From 1c40d8ac1ee43e6e2c7baae22ac336685f784487 Mon Sep 17 00:00:00 2001 From: Ryan Steinmetz Date: Sun, 6 May 2012 20:34:31 +0200 Subject: [PATCH] build-sys: make build work under FreeBSD Signed-off-by: Ryan Steinmetz Signed-off-by: Sami Kerola --- configure.ac | 4 ++++ src/other.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index e5cc89e..eeae1d9 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ diff --git a/src/other.c b/src/other.c index 6caf6e7..f71c55f 100644 --- a/src/other.c +++ b/src/other.c @@ -53,13 +53,30 @@ extern void _exit(); #include #include +#ifdef HAVE_ERROR_H #include +#endif #include #include #include +#ifdef HAVE_STDIO_EXT_H #include +#endif #include +#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) {