]> sourceware.org Git - lvm2.git/blame_incremental - aclocal.m4
metadata: use lv_hash in segment-specific metadata parsing
[lvm2.git] / aclocal.m4
... / ...
CommitLineData
1# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2
3# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15# ===========================================================================
16# https://www.gnu.org/software/autoconf-archive/ax_python_module.html
17# ===========================================================================
18#
19# SYNOPSIS
20#
21# AX_PYTHON_MODULE(modname[, fatal, python])
22#
23# DESCRIPTION
24#
25# Checks for Python module.
26#
27# If fatal is non-empty then absence of a module will trigger an error.
28# The third parameter can either be "python" for Python 2 or "python3" for
29# Python 3; defaults to Python 3.
30#
31# LICENSE
32#
33# Copyright (c) 2008 Andrew Collier
34#
35# Copying and distribution of this file, with or without modification, are
36# permitted in any medium without royalty provided the copyright notice
37# and this notice are preserved. This file is offered as-is, without any
38# warranty.
39
40#serial 9
41
42AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
43AC_DEFUN([AX_PYTHON_MODULE],[
44 if test -z $PYTHON;
45 then
46 if test -z "$3";
47 then
48 PYTHON="python3"
49 else
50 PYTHON="$3"
51 fi
52 fi
53 PYTHON_NAME=`basename $PYTHON`
54 AC_MSG_CHECKING($PYTHON_NAME module: $1)
55 $PYTHON -c "import $1" 2>/dev/null
56 if test $? -eq 0;
57 then
58 AC_MSG_RESULT(yes)
59 eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
60 else
61 AC_MSG_RESULT(no)
62 eval AS_TR_CPP(HAVE_PYMOD_$1)=no
63 #
64 if test -n "$2"
65 then
66 AC_MSG_ERROR(failed to find required module $1)
67 exit 1
68 fi
69 fi
70])
71
72# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
73# serial 12 (pkg-config-0.29.2)
74
75dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
76dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
77dnl
78dnl This program is free software; you can redistribute it and/or modify
79dnl it under the terms of the GNU General Public License as published by
80dnl the Free Software Foundation; either version 2 of the License, or
81dnl (at your option) any later version.
82dnl
83dnl This program is distributed in the hope that it will be useful, but
84dnl WITHOUT ANY WARRANTY; without even the implied warranty of
85dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
86dnl General Public License for more details.
87dnl
88dnl You should have received a copy of the GNU General Public License
89dnl along with this program; if not, write to the Free Software
90dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
91dnl 02111-1307, USA.
92dnl
93dnl As a special exception to the GNU General Public License, if you
94dnl distribute this file as part of a program that contains a
95dnl configuration script generated by Autoconf, you may include it under
96dnl the same distribution terms that you use for the rest of that
97dnl program.
98
99dnl PKG_PREREQ(MIN-VERSION)
100dnl -----------------------
101dnl Since: 0.29
102dnl
103dnl Verify that the version of the pkg-config macros are at least
104dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
105dnl installed version of pkg-config, this checks the developer's version
106dnl of pkg.m4 when generating configure.
107dnl
108dnl To ensure that this macro is defined, also add:
109dnl m4_ifndef([PKG_PREREQ],
110dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
111dnl
112dnl See the "Since" comment for each macro you use to see what version
113dnl of the macros you require.
114m4_defun([PKG_PREREQ],
115[m4_define([PKG_MACROS_VERSION], [0.29.2])
116m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
117 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
118])dnl PKG_PREREQ
119
120dnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
121dnl ---------------------------------------------------------
122dnl Since: 0.16
123dnl
124dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
125dnl first found in the path. Checks that the version of pkg-config found
126dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
127dnl used since that's the first version where most current features of
128dnl pkg-config existed.
129dnl
130dnl If pkg-config is not found or older than specified, it will result
131dnl in an empty PKG_CONFIG variable. To avoid widespread issues with
132dnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
133dnl You can specify [PKG_CONFIG=false] as an action instead, which would
134dnl result in pkg-config tests failing, but no bogus error messages.
135AC_DEFUN([PKG_PROG_PKG_CONFIG],
136[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
137m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
138m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
139AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
140AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
141AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
142
143if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
144 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
145fi
146if test -n "$PKG_CONFIG"; then
147 _pkg_min_version=m4_default([$1], [0.9.0])
148 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
149 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
150 AC_MSG_RESULT([yes])
151 else
152 AC_MSG_RESULT([no])
153 PKG_CONFIG=""
154 fi
155fi
156if test -z "$PKG_CONFIG"; then
157 m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
158fi[]dnl
159])dnl PKG_PROG_PKG_CONFIG
160
161dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
162dnl -------------------------------------------------------------------
163dnl Since: 0.18
164dnl
165dnl Check to see whether a particular set of modules exists. Similar to
166dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
167dnl
168dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
169dnl only at the first occurrence in configure.ac, so if the first place
170dnl it's called might be skipped (such as if it is within an "if", you
171dnl have to call PKG_CHECK_EXISTS manually
172AC_DEFUN([PKG_CHECK_EXISTS],
173[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
174if test -n "$PKG_CONFIG" && \
175 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
176 m4_default([$2], [:])
177m4_ifvaln([$3], [else
178 $3])dnl
179fi])
180
181dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
182dnl ---------------------------------------------
183dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
184dnl pkg_failed based on the result.
185m4_define([_PKG_CONFIG],
186[if test -n "$$1"; then
187 pkg_cv_[]$1="$$1"
188 elif test -n "$PKG_CONFIG"; then
189 PKG_CHECK_EXISTS([$3],
190 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
191 test "x$?" != "x0" && pkg_failed=yes ],
192 [pkg_failed=yes])
193 else
194 pkg_failed=untried
195fi[]dnl
196])dnl _PKG_CONFIG
197
198dnl _PKG_SHORT_ERRORS_SUPPORTED
199dnl ---------------------------
200dnl Internal check to see if pkg-config supports short errors.
201AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
202[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
203if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
204 _pkg_short_errors_supported=yes
205else
206 _pkg_short_errors_supported=no
207fi[]dnl
208])dnl _PKG_SHORT_ERRORS_SUPPORTED
209
210
211dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
212dnl [ACTION-IF-NOT-FOUND])
213dnl --------------------------------------------------------------
214dnl Since: 0.4.0
215dnl
216dnl Note that if there is a possibility the first call to
217dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
218dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
219AC_DEFUN([PKG_CHECK_MODULES],
220[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
221AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
222AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
223
224pkg_failed=no
225AC_MSG_CHECKING([for $2])
226
227_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
228_PKG_CONFIG([$1][_LIBS], [libs], [$2])
229
230m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
231and $1[]_LIBS to avoid the need to call pkg-config.
232See the pkg-config man page for more details.])
233
234if test $pkg_failed = yes; then
235 AC_MSG_RESULT([no])
236 _PKG_SHORT_ERRORS_SUPPORTED
237 if test $_pkg_short_errors_supported = yes; then
238 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
239 else
240 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
241 fi
242 # Put the nasty error message in config.log where it belongs
243 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
244
245 m4_default([$4], [AC_MSG_ERROR(
246[Package requirements ($2) were not met:
247
248$$1_PKG_ERRORS
249
250Consider adjusting the PKG_CONFIG_PATH environment variable if you
251installed software in a non-standard prefix.
252
253_PKG_TEXT])[]dnl
254 ])
255elif test $pkg_failed = untried; then
256 AC_MSG_RESULT([no])
257 m4_default([$4], [AC_MSG_FAILURE(
258[The pkg-config script could not be found or is too old. Make sure it
259is in your PATH or set the PKG_CONFIG environment variable to the full
260path to pkg-config.
261
262_PKG_TEXT
263
264To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
265 ])
266else
267 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
268 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
269 AC_MSG_RESULT([yes])
270 $3
271fi[]dnl
272])dnl PKG_CHECK_MODULES
273
274
275dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
276dnl [ACTION-IF-NOT-FOUND])
277dnl ---------------------------------------------------------------------
278dnl Since: 0.29
279dnl
280dnl Checks for existence of MODULES and gathers its build flags with
281dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
282dnl and VARIABLE-PREFIX_LIBS from --libs.
283dnl
284dnl Note that if there is a possibility the first call to
285dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
286dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
287dnl configure.ac.
288AC_DEFUN([PKG_CHECK_MODULES_STATIC],
289[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
290_save_PKG_CONFIG=$PKG_CONFIG
291PKG_CONFIG="$PKG_CONFIG --static"
292PKG_CHECK_MODULES($@)
293PKG_CONFIG=$_save_PKG_CONFIG[]dnl
294])dnl PKG_CHECK_MODULES_STATIC
295
296
297dnl PKG_INSTALLDIR([DIRECTORY])
298dnl -------------------------
299dnl Since: 0.27
300dnl
301dnl Substitutes the variable pkgconfigdir as the location where a module
302dnl should install pkg-config .pc files. By default the directory is
303dnl $libdir/pkgconfig, but the default can be changed by passing
304dnl DIRECTORY. The user can override through the --with-pkgconfigdir
305dnl parameter.
306AC_DEFUN([PKG_INSTALLDIR],
307[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
308m4_pushdef([pkg_description],
309 [pkg-config installation directory @<:@]pkg_default[@:>@])
310AC_ARG_WITH([pkgconfigdir],
311 [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
312 [with_pkgconfigdir=]pkg_default)
313AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
314m4_popdef([pkg_default])
315m4_popdef([pkg_description])
316])dnl PKG_INSTALLDIR
317
318
319dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
320dnl --------------------------------
321dnl Since: 0.27
322dnl
323dnl Substitutes the variable noarch_pkgconfigdir as the location where a
324dnl module should install arch-independent pkg-config .pc files. By
325dnl default the directory is $datadir/pkgconfig, but the default can be
326dnl changed by passing DIRECTORY. The user can override through the
327dnl --with-noarch-pkgconfigdir parameter.
328AC_DEFUN([PKG_NOARCH_INSTALLDIR],
329[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
330m4_pushdef([pkg_description],
331 [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
332AC_ARG_WITH([noarch-pkgconfigdir],
333 [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
334 [with_noarch_pkgconfigdir=]pkg_default)
335AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
336m4_popdef([pkg_default])
337m4_popdef([pkg_description])
338])dnl PKG_NOARCH_INSTALLDIR
339
340
341dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
342dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
343dnl -------------------------------------------
344dnl Since: 0.28
345dnl
346dnl Retrieves the value of the pkg-config variable for the given module.
347AC_DEFUN([PKG_CHECK_VAR],
348[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
349AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
350
351_PKG_CONFIG([$1], [variable="][$3]["], [$2])
352AS_VAR_COPY([$1], [pkg_cv_][$1])
353
354AS_VAR_IF([$1], [""], [$5], [$4])dnl
355])dnl PKG_CHECK_VAR
356
357dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
358dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
359dnl [DESCRIPTION], [DEFAULT])
360dnl ------------------------------------------
361dnl
362dnl Prepare a "--with-" configure option using the lowercase
363dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
364dnl PKG_CHECK_MODULES in a single macro.
365AC_DEFUN([PKG_WITH_MODULES],
366[
367m4_pushdef([with_arg], m4_tolower([$1]))
368
369m4_pushdef([description],
370 [m4_default([$5], [build with ]with_arg[ support])])
371
372m4_pushdef([def_arg], [m4_default([$6], [auto])])
373m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
374m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
375
376m4_case(def_arg,
377 [yes],[m4_pushdef([with_without], [--without-]with_arg)],
378 [m4_pushdef([with_without],[--with-]with_arg)])
379
380AC_ARG_WITH(with_arg,
381 AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
382 [AS_TR_SH([with_]with_arg)=def_arg])
383
384AS_CASE([$AS_TR_SH([with_]with_arg)],
385 [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
386 [auto],[PKG_CHECK_MODULES([$1],[$2],
387 [m4_n([def_action_if_found]) $3],
388 [m4_n([def_action_if_not_found]) $4])])
389
390m4_popdef([with_arg])
391m4_popdef([description])
392m4_popdef([def_arg])
393
394])dnl PKG_WITH_MODULES
395
396dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
397dnl [DESCRIPTION], [DEFAULT])
398dnl -----------------------------------------------
399dnl
400dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
401dnl check._[VARIABLE-PREFIX] is exported as make variable.
402AC_DEFUN([PKG_HAVE_WITH_MODULES],
403[
404PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
405
406AM_CONDITIONAL([HAVE_][$1],
407 [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
408])dnl PKG_HAVE_WITH_MODULES
409
410dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
411dnl [DESCRIPTION], [DEFAULT])
412dnl ------------------------------------------------------
413dnl
414dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
415dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
416dnl and preprocessor variable.
417AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
418[
419PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
420
421AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
422 [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
423])dnl PKG_HAVE_DEFINE_WITH_MODULES
424
425# Copyright (C) 1999-2021 Free Software Foundation, Inc.
426#
427# This file is free software; the Free Software Foundation
428# gives unlimited permission to copy and/or distribute it,
429# with or without modifications, as long as this notice is preserved.
430
431
432# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
433# ---------------------------------------------------------------------------
434# Adds support for distributing Python modules and packages. To
435# install modules, copy them to $(pythondir), using the python_PYTHON
436# automake variable. To install a package with the same name as the
437# automake package, install to $(pkgpythondir), or use the
438# pkgpython_PYTHON automake variable.
439#
440# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
441# locations to install python extension modules (shared libraries).
442# Another macro is required to find the appropriate flags to compile
443# extension modules.
444#
445# If your package is configured with a different prefix to python,
446# users will have to add the install directory to the PYTHONPATH
447# environment variable, or create a .pth file (see the python
448# documentation for details).
449#
450# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
451# cause an error if the version of python installed on the system
452# doesn't meet the requirement. MINIMUM-VERSION should consist of
453# numbers and dots only.
454AC_DEFUN([AM_PATH_PYTHON],
455 [
456 dnl Find a Python interpreter. Python versions prior to 2.0 are not
457 dnl supported. (2.0 was released on October 16, 2000).
458 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
459[python python2 python3 dnl
460 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
461 python3.2 python3.1 python3.0 dnl
462 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
463 python2.0])
464
465 AC_ARG_VAR([PYTHON], [the Python interpreter])
466
467 m4_if([$1],[],[
468 dnl No version check is needed.
469 # Find any Python interpreter.
470 if test -z "$PYTHON"; then
471 AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
472 fi
473 am_display_PYTHON=python
474 ], [
475 dnl A version check is needed.
476 if test -n "$PYTHON"; then
477 # If the user set $PYTHON, use it and don't search something else.
478 AC_MSG_CHECKING([whether $PYTHON version is >= $1])
479 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
480 [AC_MSG_RESULT([yes])],
481 [AC_MSG_RESULT([no])
482 AC_MSG_ERROR([Python interpreter is too old])])
483 am_display_PYTHON=$PYTHON
484 else
485 # Otherwise, try each interpreter until we find one that satisfies
486 # VERSION.
487 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
488 [am_cv_pathless_PYTHON],[
489 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
490 test "$am_cv_pathless_PYTHON" = none && break
491 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
492 done])
493 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
494 if test "$am_cv_pathless_PYTHON" = none; then
495 PYTHON=:
496 else
497 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
498 fi
499 am_display_PYTHON=$am_cv_pathless_PYTHON
500 fi
501 ])
502
503 if test "$PYTHON" = :; then
504 dnl Run any user-specified action, or abort.
505 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
506 else
507
508 dnl Query Python for its version number. Although site.py simply uses
509 dnl sys.version[:3], printing that failed with Python 3.10, since the
510 dnl trailing zero was eliminated. So now we output just the major
511 dnl and minor version numbers, as numbers. Apparently the tertiary
512 dnl version is not of interest.
513 dnl
514 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
515 [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
516 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
517
518 dnl At times, e.g., when building shared libraries, you may want
519 dnl to know which OS platform Python thinks this is.
520 dnl
521 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
522 [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
523 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
524
525 dnl emacs-page
526 dnl If --with-python-sys-prefix is given, use the values of sys.prefix
527 dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX
528 dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and
529 dnl ${exec_prefix} variables.
530 dnl
531 dnl The two are made distinct variables so they can be overridden if
532 dnl need be, although general consensus is that you shouldn't need
533 dnl this separation.
534 dnl
535 dnl Also allow directly setting the prefixes via configure options,
536 dnl overriding any default.
537 dnl
538 if test "x$prefix" = xNONE; then
539 am__usable_prefix=$ac_default_prefix
540 else
541 am__usable_prefix=$prefix
542 fi
543
544 # Allow user to request using sys.* values from Python,
545 # instead of the GNU $prefix values.
546 AC_ARG_WITH([python-sys-prefix],
547 [AS_HELP_STRING([--with-python-sys-prefix],
548 [use Python's sys.prefix and sys.exec_prefix values])],
549 [am_use_python_sys=:],
550 [am_use_python_sys=false])
551
552 # Allow user to override whatever the default Python prefix is.
553 AC_ARG_WITH([python_prefix],
554 [AS_HELP_STRING([--with-python_prefix],
555 [override the default PYTHON_PREFIX])],
556 [am_python_prefix_subst=$withval
557 am_cv_python_prefix=$withval
558 AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix])
559 AC_MSG_RESULT([$am_cv_python_prefix])],
560 [
561 if $am_use_python_sys; then
562 # using python sys.prefix value, not GNU
563 AC_CACHE_CHECK([for python default $am_display_PYTHON prefix],
564 [am_cv_python_prefix],
565 [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`])
566
567 dnl If sys.prefix is a subdir of $prefix, replace the literal value of
568 dnl $prefix with a variable reference so it can be overridden.
569 case $am_cv_python_prefix in
570 $am__usable_prefix*)
571 am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'`
572 am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"`
573 ;;
574 *)
575 am_python_prefix_subst=$am_cv_python_prefix
576 ;;
577 esac
578 else # using GNU prefix value, not python sys.prefix
579 am_python_prefix_subst='${prefix}'
580 am_python_prefix=$am_python_prefix_subst
581 AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix])
582 AC_MSG_RESULT([$am_python_prefix])
583 fi])
584 # Substituting python_prefix_subst value.
585 AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst])
586
587 # emacs-page Now do it all over again for Python exec_prefix, but with yet
588 # another conditional: fall back to regular prefix if that was specified.
589 AC_ARG_WITH([python_exec_prefix],
590 [AS_HELP_STRING([--with-python_exec_prefix],
591 [override the default PYTHON_EXEC_PREFIX])],
592 [am_python_exec_prefix_subst=$withval
593 am_cv_python_exec_prefix=$withval
594 AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix])
595 AC_MSG_RESULT([$am_cv_python_exec_prefix])],
596 [
597 # no explicit --with-python_exec_prefix, but if
598 # --with-python_prefix was given, use its value for python_exec_prefix too.
599 AS_IF([test -n "$with_python_prefix"],
600 [am_python_exec_prefix_subst=$with_python_prefix
601 am_cv_python_exec_prefix=$with_python_prefix
602 AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix])
603 AC_MSG_RESULT([$am_cv_python_exec_prefix])],
604 [
605 # Set am__usable_exec_prefix whether using GNU or Python values,
606 # since we use that variable for pyexecdir.
607 if test "x$exec_prefix" = xNONE; then
608 am__usable_exec_prefix=$am__usable_prefix
609 else
610 am__usable_exec_prefix=$exec_prefix
611 fi
612 #
613 if $am_use_python_sys; then # using python sys.exec_prefix, not GNU
614 AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix],
615 [am_cv_python_exec_prefix],
616 [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`])
617 dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the
618 dnl literal value of $exec_prefix with a variable reference so it can
619 dnl be overridden.
620 case $am_cv_python_exec_prefix in
621 $am__usable_exec_prefix*)
622 am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'`
623 am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"`
624 ;;
625 *)
626 am_python_exec_prefix_subst=$am_cv_python_exec_prefix
627 ;;
628 esac
629 else # using GNU $exec_prefix, not python sys.exec_prefix
630 am_python_exec_prefix_subst='${exec_prefix}'
631 am_python_exec_prefix=$am_python_exec_prefix_subst
632 AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix])
633 AC_MSG_RESULT([$am_python_exec_prefix])
634 fi])])
635 # Substituting python_exec_prefix_subst.
636 AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst])
637
638 # Factor out some code duplication into this shell variable.
639 am_python_setup_sysconfig="\
640import sys
641# Prefer sysconfig over distutils.sysconfig, for better compatibility
642# with python 3.x. See automake bug#10227.
643try:
644 import sysconfig
645except ImportError:
646 can_use_sysconfig = 0
647else:
648 can_use_sysconfig = 1
649# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
650# <https://github.com/pypa/virtualenv/issues/118>
651try:
652 from platform import python_implementation
653 if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
654 can_use_sysconfig = 0
655except ImportError:
656 pass"
657
658 dnl emacs-page Set up 4 directories:
659
660 dnl 1. pythondir: where to install python scripts. This is the
661 dnl site-packages directory, not the python standard library
662 dnl directory like in previous automake betas. This behavior
663 dnl is more consistent with lispdir.m4 for example.
664 dnl Query distutils for this directory.
665 dnl
666 AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
667 [am_cv_python_pythondir],
668 [if test "x$am_cv_python_prefix" = x; then
669 am_py_prefix=$am__usable_prefix
670 else
671 am_py_prefix=$am_cv_python_prefix
672 fi
673 am_cv_python_pythondir=`$PYTHON -c "
674$am_python_setup_sysconfig
675if can_use_sysconfig:
676 sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
677else:
678 from distutils import sysconfig
679 sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
680sys.stdout.write(sitedir)"`
681 #
682 case $am_cv_python_pythondir in
683 $am_py_prefix*)
684 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
685 am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"`
686 ;;
687 *)
688 case $am_py_prefix in
689 /usr|/System*) ;;
690 *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
691 ;;
692 esac
693 ;;
694 esac
695 ])
696 AC_SUBST([pythondir], [$am_cv_python_pythondir])
697
698 dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was
699 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
700 dnl more consistent with the rest of automake.
701 dnl
702 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
703
704 dnl 3. pyexecdir: directory for installing python extension modules
705 dnl (shared libraries).
706 dnl Query distutils for this directory.
707 dnl
708 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)],
709 [am_cv_python_pyexecdir],
710 [if test "x$am_cv_python_exec_prefix" = x; then
711 am_py_exec_prefix=$am__usable_exec_prefix
712 else
713 am_py_exec_prefix=$am_cv_python_exec_prefix
714 fi
715 am_cv_python_pyexecdir=`$PYTHON -c "
716$am_python_setup_sysconfig
717if can_use_sysconfig:
718 sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'})
719else:
720 from distutils import sysconfig
721 sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
722sys.stdout.write(sitedir)"`
723 #
724 case $am_cv_python_pyexecdir in
725 $am_py_exec_prefix*)
726 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
727 am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"`
728 ;;
729 *)
730 case $am_py_exec_prefix in
731 /usr|/System*) ;;
732 *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
733 ;;
734 esac
735 ;;
736 esac
737 ])
738 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
739
740 dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE)
741 dnl
742 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
743
744 dnl Run any user-specified action.
745 $2
746 fi
747])
748
749
750# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
751# ---------------------------------------------------------------------------
752# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
753# Run ACTION-IF-FALSE otherwise.
754# This test uses sys.hexversion instead of the string equivalent (first
755# word of sys.version), in order to cope with versions such as 2.2c1.
756# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
757AC_DEFUN([AM_PYTHON_CHECK_VERSION],
758 [prog="import sys
759# split strings by '.' and convert to numeric. Append some zeros
760# because we need at least 4 digits for the hex conversion.
761# map returns an iterator in Python 3.0 and a list in 2.x
762minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
763minverhex = 0
764# xrange is not present in Python 3.0 and range returns an iterator
765for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
766sys.exit(sys.hexversion < minverhex)"
767 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
768
769# Copyright (C) 2001-2021 Free Software Foundation, Inc.
770#
771# This file is free software; the Free Software Foundation
772# gives unlimited permission to copy and/or distribute it,
773# with or without modifications, as long as this notice is preserved.
774
775# AM_RUN_LOG(COMMAND)
776# -------------------
777# Run COMMAND, save the exit status in ac_status, and log it.
778# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
779AC_DEFUN([AM_RUN_LOG],
780[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
781 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
782 ac_status=$?
783 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
784 (exit $ac_status); }])
785
786m4_include([acinclude.m4])
This page took 0.033428 seconds and 6 git commands to generate.