mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
gcc: use c++11 if possible
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@902 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
7e89c8d9db
commit
9b730d4729
33
configure.ac
33
configure.ac
@ -78,6 +78,12 @@ esac
|
||||
|
||||
includedir="${includedir}/tesseract"
|
||||
|
||||
# clear all default flags
|
||||
AM_CXXFLAGS=""
|
||||
AM_CPPFLAGS=""
|
||||
CXXFLAGS=""
|
||||
CPPFLAGS=""
|
||||
|
||||
AC_ARG_WITH(extra-includes,
|
||||
AC_HELP_STRING([--with-extra-includes=DIR],
|
||||
[Define an additional directory for include files]),
|
||||
@ -233,6 +239,33 @@ LT_INIT
|
||||
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
dnl ********************
|
||||
dnl turn on c++11
|
||||
dnl ********************
|
||||
|
||||
OLD_CXXFLAGS=$CXXFLAGS
|
||||
AC_MSG_CHECKING(whether compiler supports C++11)
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_SOURCE([[
|
||||
#if (__cplusplus < 201103L)
|
||||
#error C++ 11 is unsupported
|
||||
#endif
|
||||
]])
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
has_cpp11=yes
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
has_cpp11=no
|
||||
])
|
||||
CXXFLAGS="$OLD_CXXFLAGS"
|
||||
if test "x$has_cpp11" = "xyes"
|
||||
then
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
fi
|
||||
|
||||
# ----------------------------------------
|
||||
# Check for libraries
|
||||
|
@ -31,21 +31,21 @@
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifdef USE_STD_NAMESPACE
|
||||
#if (defined(__GNUC__) && (((__GNUC__ == 3) && ( __GNUC_MINOR__ > 0)) || \
|
||||
__GNUC__ >= 4)) // gcc
|
||||
// hash_set is deprecated in gcc
|
||||
#include <ext/hash_set>
|
||||
using __gnu_cxx::hash_set;
|
||||
#define unordered_set hash_set
|
||||
#elif (__cplusplus >= 201103L) || defined(_MSC_VER) // Visual Studio
|
||||
#if (__cplusplus >= 201103L) || defined(_MSC_VER) // Visual Studio
|
||||
#include <unordered_set>
|
||||
#if (_MSC_VER >= 1500 && _MSC_VER < 1600) // Visual Studio 2008
|
||||
using namespace std::tr1;
|
||||
#else
|
||||
using std::unordered_set;
|
||||
#endif
|
||||
#endif
|
||||
#elif (defined(__GNUC__) && (((__GNUC__ == 3) && ( __GNUC_MINOR__ > 0)) || \
|
||||
__GNUC__ >= 4)) // gcc
|
||||
// hash_set is deprecated in gcc
|
||||
#include <ext/hash_set>
|
||||
using __gnu_cxx::hash_set;
|
||||
#define unordered_set hash_set
|
||||
#else
|
||||
#include <hash_set>
|
||||
#include <hash_set>
|
||||
#endif // gcc
|
||||
#endif // USE_STD_NAMESPACE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user