build-sys: make build work under FreeBSD

Signed-off-by: Ryan Steinmetz <zi@freebsd.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Ryan Steinmetz 2012-05-06 20:34:31 +02:00 committed by Sami Kerola
parent 7c337de651
commit 1c40d8ac1e
2 changed files with 21 additions and 0 deletions

View file

@ -26,11 +26,13 @@ LT_INIT
# Checks for header files.
AC_CHECK_HEADERS([\
arpa/inet.h \
error.h \
fcntl.h \
langinfo.h \
libintl.h \
netinet/in.h \
stddef.h \
stdio_ext.h \
stdlib.h \
string.h \
strings.h \
@ -50,6 +52,8 @@ AC_TYPE_UINT32_T
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([\
__fpending \
error \
inet_ntoa \
memset \
nl_langinfo \

View file

@ -53,13 +53,30 @@ extern void _exit();
#include <err.h>
#include <errno.h>
#ifdef HAVE_ERROR_H
#include <error.h>
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#ifdef HAVE_STDIO_EXT_H
#include <stdio_ext.h>
#endif
#include <unistd.h>
#ifndef HAVE_ERROR
#ifdef __FreeBSD__
#define error errc
#endif
#endif
#ifndef HAVE___FPENDING
static size_t __fpending(FILE * fp)
{
return (fp->_p - fp->_bf._base);
}
#endif
/* Simple memory allocation wrapper */
void *safe_malloc(const size_t size)
{