mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-29 15:22:30 +03:00
787 lines
29 KiB
Plaintext
787 lines
29 KiB
Plaintext
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
|
|
|
|
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
|
|
|
# This file is free software; the Free Software Foundation
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
# with or without modifications, as long as this notice is preserved.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
# PARTICULAR PURPOSE.
|
|
|
|
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
|
# ===========================================================================
|
|
# https://www.gnu.org/software/autoconf-archive/ax_python_module.html
|
|
# ===========================================================================
|
|
#
|
|
# SYNOPSIS
|
|
#
|
|
# AX_PYTHON_MODULE(modname[, fatal, python])
|
|
#
|
|
# DESCRIPTION
|
|
#
|
|
# Checks for Python module.
|
|
#
|
|
# If fatal is non-empty then absence of a module will trigger an error.
|
|
# The third parameter can either be "python" for Python 2 or "python3" for
|
|
# Python 3; defaults to Python 3.
|
|
#
|
|
# LICENSE
|
|
#
|
|
# Copyright (c) 2008 Andrew Collier
|
|
#
|
|
# Copying and distribution of this file, with or without modification, are
|
|
# permitted in any medium without royalty provided the copyright notice
|
|
# and this notice are preserved. This file is offered as-is, without any
|
|
# warranty.
|
|
|
|
#serial 9
|
|
|
|
AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
|
|
AC_DEFUN([AX_PYTHON_MODULE],[
|
|
if test -z $PYTHON;
|
|
then
|
|
if test -z "$3";
|
|
then
|
|
PYTHON="python3"
|
|
else
|
|
PYTHON="$3"
|
|
fi
|
|
fi
|
|
PYTHON_NAME=`basename $PYTHON`
|
|
AC_MSG_CHECKING($PYTHON_NAME module: $1)
|
|
$PYTHON -c "import $1" 2>/dev/null
|
|
if test $? -eq 0;
|
|
then
|
|
AC_MSG_RESULT(yes)
|
|
eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
eval AS_TR_CPP(HAVE_PYMOD_$1)=no
|
|
#
|
|
if test -n "$2"
|
|
then
|
|
AC_MSG_ERROR(failed to find required module $1)
|
|
exit 1
|
|
fi
|
|
fi
|
|
])
|
|
|
|
# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
|
|
# serial 12 (pkg-config-0.29.2)
|
|
|
|
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
|
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
|
dnl
|
|
dnl This program is free software; you can redistribute it and/or modify
|
|
dnl it under the terms of the GNU General Public License as published by
|
|
dnl the Free Software Foundation; either version 2 of the License, or
|
|
dnl (at your option) any later version.
|
|
dnl
|
|
dnl This program is distributed in the hope that it will be useful, but
|
|
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
dnl General Public License for more details.
|
|
dnl
|
|
dnl You should have received a copy of the GNU General Public License
|
|
dnl along with this program; if not, write to the Free Software
|
|
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
dnl 02111-1307, USA.
|
|
dnl
|
|
dnl As a special exception to the GNU General Public License, if you
|
|
dnl distribute this file as part of a program that contains a
|
|
dnl configuration script generated by Autoconf, you may include it under
|
|
dnl the same distribution terms that you use for the rest of that
|
|
dnl program.
|
|
|
|
dnl PKG_PREREQ(MIN-VERSION)
|
|
dnl -----------------------
|
|
dnl Since: 0.29
|
|
dnl
|
|
dnl Verify that the version of the pkg-config macros are at least
|
|
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
|
dnl installed version of pkg-config, this checks the developer's version
|
|
dnl of pkg.m4 when generating configure.
|
|
dnl
|
|
dnl To ensure that this macro is defined, also add:
|
|
dnl m4_ifndef([PKG_PREREQ],
|
|
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
|
dnl
|
|
dnl See the "Since" comment for each macro you use to see what version
|
|
dnl of the macros you require.
|
|
m4_defun([PKG_PREREQ],
|
|
[m4_define([PKG_MACROS_VERSION], [0.29.2])
|
|
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
|
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
|
])dnl PKG_PREREQ
|
|
|
|
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
|
|
dnl ---------------------------------------------------------
|
|
dnl Since: 0.16
|
|
dnl
|
|
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
|
dnl first found in the path. Checks that the version of pkg-config found
|
|
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
|
dnl used since that's the first version where most current features of
|
|
dnl pkg-config existed.
|
|
dnl
|
|
dnl If pkg-config is not found or older than specified, it will result
|
|
dnl in an empty PKG_CONFIG variable. To avoid widespread issues with
|
|
dnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
|
|
dnl You can specify [PKG_CONFIG=false] as an action instead, which would
|
|
dnl result in pkg-config tests failing, but no bogus error messages.
|
|
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
|
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
|
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
|
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
|
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
|
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
|
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
|
|
|
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
|
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
|
fi
|
|
if test -n "$PKG_CONFIG"; then
|
|
_pkg_min_version=m4_default([$1], [0.9.0])
|
|
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
|
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
|
AC_MSG_RESULT([yes])
|
|
else
|
|
AC_MSG_RESULT([no])
|
|
PKG_CONFIG=""
|
|
fi
|
|
fi
|
|
if test -z "$PKG_CONFIG"; then
|
|
m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
|
|
fi[]dnl
|
|
])dnl PKG_PROG_PKG_CONFIG
|
|
|
|
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
dnl -------------------------------------------------------------------
|
|
dnl Since: 0.18
|
|
dnl
|
|
dnl Check to see whether a particular set of modules exists. Similar to
|
|
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
dnl
|
|
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
dnl only at the first occurrence in configure.ac, so if the first place
|
|
dnl it's called might be skipped (such as if it is within an "if", you
|
|
dnl have to call PKG_CHECK_EXISTS manually
|
|
AC_DEFUN([PKG_CHECK_EXISTS],
|
|
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
if test -n "$PKG_CONFIG" && \
|
|
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
|
m4_default([$2], [:])
|
|
m4_ifvaln([$3], [else
|
|
$3])dnl
|
|
fi])
|
|
|
|
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
|
dnl ---------------------------------------------
|
|
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
|
dnl pkg_failed based on the result.
|
|
m4_define([_PKG_CONFIG],
|
|
[if test -n "$$1"; then
|
|
pkg_cv_[]$1="$$1"
|
|
elif test -n "$PKG_CONFIG"; then
|
|
PKG_CHECK_EXISTS([$3],
|
|
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
|
test "x$?" != "x0" && pkg_failed=yes ],
|
|
[pkg_failed=yes])
|
|
else
|
|
pkg_failed=untried
|
|
fi[]dnl
|
|
])dnl _PKG_CONFIG
|
|
|
|
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
|
dnl ---------------------------
|
|
dnl Internal check to see if pkg-config supports short errors.
|
|
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
|
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
_pkg_short_errors_supported=yes
|
|
else
|
|
_pkg_short_errors_supported=no
|
|
fi[]dnl
|
|
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
|
|
|
|
|
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
dnl [ACTION-IF-NOT-FOUND])
|
|
dnl --------------------------------------------------------------
|
|
dnl Since: 0.4.0
|
|
dnl
|
|
dnl Note that if there is a possibility the first call to
|
|
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
|
AC_DEFUN([PKG_CHECK_MODULES],
|
|
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
|
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
|
|
|
pkg_failed=no
|
|
AC_MSG_CHECKING([for $2])
|
|
|
|
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
|
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
|
|
|
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
|
and $1[]_LIBS to avoid the need to call pkg-config.
|
|
See the pkg-config man page for more details.])
|
|
|
|
if test $pkg_failed = yes; then
|
|
AC_MSG_RESULT([no])
|
|
_PKG_SHORT_ERRORS_SUPPORTED
|
|
if test $_pkg_short_errors_supported = yes; then
|
|
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
|
else
|
|
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
|
fi
|
|
# Put the nasty error message in config.log where it belongs
|
|
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
|
|
|
m4_default([$4], [AC_MSG_ERROR(
|
|
[Package requirements ($2) were not met:
|
|
|
|
$$1_PKG_ERRORS
|
|
|
|
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
|
installed software in a non-standard prefix.
|
|
|
|
_PKG_TEXT])[]dnl
|
|
])
|
|
elif test $pkg_failed = untried; then
|
|
AC_MSG_RESULT([no])
|
|
m4_default([$4], [AC_MSG_FAILURE(
|
|
[The pkg-config script could not be found or is too old. Make sure it
|
|
is in your PATH or set the PKG_CONFIG environment variable to the full
|
|
path to pkg-config.
|
|
|
|
_PKG_TEXT
|
|
|
|
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
|
])
|
|
else
|
|
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
|
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
|
AC_MSG_RESULT([yes])
|
|
$3
|
|
fi[]dnl
|
|
])dnl PKG_CHECK_MODULES
|
|
|
|
|
|
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
dnl [ACTION-IF-NOT-FOUND])
|
|
dnl ---------------------------------------------------------------------
|
|
dnl Since: 0.29
|
|
dnl
|
|
dnl Checks for existence of MODULES and gathers its build flags with
|
|
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
|
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
|
dnl
|
|
dnl Note that if there is a possibility the first call to
|
|
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
|
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
|
dnl configure.ac.
|
|
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
|
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
_save_PKG_CONFIG=$PKG_CONFIG
|
|
PKG_CONFIG="$PKG_CONFIG --static"
|
|
PKG_CHECK_MODULES($@)
|
|
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
|
])dnl PKG_CHECK_MODULES_STATIC
|
|
|
|
|
|
dnl PKG_INSTALLDIR([DIRECTORY])
|
|
dnl -------------------------
|
|
dnl Since: 0.27
|
|
dnl
|
|
dnl Substitutes the variable pkgconfigdir as the location where a module
|
|
dnl should install pkg-config .pc files. By default the directory is
|
|
dnl $libdir/pkgconfig, but the default can be changed by passing
|
|
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
|
dnl parameter.
|
|
AC_DEFUN([PKG_INSTALLDIR],
|
|
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
|
m4_pushdef([pkg_description],
|
|
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
|
AC_ARG_WITH([pkgconfigdir],
|
|
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
|
[with_pkgconfigdir=]pkg_default)
|
|
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
|
m4_popdef([pkg_default])
|
|
m4_popdef([pkg_description])
|
|
])dnl PKG_INSTALLDIR
|
|
|
|
|
|
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
|
dnl --------------------------------
|
|
dnl Since: 0.27
|
|
dnl
|
|
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
|
dnl module should install arch-independent pkg-config .pc files. By
|
|
dnl default the directory is $datadir/pkgconfig, but the default can be
|
|
dnl changed by passing DIRECTORY. The user can override through the
|
|
dnl --with-noarch-pkgconfigdir parameter.
|
|
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
|
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
|
m4_pushdef([pkg_description],
|
|
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
|
AC_ARG_WITH([noarch-pkgconfigdir],
|
|
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
|
[with_noarch_pkgconfigdir=]pkg_default)
|
|
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
|
m4_popdef([pkg_default])
|
|
m4_popdef([pkg_description])
|
|
])dnl PKG_NOARCH_INSTALLDIR
|
|
|
|
|
|
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
|
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
dnl -------------------------------------------
|
|
dnl Since: 0.28
|
|
dnl
|
|
dnl Retrieves the value of the pkg-config variable for the given module.
|
|
AC_DEFUN([PKG_CHECK_VAR],
|
|
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
|
|
|
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
|
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
|
|
|
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
|
])dnl PKG_CHECK_VAR
|
|
|
|
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
|
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
|
|
dnl [DESCRIPTION], [DEFAULT])
|
|
dnl ------------------------------------------
|
|
dnl
|
|
dnl Prepare a "--with-" configure option using the lowercase
|
|
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
|
|
dnl PKG_CHECK_MODULES in a single macro.
|
|
AC_DEFUN([PKG_WITH_MODULES],
|
|
[
|
|
m4_pushdef([with_arg], m4_tolower([$1]))
|
|
|
|
m4_pushdef([description],
|
|
[m4_default([$5], [build with ]with_arg[ support])])
|
|
|
|
m4_pushdef([def_arg], [m4_default([$6], [auto])])
|
|
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
|
|
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
|
|
|
|
m4_case(def_arg,
|
|
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
|
|
[m4_pushdef([with_without],[--with-]with_arg)])
|
|
|
|
AC_ARG_WITH(with_arg,
|
|
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
|
|
[AS_TR_SH([with_]with_arg)=def_arg])
|
|
|
|
AS_CASE([$AS_TR_SH([with_]with_arg)],
|
|
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
|
|
[auto],[PKG_CHECK_MODULES([$1],[$2],
|
|
[m4_n([def_action_if_found]) $3],
|
|
[m4_n([def_action_if_not_found]) $4])])
|
|
|
|
m4_popdef([with_arg])
|
|
m4_popdef([description])
|
|
m4_popdef([def_arg])
|
|
|
|
])dnl PKG_WITH_MODULES
|
|
|
|
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
|
dnl [DESCRIPTION], [DEFAULT])
|
|
dnl -----------------------------------------------
|
|
dnl
|
|
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
|
|
dnl check._[VARIABLE-PREFIX] is exported as make variable.
|
|
AC_DEFUN([PKG_HAVE_WITH_MODULES],
|
|
[
|
|
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
|
|
|
|
AM_CONDITIONAL([HAVE_][$1],
|
|
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
|
|
])dnl PKG_HAVE_WITH_MODULES
|
|
|
|
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
|
dnl [DESCRIPTION], [DEFAULT])
|
|
dnl ------------------------------------------------------
|
|
dnl
|
|
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
|
|
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
|
|
dnl and preprocessor variable.
|
|
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
|
|
[
|
|
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
|
|
|
|
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
|
|
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
|
|
])dnl PKG_HAVE_DEFINE_WITH_MODULES
|
|
|
|
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
|
#
|
|
# This file is free software; the Free Software Foundation
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
# with or without modifications, as long as this notice is preserved.
|
|
|
|
|
|
# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
# ---------------------------------------------------------------------------
|
|
# Adds support for distributing Python modules and packages. To
|
|
# install modules, copy them to $(pythondir), using the python_PYTHON
|
|
# automake variable. To install a package with the same name as the
|
|
# automake package, install to $(pkgpythondir), or use the
|
|
# pkgpython_PYTHON automake variable.
|
|
#
|
|
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
|
|
# locations to install python extension modules (shared libraries).
|
|
# Another macro is required to find the appropriate flags to compile
|
|
# extension modules.
|
|
#
|
|
# If your package is configured with a different prefix to python,
|
|
# users will have to add the install directory to the PYTHONPATH
|
|
# environment variable, or create a .pth file (see the python
|
|
# documentation for details).
|
|
#
|
|
# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
|
|
# cause an error if the version of python installed on the system
|
|
# doesn't meet the requirement. MINIMUM-VERSION should consist of
|
|
# numbers and dots only.
|
|
AC_DEFUN([AM_PATH_PYTHON],
|
|
[
|
|
dnl Find a Python interpreter. Python versions prior to 2.0 are not
|
|
dnl supported. (2.0 was released on October 16, 2000).
|
|
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
|
|
[python python2 python3 dnl
|
|
python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
|
|
python3.2 python3.1 python3.0 dnl
|
|
python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
|
|
python2.0])
|
|
|
|
AC_ARG_VAR([PYTHON], [the Python interpreter])
|
|
|
|
m4_if([$1],[],[
|
|
dnl No version check is needed.
|
|
# Find any Python interpreter.
|
|
if test -z "$PYTHON"; then
|
|
AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
|
|
fi
|
|
am_display_PYTHON=python
|
|
], [
|
|
dnl A version check is needed.
|
|
if test -n "$PYTHON"; then
|
|
# If the user set $PYTHON, use it and don't search something else.
|
|
AC_MSG_CHECKING([whether $PYTHON version is >= $1])
|
|
AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
|
|
[AC_MSG_RESULT([yes])],
|
|
[AC_MSG_RESULT([no])
|
|
AC_MSG_ERROR([Python interpreter is too old])])
|
|
am_display_PYTHON=$PYTHON
|
|
else
|
|
# Otherwise, try each interpreter until we find one that satisfies
|
|
# VERSION.
|
|
AC_CACHE_CHECK([for a Python interpreter with version >= $1],
|
|
[am_cv_pathless_PYTHON],[
|
|
for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
|
|
test "$am_cv_pathless_PYTHON" = none && break
|
|
AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
|
|
done])
|
|
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
|
|
if test "$am_cv_pathless_PYTHON" = none; then
|
|
PYTHON=:
|
|
else
|
|
AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
|
|
fi
|
|
am_display_PYTHON=$am_cv_pathless_PYTHON
|
|
fi
|
|
])
|
|
|
|
if test "$PYTHON" = :; then
|
|
dnl Run any user-specified action, or abort.
|
|
m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
|
|
else
|
|
|
|
dnl Query Python for its version number. Although site.py simply uses
|
|
dnl sys.version[:3], printing that failed with Python 3.10, since the
|
|
dnl trailing zero was eliminated. So now we output just the major
|
|
dnl and minor version numbers, as numbers. Apparently the tertiary
|
|
dnl version is not of interest.
|
|
dnl
|
|
AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
|
|
[am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
|
|
AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
|
|
|
|
dnl At times, e.g., when building shared libraries, you may want
|
|
dnl to know which OS platform Python thinks this is.
|
|
dnl
|
|
AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
|
|
[am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
|
|
AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
|
|
|
|
dnl emacs-page
|
|
dnl If --with-python-sys-prefix is given, use the values of sys.prefix
|
|
dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX
|
|
dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and
|
|
dnl ${exec_prefix} variables.
|
|
dnl
|
|
dnl The two are made distinct variables so they can be overridden if
|
|
dnl need be, although general consensus is that you shouldn't need
|
|
dnl this separation.
|
|
dnl
|
|
dnl Also allow directly setting the prefixes via configure options,
|
|
dnl overriding any default.
|
|
dnl
|
|
if test "x$prefix" = xNONE; then
|
|
am__usable_prefix=$ac_default_prefix
|
|
else
|
|
am__usable_prefix=$prefix
|
|
fi
|
|
|
|
# Allow user to request using sys.* values from Python,
|
|
# instead of the GNU $prefix values.
|
|
AC_ARG_WITH([python-sys-prefix],
|
|
[AS_HELP_STRING([--with-python-sys-prefix],
|
|
[use Python's sys.prefix and sys.exec_prefix values])],
|
|
[am_use_python_sys=:],
|
|
[am_use_python_sys=false])
|
|
|
|
# Allow user to override whatever the default Python prefix is.
|
|
AC_ARG_WITH([python_prefix],
|
|
[AS_HELP_STRING([--with-python_prefix],
|
|
[override the default PYTHON_PREFIX])],
|
|
[am_python_prefix_subst=$withval
|
|
am_cv_python_prefix=$withval
|
|
AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix])
|
|
AC_MSG_RESULT([$am_cv_python_prefix])],
|
|
[
|
|
if $am_use_python_sys; then
|
|
# using python sys.prefix value, not GNU
|
|
AC_CACHE_CHECK([for python default $am_display_PYTHON prefix],
|
|
[am_cv_python_prefix],
|
|
[am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`])
|
|
|
|
dnl If sys.prefix is a subdir of $prefix, replace the literal value of
|
|
dnl $prefix with a variable reference so it can be overridden.
|
|
case $am_cv_python_prefix in
|
|
$am__usable_prefix*)
|
|
am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'`
|
|
am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"`
|
|
;;
|
|
*)
|
|
am_python_prefix_subst=$am_cv_python_prefix
|
|
;;
|
|
esac
|
|
else # using GNU prefix value, not python sys.prefix
|
|
am_python_prefix_subst='${prefix}'
|
|
am_python_prefix=$am_python_prefix_subst
|
|
AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix])
|
|
AC_MSG_RESULT([$am_python_prefix])
|
|
fi])
|
|
# Substituting python_prefix_subst value.
|
|
AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst])
|
|
|
|
# emacs-page Now do it all over again for Python exec_prefix, but with yet
|
|
# another conditional: fall back to regular prefix if that was specified.
|
|
AC_ARG_WITH([python_exec_prefix],
|
|
[AS_HELP_STRING([--with-python_exec_prefix],
|
|
[override the default PYTHON_EXEC_PREFIX])],
|
|
[am_python_exec_prefix_subst=$withval
|
|
am_cv_python_exec_prefix=$withval
|
|
AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix])
|
|
AC_MSG_RESULT([$am_cv_python_exec_prefix])],
|
|
[
|
|
# no explicit --with-python_exec_prefix, but if
|
|
# --with-python_prefix was given, use its value for python_exec_prefix too.
|
|
AS_IF([test -n "$with_python_prefix"],
|
|
[am_python_exec_prefix_subst=$with_python_prefix
|
|
am_cv_python_exec_prefix=$with_python_prefix
|
|
AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix])
|
|
AC_MSG_RESULT([$am_cv_python_exec_prefix])],
|
|
[
|
|
# Set am__usable_exec_prefix whether using GNU or Python values,
|
|
# since we use that variable for pyexecdir.
|
|
if test "x$exec_prefix" = xNONE; then
|
|
am__usable_exec_prefix=$am__usable_prefix
|
|
else
|
|
am__usable_exec_prefix=$exec_prefix
|
|
fi
|
|
#
|
|
if $am_use_python_sys; then # using python sys.exec_prefix, not GNU
|
|
AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix],
|
|
[am_cv_python_exec_prefix],
|
|
[am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`])
|
|
dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the
|
|
dnl literal value of $exec_prefix with a variable reference so it can
|
|
dnl be overridden.
|
|
case $am_cv_python_exec_prefix in
|
|
$am__usable_exec_prefix*)
|
|
am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'`
|
|
am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"`
|
|
;;
|
|
*)
|
|
am_python_exec_prefix_subst=$am_cv_python_exec_prefix
|
|
;;
|
|
esac
|
|
else # using GNU $exec_prefix, not python sys.exec_prefix
|
|
am_python_exec_prefix_subst='${exec_prefix}'
|
|
am_python_exec_prefix=$am_python_exec_prefix_subst
|
|
AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix])
|
|
AC_MSG_RESULT([$am_python_exec_prefix])
|
|
fi])])
|
|
# Substituting python_exec_prefix_subst.
|
|
AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst])
|
|
|
|
# Factor out some code duplication into this shell variable.
|
|
am_python_setup_sysconfig="\
|
|
import sys
|
|
# Prefer sysconfig over distutils.sysconfig, for better compatibility
|
|
# with python 3.x. See automake bug#10227.
|
|
try:
|
|
import sysconfig
|
|
except ImportError:
|
|
can_use_sysconfig = 0
|
|
else:
|
|
can_use_sysconfig = 1
|
|
# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
|
|
# <https://github.com/pypa/virtualenv/issues/118>
|
|
try:
|
|
from platform import python_implementation
|
|
if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
|
|
can_use_sysconfig = 0
|
|
except ImportError:
|
|
pass"
|
|
|
|
dnl emacs-page Set up 4 directories:
|
|
|
|
dnl 1. pythondir: where to install python scripts. This is the
|
|
dnl site-packages directory, not the python standard library
|
|
dnl directory like in previous automake betas. This behavior
|
|
dnl is more consistent with lispdir.m4 for example.
|
|
dnl Query distutils for this directory.
|
|
dnl
|
|
AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
|
|
[am_cv_python_pythondir],
|
|
[if test "x$am_cv_python_prefix" = x; then
|
|
am_py_prefix=$am__usable_prefix
|
|
else
|
|
am_py_prefix=$am_cv_python_prefix
|
|
fi
|
|
am_cv_python_pythondir=`$PYTHON -c "
|
|
$am_python_setup_sysconfig
|
|
if can_use_sysconfig:
|
|
sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
|
|
else:
|
|
from distutils import sysconfig
|
|
sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
|
|
sys.stdout.write(sitedir)"`
|
|
#
|
|
case $am_cv_python_pythondir in
|
|
$am_py_prefix*)
|
|
am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
|
|
am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"`
|
|
;;
|
|
*)
|
|
case $am_py_prefix in
|
|
/usr|/System*) ;;
|
|
*) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
])
|
|
AC_SUBST([pythondir], [$am_cv_python_pythondir])
|
|
|
|
dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was
|
|
dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
|
|
dnl more consistent with the rest of automake.
|
|
dnl
|
|
AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
|
|
|
|
dnl 3. pyexecdir: directory for installing python extension modules
|
|
dnl (shared libraries).
|
|
dnl Query distutils for this directory.
|
|
dnl
|
|
AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)],
|
|
[am_cv_python_pyexecdir],
|
|
[if test "x$am_cv_python_exec_prefix" = x; then
|
|
am_py_exec_prefix=$am__usable_exec_prefix
|
|
else
|
|
am_py_exec_prefix=$am_cv_python_exec_prefix
|
|
fi
|
|
am_cv_python_pyexecdir=`$PYTHON -c "
|
|
$am_python_setup_sysconfig
|
|
if can_use_sysconfig:
|
|
sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'})
|
|
else:
|
|
from distutils import sysconfig
|
|
sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
|
|
sys.stdout.write(sitedir)"`
|
|
#
|
|
case $am_cv_python_pyexecdir in
|
|
$am_py_exec_prefix*)
|
|
am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
|
|
am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"`
|
|
;;
|
|
*)
|
|
case $am_py_exec_prefix in
|
|
/usr|/System*) ;;
|
|
*) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
])
|
|
AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
|
|
|
|
dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE)
|
|
dnl
|
|
AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
|
|
|
|
dnl Run any user-specified action.
|
|
$2
|
|
fi
|
|
])
|
|
|
|
|
|
# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
|
# ---------------------------------------------------------------------------
|
|
# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
|
|
# Run ACTION-IF-FALSE otherwise.
|
|
# This test uses sys.hexversion instead of the string equivalent (first
|
|
# word of sys.version), in order to cope with versions such as 2.2c1.
|
|
# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
|
|
AC_DEFUN([AM_PYTHON_CHECK_VERSION],
|
|
[prog="import sys
|
|
# split strings by '.' and convert to numeric. Append some zeros
|
|
# because we need at least 4 digits for the hex conversion.
|
|
# map returns an iterator in Python 3.0 and a list in 2.x
|
|
minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
|
|
minverhex = 0
|
|
# xrange is not present in Python 3.0 and range returns an iterator
|
|
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
|
|
sys.exit(sys.hexversion < minverhex)"
|
|
AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
|
|
|
|
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
|
#
|
|
# This file is free software; the Free Software Foundation
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
# with or without modifications, as long as this notice is preserved.
|
|
|
|
# AM_RUN_LOG(COMMAND)
|
|
# -------------------
|
|
# Run COMMAND, save the exit status in ac_status, and log it.
|
|
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
|
|
AC_DEFUN([AM_RUN_LOG],
|
|
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
|
|
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
|
|
ac_status=$?
|
|
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
|
|
(exit $ac_status); }])
|
|
|
|
m4_include([acinclude.m4])
|