Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 647 lines 22 kB view raw
1diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am 2--- a/lang/python/Makefile.am 3+++ b/lang/python/Makefile.am 4@@ -34,8 +34,8 @@ 5 .PHONY: prepare 6 prepare: copystamp 7 8-# For VPATH builds we need to copy some files because Python's 9-# distutils are not VPATH-aware. 10+# For VPATH builds we need to copy some files because Python 11+# is not VPATH-aware. 12 copystamp: 13 ln -sf "$(top_srcdir)/src/data.h" . 14 ln -sf "$(top_builddir)/conf/config.h" . 15@@ -48,7 +48,7 @@ 16 CFLAGS="$(CFLAGS)" \ 17 srcdir="$(srcdir)" \ 18 top_builddir="$(top_builddir)" \ 19- $$PYTHON setup.py build --verbose --build-base="$$(basename "$${PYTHON}")-gpg" ; \ 20+ $$PYTHON -m pip --verbose install --no-index --no-build-isolation --root="$$(basename "$${PYTHON}")-gpg" ${srcdir} ; \ 21 done 22 23 python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp 24@@ -57,8 +57,7 @@ 25 CFLAGS="$(CFLAGS)" \ 26 srcdir="$(srcdir)" \ 27 top_builddir="$(top_builddir)" \ 28- $(PYTHON) setup.py sdist --verbose --dist-dir=python$(PYTHON_VERSION)-gpg-dist \ 29- --manifest=python$(PYTHON_VERSION)-gpg-dist/MANIFEST 30+ $(PYTHON) -m build --sdist --outdir=python$(PYTHON_VERSION)-gpg-dist 31 gpgbin=gpgconf --list-components | grep OpenPGP | sed -e 's/gpg:OpenPGP://g' 32 $(gpgbin) --detach-sign --armor python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz 33 34@@ -92,17 +91,16 @@ 35 CFLAGS="$(CFLAGS)" \ 36 srcdir="$(srcdir)" \ 37 top_builddir="$(top_builddir)" \ 38- $$PYTHON setup.py \ 39- build \ 40- --build-base="$$(basename "$${PYTHON}")-gpg" \ 41+ $$PYTHON -m pip --verbose \ 42 install \ 43+ --no-index --no-build-isolation \ 44 --prefix "$(DESTDIR)$(prefix)" \ 45- --verbose ; \ 46+ ${srcdir} ; \ 47 done 48 49 uninstall-local: 50 set -x; GV=$$(echo $(VERSION) | tr - _); for PYTHON in $(PYTHONS); do \ 51 PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib", scheme="posix_prefix"), sysconfig.get_config_var("prefix")))')" ; \ 52 rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \ 53- "$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info ; \ 54+ "$(DESTDIR)$${PLATLIB}"/gpg-$$GV.dist-info ; \ 55 done 56diff --git a/lang/python/doc/src/gpgme-python-howto.org b/lang/python/doc/src/gpgme-python-howto.org 57--- a/lang/python/doc/src/gpgme-python-howto.org 58+++ b/lang/python/doc/src/gpgme-python-howto.org 59@@ -2945,7 +2945,7 @@ 60 =setup.py= file which contains this: 61 62 #+BEGIN_SRC python -i 63-from distutils.core import setup 64+from setuptools import setup 65 from Cython.Build import cythonize 66 67 setup( 68diff --git a/lang/python/examples/howto/advanced/cython/setup.py b/lang/python/examples/howto/advanced/cython/setup.py 69--- a/lang/python/examples/howto/advanced/cython/setup.py 70+++ b/lang/python/examples/howto/advanced/cython/setup.py 71@@ -1,4 +1,4 @@ 72-from distutils.core import setup 73+from setuptools import setup 74 from Cython.Build import cythonize 75 76 setup( 77diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in 78--- a/lang/python/setup.py.in 79+++ b/lang/python/setup.py.in 80@@ -18,8 +18,8 @@ 81 # License along with this library; if not, write to the Free Software 82 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 83 84-from distutils.core import setup, Extension 85-from distutils.command.build import build 86+from setuptools import setup, Extension 87+from setuptools.command.build import build 88 89 import glob 90 import os 91@@ -225,9 +225,8 @@ 92 build.run(self) 93 94 95-py3 = [] if sys.version_info.major < 3 else ['-py3'] 96 swig_sources = [] 97-swig_opts = ['-threads'] + py3 + extra_swig_opts 98+swig_opts = ['-threads'] + extra_swig_opts 99 swige = Extension( 100 'gpg._gpgme', 101 sources=swig_sources, 102diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 103--- a/m4/ax_python_devel.m4 104+++ b/m4/ax_python_devel.m4 105@@ -1,10 +1,10 @@ 106 # =========================================================================== 107-# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html 108+# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html 109 # =========================================================================== 110 # 111 # SYNOPSIS 112 # 113-# AX_PYTHON_DEVEL([version]) 114+# AX_PYTHON_DEVEL([version[,optional]]) 115 # 116 # DESCRIPTION 117 # 118@@ -12,8 +12,8 @@ 119 # in your configure.ac. 120 # 121 # This macro checks for Python and tries to get the include path to 122-# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) 123-# output variables. It also exports $(PYTHON_EXTRA_LIBS) and 124+# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output 125+# variables. It also exports $(PYTHON_EXTRA_LIBS) and 126 # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. 127 # 128 # You can search for some particular version of Python by passing a 129@@ -23,6 +23,11 @@ 130 # version number. Don't use "PYTHON_VERSION" for this: that environment 131 # variable is declared as precious and thus reserved for the end-user. 132 # 133+# By default this will fail if it does not detect a development version of 134+# python. If you want it to continue, set optional to true, like 135+# AX_PYTHON_DEVEL([], [true]). The ax_python_devel_found variable will be 136+# "no" if it fails. 137+# 138 # This macro should work for all versions of Python >= 2.1.0. As an end 139 # user, you can disable the check for the python version by setting the 140 # PYTHON_NOVERSIONCHECK environment variable to something else than the 141@@ -67,10 +72,18 @@ 142 # modified version of the Autoconf Macro, you may extend this special 143 # exception to the GPL to apply to your modified version as well. 144 145-#serial 17 146+#serial 36 147 148 AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) 149 AC_DEFUN([AX_PYTHON_DEVEL],[ 150+ # Get whether it's optional 151+ if test -z "$2"; then 152+ ax_python_devel_optional=false 153+ else 154+ ax_python_devel_optional=$2 155+ fi 156+ ax_python_devel_found=yes 157+ 158 # 159 # Allow the use of a (user set) custom python version 160 # 161@@ -81,81 +94,147 @@ 162 163 AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) 164 if test -z "$PYTHON"; then 165- AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) 166+ AC_MSG_WARN([Cannot find python$PYTHON_VERSION in your system path]) 167+ if ! $ax_python_devel_optional; then 168+ AC_MSG_ERROR([Giving up, python development not available]) 169+ fi 170+ ax_python_devel_found=no 171 PYTHON_VERSION="" 172 fi 173 174- # 175- # Check for a version of Python >= 2.1.0 176- # 177- AC_MSG_CHECKING([for a version of Python >= '2.1.0']) 178- ac_supports_python_ver=`$PYTHON -c "import sys; \ 179+ if test $ax_python_devel_found = yes; then 180+ # 181+ # Check for a version of Python >= 2.1.0 182+ # 183+ AC_MSG_CHECKING([for a version of Python >= '2.1.0']) 184+ ac_supports_python_ver=`$PYTHON -c "import sys; \ 185 ver = sys.version.split ()[[0]]; \ 186 print (ver >= '2.1.0')"` 187- if test "$ac_supports_python_ver" != "True"; then 188+ if test "$ac_supports_python_ver" != "True"; then 189 if test -z "$PYTHON_NOVERSIONCHECK"; then 190 AC_MSG_RESULT([no]) 191- AC_MSG_FAILURE([ 192+ AC_MSG_WARN([ 193 This version of the AC@&t@_PYTHON_DEVEL macro 194 doesn't work properly with versions of Python before 195 2.1.0. You may need to re-run configure, setting the 196-variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, 197+variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, 198 PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. 199 Moreover, to disable this check, set PYTHON_NOVERSIONCHECK 200 to something else than an empty string. 201 ]) 202+ if ! $ax_python_devel_optional; then 203+ AC_MSG_FAILURE([Giving up]) 204+ fi 205+ ax_python_devel_found=no 206+ PYTHON_VERSION="" 207 else 208 AC_MSG_RESULT([skip at user request]) 209 fi 210- else 211+ else 212 AC_MSG_RESULT([yes]) 213+ fi 214 fi 215 216- # 217- # if the macro parameter ``version'' is set, honour it 218- # 219- if test -n "$1"; then 220+ if test $ax_python_devel_found = yes; then 221+ # 222+ # If the macro parameter ``version'' is set, honour it. 223+ # A Python shim class, VPy, is used to implement correct version comparisons via 224+ # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for 225+ # Python 2.7.10 (the ".1" being evaluated as less than ".3"). 226+ # 227+ if test -n "$1"; then 228 AC_MSG_CHECKING([for a version of Python $1]) 229- ac_supports_python_ver=`$PYTHON -c "import sys; \ 230- ver = sys.version.split ()[[0]]; \ 231+ cat << EOF > ax_python_devel_vpy.py 232+class VPy: 233+ def vtup(self, s): 234+ return tuple(map(int, s.strip().replace("rc", ".").split("."))) 235+ def __init__(self): 236+ import sys 237+ self.vpy = tuple(sys.version_info)[[:3]] 238+ def __eq__(self, s): 239+ return self.vpy == self.vtup(s) 240+ def __ne__(self, s): 241+ return self.vpy != self.vtup(s) 242+ def __lt__(self, s): 243+ return self.vpy < self.vtup(s) 244+ def __gt__(self, s): 245+ return self.vpy > self.vtup(s) 246+ def __le__(self, s): 247+ return self.vpy <= self.vtup(s) 248+ def __ge__(self, s): 249+ return self.vpy >= self.vtup(s) 250+EOF 251+ ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \ 252+ ver = ax_python_devel_vpy.VPy(); \ 253 print (ver $1)"` 254+ rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py* 255 if test "$ac_supports_python_ver" = "True"; then 256- AC_MSG_RESULT([yes]) 257+ AC_MSG_RESULT([yes]) 258 else 259 AC_MSG_RESULT([no]) 260- AC_MSG_ERROR([this package requires Python $1. 261+ AC_MSG_WARN([this package requires Python $1. 262 If you have it installed, but it isn't the default Python 263 interpreter in your system path, please pass the PYTHON_VERSION 264 variable to configure. See ``configure --help'' for reference. 265 ]) 266+ if ! $ax_python_devel_optional; then 267+ AC_MSG_ERROR([Giving up]) 268+ fi 269+ ax_python_devel_found=no 270 PYTHON_VERSION="" 271 fi 272+ fi 273 fi 274 275- # 276- # Check if you have distutils, else fail 277- # 278- AC_MSG_CHECKING([for the distutils Python package]) 279- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` 280- if test -z "$ac_distutils_result"; then 281+ if test $ax_python_devel_found = yes; then 282+ # 283+ # Check if you have distutils, else fail 284+ # 285+ AC_MSG_CHECKING([for the sysconfig Python package]) 286+ ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1` 287+ if test $? -eq 0; then 288 AC_MSG_RESULT([yes]) 289- else 290+ IMPORT_SYSCONFIG="import sysconfig" 291+ else 292 AC_MSG_RESULT([no]) 293- AC_MSG_ERROR([cannot import Python module "distutils". 294+ 295+ AC_MSG_CHECKING([for the distutils Python package]) 296+ ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1` 297+ if test $? -eq 0; then 298+ AC_MSG_RESULT([yes]) 299+ IMPORT_SYSCONFIG="from distutils import sysconfig" 300+ else 301+ AC_MSG_WARN([cannot import Python module "distutils". 302 Please check your Python installation. The error was: 303-$ac_distutils_result]) 304- PYTHON_VERSION="" 305+$ac_sysconfig_result]) 306+ if ! $ax_python_devel_optional; then 307+ AC_MSG_ERROR([Giving up]) 308+ fi 309+ ax_python_devel_found=no 310+ PYTHON_VERSION="" 311+ fi 312+ fi 313 fi 314 315- # 316- # Check for Python include path 317- # 318- AC_MSG_CHECKING([for Python include path]) 319- if test -z "$PYTHON_CPPFLAGS"; then 320- python_path=`$PYTHON -c "import distutils.sysconfig; \ 321- print (distutils.sysconfig.get_python_inc ());"` 322- plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ 323- print (distutils.sysconfig.get_python_inc (plat_specific=1));"` 324+ if test $ax_python_devel_found = yes; then 325+ # 326+ # Check for Python include path 327+ # 328+ AC_MSG_CHECKING([for Python include path]) 329+ if test -z "$PYTHON_CPPFLAGS"; then 330+ if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then 331+ # sysconfig module has different functions 332+ python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 333+ print (sysconfig.get_path ('include'));"` 334+ plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 335+ print (sysconfig.get_path ('platinclude'));"` 336+ else 337+ # old distutils way 338+ python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 339+ print (sysconfig.get_python_inc ());"` 340+ plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 341+ print (sysconfig.get_python_inc (plat_specific=1));"` 342+ fi 343 if test -n "${python_path}"; then 344 if test "${plat_python_path}" != "${python_path}"; then 345 python_path="-I$python_path -I$plat_python_path" 346@@ -164,22 +243,22 @@ 347 fi 348 fi 349 PYTHON_CPPFLAGS=$python_path 350- fi 351- AC_MSG_RESULT([$PYTHON_CPPFLAGS]) 352- AC_SUBST([PYTHON_CPPFLAGS]) 353+ fi 354+ AC_MSG_RESULT([$PYTHON_CPPFLAGS]) 355+ AC_SUBST([PYTHON_CPPFLAGS]) 356 357- # 358- # Check for Python library path 359- # 360- AC_MSG_CHECKING([for Python library path]) 361- if test -z "$PYTHON_LDFLAGS"; then 362+ # 363+ # Check for Python library path 364+ # 365+ AC_MSG_CHECKING([for Python library path]) 366+ if test -z "$PYTHON_LIBS"; then 367 # (makes two attempts to ensure we've got a version number 368 # from the interpreter) 369 ac_python_version=`cat<<EOD | $PYTHON - 370 371 # join all versioning strings, on some systems 372 # major/minor numbers could be in different list elements 373-from distutils.sysconfig import * 374+from sysconfig import * 375 e = get_config_var('VERSION') 376 if e is not None: 377 print(e) 378@@ -190,7 +269,7 @@ 379 ac_python_version=$PYTHON_VERSION 380 else 381 ac_python_version=`$PYTHON -c "import sys; \ 382- print (sys.version[[:3]])"` 383+ print ("%d.%d" % sys.version_info[[:2]])"` 384 fi 385 fi 386 387@@ -205,8 +284,8 @@ 388 ac_python_libdir=`cat<<EOD | $PYTHON - 389 390 # There should be only one 391-import distutils.sysconfig 392-e = distutils.sysconfig.get_config_var('LIBDIR') 393+$IMPORT_SYSCONFIG 394+e = sysconfig.get_config_var('LIBDIR') 395 if e is not None: 396 print (e) 397 EOD` 398@@ -214,8 +293,8 @@ 399 # Now, for the library: 400 ac_python_library=`cat<<EOD | $PYTHON - 401 402-import distutils.sysconfig 403-c = distutils.sysconfig.get_config_vars() 404+$IMPORT_SYSCONFIG 405+c = sysconfig.get_config_vars() 406 if 'LDVERSION' in c: 407 print ('python'+c[['LDVERSION']]) 408 else: 409@@ -230,97 +309,163 @@ 410 then 411 # use the official shared library 412 ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"` 413- PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library" 414+ PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library" 415 else 416 # old way: use libpython from python_configdir 417 ac_python_libdir=`$PYTHON -c \ 418- "from distutils.sysconfig import get_python_lib as f; \ 419+ "from sysconfig import get_python_lib as f; \ 420 import os; \ 421 print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` 422- PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version" 423+ PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version" 424 fi 425 426- if test -z "PYTHON_LDFLAGS"; then 427- AC_MSG_ERROR([ 428+ if test -z "PYTHON_LIBS"; then 429+ AC_MSG_WARN([ 430 Cannot determine location of your Python DSO. Please check it was installed with 431- dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand. 432+ dynamic libraries enabled, or try setting PYTHON_LIBS by hand. 433 ]) 434+ if ! $ax_python_devel_optional; then 435+ AC_MSG_ERROR([Giving up]) 436+ fi 437+ ax_python_devel_found=no 438+ PYTHON_VERSION="" 439 fi 440+ fi 441 fi 442- AC_MSG_RESULT([$PYTHON_LDFLAGS]) 443- AC_SUBST([PYTHON_LDFLAGS]) 444 445- # 446- # Check for site packages 447- # 448- AC_MSG_CHECKING([for Python site-packages path]) 449- if test -z "$PYTHON_SITE_PKG"; then 450- PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ 451- print (distutils.sysconfig.get_python_lib(0,0));"` 452- fi 453- AC_MSG_RESULT([$PYTHON_SITE_PKG]) 454- AC_SUBST([PYTHON_SITE_PKG]) 455+ if test $ax_python_devel_found = yes; then 456+ AC_MSG_RESULT([$PYTHON_LIBS]) 457+ AC_SUBST([PYTHON_LIBS]) 458 459- # 460- # libraries which must be linked in when embedding 461- # 462- AC_MSG_CHECKING(python extra libraries) 463- if test -z "$PYTHON_EXTRA_LIBS"; then 464- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ 465- conf = distutils.sysconfig.get_config_var; \ 466+ # 467+ # Check for site packages 468+ # 469+ AC_MSG_CHECKING([for Python site-packages path]) 470+ if test -z "$PYTHON_SITE_PKG"; then 471+ if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then 472+ PYTHON_SITE_PKG=`$PYTHON -c " 473+$IMPORT_SYSCONFIG; 474+if hasattr(sysconfig, 'get_default_scheme'): 475+ scheme = sysconfig.get_default_scheme() 476+else: 477+ scheme = sysconfig._get_default_scheme() 478+if scheme == 'posix_local': 479+ # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ 480+ scheme = 'posix_prefix' 481+prefix = '$prefix' 482+if prefix == 'NONE': 483+ prefix = '$ac_default_prefix' 484+sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix}) 485+print(sitedir)"` 486+ else 487+ # distutils.sysconfig way 488+ PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 489+ print (sysconfig.get_python_lib(0,0));"` 490+ fi 491+ fi 492+ AC_MSG_RESULT([$PYTHON_SITE_PKG]) 493+ AC_SUBST([PYTHON_SITE_PKG]) 494+ 495+ # 496+ # Check for platform-specific site packages 497+ # 498+ AC_MSG_CHECKING([for Python platform specific site-packages path]) 499+ if test -z "$PYTHON_PLATFORM_SITE_PKG"; then 500+ if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then 501+ PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c " 502+$IMPORT_SYSCONFIG; 503+if hasattr(sysconfig, 'get_default_scheme'): 504+ scheme = sysconfig.get_default_scheme() 505+else: 506+ scheme = sysconfig._get_default_scheme() 507+if scheme == 'posix_local': 508+ # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ 509+ scheme = 'posix_prefix' 510+prefix = '$prefix' 511+if prefix == 'NONE': 512+ prefix = '$ac_default_prefix' 513+sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix}) 514+print(sitedir)"` 515+ else 516+ # distutils.sysconfig way 517+ PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 518+ print (sysconfig.get_python_lib(1,0));"` 519+ fi 520+ fi 521+ AC_MSG_RESULT([$PYTHON_PLATFORM_SITE_PKG]) 522+ AC_SUBST([PYTHON_PLATFORM_SITE_PKG]) 523+ 524+ # 525+ # libraries which must be linked in when embedding 526+ # 527+ AC_MSG_CHECKING(python extra libraries) 528+ if test -z "$PYTHON_EXTRA_LIBS"; then 529+ PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 530+ conf = sysconfig.get_config_var; \ 531 print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` 532- fi 533- AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) 534- AC_SUBST(PYTHON_EXTRA_LIBS) 535+ fi 536+ AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) 537+ AC_SUBST(PYTHON_EXTRA_LIBS) 538 539- # 540- # linking flags needed when embedding 541- # 542- AC_MSG_CHECKING(python extra linking flags) 543- if test -z "$PYTHON_EXTRA_LDFLAGS"; then 544- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ 545- conf = distutils.sysconfig.get_config_var; \ 546+ # 547+ # linking flags needed when embedding 548+ # 549+ AC_MSG_CHECKING(python extra linking flags) 550+ if test -z "$PYTHON_EXTRA_LDFLAGS"; then 551+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ 552+ conf = sysconfig.get_config_var; \ 553 print (conf('LINKFORSHARED'))"` 554- fi 555- AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) 556- AC_SUBST(PYTHON_EXTRA_LDFLAGS) 557+ # Hack for macos, it sticks this in here. 558+ PYTHON_EXTRA_LDFLAGS=`echo $PYTHON_EXTRA_LDFLAGS | sed 's/CoreFoundation.*$/CoreFoundation/'` 559+ fi 560+ AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) 561+ AC_SUBST(PYTHON_EXTRA_LDFLAGS) 562 563- # 564- # final check to see if everything compiles alright 565- # 566- AC_MSG_CHECKING([consistency of all components of python development environment]) 567- # save current global flags 568- ac_save_LIBS="$LIBS" 569- ac_save_CPPFLAGS="$CPPFLAGS" 570- LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS" 571- CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" 572- AC_LANG_PUSH([C]) 573- AC_LINK_IFELSE([ 574+ # 575+ # final check to see if everything compiles alright 576+ # 577+ AC_MSG_CHECKING([consistency of all components of python development environment]) 578+ # save current global flags 579+ ac_save_LIBS="$LIBS" 580+ ac_save_LDFLAGS="$LDFLAGS" 581+ ac_save_CPPFLAGS="$CPPFLAGS" 582+ LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS" 583+ LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS" 584+ CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" 585+ AC_LANG_PUSH([C]) 586+ AC_LINK_IFELSE([ 587 AC_LANG_PROGRAM([[#include <Python.h>]], 588 [[Py_Initialize();]]) 589 ],[pythonexists=yes],[pythonexists=no]) 590- AC_LANG_POP([C]) 591- # turn back to default flags 592- CPPFLAGS="$ac_save_CPPFLAGS" 593- LIBS="$ac_save_LIBS" 594+ AC_LANG_POP([C]) 595+ # turn back to default flags 596+ CPPFLAGS="$ac_save_CPPFLAGS" 597+ LIBS="$ac_save_LIBS" 598+ LDFLAGS="$ac_save_LDFLAGS" 599 600- AC_MSG_RESULT([$pythonexists]) 601+ AC_MSG_RESULT([$pythonexists]) 602 603- if test ! "x$pythonexists" = "xyes"; then 604- AC_MSG_WARN([ 605+ if test ! "x$pythonexists" = "xyes"; then 606+ AC_MSG_WARN([ 607 Could not link test program to Python. Maybe the main Python library has been 608 installed in some non-standard library path. If so, pass it to configure, 609- via the LDFLAGS environment variable. 610- Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" 611+ via the LIBS environment variable. 612+ Example: ./configure LIBS="-L/usr/non-standard-path/python/lib" 613 ============================================================================ 614+ ERROR! 615 You probably have to install the development version of the Python package 616 for your distribution. The exact name of this package varies among them. 617 ============================================================================ 618- ]) 619- PYTHON_VERSION="" 620+ ]) 621+ if ! $ax_python_devel_optional; then 622+ AC_MSG_ERROR([Giving up]) 623+ fi 624+ ax_python_devel_found=no 625+ PYTHON_VERSION="" 626+ fi 627 fi 628 629 # 630 # all done! 631 # 632-]) 633+]) 634\ No newline at end of file 635diff --git a/m4/python.m4 b/m4/python.m4 636--- a/m4/python.m4 637+++ b/m4/python.m4 638@@ -41,7 +41,7 @@ 639 m4_define_default([_AM_PYTHON_INTERPRETER_LIST], 640 [python2 python2.7 dnl 641 python dnl 642- python3 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 643+ python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 644 ]) 645 646 AC_ARG_VAR([PYTHON], [the Python interpreter]) 647