Add --with-cxx configure option to specify required C++ dialect

Unlike --enable-cxx11, this option requires C++N support and will fail if it's
not available.
This commit is contained in:
Vadim Zeitlin 2016-02-01 04:39:36 +01:00
parent a2ecb7a320
commit 246e15cb17
2 changed files with 2363 additions and 32 deletions

2363
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -628,7 +628,8 @@ dnl global compile options
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
WX_ARG_DISABLE(shared, [ --disable-shared create static library instead of shared], wxUSE_SHARED) WX_ARG_DISABLE(shared, [ --disable-shared create static library instead of shared], wxUSE_SHARED)
WX_ARG_ENABLE(cxx11, [ --enable-cxx11 use C++11 compiler], wxUSE_CXX11) AC_ARG_ENABLE(cxx11, [ --enable-cxx11 use C++11 compiler if available], [wxWITH_CXX=11 wxWITH_CXX_IS_OPTIONAL=1])
AC_ARG_WITH(cxx, [ --with-cxx=11|14 use the given C++11], [wxWITH_CXX="$withval"])
WX_ARG_ENABLE(stl, [ --enable-stl use standard C++ classes for everything], wxUSE_STL) WX_ARG_ENABLE(stl, [ --enable-stl use standard C++ classes for everything], wxUSE_STL)
if test "$wxUSE_STL" = "yes"; then if test "$wxUSE_STL" = "yes"; then
DEFAULT_wxUSE_STD_CONTAINERS=yes DEFAULT_wxUSE_STD_CONTAINERS=yes
@ -1058,10 +1059,31 @@ if test "$CXX" = "g++" -a "$GXX" != "yes"; then
AC_MSG_ERROR([C++ compiler is needed to build wxWidgets]) AC_MSG_ERROR([C++ compiler is needed to build wxWidgets])
fi fi
if test "$wxUSE_CXX11" = "yes"; then if test -n "$wxWITH_CXX"; then
dnl We still continue even if C++11 support is not available, would it be dnl AX_CXX_COMPILE_STDCXX requires its VERSION argument to be specified at
dnl better to stop with an error in this case? dnl autoconf, not run, time.
AX_CXX_COMPILE_STDCXX(11,,optional) case "$wxWITH_CXX" in
11)
if test -n "$wxWITH_CXX_IS_OPTIONAL"; then
AX_CXX_COMPILE_STDCXX(11,,optional)
else
AX_CXX_COMPILE_STDCXX(11)
fi
have_cxxN=$HAVE_CXX11
;;
14)
dnl This check can't be optional because we have only --with-cxx=14
dnl and not --enable-cxx14 option.
AX_CXX_COMPILE_STDCXX(14)
dnl If we have C++14, we necessarily have C++11 too.
HAVE_CXX11=1
;;
*)
AC_MSG_ERROR([Invalid --with-cxx="$wxWITH_CXX" option value, only 11 or 14 supported])
esac
if test "$HAVE_CXX11" = "1" ; then if test "$HAVE_CXX11" = "1" ; then
dnl The standard macro above doesn't set Objective-C++ flags, but we do dnl The standard macro above doesn't set Objective-C++ flags, but we do