From 640e867dbd70bbebefa0baaeffd894016478a7d5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 30 Oct 2015 10:11:55 -0600 Subject: [PATCH] Don't use CPPFLAGS for the -fstack-protector check. Otherwise on systems with _FORTIFY_SOURCE support we'll get an error due to the lack of optimization flags. Bug #725 --- configure | 9 ++++++--- configure.ac | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 6a27b2f63..8c53fcce5 100755 --- a/configure +++ b/configure @@ -23922,12 +23922,14 @@ if ${sudo_cv_var_stack_protector+:} false; then : $as_echo_n "(cached) " >&6 else - # Avoid using CFLAGS since the compiler might optimize away our - # test. We don't want LIBS to interfere with the test but keep - # LDFLAGS as it may have an rpath needed to find the ssp lib. + # Avoid CFLAGS since the compiler might optimize away our test. + # We don't want CPPFLAGS or LIBS to interfere with the test but + # keep LDFLAGS as it may have an rpath needed to find the ssp lib. + _CPPFLAGS="$CPPFLAGS" _CFLAGS="$CFLAGS" _LDFLAGS="$LDFLAGS" _LIBS="$LIBS" + CPPFLAGS= LIBS= sudo_cv_var_stack_protector="-fstack-protector-strong" @@ -24003,6 +24005,7 @@ rm -f core conftest.err conftest.$ac_objext \ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + CPPFLAGS="$_CPPFLAGS" CFLAGS="$_CFLAGS" LDFLAGS="$_LDFLAGS" LIBS="$_LIBS" diff --git a/configure.ac b/configure.ac index 97253eed1..c0425cc58 100644 --- a/configure.ac +++ b/configure.ac @@ -3791,7 +3791,7 @@ SUDO_TZDIR dnl dnl Turn warnings into errors. dnl All compiler/loader tests after this point will fail if -dnl a warning is displayed (nornally, warnings are not fata). +dnl a warning is displayed (normally, warnings are not fatal). dnl AC_LANG_WERROR @@ -3981,12 +3981,14 @@ if test "$enable_hardening" != "no"; then AC_CACHE_CHECK([for compiler stack protector support], [sudo_cv_var_stack_protector], [ - # Avoid using CFLAGS since the compiler might optimize away our - # test. We don't want LIBS to interfere with the test but keep - # LDFLAGS as it may have an rpath needed to find the ssp lib. + # Avoid CFLAGS since the compiler might optimize away our test. + # We don't want CPPFLAGS or LIBS to interfere with the test but + # keep LDFLAGS as it may have an rpath needed to find the ssp lib. + _CPPFLAGS="$CPPFLAGS" _CFLAGS="$CFLAGS" _LDFLAGS="$LDFLAGS" _LIBS="$LIBS" + CPPFLAGS= LIBS= sudo_cv_var_stack_protector="-fstack-protector-strong" @@ -4014,6 +4016,7 @@ if test "$enable_hardening" != "no"; then ]) ]) ]) + CPPFLAGS="$_CPPFLAGS" CFLAGS="$_CFLAGS" LDFLAGS="$_LDFLAGS" LIBS="$_LIBS" -- 2.40.0