eac8a944c3fecefc57d3f08f1db6051c7a6b5298
[rrdtool.git] / config / acconfig.h
1 #ifndef CONFIG_H
2 #define CONFIG_H
3
4 @TOP@
5
6 /* IEEE can be prevented from raising signals with fpsetmask(0) */
7 #undef MUST_DISABLE_FPMASK
8
9 /* IEEE math only works if SIGFPE gets actively set to IGNORE */
10
11 #undef MUST_DISABLE_SIGFPE
12
13 /* realloc does not support NULL as argument */
14 #undef NO_NULL_REALLOC
15
16 @BOTTOM@
17
18 /* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
19    make sure you are NOT using bcopy, index or rindex in the code */
20       
21 #if STDC_HEADERS
22 # include <string.h>
23 #else
24 # ifndef HAVE_STRCHR
25 #  define strchr index
26 #  define strrchr rindex
27 # endif
28 char *strchr (), *strrchr ();
29 # ifndef HAVE_MEMMOVE
30 #  define memcpy(d, s, n) bcopy ((s), (d), (n))
31 #  define memmove(d, s, n) bcopy ((s), (d), (n))
32 # endif
33 #endif
34
35
36 #if NO_NULL_REALLOC
37 # define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
38 #else
39 # define rrd_realloc(a,b) realloc((a), (b))
40 #endif      
41
42 #if HAVE_MATH_H
43 #  include <math.h>
44 #endif
45
46 #if HAVE_FLOAT_H
47 #  include <float.h>
48 #endif
49
50 #if HAVE_IEEEFP_H
51 #  include <ieeefp.h>
52 #endif
53
54 #if HAVE_FP_CLASS_H
55 #  include <fp_class.h>
56 #endif
57
58 /* for Solaris */
59 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
60 #  define HAVE_ISINF 1
61 #  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
62 #endif
63
64 /* for OSF1 Digital Unix */
65 #if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
66 #  define HAVE_ISINF 1
67 #  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
68 #endif
69
70 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
71 #  define HAVE_ISINF 1
72 #  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
73 #endif
74
75 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
76 #  define HAVE_ISINF 1
77 #  define isinf(a) (fpclassify(a) == FP_INFINITE)
78 #endif
79
80 /* for AIX */
81 #if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
82 #  define HAVE_ISINF 1
83 #  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
84 #endif
85
86 #if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
87 #  define HAVE_FINITE 1
88 #  define finite(a) isfinite(a)
89 #endif
90
91 #if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
92 #  define HAVE_FINITE 1
93 #  define finite(a) (! isnan(a) && ! isinf(a))
94 #endif
95
96 #ifndef HAVE_FINITE
97 #error "Can't compile without finite function"
98 #endif
99
100 #ifndef HAVE_ISINF
101 #error "Can't compile without isinf function"
102 #endif
103
104 #endif /* CONFIG_H */
105