mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
29d260670e
commit
d15db5c711
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue