Mercurial > gnulib
annotate m4/log10.m4 @ 40231:9b3c79fdfe0b
strtod: fix clash with strtold
Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
* lib/strtod.c (compute_minus_zero, minus_zero):
Simplify by remving the macro / external variable,
and having just a function. User changed. This avoids
the need for an external variable that might clash.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 11 Mar 2019 16:40:29 -0700 |
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 # log10.m4 serial 9 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
39913
diff
changeset
|
2 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc. |
15865 | 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_LOG10], | |
8 [ | |
16745
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
9 m4_divert_text([DEFAULTS], [gl_log10_required=plain]) |
16736
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
10 AC_REQUIRE([gl_MATH_H_DEFAULTS]) |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
11 |
15865 | 12 dnl Determine LOG10_LIBM. |
13 gl_COMMON_DOUBLE_MATHFUNC([log10]) | |
16736
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
14 |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
15 save_LIBS="$LIBS" |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
16 LIBS="$LIBS $LOG10_LIBM" |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
17 gl_FUNC_LOG10_WORKS |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
18 LIBS="$save_LIBS" |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
19 case "$gl_cv_func_log10_works" in |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
20 *yes) ;; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
21 *) REPLACE_LOG10=1 ;; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
22 esac |
16745
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
23 |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
24 m4_ifdef([gl_FUNC_LOG10_IEEE], [ |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
25 if test $gl_log10_required = ieee && test $REPLACE_LOG10 = 0; then |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16745
diff
changeset
|
26 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
16745
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
27 AC_CACHE_CHECK([whether log10 works according to ISO C 99 with IEC 60559], |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
28 [gl_cv_func_log10_ieee], |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
29 [ |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
30 save_LIBS="$LIBS" |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
31 LIBS="$LIBS $LOG10_LIBM" |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
32 AC_RUN_IFELSE( |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
33 [AC_LANG_SOURCE([[ |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
34 #ifndef __NO_MATH_INLINES |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
35 # define __NO_MATH_INLINES 1 /* for glibc */ |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
36 #endif |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
37 #include <math.h> |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
38 /* Compare two numbers with ==. |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
39 This is a separate function because IRIX 6.5 "cc -O" miscompiles an |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
40 'x == x' test. */ |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
41 static int |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
42 numeric_equal (double x, double y) |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
43 { |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
44 return x == y; |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
45 } |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
46 static double dummy (double x) { return 0; } |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
47 int main (int argc, char *argv[]) |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
48 { |
40109
e2e6dc79463b
Defeat current GCC optimizations in math autoconf tests.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
49 double (* volatile my_log10) (double) = argc ? log10 : dummy; |
16745
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
50 /* Test log10(negative). |
39913
73d60b1f9c96
doc: Update for Solaris 11.4.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
51 This test fails on NetBSD 5.1, Solaris 11.4. */ |
16745
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
52 double y = my_log10 (-1.0); |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
53 if (numeric_equal (y, y)) |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
54 return 1; |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
55 return 0; |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
56 } |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
57 ]])], |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
58 [gl_cv_func_log10_ieee=yes], |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
59 [gl_cv_func_log10_ieee=no], |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16745
diff
changeset
|
60 [case "$host_os" in |
19479
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
19241
diff
changeset
|
61 # Guess yes on glibc systems. |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
19241
diff
changeset
|
62 *-gnu* | gnu*) gl_cv_func_log10_ieee="guessing yes" ;; |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
19241
diff
changeset
|
63 # Guess yes on native Windows. |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
19241
diff
changeset
|
64 mingw*) gl_cv_func_log10_ieee="guessing yes" ;; |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
19241
diff
changeset
|
65 # If we don't know, assume the worst. |
4bc5b8cefed7
Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents:
19241
diff
changeset
|
66 *) gl_cv_func_log10_ieee="guessing no" ;; |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16745
diff
changeset
|
67 esac |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16745
diff
changeset
|
68 ]) |
16745
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
69 LIBS="$save_LIBS" |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
70 ]) |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
71 case "$gl_cv_func_log10_ieee" in |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
72 *yes) ;; |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
73 *) REPLACE_LOG10=1 ;; |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
74 esac |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
75 fi |
78fe2a20b15c
log10-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents:
16736
diff
changeset
|
76 ]) |
15865 | 77 ]) |
16736
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
78 |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
79 dnl Test whether log10() works. |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
80 dnl On OSF/1 5.1, log10(-0.0) is NaN. |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
81 AC_DEFUN([gl_FUNC_LOG10_WORKS], |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
82 [ |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
83 AC_REQUIRE([AC_PROG_CC]) |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
84 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
85 AC_CACHE_CHECK([whether log10 works], [gl_cv_func_log10_works], |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
86 [ |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
87 AC_RUN_IFELSE( |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
88 [AC_LANG_SOURCE([[ |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
89 #include <math.h> |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
90 volatile double x; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
91 double y; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
92 int main () |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
93 { |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
94 x = -0.0; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
95 y = log10 (x); |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
96 if (!(y + y == y)) |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
97 return 1; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
98 return 0; |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
99 } |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
100 ]])], |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
101 [gl_cv_func_log10_works=yes], |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
102 [gl_cv_func_log10_works=no], |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
103 [case "$host_os" in |
18993
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
104 osf*) gl_cv_func_log10_works="guessing no" ;; |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
105 # Guess yes on native Windows. |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
106 mingw*) gl_cv_func_log10_works="guessing yes" ;; |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
107 *) gl_cv_func_log10_works="guessing yes" ;; |
16736
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
108 esac |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
109 ]) |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
110 ]) |
747e0285fa98
log10: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
111 ]) |