Put all LLVM code into the llvm namespace, as per bug 109.
[oota-llvm.git] / autoconf / aclocal.m4
index 51040fb523942c26e587cc470f04c64af6ba781e..aca868ab123a4bc6a9efe8de447d8569fb57c071 100644 (file)
 # Check for hash_map extension.  This is from
 # http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html
 #
-AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP],
-[AC_CACHE_CHECK(whether the compiler has ext/hash_map,
-ac_cv_cxx_have_ext_hash_map,
-[AC_REQUIRE([AC_CXX_NAMESPACES])
+AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_MAP],
+[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class std::hash_map],
+ ac_cv_cxx_have_std_ext_hash_map,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
   AC_TRY_COMPILE([#include <ext/hash_map>
 #ifdef HAVE_NAMESPACES
 using namespace std;
-#endif],[hash_map<int, int> t; return 0;],
-  ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no)
+#endif],[hash_map<int, int> t;],
+  [ac_cv_cxx_have_std_ext_hash_map=yes], [ac_cv_cxx_have_std_ext_hash_map=no])
+  AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_std_ext_hash_map" = yes; then
+   AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[Define if the compiler has a header <ext/hash_map> that defines template class std::hash_map.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP],
+[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class __gnu_cxx::hash_map],
+ ac_cv_cxx_have_gnu_ext_hash_map,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
   AC_TRY_COMPILE([#include <ext/hash_map>
 #ifdef HAVE_NAMESPACES
 using namespace __gnu_cxx;
-#endif],[hash_map<int, int> t; return 0;],
-  ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no)
-  AC_LANG_RESTORE
-])
-if test "$ac_cv_cxx_have_ext_hash_map" = std; then
-   AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map])
-fi
-if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then
-   AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map])
-fi
-])
-
+#endif],[hash_map<int,int> t; ],
+  [ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no])
+  AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes; then
+   AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[Define if the compiler has a header <ext/hash_map> that defines template class __gnu_cxx::hash_map.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP],
+[AC_CACHE_CHECK([whether the compiler has <hash_map> defining template class ::hash_map],
+ ac_cv_cxx_have_global_hash_map,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([#include <hash_map>],[hash_map<int,int> t; ],
+  [ac_cv_cxx_have_global_hash_map=yes], [ac_cv_cxx_have_global_hash_map=no])
+  AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_global_hash_map" = yes; then
+   AC_DEFINE(HAVE_GLOBAL_HASH_MAP,,[Define if the compiler has a header <hash_map> that defines template class ::hash_map.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_HASH_MAP],
+[AC_CXX_HAVE_STD_EXT_HASH_MAP
+ AC_CXX_HAVE_GNU_EXT_HASH_MAP
+ AC_CXX_HAVE_GLOBAL_HASH_MAP])
 #
 # Check for hash_set extension.  This is modified from
 # http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
 #
-AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET],
-[AC_CACHE_CHECK(whether the compiler has ext/hash_set,
-ac_cv_cxx_have_ext_hash_set,
-[AC_REQUIRE([AC_CXX_NAMESPACES])
+AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_SET],
+[AC_CACHE_CHECK([whether the compiler has <ext/hash_set> defining template class std::hash_set],
+ ac_cv_cxx_have_std_ext_hash_set,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
   AC_TRY_COMPILE([#include <ext/hash_set>
 #ifdef HAVE_NAMESPACES
 using namespace std;
-#endif],[hash_set<int> t; return 0;],
-  ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no)
+#endif],[hash_set<int> t; ],
+  [ac_cv_cxx_have_std_ext_hash_set=yes], [ac_cv_cxx_have_std_ext_hash_set=no])
+  AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_std_ext_hash_set" = yes; then
+   AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[Define if the compiler has a header <ext/hash_set> that defines template class std::hash_set.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_SET],
+[AC_CACHE_CHECK(
+ [whether the compiler has <ext/hash_set> defining template class __gnu_cxx::hash_set],
+ ac_cv_cxx_have_gnu_ext_hash_set,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
   AC_TRY_COMPILE([#include <ext/hash_set>
 #ifdef HAVE_NAMESPACES
 using namespace __gnu_cxx;
-#endif],[hash_set<int> t; return 0;],
-  ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no)
-  AC_LANG_RESTORE
-])
-if test "$ac_cv_cxx_have_ext_hash_set" = std; then
-   AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std])
-fi
-if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then
-   AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc])
-fi
-])
+#endif],[hash_set<int> t; ],
+  [ac_cv_cxx_have_gnu_ext_hash_set=yes], [ac_cv_cxx_have_gnu_ext_hash_set=no])
+  AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes; then
+   AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[Define if the compiler has a header <ext/hash_set> that defines template class __gnu_cxx::hash_set.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_SET],
+[AC_CACHE_CHECK([whether the compiler has <hash_set> defining template class ::hash_set],
+ ac_cv_cxx_have_global_hash_set,
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([#include <hash_set>],[hash_set<int> t; return 0;],
+  [ac_cv_cxx_have_global_hash_set=yes], [ac_cv_cxx_have_global_hash_set=no])
+  AC_LANG_RESTORE])
+ if test "$ac_cv_cxx_have_global_hash_set" = yes; then
+   AC_DEFINE(HAVE_GLOBAL_HASH_SET,,[Define if the compiler has a header <hash_set> that defines template class ::hash_set.])
+ fi])
+
+AC_DEFUN([AC_CXX_HAVE_HASH_SET],
+[AC_CXX_HAVE_STD_EXT_HASH_SET
+ AC_CXX_HAVE_GNU_EXT_HASH_SET
+ AC_CXX_HAVE_GLOBAL_HASH_SET])
 
 #
 # Check for standard iterator extension.  This is modified from
@@ -6166,4 +6214,34 @@ AC_DEFUN([AC_CONFIG_MAKEFILE],
 [AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`)
 ])
 
+#
+# Determine if the printf() functions have the %a format character.
+# This is modified from:
+# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
+AC_DEFUN([AC_C_PRINTF_A],
+[
+       AC_LANG_SAVE
+       AC_LANG_C
+       AC_RUN_IFELSE(
+               AC_LANG_PROGRAM([#include <stdio.h>
+                                #include <stdlib.h>],
+                                [[[
+                                volatile double A, B;
+                                char Buffer[100];
+                                A = 1;
+                                A /= 10.0;
+                                sprintf(Buffer, "%a", A);
+                                B = atof(Buffer);
+                                if (A != B)
+                                                        return (1);
+                                if (A != 0x1.999999999999ap-4)
+                                                        return (1);
+                                return (0);]]]),
+               ac_c_printf_a=yes,ac_c_printf_a=no)
+       AC_LANG_RESTORE
+       if test "$ac_c_printf_a" = "yes"; then
+               AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string])
+       fi
+])
+