annotate m4/modfl.m4 @ 17632:86af85d364e1 default tip

unistd: port readlink to Mac OS X 10.3.9 * lib/unistd.in.h (_GL_INCLUDING_UNISTD_H): New macro, to work around self-include problem in Mac OS X 10.3.9 when combined with readlink module. Problem reported by Klaus Zietler in <http://bugs.gnu.org/16825>.
author Paul Eggert <eggert@penguin.cs.ucla.edu>
date Tue, 25 Feb 2014 11:16:27 -0800
parents 344018b6e5d7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16811
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
1 # modfl.m4 serial 3
17587
344018b6e5d7 maint: update copyright
Eric Blake <eblake@redhat.com>
parents: 17249
diff changeset
2 dnl Copyright (C) 2011-2014 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 {
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
52 long double (*my_modfl) (long double, long double *) = argc ? modfl : dummy;
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
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
66 # Guess yes on glibc systems.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
67 *-gnu*) gl_cv_func_modfl_ieee="guessing yes" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
68 # If we don't know, assume the worst.
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
69 *) gl_cv_func_modfl_ieee="guessing no" ;;
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
70 esac
b187fc49964b Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 16580
diff changeset
71 ])
16471
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
72 LIBS="$save_LIBS"
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
73 ])
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
74 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
75 *yes) ;;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
76 *) REPLACE_MODFL=1 ;;
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
77 esac
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
78 fi
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
79 ])
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
80 else
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 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
82 fi
1f4605f1f3ae modfl-ieee: Work around test failures on IRIX, OSF/1, mingw.
Bruno Haible <bruno@clisp.org>
parents: 16408
diff changeset
83 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
84 dnl Find libraries needed to link lib/modfl.c.
16408
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 AC_REQUIRE([gl_FUNC_MODF])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 MODFL_LIBM="$MODF_LIBM"
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 else
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 AC_REQUIRE([gl_FUNC_TRUNCL])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 MODFL_LIBM="$TRUNCL_LIBM"
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 fi
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 fi
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 AC_SUBST([MODFL_LIBM])
b895d48831cd New module 'modfl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 ])