automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#7944: Should AM_PATH_PYTHON call AC_ARG_VAR?


From: Stefano Lattarini
Subject: Re: bug#7944: Should AM_PATH_PYTHON call AC_ARG_VAR?
Date: Mon, 31 Jan 2011 21:31:37 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Monday 31 January 2011, Jack Kelly wrote:
> Hi automakers,
> 
> I've noticed that if you put AM_PATH_PYTHON in configure.ac, it
> doesn't add an entry for PYTHON in ./configure --help. Is PYTHON meant
> to be a user's variable?
> 
According to the comments in `m4/python.m4' and to the tests
`python{4,6,11}.test', it is (and I think that's a good policy).
Documenting the fact in the configure help screen and in the
manual would be a good idea too.  What about the attached patch?

BTW, Jack, are you the same Jack Kelly already listed in THANKS
("Jack Kelly <address@hidden>")?  If yes, should we update
your e-mail address?

Regards,
  Stefano
From da5fccb5ebb2eb5302bdb4734f11222dfce6924c Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 31 Jan 2011 21:24:02 +0100
Subject: [PATCH] python: report the 'PYTHON' influential environment variable

* m4/python.m4 (AM_PATH_PYTHON): Call AC_ARG_VAR on PYTHON.
* doc/automake.texi (Python): Update and extend.
* tests/help-python.test: New test.
* tests/Makefile.am (TESTS): Update.
Suggestion from Jack Kelly.
---
 ChangeLog              |    9 +++++++++
 doc/automake.texi      |   26 ++++++++++++++++----------
 m4/python.m4           |    2 ++
 tests/Makefile.am      |    1 +
 tests/Makefile.in      |    1 +
 tests/help-python.test |   38 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 67 insertions(+), 10 deletions(-)
 create mode 100755 tests/help-python.test

diff --git a/ChangeLog b/ChangeLog
index dd96e23..05820e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-31  Stefano Lattarini  <address@hidden>
+
+       python: report the 'PYTHON' influential environment variable
+       * m4/python.m4 (AM_PATH_PYTHON): Call AC_ARG_VAR on PYTHON.
+       * doc/automake.texi (Python): Update and extend.
+       * tests/help-python.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       Suggestion from Jack Kelly.
+
 2011-01-29  Stefano Lattarini  <address@hidden>
 
        tests: fix spurious failures in lflags*.test
diff --git a/doc/automake.texi b/doc/automake.texi
index f5066d4..4a6e08f 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -7605,16 +7605,22 @@ installed (see the definitions of @code{pythondir} and
 
 @defmac AM_PATH_PYTHON (@ovar{version}, @ovar{action-if-found}, 
@ovar{action-if-not-found})
 
-Search for a Python interpreter on the system.  This macro takes three
-optional arguments.  The first argument, if present, is the minimum
-version of Python required for this package: @code{AM_PATH_PYTHON}
-will skip any Python interpreter that is older than @var{version}.
-If an interpreter is found and satisfies @var{version}, then
address@hidden is run.  Otherwise, @var{action-if-not-found} is
-run.
-
-If @var{action-if-not-found} is not specified, as in the following
-example, the default is to abort @command{configure}.
+Search for a Python interpreter on the system.  The user can force the
+choice with the configuration variable @env{PYTHON}.
+
+This macro takes three optional arguments.
+
+The first argument, if present, is the minimum version of Python required
+for this package; @code{AM_PATH_PYTHON} will skip any Python interpreter
+that is older than @var{version}.  Note that, if @env{PYTHON} was specified
+by the user, the version check will still take place, but no other Python
+interpreter will be tried if that fails.
+
+If an interpreter is found and satisfies @var{version} (which, in case
address@hidden is empty or unspecified, means @emph{any} interpreter), then
address@hidden is run.  Otherwise, @var{action-if-not-found} is run.
+If @var{action-if-not-found} is not specified, as in the following example
+, the default is to abort @command{configure}.
 
 @example
 AM_PATH_PYTHON([2.2])
diff --git a/m4/python.m4 b/m4/python.m4
index 50e1538..655dcf3 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -40,6 +40,8 @@ AC_DEFUN([AM_PATH_PYTHON],
 [python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl
  python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
 
+  AC_ARG_VAR([PYTHON], [the Python interpreter])
+
   m4_if([$1],[],[
     dnl No version check is needed.
     # Find any Python interpreter.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 78bacf2..ed7287c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -371,6 +371,7 @@ help-init.test \
 help-lispdir.test \
 help-maintainer.test \
 help-multilib.test \
+help-python.test \
 help-regex.test \
 help-silent.test \
 help-upc.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 18cb337..560e523 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -638,6 +638,7 @@ help-init.test \
 help-lispdir.test \
 help-maintainer.test \
 help-multilib.test \
+help-python.test \
 help-regex.test \
 help-silent.test \
 help-upc.test \
diff --git a/tests/help-python.test b/tests/help-python.test
new file mode 100755
index 0000000..ecad233
--- /dev/null
+++ b/tests/help-python.test
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that our private macro `AM_DEP_TRACK' adds proper text to
+# the configure help screen.
+# Keep this in sync with sister test `help-depend2.test'
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_PATH_PYTHON
+END
+
+$ACLOCAL
+$AUTOCONF
+
+./configure --help >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep '^  *PYTHON  *the Python interpreter$' stdout
+
+:
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]