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