lol
1diff --git a/configure.ac b/configure.ac
2--- a/configure.ac
3+++ b/configure.ac
4@@ -425,11 +425,12 @@
5 if test "$found_py" = "1" -o "$found_py3" = "1"; then
6 # Reset everything, so that we can look for another Python.
7 m4_foreach([mym4pythonver],
8- [[2.7],[3.4],[3.5],[3.6],[3.7],[3.8],[3.9],[all]],
9+ [[2.7],[3.4],[3.5],[3.6],[3.7],[3.8],[3.9],[3.10],[all]],
10 [unset PYTHON
11 unset PYTHON_VERSION
12 unset PYTHON_CPPFLAGS
13 unset PYTHON_LDFLAGS
14+ unset PYTHON_LIBS
15 unset PYTHON_SITE_PKG
16 unset PYTHON_EXTRA_LIBS
17 unset PYTHON_EXTRA_LDFLAGS
18diff --git a/m4/python.m4 b/m4/python.m4
19--- a/m4/python.m4
20+++ b/m4/python.m4
21@@ -1,10 +1,10 @@
22 ## ------------------------ -*- Autoconf -*-
23 ## Python file handling
24 ## From Andrew Dalke
25-## Updated by James Henstridge
26+## Updated by James Henstridge and other contributors.
27 ## Updated by Werner Koch 2018-10-17
28-## ---------------------------------
29-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
30+## ------------------------
31+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
32 #
33 # This file is free software; the Free Software Foundation
34 # gives unlimited permission to copy and/or distribute it,
35@@ -36,13 +36,12 @@
36 # numbers and dots only.
37 AC_DEFUN([AM_PATH_PYTHON],
38 [
39- dnl Find a Python interpreter. Python versions prior to 2.0 are not
40- dnl supported. (2.0 was released on October 16, 2000). Python 3.0
41- dnl through to Python 3.9 are also not supported.
42+ dnl Find a Python interpreter. Python versions prior to 2.7 are not
43+ dnl supported. Python 3.0 through to Python 3.3 are also not supported.
44 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
45 [python2 python2.7 dnl
46 python dnl
47- python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4
48+ python3 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4
49 ])
50
51 AC_ARG_VAR([PYTHON], [the Python interpreter])
52@@ -85,34 +84,141 @@
53 ])
54
55 if test "$PYTHON" = :; then
56- dnl Run any user-specified action, or abort.
57+ dnl Run any user-specified action, or abort.
58 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
59 else
60
61- dnl Query Python for its version number. Getting [:3] seems to be
62- dnl the best way to do this; it's what "site.py" does in the standard
63- dnl library.
64-
65+ dnl Query Python for its version number. Although site.py simply uses
66+ dnl sys.version[:3], printing that failed with Python 3.10, since the
67+ dnl trailing zero was eliminated. So now we output just the major
68+ dnl and minor version numbers, as numbers. Apparently the tertiary
69+ dnl version is not of interest.
70+ dnl
71 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
72- [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
73+ [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
74 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
75
76- dnl Use the values of $prefix and $exec_prefix for the corresponding
77- dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
78- dnl distinct variables so they can be overridden if need be. However,
79- dnl general consensus is that you shouldn't need this ability.
80-
81- AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
82- AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
83-
84- dnl At times (like when building shared libraries) you may want
85+ dnl At times, e.g., when building shared libraries, you may want
86 dnl to know which OS platform Python thinks this is.
87-
88+ dnl
89 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
90 [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
91 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
92
93- # Just factor out some code duplication.
94+ dnl emacs-page
95+ dnl If --with-python-sys-prefix is given, use the values of sys.prefix
96+ dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX
97+ dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and
98+ dnl ${exec_prefix} variables.
99+ dnl
100+ dnl The two are made distinct variables so they can be overridden if
101+ dnl need be, although general consensus is that you shouldn't need
102+ dnl this separation.
103+ dnl
104+ dnl Also allow directly setting the prefixes via configure options,
105+ dnl overriding any default.
106+ dnl
107+ if test "x$prefix" = xNONE; then
108+ am__usable_prefix=$ac_default_prefix
109+ else
110+ am__usable_prefix=$prefix
111+ fi
112+
113+ # Allow user to request using sys.* values from Python,
114+ # instead of the GNU $prefix values.
115+ AC_ARG_WITH([python-sys-prefix],
116+ [AS_HELP_STRING([--with-python-sys-prefix],
117+ [use Python's sys.prefix and sys.exec_prefix values])],
118+ [am_use_python_sys=:],
119+ [am_use_python_sys=false])
120+
121+ # Allow user to override whatever the default Python prefix is.
122+ AC_ARG_WITH([python_prefix],
123+ [AS_HELP_STRING([--with-python_prefix],
124+ [override the default PYTHON_PREFIX])],
125+ [am_python_prefix_subst=$withval
126+ am_cv_python_prefix=$withval
127+ AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix])
128+ AC_MSG_RESULT([$am_cv_python_prefix])],
129+ [
130+ if $am_use_python_sys; then
131+ # using python sys.prefix value, not GNU
132+ AC_CACHE_CHECK([for python default $am_display_PYTHON prefix],
133+ [am_cv_python_prefix],
134+ [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`])
135+
136+ dnl If sys.prefix is a subdir of $prefix, replace the literal value of
137+ dnl $prefix with a variable reference so it can be overridden.
138+ case $am_cv_python_prefix in
139+ $am__usable_prefix*)
140+ am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'`
141+ am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"`
142+ ;;
143+ *)
144+ am_python_prefix_subst=$am_cv_python_prefix
145+ ;;
146+ esac
147+ else # using GNU prefix value, not python sys.prefix
148+ am_python_prefix_subst='${prefix}'
149+ am_python_prefix=$am_python_prefix_subst
150+ AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix])
151+ AC_MSG_RESULT([$am_python_prefix])
152+ fi])
153+ # Substituting python_prefix_subst value.
154+ AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst])
155+
156+ # emacs-page Now do it all over again for Python exec_prefix, but with yet
157+ # another conditional: fall back to regular prefix if that was specified.
158+ AC_ARG_WITH([python_exec_prefix],
159+ [AS_HELP_STRING([--with-python_exec_prefix],
160+ [override the default PYTHON_EXEC_PREFIX])],
161+ [am_python_exec_prefix_subst=$withval
162+ am_cv_python_exec_prefix=$withval
163+ AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix])
164+ AC_MSG_RESULT([$am_cv_python_exec_prefix])],
165+ [
166+ # no explicit --with-python_exec_prefix, but if
167+ # --with-python_prefix was given, use its value for python_exec_prefix too.
168+ AS_IF([test -n "$with_python_prefix"],
169+ [am_python_exec_prefix_subst=$with_python_prefix
170+ am_cv_python_exec_prefix=$with_python_prefix
171+ AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix])
172+ AC_MSG_RESULT([$am_cv_python_exec_prefix])],
173+ [
174+ # Set am__usable_exec_prefix whether using GNU or Python values,
175+ # since we use that variable for pyexecdir.
176+ if test "x$exec_prefix" = xNONE; then
177+ am__usable_exec_prefix=$am__usable_prefix
178+ else
179+ am__usable_exec_prefix=$exec_prefix
180+ fi
181+ #
182+ if $am_use_python_sys; then # using python sys.exec_prefix, not GNU
183+ AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix],
184+ [am_cv_python_exec_prefix],
185+ [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`])
186+ dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the
187+ dnl literal value of $exec_prefix with a variable reference so it can
188+ dnl be overridden.
189+ case $am_cv_python_exec_prefix in
190+ $am__usable_exec_prefix*)
191+ am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'`
192+ am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"`
193+ ;;
194+ *)
195+ am_python_exec_prefix_subst=$am_cv_python_exec_prefix
196+ ;;
197+ esac
198+ else # using GNU $exec_prefix, not python sys.exec_prefix
199+ am_python_exec_prefix_subst='${exec_prefix}'
200+ am_python_exec_prefix=$am_python_exec_prefix_subst
201+ AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix])
202+ AC_MSG_RESULT([$am_python_exec_prefix])
203+ fi])])
204+ # Substituting python_exec_prefix_subst.
205+ AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst])
206+
207+ # Factor out some code duplication into this shell variable.
208 am_python_setup_sysconfig="\
209 import sys
210 # Prefer sysconfig over distutils.sysconfig, for better compatibility
211@@ -132,96 +238,95 @@
212 except ImportError:
213 pass"
214
215- dnl Set up 4 directories:
216+ dnl emacs-page Set up 4 directories:
217
218- dnl pythondir -- where to install python scripts. This is the
219- dnl site-packages directory, not the python standard library
220- dnl directory like in previous automake betas. This behavior
221- dnl is more consistent with lispdir.m4 for example.
222+ dnl 1. pythondir: where to install python scripts. This is the
223+ dnl site-packages directory, not the python standard library
224+ dnl directory like in previous automake betas. This behavior
225+ dnl is more consistent with lispdir.m4 for example.
226 dnl Query distutils for this directory.
227- AC_CACHE_CHECK([for $am_display_PYTHON script directory],
228- [am_cv_python_pythondir],
229- [if test "x$prefix" = xNONE
230- then
231- am_py_prefix=$ac_default_prefix
232- else
233- am_py_prefix=$prefix
234- fi
235- am_cv_python_pythondir=`$PYTHON -c "
236+ dnl
237+ AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
238+ [am_cv_python_pythondir],
239+ [if test "x$am_cv_python_prefix" = x; then
240+ am_py_prefix=$am__usable_prefix
241+ else
242+ am_py_prefix=$am_cv_python_prefix
243+ fi
244+ am_cv_python_pythondir=`$PYTHON -c "
245 $am_python_setup_sysconfig
246 if can_use_sysconfig:
247- sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
248+ sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
249 else:
250- from distutils import sysconfig
251- sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
252+ from distutils import sysconfig
253+ sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
254 sys.stdout.write(sitedir)"`
255- case $am_cv_python_pythondir in
256- $am_py_prefix*)
257- am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
258- am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
259- ;;
260- *)
261- case $am_py_prefix in
262- /usr|/System*) ;;
263- *)
264- am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
265- ;;
266- esac
267- ;;
268+ #
269+ case $am_cv_python_pythondir in
270+ $am_py_prefix*)
271+ am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
272+ am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"`
273+ ;;
274+ *)
275+ case $am_py_prefix in
276+ /usr|/System*) ;;
277+ *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
278+ ;;
279 esac
280- ])
281+ ;;
282+ esac
283+ ])
284 AC_SUBST([pythondir], [$am_cv_python_pythondir])
285
286- dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
287- dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
288- dnl more consistent with the rest of automake.
289-
290+ dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was
291+ dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
292+ dnl more consistent with the rest of automake.
293+ dnl
294 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
295
296- dnl pyexecdir -- directory for installing python extension modules
297- dnl (shared libraries)
298+ dnl 3. pyexecdir: directory for installing python extension modules
299+ dnl (shared libraries).
300 dnl Query distutils for this directory.
301- AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
302- [am_cv_python_pyexecdir],
303- [if test "x$exec_prefix" = xNONE
304- then
305- am_py_exec_prefix=$am_py_prefix
306- else
307- am_py_exec_prefix=$exec_prefix
308- fi
309- am_cv_python_pyexecdir=`$PYTHON -c "
310+ dnl
311+ AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)],
312+ [am_cv_python_pyexecdir],
313+ [if test "x$am_cv_python_exec_prefix" = x; then
314+ am_py_exec_prefix=$am__usable_exec_prefix
315+ else
316+ am_py_exec_prefix=$am_cv_python_exec_prefix
317+ fi
318+ am_cv_python_pyexecdir=`$PYTHON -c "
319 $am_python_setup_sysconfig
320 if can_use_sysconfig:
321- sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
322+ sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'})
323 else:
324- from distutils import sysconfig
325- sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
326+ from distutils import sysconfig
327+ sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
328 sys.stdout.write(sitedir)"`
329- case $am_cv_python_pyexecdir in
330- $am_py_exec_prefix*)
331- am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
332- am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
333- ;;
334- *)
335- case $am_py_exec_prefix in
336- /usr|/System*) ;;
337- *)
338- am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
339- ;;
340- esac
341- ;;
342+ #
343+ case $am_cv_python_pyexecdir in
344+ $am_py_exec_prefix*)
345+ am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
346+ am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"`
347+ ;;
348+ *)
349+ case $am_py_exec_prefix in
350+ /usr|/System*) ;;
351+ *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
352+ ;;
353 esac
354- ])
355+ ;;
356+ esac
357+ ])
358 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
359
360- dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
361-
362+ dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE)
363+ dnl
364 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
365
366 dnl Run any user-specified action.
367 $2
368 fi
369-
370 ])
371
372
373