Correctly determine whether pow is available in libc on AIX 7 with xlc.
authorBruno Haible <bruno@clisp.org>
Sat, 31 Jul 2010 12:01:11 +0000 (14:01 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 31 Jul 2010 12:01:11 +0000 (14:01 +0200)
ChangeLog
m4/mathfunc.m4

index 1b4d2e97cc908a358a9ea4954ce5502348fa4394..e90bfe8997bcd3a0fce899370f6b9904281b20d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-31  Bruno Haible  <bruno@clisp.org>
+
+       Correctly determine whether pow is available in libc on AIX 7 with xlc.
+       * m4/mathfunc.m4 (gl_MATHFUNC): Actually use the 'funcptr' variable.
+       This disables an xlc optimization that was causing wrong test results.
+       Reported by Rainer Tammer.
+
 2010-07-31  Bruno Haible  <bruno@clisp.org>
 
        iconv: Work around AIX 6.1..7.1 bug.
index 92faac904547bcf1a7139c8a88d7ca887a6e334f..2cd47df3f73d7ef8399db15f715d22b23a3d7eff 100644 (file)
@@ -1,4 +1,4 @@
-# mathfunc.m4 serial 5
+# mathfunc.m4 serial 6
 dnl Copyright (C) 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,12 +24,15 @@ AC_DEFUN([gl_MATHFUNC],
     [gl_cv_func_]func[_no_libm],
     [
       AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
-                           # define __NO_MATH_INLINES 1 /* for glibc */
-                           #endif
-                           #include <math.h>
-                           $2 (*funcptr) $3 = ]func[;]],
-                         [[return 0;]])],
+        [AC_LANG_PROGRAM(
+           [[#ifndef __NO_MATH_INLINES
+             # define __NO_MATH_INLINES 1 /* for glibc */
+             #endif
+             #include <math.h>
+             $2 (*funcptr) $3 = ]func[;]],
+           [[$2 y = funcptr ]m4_bpatsubst([m4_bpatsubst([$3], [int], [2])], [double], [1.6180339887])[;
+             return y < 0.3 || y > 1.7;
+           ]])],
         [gl_cv_func_]func[_no_libm=yes],
         [gl_cv_func_]func[_no_libm=no])
     ])
@@ -40,12 +43,15 @@ AC_DEFUN([gl_MATHFUNC],
         save_LIBS="$LIBS"
         LIBS="$LIBS -lm"
         AC_LINK_IFELSE(
-          [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
-                             # define __NO_MATH_INLINES 1 /* for glibc */
-                             #endif
-                             #include <math.h>
-                             $2 (*funcptr) $3 = ]func[;]],
-                           [[return 0;]])],
+          [AC_LANG_PROGRAM(
+             [[#ifndef __NO_MATH_INLINES
+               # define __NO_MATH_INLINES 1 /* for glibc */
+               #endif
+               #include <math.h>
+               $2 (*funcptr) $3 = ]func[;]],
+             [[$2 y = funcptr ]m4_bpatsubst([m4_bpatsubst([$3], [int], [2])], [double], [1.6180339887])[;
+               return y < 0.3 || y > 1.7;
+             ]])],
           [gl_cv_func_]func[_in_libm=yes],
           [gl_cv_func_]func[_in_libm=no])
         LIBS="$save_LIBS"