[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ax_prog_python.m4
From: |
Dustin Mitchell |
Subject: |
Re: ax_prog_python.m4 |
Date: |
Fri, 25 Jul 2003 18:13:11 -0500 |
User-agent: |
Mutt/1.4.1i |
On Fri, Jul 25, 2003 at 01:09:36AM +0200, Guido Draheim wrote:
> Well, most users of scripting languages tend to use configure scripts
> written in their preferred scripting idiom - the perl installation
> even has a few library routines to help with the tasks, ye know, and
> most other projects have been fine with simply using AC_PATH_PROG.
This macro adds the support for the --with-python argument, and with
the other additions you supply below, will help people who want to
build against a version of Python different from that which is
currently in the PATH. It will be good for those distributing scripts
(e.g., CGI) or other software that merely *uses* Python, but does not
extend the python distribution.
I understand that the macro isn't too exciting, but it saves the
trouble of rolling your own ungainly AC_ARG_VAR / AC_ARG_WITH /
AC_PATH_PROG sequence within configure.ac. Hopefully my
ax_python_config_var.m4 macros are a little more exciting; I'll be
re-drafting those and sending them along shortly.
> - add some ACTION-IF-NOT-FOUND part, currently you just put out
> informative messages but AC_PATH_PROG itself has that action-arg.
I had thought of that, but in fact AC_PATH_PROG doesn't have an
ACTION-IF-NOT-FOUND:
AC_PATH_PROG (variable, prog-to-check-for, [value-if-not-found], [path])
It seems it would be better to follow the AC_PATH_PROG model, and
provide a [value-if-not-found] parameter, which I have done.
As for the rest of your (very helpful!) comments: duly noted and new
version supplied below.
Dustin
--snip--
dnl @synopsis AX_WITH_PYTHON([minimum-version], [value-if-not-found])
dnl
dnl Locates an installed Python binary, placing the result in the precious
dnl variable $PYTHON. Accepts a present $PYTHON, then --with-python, and
failing
dnl that searches for python in the given path (which defaults to the system
dnl path). If python is found, $PYTHON is set to the full path of the binary
and
dnl ACTION-IF-FOUND is executed; otherwise ACTION-IF-NOT-FOUND is executed.
dnl
dnl Example:
dnl
dnl AX_WITH_PYTHON(2.2, missing)
dnl
dnl @author Dustin Mitchell <address@hidden>
AC_DEFUN([AX_WITH_PYTHON],
[
AC_ARG_VAR(PYTHON)
# unless PYTHON was supplied to us (as a precious variable)
if test -z "$PYTHON"
then
AC_MSG_CHECKING(for --with-python)
AC_ARG_WITH(python,
AC_HELP_STRING([--with-python=PYTHON],
[absolute path name of Python executable]),
[ if test "$withval" != "yes"
then
PYTHON="$withval"
AC_MSG_RESULT($withval)
else
AC_MSG_RESULT(no)
fi
],
[ AC_MSG_RESULT(no)
])
fi
# if it's still not found, check the paths.
if test -z "$PYTHON"
then
AC_PATH_PROG(PYTHON, python)
fi
# if, even now, it's not found, just bail with value-if-not-found
if test -z "$PYTHON"
then
PYTHON="$2"
else
# check version if required
if test "x$1" != "x"
then
AC_MSG_CHECKING(Python version >= $1)
if test `python -c ["import sys; print sys.version[:3] >= \"$1\" and
\"OK\" or \"OLD\""]` = "OK"
then
AC_MSG_RESULT(ok)
else
AC_MSG_RESULT(no)
PYTHON="$2"
fi
fi
fi
])
--snip--
--
Dustin Mitchell
address@hidden/address@hidden
http://people.cs.uchicago.edu/~dustin/