1 diff -urN a/configure.in b/configure.in 2 --- a/configure.in 2012-06-30 01:06:22.326507693 +0100 3 +++ b/configure.in 2012-06-30 01:06:22.717510412 +0100 4 @@ -4807,6 +4807,6 @@ 5 6 mv config.c Modules]) 7 AC_CONFIG_FILES([setup_info]) 8 -AC_CONFIG_FILES([Makefile.pre Modules/Setup.config Misc/python.pc]) 9 +AC_CONFIG_FILES([Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh]) 10 AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) 11 AC_OUTPUT 12 diff -urN a/Makefile.pre.in b/Makefile.pre.in 13 --- a/Makefile.pre.in 2012-06-30 01:06:22.339507783 +0100 14 +++ b/Makefile.pre.in 2012-06-30 01:06:22.718510418 +0100 15 @@ -987,10 +987,12 @@ 16 export EXE; EXE="$(BUILDEXE)"; \ 17 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen $(CC) 18 19 -python-config: $(srcdir)/Misc/python-config.in 20 +python-config: $(srcdir)/Misc/python-config.in $(srcdir)/Misc/python-config.sh.in 21 # Substitution happens here, as the completely-expanded BINDIR 22 # is not available in configure 23 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config 24 + # Replace makefile compat. variable references with shell script compat. ones 25 + sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python-config.sh >python-config.sh 26 27 # Install the include files 28 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) 29 @@ -1049,6 +1051,8 @@ 30 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup 31 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh 32 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config 33 + $(INSTALL_SCRIPT) python-config.sh $(DESTDIR)$(BINDIR)/python-config.sh 34 + 35 rm python-config 36 @if [ -s Modules/python.exp -a \ 37 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ 38 diff -urN a/Misc/python-config.sh.in b/Misc/python-config.sh.in 39 --- a/Misc/python-config.sh.in 1970-01-01 01:00:00.000000000 +0100 40 +++ b/Misc/python-config.sh.in 2012-06-30 01:09:08.311648080 +0100 41 @@ -0,0 +1,69 @@ 42 +#!/bin/sh 43 + 44 +exit_with_usage () 45 +{ 46 + echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--help" 47 + exit 1 48 +} 49 + 50 +prefix="@prefix@" 51 +exec_prefix="@exec_prefix@" 52 +includedir="@includedir@" 53 +VERSION="@VERSION@" 54 +#libdir="@libdir@" 55 +libdir=$prefix/lib/python$VERSION/config 56 +LIBM="@LIBM@" 57 +LIBC="@LIBC@" 58 +SYSLIBS="$LIBM $LIBC" 59 +LIBS="@LIBS@ $SYSLIBS -lpython$VERSION" 60 +ABIFLAGS="@ABIFLAGS@" 61 +BASECFLAGS="@BASECFLAGS@" 62 +CFLAGS="@CFLAGS@" 63 +LDLIBRARY="@LDLIBRARY@" 64 +LINKFORSHARED="@LINKFORSHARED@" 65 +OPT="@OPT@" 66 + 67 +for ARG in $* 68 +do 69 + case $ARG in 70 + --prefix) 71 + echo $prefix 72 + exit 0 73 + ;; 74 + --exec-prefix) 75 + echo $exec_prefix 76 + exit 0 77 + ;; 78 + --includes) 79 + echo -I$includedir/python$VERSION 80 + exit 0 81 + ;; 82 + --libs) 83 + echo $LIBS 84 + exit 0 85 + ;; 86 + --cflags) 87 + echo -I$includedir/python$VERSION $BASECFLAGS $CFLAGS $OPT 88 + exit 0 89 + ;; 90 + --ldflags) 91 + # I'm not handling the case of not Py_ENABLE_SHARED here. 92 + # As there's no AC_SUBST for Py_ENABLE_SHARED (though I should just 93 + # add that to be honest with you!) 94 + # From python-config there's: 95 + # if not getvar('Py_ENABLE_SHARED'): 96 + # libs.insert(0, '-L' + getvar('LIBPL')) 97 + # libs.extend(getvar('LINKFORSHARED').split()) 98 + echo -L$libdir $LIBS $LINKFORSHARED 99 + exit 0 100 + ;; 101 + *.py) 102 + # configuring GDB uses: 103 + # ${python_prog} ${srcdir}/python/python-config.py --includes 104 + # so skip any .py files passed as arguments. 105 + ;; 106 + *) 107 + exit_with_usage 108 + ;; 109 +esac 110 +done 111