summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-07-02 07:55:33 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-07-02 07:56:10 -0400
commite2303f682b76c6c494c11083756ee687fe98eaa9 (patch)
tree7793eb014e1df6aecbcd3da83451710f580ba0cd /Configure
parent289e2b8e6dc026febcbfcc97e0ef86e4afbe4a1c (diff)
downloadperl-e2303f682b76c6c494c11083756ee687fe98eaa9.tar.gz
Enable _FORTIFY_SOURCE only if optimizing, as specified.
As noticed by Dave Mitchell.
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure15
1 files changed, 10 insertions, 5 deletions
diff --git a/Configure b/Configure
index 2e404d7d52..8cb09bdbf9 100755
--- a/Configure
+++ b/Configure
@@ -22221,12 +22221,17 @@ fi
: add -D_FORTIFY_SOURCE if feasible and not already there
case "$gccversion" in
-4.*) case "$ccflags$cppsymbols" in
- *_FORTIFY_SOURCE=*) # Don't add it again.
- echo "You seem to have -D_FORTIFY_SOURCE already..." >&4
+4.*) case "$optimize$ccflags" in
+ *-O*) case "$ccflags$cppsymbols" in
+ *_FORTIFY_SOURCE=*) # Don't add it again.
+ echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
+ ;;
+ *) echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
+ ccflags="$ccflags -D_FORTIFY_SOURCE=2"
+ ;;
+ esac
;;
- *) ccflags="$ccflags -D_FORTIFY_SOURCE=2"
- echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
+ *) echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
;;
esac
;;