branch: master commit 93827f2da2cfe55b96debc5fb755552bd27faf1c Author: Kai Sterker <kai.ster...@gmail.com> Commit: Kai Sterker <kai.ster...@gmail.com>
ADDED configure check for unordered_map/set headers and simplify str_hash.h --- configure.ac | 7 +++++++ src/str_hash.h | 22 ++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 892fd9c..a4dadae 100644 --- a/configure.ac +++ b/configure.ac @@ -183,6 +183,7 @@ AC_CHECK_LIB([SDL2_ttf], AC_CHECK_FUNCS([TTF_GetFontKerningSizeGlyphs]) dnl on a mingw build, we do not want SDL to redefine 'main' + case "$target" in *-*-cygwin* | *-*-mingw32 | *-*-mingw64 ) SDL_CFLAGS=`echo $SDL_CFLAGS | sed 's/-Dmain=SDL_main//'` @@ -195,6 +196,7 @@ dnl Check for Python dnl **************** dnl Find Python executable + if test "x$with_python" != "xno"; then AC_PATH_PROG([PYTHON], [$with_python], no) else @@ -485,6 +487,11 @@ if test x$OGG_VORBIS = xyes; then AC_CHECK_HEADER([vorbis/vorbisfile.h]) fi +AC_LANG_PUSH([C++]) +AC_CHECK_HEADERS(tr1/unordered_map) +AC_CHECK_HEADERS(unordered_map) +AC_LANG_POP([C++]) + AM_CONDITIONAL(HAVE_OGG_VORBIS, test x$OGG_VORBIS = xyes) dnl ******************************** diff --git a/src/str_hash.h b/src/str_hash.h index f37af73..9f7dcb0 100644 --- a/src/str_hash.h +++ b/src/str_hash.h @@ -29,26 +29,16 @@ #ifndef STR_HASH_H #define STR_HASH_H -#ifdef __clang__ -#include <AvailabilityMacros.h> -#if MAC_OS_X_VERSION_MIN_REQUIRED > 1060 +#include "config.h" + +#ifdef HAVE_UNORDERED_MAP #include <unordered_map> #include <unordered_set> #define hash_map unordered_map #define hash_set unordered_set -#else -#include <tr1/unordered_map> -#include <tr1/unordered_set> -#define hash_map tr1::unordered_map -#define hash_set tr1::unordered_set -#endif - -#else - -// gcc >= 4.4 -#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 +#elif HAVE_TR1_UNORDERED_MAP #include <tr1/unordered_map> #include <tr1/unordered_set> @@ -56,6 +46,7 @@ #define hash_set tr1::unordered_set #else + // gcc < 4.4 #if __GNUG__ > 2 #include <ext/hash_map> @@ -87,7 +78,6 @@ namespace std #if __GNUG__ > 2 namespace std { using namespace __gnu_cxx; } #endif -#endif -#endif // CLANG +#endif #endif // STR_HASH_H _______________________________________________ Adonthell-commits mailing list Adonthell-commits@nongnu.org https://lists.nongnu.org/mailman/listinfo/adonthell-commits