From 06d6c425df78028ab32388baaefdbd4d98a4c396 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Mon, 22 Jun 2015 18:09:01 +0200 Subject: [PATCH] Fix CPPFLAGS for GCC 5 (add -P flag) --- configure | 179 +++++++++++++++++++++++++++++++++++---------------- configure.ac | 3 + 2 files changed, 125 insertions(+), 57 deletions(-) diff --git a/configure b/configure index 10b589cf..526c4edb 100755 --- a/configure +++ b/configure @@ -15581,6 +15581,128 @@ ac_config_headers="$ac_config_headers config.h include/GyotoConfig.h" VERSINFO=4:0:0 +# Needed for gcc-5, should be harmless for other compilers: +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts " >&5 +$as_echo_n "checking whether C++ compiler accepts ... " >&6; } +if ${ax_cv_check_cxxflags__+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS " + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_check_cxxflags__=yes +else + ax_cv_check_cxxflags__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__" >&5 +$as_echo "$ax_cv_check_cxxflags__" >&6; } +if test x"$ax_cv_check_cxxflags__" = xyes; then : + : +else + : +fi + +if ${CXXFLAGS+:} false; then : + case " $CXXFLAGS " in + *" "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains "; } >&5 + (: CXXFLAGS already contains ) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \""; } >&5 + (: CXXFLAGS="$CXXFLAGS ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CXXFLAGS="$CXXFLAGS " + ;; + esac +else + CXXFLAGS="" +fi + + + +for flag in -P; do + as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 +$as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $flag" + 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 test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : + if ${CPPFLAGS+:} false; then : + case " $CPPFLAGS " in + *" $flag "*) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS already contains \$flag"; } >&5 + (: CPPFLAGS already contains $flag) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; + *) + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \$flag\""; } >&5 + (: CPPFLAGS="$CPPFLAGS $flag") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CPPFLAGS="$CPPFLAGS $flag" + ;; + esac +else + CPPFLAGS="$flag" +fi + +else + : +fi + +done + + FEATURES="" # Check whether --enable-release was given. if test "${enable_release+set}" = set; then : @@ -17752,63 +17874,6 @@ done # Provide additional defaults for user variables -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts " >&5 -$as_echo_n "checking whether C++ compiler accepts ... " >&6; } -if ${ax_cv_check_cxxflags__+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS " - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv_check_cxxflags__=yes -else - ax_cv_check_cxxflags__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__" >&5 -$as_echo "$ax_cv_check_cxxflags__" >&6; } -if test x"$ax_cv_check_cxxflags__" = xyes; then : - : -else - : -fi - -if ${CXXFLAGS+:} false; then : - case " $CXXFLAGS " in - *" "*) - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains "; } >&5 - (: CXXFLAGS already contains ) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \""; } >&5 - (: CXXFLAGS="$CXXFLAGS ") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - CXXFLAGS="$CXXFLAGS " - ;; - esac -else - CXXFLAGS="" -fi - for flag in -rdynamic; do diff --git a/configure.ac b/configure.ac index ef15277e..277bfe43 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,9 @@ AC_CONFIG_HEADERS([config.h include/GyotoConfig.h]) VERSINFO=4:0:0 AC_SUBST([VERSINFO]) +# Needed for gcc-5, should be harmless for other compilers: +AX_APPEND_COMPILE_FLAGS([-P], [CPPFLAGS]) + FEATURES="" AC_ARG_ENABLE([release], [AS_HELP_STRING([--enable-release],