summaryrefslogtreecommitdiffstats
path: root/gl/m4/math_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/math_h.m4')
-rw-r--r--gl/m4/math_h.m453
1 files changed, 45 insertions, 8 deletions
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4
index d941bc3..2d89ca3 100644
--- a/gl/m4/math_h.m4
+++ b/gl/m4/math_h.m4
@@ -1,5 +1,5 @@
1# math_h.m4 serial 14 1# math_h.m4 serial 21
2dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,6 +8,8 @@ AC_DEFUN([gl_MATH_H],
8[ 8[
9 AC_REQUIRE([gl_MATH_H_DEFAULTS]) 9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 gl_CHECK_NEXT_HEADERS([math.h]) 10 gl_CHECK_NEXT_HEADERS([math.h])
11 AC_REQUIRE([AC_C_INLINE])
12
11 AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], 13 AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
12 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], 14 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
13 [[/* Solaris 10 has a broken definition of NAN. Other platforms 15 [[/* Solaris 10 has a broken definition of NAN. Other platforms
@@ -15,9 +17,9 @@ AC_DEFUN([gl_MATH_H],
15 test only needs to fail when NAN is provided but wrong. */ 17 test only needs to fail when NAN is provided but wrong. */
16 float f = 1.0f; 18 float f = 1.0f;
17#ifdef NAN 19#ifdef NAN
18 f = NAN; 20 f = NAN;
19#endif 21#endif
20 return f == 0;]])], 22 return f == 0;]])],
21 [gl_cv_header_math_nan_works=yes], 23 [gl_cv_header_math_nan_works=yes],
22 [gl_cv_header_math_nan_works=no])]) 24 [gl_cv_header_math_nan_works=no])])
23 if test $gl_cv_header_math_nan_works = no; then 25 if test $gl_cv_header_math_nan_works = no; then
@@ -26,26 +28,39 @@ AC_DEFUN([gl_MATH_H],
26 AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], 28 AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
27 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], 29 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
28 [[/* Solaris 10 has a broken definition of HUGE_VAL. */ 30 [[/* Solaris 10 has a broken definition of HUGE_VAL. */
29 double d = HUGE_VAL; 31 double d = HUGE_VAL;
30 return d == 0;]])], 32 return d == 0;]])],
31 [gl_cv_header_math_huge_val_works=yes], 33 [gl_cv_header_math_huge_val_works=yes],
32 [gl_cv_header_math_huge_val_works=no])]) 34 [gl_cv_header_math_huge_val_works=no])])
33 if test $gl_cv_header_math_huge_val_works = no; then 35 if test $gl_cv_header_math_huge_val_works = no; then
34 REPLACE_HUGE_VAL=1 36 REPLACE_HUGE_VAL=1
35 fi 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 ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
43 ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
36]) 44])
37 45
38AC_DEFUN([gl_MATH_MODULE_INDICATOR], 46AC_DEFUN([gl_MATH_MODULE_INDICATOR],
39[ 47[
40 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 48 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
41 AC_REQUIRE([gl_MATH_H_DEFAULTS]) 49 AC_REQUIRE([gl_MATH_H_DEFAULTS])
42 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 50 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
51 dnl Define it also as a C macro, for the benefit of the unit tests.
52 gl_MODULE_INDICATOR_FOR_TESTS([$1])
43]) 53])
44 54
45AC_DEFUN([gl_MATH_H_DEFAULTS], 55AC_DEFUN([gl_MATH_H_DEFAULTS],
46[ 56[
57 GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL])
58 GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL])
59 GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL])
47 GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) 60 GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF])
48 GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) 61 GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL])
62 GNULIB_COSL=0; AC_SUBST([GNULIB_COSL])
63 GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
49 GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) 64 GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
50 GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) 65 GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
51 GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) 66 GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
@@ -57,31 +72,53 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
57 GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) 72 GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
58 GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) 73 GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
59 GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) 74 GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
60 GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) 75 GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
76 GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
61 GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) 77 GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
62 GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) 78 GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
63 GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) 79 GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL])
64 GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) 80 GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT])
81 GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
82 GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
83 GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
65 GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) 84 GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
66 GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) 85 GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
67 GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) 86 GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
68 dnl Assume proper GNU behavior unless another module says otherwise. 87 dnl Assume proper GNU behavior unless another module says otherwise.
88 HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL])
89 HAVE_ASINL=1; AC_SUBST([HAVE_ASINL])
90 HAVE_ATANL=1; AC_SUBST([HAVE_ATANL])
91 HAVE_COSL=1; AC_SUBST([HAVE_COSL])
92 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
69 HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) 93 HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
70 HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) 94 HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
71 HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) 95 HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
96 HAVE_LOGL=1; AC_SUBST([HAVE_LOGL])
97 HAVE_SINL=1; AC_SUBST([HAVE_SINL])
98 HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
99 HAVE_TANL=1; AC_SUBST([HAVE_TANL])
72 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) 100 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
73 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) 101 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
74 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) 102 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
103 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
104 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
75 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) 105 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
76 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) 106 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
107 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
108 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
77 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) 109 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
78 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) 110 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
111 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
79 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) 112 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
113 HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
114 HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
115 HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
80 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) 116 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
81 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) 117 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
82 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) 118 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
83 HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) 119 HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
84 HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) 120 HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
121 HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
85 REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) 122 REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
86 REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) 123 REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
87 REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) 124 REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])