changeset 16037:82a1361734d0

Extend gl_MATHFUNC. * m4/mathfunc.m4 (gl_MATHFUNC): Accept an 4th parameter of INCLUDES. Support 'void' as argument type. * m4/rint.m4 (gl_FUNC_RINT): Update gl_MATHFUNC invocation.
author Bruno Haible <bruno@clisp.org>
date Sun, 06 Nov 2011 02:14:43 +0100
parents 1fda91604648
children 8f14d00d6f24
files ChangeLog m4/mathfunc.m4 m4/rint.m4
diffstat 3 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 05 20:34:55 2011 +0100
+++ b/ChangeLog	Sun Nov 06 02:14:43 2011 +0100
@@ -1,3 +1,10 @@
+2011-11-05  Bruno Haible  <bruno@clisp.org>
+
+	Extend gl_MATHFUNC.
+	* m4/mathfunc.m4 (gl_MATHFUNC): Accept an 4th parameter of INCLUDES.
+	Support 'void' as argument type.
+	* m4/rint.m4 (gl_FUNC_RINT): Update gl_MATHFUNC invocation.
+
 2011-11-05  Jim Meyering  <meyering@redhat.com>
 
 	maint.mk: also prohibit inclusion of dirent.h without use
--- a/m4/mathfunc.m4	Sat Nov 05 20:34:55 2011 +0100
+++ b/m4/mathfunc.m4	Sun Nov 06 02:14:43 2011 +0100
@@ -1,11 +1,11 @@
-# mathfunc.m4 serial 9
+# mathfunc.m4 serial 10
 dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES [, EXTRA-CODE])
-# -----------------------------------------------------
+# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES [, INCLUDES] [, EXTRA-CODE])
+# ------------------------------------------------------------------
 # tests whether the function FUNC is available in libc or libm.
 # RETTYPE is the return type. PARAMTYPES is a parameter list, with parentheses.
 # It sets FUNC_LIBM to empty or "-lm" accordingly.
@@ -38,15 +38,17 @@
                                     [m4_bpatsubst(
                                        [m4_bpatsubst(
                                           [m4_bpatsubst(
-                                             [$3],
-                                             [int \*], [&i_ret])],
-                                          [float \*], [&f_ret])],
-                                       [double \*], [&d_ret])],
-                                    [long double \*], [&l_ret])],
-                                 [int], [2])],
-                              [float], [1.618034f])],
-                           [long double], [1.618033988749894848L])],
-                        [double], [1.6180339887])])
+                                             [m4_bpatsubst(
+                                                [$3],
+                                                [int \*], [&i_ret])],
+                                             [float \*], [&f_ret])],
+                                          [double \*], [&d_ret])],
+                                       [long double \*], [&l_ret])],
+                                    [int], [2])],
+                                 [float], [1.618034f])],
+                              [long double], [1.618033988749894848L])],
+                           [double], [1.6180339887])],
+                        [void], [])])
   FUNC[]_LIBM=
   AC_CACHE_CHECK([whether func() can be used without linking with libm],
     [gl_cv_func_]func[_no_libm],
@@ -57,13 +59,14 @@
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
+             $4
              $2 (*funcptr) $3 = ]func[;
              int i_ret;
              float f_ret;
              double d_ret;
              long double l_ret;]],
            [[$2 y = funcptr ]ARGS[ + ]func[ ]ARGS[;
-             $4
+             $5
              return y < 0.3 || y > 1.7;
            ]])],
         [gl_cv_func_]func[_no_libm=yes],
@@ -81,13 +84,14 @@
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
+               $4
                $2 (*funcptr) $3 = ]func[;
                int i_ret;
                float f_ret;
                double d_ret;
                long double l_ret;]],
              [[$2 y = funcptr ]ARGS[ + ]func[ ]ARGS[;
-               $4
+               $5
                return y < 0.3 || y > 1.7;
              ]])],
           [gl_cv_func_]func[_in_libm=yes],
--- a/m4/rint.m4	Sat Nov 05 20:34:55 2011 +0100
+++ b/m4/rint.m4	Sun Nov 06 02:14:43 2011 +0100
@@ -1,4 +1,4 @@
-# rint.m4 serial 3
+# rint.m4 serial 4
 dnl Copyright (C) 2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@
   dnl In AIX 7.1 with gcc 4.2, when optimization is turned on, calls to
   dnl rint() with simple arguments are turned into rintf() calls by the
   dnl compiler. But while rint() is resides in libc, rintf() is in libm.
-  gl_MATHFUNC([rint], [double], [(double)], [y += rint (2.0);])
+  gl_MATHFUNC([rint], [double], [(double)], [], [y += rint (2.0);])
   if test $gl_cv_func_rint_no_libm = no \
      && test $gl_cv_func_rint_in_libm = no; then
     HAVE_RINT=0