])
AH_BOTTOM([
+/* enable posix_fadvise on linux */
+#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+#endif
/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
make sure you are NOT using bcopy, index or rindex in the code */
# endif
#endif
-/* enable posix_fadvise on linux */
-#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
-#define _XOPEN_SOURCE 600
-#include <fcntl.h>
-#endif
-
#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
+#endif
#ifdef NEED_MALLOC_MALLOC_H
# include <malloc/malloc.h>
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
+AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h float.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
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)
+AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
+AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
+#include <fcntl.h>])
+AC_CHECK_DECLS(madvise, [], [], [#include <sys/mman.h>])
if test "x$enable_mmap" = xyes; then
case "$host" in
struct rusage myusage;
struct timeval starttime;
struct timeval currenttime;
- struct timezone tz;
- tz.tz_minuteswest =0;
- tz.tz_dsttime=0;
- gettimeofday(&starttime,&tz);
+ gettimeofday(&starttime, NULL);
#endif
RemoteMode=1;
if ((argc == 3) && strcmp("",argv[2])){
#if HAVE_GETRUSAGE
getrusage(RUSAGE_SELF,&myusage);
- gettimeofday(¤ttime,&tz);
+ gettimeofday(¤ttime,NULL);
printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
(double)myusage.ru_utime.tv_sec+
(double)myusage.ru_utime.tv_usec/1000000.0,
#ifdef MUST_DISABLE_FPMASK
#include <floatingpoint.h>
#endif
-
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <time.h>
#include <ctype.h>
#if HAVE_SYS_PARAM_H
# include <sys/stat.h>
#endif
-
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
-#if HAVE_SYS_TIME_H
+
+#if TIME_WITH_SYS_TIME
# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
#endif
+
#if HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
+
+
#if HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#if (defined(__svr4__) && defined(__sun__))
#else
/* unix-only includes */
-#ifndef isnan
+#if !defined isnan && !defined HAVE_ISNAN
int isnan(double value);
#endif
#include <sys/types.h>
#include <fcntl.h>
#ifdef HAVE_MMAP
- #include <sys/mman.h>
+# include <sys/mman.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
#ifdef HAVE_MADVISE
/* when we use mmaping we tell the kernel the mmap equivalent
of POSIX_FADV_RANDOM */
- madvise(rrd_mmaped_file,rrd_filesize,MADV_RANDOM);
+ madvise(rrd_mmaped_file,rrd_filesize,POSIX_MADV_RANDOM);
+#endif
#endif
-#endif
/* loop through the arguments. */
for(arg_i=0; arg_i<argc;arg_i++) {
char *stepper = strdup(argv[arg_i]);