diff configure @ 1976:810a0b8f5472 c++14

Requiring c++14 is not going to work for Travis (because we want to support a Qt version too old to know about the c++14 config flag) or for our AppImage build (because we want to run on distros to old to support the relevant gcc ABI). So instead we try to confine the C++ standard selection to one place (config/noconfig) and revert to c++11 if the compiler is too old to know about c++14. All of the actual SV code remains c++11, and we assume we build against an older version of capnproto when we want to perform a c++11 build.
author Chris Cannam
date Fri, 31 Aug 2018 13:41:27 +0100
parents 714f8dad57bc
children 5ffcb4e10e1b
line wrap: on
line diff
--- a/configure	Fri Aug 31 12:16:59 2018 +0100
+++ b/configure	Fri Aug 31 13:41:27 2018 +0100
@@ -624,6 +624,7 @@
 LIBOBJS
 QMAKE_CONFIG
 HAVES
+CXXSTANDARD
 CXXFLAGS_MINIMAL
 CUT
 SHA1SUM
@@ -4422,13 +4423,53 @@
 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS"
 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS"
 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
+CXXSTANDARD=c++14
 
 if test "x$GCC" = "xyes"; then
    	CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
         CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -O2 -Werror"
    	CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math"
    	CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0"
-        LIBS_DEBUG="$LIBS -lubsan"
+        LIBS_DEBUG="$LIBS"
+        as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__--std=$CXXSTANDARD" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts --std=$CXXSTANDARD" >&5
+$as_echo_n "checking whether C++ compiler accepts --std=$CXXSTANDARD... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CXXFLAGS
+  CXXFLAGS="$CXXFLAGS  --std=$CXXSTANDARD"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CXXFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+  :
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Compiler does not appear to support $CXXSTANDARD, falling back to c++11" >&5
+$as_echo "$as_me: Compiler does not appear to support $CXXSTANDARD, falling back to c++11" >&6;}
+        CXXSTANDARD=c++11
+fi
+
 fi
 
 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE"
@@ -7353,6 +7394,7 @@
 
 
 
+
 ac_config_files="$ac_config_files config.pri"