annotate m4/modfl.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 # modfl.m4 serial 6
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_MODFL],
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
9 m4_divert_text([DEFAULTS], [gl_modfl_required=plain])
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12
16580
fdbe3125f81a math: Ensure declarations of math functions.
Bruno Haible <bruno@clisp.org>
parents: 16490
diff changeset
13 dnl Persuade glibc <math.h> to declare modfl().
fdbe3125f81a math: Ensure declarations of math functions.
Bruno Haible <bruno@clisp.org>
parents: 16490
diff changeset
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
fdbe3125f81a math: Ensure declarations of math functions.
Bruno Haible <bruno@clisp.org>
parents: 16490
diff changeset
15
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 dnl Test whether modfl() exists. We cannot assume that modfl(), if it
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 dnl exists, is defined in the same library as modf(). This is not the case
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 dnl on FreeBSD, Solaris.
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 gl_MATHFUNC([modfl], [long double], [(long double, long double *)])
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
20 if test $gl_cv_func_modfl_no_libm = yes \
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
21 || test $gl_cv_func_modfl_in_libm = yes; then
16490
0d1fd31a3ea0 modff, modfl: Fix configure syntax error.
Bruno Haible <bruno@clisp.org>
parents: 16471
diff changeset
22 :
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
23 m4_ifdef([gl_FUNC_MODFL_IEEE], [
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
24 if test $gl_modfl_required = ieee && test $REPLACE_MODFL = 0; then
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
25 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
26 AC_CACHE_CHECK([whether modfl works according to ISO C 99 with IEC 60559],
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
27 [gl_cv_func_modfl_ieee],
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
28 [
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
29 save_LIBS="$LIBS"
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
30 LIBS="$LIBS $MODFL_LIBM"
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
31 AC_RUN_IFELSE(
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
32 [AC_LANG_SOURCE([[
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
33 #ifndef __NO_MATH_INLINES
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
34 # define __NO_MATH_INLINES 1 /* for glibc */
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
35 #endif
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
36 #include <math.h>
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
37 ]gl_LONG_DOUBLE_MINUS_ZERO_CODE[
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
38 ]gl_LONG_DOUBLE_SIGNBIT_CODE[
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
39 /* Compare two numbers with ==.
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
40 This is a separate function because IRIX 6.5 "cc -O" miscompiles an
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
41 'x == x' test. */
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
42 static int
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
43 numeric_equal (long double x, long double y)
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
44 {
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
45 return x == y;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
46 }
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
47 static long double dummy (long double x, long double *iptr) { return 0; }
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
48 long double zero;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
49 long double minus_one = - 1.0L;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
50 int main (int argc, char *argv[])
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
51 {
40109
e2e6dc79463b Defeat current GCC optimizations in math autoconf tests.
Bruno Haible <bruno@clisp.org>
parents: 40057
diff changeset
52 long double (* volatile my_modfl) (long double, long double *) = argc ? modfl : dummy;
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
53 long double i;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
54 long double f;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
55 /* Test modfl(-Inf,...).
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
56 This test fails on IRIX 6.5, OSF/1 5.1, mingw. */
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
57 f = my_modfl (minus_one / zero, &i);
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
58 if (!(f == 0.0L) || (signbitl (minus_zerol) && !signbitl (f)))
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
59 return 1;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
60 return 0;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
61 }
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
62 ]])],
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
63 [gl_cv_func_modfl_ieee=yes],
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
64 [gl_cv_func_modfl_ieee=no],
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
65 [case "$host_os" in
19479
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
66 # Guess yes on glibc systems.
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
67 *-gnu* | gnu*) gl_cv_func_modfl_ieee="guessing yes" ;;
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
68 # Guess yes on MSVC, no on mingw.
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
69 mingw*) AC_EGREP_CPP([Known], [
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
70 #ifdef _MSC_VER
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
71 Known
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
72 #endif
19479
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
73 ],
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
74 [gl_cv_func_modfl_ieee="guessing yes"],
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
75 [gl_cv_func_modfl_ieee="guessing no"])
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
76 ;;
4bc5b8cefed7 Add cross-compilation results for GNU/Hurd.
Samuel Thibault <samuel.thibault@gnu.org>
parents: 18993
diff changeset
77 # 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
78 *) gl_cv_func_modfl_ieee="guessing no" ;;
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
79 esac
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
80 ])
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
81 LIBS="$save_LIBS"
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
82 ])
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
83 case "$gl_cv_func_modfl_ieee" in
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
84 *yes) ;;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
85 *) REPLACE_MODFL=1 ;;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
86 esac
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
87 fi
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
88 ])
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
89 else
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 HAVE_MODFL=0
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
91 fi
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
92 if test $HAVE_MODFL = 0 || test $REPLACE_MODFL = 1; then
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
93 dnl Find libraries needed to link lib/modfl.c.
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 AC_REQUIRE([gl_FUNC_MODF])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 MODFL_LIBM="$MODF_LIBM"
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 else
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 AC_REQUIRE([gl_FUNC_TRUNCL])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 MODFL_LIBM="$TRUNCL_LIBM"
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 fi
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 fi
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 AC_SUBST([MODFL_LIBM])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 ])