components/python/python34/patches/16-pic-compile.patch
changeset 1907 446472de62e9
child 2183 5d00686e81da
equal deleted inserted replaced
1906:06b8097543cd 1907:446472de62e9
       
     1 This patch is a Solaris-specific hack; it will not be submitted upstream.
       
     2 
       
     3 --- Python-3.4.0/Lib/distutils/sysconfig.py.~2~	2014-04-30 09:23:26.632873134 -0700
       
     4 +++ Python-3.4.0/Lib/distutils/sysconfig.py	2014-04-30 10:49:42.395635789 -0700
       
     5 @@ -221,6 +221,22 @@
       
     6          else:
       
     7              archiver = ar + ' ' + ar_flags
       
     8  
       
     9 +        # Force PIC compilation. Determine if GNU compiler or otherwise
       
    10 +        # and set the PIC flag(s) accordingly. Defaults to Studio compiler.
       
    11 +        if re.search('-.PIC', cflags) == None:
       
    12 +            try:
       
    13 +                out = os.popen(cc + ' --version 2>/dev/null', 'r')
       
    14 +                out_string = out.read()
       
    15 +                out.close()
       
    16 +                result = re.search(' (\d+\.\d+(\.\d+)*)', out_string)
       
    17 +                kpic_flags = "-fPIC -DPIC" if result else "-KPIC -DPIC"
       
    18 +            except ImportError:
       
    19 +                # The only time the above should fail is during boot-strapping
       
    20 +                # when time (os imports subprocess which imports time) is not
       
    21 +                # yet available.  Assume Studio compiler for that case.
       
    22 +                kpic_flags = "-KPIC -DPIC"
       
    23 +            cflags += ' ' + kpic_flags
       
    24 +
       
    25          cc_cmd = cc + ' ' + cflags
       
    26          compiler.set_executables(
       
    27              preprocessor=cpp,