Patch to fix PR102, contributed by Reid Spencer.
authorBrian Gaeke <gaeke@uiuc.edu>
Mon, 10 Nov 2003 03:06:09 +0000 (03:06 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Mon, 10 Nov 2003 03:06:09 +0000 (03:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9849 91177308-0d34-0410-b5e6-96231b3b80d8

autoconf/aclocal.m4
autoconf/configure.ac
include/Support/hash_map
include/Support/hash_set

index da725af8a46c31c4f6d671582a1183e67463d9ac..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
@@ -6196,3 +6244,4 @@ AC_DEFUN([AC_C_PRINTF_A],
        fi
 ])
 
+
index f613de0a26c10d08fc5560c202285dc91d28cf23..1ae8c1cdd8284069b86276df23d4378673463776 100644 (file)
@@ -460,8 +460,8 @@ dnl Check for various C features
 AC_C_PRINTF_A
 
 dnl Check for C++ extensions
-AC_CXX_HAVE_EXT_HASH_MAP
-AC_CXX_HAVE_EXT_HASH_SET
+AC_CXX_HAVE_HASH_MAP
+AC_CXX_HAVE_HASH_SET
 AC_CXX_HAVE_EXT_SLIST
 AC_CXX_HAVE_STD_ITERATOR
 AC_CXX_HAVE_BI_ITERATOR
index 95ef0e5cdc9634e2ea3f0bbe11ffaad3ece7f7f4..de3b3f5ea5f205c2b686e1ea54bf595b4c545957 100644 (file)
 
 #ifdef HAVE_GNU_EXT_HASH_MAP
 // This is for GCC-3.1+ which puts hash in ext/hash_map
-#include <ext/hash_map>
-#define HASH_NAMESPACE __gnu_cxx
+# include <ext/hash_map>
+# ifndef HASH_NAMESPACE
+#  define HASH_NAMESPACE __gnu_cxx
+# endif
 
-#else
+// GCC 3.0.x puts hash_map in <ext/hash_map> and in the std namespace.
+#elif defined(HAVE_STD_EXT_HASH_MAP)
+# include <ext/hash_map>
+# ifndef HASH_NAMESPACE
+#  define HASH_NAMESPACE std
+# endif
 
-// This is for GCC-3.0.x which puts hashmap in the `ext' directory.
-#ifdef HAVE_STD_EXT_HASH_MAP
-#include <ext/hash_map>
-#define HASH_NAMESPACE std
+// Older compilers such as GCC before version 3.0 do not keep
+// extensions in the `ext' directory, and ignore the `std' namespace.
+#elif defined(HAVE_GLOBAL_HASH_MAP)
+# include <hash_map>
+# ifndef HASH_NAMESPACE
+#  define HASH_NAMESPACE std
+# endif
 
+// Give a warning if we couldn't find it, instead of (or in addition to)
+// randomly doing something dumb.
 #else
-// This handles older, pre-3.0 GCC which do not have the extentions in the `ext'
-// directory, and ignore the `std' namespace.
-#include <hash_map>
-#define HASH_NAMESPACE std
-#endif
-
+# warning "Autoconfiguration failed to find the hash_map header file."
 #endif
 
 using HASH_NAMESPACE::hash_map;
index 620dd336671bf5822dfb33687427640738ddda66..fa68a8bb738b4f4c3b437bddef0e9e6e3e7b57b8 100644 (file)
 
 #include "Config/config.h"
 
-#ifdef HAVE_GNU_EXT_HASH_SET
+// GCC versions 3.1 and later put hash_set in <ext/hash_set> and in
+// the __gnu_cxx namespace.
+#if defined(HAVE_GNU_EXT_HASH_SET)
+# include <ext/hash_set>
+# ifndef HASH_NAMESPACE
+#  define HASH_NAMESPACE __gnu_cxx
+# endif
 
-// This is for GCC-3.1+ which puts hashset in ext/hash_set
-#include <ext/hash_set>
-#define HASH_NAMESPACE __gnu_cxx
+// GCC 3.0.x puts hash_set in <ext/hash_set> and in the std namespace.
+#elif defined(HAVE_STD_EXT_HASH_SET)
+# include <ext/hash_set>
+# ifndef HASH_NAMESPACE
+#  define HASH_NAMESPACE std
+# endif
 
-#else
-
-// This is for GCC-3.0.x which puts hashmap in the `ext' directory.
-#ifdef HAVE_STD_EXT_HASH_SET
-#include <ext/hash_set>
-#define HASH_NAMESPACE std
+// Older compilers such as GCC before version 3.0 do not keep
+// extensions in the `ext' directory, and ignore the `std' namespace.
+#elif defined(HAVE_GLOBAL_HASH_SET)
+# include <hash_set>
+# ifndef HASH_NAMESPACE
+#  define HASH_NAMESPACE std
+# endif
 
+// Give a warning if we couldn't find it, instead of (or in addition to)
+// randomly doing something dumb.
 #else
-// This handles older, pre-3.0 GCC which do not have the extentions in the `ext'
-// directory, and ignore the `std' namespace.
-#include <hash_set>
-#define HASH_NAMESPACE std
-#endif
-
+# warning "Autoconfiguration failed to find the hash_set header file."
 #endif
 
 using HASH_NAMESPACE::hash_set;