mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-11 04:33:20 +08:00
Use C++14 compiler if possible
This allows using new features of C++14 conditionally. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
b3327f4e90
commit
fd6e281c61
48
configure.ac
48
configure.ac
@ -331,46 +331,42 @@ AC_COMPILE_IFELSE(
|
|||||||
|
|
||||||
AC_MSG_RESULT([$CLANG])
|
AC_MSG_RESULT([$CLANG])
|
||||||
|
|
||||||
dnl ********************
|
dnl **********************
|
||||||
dnl turn on c++11
|
dnl Turn on C++11 or newer
|
||||||
dnl ********************
|
dnl **********************
|
||||||
|
|
||||||
OLD_CXXFLAGS=$CXXFLAGS
|
CPLUSPLUS=
|
||||||
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)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_ERROR([Your compiler does not have the necessary c++11 support! Cannot proceed.])
|
|
||||||
])
|
|
||||||
CXXFLAGS="$OLD_CXXFLAGS"
|
|
||||||
|
|
||||||
|
AX_CHECK_COMPILE_FLAG([-std=c++11], [cplusplus11=true], [cplusplus11=false])
|
||||||
|
if $cplusplus11; then
|
||||||
|
CPLUSPLUS=11
|
||||||
|
fi
|
||||||
|
|
||||||
# set c++11 support based on platform/compiler
|
AX_CHECK_COMPILE_FLAG([-std=c++14], [cplusplus14=true], [cplusplus14=false])
|
||||||
|
if $cplusplus14; then
|
||||||
|
CPLUSPLUS=14
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$CPLUSPLUS"; then
|
||||||
|
AC_MSG_ERROR([Your compiler does not have the necessary C++11 support! Cannot proceed.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set C++11 or C++14 support based on platform/compiler
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
cygwin*)
|
cygwin*)
|
||||||
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
CXXFLAGS="$CXXFLAGS -std=gnu++$CPLUSPLUS"
|
||||||
;;
|
;;
|
||||||
*-darwin* | *-macos10*)
|
*-darwin* | *-macos10*)
|
||||||
if test "x$CLANG" = "xyes"; then
|
if test "x$CLANG" = "xyes"; then
|
||||||
CXXFLAGS="$CXXFLAGS -std=c++11 "
|
CXXFLAGS="$CXXFLAGS -std=c++$CPLUSPLUS"
|
||||||
LDFLAGS="$LDFLAGS -stdlib=libc++"
|
LDFLAGS="$LDFLAGS -stdlib=libc++"
|
||||||
else
|
else
|
||||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
CXXFLAGS="$CXXFLAGS -std=c++$CPLUSPLUS"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# default
|
# default
|
||||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
CXXFLAGS="$CXXFLAGS -std=c++$CPLUSPLUS"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user