annotate m4/log.m4 @ 39913:73d60b1f9c96

doc: Update for Solaris 11.4. * doc/**/*.texi: For bugs that exist in both Solaris 11.3 and 11.4, mention Solaris 11.4. * m4/printf.m4: Update comments about Solaris. * m4/log.m4: Likewise. * m4/log10.m4: Likewise. * m4/logb.m4: Likewise. * m4/logbf.m4: Likewise. * m4/logbl.m4: Likewise. * m4/rename.m4: Likewise. * m4/wcrtomb.m4: Likewise. * m4/hostent.m4: Likewise. * m4/servent.m4: Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 14 Oct 2018 09:33:46 +0200
parents 10eb9086bea0
children b06060465f09
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39913
73d60b1f9c96 doc: Update for Solaris 11.4.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
1 # log.m4 serial 8
19484
10eb9086bea0 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19479
diff changeset
2 dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
15862
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_LOG],
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
16643
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
9 m4_divert_text([DEFAULTS], [gl_log_required=plain])
16636
521c2cde0e31 log: Fix bug introduced on 2012-03-09.
Bruno Haible <bruno@clisp.org>
parents: 16631
diff changeset
10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
521c2cde0e31 log: Fix bug introduced on 2012-03-09.
Bruno Haible <bruno@clisp.org>
parents: 16631
diff changeset
11
15862
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 dnl Determine LOG_LIBM.
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 gl_COMMON_DOUBLE_MATHFUNC([log])
16631
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
14
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
15 save_LIBS="$LIBS"
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
16 LIBS="$LIBS $LOG_LIBM"
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
17 gl_FUNC_LOG_WORKS
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
18 LIBS="$save_LIBS"
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
19 case "$gl_cv_func_log_works" in
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
20 *yes) ;;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
21 *) REPLACE_LOG=1 ;;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
22 esac
16643
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
23
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
24 m4_ifdef([gl_FUNC_LOG_IEEE], [
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
25 if test $gl_log_required = ieee && test $REPLACE_LOG = 0; then
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16643
diff changeset
26 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
16643
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
27 AC_CACHE_CHECK([whether log works according to ISO C 99 with IEC 60559],
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
28 [gl_cv_func_log_ieee],
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
29 [
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
30 save_LIBS="$LIBS"
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
31 LIBS="$LIBS $LOG_LIBM"
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
32 AC_RUN_IFELSE(
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
33 [AC_LANG_SOURCE([[
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
34 #ifndef __NO_MATH_INLINES
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
35 # define __NO_MATH_INLINES 1 /* for glibc */
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
36 #endif
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
37 #include <math.h>
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
38 /* Compare two numbers with ==.
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
39 This is a separate function because IRIX 6.5 "cc -O" miscompiles an
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
40 'x == x' test. */
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
41 static int
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
42 numeric_equal (double x, double y)
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
43 {
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
44 return x == y;
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
45 }
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
46 static double dummy (double x) { return 0; }
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
47 int main (int argc, char *argv[])
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
48 {
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
49 double (*my_log) (double) = argc ? log : dummy;
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
50 /* Test log(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. */
16643
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
52 double y = my_log (-1.0);
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
53 if (numeric_equal (y, y))
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
54 return 1;
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
55 return 0;
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
56 }
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
57 ]])],
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
58 [gl_cv_func_log_ieee=yes],
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
59 [gl_cv_func_log_ieee=no],
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16643
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_log_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_log_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_log_ieee="guessing no" ;;
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16643
diff changeset
67 esac
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16643
diff changeset
68 ])
16643
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
69 LIBS="$save_LIBS"
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
70 ])
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
71 case "$gl_cv_func_log_ieee" in
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
72 *yes) ;;
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
73 *) REPLACE_LOG=1 ;;
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
74 esac
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
75 fi
90bb29c30680 log-ieee: Work around test failure on NetBSD 5.1 and Solaris 11.
Bruno Haible <bruno@clisp.org>
parents: 16636
diff changeset
76 ])
15862
e369ba8115ea log: Use a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 ])
16631
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
78
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
79 dnl Test whether log() works.
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
80 dnl On OSF/1 5.1, log(-0.0) is NaN.
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
81 AC_DEFUN([gl_FUNC_LOG_WORKS],
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
82 [
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
83 AC_REQUIRE([AC_PROG_CC])
45443deebb7d log: 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
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
85 AC_CACHE_CHECK([whether log works], [gl_cv_func_log_works],
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
86 [
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
87 AC_RUN_IFELSE(
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
88 [AC_LANG_SOURCE([[
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
89 #include <math.h>
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
90 volatile double x;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
91 double y;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
92 int main ()
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
93 {
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
94 x = -0.0;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
95 y = log (x);
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
96 if (!(y + y == y))
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
97 return 1;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
98 return 0;
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
99 }
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
100 ]])],
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
101 [gl_cv_func_log_works=yes],
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
102 [gl_cv_func_log_works=no],
45443deebb7d log: 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_log_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_log_works="guessing yes" ;;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
107 *) gl_cv_func_log_works="guessing yes" ;;
16631
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
108 esac
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
109 ])
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
110 ])
45443deebb7d log: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
111 ])