[patch] Try to use python-config to get python include and lib parameters.

Doug Evans
2010-05-20T23:04:18Z

Hi.

Building with a private copy of python, or even the system copy,
sometimes requires linking with extra libraries.
These libraries are listed with `python-config --ldflags'.
[or --libs, but --ldflags also includes any needed -L's]

I will check this in in a few days if there are no objections.

2010-05-20 Doug Evans <dje@google.com>

* configure.ac: Try to use python-config to get python include and lib
parameters.
* configure: Regenerate.

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.117
diff -u -p -r1.117 configure.ac
--- configure.ac 23 Apr 2010 18:07:26 -0000 1.117
+++ configure.ac 20 May 2010 23:03:09 -0000
@@ -619,13 +619,28 @@ if test "${with_python}" = no; then
else
case "${with_python}" in
yes | auto)
- # Leave as empty, use defaults.
- python_includes=
- python_libs=
+ AC_PATH_PROG(python_config_path, python-config, missing)
+ if test "${python_config_path}" = missing; then
+ # Perhaps this should be an error, but 7.0 and 7.1 shipped without
+ # checking for python-config so in the interests of not breaking
+ # anything, we follow their behaviour here.
+ python_includes=
+ python_libs=
+ else
+ python_includes=`${python_config_path} --includes`
+ python_libs=`${python_config_path} --ldflags`
+ fi
;;
/*)
- python_includes="-I${with_python}/include"
- python_libs="-L${with_python}/lib"
+ AC_PATH_PROG(python_config_path, python-config, missing,
+ [PATH = ${with_python}/bin])
+ if test "${python_config_path}" = missing; then
+ # If an explicit path was provided, and we can't find python-config
+ # at that location, flag an error.
+ AC_ERROR(python-config missing from ${with_python}/bin)
+ fi
+ python_includes=`${python_config_path} --includes`
+ python_libs=`${python_config_path} --ldflags`
;;
*)