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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_EXPM1],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
16588
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
9 m4_divert_text([DEFAULTS], [gl_expm1_required=plain])
16581
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 dnl Persuade glibc <math.h> to declare expm1().
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 EXPM1_LIBM=
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 AC_CACHE_CHECK([whether expm1() can be used without linking with libm],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 [gl_cv_func_expm1_no_libm],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 [
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 AC_LINK_IFELSE(
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 [AC_LANG_PROGRAM(
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 [[#ifndef __NO_MATH_INLINES
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 # define __NO_MATH_INLINES 1 /* for glibc */
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #endif
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <math.h>
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 double (*funcptr) (double) = expm1;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 double x;]],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 [[return funcptr (x) > 0.5
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 || expm1 (x) > 0.5;]])],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 [gl_cv_func_expm1_no_libm=yes],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 [gl_cv_func_expm1_no_libm=no])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 ])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 if test $gl_cv_func_expm1_no_libm = no; then
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 AC_CACHE_CHECK([whether expm1() can be used with libm],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 [gl_cv_func_expm1_in_libm],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 [
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 save_LIBS="$LIBS"
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 LIBS="$LIBS -lm"
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 AC_LINK_IFELSE(
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 [AC_LANG_PROGRAM(
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 [[#ifndef __NO_MATH_INLINES
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # define __NO_MATH_INLINES 1 /* for glibc */
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 #endif
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 #include <math.h>
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 double (*funcptr) (double) = expm1;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 double x;]],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 [[return funcptr (x) > 0.5
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 || expm1 (x) > 0.5;]])],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 [gl_cv_func_expm1_in_libm=yes],
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 [gl_cv_func_expm1_in_libm=no])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 LIBS="$save_LIBS"
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 ])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 if test $gl_cv_func_expm1_in_libm = yes; then
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 EXPM1_LIBM=-lm
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 fi
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 fi
16588
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
56 if test $gl_cv_func_expm1_no_libm = yes \
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
57 || test $gl_cv_func_expm1_in_libm = yes; then
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
58 :
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
59 m4_ifdef([gl_FUNC_EXPM1_IEEE], [
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
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
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
62 AC_CACHE_CHECK([whether expm1 works according to ISO C 99 with IEC 60559],
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
63 [gl_cv_func_expm1_ieee],
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
64 [
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
65 save_LIBS="$LIBS"
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
66 LIBS="$LIBS $EXPM1_LIBM"
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
67 AC_RUN_IFELSE(
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
68 [AC_LANG_SOURCE([[
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
69 #ifndef __NO_MATH_INLINES
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
70 # define __NO_MATH_INLINES 1 /* for glibc */
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
71 #endif
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
72 #include <math.h>
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
73 ]gl_DOUBLE_MINUS_ZERO_CODE[
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
74 ]gl_DOUBLE_SIGNBIT_CODE[
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
75 static double dummy (double x) { return 0; }
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
76 int main (int argc, char *argv[])
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
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
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
79 double y = my_expm1 (minus_zerod);
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
80 if (!(y == 0.0) || (signbitd (minus_zerod) && !signbitd (y)))
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
81 return 1;
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
82 return 0;
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
83 }
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
84 ]])],
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
85 [gl_cv_func_expm1_ieee=yes],
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
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
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
96 LIBS="$save_LIBS"
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
97 ])
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
98 case "$gl_cv_func_expm1_ieee" in
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
99 *yes) ;;
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
100 *) REPLACE_EXPM1=1 ;;
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
101 esac
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
102 fi
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
103 ])
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
104 else
16581
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 HAVE_EXPM1=0
16588
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
106 fi
6312b64c2c23 New module 'expm1-ieee'.
Bruno Haible <bruno@clisp.org>
parents: 16581
diff changeset
107 if test $HAVE_EXPM1 = 0 || test $REPLACE_EXPM1 = 1; then
16581
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 dnl Find libraries needed to link lib/expm1.c.
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 AC_REQUIRE([gl_FUNC_ISNAND])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 AC_REQUIRE([gl_FUNC_EXP])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 AC_REQUIRE([gl_FUNC_ROUND])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 AC_REQUIRE([gl_FUNC_LDEXP])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 EXPM1_LIBM=
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 dnl Append $ISNAND_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates.
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 case " $EXPM1_LIBM " in
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 *" $ISNAND_LIBM "*) ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 *) EXPM1_LIBM="$EXPM1_LIBM $ISNAND_LIBM" ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 esac
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 dnl Append $EXP_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates.
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 case " $EXPM1_LIBM " in
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 *" $EXP_LIBM "*) ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 *) EXPM1_LIBM="$EXPM1_LIBM $EXP_LIBM" ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 esac
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 dnl Append $ROUND_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates.
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 case " $EXPM1_LIBM " in
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 *" $ROUND_LIBM "*) ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 *) EXPM1_LIBM="$EXPM1_LIBM $ROUND_LIBM" ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 esac
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 dnl Append $LDEXP_LIBM to EXPM1_LIBM, avoiding gratuitous duplicates.
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 case " $EXPM1_LIBM " in
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 *" $LDEXP_LIBM "*) ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 *) EXPM1_LIBM="$EXPM1_LIBM $LDEXP_LIBM" ;;
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 esac
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 fi
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 AC_SUBST([EXPM1_LIBM])
8e7ddab445f4 New module 'expm1'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 ])