Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] use python-config if available
@ 2012-12-20 15:41 Matthias Klose
  2012-12-20 15:43 ` Matthias Klose
  0 siblings, 1 reply; 9+ messages in thread
From: Matthias Klose @ 2012-12-20 15:41 UTC (permalink / raw)
  To: gdb-patches

This patch does use the python-config, which comes shipped with the python
interpreter, and falls back to the internal copy of python-config.py.
AC_CHECK_TOOL is used to find a possible python-config for the host.

Tested with 7.5 with a native and a cross build.

  Matthias


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-20 15:41 [patch] use python-config if available Matthias Klose
@ 2012-12-20 15:43 ` Matthias Klose
  2012-12-20 15:53   ` Pierre Muller
  2012-12-20 15:59   ` Joel Brobecker
  0 siblings, 2 replies; 9+ messages in thread
From: Matthias Klose @ 2012-12-20 15:43 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

Am 20.12.2012 16:41, schrieb Matthias Klose:
> This patch does use the python-config, which comes shipped with the python
> interpreter, and falls back to the internal copy of python-config.py.
> AC_CHECK_TOOL is used to find a possible python-config for the host.
> 
> Tested with 7.5 with a native and a cross build.
> 
>   Matthias
> 


[-- Attachment #2: python-config.patch --]
[-- Type: text/x-diff, Size: 1729 bytes --]

Index: b/gdb/configure.ac
===================================================================
--- a/gdb/configure.ac	2012-12-20 15:19:47.620663038 +0000
+++ b/gdb/configure.ac	2012-12-20 15:32:59.604669244 +0000
@@ -840,29 +840,31 @@
     esac
   esac
 
+  python_config=
   if test "${python_prog}" != missing; then
+    AC_CHECK_TOOL(python_config,[${python_prog}-config],[${python_prog} ${srcdir}/python/python-config.py])
     # We have a python program to use, but it may be too old.
     # Don't flag an error for --with-python=auto (the default).
     have_python_config=yes
-    python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
+    python_includes=`${python_config} --includes`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --includes)
+        AC_ERROR(failure running ${python-config} --includes)
       fi
     fi
-    python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+    python_libs=`${python_config} --ldflags`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --ldflags)
+        AC_ERROR(failure running ${python-config} --ldflags)
       fi
     fi
-    python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
+    python_prefix=`${python_config} --exec-prefix`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --exec-prefix)
+        AC_ERROR(failure running ${python-config} --exec-prefix)
       fi
     fi
   else

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [patch] use python-config if available
  2012-12-20 15:43 ` Matthias Klose
@ 2012-12-20 15:53   ` Pierre Muller
  2012-12-20 15:59   ` Joel Brobecker
  1 sibling, 0 replies; 9+ messages in thread
From: Pierre Muller @ 2012-12-20 15:53 UTC (permalink / raw)
  To: 'Matthias Klose'; +Cc: gdb-patches

  Hi Matthias,

it seems there is a small oversight in your patch,
  in ACERROR you have ${python-config}
in places where you should  probably use ${python_config}

  I can't comment on the patch otherwise, as
my python level is zero...

Pierre Muller

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Matthias Klose
> Envoyé : jeudi 20 décembre 2012 16:43
> À : gdb-patches@sourceware.org
> Objet : Re: [patch] use python-config if available
> 
> Am 20.12.2012 16:41, schrieb Matthias Klose:
> > This patch does use the python-config, which comes shipped with the
python
> > interpreter, and falls back to the internal copy of python-config.py.
> > AC_CHECK_TOOL is used to find a possible python-config for the host.
> >
> > Tested with 7.5 with a native and a cross build.
> >
> >   Matthias
> >



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-20 15:43 ` Matthias Klose
  2012-12-20 15:53   ` Pierre Muller
@ 2012-12-20 15:59   ` Joel Brobecker
  2012-12-20 16:13     ` Matthias Klose
  1 sibling, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2012-12-20 15:59 UTC (permalink / raw)
  To: Matthias Klose; +Cc: gdb-patches

> > This patch does use the python-config, which comes shipped with the python
> > interpreter, and falls back to the internal copy of python-config.py.
> > AC_CHECK_TOOL is used to find a possible python-config for the host.
> > 
> > Tested with 7.5 with a native and a cross build.

Can you tell us what problem you are trying to solve?

Your patch would most certainly break the build in my case, as
I rely on some local changes made to our copy of python-config.py,
which I cannot contribute because they break some setups different
than ours.

-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-20 15:59   ` Joel Brobecker
@ 2012-12-20 16:13     ` Matthias Klose
  2012-12-21  7:57       ` Joel Brobecker
  0 siblings, 1 reply; 9+ messages in thread
From: Matthias Klose @ 2012-12-20 16:13 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Am 20.12.2012 16:59, schrieb Joel Brobecker:
>>> This patch does use the python-config, which comes shipped with the python
>>> interpreter, and falls back to the internal copy of python-config.py.
>>> AC_CHECK_TOOL is used to find a possible python-config for the host.
>>>
>>> Tested with 7.5 with a native and a cross build.
> 
> Can you tell us what problem you are trying to solve?

cross building in a multiarch environment, where the host libraries are
installed, and a <host>-python-config is shipped as part of the system python.
This <host>-python-config is a backport of http://bugs.python.org/issue16235
(not yet applied upstream).

> Your patch would most certainly break the build in my case, as
> I rely on some local changes made to our copy of python-config.py,
> which I cannot contribute because they break some setups different
> than ours.

