From d13efa35a2b00e8ad4caa0a6c486bb9f8068cffe Mon Sep 17 00:00:00 2001 From: "Eric J. Korpela" Date: Thu, 11 Dec 2003 18:38:24 +0000 Subject: [PATCH] Added checked macro files into boinc svn path=/trunk/boinc/; revision=2779 --- m4/sah_header_stdcxx.m4 | 32 +++++++++++++++++++ m4/sah_namespace.m4 | 71 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 m4/sah_header_stdcxx.m4 create mode 100644 m4/sah_namespace.m4 diff --git a/m4/sah_header_stdcxx.m4 b/m4/sah_header_stdcxx.m4 new file mode 100644 index 0000000000..e1279af223 --- /dev/null +++ b/m4/sah_header_stdcxx.m4 @@ -0,0 +1,32 @@ +# The contents of this file are subject to the BOINC Public License +# Version 1.0 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://boinc.berkeley.edu/license_1.0.txt + +AC_PREREQ([2.54]) + +AC_DEFUN([SAH_HEADER_STDCXX],[ + save_inc="$ac_includes_default" + ac_includes_default="$ac_includes_default +#define CONFIG_TEST +#include \"lib/std_fixes.h\" +" + sah_stdcxx_headers="algorithm bitset cassert cctype cerrno cfloat climits clocale cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime deque fstream functional iomanip ios iosfwd iostream istream iterator limits list locale map memory numeric ostream queue set sstream stack stdexcept streambuf string utility valarray vector" + AC_LANG_PUSH(C++) + AC_CHECK_HEADERS([$sah_stdcxx_headers]) + for header in $sah_stdcxx_headers + do + eval tmp_var=\$ac_cv_header_${header} + if test "$tmp_var" = "yes" + then + sah_cxx_includes="$sah_cxx_includes +#include <$header> +" + fi + done + AC_CACHE_SAVE + AC_LANG_POP + ac_includes_default="$save_inc" + CONFIG_TEST= +]) + diff --git a/m4/sah_namespace.m4 b/m4/sah_namespace.m4 new file mode 100644 index 0000000000..cfa3ac4007 --- /dev/null +++ b/m4/sah_namespace.m4 @@ -0,0 +1,71 @@ +# The contents of this file are subject to the BOINC Public License +# Version 1.0 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://boinc.berkeley.edu/license_1.0.txt +# +# Revision Log: +# $Log$ +# Revision 1.1 2003/12/11 18:38:24 korpela +# Added checked macro files into boinc +# +# Revision 1.5 2003/12/03 23:46:11 korpela +# Fixed "sah_namespaces.m4" not to rely on "tr". +# +# + +AC_PREREQ([2.54]) + + +AC_DEFUN([SAH_LC_TO_DEFN],[ + $1=`echo $2 | $AWK '{split($[]1,a,"(");print a[[ 1 ]]}' | $as_tr_cpp` +]) + +AC_DEFUN([SAH_NS_TO_DEFN],[ + $1=`echo $2 | $as_tr_cpp` +]) + +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_DEFUN([SAH_FUNCS_IN_NAMESPACE],[ + AC_LANG_PUSH(C++) + for func_name in $1 + 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_LANG_PROGRAM([[ + #define CONFIG_TEST + $sah_cxx_includes + ]], + [[ + $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) + done + AC_LANG_POP +]) + +