Mercurial > hg > octave-shane > gnulib-hg
comparison m4/log.m4 @ 16631:45443deebb7d
log: Work around OSF/1 5.1 bug.
* lib/math.in.h (log): New declaration.
* lib/log.c: New file.
* m4/log.m4 (gl_FUNC_LOG_WORKS): New macro.
(gl_FUNC_LOG): Invoke it. Set REPLACE_LOG.
* m4/math_h.m4 (gl_MATH_H): Test whether log is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_LOG, REPLACE_LOG.
* modules/math (Makefile.am): Substitute GNULIB_LOG, REPLACE_LOG.
* modules/log (Files): Add lib/log.c.
(Depends-on): Add math.
(configure.ac): If REPLACE_LOG is 1, compile an override.
* tests/test-math-c++.cc: Check the declaration of log.
* doc/posix-functions/log.texi: Mention the OSF/1 5.1 problem.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 09 Mar 2012 23:55:13 +0100 |
parents | 8250f2777afc |
children | 521c2cde0e31 |
comparison
equal
deleted
inserted
replaced
16630:1ac24dbbff5a | 16631:45443deebb7d |
---|---|
1 # log.m4 serial 1 | 1 # log.m4 serial 2 |
2 dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. | 2 dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. |
3 dnl This file is free software; the Free Software Foundation | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | 4 dnl gives unlimited permission to copy and/or distribute it, |
5 dnl with or without modifications, as long as this notice is preserved. | 5 dnl with or without modifications, as long as this notice is preserved. |
6 | 6 |
7 AC_DEFUN([gl_FUNC_LOG], | 7 AC_DEFUN([gl_FUNC_LOG], |
8 [ | 8 [ |
9 dnl Determine LOG_LIBM. | 9 dnl Determine LOG_LIBM. |
10 gl_COMMON_DOUBLE_MATHFUNC([log]) | 10 gl_COMMON_DOUBLE_MATHFUNC([log]) |
11 | |
12 save_LIBS="$LIBS" | |
13 LIBS="$LIBS $LOG_LIBM" | |
14 gl_FUNC_LOG_WORKS | |
15 LIBS="$save_LIBS" | |
16 case "$gl_cv_func_log_works" in | |
17 *yes) ;; | |
18 *) REPLACE_LOG=1 ;; | |
19 esac | |
11 ]) | 20 ]) |
21 | |
22 dnl Test whether log() works. | |
23 dnl On OSF/1 5.1, log(-0.0) is NaN. | |
24 AC_DEFUN([gl_FUNC_LOG_WORKS], | |
25 [ | |
26 AC_REQUIRE([AC_PROG_CC]) | |
27 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | |
28 AC_CACHE_CHECK([whether log works], [gl_cv_func_log_works], | |
29 [ | |
30 AC_RUN_IFELSE( | |
31 [AC_LANG_SOURCE([[ | |
32 #include <math.h> | |
33 volatile double x; | |
34 double y; | |
35 int main () | |
36 { | |
37 x = -0.0; | |
38 y = log (x); | |
39 if (!(y + y == y)) | |
40 return 1; | |
41 return 0; | |
42 } | |
43 ]])], | |
44 [gl_cv_func_log_works=yes], | |
45 [gl_cv_func_log_works=no], | |
46 [case "$host_os" in | |
47 osf*) gl_cv_func_log_works="guessing no";; | |
48 *) gl_cv_func_log_works="guessing yes";; | |
49 esac | |
50 ]) | |
51 ]) | |
52 ]) |