From 2a4d39b7e86af6a89bceecead1d9c97137b1fbf1 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 30 Jan 2016 19:14:38 +0900 Subject: [PATCH] Don't add C++11 switch flags to CXXFLAGS --- configure.ac | 13 +++++++++++++ src/Makefile.am | 2 +- test/Makefile.am | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 10e27924..2e41498b 100644 --- a/configure.ac +++ b/configure.ac @@ -132,9 +132,19 @@ AC_LANG([C++]) PKG_PROG_PKG_CONFIG([0.20]) # Check C++ compiler supports C++0x/C++11 feature +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= + AX_CXX_COMPILE_STDCXX_11([noext], [mandatory]) +CXX1XCXXFLAGS="$CXXFLAGS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_SUBST([CXX1XCXXFLAGS]) + # Check C++ compiler actually supports nullptr +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXX1XCXXFLAGS" + AC_MSG_CHECKING([whether the c++ compiler supports nullptr]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], @@ -165,6 +175,8 @@ Derived x; AC_DEFINE_UNQUOTED([CXX11_OVERRIDE], [$cxx11_override], [Define `override` keyword if the compiler supports it]) +CXXFLAGS=$ac_save_CXXFLAGS + # Check static build is requested if test "x$ARIA2_STATIC" = "xyes"; then case "$host" in @@ -1165,6 +1177,7 @@ CPPFLAGS: $CPPFLAGS LDFLAGS: $LDFLAGS LIBS: $LIBS DEFS: $DEFS +CXX1XCXXFLAGS: $CXX1XCXXFLAGS EXTRACXXFLAGS: $EXTRACXXFLAGS EXTRACFLAGS: $EXTRACFLAGS EXTRACPPFLAGS: $EXTRACPPFLAGS diff --git a/src/Makefile.am b/src/Makefile.am index 14c21695..629218bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -763,5 +763,5 @@ LDADD = libaria2.la @ALLOCA@ \ AM_CFLAGS = @EXTRACFLAGS@ -AM_CXXFLAGS = @WARNCXXFLAGS@ @EXTRACXXFLAGS@ +AM_CXXFLAGS = @WARNCXXFLAGS@ @CXX1XCXXFLAGS@ @EXTRACXXFLAGS@ diff --git a/test/Makefile.am b/test/Makefile.am index 47be2bc1..2315882f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -294,7 +294,7 @@ AM_LDFLAGS = \ AM_CFLAGS = @EXTRACFLAGS@ -AM_CXXFLAGS = @WARNCXXFLAGS@ @EXTRACXXFLAGS@ +AM_CXXFLAGS = @WARNCXXFLAGS@ @CXX1XCXXFLAGS@ @EXTRACXXFLAGS@ EXTRA_DIST = 4096chunk.txt\ chunkChecksumTestFile250.txt\