[PATCH] configure: use -Wp, -D_FORTIFY_SOURCE=0 instead of -D_FORTIFY_SOURCE=0

Anssi Hannula anssi.hannula at iki.fi
Wed Sep 26 13:21:25 CDT 2012


Some Linux distributions (at least Mageia) build packages with
-Wp,-D_FORTIFY_SOURCE=2 by default. There is a check in configure which
checks for enabled fortify and adds "-U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=0". Unfortunately, -Wp,-Dfoo are applied after -Dfoo,
so the added flags fail to override the fortify in the CFLAGS.

Prepend the added arguments with "-Wp," so that they will override both
-DFORTIFY_SOURCE=x and -Wp,-D_FORTIFY_SOURCE=x.
---
 configure.ac |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 79b1175..5c1c37e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1824,7 +1824,8 @@ AC_CACHE_CHECK([for the need to disable Fortify], ac_cv_c_fortify_enabled,
         [ac_cv_c_fortify_enabled=no],[ac_cv_c_fortify_enabled=yes]))
 if test "$ac_cv_c_fortify_enabled" = yes
 then
-    CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
+    # -Wp so that both -Wp,-D_FORTIFY_SOURCE=x and -D_FORTIFY_SOURCE=x are overridden
+    CFLAGS="$CFLAGS -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0"
 fi
 
 dnl **** Check for underscore on external symbols ****
-- 
1.7.10




More information about the wine-patches mailing list