aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorJohannes Schickel2013-01-09 07:53:21 +0100
committerJohannes Schickel2013-01-09 07:53:41 +0100
commitd198ccac2619b43671d39beac126342ea6d9cc64 (patch)
treee97d06f800885d3834a6e2138b03996db25b04fe /configure
parentcc0b8594ce402d7aae25a284381805216c615c39 (diff)
downloadscummvm-rg350-d198ccac2619b43671d39beac126342ea6d9cc64.tar.gz
scummvm-rg350-d198ccac2619b43671d39beac126342ea6d9cc64.tar.bz2
scummvm-rg350-d198ccac2619b43671d39beac126342ea6d9cc64.zip
CONFIGURE: Add option to build as C++11.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure50
1 files changed, 41 insertions, 9 deletions
diff --git a/configure b/configure
index b703776f8b..91364eb304 100755
--- a/configure
+++ b/configure
@@ -123,6 +123,7 @@ _libunity=auto
_debug_build=auto
_release_build=auto
_optimizations=auto
+_use_cxx11=no
_verbose_build=no
_text_console=no
_mt32emu=yes
@@ -870,6 +871,7 @@ Game engines:
The values of <engine name> for these options are as follows:
$engines_help
Optional Features:
+ --enable-c++11 build as C++11 if the compiler allows that
--disable-debug disable building with debugging symbols
--enable-Werror treat warnings as errors
--enable-release enable building in release mode (this activates
@@ -1109,6 +1111,12 @@ for ac_option in $@; do
--backend=*)
_backend=`echo $ac_option | cut -d '=' -f 2`
;;
+ --enable-c++11)
+ _use_cxx11=yes
+ ;;
+ --disable-c++11)
+ _use_cxx11=no
+ ;;
--enable-debug)
_debug_build=yes
;;
@@ -1695,21 +1703,36 @@ if test "$cxx_verc_fail" = yes ; then
fi
#
+# Check whether the compiler supports C++11
+#
+have_cxx11=no
+cat > $TMPC << EOF
+int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; }
+EOF
+cc_check -std=c++11 && have_cxx11=yes
+if test "$_use_cxx11" = "yes" ; then
+ _use_cxx11=$have_cxx11
+fi
+
+#
# Setup compiler specific CXXFLAGS now that we know the compiler version.
# Foremost, this means enabling various warnings.
# In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC.
#
if test "$have_gcc" = yes ; then
if test "$_cxx_major" -ge "3" ; then
- case $_host_os in
- # newlib-based system include files suppress non-C89 function
- # declarations under __STRICT_ANSI__
- amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince )
- ;;
- *)
- CXXFLAGS="$CXXFLAGS -ansi"
- ;;
- esac
+ # Try to use ANSI mode when C++11 is disabled.
+ if test "$_use_cxx11" = "no" ; then
+ case $_host_os in
+ # newlib-based system include files suppress non-C89 function
+ # declarations under __STRICT_ANSI__
+ amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince )
+ ;;
+ *)
+ CXXFLAGS="$CXXFLAGS -ansi"
+ ;;
+ esac
+ fi
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
add_line_to_config_mk 'HAVE_GCC3 = 1'
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
@@ -1725,6 +1748,15 @@ elif test "$have_icc" = yes ; then
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
fi;
+#
+# Update status about C++11 mode
+#
+echo_n "Building as C++11... "
+if test "$_use_cxx11" = "yes" ; then
+ CXXFLAGS="$CXXFLAGS -std=c++11"
+fi
+echo $_use_cxx11
+
# By default, we add -pedantic to the CXXFLAGS to catch some potentially
# non-portable constructs, like use of GNU extensions.
# However, some platforms use GNU extensions in system header files, so