aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'm4/ax_compiler_flags_ldflags.m4')
-rw-r--r--m4/ax_compiler_flags_ldflags.m423
1 files changed, 21 insertions, 2 deletions
diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4
index 842e329..976d119 100644
--- a/m4/ax_compiler_flags_ldflags.m4
+++ b/m4/ax_compiler_flags_ldflags.m4
@@ -19,13 +19,14 @@
# LICENSE
#
# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
+# Copyright (c) 2017, 2018 Reini Urban <rurban@cpan.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 9
AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
@@ -48,7 +49,25 @@ AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
ax_compiler_flags_test=""
])
- # macOS linker does not have --as-needed
+ AX_CHECK_LINK_FLAG([-Wl,--as-needed], [
+ AX_APPEND_LINK_FLAGS([-Wl,--as-needed],
+ [AM_LDFLAGS],[$ax_compiler_flags_test])
+ ])
+ AX_CHECK_LINK_FLAG([-Wl,-z,relro], [
+ AX_APPEND_LINK_FLAGS([-Wl,-z,relro],
+ [AM_LDFLAGS],[$ax_compiler_flags_test])
+ ])
+ AX_CHECK_LINK_FLAG([-Wl,-z,now], [
+ AX_APPEND_LINK_FLAGS([-Wl,-z,now],
+ [AM_LDFLAGS],[$ax_compiler_flags_test])
+ ])
+ AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [
+ AX_APPEND_LINK_FLAGS([-Wl,-z,noexecstack],
+ [AM_LDFLAGS],[$ax_compiler_flags_test])
+ ])
+ # textonly, retpolineplt not yet
+
+ # macOS and cygwin linker do not have --as-needed
AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [
ax_compiler_flags_as_needed_option="-Wl,--no-as-needed"
], [