* replaced strtok with strtok_r for thread safety
[rrdtool.git] / configure.ac
index a889daa..7d77122 100644 (file)
@@ -49,12 +49,22 @@ AH_TOP([
 /* realloc does not support NULL as argument */
 #undef NO_NULL_REALLOC
 
+/* lets enable madvise defines in NetBSD */ 
+#if defined(__NetBSD__)
+# if !defined(_NETBSD_SOURCE)
+#  define _NETBSD_SOURCE
+# endif
+#endif
+
  ])
 
 AH_BOTTOM([
 /* make sure that we pickup the correct stuff from all headers */
-#define _XOPEN_SOURCE 600
 #ifdef HAVE_FEATURES_H
+#undef _XOPEN_SOURCE /* keep unmodified */
+#undef _BSD_SOURCE /* keep unmodified */
+#define _XOPEN_SOURCE 600
+#define _BSD_SOURCE 1
 # include <features.h>
 #endif
 
@@ -84,6 +94,7 @@ AH_BOTTOM([
 #ifdef HAVE_SYS_MMAN_H
 # include <sys/mman.h>
 #endif
+
 #if !defined HAVE_MADVISE && defined HAVE_POSIX_MADVISE
 /* use posix_madvise family */
 # define madvise posix_madvise
@@ -218,12 +229,15 @@ char *strchr (), *strrchr ();
 /* for Solaris */
 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
 #  define HAVE_ISINF 1
+#  ifdef isinf
+#  undef isinf /* confuse autoconf */
+#  endif
 #  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
 #endif
 
 /* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
 #if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
-#  undef isnan
+#  undef isnan /* confuse autoconf to NOT remove this */
 #  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
 #endif
 
@@ -325,7 +339,7 @@ CFLAGS="$CFLAGS -D_GNU_SOURCE"
 
 dnl which flags does the compiler support?
 if test "x$GCC" = "xyes"; then
-  for flag in -fno-strict-aliasing -Wall -std=c99 -pedantic -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wc++-compat -Wold-style-definition -W; do
+  for flag in -fno-strict-aliasing -Wall -std=c99 -pedantic -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wold-style-definition -W; do
     oCFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $flag"
     cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'`
@@ -356,6 +370,7 @@ AC_STRUCT_TM
 dnl Checks for libraries.
 AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
 
+
 dnl add pic flag in any case this makes sure all our code is relocatable
 eval `./libtool --config | grep pic_flag`
 CFLAGS="$CFLAGS $pic_flag"
@@ -373,8 +388,6 @@ dnl of the form HAVE_FUNCTION
 
 AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday)
 
-dnl Could use these to know if we need to provide a prototype
-dnl AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
 
 dnl XXX: dunno about windows.. add AC_CHECK_FUNCS(munmap) there too?
 if test "x$enable_mmap" = "xyes"; then
@@ -567,6 +580,14 @@ AC_LINK_IFELSE(
 )
 AC_LANG_POP(C)
 
+dnl Could use these to know if we need to provide a prototype
+dnl AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
+
+dnl solaris has fdatasync in the librt
+
+AC_CHECK_FUNC(fdatasync, [],  AC_CHECK_LIB(rt, fdatasync, [LIBS="${LIBS} -lrt"],[]))
+
+
 CONFIGURE_PART(Find 3rd-Party Libraries)