summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml1
-rw-r--r--m4/ax_python_devel.m4361
2 files changed, 252 insertions, 110 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e37201c..4ee5f77 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -155,6 +155,7 @@ jobs:
155 PYTHON_EXEC_PREFIX=`$PYTHON3_BIN -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('exec_prefix'))"` 155 PYTHON_EXEC_PREFIX=`$PYTHON3_BIN -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('exec_prefix'))"`
156 PYTHON_LIBS_PATH=$PYTHON_EXEC_PREFIX/lib 156 PYTHON_LIBS_PATH=$PYTHON_EXEC_PREFIX/lib
157 PYTHON_FRAMEWORK_PATH=$PYTHON_EXEC_PREFIX/Python3 157 PYTHON_FRAMEWORK_PATH=$PYTHON_EXEC_PREFIX/Python3
158 export PYTHON_CPPFLAGS="-I$PYTHON_EXEC_PREFIX/Headers"
158 export PYTHON_LIBS="-L$PYTHON_LIBS_PATH -lpython$PYTHON_VER" 159 export PYTHON_LIBS="-L$PYTHON_LIBS_PATH -lpython$PYTHON_VER"
159 export PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation $PYTHON_FRAMEWORK_PATH" 160 export PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation $PYTHON_FRAMEWORK_PATH"
160 fi 161 fi
diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4
index 44dbd83..935056c 100644
--- a/m4/ax_python_devel.m4
+++ b/m4/ax_python_devel.m4
@@ -4,7 +4,7 @@
4# 4#
5# SYNOPSIS 5# SYNOPSIS
6# 6#
7# AX_PYTHON_DEVEL([version]) 7# AX_PYTHON_DEVEL([version[,optional]])
8# 8#
9# DESCRIPTION 9# DESCRIPTION
10# 10#
@@ -23,6 +23,11 @@
23# version number. Don't use "PYTHON_VERSION" for this: that environment 23# version number. Don't use "PYTHON_VERSION" for this: that environment
24# variable is declared as precious and thus reserved for the end-user. 24# variable is declared as precious and thus reserved for the end-user.
25# 25#
26# By default this will fail if it does not detect a development version of
27# python. If you want it to continue, set optional to true, like
28# AX_PYTHON_DEVEL([], [true]). The ax_python_devel_found variable will be
29# "no" if it fails.
30#
26# This macro should work for all versions of Python >= 2.1.0. As an end 31# This macro should work for all versions of Python >= 2.1.0. As an end
27# user, you can disable the check for the python version by setting the 32# user, you can disable the check for the python version by setting the
28# PYTHON_NOVERSIONCHECK environment variable to something else than the 33# PYTHON_NOVERSIONCHECK environment variable to something else than the
@@ -67,10 +72,18 @@
67# modified version of the Autoconf Macro, you may extend this special 72# modified version of the Autoconf Macro, you may extend this special
68# exception to the GPL to apply to your modified version as well. 73# exception to the GPL to apply to your modified version as well.
69 74
70#serial 21 75#serial 37
71 76
72AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) 77AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
73AC_DEFUN([AX_PYTHON_DEVEL],[ 78AC_DEFUN([AX_PYTHON_DEVEL],[
79 # Get whether it's optional
80 if test -z "$2"; then
81 ax_python_devel_optional=false
82 else
83 ax_python_devel_optional=$2
84 fi
85 ax_python_devel_found=yes
86
74 # 87 #
75 # Allow the use of a (user set) custom python version 88 # Allow the use of a (user set) custom python version
76 # 89 #
@@ -81,21 +94,26 @@ AC_DEFUN([AX_PYTHON_DEVEL],[
81 94
82 AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) 95 AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
83 if test -z "$PYTHON"; then 96 if test -z "$PYTHON"; then
84 AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) 97 AC_MSG_WARN([Cannot find python$PYTHON_VERSION in your system path])
98 if ! $ax_python_devel_optional; then
99 AC_MSG_ERROR([Giving up, python development not available])
100 fi
101 ax_python_devel_found=no
85 PYTHON_VERSION="" 102 PYTHON_VERSION=""
86 fi 103 fi
87 104
88 # 105 if test $ax_python_devel_found = yes; then
89 # Check for a version of Python >= 2.1.0 106 #
90 # 107 # Check for a version of Python >= 2.1.0
91 AC_MSG_CHECKING([for a version of Python >= '2.1.0']) 108 #
92 ac_supports_python_ver=`$PYTHON -c "import sys; \ 109 AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
110 ac_supports_python_ver=`$PYTHON -c "import sys; \
93 ver = sys.version.split ()[[0]]; \ 111 ver = sys.version.split ()[[0]]; \
94 print (ver >= '2.1.0')"` 112 print (ver >= '2.1.0')"`
95 if test "$ac_supports_python_ver" != "True"; then 113 if test "$ac_supports_python_ver" != "True"; then
96 if test -z "$PYTHON_NOVERSIONCHECK"; then 114 if test -z "$PYTHON_NOVERSIONCHECK"; then
97 AC_MSG_RESULT([no]) 115 AC_MSG_RESULT([no])
98 AC_MSG_FAILURE([ 116 AC_MSG_WARN([
99This version of the AC@&t@_PYTHON_DEVEL macro 117This version of the AC@&t@_PYTHON_DEVEL macro
100doesn't work properly with versions of Python before 118doesn't work properly with versions of Python before
1012.1.0. You may need to re-run configure, setting the 1192.1.0. You may need to re-run configure, setting the
@@ -104,58 +122,119 @@ PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
104Moreover, to disable this check, set PYTHON_NOVERSIONCHECK 122Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
105to something else than an empty string. 123to something else than an empty string.
106]) 124])
125 if ! $ax_python_devel_optional; then
126 AC_MSG_FAILURE([Giving up])
127 fi
128 ax_python_devel_found=no
129 PYTHON_VERSION=""
107 else 130 else
108 AC_MSG_RESULT([skip at user request]) 131 AC_MSG_RESULT([skip at user request])
109 fi 132 fi
110 else 133 else
111 AC_MSG_RESULT([yes]) 134 AC_MSG_RESULT([yes])
135 fi
112 fi 136 fi
113 137
114 # 138 if test $ax_python_devel_found = yes; then
115 # if the macro parameter ``version'' is set, honour it 139 #
116 # 140 # If the macro parameter ``version'' is set, honour it.
117 if test -n "$1"; then 141 # A Python shim class, VPy, is used to implement correct version comparisons via
142 # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for
143 # Python 2.7.10 (the ".1" being evaluated as less than ".3").
144 #
145 if test -n "$1"; then
118 AC_MSG_CHECKING([for a version of Python $1]) 146 AC_MSG_CHECKING([for a version of Python $1])
119 ac_supports_python_ver=`$PYTHON -c "import sys; \ 147 cat << EOF > ax_python_devel_vpy.py
120 ver = sys.version.split ()[[0]]; \ 148class VPy:
149 def vtup(self, s):
150 return tuple(map(int, s.strip().replace("rc", ".").split(".")))
151 def __init__(self):
152 import sys
153 self.vpy = tuple(sys.version_info)[[:3]]
154 def __eq__(self, s):
155 return self.vpy == self.vtup(s)
156 def __ne__(self, s):
157 return self.vpy != self.vtup(s)
158 def __lt__(self, s):
159 return self.vpy < self.vtup(s)
160 def __gt__(self, s):
161 return self.vpy > self.vtup(s)
162 def __le__(self, s):
163 return self.vpy <= self.vtup(s)
164 def __ge__(self, s):
165 return self.vpy >= self.vtup(s)
166EOF
167 ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \
168 ver = ax_python_devel_vpy.VPy(); \
121 print (ver $1)"` 169 print (ver $1)"`
170 rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py*
122 if test "$ac_supports_python_ver" = "True"; then 171 if test "$ac_supports_python_ver" = "True"; then
123 AC_MSG_RESULT([yes]) 172 AC_MSG_RESULT([yes])
124 else 173 else
125 AC_MSG_RESULT([no]) 174 AC_MSG_RESULT([no])
126 AC_MSG_ERROR([this package requires Python $1. 175 AC_MSG_WARN([this package requires Python $1.
127If you have it installed, but it isn't the default Python 176If you have it installed, but it isn't the default Python
128interpreter in your system path, please pass the PYTHON_VERSION 177interpreter in your system path, please pass the PYTHON_VERSION
129variable to configure. See ``configure --help'' for reference. 178variable to configure. See ``configure --help'' for reference.
130]) 179])
180 if ! $ax_python_devel_optional; then
181 AC_MSG_ERROR([Giving up])
182 fi
183 ax_python_devel_found=no
131 PYTHON_VERSION="" 184 PYTHON_VERSION=""
132 fi 185 fi
186 fi
133 fi 187 fi
134 188
135 # 189 if test $ax_python_devel_found = yes; then
136 # Check if you have distutils, else fail 190 #
137 # 191 # Check if you have distutils, else fail
138 AC_MSG_CHECKING([for the distutils Python package]) 192 #
139 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` 193 AC_MSG_CHECKING([for the sysconfig Python package])
140 if test $? -eq 0; then 194 ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1`
195 if test $? -eq 0; then
141 AC_MSG_RESULT([yes]) 196 AC_MSG_RESULT([yes])
142 else 197 IMPORT_SYSCONFIG="import sysconfig"
198 else
143 AC_MSG_RESULT([no]) 199 AC_MSG_RESULT([no])
144 AC_MSG_ERROR([cannot import Python module "distutils". 200
201 AC_MSG_CHECKING([for the distutils Python package])
202 ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1`
203 if test $? -eq 0; then
204 AC_MSG_RESULT([yes])
205 IMPORT_SYSCONFIG="from distutils import sysconfig"
206 else
207 AC_MSG_WARN([cannot import Python module "distutils".
145Please check your Python installation. The error was: 208Please check your Python installation. The error was:
146$ac_distutils_result]) 209$ac_sysconfig_result])
147 PYTHON_VERSION="" 210 if ! $ax_python_devel_optional; then
211 AC_MSG_ERROR([Giving up])
212 fi
213 ax_python_devel_found=no
214 PYTHON_VERSION=""
215 fi
216 fi
148 fi 217 fi
149 218
150 # 219 if test $ax_python_devel_found = yes; then
151 # Check for Python include path 220 #
152 # 221 # Check for Python include path
153 AC_MSG_CHECKING([for Python include path]) 222 #
154 if test -z "$PYTHON_CPPFLAGS"; then 223 AC_MSG_CHECKING([for Python include path])
155 python_path=`$PYTHON -c "import distutils.sysconfig; \ 224 if test -z "$PYTHON_CPPFLAGS"; then
156 print (distutils.sysconfig.get_python_inc ());"` 225 if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
157 plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ 226 # sysconfig module has different functions
158 print (distutils.sysconfig.get_python_inc (plat_specific=1));"` 227 python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
228 print (sysconfig.get_path ('include'));"`
229 plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
230 print (sysconfig.get_path ('platinclude'));"`
231 else
232 # old distutils way
233 python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
234 print (sysconfig.get_python_inc ());"`
235 plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
236 print (sysconfig.get_python_inc (plat_specific=1));"`
237 fi
159 if test -n "${python_path}"; then 238 if test -n "${python_path}"; then
160 if test "${plat_python_path}" != "${python_path}"; then 239 if test "${plat_python_path}" != "${python_path}"; then
161 python_path="-I$python_path -I$plat_python_path" 240 python_path="-I$python_path -I$plat_python_path"
@@ -164,22 +243,22 @@ $ac_distutils_result])
164 fi 243 fi
165 fi 244 fi
166 PYTHON_CPPFLAGS=$python_path 245 PYTHON_CPPFLAGS=$python_path
167 fi 246 fi
168 AC_MSG_RESULT([$PYTHON_CPPFLAGS]) 247 AC_MSG_RESULT([$PYTHON_CPPFLAGS])
169 AC_SUBST([PYTHON_CPPFLAGS]) 248 AC_SUBST([PYTHON_CPPFLAGS])
170 249
171 # 250 #
172 # Check for Python library path 251 # Check for Python library path
173 # 252 #
174 AC_MSG_CHECKING([for Python library path]) 253 AC_MSG_CHECKING([for Python library path])
175 if test -z "$PYTHON_LIBS"; then 254 if test -z "$PYTHON_LIBS"; then
176 # (makes two attempts to ensure we've got a version number 255 # (makes two attempts to ensure we've got a version number
177 # from the interpreter) 256 # from the interpreter)
178 ac_python_version=`cat<<EOD | $PYTHON - 257 ac_python_version=`cat<<EOD | $PYTHON -
179 258
180# join all versioning strings, on some systems 259# join all versioning strings, on some systems
181# major/minor numbers could be in different list elements 260# major/minor numbers could be in different list elements
182from distutils.sysconfig import * 261from sysconfig import *
183e = get_config_var('VERSION') 262e = get_config_var('VERSION')
184if e is not None: 263if e is not None:
185 print(e) 264 print(e)
@@ -190,7 +269,7 @@ EOD`
190 ac_python_version=$PYTHON_VERSION 269 ac_python_version=$PYTHON_VERSION
191 else 270 else
192 ac_python_version=`$PYTHON -c "import sys; \ 271 ac_python_version=`$PYTHON -c "import sys; \
193 print (sys.version[[:3]])"` 272 print ("%d.%d" % sys.version_info[[:2]])"`
194 fi 273 fi
195 fi 274 fi
196 275
@@ -202,8 +281,8 @@ EOD`
202 ac_python_libdir=`cat<<EOD | $PYTHON - 281 ac_python_libdir=`cat<<EOD | $PYTHON -
203 282
204# There should be only one 283# There should be only one
205import distutils.sysconfig 284$IMPORT_SYSCONFIG
206e = distutils.sysconfig.get_config_var('LIBDIR') 285e = sysconfig.get_config_var('LIBDIR')
207if e is not None: 286if e is not None:
208 print (e) 287 print (e)
209EOD` 288EOD`
@@ -211,8 +290,8 @@ EOD`
211 # Now, for the library: 290 # Now, for the library:
212 ac_python_library=`cat<<EOD | $PYTHON - 291 ac_python_library=`cat<<EOD | $PYTHON -
213 292
214import distutils.sysconfig 293$IMPORT_SYSCONFIG
215c = distutils.sysconfig.get_config_vars() 294c = sysconfig.get_config_vars()
216if 'LDVERSION' in c: 295if 'LDVERSION' in c:
217 print ('python'+c[['LDVERSION']]) 296 print ('python'+c[['LDVERSION']])
218else: 297else:
@@ -231,83 +310,140 @@ EOD`
231 else 310 else
232 # old way: use libpython from python_configdir 311 # old way: use libpython from python_configdir
233 ac_python_libdir=`$PYTHON -c \ 312 ac_python_libdir=`$PYTHON -c \
234 "from distutils.sysconfig import get_python_lib as f; \ 313 "from sysconfig import get_python_lib as f; \
235 import os; \ 314 import os; \
236 print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` 315 print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
237 PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version" 316 PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
238 fi 317 fi
239 318
240 if test -z "PYTHON_LIBS"; then 319 if test -z "$PYTHON_LIBS"; then
241 AC_MSG_ERROR([ 320 AC_MSG_WARN([
242 Cannot determine location of your Python DSO. Please check it was installed with 321 Cannot determine location of your Python DSO. Please check it was installed with
243 dynamic libraries enabled, or try setting PYTHON_LIBS by hand. 322 dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
244 ]) 323 ])
324 if ! $ax_python_devel_optional; then
325 AC_MSG_ERROR([Giving up])
326 fi
327 ax_python_devel_found=no
328 PYTHON_VERSION=""
245 fi 329 fi
330 fi
246 fi 331 fi
247 AC_MSG_RESULT([$PYTHON_LIBS])
248 AC_SUBST([PYTHON_LIBS])
249 332
250 # 333 if test $ax_python_devel_found = yes; then
251 # Check for site packages 334 AC_MSG_RESULT([$PYTHON_LIBS])
252 # 335 AC_SUBST([PYTHON_LIBS])
253 AC_MSG_CHECKING([for Python site-packages path])
254 if test -z "$PYTHON_SITE_PKG"; then
255 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
256 print (distutils.sysconfig.get_python_lib(0,0));"`
257 fi
258 AC_MSG_RESULT([$PYTHON_SITE_PKG])
259 AC_SUBST([PYTHON_SITE_PKG])
260 336
261 # 337 #
262 # libraries which must be linked in when embedding 338 # Check for site packages
263 # 339 #
264 AC_MSG_CHECKING(python extra libraries) 340 AC_MSG_CHECKING([for Python site-packages path])
265 if test -z "$PYTHON_EXTRA_LIBS"; then 341 if test -z "$PYTHON_SITE_PKG"; then
266 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ 342 if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
267 conf = distutils.sysconfig.get_config_var; \ 343 PYTHON_SITE_PKG=`$PYTHON -c "
344$IMPORT_SYSCONFIG;
345if hasattr(sysconfig, 'get_default_scheme'):
346 scheme = sysconfig.get_default_scheme()
347else:
348 scheme = sysconfig._get_default_scheme()
349if scheme == 'posix_local':
350 # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
351 scheme = 'posix_prefix'
352prefix = '$prefix'
353if prefix == 'NONE':
354 prefix = '$ac_default_prefix'
355sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix})
356print(sitedir)"`
357 else
358 # distutils.sysconfig way
359 PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
360 print (sysconfig.get_python_lib(0,0));"`
361 fi
362 fi
363 AC_MSG_RESULT([$PYTHON_SITE_PKG])
364 AC_SUBST([PYTHON_SITE_PKG])
365
366 #
367 # Check for platform-specific site packages
368 #
369 AC_MSG_CHECKING([for Python platform specific site-packages path])
370 if test -z "$PYTHON_PLATFORM_SITE_PKG"; then
371 if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
372 PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "
373$IMPORT_SYSCONFIG;
374if hasattr(sysconfig, 'get_default_scheme'):
375 scheme = sysconfig.get_default_scheme()
376else:
377 scheme = sysconfig._get_default_scheme()
378if scheme == 'posix_local':
379 # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
380 scheme = 'posix_prefix'
381prefix = '$prefix'
382if prefix == 'NONE':
383 prefix = '$ac_default_prefix'
384sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix})
385print(sitedir)"`
386 else
387 # distutils.sysconfig way
388 PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
389 print (sysconfig.get_python_lib(1,0));"`
390 fi
391 fi
392 AC_MSG_RESULT([$PYTHON_PLATFORM_SITE_PKG])
393 AC_SUBST([PYTHON_PLATFORM_SITE_PKG])
394
395 #
396 # libraries which must be linked in when embedding
397 #
398 AC_MSG_CHECKING(python extra libraries)
399 if test -z "$PYTHON_EXTRA_LIBS"; then
400 PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
401 conf = sysconfig.get_config_var; \
268 print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` 402 print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
269 fi 403 fi
270 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) 404 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
271 AC_SUBST(PYTHON_EXTRA_LIBS) 405 AC_SUBST(PYTHON_EXTRA_LIBS)
272 406
273 # 407 #
274 # linking flags needed when embedding 408 # linking flags needed when embedding
275 # 409 #
276 AC_MSG_CHECKING(python extra linking flags) 410 AC_MSG_CHECKING(python extra linking flags)
277 if test -z "$PYTHON_EXTRA_LDFLAGS"; then 411 if test -z "$PYTHON_EXTRA_LDFLAGS"; then
278 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ 412 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
279 conf = distutils.sysconfig.get_config_var; \ 413 conf = sysconfig.get_config_var; \
280 print (conf('LINKFORSHARED'))"` 414 print (conf('LINKFORSHARED'))"`
281 fi 415 # Hack for macos, it sticks this in here.
282 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) 416 PYTHON_EXTRA_LDFLAGS=`echo $PYTHON_EXTRA_LDFLAGS | sed 's/CoreFoundation.*$/CoreFoundation/'`
283 AC_SUBST(PYTHON_EXTRA_LDFLAGS) 417 fi
418 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
419 AC_SUBST(PYTHON_EXTRA_LDFLAGS)
284 420
285 # 421 #
286 # final check to see if everything compiles alright 422 # final check to see if everything compiles alright
287 # 423 #
288 AC_MSG_CHECKING([consistency of all components of python development environment]) 424 AC_MSG_CHECKING([consistency of all components of python development environment])
289 # save current global flags 425 # save current global flags
290 ac_save_LIBS="$LIBS" 426 ac_save_LIBS="$LIBS"
291 ac_save_LDFLAGS="$LDFLAGS" 427 ac_save_LDFLAGS="$LDFLAGS"
292 ac_save_CPPFLAGS="$CPPFLAGS" 428 ac_save_CPPFLAGS="$CPPFLAGS"
293 LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS" 429 LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS"
294 LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS" 430 LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
295 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" 431 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
296 AC_LANG_PUSH([C]) 432 AC_LANG_PUSH([C])
297 AC_LINK_IFELSE([ 433 AC_LINK_IFELSE([
298 AC_LANG_PROGRAM([[#include <Python.h>]], 434 AC_LANG_PROGRAM([[#include <Python.h>]],
299 [[Py_Initialize();]]) 435 [[Py_Initialize();]])
300 ],[pythonexists=yes],[pythonexists=no]) 436 ],[pythonexists=yes],[pythonexists=no])
301 AC_LANG_POP([C]) 437 AC_LANG_POP([C])
302 # turn back to default flags 438 # turn back to default flags
303 CPPFLAGS="$ac_save_CPPFLAGS" 439 CPPFLAGS="$ac_save_CPPFLAGS"
304 LIBS="$ac_save_LIBS" 440 LIBS="$ac_save_LIBS"
305 LDFLAGS="$ac_save_LDFLAGS" 441 LDFLAGS="$ac_save_LDFLAGS"
306 442
307 AC_MSG_RESULT([$pythonexists]) 443 AC_MSG_RESULT([$pythonexists])
308 444
309 if test ! "x$pythonexists" = "xyes"; then 445 if test ! "x$pythonexists" = "xyes"; then
310 AC_MSG_FAILURE([ 446 AC_MSG_WARN([
311 Could not link test program to Python. Maybe the main Python library has been 447 Could not link test program to Python. Maybe the main Python library has been
312 installed in some non-standard library path. If so, pass it to configure, 448 installed in some non-standard library path. If so, pass it to configure,
313 via the LIBS environment variable. 449 via the LIBS environment variable.
@@ -317,8 +453,13 @@ EOD`
317 You probably have to install the development version of the Python package 453 You probably have to install the development version of the Python package
318 for your distribution. The exact name of this package varies among them. 454 for your distribution. The exact name of this package varies among them.
319 ============================================================================ 455 ============================================================================
320 ]) 456 ])
321 PYTHON_VERSION="" 457 if ! $ax_python_devel_optional; then
458 AC_MSG_ERROR([Giving up])
459 fi
460 ax_python_devel_found=no
461 PYTHON_VERSION=""
462 fi
322 fi 463 fi
323 464
324 # 465 #