mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 17:03:05 +00:00
CONFIGURE: Add option to build as C++11.
This commit is contained in:
parent
cc0b8594ce
commit
d198ccac26
50
configure
vendored
50
configure
vendored
@ -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
|
||||
;;
|
||||
@ -1694,6 +1702,18 @@ if test "$cxx_verc_fail" = yes ; then
|
||||
exit 1
|
||||
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.
|
||||
@ -1701,15 +1721,18 @@ fi
|
||||
#
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user