components/python/python27/patches/13-pic-compile.patch
author John Beck <John.Beck@Oracle.COM>
Wed, 17 Dec 2014 09:46:51 -0800
changeset 3555 76f4672c5e4b
parent 1954 32663e59626d
permissions -rw-r--r--
20230129 update Python 2.7 line to version 2.7.9 20207552 problem in UTILITY/PYTHON

This patch is a Solaris-specific hack; it will not be submitted upstream.

--- Python-2.7.9/Lib/distutils/sysconfig.py.~1~	2014-12-10 07:59:34.000000000 -0800
+++ Python-2.7.9/Lib/distutils/sysconfig.py	2014-12-11 09:28:01.439349129 -0800
@@ -209,6 +209,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,