summaryrefslogtreecommitdiff
path: root/m4/python.m4
diff options
context:
space:
mode:
authorAlexandre Duret-Lutz <adl@gnu.org>2003-08-17 18:09:10 +0000
committerAlexandre Duret-Lutz <adl@gnu.org>2003-08-17 18:09:10 +0000
commita4f5cb9af7ba9316fd6b074231f21ba4936efbd6 (patch)
tree56b1ab76e078fd5897053a2d5f6d3b3f1f94b228 /m4/python.m4
parent5fd79af30382dce84cd8d462c5aab7861324c092 (diff)
downloadautomake-a4f5cb9af7ba9316fd6b074231f21ba4936efbd6.tar.gz
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.
Diffstat (limited to 'm4/python.m4')
-rw-r--r--m4/python.m429
1 files changed, 22 insertions, 7 deletions
diff --git a/m4/python.m4 b/m4/python.m4
index a327598bb..cd4e0535d 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -21,7 +21,7 @@
# 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
@@ -56,7 +56,10 @@ AC_DEFUN([AM_PATH_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.
@@ -71,18 +74,25 @@ AC_DEFUN([AM_PATH_PYTHON],
# 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.
@@ -142,6 +152,11 @@ AC_DEFUN([AM_PATH_PYTHON],
dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+ dnl Run any user-specified action.
+ $2
+ fi
+
])