so what is your recommendation? configure.ac reads:

dnl /path/to/python/executable -
dnl        Run python-config.py with this version of python to fetch the
dnl        compilation parameters.
dnl        NOTE: This needn't be the real python executable.
dnl        In a cross-compilation scenario (build != host), this could be
dnl        a shell script that provides what python-config.py provides for
dnl        --ldflags, --includes, --exec-prefix.

do I really have to provide a shell script, which shifts the first parameter,
and then calls the real python-config?

  Matthias


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-20 16:13     ` Matthias Klose
@ 2012-12-21  7:57       ` Joel Brobecker
  2012-12-21 17:31         ` Doug Evans
  0 siblings, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2012-12-21  7:57 UTC (permalink / raw)
  To: Matthias Klose; +Cc: gdb-patches

> cross building in a multiarch environment, where the host libraries
> are installed, and a <host>-python-config is shipped as part of the
> system python.  This <host>-python-config is a backport of
> http://bugs.python.org/issue16235 (not yet applied upstream).

Ah, OK. Now I understand your problem.

> so what is your recommendation? configure.ac reads:
> 
> dnl /path/to/python/executable -
> dnl        Run python-config.py with this version of python to fetch the
> dnl        compilation parameters.
> dnl        NOTE: This needn't be the real python executable.
> dnl        In a cross-compilation scenario (build != host), this could be
> dnl        a shell script that provides what python-config.py provides for
> dnl        --ldflags, --includes, --exec-prefix.
> 
> do I really have to provide a shell script, which shifts the first
> parameter, and then calls the real python-config?

I think that this was the plan, yes; but Doug Evans would probably
know more, as he is the main author of this code (I only fiddled
with it).

-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-21  7:57       ` Joel Brobecker
@ 2012-12-21 17:31         ` Doug Evans
  2012-12-21 17:51           ` Joel Brobecker
  0 siblings, 1 reply; 9+ messages in thread
From: Doug Evans @ 2012-12-21 17:31 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Matthias Klose, gdb-patches

On Thu, Dec 20, 2012 at 11:57 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>> cross building in a multiarch environment, where the host libraries
>> are installed, and a <host>-python-config is shipped as part of the
>> system python.  This <host>-python-config is a backport of
>> http://bugs.python.org/issue16235 (not yet applied upstream).
>
> Ah, OK. Now I understand your problem.
>
>> so what is your recommendation? configure.ac reads:
>>
>> dnl /path/to/python/executable -
>> dnl        Run python-config.py with this version of python to fetch the
>> dnl        compilation parameters.
>> dnl        NOTE: This needn't be the real python executable.
>> dnl        In a cross-compilation scenario (build != host), this could be
>> dnl        a shell script that provides what python-config.py provides for
>> dnl        --ldflags, --includes, --exec-prefix.
>>
>> do I really have to provide a shell script, which shifts the first
>> parameter, and then calls the real python-config?
>
> I think that this was the plan, yes; but Doug Evans would probably
> know more, as he is the main author of this code (I only fiddled
> with it).

The patch is fine with me.
[The plan wasn't to shift and call the "real" python-config ... at the
time there was no real python-config for cross builds.]

One typo: should be ${python_config}

-        AC_ERROR(failure running python-config --exec-prefix)
+        AC_ERROR(failure running ${python-config} --exec-prefix)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-21 17:31         ` Doug Evans
@ 2012-12-21 17:51           ` Joel Brobecker
  2012-12-22 19:33             ` Doug Evans
  0 siblings, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2012-12-21 17:51 UTC (permalink / raw)
  To: Doug Evans; +Cc: Matthias Klose, gdb-patches

> The patch is fine with me.
> [The plan wasn't to shift and call the "real" python-config ... at the
> time there was no real python-config for cross builds.]
> 
> One typo: should be ${python_config}
> 
> -        AC_ERROR(failure running python-config --exec-prefix)
> +        AC_ERROR(failure running ${python-config} --exec-prefix)

Can we make this new behavior optional? The "real" python-config
is broken for several platforms, and having our own that we can
control was very convenient.

-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] use python-config if available
  2012-12-21 17:51           ` Joel Brobecker
@ 2012-12-22 19:33             ` Doug Evans
  0 siblings, 0 replies; 9+ messages in thread
From: Doug Evans @ 2012-12-22 19:33 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Matthias Klose, gdb-patches

On Fri, Dec 21, 2012 at 9:50 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> The patch is fine with me.
>> [The plan wasn't to shift and call the "real" python-config ... at the
>> time there was no real python-config for cross builds.]
>>
>> One typo: should be ${python_config}
>>
>> -        AC_ERROR(failure running python-config --exec-prefix)
>> +        AC_ERROR(failure running ${python-config} --exec-prefix)
>
> Can we make this new behavior optional? The "real" python-config
> is broken for several platforms, and having our own that we can
> control was very convenient.

I certainly don't want to break your use-case.

I need to look at the patch again (but I probably won't get to it
until next week).


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-12-22 19:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 15:41 [patch] use python-config if available Matthias Klose
2012-12-20 15:43 ` Matthias Klose
2012-12-20 15:53   ` Pierre Muller
2012-12-20 15:59   ` Joel Brobecker
2012-12-20 16:13     ` Matthias Klose
2012-12-21  7:57       ` Joel Brobecker
2012-12-21 17:31         ` Doug Evans
2012-12-21 17:51           ` Joel Brobecker
2012-12-22 19:33             ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox