author | John Beck <John.Beck@Oracle.COM> |
Wed, 29 Oct 2014 14:12:28 -0700 | |
changeset 2183 | 5d00686e81da |
parent 1907 | 446472de62e9 |
permissions | -rw-r--r-- |
1907 | 1 |
This patch is a Solaris-specific hack; it will not be submitted upstream. |
2 |
||
2183
5d00686e81da
19782913 update Python to 3.4.2
John Beck <John.Beck@Oracle.COM>
parents:
1907
diff
changeset
|
3 |
--- Python-3.4.2/Lib/distutils/sysconfig.py.~2~ 2014-09-22 14:20:53.466326587 -0700 |
5d00686e81da
19782913 update Python to 3.4.2
John Beck <John.Beck@Oracle.COM>
parents:
1907
diff
changeset
|
4 |
+++ Python-3.4.2/Lib/distutils/sysconfig.py 2014-09-22 14:20:53.494063421 -0700 |
5d00686e81da
19782913 update Python to 3.4.2
John Beck <John.Beck@Oracle.COM>
parents:
1907
diff
changeset
|
5 |
@@ -219,6 +219,22 @@ |
1907 | 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, |