diff -r 684b75600fa9 Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py Tue Mar 19 17:22:51 2013 -0700 +++ b/Lib/distutils/command/build_ext.py Tue Mar 19 18:36:56 2013 -0700 @@ -666,10 +666,10 @@ from distutils.sysconfig import get_config_var ext_path = ext_name.split('.') # extensions in debug_mode are named 'module_d.pyd' under windows - so_ext = get_config_var('SO') + ext_suffix = get_config_var('EXT_SUFFIX') if os.name == 'nt' and self.debug: - return os.path.join(*ext_path) + '_d' + so_ext - return os.path.join(*ext_path) + so_ext + return os.path.join(*ext_path) + '_d' + ext_suffix + return os.path.join(*ext_path) + ext_suffix def get_export_symbols(self, ext): """Return the list of symbols that a shared extension has to diff -r 684b75600fa9 Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py Tue Mar 19 17:22:51 2013 -0700 +++ b/Lib/distutils/sysconfig.py Tue Mar 19 18:36:56 2013 -0700 @@ -184,9 +184,9 @@ _osx_support.customize_compiler(_config_vars) _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ + (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', - 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS') + 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') newcc = None if 'CC' in os.environ: @@ -225,7 +225,7 @@ linker_exe=cc, archiver=archiver) - compiler.shared_lib_extension = so_ext + compiler.shared_lib_extension = shlib_suffix def get_config_h_filename(): diff -r 684b75600fa9 Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py Tue Mar 19 17:22:51 2013 -0700 +++ b/Lib/distutils/tests/test_build_ext.py Tue Mar 19 18:36:56 2013 -0700 @@ -318,8 +318,8 @@ finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file)) - so_ext = sysconfig.get_config_var('SO') - self.assertTrue(so_file.endswith(so_ext)) + ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, other_tmp_dir) @@ -328,7 +328,7 @@ cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file)) - self.assertTrue(so_file.endswith(so_ext)) + self.assertTrue(so_file.endswith(ext_suffix)) so_dir = os.path.dirname(so_file) self.assertEqual(so_dir, cmd.build_lib) @@ -355,7 +355,7 @@ self.assertEqual(lastdir, 'bar') def test_ext_fullpath(self): - ext = sysconfig.get_config_vars()['SO'] + ext = sysconfig.get_config_var('EXT_SUFFIX') # building lxml.etree inplace #etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') #etree_ext = Extension('lxml.etree', [etree_c]) diff -r 684b75600fa9 Makefile.pre.in --- a/Makefile.pre.in Tue Mar 19 17:22:51 2013 -0700 +++ b/Makefile.pre.in Tue Mar 19 18:36:56 2013 -0700 @@ -125,7 +125,9 @@ CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) # Symbols used for using shared libraries -SO= @SO@ +SHLIB_SUFFIX= @SHLIB_SUFFIX@ +EXT_SUFFIX= @EXT_SUFFIX@ +SO= $(SHLIB_SUFFIX) LDSHARED= @LDSHARED@ $(PY_LDFLAGS) BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS) LDCXXSHARED= @LDCXXSHARED@ @@ -1188,7 +1190,7 @@ done @if test -d $(LIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ - if test "$(SO)" = .dll; then \ + if test "$(SHLIB_SUFFIX)" = .dll; then \ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ else \ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ diff -r 684b75600fa9 Python/dynload_hpux.c --- a/Python/dynload_hpux.c Tue Mar 19 17:22:51 2013 -0700 +++ b/Python/dynload_hpux.c Tue Mar 19 18:36:56 2013 -0700 @@ -13,7 +13,7 @@ #define FUNCNAME_PATTERN "PyInit_%.200s" #endif -const char *_PyImport_DynLoadFiletab[] = {SHLIB_EXT, NULL}; +const char *_PyImport_DynLoadFiletab[] = {'.sl', NULL}; dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname, const char *pathname, FILE *fp) diff -r 684b75600fa9 configure.ac --- a/configure.ac Tue Mar 19 17:22:51 2013 -0700 +++ b/configure.ac Tue Mar 19 18:36:56 2013 -0700 @@ -1898,13 +1898,41 @@ esac # Set info about shared libraries. -AC_SUBST(SO) +AC_SUBST(SHLIB_SUFFIX) AC_SUBST(LDSHARED) AC_SUBST(LDCXXSHARED) AC_SUBST(BLDSHARED) AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) +# SHLIB_SUFFIX is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX, .dll on Cygwin +AC_MSG_CHECKING(the extension of shared libraries) +if test -z "$SHLIB_SUFFIX"; then + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SHLIB_SUFFIX=.so;; + *) SHLIB_SUFFIX=.sl;; + esac + ;; + CYGWIN*) SHLIB_SUFFIX=.dll;; + *) SHLIB_SUFFIX=.so;; + esac +else + # this might also be a termcap variable, see #610332 + echo + echo '=====================================================================' + echo '+ +' + echo '+ WARNING: You have set SO in your environment. +' + echo '+ Do you really mean to change the extension for shared libraries? +' + echo '+ Continuing in 10 seconds to let you to ponder. +' + echo '+ +' + echo '=====================================================================' + sleep 10 +fi +AC_MSG_RESULT($SHLIB_SUFFIX) + # LDSHARED is the ld *command* used to create shared library # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into @@ -3927,6 +3955,14 @@ SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS} AC_MSG_RESULT($SOABI) +AC_SUBST(EXT_SUFFIX) +case $ac_sys_system in + Linux*|GNU*) + EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; + *) + EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + AC_MSG_CHECKING(LDVERSION) LDVERSION='$(VERSION)$(ABIFLAGS)' AC_MSG_RESULT($LDVERSION) @@ -3936,39 +3972,6 @@ LIBPL="${prefix}/lib/python${VERSION}/config-${LDVERSION}" AC_SUBST(LIBPL) -# SO is the extension of shared libraries `(including the dot!) -# -- usually .so, .sl on HP-UX, .dll on Cygwin -AC_MSG_CHECKING(SO) -if test -z "$SO" -then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - Linux*|GNU*) - SO=.${SOABI}.so;; - *) SO=.so;; - esac -else - # this might also be a termcap variable, see #610332 - echo - echo '=====================================================================' - echo '+ +' - echo '+ WARNING: You have set SO in your environment. +' - echo '+ Do you really mean to change the extension for shared libraries? +' - echo '+ Continuing in 10 seconds to let you to ponder. +' - echo '+ +' - echo '=====================================================================' - sleep 10 -fi -AC_MSG_RESULT($SO) - -AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). AC_MSG_CHECKING(whether right shift extends the sign bit)