summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-10 20:03:17 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-10 20:03:17 (GMT)
commitaabdceba515d7f43f378c0aba897d1e697e416c8 (patch)
treed9bbb3c759e30ba07d3e6c7cebf445ca19a4737b
parentb170f17bacf77996667b8814ed4f0940409b1810 (diff)
downloadcpython-aabdceba515d7f43f378c0aba897d1e697e416c8.zip
cpython-aabdceba515d7f43f378c0aba897d1e697e416c8.tar.gz
cpython-aabdceba515d7f43f378c0aba897d1e697e416c8.tar.bz2
Merged revisions 84680 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84680 | antoine.pitrou | 2010-09-10 21:44:44 +0200 (ven., 10 sept. 2010) | 4 lines Issue #941346: Improve the build process under AIX and allow Python to be built as a shared library. Patch by Sébastien Sablé. ........
-rw-r--r--Lib/distutils/command/build_ext.py4
-rw-r--r--Makefile.pre.in6
-rw-r--r--Misc/NEWS3
-rw-r--r--[-rwxr-xr-x]Modules/ld_so_aix.in (renamed from Modules/ld_so_aix)18
-rwxr-xr-xconfigure16
-rw-r--r--configure.in7
6 files changed, 40 insertions, 14 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index aeb6b74..5b3be6f 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -753,7 +753,9 @@ class build_ext (Command):
elif sys.platform == 'darwin':
# Don't use the default code below
return ext.libraries
-
+ elif sys.platform[:3] == 'aix':
+ # Don't use the default code below
+ return ext.libraries
else:
from distutils import sysconfig
if sysconfig.get_config_var('Py_ENABLE_SHARED'):
diff --git a/Makefile.pre.in b/Makefile.pre.in
index a0c977a..e878a2c 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -422,10 +422,10 @@ $(LIBRARY): $(LIBRARY_OBJS)
libpython$(VERSION).so: $(LIBRARY_OBJS)
if test $(INSTSONAME) != $(LDLIBRARY); then \
- $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ $(BLDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
$(LN) -f $(INSTSONAME) $@; \
else \
- $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ $(BLDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
fi
libpython$(VERSION).dylib: $(LIBRARY_OBJS)
@@ -1197,7 +1197,7 @@ distclean: clobber
done
-rm -f core Makefile Makefile.pre config.status \
Modules/Setup Modules/Setup.local Modules/Setup.config \
- Misc/python.pc
+ Modules/ld_so_aix Misc/python.pc
-rm -f python*-gdb.py
find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
-o -name '[@,#]*' -o -name '*.old' \
diff --git a/Misc/NEWS b/Misc/NEWS
index 13cec41..b65e860 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -302,6 +302,9 @@ Tools/Demos
Build
-----
+- Issue #941346: Improve the build process under AIX and allow Python to
+ be built as a shared library. Patch by Sébastien Sablé.
+
- Issue #4026: Make the fcntl extension build under AIX. Patch by Sébastien
Sablé.
diff --git a/Modules/ld_so_aix b/Modules/ld_so_aix.in
index 6b83823..0fd245b 100755..100644
--- a/Modules/ld_so_aix
+++ b/Modules/ld_so_aix.in
@@ -131,11 +131,14 @@ do
shift
done
+if test "$objfile" = "libpython@VERSION@.so"; then
+ ldsocoremode="true"
+fi
if test -z "$objs"; then
echo "ld_so_aix: No input files; exiting."
exit 2
-elif test ! -r "$impfile"; then
+elif test ! -r "$impfile" -a -z "$ldsocoremode"; then
echo "ld_so_aix: Import file '$impfile' not found or not readable; exiting."
exit 2
fi
@@ -155,7 +158,7 @@ fi
# Default entry symbol for Python modules = init[modulename]
# Can be overriden by providing a -e argument.
if test -z "$entry"; then
- entry=init`echo $filename | sed "s/module.*//"`
+ entry=PyInit_`echo $filename | sed "s/module.*//"`
fi
#echo "ld_so_aix: Debug info section"
@@ -166,11 +169,12 @@ fi
#echo " -> object files: $objs"
#echo " -> CC arguments: $args"
-CCOPT="-Wl,-e$entry -Wl,-bE:$expfile -Wl,-bI:$impfile -Wl,-bhalt:4"
-CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -lm -o $objfile"
-# Note: to use dynamic libraries like libtcl8.4.so and libtk8.4.so
-# you may need to replace the second CCOPT line above with the following:
-# CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -brtl -bnortllib -lm -o $objfile"
+if test -z "$ldsocoremode"; then
+ CCOPT="-Wl,-e$entry -Wl,-bE:$expfile -Wl,-bI:$impfile -Wl,-bhalt:4"
+else
+ CCOPT="-Wl,-bnoentry -Wl,-bE:$expfile -Wl,-bhalt:4"
+fi
+CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -Wl,-brtl -Wl,-bnortllib -lm -o $objfile"
CCARGS="$args"
diff --git a/configure b/configure
index 187009b..254cae7 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 84585 .
+# From configure.in Revision: 84676 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for python 2.7.
#
@@ -4950,6 +4950,10 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>confdefs.h
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
;;
+ AIX*)
+ LDLIBRARY='libpython$(VERSION).so'
+ RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
+ ;;
esac
else # shared is disabled
@@ -7531,7 +7535,7 @@ if test -z "$LDSHARED"
then
case $ac_sys_system/$ac_sys_release in
AIX*)
- BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
+ BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp -L\$(srcdir)"
LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
;;
BeOS*)
@@ -13753,6 +13757,8 @@ $as_echo "done" >&6; }
# generate output files
ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc"
+ac_config_files="$ac_config_files Modules/ld_so_aix"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -14446,6 +14452,7 @@ do
"Makefile.pre") CONFIG_FILES="$CONFIG_FILES Makefile.pre" ;;
"Modules/Setup.config") CONFIG_FILES="$CONFIG_FILES Modules/Setup.config" ;;
"Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
+ "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -14985,6 +14992,11 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;}
esac
+
+ case $ac_file$ac_mode in
+ "Modules/ld_so_aix":F) chmod +x Modules/ld_so_aix ;;
+
+ esac
done # for ac_tag
diff --git a/configure.in b/configure.in
index 2c0bf4f..51cdaa5 100644
--- a/configure.in
+++ b/configure.in
@@ -823,6 +823,10 @@ if test $enable_shared = "yes"; then
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
;;
+ AIX*)
+ LDLIBRARY='libpython$(VERSION).so'
+ RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
+ ;;
esac
else # shared is disabled
@@ -1757,7 +1761,7 @@ if test -z "$LDSHARED"
then
case $ac_sys_system/$ac_sys_release in
AIX*)
- BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
+ BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp -L\$(srcdir)"
LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
;;
BeOS*)
@@ -4273,6 +4277,7 @@ AC_MSG_RESULT(done)
# generate output files
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
+AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
AC_OUTPUT
echo "creating Modules/Setup"