components/python/python27/patches/13-pic-compile.patch
author John Beck <John.Beck@Oracle.COM>
Thu, 22 May 2014 14:36:47 -0700
changeset 1914 00e8dbcb9b1e
parent 756 3602fbc18c59
child 1954 32663e59626d
permissions -rw-r--r--
PSARC 2014/183 Python 2.7.6 18251953 update Python 2.7 line to version 2.7.6

--- Python-2.7.6/Lib/distutils/sysconfig.py.~1~	2013-11-09 23:36:40.000000000 -0800
+++ Python-2.7.6/Lib/distutils/sysconfig.py	2014-05-14 13:33:21.453593946 -0700
@@ -208,6 +208,15 @@
         else:
             archiver = ar + ' ' + ar_flags
 
+        # Force PIC compilation. Determine if GNU compiler or otherwise
+        # and set the PIC flag(s) accordingly. Defaults to Studio compiler.
+        out = os.popen(cc + ' --version 2>/dev/null', 'r')
+        out_string = out.read()
+        out.close()
+        result = re.search(' (\d+\.\d+(\.\d+)*)', out_string)
+        kpic_flags = "-fPIC -DPIC" if result else "-KPIC -DPIC"
+        cflags += ' ' + kpic_flags
+
         cc_cmd = cc + ' ' + cflags
         compiler.set_executables(
             preprocessor=cpp,