/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
make sure you are NOT using bcopy, index or rindex in the code */
-#if STDC_HEADERS
+#ifdef STDC_HEADERS
# include <string.h>
#else
# ifndef HAVE_STRCHR
# endif
#endif
+/* enable posix_fadvise on linux */
+#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
+#define __USE_XOPEN2K 1
+#include <fcntl.h>
+#endif
-#if NO_NULL_REALLOC
+#ifdef NO_NULL_REALLOC
# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
#else
# define rrd_realloc(a,b) realloc((a), (b))
#endif
-#if NEED_MALLOC_MALLOC_H
+#ifdef NEED_MALLOC_MALLOC_H
# include <malloc/malloc.h>
#endif
-#if HAVE_MATH_H
+#ifdef HAVE_MATH_H
# include <math.h>
#endif
-#if HAVE_FLOAT_H
+#ifdef HAVE_FLOAT_H
# include <float.h>
#endif
-#if HAVE_IEEEFP_H
+#ifdef HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
-#if HAVE_FP_CLASS_H
+#ifdef HAVE_FP_CLASS_H
# include <fp_class.h>
#endif
dnl for each function found we get a definition in config.h
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)
+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 posix_fadvise madvise)
if test "x$enable_mmap" = xyes; then