1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: ax_with_python
</title>
<link rel="stylesheet" type="text/css" href="ac-archive.css">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:50%;" align="center">
<a href="http://autoconf-archive.cryp.to/ax_with_python.m4">Download M4
Source</a>
</td>
<td style="width:50%;" align="center">
<a href="macros-by-category.html">Macro Index Page</a>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
ax_with_python
</h1>
<h2>
Synopsis
</h2>
<p class="indent" style="white-space:nowrap;">
<code>AX_WITH_PYTHON([minimum-version], [value-if-not-found], [path])</code>
</p>
<h2>
Description
</h2>
<div class="indent">
<p>
Locates an installed Python binary, placing the result in the precious
variable $PYTHON. Accepts a present $PYTHON, then --with-python, and
failing that searches for python in the given path (which defaults to the
system path). If python is found, $PYTHON is set to the full path of the
binary; if it is not found, $PYTHON is set to VALUE-IF-NOT-FOUND, which
defaults to 'python'.
</p>
<p>
Example:
</p>
<pre>
AX_WITH_PYTHON(2.2, missing)
</pre>
</div>
<h2>
Author
</h2>
<p class="indent">
Dustin Mitchell <dustin@cs.uchicago.edu>
</p>
<h2>
Last Modified
</h2>
<p class="indent">
2005-01-22
</p>
<h2>
M4 Source Code
</h2>
<div class="indent">
<pre class="m4source">
AC_DEFUN([AX_WITH_PYTHON],
[
AC_ARG_VAR([PYTHON])
dnl 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
dnl if it's still not found, check the paths, or use the fallback
if test -z "$PYTHON"
then
AC_PATH_PROG([PYTHON], python, m4_ifval([$2],[$2],[python]), $3)
fi
dnl check version if required
m4_ifvaln([$1], [
dnl do this only if we didn't fall back
if test "$PYTHON" != "m4_ifval([$2],[$2],[python])"
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])
])
</pre>
</div>
</body>
</html>
|