annotate m4/float_h.m4 @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents 10eb9086bea0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19430
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
1 # float_h.m4 serial 12
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FLOAT_H],
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 AC_REQUIRE([AC_PROG_CC])
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 AC_REQUIRE([AC_CANONICAL_HOST])
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 FLOAT_H=
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
12 REPLACE_FLOAT_LDBL=0
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 case "$host_os" in
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
14 aix* | beos* | openbsd* | mirbsd* | irix*)
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 FLOAT_H=float.h
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
16 ;;
18960
ef857abcafa1 float: Fix 'float' and 'isinf' failures on DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
17 freebsd* | dragonfly*)
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
18 case "$host_cpu" in
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
19 changequote(,)dnl
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
20 i[34567]86 )
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
21 changequote([,])dnl
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
22 FLOAT_H=float.h
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
23 ;;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
24 x86_64 )
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
25 # On x86_64 systems, the C compiler may still be generating
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
26 # 32-bit code.
19430
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
27 AC_COMPILE_IFELSE(
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
28 [AC_LANG_SOURCE(
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
29 [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
30 int ok;
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
31 #else
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
32 error fail
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
33 #endif
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
34 ]])],
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
35 [],
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
36 [FLOAT_H=float.h])
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
37 ;;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
38 esac
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 ;;
15799
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
40 linux*)
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
41 case "$host_cpu" in
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
42 powerpc*)
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
43 FLOAT_H=float.h
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
44 ;;
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
45 esac
f1d36de2d2bb float: Fix LDBL_MAX value on Linux/PowerPC.
Bruno Haible <bruno@clisp.org>
parents: 15301
diff changeset
46 ;;
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 esac
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
48 case "$host_os" in
18960
ef857abcafa1 float: Fix 'float' and 'isinf' failures on DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
49 aix* | freebsd* | dragonfly* | linux*)
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
50 if test -n "$FLOAT_H"; then
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
51 REPLACE_FLOAT_LDBL=1
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
52 fi
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
53 ;;
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
54 esac
15803
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
55
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
56 dnl Test against glibc-2.7 Linux/SPARC64 bug.
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
57 REPLACE_ITOLD=0
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
58 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works],
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
59 [gl_cv_func_itold_works],
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
60 [
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
61 AC_RUN_IFELSE(
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
62 [AC_LANG_SOURCE([[
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
63 int i = -1;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
64 volatile long double ld;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
65 int main ()
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
66 {
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
67 ld += i * 1.0L;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
68 if (ld > 0)
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
69 return 1;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
70 return 0;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
71 }]])],
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
72 [gl_cv_func_itold_works=yes],
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
73 [gl_cv_func_itold_works=no],
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
74 [case "$host" in
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
75 sparc*-*-linux*)
19430
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
76 AC_COMPILE_IFELSE(
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
77 [AC_LANG_SOURCE(
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
78 [[#if defined __LP64__ || defined __arch64__
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
79 int ok;
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
80 #else
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
81 error fail
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
82 #endif
55213288e1b4 Don’t use AC_EGREP_CPP if affected by CFLAGS
Paul Eggert <eggert@cs.ucla.edu>
parents: 18993
diff changeset
83 ]])],
15803
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
84 [gl_cv_func_itold_works="guessing no"],
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
85 [gl_cv_func_itold_works="guessing yes"])
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
86 ;;
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18960
diff changeset
87 # Guess yes on native Windows.
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18960
diff changeset
88 mingw*) gl_cv_func_itold_works="guessing yes" ;;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18960
diff changeset
89 *) gl_cv_func_itold_works="guessing yes" ;;
15803
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
90 esac
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
91 ])
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
92 ])
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
93 case "$gl_cv_func_itold_works" in
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
94 *no)
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
95 REPLACE_ITOLD=1
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
96 dnl We add the workaround to <float.h> but also to <math.h>,
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
97 dnl to increase the chances that the fix function gets pulled in.
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
98 FLOAT_H=float.h
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
99 ;;
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
100 esac
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
101
15301
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
102 if test -n "$FLOAT_H"; then
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
103 gl_NEXT_HEADERS([float.h])
deb35cf77594 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 14528
diff changeset
104 fi
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 AC_SUBST([FLOAT_H])
14528
662ae53d8d37 Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents: 14181
diff changeset
106 AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
15803
ec6332cd8838 float, math: Fix 'int' to 'long double' conversion on Linux/SPARC64.
Bruno Haible <bruno@clisp.org>
parents: 15799
diff changeset
107 AC_SUBST([REPLACE_ITOLD])
8843
dd750f34c273 New module 'float'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 ])