diff -r 40a1652349e9 Makefile.pre.in --- a/Makefile.pre.in Sun Oct 14 22:16:27 2012 +0200 +++ b/Makefile.pre.in Sun Oct 14 22:51:31 2012 +0100 @@ -1120,6 +1120,8 @@ # Substitution happens here, as the completely-expanded BINDIR # is not available in configure sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config + # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} + sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python-config.sh >python-config.sh # Install the include files INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) @@ -1178,6 +1180,7 @@ $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config + $(INSTALL_SCRIPT) python-config.sh $(DESTDIR)$(BINDIR)/python-config.sh rm python-config @if [ -s Modules/python.exp -a \ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ diff -r 40a1652349e9 Misc/python-config.sh.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Misc/python-config.sh.in Sun Oct 14 22:51:31 2012 +0100 @@ -0,0 +1,85 @@ +#!/bin/sh + +exit_with_usage () +{ + echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--help" + exit 1 +} + +if [ "$1" = "" ] ; then + exit_with_usage +fi + +# Returns the actual prefix where this script was installed to. +installed_prefix () +{ + local RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) + if [ $(which readlink) ] ; then + RESULT=$(readlink -f "$RESULT") + fi + echo $RESULT +} + +prefix_build="@prefix@" +prefix_real=$(installed_prefix "$0") + +# Use sed to fix paths from their built to locations to their installed to locations. +prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") +exec_prefix_build="@exec_prefix@" +exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#") +includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#") +libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#") +CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#") +VERSION="@VERSION@" +LIBM="@LIBM@" +LIBC="@LIBC@" +SYSLIBS="$LIBM $LIBC" +LIBS="@LIBS@ $SYSLIBS -lpython$VERSION" +ABIFLAGS="@ABIFLAGS@" +BASECFLAGS="@BASECFLAGS@" +LDLIBRARY="@LDLIBRARY@" +LINKFORSHARED="@LINKFORSHARED@" +OPT="@OPT@" +PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" +LDVERSION="@LDVERSION@" +LIBDEST=${prefix}/lib/python${VERSION} +LIBPL=${LIBDEST}/config-${LDVERSION} + +for ARG in $* +do + case $ARG in + --prefix) + echo "$prefix" + exit 0 + ;; + --exec-prefix) + echo "$exec_prefix" + exit 0 + ;; + --includes) + echo "-I$includedir/python$VERSION" + exit 0 + ;; + --libs) + echo "$LIBS" + exit 0 + ;; + --cflags) + echo "-I$includedir/python$VERSION $BASECFLAGS $CFLAGS $OPT" + exit 0 + ;; + --ldflags) + if [ "$PY_ENABLE_SHARED" = "0" ] ; then + echo "-L$LIBPL -L$libdir $LIBS $LINKFORSHARED" + else + echo "-L$libdir $LIBS $LINKFORSHARED" + fi + ;; + --help) + exit_with_usage + ;; + *) + exit_with_usage + ;; +esac +done diff -r 40a1652349e9 configure.ac --- a/configure.ac Sun Oct 14 22:16:27 2012 +0200 +++ b/configure.ac Sun Oct 14 22:51:31 2012 +0100 @@ -894,6 +894,7 @@ # Other platforms follow if test $enable_shared = "yes"; then + PY_ENABLE_SHARED=1 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.]) case $ac_sys_system in CYGWIN*) @@ -949,6 +950,7 @@ esac else # shared is disabled + PY_ENABLE_SHARED=0 case $ac_sys_system in CYGWIN*) BLDLIBRARY='$(LIBRARY)' @@ -956,6 +958,7 @@ ;; esac fi +AC_SUBST(PY_ENABLE_SHARED) if test "$cross_compiling" = yes; then RUNSHARED= @@ -4597,7 +4600,7 @@ fi # generate output files -AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) +AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh) AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) AC_OUTPUT