Mercurial > gnulib
annotate m4/expm1.m4 @ 40196:e63f5d3edab5
relocatable-prog: Update documentation.
* doc/relocatable-maint.texi (Supporting Relocation): Update to match
the recent changes.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 24 Feb 2019 01:49:15 +0100 |
parents | e2e6dc79463b |
children |
rev | line source |
---|---|
40109
e2e6dc79463b
Defeat current GCC optimizations in math autoconf tests.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
1 # expm1.m4 serial 6 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc. |
16581 | 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_FUNC_EXPM1], | |
8 [ | |
16588 | 9 m4_divert_text([DEFAULTS], [gl_expm1_required=plain]) |
16581 | 10 AC_REQUIRE([gl_MATH_H_DEFAULTS]) |
11 | |
12 dnl Persuade glibc <math.h> to declare expm1(). | |
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | |
14 | |
15 EXPM1_LIBM= | |
16 AC_CACHE_CHECK([whether expm1() can be used without linking with libm], | |
17 [gl_cv_func_expm1_no_libm], | |
18 [ | |
19 AC_LINK_IFELSE( | |
20 [AC_LANG_PROGRAM( | |
21 [[#ifndef __NO_MATH_INLINES | |
22 # define __NO_MATH_INLINES 1 /* for glibc */ | |
23 #endif | |
24 #include <math.h> | |
25 double (*funcptr) (double) = expm1; | |
26 double x;]], | |
27 [[return funcptr (x) > 0.5 | |
28 || expm1 (x) > 0.5;]])], | |
29 [gl_cv_func_expm1_no_libm=yes], | |
30 [gl_cv_func_expm1_no_libm=no]) | |
31 ]) | |
32 if test $gl_cv_func_expm1_no_libm = no; then | |
33 AC_CACHE_CHECK([whether expm1() can be used with libm], | |
34 [gl_cv_func_expm1_in_libm], | |
35 [ | |
36 save_LIBS="$LIBS" | |
37 LIBS="$LIBS -lm" | |
38 AC_LINK_IFELSE( | |
39 [AC_LANG_PROGRAM( | |
40 [[#ifndef __NO_MATH_INLINES | |
41 # define __NO_MATH_INLINES 1 /* for glibc */ | |
42 #endif | |
43 #include <math.h> | |
44 double (*funcptr) (double) = expm1; | |
45 double x;]], | |
46 [[return funcptr (x) > 0.5 | |
47 || expm1 (x) > 0.5;]])], | |
48 [gl_cv_func_expm1_in_libm=yes], | |
49 [gl_cv_func_expm1_in_libm=no]) | |
50 LIBS="$save_LIBS" | |
51 ]) | |
52 if test $gl_cv_func_expm1_in_libm = yes; then | |
53 EXPM1_LIBM=-lm | |
54 fi | |
55 fi | |
16588 | 56 if test $gl_cv_func_expm1_no_libm = yes \ |
57 || test $gl_cv_func_expm1_in_libm = yes; then | |
58 : | |
59 m4_ifdef([gl_FUNC_EXPM1_IEEE], [ | |
60 if test $gl_expm1_required = ieee && test $REPLACE_EXPM1 = 0; then | |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16588
diff
changeset
|
61 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
16588 | 62 AC_CACHE_CHECK([whether expm1 works according to ISO C 99 with IEC 60559], |
63 [gl_cv_func_expm1_ieee], | |
64 [ | |
65 save_LIBS="$LIBS" | |
66 LIBS="$LIBS $EXPM1_LIBM" | |
67 AC_RUN_IFELSE( | |
68 [AC_LANG_SOURCE([[ | |
69 #ifndef __NO_MATH_INLINES | |
70 # define __NO_MATH_INLINES 1 /* for glibc */ | |
71 #endif | |
72 #include <math.h> | |
73 ]gl_DOUBLE_MINUS_ZERO_CODE[ | |
74 ]gl_DOUBLE_SIGNBIT_CODE[ | |
75 static double dummy (double x) { return 0; } | |
76 int main (int argc, char *argv[]) | |
77 { | |
40109
e2e6dc79463b
Defeat current GCC optimizations in math autoconf tests.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
78 double (* volatile my_expm1) (double) = argc ? expm1 : dummy; |
16588 | 79 double y = my_expm1 (minus_zerod); |
80 if (!(y == 0.0) || (signbitd (minus_zerod) && !signbitd (y))) | |
81 return 1; | |
82 return 0; | |
83 } | |
84 ]])], | |
85 [gl_cv_func_expm1_ieee=yes], | |
86 [gl_cv_func_expm1_ieee=no], | |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16588
diff
changeset
|
87 [case "$host_os" in |
19479
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
18993
diff
changeset
|
88 # Guess yes on glibc systems. |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
18993
diff
changeset
|
89 *-gnu* | gnu*) gl_cv_func_expm1_ieee="guessing yes" ;; |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
18993
diff
changeset
|
90 # Guess yes on native Windows. |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
18993
diff
changeset
|
91 mingw*) gl_cv_func_expm1_ieee="guessing yes" ;; |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
18993
diff
changeset
|
92 # If we don't know, assume the worst. |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
18993
diff
changeset
|
93 *) gl_cv_func_expm1_ieee="guessing no" ;; |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16588
diff
changeset
|
94 esac |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16588
diff
changeset
|
95 ]) |
16588 | 96 LIBS="$save_LIBS" |
97 ]) | |
98 case "$gl_cv_func_expm1_ieee" in | |
99 *yes) ;; | |
100 *) REPLACE_EXPM1=1 ;; | |
101 esac | |
102 fi | |
103 ]) | |
104 else | |
16581 | 105 HAVE_EXPM1=0 |
16588 | 106 fi |
107 if test $HAVE_EXPM1 = 0 || test $REPLACE_EXPM1 = 1; then | |
16581 | 108 dnl Find libraries needed to link lib/expm1.c. |
109 AC_REQUIRE([gl_FUNC_ISNAND]) | |
110 AC_REQUIRE([gl_FUNC_EXP]) | |
111 AC_REQUIRE([gl_FUNC_ROUND]) | |
112 AC_REQUIRE([gl_FUNC_LDEXP]) | |
113 EXPM1_LIBM= | |
114 dnl Append $ISNAND_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates. | |
115 case " $EXPM1_LIBM " in | |
116 *" $ISNAND_LIBM "*) ;; | |
117 *) EXPM1_LIBM="$EXPM1_LIBM $ISNAND_LIBM" ;; | |
118 esac | |
119 dnl Append $EXP_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates. | |
120 case " $EXPM1_LIBM " in | |
121 *" $EXP_LIBM "*) ;; | |
122 *) EXPM1_LIBM="$EXPM1_LIBM $EXP_LIBM" ;; | |
123 esac | |
124 dnl Append $ROUND_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates. | |
125 case " $EXPM1_LIBM " in | |
126 *" $ROUND_LIBM "*) ;; | |
127 *) EXPM1_LIBM="$EXPM1_LIBM $ROUND_LIBM" ;; | |
128 esac | |
129 dnl Append $LDEXP_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates. | |
130 case " $EXPM1_LIBM " in | |
131 *" $LDEXP_LIBM "*) ;; | |
132 *) EXPM1_LIBM="$EXPM1_LIBM $LDEXP_LIBM" ;; | |
133 esac | |
134 fi | |
135 AC_SUBST([EXPM1_LIBM]) | |
136 ]) |