This patch addresses PR modula2/126847 and PR modula2/126863
which were raised after the patch to PR modula2/125129 was applied.
It provides a new file ax_python_interpreter.m4 containing
AC_PYTHON_INTERPRETER allowing for a Python version check.
The libgm2 build will check for Python >= 3.0 and use mktargetsrc.py
otherwise it reduces the functionality of libraries.
libgm2/ChangeLog:
PR modula2/126847
PR modula2/125129
PR modula2/126863
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Call AC_PYTHON_INTERPRETER.
Remove call to AC_PYTHON_DEVEL.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.in: Regenerate.
* ax_python_devel.m4: Removed.
* ax_python_interpreter.m4: New file.
Signed-off-by: Gaius Mulley <[email protected]>
---
libgm2/Makefile.in | 10 +-
libgm2/aclocal.m4 | 2 +-
libgm2/ax_python_devel.m4 | 522 -------------------------------
libgm2/ax_python_interpreter.m4 | 136 ++++++++
libgm2/config.h.in | 3 -
libgm2/configure | 539 +++-----------------------------
libgm2/configure.ac | 4 +-
libgm2/libm2cor/Makefile.in | 10 +-
libgm2/libm2iso/Makefile.in | 10 +-
libgm2/libm2log/Makefile.in | 10 +-
libgm2/libm2min/Makefile.in | 10 +-
libgm2/libm2pim/Makefile.in | 10 +-
12 files changed, 194 insertions(+), 1072 deletions(-)
delete mode 100644 libgm2/ax_python_devel.m4
create mode 100644 libgm2/ax_python_interpreter.m4
diff --git a/libgm2/Makefile.in b/libgm2/Makefile.in
index b2ad58d08e8..36570c81c13 100644
--- a/libgm2/Makefile.in
+++ b/libgm2/Makefile.in
@@ -90,7 +90,7 @@ host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/ax_python_devel.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/ax_python_interpreter.m4 \
$(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -240,12 +240,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PICFLAG = @PICFLAG@
PYTHON = @PYTHON@
-PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
-PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
-PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
-PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
@@ -265,7 +259,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-ax_python_interpreter = @ax_python_interpreter@
+ax_python_interpreter_found = @ax_python_interpreter_found@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
diff --git a/libgm2/aclocal.m4 b/libgm2/aclocal.m4
index c9eee317b7b..faff88dedfa 100644
--- a/libgm2/aclocal.m4
+++ b/libgm2/aclocal.m4
@@ -1187,7 +1187,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([ax_python_devel.m4])
+m4_include([ax_python_interpreter.m4])
m4_include([../config/acx.m4])
m4_include([../config/clang-plugin.m4])
m4_include([../config/depstand.m4])
diff --git a/libgm2/ax_python_devel.m4 b/libgm2/ax_python_devel.m4
deleted file mode 100644
index b018748cc19..00000000000
--- a/libgm2/ax_python_devel.m4
+++ /dev/null
@@ -1,522 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_PYTHON_DEVEL([version[,optional[,checkdev]]])
-#
-# DESCRIPTION
-#
-# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
-# in your configure.ac.
-#
-# This macro checks for Python and tries to get the include path to
-# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS)
-# output variables. It also exports $(PYTHON_EXTRA_LIBS) and
-# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
-#
-# You can search for some particular version of Python by passing a
-# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
-# note that you *have* to pass also an operator along with the version to
-# match, and pay special attention to the single quotes surrounding the
-# version number. Don't use "PYTHON_VERSION" for this: that environment
-# variable is declared as precious and thus reserved for the end-user.
-#
-# By default this will fail if it does not detect a development version of
-# python. If you want it to continue, set optional to something, like
-# AX_PYTHON_DEVEL([], [no]). The ax_python_devel_found variable will be
-# "no" if it fails. The ax_python_interpreter variable will be "no"
-# if the incorrect version of Python is found. It will be "yes" if found.
-#
-# If you want to disable the search for Python development files you can
-# add a non empty third parameter. For example:
-#
-# AX_PYTHON_DEVEL([>= '3.0'], [no], [no]) searches for a Python3
-# interpreter (no development files) and will not fail if not found.
-#
-# AX_PYTHON_DEVEL([>= '3.0'], [], [no]) searches for a Python3
-# interpreter (no development files) and will fail if not found.
-#
-# AX_PYTHON_DEVEL([>= '3.0'], [], []) searches for a Python3
-# interpreter (with development files) and will fail if not found.
-#
-# This macro should work for all versions of Python >= 2.1.0. As an end
-# user, you can disable the check for the python version by setting the
-# PYTHON_NOVERSIONCHECK environment variable to something else than the
-# empty string.
-#
-# If you need to use this macro for an older Python version, please
-# contact the authors. We're always open for feedback.
-#
-# LICENSE
-#
-# Copyright (c) 2009 Sebastian Huber <[email protected]>
-# Copyright (c) 2009 Alan W. Irwin
-# Copyright (c) 2009 Rafael Laboissiere <[email protected]>
-# Copyright (c) 2009 Andrew Collier
-# Copyright (c) 2009 Matteo Settenvini <[email protected]>
-# Copyright (c) 2009 Horst Knorr <[email protected]>
-# Copyright (c) 2013 Daniel Mullner <[email protected]>
-# Copyright (c) 2026 Gaius Mulley <[email protected]>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-# As a special exception, the respective Autoconf Macro's copyright owner
-# gives unlimited permission to copy, distribute and modify the configure
-# scripts that are the output of Autoconf when processing the Macro. You
-# need not follow the terms of the GNU General Public License when using
-# or distributing such scripts, even though portions of the text of the
-# Macro appear in them. The GNU General Public License (GPL) does govern
-# all other use of the material that constitutes the Autoconf Macro.
-#
-# This special exception to the GPL applies to versions of the Autoconf
-# Macro released by the Autoconf Archive. When you make and distribute a
-# modified version of the Autoconf Macro, you may extend this special
-# exception to the GPL to apply to your modified version as well.
-#
-# example of usage:
-#
-# AC_PYTHON_DEVEL([>= '3.0'],[no],[no])
-#
-# check for version >= 3.0.
-# do not bail out if no Python interpreter is found.
-# do not check for Python development files.
-#
-
-#serial 37
-
-AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
-AC_DEFUN([AX_PYTHON_DEVEL],[
- AC_MSG_CHECKING([starting ax_python_devel])
- # Get whether it's optional
- if test -z "$2"; then
- AC_MSG_CHECKING([having a Python interpreter is not optional])
- ax_python_devel_optional=false
- else
- AC_MSG_CHECKING([having a Python interpreter is optional])
- ax_python_devel_optional=$2
- fi
- # Should we test for python development?
- if test -z "$3"; then
- ax_python_devel_check=yes
- else
- AC_MSG_CHECKING([not checking for Python development])
- ax_python_devel_check=$3
- fi
- ax_python_devel_found=yes
- ax_python_interpreter=yes
- AC_MSG_CHECKING([do we have a Python interpreter])
- #
- # Allow the use of a (user set) custom python version
- #
- AC_ARG_VAR([PYTHON_VERSION],[The installed Python
- version to use, for example '2.3'. This string
- will be appended to the Python interpreter
- canonical name.])
-
- AC_MSG_CHECKING([for python version])
- for version in $PYTHON_VERSION "" 3 2; do
- AC_PATH_PROG([PYTHON],[python[$version]])
- AC_MSG_CHECKING([$version])
- if test -z "$PYTHON"; then
- AC_MSG_CHECKING([no])
- ax_python_devel_found=no
- ax_python_interpreter=no
- else
- AC_MSG_CHECKING([yes])
- ax_python_devel_found=yes
- ax_python_interpreter=yes
- PYTHON_VERSION=$version
- break
- fi
- done
-
- if test "$ax_python_devel_found" = "yes"; then
- #
- # Check for a version of Python >= 2.1.0
- #
- AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
- ac_supports_python_ver=`$PYTHON -c "import sys; \
- ver = sys.version.split ()[[0]]; \
- print (ver >= '2.1.0')"`
- if test "$ac_supports_python_ver" != "True"; then
- if test -z "$PYTHON_NOVERSIONCHECK"; then
- AC_MSG_RESULT([no])
- AC_MSG_WARN([
-This version of the AC@&t@_PYTHON_DEVEL macro
-doesn't work properly with versions of Python before
-2.1.0. You may need to re-run configure, setting the
-variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
-to something else than an empty string.
-])
- if ! $ax_python_devel_optional; then
- AC_MSG_FAILURE([Giving up])
- fi
- ax_python_devel_found=no
- AC_MSG_CHECKING([no interpreter found, incorrect
version])
- PYTHON_VERSION=""
- ax_python_interpreter=no
- AC_MSG_CHECKING([no interpreter found])
- else
- AC_MSG_RESULT([skip at user request])
- fi
- else
- AC_MSG_RESULT([yes])
- fi
- fi
-
- if test "$ax_python_devel_found" = "yes"; then
- #
- # If the macro parameter ``version'' is set, honour it.
- # A Python shim class, VPy, is used to implement correct version
comparisons via
- # string expressions, since e.g. a naive textual ">= 2.7.3" won't
work for
- # Python 2.7.10 (the ".1" being evaluated as less than ".3").
- #
- if test -n $1; then
- AC_MSG_CHECKING([for a version of Python $1])
- cat << EOF > ax_python_devel_vpy.py
-class VPy:
- def vtup(self, s):
- return tuple(map(int, s.strip().replace("rc", ".").split(".")))
- def __init__(self):
- import sys
- self.vpy = tuple(sys.version_info)[[:3]]
- def __eq__(self, s):
- return self.vpy == self.vtup(s)
- def __ne__(self, s):
- return self.vpy != self.vtup(s)
- def __lt__(self, s):
- return self.vpy < self.vtup(s)
- def __gt__(self, s):
- return self.vpy > self.vtup(s)
- def __le__(self, s):
- return self.vpy <= self.vtup(s)
- def __ge__(self, s):
- return self.vpy >= self.vtup(s)
-EOF
- ac_supports_python_ver=`$PYTHON -c """import
ax_python_devel_vpy; \
- ver = ax_python_devel_vpy.VPy(); \
- print (ver $1) """`
- rm -rf ax_python_devel_vpy*.py*
__pycache__/ax_python_devel_vpy*.py*
- if test "$ac_supports_python_ver" = "True"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_WARN([this package requires Python $1.
-If you have it installed, but it isn't the default Python
-interpreter in your system path, please pass the PYTHON_VERSION
-variable to configure. See ``configure --help'' for reference.
-])
- if ! $ax_python_devel_optional; then
- AC_MSG_ERROR([Giving up])
- fi
- AC_MSG_CHECKING([no interpreter found, wrong version
$1])
- ax_python_devel_found=no
- PYTHON_VERSION=""
- # Wrong version of the interpreter.
- ax_python_interpreter=no
- fi
- fi
- fi
- if test "$ax_python_devel_found" = "yes"; then
- #
- # Check if you have distutils, else fail
- #
- AC_MSG_CHECKING([for the sysconfig Python package])
- ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1`
- if test $? -eq 0; then
- AC_MSG_RESULT([yes])
- IMPORT_SYSCONFIG="import sysconfig"
- else
- AC_MSG_RESULT([no])
-
- AC_MSG_CHECKING([for the distutils Python package])
- ac_sysconfig_result=`$PYTHON -c "from distutils import
sysconfig" 2>&1`
- if test $? -eq 0; then
- AC_MSG_RESULT([yes])
- IMPORT_SYSCONFIG="from distutils import sysconfig"
- else
- AC_MSG_WARN([cannot import Python module "distutils".
-Please check your Python installation. The error was:
-$ac_sysconfig_result])
- if ! $ax_python_devel_optional; then
- AC_MSG_ERROR([Giving up])
- fi
- ax_python_devel_found=no
- PYTHON_VERSION=""
- fi
- fi
- fi
-
- if test "$ax_python_devel_found" = "yes"; then
- #
- # Check for Python include path
- #
- AC_MSG_CHECKING([for Python include path])
- if test -z "$PYTHON_CPPFLAGS"; then
- if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
- # sysconfig module has different functions
- python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_path ('include'));"`
- plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_path ('platinclude'));"`
- else
- # old distutils way
- python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_inc ());"`
- plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_inc
(plat_specific=1));"`
- fi
- if test -n "${python_path}"; then
- if test "${plat_python_path}" != "${python_path}"; then
- python_path="-I$python_path -I$plat_python_path"
- else
- python_path="-I$python_path"
- fi
- fi
- PYTHON_CPPFLAGS=$python_path
- fi
- AC_MSG_RESULT([$PYTHON_CPPFLAGS])
- AC_SUBST([PYTHON_CPPFLAGS])
-
- #
- # Check for Python library path
- #
- AC_MSG_CHECKING([for Python library path])
- if test -z "$PYTHON_LIBS"; then
- # (makes two attempts to ensure we've got a version number
- # from the interpreter)
- ac_python_version=`cat<<EOD | $PYTHON -
-
-# join all versioning strings, on some systems
-# major/minor numbers could be in different list elements
-from sysconfig import *
-e = get_config_var('VERSION')
-if e is not None:
- print(e)
-EOD`
-
- if test -z "$ac_python_version"; then
- if test -n "$PYTHON_VERSION"; then
- ac_python_version=$PYTHON_VERSION
- else
- ac_python_version=`$PYTHON -c "import sys; \
- print ("%d.%d" %
sys.version_info[[:2]])"`
- fi
- fi
-
- # Make the versioning information available to the compiler
- AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
- [If available, contains the Python version
number currently in use.])
-
- # First, the library directory:
- ac_python_libdir=`cat<<EOD | $PYTHON -
-
-# There should be only one
-$IMPORT_SYSCONFIG
-e = sysconfig.get_config_var('LIBDIR')
-if e is not None:
- print (e)
-EOD`
-
- # Now, for the library:
- ac_python_library=`cat<<EOD | $PYTHON -
-
-$IMPORT_SYSCONFIG
-c = sysconfig.get_config_vars()
-if 'LDVERSION' in c:
- print ('python'+c[['LDVERSION']])
-else:
- print ('python'+c[['VERSION']])
-EOD`
-
- # This small piece shamelessly adapted from PostgreSQL python
macro;
- # credits goes to momjian, I think. I'd like to put the right
name
- # in the credits, if someone can point me in the right
direction... ?
- #
- if test -n "$ac_python_libdir" -a -n "$ac_python_library"
- then
- # use the official shared library
- ac_python_library=`echo "$ac_python_library" | sed
"s/^lib//"`
- PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
- else
- # old way: use libpython from python_configdir
- ac_python_libdir=`$PYTHON -c \
- "from sysconfig import get_python_lib as f; \
- import os; \
- print (os.path.join(f(plat_specific=1,
standard_lib=1), 'config'));"`
- PYTHON_LIBS="-L$ac_python_libdir
-lpython$ac_python_version"
- fi
-
- if test -z "$PYTHON_LIBS"; then
- AC_MSG_WARN([
- Cannot determine location of your Python DSO. Please check it was installed
with
- dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
- ])
- if ! $ax_python_devel_optional; then
- AC_MSG_ERROR([Giving up])
- fi
- ax_python_devel_found=no
- PYTHON_VERSION=""
- fi
- fi
- fi
-
- if test "$ax_python_devel_found" = "yes"; then
- AC_MSG_RESULT([$PYTHON_LIBS])
- AC_SUBST([PYTHON_LIBS])
-
- #
- # Check for site packages
- #
- AC_MSG_CHECKING([for Python site-packages path])
- if test -z "$PYTHON_SITE_PKG"; then
- if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
- PYTHON_SITE_PKG=`$PYTHON -c "
-$IMPORT_SYSCONFIG;
-if hasattr(sysconfig, 'get_default_scheme'):
- scheme = sysconfig.get_default_scheme()
-else:
- scheme = sysconfig._get_default_scheme()
-if scheme == 'posix_local':
- # Debian's default scheme installs to /usr/local/ but we want to find
headers in /usr/
- scheme = 'posix_prefix'
-prefix = '$prefix'
-if prefix == 'NONE':
- prefix = '$ac_default_prefix'
-sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix})
-print(sitedir)"`
- else
- # distutils.sysconfig way
- PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_lib(0,0));"`
- fi
- fi
- AC_MSG_RESULT([$PYTHON_SITE_PKG])
- AC_SUBST([PYTHON_SITE_PKG])
-
- #
- # Check for platform-specific site packages
- #
- AC_MSG_CHECKING([for Python platform specific site-packages path])
- if test -z "$PYTHON_PLATFORM_SITE_PKG"; then
- if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
- PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "
-$IMPORT_SYSCONFIG;
-if hasattr(sysconfig, 'get_default_scheme'):
- scheme = sysconfig.get_default_scheme()
-else:
- scheme = sysconfig._get_default_scheme()
-if scheme == 'posix_local':
- # Debian's default scheme installs to /usr/local/ but we want to find
headers in /usr/
- scheme = 'posix_prefix'
-prefix = '$prefix'
-if prefix == 'NONE':
- prefix = '$ac_default_prefix'
-sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix})
-print(sitedir)"`
- else
- # distutils.sysconfig way
- PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c
"$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_lib(1,0));"`
- fi
- fi
- AC_MSG_RESULT([$PYTHON_PLATFORM_SITE_PKG])
- AC_SUBST([PYTHON_PLATFORM_SITE_PKG])
-
- #
- # libraries which must be linked in when embedding
- #
- AC_MSG_CHECKING(python extra libraries)
- if test -z "$PYTHON_EXTRA_LIBS"; then
- PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- conf = sysconfig.get_config_var; \
- print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
- fi
- AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
- AC_SUBST(PYTHON_EXTRA_LIBS)
-
- #
- # linking flags needed when embedding
- #
- AC_MSG_CHECKING(python extra linking flags)
- if test -z "$PYTHON_EXTRA_LDFLAGS"; then
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- conf = sysconfig.get_config_var; \
- print (conf('LINKFORSHARED'))"`
- # Hack for macos, it sticks this in here.
- PYTHON_EXTRA_LDFLAGS=`echo $PYTHON_EXTRA_LDFLAGS | sed
's/CoreFoundation.*$/CoreFoundation/'`
- fi
- AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
- AC_SUBST(PYTHON_EXTRA_LDFLAGS)
-
- if test "$ax_python_devel_check" = "yes"; then
- #
- # final check to see if everything compiles alright
- #
- AC_MSG_CHECKING([consistency of all components of python
development environment])
- # save current global flags
- ac_save_LIBS="$LIBS"
- ac_save_LDFLAGS="$LDFLAGS"
- ac_save_CPPFLAGS="$CPPFLAGS"
- LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS"
- LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
- CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
- AC_LANG_PUSH([C])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[#include <Python.h>]],
- [[Py_Initialize();]])
- ],[pythonexists=yes],[pythonexists=no])
- AC_LANG_POP([C])
- # turn back to default flags
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBS="$ac_save_LIBS"
- LDFLAGS="$ac_save_LDFLAGS"
- AC_MSG_RESULT([$pythonexists])
-
- if test ! "x$pythonexists" = "xyes"; then
- AC_MSG_WARN([
- Could not link test program to Python. Maybe the main Python library has been
- installed in some non-standard library path. If so, pass it to configure,
- via the LIBS environment variable.
- Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
- ============================================================================
- ERROR!
- You probably have to install the development version of the Python package
- for your distribution. The exact name of this package varies among them.
- ============================================================================
- ])
- if ! $ax_python_devel_optional; then
- AC_MSG_ERROR([Giving up])
- fi
- ax_python_devel_found=no
- PYTHON_VERSION=""
- fi
- fi
- fi
- AC_SUBST([ax_python_interpreter])
- AC_MSG_CHECKING([result of having a Python interpreter])
- if test "$ax_python_interpreter" = "yes"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
-
- #
- # all done!
- #
-])
diff --git a/libgm2/ax_python_interpreter.m4 b/libgm2/ax_python_interpreter.m4
new file mode 100644
index 00000000000..2ebd84568ad
--- /dev/null
+++ b/libgm2/ax_python_interpreter.m4
@@ -0,0 +1,136 @@
+# ax_python_interpreter.m4 detect a versioned python interpreter.
+#
+# Copyright (C) 2026 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+#
+# This code is heavily derived and pruned from:
+#
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PYTHON_INTERPRETER([version])
+#
+# DESCRIPTION
+#
+# This macro checks for a particular version of Python.
+# The parameter is manditory, for example ">= '2.3.1'", or "== '2.4'".
+# Please note that you also *have* to pass an operator along with the
+# version to match, and pay special attention to the single quotes
+# surrounding the version number.
+#
+# The ax_python_interpreter_found variable will be "no" if the incorrect
+# version of Python is found. It will be "yes" if found.
+#
+# PYTHON_VERSION can be set to force the interpreter program name.
+# For example PYTHON_VERSION=2.7.1 which searches for python2.7.1.
+# Otherwise it searches for a program named python, python2 or python3.
+#
+# For example:
+#
+# AX_PYTHON_INTERPRETER([>= '3.0']) searches for a Python3 interpreter.
+#
+# This macro should work for all versions of Python >= 2.1.0.
+#
+
+AC_DEFUN([AC_PYTHON_INTERPRETER],[
+ # Default to no.
+ ax_python_interpreter_found=no
+ AC_MSG_CHECKING([do we have a Python interpreter])
+ #
+ # Allow the use of a (user set) custom python version
+ #
+ AC_ARG_VAR([PYTHON_VERSION],[The installed Python
+ version to use, for example '2.3'. This string
+ will be appended to the Python interpreter
+ canonical name.])
+ for version in $PYTHON_VERSION 3 2 ""; do
+ AC_PATH_PROG([PYTHON],[python[$version]])
+ if test -z "$PYTHON"; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ # Note: omitted the test for Python version < 2.1.0.
+ #
+ # If the macro parameter ``version'' is set, honour it.
+ # A Python shim class, VPy, is used to implement correct
version comparisons via
+ # string expressions, since e.g. a naive textual ">= 2.7.3"
won't work for
+ # Python 2.7.10 (the ".1" being evaluated as less than ".3").
+ if test -n $1; then
+ AC_MSG_CHECKING([whether internal python version string is
$1])
+ cat << EOF > ax_python_interpreter_vpy.py
+class VPy:
+ def vtup(self, s):
+ return tuple(map(int, s.strip().replace("rc", ".").split(".")))
+ def __init__(self):
+ import sys
+ self.vpy = tuple(sys.version_info)[[:3]]
+ def __eq__(self, s):
+ return self.vpy == self.vtup(s)
+ def __ne__(self, s):
+ return self.vpy != self.vtup(s)
+ def __lt__(self, s):
+ return self.vpy < self.vtup(s)
+ def __gt__(self, s):
+ return self.vpy > self.vtup(s)
+ def __le__(self, s):
+ return self.vpy <= self.vtup(s)
+ def __ge__(self, s):
+ return self.vpy >= self.vtup(s)
+EOF
+ ac_supports_python_ver=`$PYTHON -c """import
ax_python_interpreter_vpy; \
+ ver = ax_python_interpreter_vpy.VPy(); \
+ print (ver $1) """`
+ rm -rf ax_python_interpreter_vpy*.py*
__pycache__/ax_python_interpreter_vpy*.py*
+ if test "$ac_supports_python_ver" = "True"; then
+ # Found correct version, now break from the loop.
+ AC_MSG_RESULT([yes])
+ PYTHON_VERSION=$version
+ ax_python_interpreter_found=yes
+ break
+ else
+ AC_MSG_RESULT([no])
+ PYTHON_VERSION=""
+ fi
+ fi
+ fi
+ done
+ AC_SUBST([ax_python_interpreter_found])
+ AC_MSG_CHECKING([result of having a Python $1 interpreter])
+ if test "$ax_python_interpreter_found" = "yes"; then
+ AC_MSG_RESULT([yes, all done.])
+ else
+ AC_MSG_RESULT([no])
+ PYTHON_VERSION=""
+ fi
+ #
+ # all done!
+ #
+])
diff --git a/libgm2/config.h.in b/libgm2/config.h.in
index bd0c3237f4b..f9710ffde8a 100644
--- a/libgm2/config.h.in
+++ b/libgm2/config.h.in
@@ -152,9 +152,6 @@
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
-/* If available, contains the Python version number currently in use. */
-#undef HAVE_PYTHON
-
/* function rand exists */
#undef HAVE_RAND
diff --git a/libgm2/configure b/libgm2/configure
index e522e73d4db..9c383718782 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -652,13 +652,7 @@ enable_static
enable_shared
HAVE_PYTHON_INTERPRETER_FALSE
HAVE_PYTHON_INTERPRETER_TRUE
-ax_python_interpreter
-PYTHON_EXTRA_LDFLAGS
-PYTHON_EXTRA_LIBS
-PYTHON_PLATFORM_SITE_PKG
-PYTHON_SITE_PKG
-PYTHON_LIBS
-PYTHON_CPPFLAGS
+ax_python_interpreter_found
PYTHON
PYTHON_VERSION
ENABLE_DARWIN_AT_RPATH_FALSE
@@ -15258,7 +15252,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 15261 "configure"
+#line 15255 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15364,7 +15358,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 15367 "configure"
+#line 15361 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18706,39 +18700,16 @@ else
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking starting
ax_python_devel" >&5
-$as_echo_n "checking starting ax_python_devel... " >&6; }
- # Get whether it's optional
- if test -z "no"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking having a Python
interpreter is not optional" >&5
-$as_echo_n "checking having a Python interpreter is not optional... " >&6; }
- ax_python_devel_optional=false
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking having a Python
interpreter is optional" >&5
-$as_echo_n "checking having a Python interpreter is optional... " >&6; }
- ax_python_devel_optional=no
- fi
- # Should we test for python development?
- if test -z "no"; then
- ax_python_devel_check=yes
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking not checking for
Python development" >&5
-$as_echo_n "checking not checking for Python development... " >&6; }
- ax_python_devel_check=no
- fi
- ax_python_devel_found=yes
- ax_python_interpreter=yes
+ # Default to no.
+ ax_python_interpreter_found=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking do we have a Python
interpreter" >&5
$as_echo_n "checking do we have a Python interpreter... " >&6; }
#
# Allow the use of a (user set) custom python version
#
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python version"
>&5
-$as_echo_n "checking for python version... " >&6; }
- for version in $PYTHON_VERSION "" 3 2; do
- # Extract the first word of "python[$version]", so it can be a
program name with args.
+ for version in $PYTHON_VERSION 3 2 ""; do
+ # Extract the first word of "python[$version]", so it can be a
program name with args.
set dummy python$version; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@@ -18778,88 +18749,22 @@ $as_echo "no" >&6; }
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking $version" >&5
-$as_echo_n "checking $version... " >&6; }
- if test -z "$PYTHON"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking no" >&5
-$as_echo_n "checking no... " >&6; }
- ax_python_devel_found=no
- ax_python_interpreter=no
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking yes" >&5
-$as_echo_n "checking yes... " >&6; }
- ax_python_devel_found=yes
- ax_python_interpreter=yes
- PYTHON_VERSION=$version
- break
- fi
- done
-
- if test "$ax_python_devel_found" = "yes"; then
- #
- # Check for a version of Python >= 2.1.0
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of
Python >= '2.1.0'" >&5
-$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; }
- ac_supports_python_ver=`$PYTHON -c "import sys; \
- ver = sys.version.split ()[0]; \
- print (ver >= '2.1.0')"`
- if test "$ac_supports_python_ver" != "True"; then
- if test -z "$PYTHON_NOVERSIONCHECK"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ if test -z "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-This version of the AC_PYTHON_DEVEL macro
-doesn't work properly with versions of Python before
-2.1.0. You may need to re-run configure, setting the
-variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
-to something else than an empty string.
-" >&5
-$as_echo "$as_me: WARNING:
-This version of the AC_PYTHON_DEVEL macro
-doesn't work properly with versions of Python before
-2.1.0. You may need to re-run configure, setting the
-variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
-to something else than an empty string.
-" >&2;}
- if ! $ax_python_devel_optional; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in
\`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "Giving up
-See \`config.log' for more details" "$LINENO" 5; }
- fi
- ax_python_devel_found=no
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking no
interpreter found, incorrect version" >&5
-$as_echo_n "checking no interpreter found, incorrect version... " >&6; }
- PYTHON_VERSION=""
- ax_python_interpreter=no
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking no
interpreter found" >&5
-$as_echo_n "checking no interpreter found... " >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip
at user request" >&5
-$as_echo "skip at user request" >&6; }
- fi
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- fi
- fi
-
- if test "$ax_python_devel_found" = "yes"; then
- #
- # If the macro parameter ``version'' is set, honour it.
- # A Python shim class, VPy, is used to implement correct version
comparisons via
- # string expressions, since e.g. a naive textual ">= 2.7.3" won't
work for
- # Python 2.7.10 (the ".1" being evaluated as less than ".3").
- #
- if test -n >= '3.0'; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version
of Python >= '3.0'" >&5
-$as_echo_n "checking for a version of Python >= '3.0'... " >&6; }
- cat << EOF > ax_python_devel_vpy.py
+ # Note: omitted the test for Python version < 2.1.0.
+ #
+ # If the macro parameter ``version'' is set, honour it.
+ # A Python shim class, VPy, is used to implement correct
version comparisons via
+ # string expressions, since e.g. a naive textual ">= 2.7.3"
won't work for
+ # Python 2.7.10 (the ".1" being evaluated as less than ".3").
+ if test -n >= '3.0'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether
internal python version string is >= '3.0'" >&5
+$as_echo_n "checking whether internal python version string is >= '3.0'... "
>&6; }
+ cat << EOF > ax_python_interpreter_vpy.py
class VPy:
def vtup(self, s):
return tuple(map(int, s.strip().replace("rc", ".").split(".")))
@@ -18879,399 +18784,41 @@ class VPy:
def __ge__(self, s):
return self.vpy >= self.vtup(s)
EOF
- ac_supports_python_ver=`$PYTHON -c """import
ax_python_devel_vpy; \
- ver = ax_python_devel_vpy.VPy(); \
+ ac_supports_python_ver=`$PYTHON -c """import
ax_python_interpreter_vpy; \
+ ver = ax_python_interpreter_vpy.VPy(); \
print (ver >= '3.0') """`
- rm -rf ax_python_devel_vpy*.py*
__pycache__/ax_python_devel_vpy*.py*
- if test "$ac_supports_python_ver" = "True"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes"
>&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: this
package requires Python >= '3.0'.
-If you have it installed, but it isn't the default Python
-interpreter in your system path, please pass the PYTHON_VERSION
-variable to configure. See \`\`configure --help'' for reference.
-" >&5
-$as_echo "$as_me: WARNING: this package requires Python >= '3.0'.
-If you have it installed, but it isn't the default Python
-interpreter in your system path, please pass the PYTHON_VERSION
-variable to configure. See \`\`configure --help'' for reference.
-" >&2;}
- if ! $ax_python_devel_optional; then
- as_fn_error $? "Giving up" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking no
interpreter found, wrong version >= '3.0'" >&5
-$as_echo_n "checking no interpreter found, wrong version >= '3.0'... " >&6; }
- ax_python_devel_found=no
- PYTHON_VERSION=""
- # Wrong version of the interpreter.
- ax_python_interpreter=no
- fi
- fi
- fi
- if test "$ax_python_devel_found" = "yes"; then
- #
- # Check if you have distutils, else fail
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the sysconfig
Python package" >&5
-$as_echo_n "checking for the sysconfig Python package... " >&6; }
- ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1`
- if test $? -eq 0; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ rm -rf ax_python_interpreter_vpy*.py*
__pycache__/ax_python_interpreter_vpy*.py*
+ if test "$ac_supports_python_ver" = "True"; then
+ # Found correct version, now break from the loop.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes"
>&5
$as_echo "yes" >&6; }
- IMPORT_SYSCONFIG="import sysconfig"
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ PYTHON_VERSION=$version
+ ax_python_interpreter_found=yes
+ break
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no"
>&5
$as_echo "no" >&6; }
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the
distutils Python package" >&5
-$as_echo_n "checking for the distutils Python package... " >&6; }
- ac_sysconfig_result=`$PYTHON -c "from distutils import
sysconfig" 2>&1`
- if test $? -eq 0; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes"
>&5
-$as_echo "yes" >&6; }
- IMPORT_SYSCONFIG="from distutils import sysconfig"
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
cannot import Python module \"distutils\".
-Please check your Python installation. The error was:
-$ac_sysconfig_result" >&5
-$as_echo "$as_me: WARNING: cannot import Python module \"distutils\".
-Please check your Python installation. The error was:
-$ac_sysconfig_result" >&2;}
- if ! $ax_python_devel_optional; then
- as_fn_error $? "Giving up" "$LINENO" 5
- fi
- ax_python_devel_found=no
PYTHON_VERSION=""
- fi
- fi
- fi
-
- if test "$ax_python_devel_found" = "yes"; then
- #
- # Check for Python include path
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include
path" >&5
-$as_echo_n "checking for Python include path... " >&6; }
- if test -z "$PYTHON_CPPFLAGS"; then
- if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
- # sysconfig module has different functions
- python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_path ('include'));"`
- plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_path ('platinclude'));"`
- else
- # old distutils way
- python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_inc ());"`
- plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_inc
(plat_specific=1));"`
- fi
- if test -n "${python_path}"; then
- if test "${plat_python_path}" != "${python_path}"; then
- python_path="-I$python_path -I$plat_python_path"
- else
- python_path="-I$python_path"
- fi
- fi
- PYTHON_CPPFLAGS=$python_path
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS"
>&5
-$as_echo "$PYTHON_CPPFLAGS" >&6; }
-
-
- #
- # Check for Python library path
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library
path" >&5
-$as_echo_n "checking for Python library path... " >&6; }
- if test -z "$PYTHON_LIBS"; then
- # (makes two attempts to ensure we've got a version number
- # from the interpreter)
- ac_python_version=`cat<<EOD | $PYTHON -
-
-# join all versioning strings, on some systems
-# major/minor numbers could be in different list elements
-from sysconfig import *
-e = get_config_var('VERSION')
-if e is not None:
- print(e)
-EOD`
-
- if test -z "$ac_python_version"; then
- if test -n "$PYTHON_VERSION"; then
- ac_python_version=$PYTHON_VERSION
- else
- ac_python_version=`$PYTHON -c "import sys; \
- print ("%d.%d" % sys.version_info[:2])"`
- fi
- fi
-
- # Make the versioning information available to the compiler
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PYTHON "$ac_python_version"
-_ACEOF
-
-
- # First, the library directory:
- ac_python_libdir=`cat<<EOD | $PYTHON -
-
-# There should be only one
-$IMPORT_SYSCONFIG
-e = sysconfig.get_config_var('LIBDIR')
-if e is not None:
- print (e)
-EOD`
-
- # Now, for the library:
- ac_python_library=`cat<<EOD | $PYTHON -
-
-$IMPORT_SYSCONFIG
-c = sysconfig.get_config_vars()
-if 'LDVERSION' in c:
- print ('python'+c['LDVERSION'])
-else:
- print ('python'+c['VERSION'])
-EOD`
-
- # This small piece shamelessly adapted from PostgreSQL python
macro;
- # credits goes to momjian, I think. I'd like to put the right
name
- # in the credits, if someone can point me in the right
direction... ?
- #
- if test -n "$ac_python_libdir" -a -n "$ac_python_library"
- then
- # use the official shared library
- ac_python_library=`echo "$ac_python_library" | sed
"s/^lib//"`
- PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
- else
- # old way: use libpython from python_configdir
- ac_python_libdir=`$PYTHON -c \
- "from sysconfig import get_python_lib as f; \
- import os; \
- print (os.path.join(f(plat_specific=1,
standard_lib=1), 'config'));"`
- PYTHON_LIBS="-L$ac_python_libdir
-lpython$ac_python_version"
- fi
-
- if test -z "$PYTHON_LIBS"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
- Cannot determine location of your Python DSO. Please check it was installed
with
- dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
- " >&5
-$as_echo "$as_me: WARNING:
- Cannot determine location of your Python DSO. Please check it was installed
with
- dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
- " >&2;}
- if ! $ax_python_devel_optional; then
- as_fn_error $? "Giving up" "$LINENO" 5
- fi
- ax_python_devel_found=no
- PYTHON_VERSION=""
- fi
- fi
- fi
-
- if test "$ax_python_devel_found" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5
-$as_echo "$PYTHON_LIBS" >&6; }
-
-
- #
- # Check for site packages
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python
site-packages path" >&5
-$as_echo_n "checking for Python site-packages path... " >&6; }
- if test -z "$PYTHON_SITE_PKG"; then
- if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
- PYTHON_SITE_PKG=`$PYTHON -c "
-$IMPORT_SYSCONFIG;
-if hasattr(sysconfig, 'get_default_scheme'):
- scheme = sysconfig.get_default_scheme()
-else:
- scheme = sysconfig._get_default_scheme()
-if scheme == 'posix_local':
- # Debian's default scheme installs to /usr/local/ but we want to find
headers in /usr/
- scheme = 'posix_prefix'
-prefix = '$prefix'
-if prefix == 'NONE':
- prefix = '$ac_default_prefix'
-sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix})
-print(sitedir)"`
- else
- # distutils.sysconfig way
- PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_lib(0,0));"`
- fi
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG"
>&5
-$as_echo "$PYTHON_SITE_PKG" >&6; }
-
-
- #
- # Check for platform-specific site packages
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python
platform specific site-packages path" >&5
-$as_echo_n "checking for Python platform specific site-packages path... " >&6;
}
- if test -z "$PYTHON_PLATFORM_SITE_PKG"; then
- if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
- PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "
-$IMPORT_SYSCONFIG;
-if hasattr(sysconfig, 'get_default_scheme'):
- scheme = sysconfig.get_default_scheme()
-else:
- scheme = sysconfig._get_default_scheme()
-if scheme == 'posix_local':
- # Debian's default scheme installs to /usr/local/ but we want to find
headers in /usr/
- scheme = 'posix_prefix'
-prefix = '$prefix'
-if prefix == 'NONE':
- prefix = '$ac_default_prefix'
-sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix})
-print(sitedir)"`
- else
- # distutils.sysconfig way
- PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c
"$IMPORT_SYSCONFIG; \
- print (sysconfig.get_python_lib(1,0));"`
- fi
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result:
$PYTHON_PLATFORM_SITE_PKG" >&5
-$as_echo "$PYTHON_PLATFORM_SITE_PKG" >&6; }
-
-
- #
- # libraries which must be linked in when embedding
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra
libraries" >&5
-$as_echo_n "checking python extra libraries... " >&6; }
- if test -z "$PYTHON_EXTRA_LIBS"; then
- PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- conf = sysconfig.get_config_var; \
- print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS"
>&5
-$as_echo "$PYTHON_EXTRA_LIBS" >&6; }
-
-
- #
- # linking flags needed when embedding
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra
linking flags" >&5
-$as_echo_n "checking python extra linking flags... " >&6; }
- if test -z "$PYTHON_EXTRA_LDFLAGS"; then
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \
- conf = sysconfig.get_config_var; \
- print (conf('LINKFORSHARED'))"`
- # Hack for macos, it sticks this in here.
- PYTHON_EXTRA_LDFLAGS=`echo $PYTHON_EXTRA_LDFLAGS | sed
's/CoreFoundation.*$/CoreFoundation/'`
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result:
$PYTHON_EXTRA_LDFLAGS" >&5
-$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; }
-
-
- if test "$ax_python_devel_check" = "yes"; then
- #
- # final check to see if everything compiles alright
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of
all components of python development environment" >&5
-$as_echo_n "checking consistency of all components of python development
environment... " >&6; }
- # save current global flags
- ac_save_LIBS="$LIBS"
- ac_save_LDFLAGS="$LDFLAGS"
- ac_save_CPPFLAGS="$CPPFLAGS"
- LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS"
- LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
- CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- if test x$gcc_no_link = xyes; then
- as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES."
"$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <Python.h>
-int
-main ()
-{
-Py_Initialize();
- ;
- return 0;
-}
-
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- pythonexists=yes
-else
- pythonexists=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext
$LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- # turn back to default flags
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBS="$ac_save_LIBS"
- LDFLAGS="$ac_save_LDFLAGS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists"
>&5
-$as_echo "$pythonexists" >&6; }
-
- if test ! "x$pythonexists" = "xyes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
- Could not link test program to Python. Maybe the main Python library has been
- installed in some non-standard library path. If so, pass it to configure,
- via the LIBS environment variable.
- Example: ./configure LIBS=\"-L/usr/non-standard-path/python/lib\"
- ============================================================================
- ERROR!
- You probably have to install the development version of the Python package
- for your distribution. The exact name of this package varies among them.
- ============================================================================
- " >&5
-$as_echo "$as_me: WARNING:
- Could not link test program to Python. Maybe the main Python library has been
- installed in some non-standard library path. If so, pass it to configure,
- via the LIBS environment variable.
- Example: ./configure LIBS=\"-L/usr/non-standard-path/python/lib\"
- ============================================================================
- ERROR!
- You probably have to install the development version of the Python package
- for your distribution. The exact name of this package varies among them.
- ============================================================================
- " >&2;}
- if ! $ax_python_devel_optional; then
- as_fn_error $? "Giving up" "$LINENO" 5
- fi
- ax_python_devel_found=no
- PYTHON_VERSION=""
- fi
- fi
- fi
+ fi
+ fi
+ fi
+ done
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking result of having a
Python interpreter" >&5
-$as_echo_n "checking result of having a Python interpreter... " >&6; }
- if test "$ax_python_interpreter" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking result of having a
Python >= '3.0' interpreter" >&5
+$as_echo_n "checking result of having a Python >= '3.0' interpreter... " >&6; }
+ if test "$ax_python_interpreter_found" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, all done." >&5
+$as_echo "yes, all done." >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
+ PYTHON_VERSION=""
fi
-
#
# all done!
#
- if test x$ax_python_interpreter = xyes; then
+ if test x$ax_python_interpreter_found = xyes; then
HAVE_PYTHON_INTERPRETER_TRUE=
HAVE_PYTHON_INTERPRETER_FALSE='#'
else
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 8f71649cd16..52a82fff33e 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -259,8 +259,8 @@ LT_INIT
AC_LIBTOOL_DLOPEN
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath =
xyes])
-AC_PYTHON_DEVEL([>= '3.0'],[no],[no])
-AM_CONDITIONAL([HAVE_PYTHON_INTERPRETER], [test x$ax_python_interpreter =
xyes])
+AC_PYTHON_INTERPRETER([>= '3.0'])
+AM_CONDITIONAL([HAVE_PYTHON_INTERPRETER], [test x$ax_python_interpreter_found
= xyes])
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
diff --git a/libgm2/libm2cor/Makefile.in b/libgm2/libm2cor/Makefile.in
index fe2fe468f60..23e1e677ae6 100644
--- a/libgm2/libm2cor/Makefile.in
+++ b/libgm2/libm2cor/Makefile.in
@@ -108,7 +108,7 @@ target_triplet = @target@
@BUILD_CORLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 =
-nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2cor
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/ax_python_devel.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/ax_python_interpreter.m4 \
$(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -317,12 +317,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PICFLAG = @PICFLAG@
PYTHON = @PYTHON@
-PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
-PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
-PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
-PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
@@ -342,7 +336,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-ax_python_interpreter = @ax_python_interpreter@
+ax_python_interpreter_found = @ax_python_interpreter_found@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
diff --git a/libgm2/libm2iso/Makefile.in b/libgm2/libm2iso/Makefile.in
index 37216b856c8..00b4a6a4453 100644
--- a/libgm2/libm2iso/Makefile.in
+++ b/libgm2/libm2iso/Makefile.in
@@ -108,7 +108,7 @@ target_triplet = @target@
@BUILD_ISOLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 =
-nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2iso
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/ax_python_devel.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/ax_python_interpreter.m4 \
$(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -343,12 +343,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PICFLAG = @PICFLAG@
PYTHON = @PYTHON@
-PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
-PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
-PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
-PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
@@ -368,7 +362,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-ax_python_interpreter = @ax_python_interpreter@
+ax_python_interpreter_found = @ax_python_interpreter_found@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
diff --git a/libgm2/libm2log/Makefile.in b/libgm2/libm2log/Makefile.in
index 1bf8ec79415..ba3a087dea6 100644
--- a/libgm2/libm2log/Makefile.in
+++ b/libgm2/libm2log/Makefile.in
@@ -108,7 +108,7 @@ target_triplet = @target@
@BUILD_LOGLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 =
-nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2log
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/ax_python_devel.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/ax_python_interpreter.m4 \
$(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -306,12 +306,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PICFLAG = @PICFLAG@
PYTHON = @PYTHON@
-PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
-PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
-PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
-PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
@@ -331,7 +325,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-ax_python_interpreter = @ax_python_interpreter@
+ax_python_interpreter_found = @ax_python_interpreter_found@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in
index 85d289a5b99..3075d557c87 100644
--- a/libgm2/libm2min/Makefile.in
+++ b/libgm2/libm2min/Makefile.in
@@ -108,7 +108,7 @@ target_triplet = @target@
@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -nodefaultrpaths
-Wl,-rpath,@loader_path/
subdir = libm2min
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/ax_python_devel.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/ax_python_interpreter.m4 \
$(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -296,12 +296,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PICFLAG = @PICFLAG@
PYTHON = @PYTHON@
-PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
-PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
-PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
-PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
@@ -321,7 +315,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-ax_python_interpreter = @ax_python_interpreter@
+ax_python_interpreter_found = @ax_python_interpreter_found@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 213f5c1e626..c2cb4514409 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -108,7 +108,7 @@ target_triplet = @target@
@BUILD_PIMLIB_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 =
-nodefaultrpaths -Wl,-rpath,@loader_path/
subdir = libm2pim
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/ax_python_devel.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/ax_python_interpreter.m4 \
$(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -333,12 +333,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PICFLAG = @PICFLAG@
PYTHON = @PYTHON@
-PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
-PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
-PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
-PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
@@ -358,7 +352,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-ax_python_interpreter = @ax_python_interpreter@
+ax_python_interpreter_found = @ax_python_interpreter_found@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
--
2.47.3