xref: /freebsd/sys/contrib/openzfs/config/ax_python_devel.m4 (revision bb2d13b686e3ccf6c3ccb36209dfb7dcc108b182)
1eda14cbcSMatt Macy# ===========================================================================
2eda14cbcSMatt Macy#     https://www.gnu.org/software/autoconf-archive/ax_python_devel.html
3eda14cbcSMatt Macy# ===========================================================================
4eda14cbcSMatt Macy#
5eda14cbcSMatt Macy# SYNOPSIS
6eda14cbcSMatt Macy#
7eda14cbcSMatt Macy#   AX_PYTHON_DEVEL([version], [action-if-not-found])
8eda14cbcSMatt Macy#
9eda14cbcSMatt Macy# DESCRIPTION
10eda14cbcSMatt Macy#
11eda14cbcSMatt Macy#   Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
12eda14cbcSMatt Macy#   in your configure.ac.
13eda14cbcSMatt Macy#
14eda14cbcSMatt Macy#   Note: this is a slightly modified version of the original AX_PYTHON_DEVEL
15eda14cbcSMatt Macy#   macro which accepts an additional [action-if-not-found] argument. This
16eda14cbcSMatt Macy#   allow to detect if Python development is available without aborting the
17eda14cbcSMatt Macy#   configure phase with an hard error in case it is not.
18eda14cbcSMatt Macy#
19eda14cbcSMatt Macy#   This macro checks for Python and tries to get the include path to
20eda14cbcSMatt Macy#   'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output
21eda14cbcSMatt Macy#   variables. It also exports $(PYTHON_EXTRA_LIBS) and
22eda14cbcSMatt Macy#   $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
23eda14cbcSMatt Macy#
24eda14cbcSMatt Macy#   You can search for some particular version of Python by passing a
25eda14cbcSMatt Macy#   parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
26eda14cbcSMatt Macy#   note that you *have* to pass also an operator along with the version to
27eda14cbcSMatt Macy#   match, and pay special attention to the single quotes surrounding the
28eda14cbcSMatt Macy#   version number. Don't use "PYTHON_VERSION" for this: that environment
29eda14cbcSMatt Macy#   variable is declared as precious and thus reserved for the end-user.
30eda14cbcSMatt Macy#
31eda14cbcSMatt Macy#   This macro should work for all versions of Python >= 2.1.0. As an end
32eda14cbcSMatt Macy#   user, you can disable the check for the python version by setting the
33eda14cbcSMatt Macy#   PYTHON_NOVERSIONCHECK environment variable to something else than the
34eda14cbcSMatt Macy#   empty string.
35eda14cbcSMatt Macy#
36eda14cbcSMatt Macy#   If you need to use this macro for an older Python version, please
37eda14cbcSMatt Macy#   contact the authors. We're always open for feedback.
38eda14cbcSMatt Macy#
39eda14cbcSMatt Macy# LICENSE
40eda14cbcSMatt Macy#
41eda14cbcSMatt Macy#   Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
42eda14cbcSMatt Macy#   Copyright (c) 2009 Alan W. Irwin
43eda14cbcSMatt Macy#   Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
44eda14cbcSMatt Macy#   Copyright (c) 2009 Andrew Collier
45eda14cbcSMatt Macy#   Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
46eda14cbcSMatt Macy#   Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
47eda14cbcSMatt Macy#   Copyright (c) 2013 Daniel Mullner <muellner@math.stanford.edu>
48eda14cbcSMatt Macy#   Copyright (c) 2018 loli10K <ezomori.nozomu@gmail.com>
49eda14cbcSMatt Macy#
50eda14cbcSMatt Macy#   This program is free software: you can redistribute it and/or modify it
51eda14cbcSMatt Macy#   under the terms of the GNU General Public License as published by the
52eda14cbcSMatt Macy#   Free Software Foundation, either version 3 of the License, or (at your
53eda14cbcSMatt Macy#   option) any later version.
54eda14cbcSMatt Macy#
55eda14cbcSMatt Macy#   This program is distributed in the hope that it will be useful, but
56eda14cbcSMatt Macy#   WITHOUT ANY WARRANTY; without even the implied warranty of
57eda14cbcSMatt Macy#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
58eda14cbcSMatt Macy#   Public License for more details.
59eda14cbcSMatt Macy#
60eda14cbcSMatt Macy#   You should have received a copy of the GNU General Public License along
61eda14cbcSMatt Macy#   with this program. If not, see <https://www.gnu.org/licenses/>.
62eda14cbcSMatt Macy#
63eda14cbcSMatt Macy#   As a special exception, the respective Autoconf Macro's copyright owner
64eda14cbcSMatt Macy#   gives unlimited permission to copy, distribute and modify the configure
65eda14cbcSMatt Macy#   scripts that are the output of Autoconf when processing the Macro. You
66eda14cbcSMatt Macy#   need not follow the terms of the GNU General Public License when using
67eda14cbcSMatt Macy#   or distributing such scripts, even though portions of the text of the
68eda14cbcSMatt Macy#   Macro appear in them. The GNU General Public License (GPL) does govern
69eda14cbcSMatt Macy#   all other use of the material that constitutes the Autoconf Macro.
70eda14cbcSMatt Macy#
71eda14cbcSMatt Macy#   This special exception to the GPL applies to versions of the Autoconf
72eda14cbcSMatt Macy#   Macro released by the Autoconf Archive. When you make and distribute a
73eda14cbcSMatt Macy#   modified version of the Autoconf Macro, you may extend this special
74eda14cbcSMatt Macy#   exception to the GPL to apply to your modified version as well.
75eda14cbcSMatt Macy
76eda14cbcSMatt Macy#serial 21
77eda14cbcSMatt Macy
78eda14cbcSMatt MacyAU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
79eda14cbcSMatt MacyAC_DEFUN([AX_PYTHON_DEVEL],[
80eda14cbcSMatt Macy	#
81eda14cbcSMatt Macy	# Allow the use of a (user set) custom python version
82eda14cbcSMatt Macy	#
83eda14cbcSMatt Macy	AC_ARG_VAR([PYTHON_VERSION],[The installed Python
84eda14cbcSMatt Macy		version to use, for example '2.3'. This string
85eda14cbcSMatt Macy		will be appended to the Python interpreter
86eda14cbcSMatt Macy		canonical name.])
87eda14cbcSMatt Macy
88eda14cbcSMatt Macy	AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
89eda14cbcSMatt Macy	if test -z "$PYTHON"; then
90eda14cbcSMatt Macy		m4_ifvaln([$2],[$2],[
91eda14cbcSMatt Macy			AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
92eda14cbcSMatt Macy			PYTHON_VERSION=""
93eda14cbcSMatt Macy		])
94eda14cbcSMatt Macy	fi
95eda14cbcSMatt Macy
96eda14cbcSMatt Macy	#
97eda14cbcSMatt Macy	# Check for a version of Python >= 2.1.0
98eda14cbcSMatt Macy	#
99eda14cbcSMatt Macy	AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
1003ff01b23SMartin Matuska	ac_supports_python_ver=`cat<<EOD | $PYTHON -
1013ff01b23SMartin Matuskafrom __future__ import print_function;
1023ff01b23SMartin Matuskaimport sys;
1033ff01b23SMartin Matuskatry:
1043ff01b23SMartin Matuska	from packaging import version;
1053ff01b23SMartin Matuskaexcept ImportError:
1063ff01b23SMartin Matuska	from distlib import version;
1073ff01b23SMartin Matuskaver = sys.version.split ()[[0]];
1083ff01b23SMartin Matuska(tst_cmp, tst_ver) = ">= '2.1.0'".split ();
1093ff01b23SMartin Matuskatst_ver = tst_ver.strip ("'");
1103ff01b23SMartin Matuskaeval ("print (version.LegacyVersion (ver)"+ tst_cmp +"version.LegacyVersion (tst_ver))")
1113ff01b23SMartin MatuskaEOD`
112eda14cbcSMatt Macy	if test "$ac_supports_python_ver" != "True"; then
113eda14cbcSMatt Macy		if test -z "$PYTHON_NOVERSIONCHECK"; then
114eda14cbcSMatt Macy			AC_MSG_RESULT([no])
115eda14cbcSMatt Macy			m4_ifvaln([$2],[$2],[
116eda14cbcSMatt Macy				AC_MSG_FAILURE([
117eda14cbcSMatt MacyThis version of the AC@&t@_PYTHON_DEVEL macro
118eda14cbcSMatt Macydoesn't work properly with versions of Python before
119eda14cbcSMatt Macy2.1.0. You may need to re-run configure, setting the
120eda14cbcSMatt Macyvariables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
121eda14cbcSMatt MacyPYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
122eda14cbcSMatt MacyMoreover, to disable this check, set PYTHON_NOVERSIONCHECK
123eda14cbcSMatt Macyto something else than an empty string.
124eda14cbcSMatt Macy])
125eda14cbcSMatt Macy			])
126eda14cbcSMatt Macy		else
127eda14cbcSMatt Macy			AC_MSG_RESULT([skip at user request])
128eda14cbcSMatt Macy		fi
129eda14cbcSMatt Macy	else
130eda14cbcSMatt Macy		AC_MSG_RESULT([yes])
131eda14cbcSMatt Macy	fi
132eda14cbcSMatt Macy
133eda14cbcSMatt Macy	#
134eda14cbcSMatt Macy	# if the macro parameter ``version'' is set, honour it
135eda14cbcSMatt Macy	#
136eda14cbcSMatt Macy	if test -n "$1"; then
137eda14cbcSMatt Macy		AC_MSG_CHECKING([for a version of Python $1])
1383ff01b23SMartin Matuska		# Why the strip ()?  Because if we don't, version.parse
1393ff01b23SMartin Matuska		# will, for example, report 3.10.0 >= '3.11.0'
1403ff01b23SMartin Matuska		ac_supports_python_ver=`cat<<EOD | $PYTHON -
1413ff01b23SMartin Matuska
1423ff01b23SMartin Matuskafrom __future__ import print_function;
1433ff01b23SMartin Matuskaimport sys;
1443ff01b23SMartin Matuskatry:
1453ff01b23SMartin Matuska	from packaging import version;
1463ff01b23SMartin Matuskaexcept ImportError:
1473ff01b23SMartin Matuska	from distlib import version;
1483ff01b23SMartin Matuskaver = sys.version.split ()[[0]];
1493ff01b23SMartin Matuska(tst_cmp, tst_ver) = "$1".split ();
1503ff01b23SMartin Matuskatst_ver = tst_ver.strip ("'");
1513ff01b23SMartin Matuskaeval ("print (version.LegacyVersion (ver)"+ tst_cmp +"version.LegacyVersion (tst_ver))")
1523ff01b23SMartin MatuskaEOD`
153eda14cbcSMatt Macy		if test "$ac_supports_python_ver" = "True"; then
154eda14cbcSMatt Macy		   AC_MSG_RESULT([yes])
155eda14cbcSMatt Macy		else
156eda14cbcSMatt Macy			AC_MSG_RESULT([no])
157eda14cbcSMatt Macy			m4_ifvaln([$2],[$2],[
158eda14cbcSMatt Macy				AC_MSG_ERROR([this package requires Python $1.
159eda14cbcSMatt MacyIf you have it installed, but it isn't the default Python
160eda14cbcSMatt Macyinterpreter in your system path, please pass the PYTHON_VERSION
161eda14cbcSMatt Macyvariable to configure. See ``configure --help'' for reference.
162eda14cbcSMatt Macy])
163eda14cbcSMatt Macy				PYTHON_VERSION=""
164eda14cbcSMatt Macy			])
165eda14cbcSMatt Macy		fi
166eda14cbcSMatt Macy	fi
167eda14cbcSMatt Macy
168eda14cbcSMatt Macy	#
169eda14cbcSMatt Macy	# Check for Python include path
170eda14cbcSMatt Macy	#
171*bb2d13b6SMartin Matuska	#
172eda14cbcSMatt Macy	AC_MSG_CHECKING([for Python include path])
173eda14cbcSMatt Macy	if test -z "$PYTHON_CPPFLAGS"; then
174*bb2d13b6SMartin Matuska		python_path=`$PYTHON -c "import sysconfig; \
175*bb2d13b6SMartin Matuska			print (sysconfig.get_path('include'));"`
176*bb2d13b6SMartin Matuska		plat_python_path=`$PYTHON -c "import sysconfig; \
177*bb2d13b6SMartin Matuska			print (sysconfig.get_path('platinclude'));"`
178eda14cbcSMatt Macy		if test -n "${python_path}"; then
179eda14cbcSMatt Macy			if test "${plat_python_path}" != "${python_path}"; then
180eda14cbcSMatt Macy				python_path="-I$python_path -I$plat_python_path"
181eda14cbcSMatt Macy			else
182eda14cbcSMatt Macy				python_path="-I$python_path"
183eda14cbcSMatt Macy			fi
184eda14cbcSMatt Macy		fi
185eda14cbcSMatt Macy		PYTHON_CPPFLAGS=$python_path
186eda14cbcSMatt Macy	fi
187eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_CPPFLAGS])
188eda14cbcSMatt Macy	AC_SUBST([PYTHON_CPPFLAGS])
189eda14cbcSMatt Macy
190eda14cbcSMatt Macy	#
191eda14cbcSMatt Macy	# Check for Python library path
192eda14cbcSMatt Macy	#
193eda14cbcSMatt Macy	AC_MSG_CHECKING([for Python library path])
194eda14cbcSMatt Macy	if test -z "$PYTHON_LIBS"; then
195eda14cbcSMatt Macy		# (makes two attempts to ensure we've got a version number
196eda14cbcSMatt Macy		# from the interpreter)
197eda14cbcSMatt Macy		ac_python_version=`cat<<EOD | $PYTHON -
198eda14cbcSMatt Macy
199eda14cbcSMatt Macy# join all versioning strings, on some systems
200eda14cbcSMatt Macy# major/minor numbers could be in different list elements
201*bb2d13b6SMartin Matuskafrom sysconfig import *
202eda14cbcSMatt Macye = get_config_var('VERSION')
203eda14cbcSMatt Macyif e is not None:
204eda14cbcSMatt Macy	print(e)
205eda14cbcSMatt MacyEOD`
206eda14cbcSMatt Macy
207eda14cbcSMatt Macy		if test -z "$ac_python_version"; then
208eda14cbcSMatt Macy			if test -n "$PYTHON_VERSION"; then
209eda14cbcSMatt Macy				ac_python_version=$PYTHON_VERSION
210eda14cbcSMatt Macy			else
211eda14cbcSMatt Macy				ac_python_version=`$PYTHON -c "import sys; \
21281b22a98SMartin Matuska					print ('.'.join(sys.version.split('.')[[:2]]))"`
213eda14cbcSMatt Macy			fi
214eda14cbcSMatt Macy		fi
215eda14cbcSMatt Macy
216eda14cbcSMatt Macy		# Make the versioning information available to the compiler
217eda14cbcSMatt Macy		AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
218eda14cbcSMatt Macy                                   [If available, contains the Python version number currently in use.])
219eda14cbcSMatt Macy
220eda14cbcSMatt Macy		# First, the library directory:
221eda14cbcSMatt Macy		ac_python_libdir=`cat<<EOD | $PYTHON -
222eda14cbcSMatt Macy
223eda14cbcSMatt Macy# There should be only one
224*bb2d13b6SMartin Matuskaimport sysconfig
225*bb2d13b6SMartin Matuskae = sysconfig.get_config_var('LIBDIR')
226eda14cbcSMatt Macyif e is not None:
227eda14cbcSMatt Macy	print (e)
228eda14cbcSMatt MacyEOD`
229eda14cbcSMatt Macy
230eda14cbcSMatt Macy		# Now, for the library:
231eda14cbcSMatt Macy		ac_python_library=`cat<<EOD | $PYTHON -
232eda14cbcSMatt Macy
233*bb2d13b6SMartin Matuskaimport sysconfig
234*bb2d13b6SMartin Matuskac = sysconfig.get_config_vars()
235eda14cbcSMatt Macyif 'LDVERSION' in c:
236eda14cbcSMatt Macy	print ('python'+c[['LDVERSION']])
237eda14cbcSMatt Macyelse:
238eda14cbcSMatt Macy	print ('python'+c[['VERSION']])
239eda14cbcSMatt MacyEOD`
240eda14cbcSMatt Macy
241eda14cbcSMatt Macy		# This small piece shamelessly adapted from PostgreSQL python macro;
242eda14cbcSMatt Macy		# credits goes to momjian, I think. I'd like to put the right name
243eda14cbcSMatt Macy		# in the credits, if someone can point me in the right direction... ?
244eda14cbcSMatt Macy		#
245eda14cbcSMatt Macy		if test -n "$ac_python_libdir" -a -n "$ac_python_library"
246eda14cbcSMatt Macy		then
247eda14cbcSMatt Macy			# use the official shared library
248eda14cbcSMatt Macy			ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
249eda14cbcSMatt Macy			PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
250eda14cbcSMatt Macy		else
251eda14cbcSMatt Macy			# old way: use libpython from python_configdir
252eda14cbcSMatt Macy			ac_python_libdir=`$PYTHON -c \
253*bb2d13b6SMartin Matuska			  "import sysconfig; \
254eda14cbcSMatt Macy			  import os; \
255*bb2d13b6SMartin Matuska			  print (os.path.join(sysconfig.get_path('platstdlib'), 'config'));"`
256eda14cbcSMatt Macy			PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
257eda14cbcSMatt Macy		fi
258eda14cbcSMatt Macy
259eda14cbcSMatt Macy		if test -z "PYTHON_LIBS"; then
260eda14cbcSMatt Macy			m4_ifvaln([$2],[$2],[
261eda14cbcSMatt Macy				AC_MSG_ERROR([
262eda14cbcSMatt Macy  Cannot determine location of your Python DSO. Please check it was installed with
263eda14cbcSMatt Macy  dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
264eda14cbcSMatt Macy				])
265eda14cbcSMatt Macy			])
266eda14cbcSMatt Macy		fi
267eda14cbcSMatt Macy	fi
268eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_LIBS])
269eda14cbcSMatt Macy	AC_SUBST([PYTHON_LIBS])
270eda14cbcSMatt Macy
271eda14cbcSMatt Macy	#
272eda14cbcSMatt Macy	# Check for site packages
273eda14cbcSMatt Macy	#
274eda14cbcSMatt Macy	AC_MSG_CHECKING([for Python site-packages path])
275eda14cbcSMatt Macy	if test -z "$PYTHON_SITE_PKG"; then
276eda14cbcSMatt Macy		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
277*bb2d13b6SMartin Matuska			print (distutils.sysconfig.get_python_lib(0,0));" 2>/dev/null || \
278*bb2d13b6SMartin Matuska			$PYTHON -c "import sysconfig; \
279*bb2d13b6SMartin Matuska			print (sysconfig.get_path('purelib'));"`
280eda14cbcSMatt Macy	fi
281eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_SITE_PKG])
282eda14cbcSMatt Macy	AC_SUBST([PYTHON_SITE_PKG])
283eda14cbcSMatt Macy
284eda14cbcSMatt Macy	#
285eda14cbcSMatt Macy	# libraries which must be linked in when embedding
286eda14cbcSMatt Macy	#
287eda14cbcSMatt Macy	AC_MSG_CHECKING(python extra libraries)
288eda14cbcSMatt Macy	if test -z "$PYTHON_EXTRA_LIBS"; then
289*bb2d13b6SMartin Matuska	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import sysconfig; \
290*bb2d13b6SMartin Matuska                conf = sysconfig.get_config_var; \
291eda14cbcSMatt Macy                print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
292eda14cbcSMatt Macy	fi
293eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
294eda14cbcSMatt Macy	AC_SUBST(PYTHON_EXTRA_LIBS)
295eda14cbcSMatt Macy
296eda14cbcSMatt Macy	#
297eda14cbcSMatt Macy	# linking flags needed when embedding
298eda14cbcSMatt Macy	#
299eda14cbcSMatt Macy	AC_MSG_CHECKING(python extra linking flags)
300eda14cbcSMatt Macy	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
301*bb2d13b6SMartin Matuska		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import sysconfig; \
302*bb2d13b6SMartin Matuska			conf = sysconfig.get_config_var; \
303eda14cbcSMatt Macy			print (conf('LINKFORSHARED'))"`
304eda14cbcSMatt Macy	fi
305eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
306eda14cbcSMatt Macy	AC_SUBST(PYTHON_EXTRA_LDFLAGS)
307eda14cbcSMatt Macy
308eda14cbcSMatt Macy	#
309eda14cbcSMatt Macy	# final check to see if everything compiles alright
310eda14cbcSMatt Macy	#
311eda14cbcSMatt Macy	AC_MSG_CHECKING([consistency of all components of python development environment])
312eda14cbcSMatt Macy	# save current global flags
313eda14cbcSMatt Macy	ac_save_LIBS="$LIBS"
314eda14cbcSMatt Macy	ac_save_LDFLAGS="$LDFLAGS"
315eda14cbcSMatt Macy	ac_save_CPPFLAGS="$CPPFLAGS"
316eda14cbcSMatt Macy	LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS"
317eda14cbcSMatt Macy	LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
318eda14cbcSMatt Macy	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
319eda14cbcSMatt Macy	AC_LANG_PUSH([C])
320eda14cbcSMatt Macy	AC_LINK_IFELSE([
321eda14cbcSMatt Macy		AC_LANG_PROGRAM([[#include <Python.h>]],
322eda14cbcSMatt Macy				[[Py_Initialize();]])
323eda14cbcSMatt Macy		],[pythonexists=yes],[pythonexists=no])
324eda14cbcSMatt Macy	AC_LANG_POP([C])
325eda14cbcSMatt Macy	# turn back to default flags
326eda14cbcSMatt Macy	CPPFLAGS="$ac_save_CPPFLAGS"
327eda14cbcSMatt Macy	LIBS="$ac_save_LIBS"
328eda14cbcSMatt Macy	LDFLAGS="$ac_save_LDFLAGS"
329eda14cbcSMatt Macy
330eda14cbcSMatt Macy	AC_MSG_RESULT([$pythonexists])
331eda14cbcSMatt Macy
332eda14cbcSMatt Macy        if test ! "x$pythonexists" = "xyes"; then
333eda14cbcSMatt Macy		m4_ifvaln([$2],[$2],[
334eda14cbcSMatt Macy			AC_MSG_FAILURE([
335eda14cbcSMatt Macy  Could not link test program to Python. Maybe the main Python library has been
336eda14cbcSMatt Macy  installed in some non-standard library path. If so, pass it to configure,
337eda14cbcSMatt Macy  via the LIBS environment variable.
338eda14cbcSMatt Macy  Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
339eda14cbcSMatt Macy  ============================================================================
340eda14cbcSMatt Macy   ERROR!
341eda14cbcSMatt Macy   You probably have to install the development version of the Python package
342eda14cbcSMatt Macy   for your distribution.  The exact name of this package varies among them.
343eda14cbcSMatt Macy  ============================================================================
344eda14cbcSMatt Macy	   ])
345eda14cbcSMatt Macy			PYTHON_VERSION=""
346eda14cbcSMatt Macy		])
347eda14cbcSMatt Macy	fi
348eda14cbcSMatt Macy
349eda14cbcSMatt Macy	#
350eda14cbcSMatt Macy	# all done!
351eda14cbcSMatt Macy	#
352eda14cbcSMatt Macy])
353