summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-12-11 05:04:24 (GMT)
committerFred Drake <fdrake@acm.org>2001-12-11 05:04:24 (GMT)
commitd15db5c711f0b903762d0dfb0fbab95d869d56d8 (patch)
treefb9812bc3757bf202f5582daa9d4aa395de36155 /Lib
parent29d260670eff2d04b98d737ad14928163602a41a (diff)
downloadcpython-d15db5c711f0b903762d0dfb0fbab95d869d56d8.zip
cpython-d15db5c711f0b903762d0dfb0fbab95d869d56d8.tar.gz
cpython-d15db5c711f0b903762d0dfb0fbab95d869d56d8.tar.bz2
When using GCC, use the right option to add a directory to the list of dirs
searched for a dependency for runtime linking. This closes SF bug #445902.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/unixccompiler.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index a9b5de5..356587d 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -20,6 +20,7 @@ __revision__ = "$Id$"
import string, re, os
from types import *
from copy import copy
+from distutils import sysconfig
from distutils.dep_util import newer
from distutils.ccompiler import \
CCompiler, gen_preprocess_options, gen_lib_options
@@ -249,7 +250,23 @@ class UnixCCompiler (CCompiler):
return "-L" + dir
def runtime_library_dir_option (self, dir):
- return "-R" + dir
+ # XXX Hackish, at the very least. See Python bug #445902:
+ # http://sourceforge.net/tracker/index.php
+ # ?func=detail&aid=445902&group_id=5470&atid=105470
+ # Linkers on different platforms need different options to
+ # specify that directories need to be added to the list of
+ # directories searched for dependencies when a dynamic library
+ # is sought. GCC has to be told to pass the -R option through
+ # to the linker, whereas other compilers just know this.
+ # Other compilers may need something slightly different. At
+ # this time, there's no way to determine this information from
+ # the configuration data stored in the Python installation, so
+ # we use this hack.
+ compiler = os.path.basename(sysconfig.get_config_var("CC"))
+ if compiler == "gcc" or compiler == "g++":
+ return "-Wl,-R" + dir
+ else:
+ return "-R" + dir
def library_option (self, lib):
return "-l" + lib