From 0369d0e7389a5da3d63c2a459662e32d0c47143d Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 1 Mar 2014 03:33:08 +0000 Subject: [PATCH] [C++11] Replace autoconf --enable-cxx11 with --enable-cxx1y. The baseline is now C++11, and we unconditionally add -std=c++11 to the flags. This has the dim potential to break some non-GNU-compatible compiler (in terms of -std flags) using the makefiles, but those makefiles are littered with GNU-style compile flags so it would be very surprising to me for it to actually happen in practice. As always, do let me know if there is a toolchain you're using where this doesn't work, and I'll be watching the bots. llvm-svn: 202569 --- Makefile.config.in | 5 +++-- Makefile.rules | 6 ++++-- autoconf/configure.ac | 16 ++++++++-------- configure | 22 +++++++++++----------- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Makefile.config.in b/Makefile.config.in index cf6a4f14d77..a272050c75a 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -244,8 +244,9 @@ RDYNAMIC := @RDYNAMIC@ #ENABLE_LIBCPP = 0 ENABLE_LIBCPP = @ENABLE_LIBCPP@ -# When ENABLE_CXX11 is enabled, LLVM uses c++11 mode by default to build. -ENABLE_CXX11 = @ENABLE_CXX11@ +# When ENABLE_CXX1Y is enabled, LLVM uses c++1y mode by default to build. +# Otherwise it uses the baseline c++11. +ENABLE_CXX1Y = @ENABLE_CXX1Y@ # When ENABLE_SPLIT_DWARF is enabled, LLVM uses -gfission to build in debug mode. ENABLE_SPLIT_DWARF = @ENABLE_SPLIT_DWARF@ diff --git a/Makefile.rules b/Makefile.rules index 3f1c2afe73d..62428d1a722 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -319,8 +319,10 @@ ifeq ($(ENABLE_LIBCPP),1) LD.Flags += -stdlib=libc++ endif -ifeq ($(ENABLE_CXX11),1) - CXX.Flags += -std=c++11 +ifeq ($(ENABLE_CXX1Y),1) + CXX.Flags += -std=c++1y +else + CXX.Flags += -std=c++11 endif ifeq ($(ENABLE_WERROR),1) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 018321591c2..72e423928e9 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -589,16 +589,16 @@ bypass these sanity checks.])]) ;; esac -dnl --enable-cxx11 : check whether or not to use -std=c++11 on the command line -AC_ARG_ENABLE(cxx11, - AS_HELP_STRING([--enable-cxx11], - [Use c++11 if available (default is YES)]),, +dnl --enable-cxx1y : check whether or not to use -std=c++1y on the command line +AC_ARG_ENABLE(cxx1y, + AS_HELP_STRING([--enable-cxx1y], + [Use c++1y if available (default is NO)]),, enableval=default) case "$enableval" in - yes) AC_SUBST(ENABLE_CXX11,[1]) ;; - no) AC_SUBST(ENABLE_CXX11,[0]) ;; - default) AC_SUBST(ENABLE_CXX11,[1]);; - *) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;; + yes) AC_SUBST(ENABLE_CXX1Y,[1]) ;; + no) AC_SUBST(ENABLE_CXX1Y,[0]) ;; + default) AC_SUBST(ENABLE_CXX1Y,[0]);; + *) AC_MSG_ERROR([Invalid setting for --enable-cxx1y. Use "yes" or "no"]) ;; esac dnl --enable-fission : check whether or not to use -gsplit-dwarf on the command diff --git a/configure b/configure index deab9899d95..534cd47a007 100755 --- a/configure +++ b/configure @@ -684,7 +684,7 @@ BUILD_EXEEXT BUILD_CXX CVSBUILD ENABLE_LIBCPP -ENABLE_CXX11 +ENABLE_CXX1Y ENABLE_SPLIT_DWARF ENABLE_CLANG_ARCMT ENABLE_CLANG_STATIC_ANALYZER @@ -1402,7 +1402,7 @@ Optional Features: --enable-compiler-version-checks Check the version of the host compiler (default is YES) - --enable-cxx11 Use c++11 if available (default is YES) + --enable-cxx1y Use c++1y if available (default is NO) --enable-split-dwarf Use split-dwarf if available (default is NO) --enable-clang-arcmt Enable building of clang ARCMT (default is YES) --enable-clang-static-analyzer @@ -4804,22 +4804,22 @@ echo "$as_me: error: Invalid setting for --enable-compiler-version-checks. Use \ ;; esac -# Check whether --enable-cxx11 was given. -if test "${enable_cxx11+set}" = set; then - enableval=$enable_cxx11; +# Check whether --enable-cxx1y was given. +if test "${enable_cxx1y+set}" = set; then + enableval=$enable_cxx1y; else enableval=default fi case "$enableval" in - yes) ENABLE_CXX11=1 + yes) ENABLE_CXX1Y=1 ;; - no) ENABLE_CXX11=0 + no) ENABLE_CXX1Y=0 ;; - default) ENABLE_CXX11=1 + default) ENABLE_CXX1Y=0 ;; - *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-cxx11. Use \"yes\" or \"no\"" >&5 -echo "$as_me: error: Invalid setting for --enable-cxx11. Use \"yes\" or \"no\"" >&2;} + *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-cxx1y. Use \"yes\" or \"no\"" >&5 +echo "$as_me: error: Invalid setting for --enable-cxx1y. Use \"yes\" or \"no\"" >&2;} { (exit 1); exit 1; }; } ;; esac @@ -20165,7 +20165,7 @@ BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim BUILD_CXX!$BUILD_CXX$ac_delim CVSBUILD!$CVSBUILD$ac_delim ENABLE_LIBCPP!$ENABLE_LIBCPP$ac_delim -ENABLE_CXX11!$ENABLE_CXX11$ac_delim +ENABLE_CXX1Y!$ENABLE_CXX1Y$ac_delim ENABLE_SPLIT_DWARF!$ENABLE_SPLIT_DWARF$ac_delim ENABLE_CLANG_ARCMT!$ENABLE_CLANG_ARCMT$ac_delim ENABLE_CLANG_STATIC_ANALYZER!$ENABLE_CLANG_STATIC_ANALYZER$ac_delim