comparison m4/ax_python.m4 @ 207:17d2d6a7587f

add missing m4 macros to source control
author Carl Byington <carl@five-ten-sg.com>
date Sat, 06 Jun 2009 12:53:28 -0700
parents
children 06d759f640f6
comparison
equal deleted inserted replaced
206:5cd7b495a3ac 207:17d2d6a7587f
1 # ===========================================================================
2 # http://autoconf-archive.cryp.to/ax_python.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_PYTHON
8 #
9 # DESCRIPTION
10 #
11 # This macro does a complete Python development environment check.
12 #
13 # It recurses through several python versions (from 2.1 to 2.5 in this
14 # version), looking for an executable. When it finds an executable, it
15 # looks to find the header files and library.
16 #
17 # It sets PYTHON_BIN to the name of the python executable,
18 # PYTHON_INCLUDE_DIR to the directory holding the header files, and
19 # PYTHON_LIB to the name of the Python library.
20 #
21 # This macro calls AC_SUBST on PYTHON_BIN (via AC_CHECK_PROG),
22 # PYTHON_INCLUDE_DIR and PYTHON_LIB.
23 #
24 # LAST MODIFICATION
25 #
26 # 2008-04-12
27 #
28 # COPYLEFT
29 #
30 # Copyright (c) 2008 Michael Tindal
31 #
32 # This program is free software; you can redistribute it and/or modify it
33 # under the terms of the GNU General Public License as published by the
34 # Free Software Foundation; either version 2 of the License, or (at your
35 # option) any later version.
36 #
37 # This program is distributed in the hope that it will be useful, but
38 # WITHOUT ANY WARRANTY; without even the implied warranty of
39 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
40 # Public License for more details.
41 #
42 # You should have received a copy of the GNU General Public License along
43 # with this program. If not, see <http://www.gnu.org/licenses/>.
44 #
45 # As a special exception, the respective Autoconf Macro's copyright owner
46 # gives unlimited permission to copy, distribute and modify the configure
47 # scripts that are the output of Autoconf when processing the Macro. You
48 # need not follow the terms of the GNU General Public License when using
49 # or distributing such scripts, even though portions of the text of the
50 # Macro appear in them. The GNU General Public License (GPL) does govern
51 # all other use of the material that constitutes the Autoconf Macro.
52 #
53 # This special exception to the GPL applies to versions of the Autoconf
54 # Macro released by the Autoconf Macro Archive. When you make and
55 # distribute a modified version of the Autoconf Macro, you may extend this
56 # special exception to the GPL to apply to your modified version as well.
57
58 AC_DEFUN([AX_PYTHON],
59 [AC_MSG_CHECKING(for python build information)
60 AC_MSG_RESULT([])
61 for python in python2.5 python2.4 python2.3 python2.2 python2.1 python; do
62 AC_CHECK_PROGS(PYTHON_BIN, [$python])
63 ax_python_bin=$PYTHON_BIN
64 if test x$ax_python_bin != x; then
65 AC_CHECK_LIB($ax_python_bin, main, ax_python_lib=$ax_python_bin, ax_python_lib=no)
66 AC_CHECK_HEADER([$ax_python_bin/Python.h],
67 [[ax_python_header=`locate $ax_python_bin/Python.h | sed -e s,/Python.h,,`]],
68 ax_python_header=no)
69 if test $ax_python_lib != no; then
70 if test $ax_python_header != no; then
71 break;
72 fi
73 fi
74 fi
75 done
76 if test x$ax_python_bin = x; then
77 ax_python_bin=no
78 fi
79 if test x$ax_python_header = x; then
80 ax_python_header=no
81 fi
82 if test x$ax_python_lib = x; then
83 ax_python_lib=no
84 fi
85
86 AC_MSG_RESULT([ results of the Python check:])
87 AC_MSG_RESULT([ Binary: $ax_python_bin])
88 AC_MSG_RESULT([ Library: $ax_python_lib])
89 AC_MSG_RESULT([ Include Dir: $ax_python_header])
90
91 if test x$ax_python_header != xno; then
92 PYTHON_INCLUDE_DIR=$ax_python_header
93 AC_SUBST(PYTHON_INCLUDE_DIR)
94 fi
95 if test x$ax_python_lib != xno; then
96 PYTHON_LIB=$ax_python_lib
97 AC_SUBST(PYTHON_LIB)
98 fi
99 ])dnl