Patch to fix PR102, contributed by Reid Spencer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9849 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke 2003-11-10 03:06:09 +00:00
parent 75920ee460
commit 278a4ac603
4 changed files with 131 additions and 68 deletions

117
autoconf/aclocal.m4 vendored
View File

@ -5892,61 +5892,109 @@ fi
# 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
])

View 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

View File

@ -29,23 +29,30 @@
#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
// 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
// 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 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
#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;

View File

@ -28,26 +28,33 @@
#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
// 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 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
#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;