1 #ifndef RRD_CONFIG_BOTTOM_H
2 #define RRD_CONFIG_BOTTOM_H
4 /* make sure that we pickup the correct stuff from all headers */
12 # define _XOPEN_SOURCE 600
13 # define _BSD_SOURCE 1
14 # include <features.h>
17 /* FreeBSD 4.8 wants this included BEFORE sys/types.h */
18 #ifdef HAVE_SYS_MMAN_H
19 # include <sys/mman.h>
22 #ifdef HAVE_SYS_TYPES_H
23 # include <sys/types.h>
26 #ifdef HAVE_SYS_PARAM_H
27 # include <sys/param.h>
31 # define MAXPATH PATH_MAX
35 /* else try the BSD variant */
37 # define MAXPATH MAXPATHLEN
45 #if !defined HAVE_MADVISE && defined HAVE_POSIX_MADVISE
46 /* use posix_madvise family */
47 # define madvise posix_madvise
48 # define MADV_NORMAL POSIX_MADV_NORMAL
49 # define MADV_RANDOM POSIX_MADV_RANDOM
50 # define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
51 # define MADV_WILLNEED POSIX_MADV_WILLNEED
52 # define MADV_DONTNEED POSIX_MADV_DONTNEED
54 #if defined HAVE_MADVISE || defined HAVE_POSIX_MADVISE
55 # define USE_MADVISE 1
58 #ifdef HAVE_SYS_STAT_H
59 # include <sys/stat.h>
70 #ifdef TIME_WITH_SYS_TIME
71 # include <sys/time.h>
74 # ifdef HAVE_SYS_TIME_H
75 # include <sys/time.h>
81 #ifdef HAVE_SYS_TIMES_H
82 # include <sys/times.h>
85 #ifdef HAVE_SYS_RESOURCE_H
86 # include <sys/resource.h>
87 #if (defined(__svr4__) && defined(__sun__))
88 /* Solaris headers (pre 2.6) do not have a getrusage prototype.
90 extern int getrusage(int, struct rusage *);
91 #endif /* __svr4__ && __sun__ */
95 /* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
96 make sure you are NOT using bcopy, index or rindex in the code */
102 # define strchr index
103 # define strrchr rindex
105 char *strchr (), *strrchr ();
106 # ifndef HAVE_MEMMOVE
107 # define memcpy(d, s, n) bcopy ((s), (d), (n))
108 # define memmove(d, s, n) bcopy ((s), (d), (n))
112 #ifdef NO_NULL_REALLOC
113 # define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
115 # define rrd_realloc(a,b) realloc((a), (b))
132 # define NAMLEN(dirent) strlen((dirent)->d_name)
134 # define dirent direct
135 # define NAMLEN(dirent) (dirent)->d_namlen
136 # ifdef HAVE_SYS_NDIR_H
137 # include <sys/ndir.h>
139 # ifdef HAVE_SYS_DIR_H
140 # include <sys/dir.h>
147 #ifdef MUST_DISABLE_SIGFPE
151 #ifdef MUST_DISABLE_FPMASK
152 # include <floatingpoint.h>
168 #ifdef HAVE_FP_CLASS_H
169 # include <fp_class.h>
173 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
174 # define HAVE_ISINF 1
178 # define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
181 /* solaris 10 it defines isnan such that only forte can compile it ... bad bad */
182 #if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
184 # define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
187 /* for OSF1 Digital Unix */
188 #if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
189 # define HAVE_ISINF 1
190 # define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
193 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
194 # define HAVE_ISINF 1
195 # define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
198 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
199 # define HAVE_ISINF 1
200 # define isinf(a) (fpclassify(a) == FP_INFINITE)
204 #if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
205 # define HAVE_ISINF 1
206 # define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
209 #if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
210 # define HAVE_FINITE 1
211 # define finite(a) isfinite(a)
214 #if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
215 # define HAVE_FINITE 1
216 # define finite(a) (! isnan(a) && ! isinf(a))
220 #error "Can't compile without finite function"
224 #error "Can't compile without isinf function"
227 #if (! defined(HAVE_FDATASYNC) && defined(HAVE_FSYNC))
228 #define fdatasync fsync
231 #if (!defined(HAVE_FDATASYNC) && !defined(HAVE_FSYNC))
232 #error "Can't compile with without fsync and fdatasync"
235 #endif /* RRD_CONFIG_BOTTOM_H */