INN commit: trunk (m4/perl.m4 m4/python.m4 support/getrra-c-util)
INN Commit
rra at isc.org
Tue May 29 20:26:55 UTC 2018
Date: Tuesday, May 29, 2018 @ 13:26:55
Author: iulius
Revision: 10288
Update to latest rra-c-util upstream version, improving Perl and Python support at configure time
Modified:
trunk/m4/perl.m4
trunk/m4/python.m4
trunk/support/getrra-c-util
-----------------------+
m4/perl.m4 | 30 ++++++++++--
m4/python.m4 | 111 ++++++++++++++++++++++++++++++++++++------------
support/getrra-c-util | 1
3 files changed, 109 insertions(+), 33 deletions(-)
Modified: m4/perl.m4
===================================================================
--- m4/perl.m4 2018-05-21 12:42:24 UTC (rev 10287)
+++ m4/perl.m4 2018-05-29 20:26:55 UTC (rev 10288)
@@ -6,20 +6,27 @@
dnl INN_PROG_PERL
dnl Checks for a specific Perl version and sets the PERL environment
dnl variable to the full path, or aborts the configure run if the version
-dnl of Perl is not new enough or couldn't be found.
+dnl of Perl is not new enough or couldn't be found. Marks PERL as a
+dnl substitution variable.
dnl
dnl INN_PERL_CHECK_MODULE
-dnl Checks for the existence of a Perl module and runs provided code based
-dnl on whether or not it was found.
+dnl Checks for the existence of a Perl module. Runs the second argument
+dnl if it is present and the third if it is not.
dnl
dnl INN_LIB_PERL
dnl Determines the flags required for embedding Perl and sets
dnl PERL_CPPFLAGS and PERL_LIBS.
dnl
+dnl INN_PROG_PERL should generally be called before the other two macros. If
+dnl it isn't, the PERL environment variable must be set in some other way.
+dnl (It cannot be run automatically via dependencies because it takes a
+dnl mandatory minimum version argument, which should be provided by the
+dnl calling configure script.)
+dnl
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Copyright 2016 Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2016, 2018 Russ Allbery <eagle at eyrie.org>
dnl Copyright 2006, 2009, 2011 Internet Systems Consortium, Inc. ("ISC")
dnl Copyright 1998-2003 The Internet Software Consortium
dnl
@@ -54,7 +61,8 @@
ac_path_PERL_found=:])])])
AS_IF([test x"$ac_cv_path_PERL" = x],
[AC_MSG_ERROR([Perl $1 or greater is required])])
- PERL="$ac_cv_path_PERL"])])
+ PERL="$ac_cv_path_PERL"
+ AC_SUBST([PERL])])])
dnl Check whether a given Perl module can be loaded. Runs the second argument
dnl if it can, and the third argument if it cannot.
@@ -97,4 +105,14 @@
inn_perl_core_libs=`echo "$inn_perl_core_libs" | sed 's/ *$//'`
PERL_CPPFLAGS="$inn_perl_core_flags"
PERL_LIBS="$inn_perl_core_libs"
- AC_MSG_RESULT([$PERL_LIBS])])
+ AC_MSG_RESULT([$PERL_LIBS])
+ inn_perl_save_CPPFLAGS="$CPPFLAGS"
+ inn_perl_save_LIBS="$LIBS"
+ CPPFLAGS="$PERL_CPPFLAGS $CPPFLAGS"
+ LIBS="$PERL_LIBS $LIBS"
+ AC_CHECK_HEADER([EXTERN.h], [],
+ [AC_MSG_FAILURE([unable to compile with EXTERN.h])])
+ AC_CHECK_FUNC([perl_alloc], [],
+ [AC_MSG_FAILURE([unable to link with Perl library])])
+ CPPFLAGS="$inn_perl_save_CPPFLAGS"
+ LIBS="$inn_perl_save_LIBS"])
Modified: m4/python.m4
===================================================================
--- m4/python.m4 2018-05-21 12:42:24 UTC (rev 10287)
+++ m4/python.m4 2018-05-29 20:26:55 UTC (rev 10288)
@@ -6,7 +6,9 @@
dnl INN_PROG_PYTHON
dnl Checks for a specific Python version and sets the PYTHON environment
dnl variable to the full path, or aborts the configure run if the version
-dnl of Python is not new enough or couldn't be found.
+dnl of Python is not new enough or couldn't be found. Marks PYTHON as a
+dnl substitution variable.
+dnl
dnl The first argument is a Python version related to the 2.x series (if
dnl empty, it means that Python 2 is not supported). The second argument
dnl is a Python version related to at least the 3.x series (if empty,
@@ -13,49 +15,94 @@
dnl it means that Python 3 or later is not supported).
dnl
dnl INN_PYTHON_CHECK_MODULE
-dnl Checks for the existence of a Python module and runs provided code
-dnl based on whether or not it was found.
+dnl Checks for the existence of a Python module. Runs the second argument
+dnl if it is present and the third argument if it is not.
dnl
dnl INN_LIB_PYTHON
dnl Determines the flags required for embedding Python and sets
dnl PYTHON_CPPFLAGS and PYTHON_LIBS.
dnl
-dnl Defines INN_ARG_PYTHON, which sets up the --with-python command line
-dnl argument and also sets various flags needed for embedded Python if it is
-dnl requested.
+dnl INN_PROG_PYTHON should generally be called before the other two macros.
+dnl If it isn't, the PYTHON environment variable must be set in some other
+dnl way. (It cannot be run automatically via dependencies because it takes a
+dnl mandatory minimum version argument, which should be provided by the
+dnl calling configure script.)
dnl
-dnl We use the distutils.sysconfig module shipped with Python 2.2.0 and later
-dnl to find the compiler and linker flags to use to embed Python.
-dnl We also select libpython in the main library location (a shared library
-dnl is present there in Python 2.3.0 and later).
+dnl This macro uses the distutils.sysconfig module shipped with Python 2.2.0
+dnl and later to find the compiler and linker flags to use to embed Python.
+dnl It also expects libpython to be in the main library location, which it is
+dnl since Python 2.3.0.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Copyright 2018 Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2009, 2011, 2015, 2018 Julien ÃLIE <julien at trigofacile.com>
+dnl Copyright 1998-2003 The Internet Software Consortium
+dnl
+dnl Permission to use, copy, modify, and distribute this software for any
+dnl purpose with or without fee is hereby granted, provided that the above
+dnl copyright notice and this permission notice appear in all copies.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+dnl REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
+dnl SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+dnl IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+dnl
+dnl SPDX-License-Identifier: ISC
+dnl Command used to probe the Python version.
+AC_DEFUN([_INN_PROG_PYTHON_CMD], [[
+import sys
+two_okay = False
+three_okay = False
+if sys.argv[1]:
+ two_tuple = tuple(int(i) for i in sys.argv[1].split("."))
+ if sys.version_info.major == 2 and sys.version_info >= two_tuple:
+ two_okay = True
+if sys.argv[2]:
+ three_tuple = tuple(int(i) for i in sys.argv[2].split("."))
+ if sys.version_info.major > 2 and sys.version_info >= three_tuple:
+ three_okay = True
+assert(two_okay or three_okay)
+]])
+
dnl Check for the path to Python and ensure it meets our minimum version
-dnl requirement (given as the argument). Honor the $PYTHON environment
+dnl requirement. The first argument specifies the minimum Python 2 version
+dnl and the second argument specifies the minimum Python 3 (or later) version.
+dnl At least one constraint must be met. Honor the $PYTHON environment
dnl variable, if set.
AC_DEFUN([INN_PROG_PYTHON],
[AC_ARG_VAR([PYTHON], [Location of Python interpreter])
- AS_IF([test x"$1" != x], [py_expected_ver="$1 (in the 2.x series)"],
- [py_expected_ver=""])
+ AS_IF([test x"$1" != x],
+ [inn_py_expected_ver="$1 (2.x series)"],
+ [inn_py_expected_ver=""])
AS_IF([test x"$2" != x],
- [AS_IF([test x"$1" != x], [py_expected_ver="$py_expected_ver or "])
- py_expected_ver="${py_expected_ver}$2"])
+ [AS_IF([test x"$1" != x],
+ [inn_py_expected_ver="$inn_py_expected_ver or "])
+ inn_py_expected_ver="${inn_py_expected_ver}$2"])
AS_IF([test x"$PYTHON" != x],
[AS_IF([! test -x "$PYTHON"],
[AC_MSG_ERROR([Python binary $PYTHON not found])])
- AS_IF([! "$PYTHON" -c 'import sys; assert((False if "$2" == "" else (sys.version_info.major > 2 and sys.version_info >= tuple(int(i) for i in "$2".split(".")))) if "$1" == "" else ((sys.version_info.major == 2 and sys.version_info >= tuple(int(i) for i in "$1".split("."))) if "$2" == "" else ((sys.version_info.major == 2 and sys.version_info >= tuple(int(i) for i in "$1".split("."))) or sys.version_info >= tuple(int(i) for i in "$2".split(".")))))' >/dev/null 2>&1],
- [AC_MSG_ERROR([Python $py_expected_ver or greater is required])])],
- [AC_CACHE_CHECK([for Python version $py_expected_ver or later], [ac_cv_path_PYTHON],
- [AC_PATH_PROGS_FEATURE_CHECK([PYTHON], [python],
- [AS_IF(["$ac_path_PYTHON" -c 'import sys; assert((False if "$2" == "" else (sys.version_info.major > 2 and sys.version_info >= tuple(int(i) for i in "$2".split(".")))) if "$1" == "" else ((sys.version_info.major == 2 and sys.version_info >= tuple(int(i) for i in "$1".split("."))) if "$2" == "" else ((sys.version_info.major == 2 and sys.version_info >= tuple(int(i) for i in "$1".split("."))) or sys.version_info >= tuple(int(i) for i in "$2".split(".")))))' >/dev/null 2>&1],
+ AS_IF([! "$PYTHON" -c '_INN_PROG_PYTHON_CMD()' '$1' '$2' >/dev/null 2>&1],
+ [AC_MSG_ERROR([Python $inn_py_expected_ver or greater is required])])],
+ [AC_CACHE_CHECK([for Python version $inn_py_expected_ver or later],
+ [ac_cv_path_PYTHON],
+ [AC_PATH_PROGS_FEATURE_CHECK([PYTHON], [python python3 python2],
+ [AS_IF(["$ac_path_PYTHON" -c '_INN_PROG_PYTHON_CMD()' \
+ '$1' '$2' >/dev/null 2>&1],
[ac_cv_path_PYTHON="$ac_path_PYTHON"
ac_path_PYTHON_found=:])])])
AS_IF([test x"$ac_cv_path_PYTHON" = x],
- [AC_MSG_ERROR([Python $py_expected_ver or greater is required])])
+ [AC_MSG_ERROR([Python $inn_py_expected_ver or greater is required])])
PYTHON="$ac_cv_path_PYTHON"
AC_SUBST([PYTHON])])])
-dnl Check whether a given Python module can be loaded. Runs the second argument
-dnl if it can, and the third argument if it cannot.
+dnl Check whether a given Python module can be loaded. Runs the second
+dnl argument if it can, and the third argument if it cannot.
AC_DEFUN([INN_PYTHON_CHECK_MODULE],
[AS_LITERAL_IF([$1], [], [m4_fatal([$0: requires literal arguments])])dnl
AS_VAR_PUSHDEF([ac_Module], [inn_cv_python_module_$1])dnl
@@ -78,11 +125,21 @@
print(" -L".join(distutils.sysconfig.get_config_vars("LIBDIR")))'`
py_ldlibrary=`$PYTHON -c 'import distutils.sysconfig; \
print(distutils.sysconfig.get_config_vars("LDLIBRARY")@<:@0@:>@)'`
- py_linkage=`$PYTHON -c 'import distutils.sysconfig; \
- print(" ".join(distutils.sysconfig.get_config_vars("LIBS", \
- "LIBC", "LIBM", "LOCALMODLIBS", "BASEMODLIBS", \
+ py_linkage=`$PYTHON -c 'import distutils.sysconfig; \
+ print(" ".join(distutils.sysconfig.get_config_vars( \
+ "LIBS", "LIBC", "LIBM", "LOCALMODLIBS", "BASEMODLIBS", \
"LINKFORSHARED", "LDFLAGS")))'`
py_libpython=`echo $py_ldlibrary | sed "s/^lib//" | sed "s/\.@<:@a-z@:>@*$//"`
PYTHON_LIBS="-L$py_libdir -l$py_libpython $py_linkage"
PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
- AC_MSG_RESULT([$PYTHON_LIBS])])
+ AC_MSG_RESULT([$PYTHON_LIBS])
+ inn_python_save_CPPFLAGS="$CPPFLAGS"
+ inn_python_save_LIBS="$LIBS"
+ CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
+ LIBS="$PYTHON_LIBS $LIBS"
+ AC_CHECK_HEADER([Python.h], [],
+ [AC_MSG_FAILURE([unable to compile with Python.h])])
+ AC_CHECK_FUNC([Py_Initialize], [],
+ [AC_MSG_FAILURE([unable to link with Python library])])
+ CPPFLAGS="$inn_python_save_CPPFLAGS"
+ LIBS="$inn_python_save_LIBS"])
Modified: support/getrra-c-util
===================================================================
--- support/getrra-c-util 2018-05-21 12:42:24 UTC (rev 10287)
+++ support/getrra-c-util 2018-05-29 20:26:55 UTC (rev 10288)
@@ -244,6 +244,7 @@
download m4/openssl.m4 m4 openssl.m4
download m4/pam-const.m4 m4 pam-const.m4
download m4/perl.m4 m4 perl.m4
+download m4/python.m4 m4 python.m4
download m4/sasl.m4 m4 sasl.m4
download m4/snprintf.m4 m4 snprintf.m4
download m4/socket-unix.m4 m4 socket-unix.m4
More information about the inn-committers
mailing list