diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/configure.in b/configure.in index 3dcd8bc6..ee0d40ba 100644 --- a/configure.in +++ b/configure.in @@ -211,7 +211,17 @@ if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-fPIC[\ \ ]*) ;; *) if cc_supports_flag -fPIC; then - CFLAGS="$CFLAGS -fPIC" + PIC_CFLAGS="-fPIC" + PIC_LDFLAGS="-Wl,-z,relro" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fPIE[\ \ ]*) ;; + *) if cc_supports_flag -fPIE; then + PIE_CFLAGS="-fPIE" + PIE_LDFLAGS="-pie -Wl,-z,relro" fi ;; esac @@ -257,6 +267,11 @@ else fi fi +AC_SUBST(PIC_CFLAGS) +AC_SUBST(PIC_LDFLAGS) +AC_SUBST(PIE_CFLAGS) +AC_SUBST(PIE_LDFLAGS) + # Check for -Wl,--gc-sections AC_MSG_CHECKING([for ld that supports "-Wl,--gc-sections"]) AC_TRY_LINK([ |