]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix build with 3.x gcc versions.
authorStefan Krah <skrah@bytereef.org>
Thu, 17 Jan 2013 11:49:34 +0000 (12:49 +0100)
committerStefan Krah <skrah@bytereef.org>
Thu, 17 Jan 2013 11:49:34 +0000 (12:49 +0100)
setup.py

index 3bbd623c5dc6e73a704ee609604c63f00045f383..4d6932686024feb0323635647fc841c59f643596 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1997,8 +1997,12 @@ class PyBuildExt(build_ext):
 
         # Increase warning level for gcc:
         if 'gcc' in cc:
-            extra_compile_args.extend(['-Wextra',
-                                       '-Wno-missing-field-initializers'])
+            cmd = ("echo '' | gcc -Wextra -Wno-missing-field-initializers -E - "
+                   "> /dev/null 2>&1")
+            ret = os.system(cmd)
+            if ret >> 8 == 0:
+                extra_compile_args.extend(['-Wextra',
+                                           '-Wno-missing-field-initializers'])
 
         # Uncomment for extra functionality:
         #define_macros.append(('EXTRA_FUNCTIONALITY', 1))