# 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
fi
])
+
#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;