xref: /freebsd/sys/contrib/openzfs/config/ax_python_devel.m4 (revision 15f0b8c309dea1dcb14d3e374686576ff68ac43f)
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'])
100*15f0b8c3SMartin Matuska	ac_supports_python_ver=`$PYTHON -c "import sys; \
101*15f0b8c3SMartin Matuska		ver = sys.version.split ()[[0]]; \
102*15f0b8c3SMartin Matuska		print (ver >= '2.1.0')"`
103eda14cbcSMatt Macy	if test "$ac_supports_python_ver" != "True"; then
104eda14cbcSMatt Macy		if test -z "$PYTHON_NOVERSIONCHECK"; then
105eda14cbcSMatt Macy			AC_MSG_RESULT([no])
106eda14cbcSMatt Macy			AC_MSG_FAILURE([
107eda14cbcSMatt MacyThis version of the AC@&t@_PYTHON_DEVEL macro
108eda14cbcSMatt Macydoesn't work properly with versions of Python before
109eda14cbcSMatt Macy2.1.0. You may need to re-run configure, setting the
110eda14cbcSMatt Macyvariables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
111eda14cbcSMatt MacyPYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
112eda14cbcSMatt MacyMoreover, to disable this check, set PYTHON_NOVERSIONCHECK
113eda14cbcSMatt Macyto something else than an empty string.
114eda14cbcSMatt Macy])
115eda14cbcSMatt Macy		else
116eda14cbcSMatt Macy			AC_MSG_RESULT([skip at user request])
117eda14cbcSMatt Macy		fi
118eda14cbcSMatt Macy	else
119eda14cbcSMatt Macy		AC_MSG_RESULT([yes])
120eda14cbcSMatt Macy	fi
121eda14cbcSMatt Macy
122eda14cbcSMatt Macy	#
123*15f0b8c3SMartin Matuska	# If the macro parameter ``version'' is set, honour it.
124*15f0b8c3SMartin Matuska	# A Python shim class, VPy, is used to implement correct version comparisons via
125*15f0b8c3SMartin Matuska	# string expressions, since e.g. a naive textual ">= 2.7.3" won't work for
126*15f0b8c3SMartin Matuska	# Python 2.7.10 (the ".1" being evaluated as less than ".3").
127eda14cbcSMatt Macy	#
128eda14cbcSMatt Macy	if test -n "$1"; then
129eda14cbcSMatt Macy		AC_MSG_CHECKING([for a version of Python $1])
130*15f0b8c3SMartin Matuska                cat << EOF > ax_python_devel_vpy.py
131*15f0b8c3SMartin Matuskaclass VPy:
132*15f0b8c3SMartin Matuska    def vtup(self, s):
133*15f0b8c3SMartin Matuska        return tuple(map(int, s.strip().replace("rc", ".").split(".")))
134*15f0b8c3SMartin Matuska    def __init__(self):
135*15f0b8c3SMartin Matuska        import sys
136*15f0b8c3SMartin Matuska        self.vpy = tuple(sys.version_info)
137*15f0b8c3SMartin Matuska    def __eq__(self, s):
138*15f0b8c3SMartin Matuska        return self.vpy == self.vtup(s)
139*15f0b8c3SMartin Matuska    def __ne__(self, s):
140*15f0b8c3SMartin Matuska        return self.vpy != self.vtup(s)
141*15f0b8c3SMartin Matuska    def __lt__(self, s):
142*15f0b8c3SMartin Matuska        return self.vpy < self.vtup(s)
143*15f0b8c3SMartin Matuska    def __gt__(self, s):
144*15f0b8c3SMartin Matuska        return self.vpy > self.vtup(s)
145*15f0b8c3SMartin Matuska    def __le__(self, s):
146*15f0b8c3SMartin Matuska        return self.vpy <= self.vtup(s)
147*15f0b8c3SMartin Matuska    def __ge__(self, s):
148*15f0b8c3SMartin Matuska        return self.vpy >= self.vtup(s)
149*15f0b8c3SMartin MatuskaEOF
150*15f0b8c3SMartin Matuska		ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \
151*15f0b8c3SMartin Matuska                        ver = ax_python_devel_vpy.VPy(); \
152*15f0b8c3SMartin Matuska			print (ver $1)"`
153*15f0b8c3SMartin Matuska                rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py*
154eda14cbcSMatt Macy		if test "$ac_supports_python_ver" = "True"; then
155eda14cbcSMatt Macy			AC_MSG_RESULT([yes])
156eda14cbcSMatt Macy		else
157eda14cbcSMatt Macy			AC_MSG_RESULT([no])
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		fi
165eda14cbcSMatt Macy	fi
166eda14cbcSMatt Macy
167eda14cbcSMatt Macy	#
168eda14cbcSMatt Macy	# Check for Python include path
169eda14cbcSMatt Macy	#
170bb2d13b6SMartin Matuska	#
171eda14cbcSMatt Macy	AC_MSG_CHECKING([for Python include path])
172eda14cbcSMatt Macy	if test -z "$PYTHON_CPPFLAGS"; then
173bb2d13b6SMartin Matuska		python_path=`$PYTHON -c "import sysconfig; \
174bb2d13b6SMartin Matuska			print (sysconfig.get_path('include'));"`
175bb2d13b6SMartin Matuska		plat_python_path=`$PYTHON -c "import sysconfig; \
176bb2d13b6SMartin Matuska			print (sysconfig.get_path('platinclude'));"`
177eda14cbcSMatt Macy		if test -n "${python_path}"; then
178eda14cbcSMatt Macy			if test "${plat_python_path}" != "${python_path}"; then
179eda14cbcSMatt Macy				python_path="-I$python_path -I$plat_python_path"
180eda14cbcSMatt Macy			else
181eda14cbcSMatt Macy				python_path="-I$python_path"
182eda14cbcSMatt Macy			fi
183eda14cbcSMatt Macy		fi
184eda14cbcSMatt Macy		PYTHON_CPPFLAGS=$python_path
185eda14cbcSMatt Macy	fi
186eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_CPPFLAGS])
187eda14cbcSMatt Macy	AC_SUBST([PYTHON_CPPFLAGS])
188eda14cbcSMatt Macy
189eda14cbcSMatt Macy	#
190eda14cbcSMatt Macy	# Check for Python library path
191eda14cbcSMatt Macy	#
192eda14cbcSMatt Macy	AC_MSG_CHECKING([for Python library path])
193eda14cbcSMatt Macy	if test -z "$PYTHON_LIBS"; then
194eda14cbcSMatt Macy		# (makes two attempts to ensure we've got a version number
195eda14cbcSMatt Macy		# from the interpreter)
196eda14cbcSMatt Macy		ac_python_version=`cat<<EOD | $PYTHON -
197eda14cbcSMatt Macy
198eda14cbcSMatt Macy# join all versioning strings, on some systems
199eda14cbcSMatt Macy# major/minor numbers could be in different list elements
200bb2d13b6SMartin Matuskafrom sysconfig import *
201eda14cbcSMatt Macye = get_config_var('VERSION')
202eda14cbcSMatt Macyif e is not None:
203eda14cbcSMatt Macy	print(e)
204eda14cbcSMatt MacyEOD`
205eda14cbcSMatt Macy
206eda14cbcSMatt Macy		if test -z "$ac_python_version"; then
207eda14cbcSMatt Macy			if test -n "$PYTHON_VERSION"; then
208eda14cbcSMatt Macy				ac_python_version=$PYTHON_VERSION
209eda14cbcSMatt Macy			else
210eda14cbcSMatt Macy				ac_python_version=`$PYTHON -c "import sys; \
21181b22a98SMartin Matuska					print ('.'.join(sys.version.split('.')[[:2]]))"`
212eda14cbcSMatt Macy			fi
213eda14cbcSMatt Macy		fi
214eda14cbcSMatt Macy
215eda14cbcSMatt Macy		# Make the versioning information available to the compiler
216eda14cbcSMatt Macy		AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
217eda14cbcSMatt Macy                                   [If available, contains the Python version number currently in use.])
218eda14cbcSMatt Macy
219eda14cbcSMatt Macy		# First, the library directory:
220eda14cbcSMatt Macy		ac_python_libdir=`cat<<EOD | $PYTHON -
221eda14cbcSMatt Macy
222eda14cbcSMatt Macy# There should be only one
223bb2d13b6SMartin Matuskaimport sysconfig
224bb2d13b6SMartin Matuskae = sysconfig.get_config_var('LIBDIR')
225eda14cbcSMatt Macyif e is not None:
226eda14cbcSMatt Macy	print (e)
227eda14cbcSMatt MacyEOD`
228eda14cbcSMatt Macy
229eda14cbcSMatt Macy		# Now, for the library:
230eda14cbcSMatt Macy		ac_python_library=`cat<<EOD | $PYTHON -
231eda14cbcSMatt Macy
232bb2d13b6SMartin Matuskaimport sysconfig
233bb2d13b6SMartin Matuskac = sysconfig.get_config_vars()
234eda14cbcSMatt Macyif 'LDVERSION' in c:
235eda14cbcSMatt Macy	print ('python'+c[['LDVERSION']])
236eda14cbcSMatt Macyelse:
237eda14cbcSMatt Macy	print ('python'+c[['VERSION']])
238eda14cbcSMatt MacyEOD`
239eda14cbcSMatt Macy
240eda14cbcSMatt Macy		# This small piece shamelessly adapted from PostgreSQL python macro;
241eda14cbcSMatt Macy		# credits goes to momjian, I think. I'd like to put the right name
242eda14cbcSMatt Macy		# in the credits, if someone can point me in the right direction... ?
243eda14cbcSMatt Macy		#
244eda14cbcSMatt Macy		if test -n "$ac_python_libdir" -a -n "$ac_python_library"
245eda14cbcSMatt Macy		then
246eda14cbcSMatt Macy			# use the official shared library
247eda14cbcSMatt Macy			ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
248eda14cbcSMatt Macy			PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
249eda14cbcSMatt Macy		else
250eda14cbcSMatt Macy			# old way: use libpython from python_configdir
251eda14cbcSMatt Macy			ac_python_libdir=`$PYTHON -c \
252bb2d13b6SMartin Matuska			  "import sysconfig; \
253eda14cbcSMatt Macy			  import os; \
254bb2d13b6SMartin Matuska			  print (os.path.join(sysconfig.get_path('platstdlib'), 'config'));"`
255eda14cbcSMatt Macy			PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
256eda14cbcSMatt Macy		fi
257eda14cbcSMatt Macy
258eda14cbcSMatt Macy		if test -z "PYTHON_LIBS"; then
259eda14cbcSMatt Macy			m4_ifvaln([$2],[$2],[
260eda14cbcSMatt Macy				AC_MSG_ERROR([
261eda14cbcSMatt Macy  Cannot determine location of your Python DSO. Please check it was installed with
262eda14cbcSMatt Macy  dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
263eda14cbcSMatt Macy				])
264eda14cbcSMatt Macy			])
265eda14cbcSMatt Macy		fi
266eda14cbcSMatt Macy	fi
267eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_LIBS])
268eda14cbcSMatt Macy	AC_SUBST([PYTHON_LIBS])
269eda14cbcSMatt Macy
270eda14cbcSMatt Macy	#
271eda14cbcSMatt Macy	# Check for site packages
272eda14cbcSMatt Macy	#
273eda14cbcSMatt Macy	AC_MSG_CHECKING([for Python site-packages path])
274eda14cbcSMatt Macy	if test -z "$PYTHON_SITE_PKG"; then
275eda14cbcSMatt Macy		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
276bb2d13b6SMartin Matuska			print (distutils.sysconfig.get_python_lib(0,0));" 2>/dev/null || \
277bb2d13b6SMartin Matuska			$PYTHON -c "import sysconfig; \
278bb2d13b6SMartin Matuska			print (sysconfig.get_path('purelib'));"`
279eda14cbcSMatt Macy	fi
280eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_SITE_PKG])
281eda14cbcSMatt Macy	AC_SUBST([PYTHON_SITE_PKG])
282eda14cbcSMatt Macy
283eda14cbcSMatt Macy	#
284eda14cbcSMatt Macy	# libraries which must be linked in when embedding
285eda14cbcSMatt Macy	#
286eda14cbcSMatt Macy	AC_MSG_CHECKING(python extra libraries)
287eda14cbcSMatt Macy	if test -z "$PYTHON_EXTRA_LIBS"; then
288bb2d13b6SMartin Matuska	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import sysconfig; \
289bb2d13b6SMartin Matuska                conf = sysconfig.get_config_var; \
290eda14cbcSMatt Macy                print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
291eda14cbcSMatt Macy	fi
292eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
293eda14cbcSMatt Macy	AC_SUBST(PYTHON_EXTRA_LIBS)
294eda14cbcSMatt Macy
295eda14cbcSMatt Macy	#
296eda14cbcSMatt Macy	# linking flags needed when embedding
297eda14cbcSMatt Macy	#
298eda14cbcSMatt Macy	AC_MSG_CHECKING(python extra linking flags)
299eda14cbcSMatt Macy	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
300bb2d13b6SMartin Matuska		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import sysconfig; \
301bb2d13b6SMartin Matuska			conf = sysconfig.get_config_var; \
302eda14cbcSMatt Macy			print (conf('LINKFORSHARED'))"`
303eda14cbcSMatt Macy	fi
304eda14cbcSMatt Macy	AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
305eda14cbcSMatt Macy	AC_SUBST(PYTHON_EXTRA_LDFLAGS)
306eda14cbcSMatt Macy
307eda14cbcSMatt Macy	#
308eda14cbcSMatt Macy	# final check to see if everything compiles alright
309eda14cbcSMatt Macy	#
310eda14cbcSMatt Macy	AC_MSG_CHECKING([consistency of all components of python development environment])
311eda14cbcSMatt Macy	# save current global flags
312eda14cbcSMatt Macy	ac_save_LIBS="$LIBS"
313eda14cbcSMatt Macy	ac_save_LDFLAGS="$LDFLAGS"
314eda14cbcSMatt Macy	ac_save_CPPFLAGS="$CPPFLAGS"
315eda14cbcSMatt Macy	LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS"
316eda14cbcSMatt Macy	LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
317eda14cbcSMatt Macy	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
318eda14cbcSMatt Macy	AC_LANG_PUSH([C])
319eda14cbcSMatt Macy	AC_LINK_IFELSE([
320eda14cbcSMatt Macy		AC_LANG_PROGRAM([[#include <Python.h>]],
321eda14cbcSMatt Macy				[[Py_Initialize();]])
322eda14cbcSMatt Macy		],[pythonexists=yes],[pythonexists=no])
323eda14cbcSMatt Macy	AC_LANG_POP([C])
324eda14cbcSMatt Macy	# turn back to default flags
325eda14cbcSMatt Macy	CPPFLAGS="$ac_save_CPPFLAGS"
326eda14cbcSMatt Macy	LIBS="$ac_save_LIBS"
327eda14cbcSMatt Macy	LDFLAGS="$ac_save_LDFLAGS"
328eda14cbcSMatt Macy
329eda14cbcSMatt Macy	AC_MSG_RESULT([$pythonexists])
330eda14cbcSMatt Macy
331eda14cbcSMatt Macy        if test ! "x$pythonexists" = "xyes"; then
332eda14cbcSMatt Macy		m4_ifvaln([$2],[$2],[
333eda14cbcSMatt Macy			AC_MSG_FAILURE([
334eda14cbcSMatt Macy  Could not link test program to Python. Maybe the main Python library has been
335eda14cbcSMatt Macy  installed in some non-standard library path. If so, pass it to configure,
336eda14cbcSMatt Macy  via the LIBS environment variable.
337eda14cbcSMatt Macy  Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
338eda14cbcSMatt Macy  ============================================================================
339eda14cbcSMatt Macy   ERROR!
340eda14cbcSMatt Macy   You probably have to install the development version of the Python package
341eda14cbcSMatt Macy   for your distribution.  The exact name of this package varies among them.
342eda14cbcSMatt Macy  ============================================================================
343eda14cbcSMatt Macy	   ])
344eda14cbcSMatt Macy			PYTHON_VERSION=""
345eda14cbcSMatt Macy		])
346eda14cbcSMatt Macy	fi
347eda14cbcSMatt Macy
348eda14cbcSMatt Macy	#
349eda14cbcSMatt Macy	# all done!
350eda14cbcSMatt Macy	#
351eda14cbcSMatt Macy])
352