CONFIGURE: Add option to build as C++11.
This commit is contained in:
parent
cc0b8594ce
commit
d198ccac26
1 changed files with 41 additions and 9 deletions
32
configure
vendored
32
configure
vendored
|
@ -123,6 +123,7 @@ _libunity=auto
|
||||||
_debug_build=auto
|
_debug_build=auto
|
||||||
_release_build=auto
|
_release_build=auto
|
||||||
_optimizations=auto
|
_optimizations=auto
|
||||||
|
_use_cxx11=no
|
||||||
_verbose_build=no
|
_verbose_build=no
|
||||||
_text_console=no
|
_text_console=no
|
||||||
_mt32emu=yes
|
_mt32emu=yes
|
||||||
|
@ -870,6 +871,7 @@ Game engines:
|
||||||
The values of <engine name> for these options are as follows:
|
The values of <engine name> for these options are as follows:
|
||||||
$engines_help
|
$engines_help
|
||||||
Optional Features:
|
Optional Features:
|
||||||
|
--enable-c++11 build as C++11 if the compiler allows that
|
||||||
--disable-debug disable building with debugging symbols
|
--disable-debug disable building with debugging symbols
|
||||||
--enable-Werror treat warnings as errors
|
--enable-Werror treat warnings as errors
|
||||||
--enable-release enable building in release mode (this activates
|
--enable-release enable building in release mode (this activates
|
||||||
|
@ -1109,6 +1111,12 @@ for ac_option in $@; do
|
||||||
--backend=*)
|
--backend=*)
|
||||||
_backend=`echo $ac_option | cut -d '=' -f 2`
|
_backend=`echo $ac_option | cut -d '=' -f 2`
|
||||||
;;
|
;;
|
||||||
|
--enable-c++11)
|
||||||
|
_use_cxx11=yes
|
||||||
|
;;
|
||||||
|
--disable-c++11)
|
||||||
|
_use_cxx11=no
|
||||||
|
;;
|
||||||
--enable-debug)
|
--enable-debug)
|
||||||
_debug_build=yes
|
_debug_build=yes
|
||||||
;;
|
;;
|
||||||
|
@ -1694,6 +1702,18 @@ if test "$cxx_verc_fail" = yes ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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.
|
# Setup compiler specific CXXFLAGS now that we know the compiler version.
|
||||||
# Foremost, this means enabling various warnings.
|
# Foremost, this means enabling various warnings.
|
||||||
|
@ -1701,6 +1721,8 @@ fi
|
||||||
#
|
#
|
||||||
if test "$have_gcc" = yes ; then
|
if test "$have_gcc" = yes ; then
|
||||||
if test "$_cxx_major" -ge "3" ; then
|
if test "$_cxx_major" -ge "3" ; then
|
||||||
|
# Try to use ANSI mode when C++11 is disabled.
|
||||||
|
if test "$_use_cxx11" = "no" ; then
|
||||||
case $_host_os in
|
case $_host_os in
|
||||||
# newlib-based system include files suppress non-C89 function
|
# newlib-based system include files suppress non-C89 function
|
||||||
# declarations under __STRICT_ANSI__
|
# declarations under __STRICT_ANSI__
|
||||||
|
@ -1710,6 +1732,7 @@ if test "$have_gcc" = yes ; then
|
||||||
CXXFLAGS="$CXXFLAGS -ansi"
|
CXXFLAGS="$CXXFLAGS -ansi"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
|
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
|
||||||
add_line_to_config_mk 'HAVE_GCC3 = 1'
|
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'
|
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'
|
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
|
||||||
fi;
|
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
|
# By default, we add -pedantic to the CXXFLAGS to catch some potentially
|
||||||
# non-portable constructs, like use of GNU extensions.
|
# non-portable constructs, like use of GNU extensions.
|
||||||
# However, some platforms use GNU extensions in system header files, so
|
# However, some platforms use GNU extensions in system header files, so
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue