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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: az_python
</title>
<link rel="stylesheet" type="text/css" href="autoconf-archive.css">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:33%;" align="center" valign="top">
<a href="macros-by-category.html">Macros by Category</a>
</td>
<td style="width:33%;" align="center" valign="top">
<a href=
"http://git.cryp.to/autoconf-archive/history/master:/az_python.m4">Revision
History</a>
</td>
<td style="width:33%;" align="center" valign="top">
<form method="get" action="http://www.google.com/search">
<div>
<input name="sitesearch" value="autoconf-archive.cryp.to" type=
"hidden">Search: <input name="q" maxlength="255" type="text">
</div>
</form>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
az_python
</h1>
<h2>
SYNOPSIS
</h2>
<p class="indent" style="white-space:nowrap;">
<code>AZ_PYTHON_DEFAULT</code><br>
<code>AZ_PYTHON_ENABLE</code><br>
<code>AZ_PYTHON_WITH</code><br>
<code>AZ_PYTHON_PATH</code><br>
<code>AZ_PYTHON_VERSION_ENSURE( [2.2] )</code><br>
<code>AZ_PYTHON_CSPEC</code><br>
<code>AZ_PYTHON_LSPEC</code>
</p>
<h2>
DESCRIPTION
</h2>
<div class="indent">
<p>
This file provides autoconf support for those applications that want to
embed python. It supports all pythons >= 2.2 which is the first official
release containing distutils. Version 2.2 of python was released December
21, 2001. Since it actually executes the python, cross platform
configuration will probably not work. Also, most of the platforms supported
are consistent until you look into MacOSX. The python included with it is
installed as a framework which is a very different environment to set up
the normal tools such as gcc and libtool to deal with. Therefore, once we
establish which python that we are going to use, we use its distutils to
actually compile and link our modules or applications.
</p>
<p>
At this time, it does NOT support linking with Python statically. It does
support dynamic linking.
</p>
<p>
This set of macros help define $PYTHON, $PYTHON_USE, $PYTHON_CSPEC and
$PYTHON_LSPEC. $PYTHON defines the full executable path for the Python
being linked to and is used within these macros to determine if that has
been specified or found. These macros do execute this python version so it
must be present on the system at configure time.
</p>
<p>
$PYTHON_USE is an automake variable that defines whether Python support
should be included or not in your application. $PYTHON_CSPEC is a variable
that supplies additional CFLAGS for the compilation of the
application/shared library. $PYTHON_LSPEC is a variable that supplies
additional LDFLAGS for linking the application/shared library.
</p>
<p>
The following is an example of how to set up for python usage within your
application in your configure.in:
</p>
<pre>
AZ_PYTHON_DEFAULT( )
AZ_PYTHON_ENABLE( ) # Optional
AZ_PYTHON_WITH( ) # Optional
AZ_PYTHON_PATH( ) # or AZ_PYTHON_INSIST( )
# if $PYTHON is not defined, then the following do nothing.
AZ_PYTHON_VERSION_ENSURE( [2.2] )
AZ_PYTHON_CSPEC
AZ_PYTHON_LSPEC
</pre>
<p>
The AZ_PYTHON_DEFAULT sets the $PYTHON_USE to false. Thereby, excluding it
if it was optional.
</p>
<p>
The AZ_PYTHON_ENABLE looks for the optional configure parameters of
--enable-python/--disable-python and establishes the $PYTHON and
$PYTHON_USE variables accordingly.
</p>
<p>
The AZ_PYTHON_WITH looks for the optional configure parameters of
--with-python/--without-python and establishes the $PYTHON and $PYTHON_USE
variables accordingly.
</p>
<p>
The AZ_PYTHON_PATH looks for python assuming that none has been previously
found or defined and issues an error if it does not find it. If it does
find it, it establishes the $PYTHON and $PYTHON_USE variables accordingly.
AZ_PYTHON_INSIST could be used here instead if you want to insist that
Python support be included using the --enable-python or --with-python
checks previously done.
</p>
<p>
The AZ_PYTHON_VERSION_ENSURE issues an error if the Python previously found
is not of version 2.2 or greater.
</p>
<p>
Once that these macros have be run, we can use PYTHON_USE within the
makefile.am file to conditionally add the Python support such as:
</p>
<p>
Makefile.am example showing optional inclusion of directories:
</p>
<pre>
if PYTHON_USE
plugins = plugins
src = src
else
plugins =
src =
endif
SUBDIRS = . $(plugins) $(src)
</pre>
<p>
Makefile.am example showing optional shared library build:
</p>
<pre>
if PYTHON_USE
lib_LTLIBRARIES = libElemList.la
libElemList_la_SOURCES = libElemList.c
libElemList_la_CFLAGS = @PYTHON_CSPEC@
libElemList_la_LDFLAGS = @PYTHON_LSPEC@
endif
</pre>
<p>
Makefile.am example showing optional program build:
</p>
<pre>
if PYTHON_USE
bin_PROGRAMS = runFunc
runFunc_SOURCES = runFunc.c
runFunc_CFLAGS = @PYTHON_CSPEC@
runFunc_LDFLAGS = @PYTHON_LSPEC@
endif
</pre>
<p>
The above compiles the modules only if PYTHON_USE was specified as true.
Also, the else portion of the if was optional.
</p>
</div>
<h2>
SOURCE CODE
</h2>
<p class="indent">
<a href=
"http://autoconf-archive.cryp.to/az_python.m4">http://autoconf-archive.cryp.to/az_python.m4</a>
</p>
<h2>
LICENSE
</h2>
<div class="indent">
<p style="white-space:nowrap;">
Copyright © 2008 Robert White <kranki@mac.com><br>
Copyright © 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
</p>
<p>
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice and
this notice are preserved.
</p>
</div>
</body>
</html>
|