# DP: When using GCC versions older than 4.9, automagically mangle # DP: -fstack-protector-strong to -fstack-protector --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -15,6 +15,7 @@ import os import re import string import sys +import fnmatch from distutils.errors import DistutilsPlatformError @@ -207,6 +208,10 @@ def customize_compiler(compiler): cc = newcc if 'CXX' in os.environ: cxx = os.environ['CXX'] + if fnmatch.filter([cc, cxx], '*-4.[0-8]'): + configure_cflags = configure_cflags.replace('-fstack-protector-strong', '-fstack-protector') + ldshared = ldshared.replace('-fstack-protector-strong', '-fstack-protector') + cflags = cflags.replace('-fstack-protector-strong', '-fstack-protector') if 'LDSHARED' in os.environ: ldshared = os.environ['LDSHARED'] if 'CPP' in os.environ: