New module 'acosf'.
[gnulib.git] / m4 / math_h.m4
1 # math_h.m4 serial 41
2 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_MATH_H],
8 [
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10   gl_CHECK_NEXT_HEADERS([math.h])
11   AC_REQUIRE([AC_C_INLINE])
12
13   AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
14     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
15       [[/* Solaris 10 has a broken definition of NAN.  Other platforms
16         fail to provide NAN, or provide it only in C99 mode; this
17         test only needs to fail when NAN is provided but wrong.  */
18          float f = 1.0f;
19 #ifdef NAN
20          f = NAN;
21 #endif
22          return f == 0;]])],
23       [gl_cv_header_math_nan_works=yes],
24       [gl_cv_header_math_nan_works=no])])
25   if test $gl_cv_header_math_nan_works = no; then
26     REPLACE_NAN=1
27   fi
28   AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
29     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
30       [[/* Solaris 10 has a broken definition of HUGE_VAL.  */
31          double d = HUGE_VAL;
32          return d == 0;]])],
33       [gl_cv_header_math_huge_val_works=yes],
34       [gl_cv_header_math_huge_val_works=no])])
35   if test $gl_cv_header_math_huge_val_works = no; then
36     REPLACE_HUGE_VAL=1
37   fi
38
39   dnl Check for declarations of anything we want to poison if the
40   dnl corresponding gnulib module is not in use.
41   gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
42     [acosf acosl asinf asinl atanl ceilf ceill cosf cosl
43      expf expl fabsf floorf floorl fmodf frexpf frexpl
44      ldexpf ldexpl logb logf logl log10f modff powf
45      round roundf roundl sinf sinl sqrtf sqrtl
46      tanf tanl trunc truncf truncl])
47 ])
48
49 AC_DEFUN([gl_MATH_MODULE_INDICATOR],
50 [
51   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
52   AC_REQUIRE([gl_MATH_H_DEFAULTS])
53   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
54   dnl Define it also as a C macro, for the benefit of the unit tests.
55   gl_MODULE_INDICATOR_FOR_TESTS([$1])
56 ])
57
58 AC_DEFUN([gl_MATH_H_DEFAULTS],
59 [
60   GNULIB_ACOSF=0;    AC_SUBST([GNULIB_ACOSF])
61   GNULIB_ACOSL=0;    AC_SUBST([GNULIB_ACOSL])
62   GNULIB_ASINF=0;    AC_SUBST([GNULIB_ASINF])
63   GNULIB_ASINL=0;    AC_SUBST([GNULIB_ASINL])
64   GNULIB_ATANL=0;    AC_SUBST([GNULIB_ATANL])
65   GNULIB_CEIL=0;     AC_SUBST([GNULIB_CEIL])
66   GNULIB_CEILF=0;    AC_SUBST([GNULIB_CEILF])
67   GNULIB_CEILL=0;    AC_SUBST([GNULIB_CEILL])
68   GNULIB_COSF=0;     AC_SUBST([GNULIB_COSF])
69   GNULIB_COSL=0;     AC_SUBST([GNULIB_COSL])
70   GNULIB_EXPF=0;     AC_SUBST([GNULIB_EXPF])
71   GNULIB_EXPL=0;     AC_SUBST([GNULIB_EXPL])
72   GNULIB_FABSF=0;    AC_SUBST([GNULIB_FABSF])
73   GNULIB_FLOOR=0;    AC_SUBST([GNULIB_FLOOR])
74   GNULIB_FLOORF=0;   AC_SUBST([GNULIB_FLOORF])
75   GNULIB_FLOORL=0;   AC_SUBST([GNULIB_FLOORL])
76   GNULIB_FMODF=0;    AC_SUBST([GNULIB_FMODF])
77   GNULIB_FREXPF=0;   AC_SUBST([GNULIB_FREXPF])
78   GNULIB_FREXP=0;    AC_SUBST([GNULIB_FREXP])
79   GNULIB_FREXPL=0;   AC_SUBST([GNULIB_FREXPL])
80   GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
81   GNULIB_ISINF=0;    AC_SUBST([GNULIB_ISINF])
82   GNULIB_ISNAN=0;    AC_SUBST([GNULIB_ISNAN])
83   GNULIB_ISNANF=0;   AC_SUBST([GNULIB_ISNANF])
84   GNULIB_ISNAND=0;   AC_SUBST([GNULIB_ISNAND])
85   GNULIB_ISNANL=0;   AC_SUBST([GNULIB_ISNANL])
86   GNULIB_LDEXPF=0;   AC_SUBST([GNULIB_LDEXPF])
87   GNULIB_LDEXPL=0;   AC_SUBST([GNULIB_LDEXPL])
88   GNULIB_LOGB=0;     AC_SUBST([GNULIB_LOGB])
89   GNULIB_LOGF=0;     AC_SUBST([GNULIB_LOGF])
90   GNULIB_LOGL=0;     AC_SUBST([GNULIB_LOGL])
91   GNULIB_LOG10F=0;   AC_SUBST([GNULIB_LOG10F])
92   GNULIB_MODFF=0;    AC_SUBST([GNULIB_MODFF])
93   GNULIB_POWF=0;     AC_SUBST([GNULIB_POWF])
94   GNULIB_ROUND=0;    AC_SUBST([GNULIB_ROUND])
95   GNULIB_ROUNDF=0;   AC_SUBST([GNULIB_ROUNDF])
96   GNULIB_ROUNDL=0;   AC_SUBST([GNULIB_ROUNDL])
97   GNULIB_SIGNBIT=0;  AC_SUBST([GNULIB_SIGNBIT])
98   GNULIB_SINF=0;     AC_SUBST([GNULIB_SINF])
99   GNULIB_SINL=0;     AC_SUBST([GNULIB_SINL])
100   GNULIB_SQRTF=0;    AC_SUBST([GNULIB_SQRTF])
101   GNULIB_SQRTL=0;    AC_SUBST([GNULIB_SQRTL])
102   GNULIB_TANF=0;     AC_SUBST([GNULIB_TANF])
103   GNULIB_TANL=0;     AC_SUBST([GNULIB_TANL])
104   GNULIB_TRUNC=0;    AC_SUBST([GNULIB_TRUNC])
105   GNULIB_TRUNCF=0;   AC_SUBST([GNULIB_TRUNCF])
106   GNULIB_TRUNCL=0;   AC_SUBST([GNULIB_TRUNCL])
107   dnl Assume proper GNU behavior unless another module says otherwise.
108   HAVE_ACOSF=1;                AC_SUBST([HAVE_ACOSF])
109   HAVE_ACOSL=1;                AC_SUBST([HAVE_ACOSL])
110   HAVE_ASINF=1;                AC_SUBST([HAVE_ASINF])
111   HAVE_ASINL=1;                AC_SUBST([HAVE_ASINL])
112   HAVE_ATANL=1;                AC_SUBST([HAVE_ATANL])
113   HAVE_COSF=1;                 AC_SUBST([HAVE_COSF])
114   HAVE_COSL=1;                 AC_SUBST([HAVE_COSL])
115   HAVE_EXPF=1;                 AC_SUBST([HAVE_EXPF])
116   HAVE_EXPL=1;                 AC_SUBST([HAVE_EXPL])
117   HAVE_FABSF=1;                AC_SUBST([HAVE_FABSF])
118   HAVE_FMODF=1;                AC_SUBST([HAVE_FMODF])
119   HAVE_FREXPF=1;               AC_SUBST([HAVE_FREXPF])
120   HAVE_ISNANF=1;               AC_SUBST([HAVE_ISNANF])
121   HAVE_ISNAND=1;               AC_SUBST([HAVE_ISNAND])
122   HAVE_ISNANL=1;               AC_SUBST([HAVE_ISNANL])
123   HAVE_LDEXPF=1;               AC_SUBST([HAVE_LDEXPF])
124   HAVE_LOGF=1;                 AC_SUBST([HAVE_LOGF])
125   HAVE_LOGL=1;                 AC_SUBST([HAVE_LOGL])
126   HAVE_LOG10F=1;               AC_SUBST([HAVE_LOG10F])
127   HAVE_MODFF=1;                AC_SUBST([HAVE_MODFF])
128   HAVE_POWF=1;                 AC_SUBST([HAVE_POWF])
129   HAVE_SINF=1;                 AC_SUBST([HAVE_SINF])
130   HAVE_SINL=1;                 AC_SUBST([HAVE_SINL])
131   HAVE_SQRTF=1;                AC_SUBST([HAVE_SQRTF])
132   HAVE_SQRTL=1;                AC_SUBST([HAVE_SQRTL])
133   HAVE_TANF=1;                 AC_SUBST([HAVE_TANF])
134   HAVE_TANL=1;                 AC_SUBST([HAVE_TANL])
135   HAVE_DECL_ACOSL=1;           AC_SUBST([HAVE_DECL_ACOSL])
136   HAVE_DECL_ASINL=1;           AC_SUBST([HAVE_DECL_ASINL])
137   HAVE_DECL_ATANL=1;           AC_SUBST([HAVE_DECL_ATANL])
138   HAVE_DECL_CEILF=1;           AC_SUBST([HAVE_DECL_CEILF])
139   HAVE_DECL_CEILL=1;           AC_SUBST([HAVE_DECL_CEILL])
140   HAVE_DECL_COSL=1;            AC_SUBST([HAVE_DECL_COSL])
141   HAVE_DECL_EXPL=1;            AC_SUBST([HAVE_DECL_EXPL])
142   HAVE_DECL_FLOORF=1;          AC_SUBST([HAVE_DECL_FLOORF])
143   HAVE_DECL_FLOORL=1;          AC_SUBST([HAVE_DECL_FLOORL])
144   HAVE_DECL_FREXPL=1;          AC_SUBST([HAVE_DECL_FREXPL])
145   HAVE_DECL_LDEXPL=1;          AC_SUBST([HAVE_DECL_LDEXPL])
146   HAVE_DECL_LOGB=1;            AC_SUBST([HAVE_DECL_LOGB])
147   HAVE_DECL_LOGL=1;            AC_SUBST([HAVE_DECL_LOGL])
148   HAVE_DECL_ROUND=1;           AC_SUBST([HAVE_DECL_ROUND])
149   HAVE_DECL_ROUNDF=1;          AC_SUBST([HAVE_DECL_ROUNDF])
150   HAVE_DECL_ROUNDL=1;          AC_SUBST([HAVE_DECL_ROUNDL])
151   HAVE_DECL_SINL=1;            AC_SUBST([HAVE_DECL_SINL])
152   HAVE_DECL_SQRTL=1;           AC_SUBST([HAVE_DECL_SQRTL])
153   HAVE_DECL_TANL=1;            AC_SUBST([HAVE_DECL_TANL])
154   HAVE_DECL_TRUNC=1;           AC_SUBST([HAVE_DECL_TRUNC])
155   HAVE_DECL_TRUNCF=1;          AC_SUBST([HAVE_DECL_TRUNCF])
156   HAVE_DECL_TRUNCL=1;          AC_SUBST([HAVE_DECL_TRUNCL])
157   REPLACE_CEIL=0;              AC_SUBST([REPLACE_CEIL])
158   REPLACE_CEILF=0;             AC_SUBST([REPLACE_CEILF])
159   REPLACE_CEILL=0;             AC_SUBST([REPLACE_CEILL])
160   REPLACE_FLOOR=0;             AC_SUBST([REPLACE_FLOOR])
161   REPLACE_FLOORF=0;            AC_SUBST([REPLACE_FLOORF])
162   REPLACE_FLOORL=0;            AC_SUBST([REPLACE_FLOORL])
163   REPLACE_FREXPF=0;            AC_SUBST([REPLACE_FREXPF])
164   REPLACE_FREXP=0;             AC_SUBST([REPLACE_FREXP])
165   REPLACE_FREXPL=0;            AC_SUBST([REPLACE_FREXPL])
166   REPLACE_HUGE_VAL=0;          AC_SUBST([REPLACE_HUGE_VAL])
167   REPLACE_ISFINITE=0;          AC_SUBST([REPLACE_ISFINITE])
168   REPLACE_ISINF=0;             AC_SUBST([REPLACE_ISINF])
169   REPLACE_ISNAN=0;             AC_SUBST([REPLACE_ISNAN])
170   REPLACE_LDEXPL=0;            AC_SUBST([REPLACE_LDEXPL])
171   REPLACE_NAN=0;               AC_SUBST([REPLACE_NAN])
172   REPLACE_ROUND=0;             AC_SUBST([REPLACE_ROUND])
173   REPLACE_ROUNDF=0;            AC_SUBST([REPLACE_ROUNDF])
174   REPLACE_ROUNDL=0;            AC_SUBST([REPLACE_ROUNDL])
175   REPLACE_SIGNBIT=0;           AC_SUBST([REPLACE_SIGNBIT])
176   REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
177   REPLACE_TRUNC=0;             AC_SUBST([REPLACE_TRUNC])
178   REPLACE_TRUNCF=0;            AC_SUBST([REPLACE_TRUNCF])
179   REPLACE_TRUNCL=0;            AC_SUBST([REPLACE_TRUNCL])
180 ])