changeset 15929:7649c55d7d4c

mathfunc.m4: Refactor. * m4/mathfunc.m4 (gl_MATHFUNC): Assign the argument list to a temporary m4 variable.
author Bruno Haible <bruno@clisp.org>
date Mon, 10 Oct 2011 01:57:56 +0200
parents c3916f7594b5
children 44cd3e1918b0
files ChangeLog m4/mathfunc.m4
diffstat 2 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-09  Bruno Haible  <bruno@clisp.org>
+
+	mathfunc.m4: Refactor.
+	* m4/mathfunc.m4 (gl_MATHFUNC): Assign the argument list to a temporary
+	m4 variable.
+
 2011-10-09  Bruno Haible  <bruno@clisp.org>
 
 	rintl: Simplify for platforms where 'long double' == 'double'.
--- a/m4/mathfunc.m4
+++ b/m4/mathfunc.m4
@@ -1,4 +1,4 @@
-# mathfunc.m4 serial 7
+# mathfunc.m4 serial 8
 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,
@@ -19,6 +19,23 @@
   m4_pushdef([func], [$1])
   m4_pushdef([FUNC], [m4_translit([$1],[abcdefghijklmnopqrstuvwxyz],
                                        [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
+  m4_pushdef([ARGS], [m4_bpatsubst(
+                        [m4_bpatsubst(
+                           [m4_bpatsubst(
+                              [m4_bpatsubst(
+                                 [m4_bpatsubst(
+                                    [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])])
   FUNC[]_LIBM=
   AC_CACHE_CHECK([whether func() can be used without linking with libm],
     [gl_cv_func_]func[_no_libm],
@@ -34,7 +51,7 @@
              float f_ret;
              double d_ret;
              long double l_ret;]],
-           [[$2 y = funcptr ]m4_bpatsubst([m4_bpatsubst([m4_bpatsubst([m4_bpatsubst([m4_bpatsubst([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])[;
+           [[$2 y = funcptr ]ARGS[;
              return y < 0.3 || y > 1.7;
            ]])],
         [gl_cv_func_]func[_no_libm=yes],
@@ -57,7 +74,7 @@
                float f_ret;
                double d_ret;
                long double l_ret;]],
-             [[$2 y = funcptr ]m4_bpatsubst([m4_bpatsubst([m4_bpatsubst([m4_bpatsubst([m4_bpatsubst([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])[;
+             [[$2 y = funcptr ]ARGS[;
                return y < 0.3 || y > 1.7;
              ]])],
           [gl_cv_func_]func[_in_libm=yes],
@@ -69,6 +86,7 @@
     fi
   fi
   AC_SUBST(FUNC[_LIBM])
+  m4_popdef([ARGS])
   m4_popdef([FUNC])
   m4_popdef([func])
 ])