From d15db5c711f0b903762d0dfb0fbab95d869d56d8 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 11 Dec 2001 05:04:24 +0000 Subject: 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. --- Lib/distutils/unixccompiler.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 -- cgit v0.12