Mercurial > hg > octave-nkf > gnulib-hg
annotate m4/log10f.m4 @ 17729:874a5cc03904
test-userspec: don't look up numeric user names
* tests/test-userspec.c: I found a system for which getpwnam("0")
returned a pointer to a non-root user's entry, and that made the
test fail.
(T): Prefix each numeric input with "+", to inhibit lookup.
author | Jim Meyering <meyering@fb.com> |
---|---|
date | Fri, 18 Jul 2014 14:16:44 -0700 |
parents | 344018b6e5d7 |
children | ab58d4870664 |
rev | line source |
---|---|
16955
256d0d4d117a
log10f: Fix possible configuration problem.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
1 # log10f.m4 serial 6 |
17587 | 2 dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. |
15866 | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | |
5 dnl with or without modifications, as long as this notice is preserved. | |
6 | |
7 AC_DEFUN([gl_FUNC_LOG10F], | |
8 [ | |
16747
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
9 m4_divert_text([DEFAULTS], [gl_log10f_required=plain]) |
15866 | 10 AC_REQUIRE([gl_MATH_H_DEFAULTS]) |
11 AC_REQUIRE([gl_FUNC_LOG10]) | |
12 | |
16580
fdbe3125f81a
math: Ensure declarations of math functions.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
13 dnl Persuade glibc <math.h> to declare log10f(). |
fdbe3125f81a
math: Ensure declarations of math functions.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
fdbe3125f81a
math: Ensure declarations of math functions.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
15 |
15866 | 16 dnl Test whether log10f() exists. Assume that log10f(), if it exists, is |
17 dnl defined in the same library as log10(). | |
18 save_LIBS="$LIBS" | |
19 LIBS="$LIBS $LOG10_LIBM" | |
20 AC_CHECK_FUNCS([log10f]) | |
21 LIBS="$save_LIBS" | |
22 if test $ac_cv_func_log10f = yes; then | |
23 LOG10F_LIBM="$LOG10_LIBM" | |
16737
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
24 |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
25 save_LIBS="$LIBS" |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
26 LIBS="$LIBS $LOG10F_LIBM" |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
27 gl_FUNC_LOG10F_WORKS |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
28 LIBS="$save_LIBS" |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
29 case "$gl_cv_func_log10f_works" in |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
30 *yes) ;; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
31 *) REPLACE_LOG10F=1 ;; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
32 esac |
16747
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
33 |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
34 m4_ifdef([gl_FUNC_LOG10F_IEEE], [ |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
35 if test $gl_log10f_required = ieee && test $REPLACE_LOG10F = 0; then |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
36 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
16747
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
37 AC_CACHE_CHECK([whether log10f works according to ISO C 99 with IEC 60559], |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
38 [gl_cv_func_log10f_ieee], |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
39 [ |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
40 save_LIBS="$LIBS" |
16955
256d0d4d117a
log10f: Fix possible configuration problem.
Bruno Haible <bruno@clisp.org>
parents:
16811
diff
changeset
|
41 LIBS="$LIBS $LOG10F_LIBM" |
16747
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
42 AC_RUN_IFELSE( |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
43 [AC_LANG_SOURCE([[ |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
44 #ifndef __NO_MATH_INLINES |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
45 # define __NO_MATH_INLINES 1 /* for glibc */ |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
46 #endif |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
47 #include <math.h> |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
48 /* Compare two numbers with ==. |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
49 This is a separate function because IRIX 6.5 "cc -O" miscompiles an |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
50 'x == x' test. */ |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
51 static int |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
52 numeric_equal (float x, float y) |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
53 { |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
54 return x == y; |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
55 } |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
56 static float dummy (float x) { return 0; } |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
57 int main (int argc, char *argv[]) |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
58 { |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
59 float (*my_log10f) (float) = argc ? log10f : dummy; |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
60 /* Test log10f(negative). |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
61 This test fails on NetBSD 5.1. */ |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
62 float y = my_log10f (-1.0f); |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
63 if (numeric_equal (y, y)) |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
64 return 1; |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
65 return 0; |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
66 } |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
67 ]])], |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
68 [gl_cv_func_log10f_ieee=yes], |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
69 [gl_cv_func_log10f_ieee=no], |
16811
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
70 [case "$host_os" in |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
71 # Guess yes on glibc systems. |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
72 *-gnu*) gl_cv_func_log10f_ieee="guessing yes" ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
73 # 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:
16747
diff
changeset
|
74 *) gl_cv_func_log10f_ieee="guessing no" ;; |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
75 esac |
b187fc49964b
Avoid "guessing no" guesses when cross-compiling to glibc systems.
Bruno Haible <bruno@clisp.org>
parents:
16747
diff
changeset
|
76 ]) |
16747
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
77 LIBS="$save_LIBS" |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
78 ]) |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
79 case "$gl_cv_func_log10f_ieee" in |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
80 *yes) ;; |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
81 *) REPLACE_LOG10F=1 ;; |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
82 esac |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
83 fi |
676471a1cb33
log10f-ieee: Work around test failure on NetBSD 5.1.
Bruno Haible <bruno@clisp.org>
parents:
16737
diff
changeset
|
84 ]) |
15866 | 85 else |
86 HAVE_LOG10F=0 | |
16737
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
87 fi |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
88 if test $HAVE_LOG10F = 0 || test $REPLACE_LOG10F = 1; then |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
89 dnl Find libraries needed to link lib/log10f.c. |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
90 if test $HAVE_LOG10F = 0; then |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
91 LOG10F_LIBM="$LOG10_LIBM" |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
92 fi |
15866 | 93 fi |
94 AC_SUBST([LOG10F_LIBM]) | |
95 ]) | |
16737
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
96 |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
97 dnl Test whether log10f() works. |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
98 dnl On OSF/1 5.1, log10f(-0.0f) is NaN. |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
99 AC_DEFUN([gl_FUNC_LOG10F_WORKS], |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
100 [ |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
101 AC_REQUIRE([AC_PROG_CC]) |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
102 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
103 AC_CACHE_CHECK([whether log10f works], [gl_cv_func_log10f_works], |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
104 [ |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
105 AC_RUN_IFELSE( |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
106 [AC_LANG_SOURCE([[ |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
107 #include <math.h> |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
108 volatile float x; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
109 float y; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
110 int main () |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
111 { |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
112 x = -0.0f; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
113 y = log10f (x); |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
114 if (!(y + y == y)) |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
115 return 1; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
116 return 0; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
117 } |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
118 ]])], |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
119 [gl_cv_func_log10f_works=yes], |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
120 [gl_cv_func_log10f_works=no], |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
121 [case "$host_os" in |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
122 osf*) gl_cv_func_log10f_works="guessing no";; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
123 *) gl_cv_func_log10f_works="guessing yes";; |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
124 esac |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
125 ]) |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
126 ]) |
6828b991e3b9
log10f: Work around OSF/1 5.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
16580
diff
changeset
|
127 ]) |