From: Wouter Wijngaards Date: Fri, 3 Nov 2017 10:52:25 +0000 (+0000) Subject: - Fix #2034 - Autoconf and -flto. X-Git-Tag: release-1.7.0rc1~161 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02fdb4c8792c7a282a3b726eee9d9cc9ac71e557;p=thirdparty%2Funbound.git - Fix #2034 - Autoconf and -flto. git-svn-id: file:///svn/unbound/trunk@4397 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/configure b/configure index 96fb7eb19..1c57b61ed 100755 --- a/configure +++ b/configure @@ -4429,6 +4429,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu # allow user to override the -g -O2 flags. +default_cflags=no if test "x$CFLAGS" = "x" ; then @@ -4492,6 +4493,7 @@ $as_echo "no" >&6; } fi +default_cflags=yes fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -5945,6 +5947,10 @@ $as_echo "#define UNBOUND_DEBUG /**/" >>confdefs.h # nothing to do. ;; esac +if test "$default_cflags" = "yes"; then + # only when CFLAGS was "" at the start, if the users wants to + # override we shouldn't add default cflags, because they wouldn't + # be able to turn off these options and set the CFLAGS wanted. # Check whether --enable-flto was given. if test "${enable_flto+set}" = set; then : @@ -6079,6 +6085,7 @@ rm -f core conftest.err conftest.$ac_objext \ fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } diff --git a/configure.ac b/configure.ac index 5c2059ed7..f5093a3eb 100644 --- a/configure.ac +++ b/configure.ac @@ -246,9 +246,11 @@ AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource f AC_C_CONST AC_LANG_C # allow user to override the -g -O2 flags. +default_cflags=no if test "x$CFLAGS" = "x" ; then ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"]) ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) +default_cflags=yes fi AC_PROG_CC ACX_DEPFLAG @@ -272,9 +274,14 @@ case "$debug_enabled" in # nothing to do. ;; esac -ACX_CHECK_FLTO -ACX_CHECK_PIE -ACX_CHECK_RELRO_NOW +if test "$default_cflags" = "yes"; then + # only when CFLAGS was "" at the start, if the users wants to + # override we shouldn't add default cflags, because they wouldn't + # be able to turn off these options and set the CFLAGS wanted. + ACX_CHECK_FLTO + ACX_CHECK_PIE + ACX_CHECK_RELRO_NOW +fi AC_C_INLINE ACX_CHECK_FORMAT_ATTRIBUTE diff --git a/doc/Changelog b/doc/Changelog index 5e9b0a8cb..694426803 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,6 @@ 3 November 2017: Wouter - Fix #2362: TLS1.3/openssl-1.1.1 not working. + - Fix #2034 - Autoconf and -flto. 2 November 2017: Wouter - Fix #1913: ub_ctx_config is under circumstances thread-safe.