INN commit: branches/2.6 (configure.ac m4/cc-flags.m4)
INN Commit
rra at isc.org
Tue Dec 1 21:10:12 UTC 2020
Date: Tuesday, December 1, 2020 @ 13:10:12
Author: iulius
Revision: 10434
Fix build issue in linker feature probing
Thanks to Bo Lindbergh for the report.
Modified:
branches/2.6/configure.ac
branches/2.6/m4/cc-flags.m4
----------------+
configure.ac | 7 ++++---
m4/cc-flags.m4 | 27 +++++++++++++++++++++++----
2 files changed, 27 insertions(+), 7 deletions(-)
Modified: configure.ac
===================================================================
--- configure.ac 2020-12-01 21:08:53 UTC (rev 10433)
+++ configure.ac 2020-12-01 21:10:12 UTC (rev 10434)
@@ -616,14 +616,15 @@
AS_IF([test x"$inn_enable_hardening_flags" = xyes],
[INN_PROG_CC_FLAG([-fPIE], [CFLAGS="${CFLAGS} -fPIE"
CC_WARNINGS="${CC_WARNINGS} -fPIE"
- LDFLAGS="${LDFLAGS} -fPIE -pie"], [])
+ INN_PROG_LD_FLAG([-pie],
+ [LDFLAGS="${LDFLAGS} -pie"], [])])
INN_PROG_CC_FLAG([-fstack-protector-strong],
[CFLAGS="${CFLAGS} -fstack-protector-strong"
CC_WARNINGS="${CC_WARNINGS} -fstack-protector-strong"],
[])
- INN_PROG_CC_FLAG([-Wl,-z,relro],
+ INN_PROG_LD_FLAG([-Wl,-z,relro],
[LDFLAGS="${LDFLAGS} -Wl,-z,relro"], [])
- INN_PROG_CC_FLAG([-Wl,-z,now],
+ INN_PROG_LD_FLAG([-Wl,-z,now],
[LDFLAGS="${LDFLAGS} -Wl,-z,now"], [])])
dnl Clean up our LIBS, just for grins.
Modified: m4/cc-flags.m4
===================================================================
--- m4/cc-flags.m4 2020-12-01 21:08:53 UTC (rev 10433)
+++ m4/cc-flags.m4 2020-12-01 21:10:12 UTC (rev 10434)
@@ -1,9 +1,10 @@
dnl Check whether the compiler supports particular flags.
dnl $Id$
dnl
-dnl Provides INN_PROG_CC_FLAG, which checks whether a compiler supports a
-dnl given flag. If it does, the commands in the second argument are run. If
-dnl not, the commands in the third argument are run.
+dnl Provides INN_PROG_CC_FLAG and INN_PROG_LD_FLAG, which checks whether a
+dnl compiler supports a given flag for either compilation or linking,
+dnl respectively. If it does, the commands in the second argument are run.
+dnl If not, the commands in the third argument are run.
dnl
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
@@ -29,8 +30,11 @@
dnl Used to build the result cache name.
AC_DEFUN([_INN_PROG_CC_FLAG_CACHE],
[translit([inn_cv_compiler_c_$1], [-=+,], [____])])
+AC_DEFUN([_INN_PROG_LD_FLAG_CACHE],
+[translit([inn_cv_linker_c_$1], [-=+,], [____])])
-dnl Check whether a given flag is supported by the compiler.
+dnl Check whether a given flag is supported by the compiler when compiling a C
+dnl source file.
AC_DEFUN([INN_PROG_CC_FLAG],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([if $CC supports $1])
@@ -46,3 +50,18 @@
AC_MSG_RESULT([$_INN_PROG_CC_FLAG_CACHE([$1])])
AS_IF([test x"$_INN_PROG_CC_FLAG_CACHE([$1])" = xyes], [$2], [$3])])
+dnl Check whether a given flag is supported by the compiler when linking an
+dnl executable.
+AC_DEFUN([INN_PROG_LD_FLAG],
+[AC_REQUIRE([AC_PROG_CC])
+ AC_MSG_CHECKING([if $CC supports $1 for linking])
+ AC_CACHE_VAL([_INN_PROG_LD_FLAG_CACHE([$1])],
+ [save_LDFLAGS=$LDFLAGS
+ LDFLAGS="$LDFLAGS $1"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int foo = 0;])],
+ [_INN_PROG_LD_FLAG_CACHE([$1])=yes],
+ [_INN_PROG_LD_FLAG_CACHE([$1])=no])
+ LDFLAGS=$save_LDFLAGS])
+ AC_MSG_RESULT([$_INN_PROG_LD_FLAG_CACHE([$1])])
+ AS_IF([test x"$_INN_PROG_LD_FLAG_CACHE([$1])" = xyes], [$2], [$3])])
+
More information about the inn-committers
mailing list