diff --git a/m4/sah_namespace.m4 b/m4/sah_namespace.m4 index cfa3ac4007..f71ebf2a3f 100644 --- a/m4/sah_namespace.m4 +++ b/m4/sah_namespace.m4 @@ -5,6 +5,9 @@ # # Revision Log: # $Log$ +# Revision 1.2 2005/05/06 00:31:05 korpela +# Added caching of results to SAH_CHECK_NAMESPACES and SAH_FUNCS_IN_NAMESPACE +# # Revision 1.1 2003/12/11 18:38:24 korpela # Added checked macro files into boinc # @@ -26,19 +29,23 @@ AC_DEFUN([SAH_NS_TO_DEFN],[ AC_DEFUN([SAH_CHECK_NAMESPACES],[ AC_LANG_PUSH(C++) - AC_MSG_CHECKING(for C++ namespaces) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ - #define CONFIG_TEST - namespace foo { - int foo(void) { return(0); } - } - ],[ - return foo::foo(); - ]) - ], [AC_DEFINE(HAVE_NAMESPACES,[1],[Define if your C++ compiler supports namespaces]) sah_cv_have_namespaces="yes"], [sah_cv_have_namespaces="no"]) - AC_MSG_RESULT($sah_cv_have_namespaces) - AC_LANG_POP + AC_CACHE_CHECK([for C++ namespaces], + [sah_cv_have_namespaces],[ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ + #define CONFIG_TEST + namespace foo { + int foo(void) { return(0); } + } + ],[ + return foo::foo(); + ]) + ], [sah_cv_have_namespaces="yes"], [sah_cv_have_namespaces="no"]) + ]) + if test "${sah_cv_have_namespaces}" = "yes" ; then + AC_DEFINE(HAVE_NAMESPACES,[1],[Define if your C++ compiler supports namespaces]) + fi + AC_LANG_POP(C++) ]) AC_DEFUN([SAH_FUNCS_IN_NAMESPACE],[ @@ -47,11 +54,12 @@ AC_DEFUN([SAH_FUNCS_IN_NAMESPACE],[ do func_name=m4_quote($func_name) t_ns=m4_quote($2) - AC_MSG_CHECKING([$func_name in namespace $t_ns]) SAH_LC_TO_DEFN(ac_func_upper,[$func_name]) SAH_LC_TO_DEFN(ac_namespace_upper,[$t_ns]) ac_uc_defn=`echo HAVE_"$ac_namespace_upper"_$ac_func_upper` - AC_LINK_IFELSE( + AC_CACHE_CHECK([for $func_name in namespace $t_ns], + [sah_cv_func_$2_$ac_func_upper],[ + AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ #define CONFIG_TEST $sah_cxx_includes @@ -59,13 +67,22 @@ AC_DEFUN([SAH_FUNCS_IN_NAMESPACE],[ [[ $2::$func_name ; ]])], - [AC_DEFINE_UNQUOTED([$ac_uc_defn], [1], - ["Define to 1 if $func_name is in namespace $t_ns::" ] ) tmp_res=yes], - [tmp_res=no]) - eval sah_cv_func_$2_$ac_func_upper=$tmp_res - AC_MSG_RESULT($tmp_res) + [ + eval sah_cv_func_$2_$ac_func_upper="yes" + tmp_res="yes" + ], + [ + eval sah_cv_func_$2_$ac_func_upper="no" + tmp_res="no" + ] + ) + ]) + if test "${tmp_res}" = "yes" ; then + AC_DEFINE_UNQUOTED([$ac_uc_defn], [1], + ["Define to 1 if $func_name is in namespace $t_ns::" ]) + fi done - AC_LANG_POP + AC_LANG_POP(C++) ])