This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] configure additions for linking with static libpython
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Cc: tromey at redhat dot com, msnyder at vmware dot com
- Date: Mon, 8 Feb 2010 11:25:38 -0800 (PST)
- Subject: [RFC] configure additions for linking with static libpython
Hi.
I was going through my mail and found this thread:
http://sourceware.org/ml/gdb/2010-01/msg00223.html
Tested on i686-linux and amd64-linux with a static-library-only
python installation. I wasn't sure how common static-only
installations are so I didn't submitted this earlier.
The -lutil is necessary to find forkpty, openpty,
referenced by at least libpython2.4.a(posixmodule.o).
I don't know how common libutil is w.r.t. libpython.
Maybe the script should first test for libutil?
2010-02-08 Doug Evans <dje@google.com>
* configure.ac (--with-python): Add necessary libraries
-dl, -lpthread, -lutil in case linking with libpython.a.
Add attempt to find libpython.a.
* configure: Regenerated.
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.114
diff -u -p -r1.114 configure.ac
--- configure.ac 25 Jan 2010 13:22:02 -0000 1.114
+++ configure.ac 8 Feb 2010 19:08:11 -0000
@@ -595,7 +595,7 @@ AC_DEFUN([AC_TRY_LIBPYTHON],
[HAVE_LIB]VERSION=no
AC_MSG_CHECKING([for ${version}])
save_LIBS=$LIBS
- LIBS="$LIBS -l${version}"
+ LIBS="$LIBS -l${version} -ldl -lpthread -lutil"
AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include "${version}/Python.h"]],
[[Py_Initialize ();]]),
[[HAVE_LIB]VERSION=yes
@@ -623,6 +623,11 @@ else
/*)
python_includes="-I${with_python}/include"
python_libs="-L${with_python}/lib"
+ # This one is to find libpythonx.y.a
+ python_config_dir=`echo ${with_python}/lib/python*.*/config`
+ if test -d "${python_config_dir}"; then
+ python_libs="${python_libs} -L${python_config_dir}"
+ fi
;;
*)
AC_ERROR(invalid value for --with-python)