This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libstdc++] Build system cleanup 12/n


This just tidies up Mark's group function check macro to use some m4 magic to eliminate an unnessecary shell out and like the other linkage check macros, check for the underscored macros only when the non-underscored functions were not present. The m4 macro funclist just changes all whitespace and punctuation in $3 to be a single " ".

For clarity, the diff in the generated configure snippet looks like this:

@@ -11304,9 +11304,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
- `for x in acosf asinf atanf \
- cosf sinf tanf \
- coshf sinhf tanhf; do echo "$x (0);"; done`
+acosf (0); asinf (0); atanf (0); cosf (0); sinf (0); tanf (0); coshf (0); sinhf (0); tanhf (0);
;
return 0;
}
@@ -11361,9 +11359,7 @@ echo "${ECHO_T}$glibcxx_cv_func_float_tr




-for ac_func in acosf asinf atanf \
-                                          cosf sinf tanf \
-                                          coshf sinhf tanhf
+for ac_func in acosf asinf atanf cosf sinf tanf coshf sinhf tanhf
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5

Then of course, there is no need for the seperate call to the macro look for the underscored functions.

Also this patch makes the next patch very easy.

OK?
2005-04-08  Kelley Cook  <kcook@gcc.gnu.org>

	* linkage.m4 (GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1): Eliminate
	a subshell and if test fails, test for same functions with 
	leading underscore.
	(GLIBCXX_CHECK_MATH_SUPPORT): Eliminate seperate checks for _funcs.
	* configure: Regenerate.

diff -prdu -x '*~' -x autom4te.cache /home/kcook34/gcc-orig/libstdc++-v3/linkage.m4 ./linkage.m4
--- /home/kcook34/gcc-orig/libstdc++-v3/linkage.m4	2005-04-08 12:43:24.260971300 -0400
+++ ./linkage.m4	2005-04-08 12:57:24.254525900 -0400
@@ -27,6 +27,7 @@ AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_1], [
   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
 ])
 
+
 dnl
 dnl Check to see if the (math function) argument passed is
 dnl 1) declared when using the c++ compiler
@@ -59,19 +60,35 @@ dnl of functions at once.  It's an all-o
 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
 dnl Doing it this way saves significant configure time.
 AC_DEFUN([GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1], [
+  define([funclist],patsubst($3,\(\w+\)\(\W*\),\1 ))dnl
   AC_MSG_CHECKING([for $1 functions])
   AC_CACHE_VAL(glibcxx_cv_func_$2_use, [
     AC_LANG_SAVE
     AC_LANG_CPLUSPLUS
     AC_TRY_COMPILE([#include <math.h>],
-                   [ `for x in $3; do echo "$x (0);"; done` ],
+                   patsubst(funclist,[\w+],[\& (0);]),
                    [glibcxx_cv_func_$2_use=yes],
                    [glibcxx_cv_func_$2_use=no])
     AC_LANG_RESTORE])
   AC_MSG_RESULT($glibcxx_cv_func_$2_use)
   if test x$glibcxx_cv_func_$2_use = x"yes"; then
-    AC_CHECK_FUNCS($3)
+    AC_CHECK_FUNCS(funclist)
+  else
+    AC_MSG_CHECKING([for _$1 functions])
+    AC_CACHE_VAL(glibcxx_cv_func__$2_use, [
+      AC_LANG_SAVE
+      AC_LANG_CPLUSPLUS
+      AC_TRY_COMPILE([#include <math.h>],
+                     patsubst(funclist,[\w+],[_\& (0);]),
+                     [glibcxx_cv_func__$2_use=yes],
+                     [glibcxx_cv_func__$2_use=no])
+      AC_LANG_RESTORE])
+    AC_MSG_RESULT($glibcxx_cv_func__$2_use)
+    if test x$glibcxx_cv_func__$2_use = x"yes"; then
+      AC_CHECK_FUNCS(patsubst(funclist,[\w+],[_\&]))
+    fi
   fi
+  undefine([funclist])
 ])
 
 dnl
@@ -450,27 +467,6 @@ AC_DEFUN([GLIBCXX_CHECK_MATH_SUPPORT], [
   dnl keep this sync'd with the one above. And if you add any new symbol,
   dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
   dnl Check to see if certain C math functions exist.
-
-  dnl Check to see if basic C math functions have float versions.
-  GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
-                                          _float_trig,
-                                          _acosf _asinf _atanf \
-                                          _cosf _sinf _tanf \
-                                          _coshf _sinhf _tanhf)
-  GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
-                                          _float_round,
-                                          _ceilf _floorf)
-
-  dnl Check to see if basic C math functions have long double versions.
-  GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
-                                          _long_double_trig,
-                                          _acosl _asinl _atanl \
-                                          _cosl _sinl _tanl \
-                                          _coshl _sinhl _tanhl)
-  GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
-                                          _long_double_round,
-                                          _ceill _floorl)
-
   LIBS="$ac_save_LIBS"
   CXXFLAGS="$ac_save_CXXFLAGS"
 ])

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]