Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [patch] Try to use python-config to get python include and lib parameters.
Date: Thu, 20 May 2010 23:08:00 -0000	[thread overview]
Message-ID: <20100520230406.0D0C084398@ruffy.mtv.corp.google.com> (raw)

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`
     ;;
   *)
     AC_ERROR(invalid value for --with-python)


             reply	other threads:[~2010-05-20 23:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-20 23:08 Doug Evans [this message]
2010-05-21  5:36 ` Doug Evans
2010-05-21 16:51   ` Tom Tromey
2010-05-24 23:07     ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100520230406.0D0C084398@ruffy.mtv.corp.google.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox