components/python/python27/patches/13-pic-compile.patch
author Rich Burridge <rich.burridge@oracle.com>
Tue, 02 May 2017 17:33:26 -0700
changeset 7964 d9801318ed3d
parent 3555 76f4672c5e4b
permissions -rw-r--r--
25981468 Build ilmbase and openexr with the GNU compilers

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,