[v3] math config speedups

Benjamin Kosnik bkoz@redhat.com
Mon Feb 5 23:03:00 GMT 2001


as discussed a bit ago: don't check for the "_math" functions if
"math" is already found. This is a simple and painless optimization:
the "_math" functions just get defined to the "math" functions if they
are found, anyway.

-benjamin

2001-02-05   Benjamin Kosnik  <bkoz@redhat.com>

	* acinclude.m4 (GLIBCPP_CHECK_MATH_DECL_1): New macro.
	(GLIBCPP_CHECK_MATH_DECL_2): New macro.
	(GLIBCPP_CHECK_MATH_DECL_3): New macro.
	(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1): Use it, check for _* too.
	(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2): Same.
	(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3): Same.
	(GLIBCPP_CHECK_MATH_SUPPORT): Remove explicit checks for _* versions.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.126
diff -c -p -r1.126 acinclude.m4
*** acinclude.m4	2001/02/06 06:31:57	1.126
--- acinclude.m4	2001/02/06 07:02:20
*************** AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, 
*** 315,331 ****
  
  dnl
  dnl Check to see if the (math function) argument passed is
! dnl 1) declared when using the c++ compiler
! dnl 2) has "C" linkage
! dnl
! dnl Define HAVE_CARGF etc if "cargf" is declared and links
! dnl
! dnl argument 1 is name of function to check
! dnl
  dnl ASSUMES argument is a math function with ONE parameter
  dnl
! dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
    AC_MSG_CHECKING([for $1 declaration])
    if test x${glibcpp_cv_func_$1_use+set} != xset; then
      AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
--- 315,325 ----
  
  dnl
  dnl Check to see if the (math function) argument passed is
! dnl declared when using the c++ compiler
  dnl ASSUMES argument is a math function with ONE parameter
  dnl
! dnl GLIBCPP_CHECK_MATH_DECL_1
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
    AC_MSG_CHECKING([for $1 declaration])
    if test x${glibcpp_cv_func_$1_use+set} != xset; then
      AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LIN
*** 338,348 ****
--- 332,365 ----
      ])
    fi
    AC_MSG_RESULT($glibcpp_cv_func_$1_use)
+ ])
+ 
+ dnl
+ dnl Check to see if the (math function) argument passed is
+ dnl 1) declared when using the c++ compiler
+ dnl 2) has "C" linkage
+ dnl 3) if not, see if 1) and 2) for argument prepended with '_'
+ dnl
+ dnl Define HAVE_CARGF etc if "cargf" is declared and links
+ dnl
+ dnl argument 1 is name of function to check
+ dnl
+ dnl ASSUMES argument is a math function with ONE parameter
+ dnl
+ dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
+ AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
+   GLIBCPP_CHECK_MATH_DECL_1($1)
    if test x$glibcpp_cv_func_$1_use = x"yes"; then
      AC_CHECK_FUNCS($1)    
+   else
+     GLIBCPP_CHECK_MATH_DECL_1(_$1)
+     if test x$glibcpp_cv_func__$1_use = x"yes"; then
+       AC_CHECK_FUNCS(_$1)    
+     fi	
    fi
  ])
  
+ 
  dnl
  dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
  dnl of functions at once.  It's an all-or-nothing check -- either 
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LI
*** 366,382 ****
  
  dnl
  dnl Check to see if the (math function) argument passed is
! dnl 1) declared when using the c++ compiler
! dnl 2) has "C" linkage
! dnl
! dnl Define HAVE_CARGF etc if "cargf" is declared and links
! dnl
! dnl argument 1 is name of function to check
! dnl
! dnl ASSUMES argument is a math function with TWO parameters
  dnl
! dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
    AC_MSG_CHECKING([for $1 declaration])
    if test x${glibcpp_cv_func_$1_use+set} != xset; then
      AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
--- 383,393 ----
  
  dnl
  dnl Check to see if the (math function) argument passed is
! dnl declared when using the c++ compiler
! dnl ASSUMES argument is a math function with ONE parameter
  dnl
! dnl GLIBCPP_CHECK_MATH_DECL_2
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
    AC_MSG_CHECKING([for $1 declaration])
    if test x${glibcpp_cv_func_$1_use+set} != xset; then
      AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LIN
*** 389,400 ****
      ])
    fi
    AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-   if test x$glibcpp_cv_func_$1_use = x"yes"; then
-     AC_CHECK_FUNCS($1)    
-   fi
  ])
  
- 
  dnl
  dnl Check to see if the (math function) argument passed is
  dnl 1) declared when using the c++ compiler
--- 400,407 ----
*************** dnl Define HAVE_CARGF etc if "cargf" is 
*** 404,413 ****
  dnl
  dnl argument 1 is name of function to check
  dnl
! dnl ASSUMES argument is a math function with THREE parameters
  dnl
! dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
    AC_MSG_CHECKING([for $1 declaration])
    if test x${glibcpp_cv_func_$1_use+set} != xset; then
      AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
--- 411,439 ----
  dnl
  dnl argument 1 is name of function to check
  dnl
! dnl ASSUMES argument is a math function with TWO parameters
  dnl
! dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
!   GLIBCPP_CHECK_MATH_DECL_2($1)
!   if test x$glibcpp_cv_func_$1_use = x"yes"; then
!     AC_CHECK_FUNCS($1)    
!   else
!     GLIBCPP_CHECK_MATH_DECL_2(_$1)
!     if test x$glibcpp_cv_func__$1_use = x"yes"; then
!       AC_CHECK_FUNCS(_$1)    
!     fi	
!   fi
! ])
! 
! 
! dnl
! dnl Check to see if the (math function) argument passed is
! dnl declared when using the c++ compiler
! dnl ASSUMES argument is a math function with ONE parameter
! dnl
! dnl GLIBCPP_CHECK_MATH_DECL_3
! AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
    AC_MSG_CHECKING([for $1 declaration])
    if test x${glibcpp_cv_func_$1_use+set} != xset; then
      AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LIN
*** 420,427 ****
--- 446,474 ----
      ])
    fi
    AC_MSG_RESULT($glibcpp_cv_func_$1_use)
+ ])
+ 
+ dnl
+ dnl Check to see if the (math function) argument passed is
+ dnl 1) declared when using the c++ compiler
+ dnl 2) has "C" linkage
+ dnl
+ dnl Define HAVE_CARGF etc if "cargf" is declared and links
+ dnl
+ dnl argument 1 is name of function to check
+ dnl
+ dnl ASSUMES argument is a math function with THREE parameters
+ dnl
+ dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
+ AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
+   GLIBCPP_CHECK_MATH_DECL_3($1)
    if test x$glibcpp_cv_func_$1_use = x"yes"; then
      AC_CHECK_FUNCS($1)    
+   else
+     GLIBCPP_CHECK_MATH_DECL_3(_$1)
+     if test x$glibcpp_cv_func__$1_use = x"yes"; then
+       AC_CHECK_FUNCS(_$1)    
+     fi	
    fi
  ])
  
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
*** 674,686 ****
    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.
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass)
  
    dnl Check to see if basic C math functions have float versions.
    GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
--- 721,726 ----
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
*** 691,709 ****
    GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
                                            _float_round,
                                            _ceilf _floorf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef)
  
    dnl Check to see if basic C math functions have long double versions.
    GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
--- 731,736 ----
*************** AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
*** 714,735 ****
    GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
                                            _long_double_round,
                                            _ceill _floorl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl)
-   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel)
  
    LIBS="$ac_save_LIBS"
    CXXFLAGS="$ac_save_CXXFLAGS"
--- 741,746 ----


More information about the Libstdc++ mailing list