+2003-08-17 Alexandre Duret-Lutz <adl@gnu.org>
+
+ Fix for PR automake/398:
+ * m4/python.m4: Do not call AC_PATH_PROGS if $PYTHON is already
+ set. Display `none' instead of `:' and $PYTHON is set to `:'
+ when no suitable interpreter is found. Honor ACTION-IF-FOUND and
+ ACTION-IF-NOT-FOUND.
+ * automake.texi (Python): Document ACTION-IF-FOUND and
+ ACTION-IF-NOT-FOUND.
+ * tests/python4.test, tests/python5.test, tests/python6.test,
+ tests/python7.test, tests/python8.test, tests/python9.test: New
+ files.
+ * tests/Makefile.am (TESTS): Add them.
+ Report from Per Cederqvist.
+
2003-08-13 Alexandre Duret-Lutz <adl@gnu.org>
Fix for PR automake/399:
links as part of the distclean target and including source files in
distributions.
+ - AM_PATH_PYTHON now support ACTION-IF-FOUND and ACTION-IF-NOT-FOUND
+ argument. The latter can be used to override the default behavior
+ (which is to abort).
+
* Obsolete features
- lisp_DATA is now allowed. If you are using the empty ELCFILES
@samp{pyexecdir_PYTHON}, @samp{pkgpyexecdir_PYTHON}, depending where you
want your files installed.
-@code{AM_PATH_PYTHON} takes a single optional argument. This argument,
-if present, is the minimum version of Python which can be used for this
-package. If the version of Python found on the system is older than the
-required version, then @code{AM_PATH_PYTHON} will cause an error.
+@code{AM_PATH_PYTHON([@var{VERSION}], [@var{ACTION-IF-FOUND}],
+[@var{ACTION-IF-NOT-FOUND}])} takes three optional arguments. It will
+search a Python interpreter on the system. The first argument, if
+present, is the minimum version of Python required for this package:
+@code{AM_PATH_PYTHON} will skip any Python interpreter which is older
+than @var{VERSION}. If an interpreter is found and satisfies
+@var{VERSION}, then @var{ACTION-IF-FOUND} is run. Otherwise,
+@var{ACTION-IF-NOT-FOUND} is run.
+
+If @var{ACTION-IF-NOT-FOUND} is not specified, the default is to abort
+configure. This is fine when Python is an absolute requirement for the
+package. Therefore if Python >= 2.2 is only @emph{optional} to the
+package, @code{AM_PATH_PYTHON} could be called as follows.
+
+@example
+ AM_PATH_PYTHON(2.2,, :)
+@end example
@code{AM_PATH_PYTHON} creates several output variables based on the
Python installation found during configuration.
@vtable @code
@item PYTHON
-The name of the Python executable.
+The name of the Python executable, or @code{:} if no suitable
+interpreter could be found.
+
+Assuming @var{ACTION-IF-NOT-FOUND} is used (otherwise @file{./configure}
+will abort if Python is absent), the value of @code{PYTHON} can be used
+to setup a conditional in order to disable the relevant part of a build
+as follows.
+
+@example
+ AM_PATH_PYTHON(,, :)
+ AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+@end example
+
+
+If the @var{ACTION-IF-NOT-FOUND}
+is specified
@item PYTHON_VERSION
The Python version number, in the form @var{major}.@var{minor}
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
-# AM_PATH_PYTHON([MINIMUM-VERSION])
+# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# Adds support for distributing Python modules and packages. To
# install modules, copy them to $(pythondir), using the python_PYTHON
m4_if([$1],[],[
dnl No version check is needed.
# Find any Python interpreter.
- AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST)
+ if test -z "$PYTHON"; then
+ PYTHON=:
+ AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST)
+ fi
am_display_PYTHON=python
], [
dnl A version check is needed.
# VERSION.
AC_CACHE_CHECK([for a Python interpreter with version >= $1],
[am_cv_pathless_PYTHON],[
- for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST : ; do
- if test "$am_cv_pathless_PYTHON" = : ; then
- AC_MSG_ERROR([no suitable Python interpreter found])
- fi
+ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
+ test "$am_cv_pathless_PYTHON" = none && break
AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
done])
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
- AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+ if test "$am_cv_pathless_PYTHON" = none; then
+ PYTHON=:
+ else
+ AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+ fi
am_display_PYTHON=$am_cv_pathless_PYTHON
fi
])
+ if test "$PYTHON" = :; then
+ dnl Run any user-specified action, or abort.
+ m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
+ else
+
dnl Query Python for its version number. Getting [:3] seems to be
dnl the best way to do this; it's what "site.py" does in the standard
dnl library.
dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+ dnl Run any user-specified action.
+ $2
+ fi
+
])
-@set UPDATED 31 July 2003
-@set UPDATED-MONTH July 2003
+@set UPDATED 14 August 2003
+@set UPDATED-MONTH August 2003
@set EDITION 1.7a
@set VERSION 1.7a
python.test \
python2.test \
python3.test \
+python4.test \
+python5.test \
+python6.test \
+python7.test \
+python8.test \
+python9.test \
recurs.test \
recurs2.test \
remake.test \
python.test \
python2.test \
python3.test \
+python4.test \
+python5.test \
+python6.test \
+python7.test \
+python8.test \
+python9.test \
recurs.test \
recurs2.test \
remake.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test detection of missing Python.
+
+# Python is not required for this test.
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<EOF
+AM_PATH_PYTHON
+AC_OUTPUT
+EOF
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Simulate no Python
+./configure PYTHON=: 2>stderr && exit 1
+cat stderr
+grep 'no suitable Python interpreter found' stderr
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test detection of missing Python.
+# Same as python4.test, but requiring a version.
+
+# Python is not required for this test.
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<EOF
+# Hopefully the Python team will never release such a version.
+AM_PATH_PYTHON(9999.9)
+AC_OUTPUT
+EOF
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure 2>stderr && exit 1
+cat stderr
+grep 'no suitable Python interpreter found' stderr
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test detection of missing Python.
+# Same as python4.test, but using a custom ACTION-IF-NOT-FOUND.
+
+# Python is not required for this test.
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<\EOF
+AM_PATH_PYTHON(,, [echo "GREP ME$PYTHON" >&2])
+AC_OUTPUT
+EOF
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Simulate no Python
+./configure PYTHON=: 2>stderr
+cat stderr
+grep 'GREP ME:' stderr
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test detection of missing Python.
+# Same as python6.test, but requiring a version.
+
+# Python is not required for this test.
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<\EOF
+# Hopefully the Python team will never release such a version.
+AM_PATH_PYTHON(9999.9,, [echo "GREP ME$PYTHON" >&2])
+AC_OUTPUT
+EOF
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure 2>stderr
+cat stderr
+grep 'GREP ME:' stderr
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test ACTION-IF-TRUE in AM_PATH_PYTHON.
+
+required=python
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<EOF
+AM_PATH_PYTHON(, [echo 'GREP ME' >&2])
+AC_OUTPUT
+EOF
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure 2>stderr
+cat stderr
+grep 'GREP ME' stderr
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test ACTION-IF-TRUE in AM_PATH_PYTHON.
+# Same as python8.test, but requiring a version.
+
+required=python
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<EOF
+AM_PATH_PYTHON(0.0, [echo 'GREP ME' >&2])
+AC_OUTPUT
+EOF
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure 2>stderr
+cat stderr
+grep 'GREP ME' stderr
-@set UPDATED 31 July 2003
-@set UPDATED-MONTH July 2003
+@set UPDATED 14 August 2003
+@set UPDATED-MONTH August 2003
@set EDITION 1.7a
@set VERSION 1.7a