18ffb90f1Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
208c70cfbSmrg
38ffb90f1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4602e473dSmrg
5602e473dSmrg# This file is free software; the Free Software Foundation
6602e473dSmrg# gives unlimited permission to copy and/or distribute it,
7602e473dSmrg# with or without modifications, as long as this notice is preserved.
8602e473dSmrg
9602e473dSmrg# This program is distributed in the hope that it will be useful,
10602e473dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11602e473dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12602e473dSmrg# PARTICULAR PURPOSE.
13602e473dSmrg
1408c70cfbSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15602e473dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16602e473dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178ffb90f1Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
188ffb90f1Smrg[m4_warning([this file was generated for autoconf 2.71.
19602e473dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20602e473dSmrgIf you have problems, you may need to regenerate the build system entirely.
2108c70cfbSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22602e473dSmrg
23b9526c6aSmrg# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
24b9526c6aSmrg# serial 12 (pkg-config-0.29.2)
25245c37e9Smrg
267204935cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
277204935cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
287204935cSmrgdnl
297204935cSmrgdnl This program is free software; you can redistribute it and/or modify
307204935cSmrgdnl it under the terms of the GNU General Public License as published by
317204935cSmrgdnl the Free Software Foundation; either version 2 of the License, or
327204935cSmrgdnl (at your option) any later version.
337204935cSmrgdnl
347204935cSmrgdnl This program is distributed in the hope that it will be useful, but
357204935cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
367204935cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
377204935cSmrgdnl General Public License for more details.
387204935cSmrgdnl
397204935cSmrgdnl You should have received a copy of the GNU General Public License
407204935cSmrgdnl along with this program; if not, write to the Free Software
417204935cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
427204935cSmrgdnl 02111-1307, USA.
437204935cSmrgdnl
447204935cSmrgdnl As a special exception to the GNU General Public License, if you
457204935cSmrgdnl distribute this file as part of a program that contains a
467204935cSmrgdnl configuration script generated by Autoconf, you may include it under
477204935cSmrgdnl the same distribution terms that you use for the rest of that
487204935cSmrgdnl program.
497204935cSmrg
507204935cSmrgdnl PKG_PREREQ(MIN-VERSION)
517204935cSmrgdnl -----------------------
527204935cSmrgdnl Since: 0.29
537204935cSmrgdnl
547204935cSmrgdnl Verify that the version of the pkg-config macros are at least
557204935cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
567204935cSmrgdnl installed version of pkg-config, this checks the developer's version
577204935cSmrgdnl of pkg.m4 when generating configure.
587204935cSmrgdnl
597204935cSmrgdnl To ensure that this macro is defined, also add:
607204935cSmrgdnl m4_ifndef([PKG_PREREQ],
617204935cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
627204935cSmrgdnl
637204935cSmrgdnl See the "Since" comment for each macro you use to see what version
647204935cSmrgdnl of the macros you require.
657204935cSmrgm4_defun([PKG_PREREQ],
66b9526c6aSmrg[m4_define([PKG_MACROS_VERSION], [0.29.2])
677204935cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
687204935cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
697204935cSmrg])dnl PKG_PREREQ
707204935cSmrg
717204935cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
727204935cSmrgdnl ----------------------------------
737204935cSmrgdnl Since: 0.16
747204935cSmrgdnl
757204935cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
767204935cSmrgdnl first found in the path. Checks that the version of pkg-config found
777204935cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
787204935cSmrgdnl used since that's the first version where most current features of
797204935cSmrgdnl pkg-config existed.
801016ad83SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
811016ad83Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
821016ad83Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
831016ad83Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
841016ad83SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
851016ad83SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
861016ad83SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
871016ad83Smrg
881016ad83Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
891016ad83Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
901016ad83Smrgfi
911016ad83Smrgif test -n "$PKG_CONFIG"; then
921016ad83Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
931016ad83Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
941016ad83Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
951016ad83Smrg		AC_MSG_RESULT([yes])
961016ad83Smrg	else
971016ad83Smrg		AC_MSG_RESULT([no])
981016ad83Smrg		PKG_CONFIG=""
991016ad83Smrg	fi
1001016ad83Smrgfi[]dnl
1017204935cSmrg])dnl PKG_PROG_PKG_CONFIG
1021016ad83Smrg
1037204935cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1047204935cSmrgdnl -------------------------------------------------------------------
1057204935cSmrgdnl Since: 0.18
1067204935cSmrgdnl
1077204935cSmrgdnl Check to see whether a particular set of modules exists. Similar to
1087204935cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1097204935cSmrgdnl
1107204935cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
111b9526c6aSmrgdnl only at the first occurrence in configure.ac, so if the first place
1127204935cSmrgdnl it's called might be skipped (such as if it is within an "if", you
1137204935cSmrgdnl have to call PKG_CHECK_EXISTS manually
1141016ad83SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1151016ad83Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1161016ad83Smrgif test -n "$PKG_CONFIG" && \
1171016ad83Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1181016ad83Smrg  m4_default([$2], [:])
1191016ad83Smrgm4_ifvaln([$3], [else
1201016ad83Smrg  $3])dnl
1211016ad83Smrgfi])
1221016ad83Smrg
1237204935cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1247204935cSmrgdnl ---------------------------------------------
1257204935cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1267204935cSmrgdnl pkg_failed based on the result.
1271016ad83Smrgm4_define([_PKG_CONFIG],
1281016ad83Smrg[if test -n "$$1"; then
1291016ad83Smrg    pkg_cv_[]$1="$$1"
1301016ad83Smrg elif test -n "$PKG_CONFIG"; then
1311016ad83Smrg    PKG_CHECK_EXISTS([$3],
1321016ad83Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1331016ad83Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1341016ad83Smrg		     [pkg_failed=yes])
1351016ad83Smrg else
1361016ad83Smrg    pkg_failed=untried
1371016ad83Smrgfi[]dnl
1387204935cSmrg])dnl _PKG_CONFIG
1391016ad83Smrg
1407204935cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1417204935cSmrgdnl ---------------------------
1427204935cSmrgdnl Internal check to see if pkg-config supports short errors.
1431016ad83SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1441016ad83Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1451016ad83Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1461016ad83Smrg        _pkg_short_errors_supported=yes
1471016ad83Smrgelse
1481016ad83Smrg        _pkg_short_errors_supported=no
1491016ad83Smrgfi[]dnl
1507204935cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1511016ad83Smrg
1521016ad83Smrg
1537204935cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1547204935cSmrgdnl   [ACTION-IF-NOT-FOUND])
1557204935cSmrgdnl --------------------------------------------------------------
1567204935cSmrgdnl Since: 0.4.0
1577204935cSmrgdnl
1587204935cSmrgdnl Note that if there is a possibility the first call to
1597204935cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1607204935cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1611016ad83SmrgAC_DEFUN([PKG_CHECK_MODULES],
1621016ad83Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1631016ad83SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1641016ad83SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1651016ad83Smrg
1661016ad83Smrgpkg_failed=no
167b9526c6aSmrgAC_MSG_CHECKING([for $2])
1681016ad83Smrg
1691016ad83Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1701016ad83Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1711016ad83Smrg
1721016ad83Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1731016ad83Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1741016ad83SmrgSee the pkg-config man page for more details.])
1751016ad83Smrg
1761016ad83Smrgif test $pkg_failed = yes; then
177b9526c6aSmrg        AC_MSG_RESULT([no])
1781016ad83Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1791016ad83Smrg        if test $_pkg_short_errors_supported = yes; then
180b9526c6aSmrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
181b9526c6aSmrg        else
182b9526c6aSmrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1831016ad83Smrg        fi
184b9526c6aSmrg        # Put the nasty error message in config.log where it belongs
185b9526c6aSmrg        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1861016ad83Smrg
187b9526c6aSmrg        m4_default([$4], [AC_MSG_ERROR(
1881016ad83Smrg[Package requirements ($2) were not met:
1891016ad83Smrg
1901016ad83Smrg$$1_PKG_ERRORS
1911016ad83Smrg
1921016ad83SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1931016ad83Smrginstalled software in a non-standard prefix.
1941016ad83Smrg
1951016ad83Smrg_PKG_TEXT])[]dnl
1961016ad83Smrg        ])
1971016ad83Smrgelif test $pkg_failed = untried; then
198b9526c6aSmrg        AC_MSG_RESULT([no])
199b9526c6aSmrg        m4_default([$4], [AC_MSG_FAILURE(
2001016ad83Smrg[The pkg-config script could not be found or is too old.  Make sure it
2011016ad83Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2021016ad83Smrgpath to pkg-config.
2031016ad83Smrg
2041016ad83Smrg_PKG_TEXT
2051016ad83Smrg
2061016ad83SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2071016ad83Smrg        ])
2081016ad83Smrgelse
209b9526c6aSmrg        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
210b9526c6aSmrg        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2111016ad83Smrg        AC_MSG_RESULT([yes])
212b9526c6aSmrg        $3
2131016ad83Smrgfi[]dnl
2147204935cSmrg])dnl PKG_CHECK_MODULES
2157204935cSmrg
2167204935cSmrg
2177204935cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2187204935cSmrgdnl   [ACTION-IF-NOT-FOUND])
2197204935cSmrgdnl ---------------------------------------------------------------------
2207204935cSmrgdnl Since: 0.29
2217204935cSmrgdnl
2227204935cSmrgdnl Checks for existence of MODULES and gathers its build flags with
2237204935cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2247204935cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2257204935cSmrgdnl
2267204935cSmrgdnl Note that if there is a possibility the first call to
2277204935cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2287204935cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2297204935cSmrgdnl configure.ac.
2307204935cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2317204935cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2327204935cSmrg_save_PKG_CONFIG=$PKG_CONFIG
2337204935cSmrgPKG_CONFIG="$PKG_CONFIG --static"
2347204935cSmrgPKG_CHECK_MODULES($@)
2357204935cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2367204935cSmrg])dnl PKG_CHECK_MODULES_STATIC
2371016ad83Smrg
2381c7386f4Smrg
2397204935cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2407204935cSmrgdnl -------------------------
2417204935cSmrgdnl Since: 0.27
2427204935cSmrgdnl
2437204935cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2447204935cSmrgdnl should install pkg-config .pc files. By default the directory is
2457204935cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2467204935cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2477204935cSmrgdnl parameter.
2481c7386f4SmrgAC_DEFUN([PKG_INSTALLDIR],
2491c7386f4Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2501c7386f4Smrgm4_pushdef([pkg_description],
2511c7386f4Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2521c7386f4SmrgAC_ARG_WITH([pkgconfigdir],
2531c7386f4Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2541c7386f4Smrg    [with_pkgconfigdir=]pkg_default)
2551c7386f4SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2561c7386f4Smrgm4_popdef([pkg_default])
2571c7386f4Smrgm4_popdef([pkg_description])
2587204935cSmrg])dnl PKG_INSTALLDIR
2591c7386f4Smrg
2601c7386f4Smrg
2617204935cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2627204935cSmrgdnl --------------------------------
2637204935cSmrgdnl Since: 0.27
2647204935cSmrgdnl
2657204935cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2667204935cSmrgdnl module should install arch-independent pkg-config .pc files. By
2677204935cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2687204935cSmrgdnl changed by passing DIRECTORY. The user can override through the
2697204935cSmrgdnl --with-noarch-pkgconfigdir parameter.
2701c7386f4SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2711c7386f4Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2721c7386f4Smrgm4_pushdef([pkg_description],
2731c7386f4Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2741c7386f4SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2751c7386f4Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2761c7386f4Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2771c7386f4SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2781c7386f4Smrgm4_popdef([pkg_default])
2791c7386f4Smrgm4_popdef([pkg_description])
2807204935cSmrg])dnl PKG_NOARCH_INSTALLDIR
2811c7386f4Smrg
2821c7386f4Smrg
2837204935cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2847204935cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2857204935cSmrgdnl -------------------------------------------
2867204935cSmrgdnl Since: 0.28
2877204935cSmrgdnl
2887204935cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2891c7386f4SmrgAC_DEFUN([PKG_CHECK_VAR],
2901c7386f4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2911c7386f4SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2921c7386f4Smrg
2931c7386f4Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2941c7386f4SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2951c7386f4Smrg
2961c7386f4SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2977204935cSmrg])dnl PKG_CHECK_VAR
2981c7386f4Smrg
299245c37e9Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
300245c37e9Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
301245c37e9Smrgdnl   [DESCRIPTION], [DEFAULT])
302245c37e9Smrgdnl ------------------------------------------
303245c37e9Smrgdnl
304245c37e9Smrgdnl Prepare a "--with-" configure option using the lowercase
305245c37e9Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
306245c37e9Smrgdnl PKG_CHECK_MODULES in a single macro.
307245c37e9SmrgAC_DEFUN([PKG_WITH_MODULES],
308245c37e9Smrg[
309245c37e9Smrgm4_pushdef([with_arg], m4_tolower([$1]))
310245c37e9Smrg
311245c37e9Smrgm4_pushdef([description],
312245c37e9Smrg           [m4_default([$5], [build with ]with_arg[ support])])
313245c37e9Smrg
314245c37e9Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
315245c37e9Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
316245c37e9Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
317245c37e9Smrg
318245c37e9Smrgm4_case(def_arg,
319245c37e9Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
320245c37e9Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
321245c37e9Smrg
322245c37e9SmrgAC_ARG_WITH(with_arg,
323245c37e9Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
324245c37e9Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
325245c37e9Smrg
326245c37e9SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
327245c37e9Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
328245c37e9Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
329245c37e9Smrg                                        [m4_n([def_action_if_found]) $3],
330245c37e9Smrg                                        [m4_n([def_action_if_not_found]) $4])])
331245c37e9Smrg
332245c37e9Smrgm4_popdef([with_arg])
333245c37e9Smrgm4_popdef([description])
334245c37e9Smrgm4_popdef([def_arg])
335245c37e9Smrg
336245c37e9Smrg])dnl PKG_WITH_MODULES
337245c37e9Smrg
338245c37e9Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
339245c37e9Smrgdnl   [DESCRIPTION], [DEFAULT])
340245c37e9Smrgdnl -----------------------------------------------
341245c37e9Smrgdnl
342245c37e9Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
343245c37e9Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
344245c37e9SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
345245c37e9Smrg[
346245c37e9SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
347245c37e9Smrg
348245c37e9SmrgAM_CONDITIONAL([HAVE_][$1],
349245c37e9Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
350245c37e9Smrg])dnl PKG_HAVE_WITH_MODULES
351245c37e9Smrg
352245c37e9Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
353245c37e9Smrgdnl   [DESCRIPTION], [DEFAULT])
354245c37e9Smrgdnl ------------------------------------------------------
355245c37e9Smrgdnl
356245c37e9Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
357245c37e9Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
358245c37e9Smrgdnl and preprocessor variable.
359245c37e9SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
360245c37e9Smrg[
361245c37e9SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
362245c37e9Smrg
363245c37e9SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
364245c37e9Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
365245c37e9Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
366245c37e9Smrg
3671c7386f4Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3681c7386f4Smrgdnl
369b9526c6aSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
3701c7386f4Smrgdnl
3711c7386f4Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3721c7386f4Smrgdnl copy of this software and associated documentation files (the "Software"),
3731c7386f4Smrgdnl to deal in the Software without restriction, including without limitation
3741c7386f4Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3751c7386f4Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3761c7386f4Smrgdnl Software is furnished to do so, subject to the following conditions:
3771c7386f4Smrgdnl
3781c7386f4Smrgdnl The above copyright notice and this permission notice (including the next
3791c7386f4Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3801c7386f4Smrgdnl Software.
3811c7386f4Smrgdnl
3821c7386f4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3831c7386f4Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3841c7386f4Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3851c7386f4Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3861c7386f4Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3871c7386f4Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3881c7386f4Smrgdnl DEALINGS IN THE SOFTWARE.
3891c7386f4Smrg
3901c7386f4Smrg# XORG_MACROS_VERSION(required-version)
3911c7386f4Smrg# -------------------------------------
3921c7386f4Smrg# Minimum version: 1.1.0
3931c7386f4Smrg#
3941c7386f4Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3951c7386f4Smrg# your configure.ac with the minimum required version, such as:
3961c7386f4Smrg# XORG_MACROS_VERSION(1.1)
3971c7386f4Smrg#
3981c7386f4Smrg# To ensure that this macro is defined, also add:
3991c7386f4Smrg# m4_ifndef([XORG_MACROS_VERSION],
4001c7386f4Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4011c7386f4Smrg#
4021c7386f4Smrg#
4031c7386f4Smrg# See the "minimum version" comment for each macro you use to see what
4041c7386f4Smrg# version you require.
4051c7386f4Smrgm4_defun([XORG_MACROS_VERSION],[
406b9526c6aSmrgm4_define([vers_have], [1.20.0])
4071c7386f4Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4081c7386f4Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4091c7386f4Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4101c7386f4Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4111c7386f4Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4121c7386f4Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4131c7386f4Smrgm4_undefine([vers_have])
4141c7386f4Smrgm4_undefine([maj_have])
4151c7386f4Smrgm4_undefine([maj_needed])
4161c7386f4Smrg]) # XORG_MACROS_VERSION
4171c7386f4Smrg
4181c7386f4Smrg# XORG_PROG_RAWCPP()
4191c7386f4Smrg# ------------------
4201c7386f4Smrg# Minimum version: 1.0.0
4211c7386f4Smrg#
4221c7386f4Smrg# Find cpp program and necessary flags for use in pre-processing text files
4231c7386f4Smrg# such as man pages and config files
4241c7386f4SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4251c7386f4SmrgAC_REQUIRE([AC_PROG_CPP])
4268ffb90f1SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
4271c7386f4Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
4281c7386f4Smrg
4291c7386f4Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4301c7386f4Smrg# which is not the best choice for supporting other OS'es, but covers most
4311c7386f4Smrg# of the ones we need for now.
4321c7386f4SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4331c7386f4SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4341c7386f4Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4351c7386f4Smrg	AC_MSG_RESULT([no])
4361c7386f4Smrgelse
4371c7386f4Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4381c7386f4Smrg		RAWCPPFLAGS=-undef
4391c7386f4Smrg		AC_MSG_RESULT([yes])
4401c7386f4Smrg	# under Cygwin unix is still defined even with -undef
4411c7386f4Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4421c7386f4Smrg		RAWCPPFLAGS="-undef -ansi"
4431c7386f4Smrg		AC_MSG_RESULT([yes, with -ansi])
4441c7386f4Smrg	else
4451c7386f4Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4461c7386f4Smrg	fi
4471c7386f4Smrgfi
4481c7386f4Smrgrm -f conftest.$ac_ext
4491c7386f4Smrg
4501c7386f4SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4511c7386f4SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4521c7386f4Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4531c7386f4Smrg	AC_MSG_RESULT([no])
4541c7386f4Smrgelse
4551c7386f4Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4561c7386f4Smrg		TRADITIONALCPPFLAGS="-traditional"
4571c7386f4Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4581c7386f4Smrg		AC_MSG_RESULT([yes])
4591c7386f4Smrg	else
4601c7386f4Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4611c7386f4Smrg	fi
4621c7386f4Smrgfi
4631c7386f4Smrgrm -f conftest.$ac_ext
4641c7386f4SmrgAC_SUBST(RAWCPPFLAGS)
4651c7386f4SmrgAC_SUBST(TRADITIONALCPPFLAGS)
4661c7386f4Smrg]) # XORG_PROG_RAWCPP
4671c7386f4Smrg
4681c7386f4Smrg# XORG_MANPAGE_SECTIONS()
4691c7386f4Smrg# -----------------------
4701c7386f4Smrg# Minimum version: 1.0.0
4711c7386f4Smrg#
4721c7386f4Smrg# Determine which sections man pages go in for the different man page types
4731c7386f4Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4741c7386f4Smrg# Not sure if there's any better way than just hardcoding by OS name.
4751c7386f4Smrg# Override default settings by setting environment variables
4761c7386f4Smrg# Added MAN_SUBSTS in version 1.8
4771c7386f4Smrg# Added AC_PROG_SED in version 1.8
4781c7386f4Smrg
4791c7386f4SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4801c7386f4SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4811c7386f4SmrgAC_REQUIRE([AC_PROG_SED])
4821c7386f4Smrg
483aa30ed02Smrgcase $host_os in
484aa30ed02Smrg    solaris*)
485aa30ed02Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
486aa30ed02Smrg        # check for a man page file found in later versions that use
487aa30ed02Smrg        # traditional section numbers instead
488aa30ed02Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
489aa30ed02Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
490aa30ed02Smrg        ;;
491aa30ed02Smrg    *) SYSV_MAN_SECTIONS=false ;;
492aa30ed02Smrgesac
493aa30ed02Smrg
4941c7386f4Smrgif test x$APP_MAN_SUFFIX = x    ; then
4951c7386f4Smrg    APP_MAN_SUFFIX=1
4961c7386f4Smrgfi
4971c7386f4Smrgif test x$APP_MAN_DIR = x    ; then
4981c7386f4Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4991c7386f4Smrgfi
5001c7386f4Smrg
5011c7386f4Smrgif test x$LIB_MAN_SUFFIX = x    ; then
5021c7386f4Smrg    LIB_MAN_SUFFIX=3
5031c7386f4Smrgfi
5041c7386f4Smrgif test x$LIB_MAN_DIR = x    ; then
5051c7386f4Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
5061c7386f4Smrgfi
5071c7386f4Smrg
5081c7386f4Smrgif test x$FILE_MAN_SUFFIX = x    ; then
509aa30ed02Smrg    case $SYSV_MAN_SECTIONS in
510aa30ed02Smrg	true)				FILE_MAN_SUFFIX=4  ;;
511aa30ed02Smrg	*)				FILE_MAN_SUFFIX=5  ;;
5121c7386f4Smrg    esac
5131c7386f4Smrgfi
5141c7386f4Smrgif test x$FILE_MAN_DIR = x    ; then
5151c7386f4Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
5161c7386f4Smrgfi
5171c7386f4Smrg
5181c7386f4Smrgif test x$MISC_MAN_SUFFIX = x    ; then
519aa30ed02Smrg    case $SYSV_MAN_SECTIONS in
520aa30ed02Smrg	true)				MISC_MAN_SUFFIX=5  ;;
521aa30ed02Smrg	*)				MISC_MAN_SUFFIX=7  ;;
5221c7386f4Smrg    esac
5231c7386f4Smrgfi
5241c7386f4Smrgif test x$MISC_MAN_DIR = x    ; then
5251c7386f4Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5261c7386f4Smrgfi
5271c7386f4Smrg
5281c7386f4Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
529aa30ed02Smrg    case $SYSV_MAN_SECTIONS in
530aa30ed02Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
531aa30ed02Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5321c7386f4Smrg    esac
5331c7386f4Smrgfi
5341c7386f4Smrgif test x$DRIVER_MAN_DIR = x    ; then
5351c7386f4Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5361c7386f4Smrgfi
5371c7386f4Smrg
5381c7386f4Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
539aa30ed02Smrg    case $SYSV_MAN_SECTIONS in
540aa30ed02Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
541aa30ed02Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5421c7386f4Smrg    esac
5431c7386f4Smrgfi
5441c7386f4Smrgif test x$ADMIN_MAN_DIR = x    ; then
5451c7386f4Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5461c7386f4Smrgfi
5471c7386f4Smrg
5481c7386f4Smrg
5491c7386f4SmrgAC_SUBST([APP_MAN_SUFFIX])
5501c7386f4SmrgAC_SUBST([LIB_MAN_SUFFIX])
5511c7386f4SmrgAC_SUBST([FILE_MAN_SUFFIX])
5521c7386f4SmrgAC_SUBST([MISC_MAN_SUFFIX])
5531c7386f4SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5541c7386f4SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5551c7386f4SmrgAC_SUBST([APP_MAN_DIR])
5561c7386f4SmrgAC_SUBST([LIB_MAN_DIR])
5571c7386f4SmrgAC_SUBST([FILE_MAN_DIR])
5581c7386f4SmrgAC_SUBST([MISC_MAN_DIR])
5591c7386f4SmrgAC_SUBST([DRIVER_MAN_DIR])
5601c7386f4SmrgAC_SUBST([ADMIN_MAN_DIR])
5611c7386f4Smrg
5621c7386f4SmrgXORG_MAN_PAGE="X Version 11"
5631c7386f4SmrgAC_SUBST([XORG_MAN_PAGE])
5641c7386f4SmrgMAN_SUBSTS="\
5651c7386f4Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5661c7386f4Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5671c7386f4Smrg	-e 's|__xservername__|Xorg|g' \
5681c7386f4Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
5691c7386f4Smrg	-e 's|__projectroot__|\$(prefix)|g' \
5701c7386f4Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5711c7386f4Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5721c7386f4Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5731c7386f4Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5741c7386f4Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5751c7386f4Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5761c7386f4Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5771c7386f4SmrgAC_SUBST([MAN_SUBSTS])
5781c7386f4Smrg
5791c7386f4Smrg]) # XORG_MANPAGE_SECTIONS
5801c7386f4Smrg
5811c7386f4Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5821c7386f4Smrg# ------------------------
5831c7386f4Smrg# Minimum version: 1.7.0
5841c7386f4Smrg#
5851c7386f4Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5861c7386f4Smrg# provided by xorg-sgml-doctools, if installed.
5871c7386f4SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5881c7386f4SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5891c7386f4SmrgXORG_SGML_PATH=
5901c7386f4SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5911c7386f4Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5921c7386f4Smrg    [m4_ifval([$1],[:],
5931c7386f4Smrg        [if test x"$cross_compiling" != x"yes" ; then
5941c7386f4Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5951c7386f4Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5961c7386f4Smrg         fi])
5971c7386f4Smrg    ])
5981c7386f4Smrg
5991c7386f4Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6001c7386f4Smrg# the path and the name of the doc stylesheet
6011c7386f4Smrgif test "x$XORG_SGML_PATH" != "x" ; then
6021c7386f4Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6031c7386f4Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6041c7386f4Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6051c7386f4Smrgelse
6061c7386f4Smrg   AC_MSG_RESULT([no])
6071c7386f4Smrgfi
6081c7386f4Smrg
6091c7386f4SmrgAC_SUBST(XORG_SGML_PATH)
6101c7386f4SmrgAC_SUBST(STYLESHEET_SRCDIR)
6111c7386f4SmrgAC_SUBST(XSL_STYLESHEET)
6121c7386f4SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6131c7386f4Smrg]) # XORG_CHECK_SGML_DOCTOOLS
6141c7386f4Smrg
6151c7386f4Smrg# XORG_CHECK_LINUXDOC
6161c7386f4Smrg# -------------------
6171c7386f4Smrg# Minimum version: 1.0.0
6181c7386f4Smrg#
6191c7386f4Smrg# Defines the variable MAKE_TEXT if the necessary tools and
6201c7386f4Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6211c7386f4Smrg# Whether or not the necessary tools and files are found can be checked
6221c7386f4Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6231c7386f4SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6241c7386f4SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6251c7386f4SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
6261c7386f4Smrg
6271c7386f4SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
6281c7386f4Smrg
6291c7386f4SmrgAC_MSG_CHECKING([whether to build documentation])
6301c7386f4Smrg
6311c7386f4Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6321c7386f4Smrg   BUILDDOC=yes
6331c7386f4Smrgelse
6341c7386f4Smrg   BUILDDOC=no
6351c7386f4Smrgfi
6361c7386f4Smrg
6371c7386f4SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6381c7386f4Smrg
6391c7386f4SmrgAC_MSG_RESULT([$BUILDDOC])
6401c7386f4Smrg
6411c7386f4SmrgAC_MSG_CHECKING([whether to build pdf documentation])
6421c7386f4Smrg
6431c7386f4Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6441c7386f4Smrg   BUILDPDFDOC=yes
6451c7386f4Smrgelse
6461c7386f4Smrg   BUILDPDFDOC=no
6471c7386f4Smrgfi
6481c7386f4Smrg
6491c7386f4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6501c7386f4Smrg
6511c7386f4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
6521c7386f4Smrg
6531c7386f4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6541c7386f4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6551c7386f4SmrgMAKE_PDF="$PS2PDF"
6561c7386f4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
6571c7386f4Smrg
6581c7386f4SmrgAC_SUBST(MAKE_TEXT)
6591c7386f4SmrgAC_SUBST(MAKE_PS)
6601c7386f4SmrgAC_SUBST(MAKE_PDF)
6611c7386f4SmrgAC_SUBST(MAKE_HTML)
6621c7386f4Smrg]) # XORG_CHECK_LINUXDOC
6631c7386f4Smrg
6641c7386f4Smrg# XORG_CHECK_DOCBOOK
6651c7386f4Smrg# -------------------
6661c7386f4Smrg# Minimum version: 1.0.0
6671c7386f4Smrg#
6681c7386f4Smrg# Checks for the ability to build output formats from SGML DocBook source.
6691c7386f4Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6701c7386f4Smrg# indicates whether the necessary tools and files are found and, if set,
6711c7386f4Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6721c7386f4SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6731c7386f4SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6741c7386f4Smrg
6751c7386f4SmrgBUILDTXTDOC=no
6761c7386f4SmrgBUILDPDFDOC=no
6771c7386f4SmrgBUILDPSDOC=no
6781c7386f4SmrgBUILDHTMLDOC=no
6791c7386f4Smrg
6801c7386f4SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6811c7386f4SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6821c7386f4SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6831c7386f4SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6841c7386f4Smrg
6851c7386f4SmrgAC_MSG_CHECKING([whether to build text documentation])
6861c7386f4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6871c7386f4Smrg   test x$BUILD_TXTDOC != xno; then
6881c7386f4Smrg	BUILDTXTDOC=yes
6891c7386f4Smrgfi
6901c7386f4SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6911c7386f4SmrgAC_MSG_RESULT([$BUILDTXTDOC])
6921c7386f4Smrg
6931c7386f4SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6941c7386f4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6951c7386f4Smrg   test x$BUILD_PDFDOC != xno; then
6961c7386f4Smrg	BUILDPDFDOC=yes
6971c7386f4Smrgfi
6981c7386f4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6991c7386f4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
7001c7386f4Smrg
7011c7386f4SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7021c7386f4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7031c7386f4Smrg   test x$BUILD_PSDOC != xno; then
7041c7386f4Smrg	BUILDPSDOC=yes
7051c7386f4Smrgfi
7061c7386f4SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7071c7386f4SmrgAC_MSG_RESULT([$BUILDPSDOC])
7081c7386f4Smrg
7091c7386f4SmrgAC_MSG_CHECKING([whether to build HTML documentation])
7101c7386f4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7111c7386f4Smrg   test x$BUILD_HTMLDOC != xno; then
7121c7386f4Smrg	BUILDHTMLDOC=yes
7131c7386f4Smrgfi
7141c7386f4SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7151c7386f4SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7161c7386f4Smrg
7171c7386f4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7181c7386f4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7191c7386f4SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7201c7386f4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
7211c7386f4Smrg
7221c7386f4SmrgAC_SUBST(MAKE_TEXT)
7231c7386f4SmrgAC_SUBST(MAKE_PS)
7241c7386f4SmrgAC_SUBST(MAKE_PDF)
7251c7386f4SmrgAC_SUBST(MAKE_HTML)
7261c7386f4Smrg]) # XORG_CHECK_DOCBOOK
7271c7386f4Smrg
7281c7386f4Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7291c7386f4Smrg# ----------------
7301c7386f4Smrg# Minimum version: 1.5.0
7311c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
7321c7386f4Smrg#
7331c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
7341c7386f4Smrg# not at the appropriate level. This macro enables a module to test for the
7351c7386f4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
736b9526c6aSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
7371c7386f4Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7381c7386f4Smrg# --with-xmlto assumes 'auto'.
7391c7386f4Smrg#
7401c7386f4Smrg# Interface to module:
7411c7386f4Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7421c7386f4Smrg# XMLTO:	returns the path of the xmlto program found
7431c7386f4Smrg#		returns the path set by the user in the environment
7441c7386f4Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7451c7386f4Smrg#		'no' user instructs the module not to use xmlto
7461c7386f4Smrg#
7471c7386f4Smrg# Added in version 1.10.0
7481c7386f4Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7491c7386f4Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7501c7386f4Smrg#
7511c7386f4Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7521c7386f4Smrg#
7531c7386f4SmrgAC_DEFUN([XORG_WITH_XMLTO],[
7541c7386f4SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7551c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
7561c7386f4SmrgAC_ARG_WITH(xmlto,
7571c7386f4Smrg	AS_HELP_STRING([--with-xmlto],
7581c7386f4Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7591c7386f4Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7601c7386f4Smrgm4_undefine([_defopt])
7611c7386f4Smrg
7621c7386f4Smrgif test "x$use_xmlto" = x"auto"; then
7631c7386f4Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7641c7386f4Smrg   if test "x$XMLTO" = "x"; then
7651c7386f4Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7661c7386f4Smrg	have_xmlto=no
7671c7386f4Smrg   else
7681c7386f4Smrg        have_xmlto=yes
7691c7386f4Smrg   fi
7701c7386f4Smrgelif test "x$use_xmlto" = x"yes" ; then
7711c7386f4Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7721c7386f4Smrg   if test "x$XMLTO" = "x"; then
7731c7386f4Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7741c7386f4Smrg   fi
7751c7386f4Smrg   have_xmlto=yes
7761c7386f4Smrgelif test "x$use_xmlto" = x"no" ; then
7771c7386f4Smrg   if test "x$XMLTO" != "x"; then
7781c7386f4Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7791c7386f4Smrg   fi
7801c7386f4Smrg   have_xmlto=no
7811c7386f4Smrgelse
7821c7386f4Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7831c7386f4Smrgfi
7841c7386f4Smrg
7851c7386f4Smrg# Test for a minimum version of xmlto, if provided.
7861c7386f4Smrgm4_ifval([$1],
7871c7386f4Smrg[if test "$have_xmlto" = yes; then
7881c7386f4Smrg    # scrape the xmlto version
7891c7386f4Smrg    AC_MSG_CHECKING([the xmlto version])
7901c7386f4Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7911c7386f4Smrg    AC_MSG_RESULT([$xmlto_version])
7921c7386f4Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7931c7386f4Smrg        [if test "x$use_xmlto" = xauto; then
7941c7386f4Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7951c7386f4Smrg            have_xmlto=no
7961c7386f4Smrg        else
7971c7386f4Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7981c7386f4Smrg        fi])
7991c7386f4Smrgfi])
8001c7386f4Smrg
8011c7386f4Smrg# Test for the ability of xmlto to generate a text target
802fe12f63cSmrg#
803fe12f63cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
804fe12f63cSmrg# following test for empty XML docbook files.
805fe12f63cSmrg# For compatibility reasons use the following empty XML docbook file and if
806fe12f63cSmrg# it fails try it again with a non-empty XML file.
8071c7386f4Smrghave_xmlto_text=no
8081c7386f4Smrgcat > conftest.xml << "EOF"
8091c7386f4SmrgEOF
8101c7386f4SmrgAS_IF([test "$have_xmlto" = yes],
8111c7386f4Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8121c7386f4Smrg             [have_xmlto_text=yes],
813fe12f63cSmrg             [# Try it again with a non-empty XML file.
814fe12f63cSmrg              cat > conftest.xml << "EOF"
815fe12f63cSmrg<x></x>
816fe12f63cSmrgEOF
817fe12f63cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
818fe12f63cSmrg                    [have_xmlto_text=yes],
819fe12f63cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8201c7386f4Smrgrm -f conftest.xml
8211c7386f4SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8221c7386f4SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8231c7386f4Smrg]) # XORG_WITH_XMLTO
8241c7386f4Smrg
8251c7386f4Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8261c7386f4Smrg# --------------------------------------------
8271c7386f4Smrg# Minimum version: 1.12.0
8281c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.12.0
8291c7386f4Smrg#
8301c7386f4Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8311c7386f4Smrg# XML-based language used for the transformation of XML documents.
8321c7386f4Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8331c7386f4Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8341c7386f4Smrg# The XSLT processor is often used as a standalone tool for transformations.
8351c7386f4Smrg# It should not be assumed that this tool is used only to work with documnetation.
8361c7386f4Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8371c7386f4Smrg#
8381c7386f4Smrg# Interface to module:
8391c7386f4Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8401c7386f4Smrg# XSLTPROC:	 returns the path of the xsltproc program found
8411c7386f4Smrg#		 returns the path set by the user in the environment
8421c7386f4Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8431c7386f4Smrg#		  'no' user instructs the module not to use xsltproc
8441c7386f4Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8451c7386f4Smrg#
8461c7386f4Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8471c7386f4Smrg#
8481c7386f4SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8491c7386f4SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8501c7386f4Smrg# Preserves the interface, should it be implemented later
8511c7386f4Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8521c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
8531c7386f4SmrgAC_ARG_WITH(xsltproc,
8541c7386f4Smrg	AS_HELP_STRING([--with-xsltproc],
8551c7386f4Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8561c7386f4Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8571c7386f4Smrgm4_undefine([_defopt])
8581c7386f4Smrg
8591c7386f4Smrgif test "x$use_xsltproc" = x"auto"; then
8601c7386f4Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8611c7386f4Smrg   if test "x$XSLTPROC" = "x"; then
8621c7386f4Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8631c7386f4Smrg	have_xsltproc=no
8641c7386f4Smrg   else
8651c7386f4Smrg        have_xsltproc=yes
8661c7386f4Smrg   fi
8671c7386f4Smrgelif test "x$use_xsltproc" = x"yes" ; then
8681c7386f4Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8691c7386f4Smrg   if test "x$XSLTPROC" = "x"; then
8701c7386f4Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8711c7386f4Smrg   fi
8721c7386f4Smrg   have_xsltproc=yes
8731c7386f4Smrgelif test "x$use_xsltproc" = x"no" ; then
8741c7386f4Smrg   if test "x$XSLTPROC" != "x"; then
8751c7386f4Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8761c7386f4Smrg   fi
8771c7386f4Smrg   have_xsltproc=no
8781c7386f4Smrgelse
8791c7386f4Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8801c7386f4Smrgfi
8811c7386f4Smrg
8821c7386f4SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8831c7386f4Smrg]) # XORG_WITH_XSLTPROC
8841c7386f4Smrg
8851c7386f4Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8861c7386f4Smrg# ----------------------------------------
8871c7386f4Smrg# Minimum version: 1.15.0
8881c7386f4Smrg#
8891c7386f4Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8901c7386f4Smrg# scanning arbitrary text files, extracting information from those text files,
8911c7386f4Smrg# and printing reports based on that information.
8921c7386f4Smrg#
8931c7386f4Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8941c7386f4Smrg#
8951c7386f4Smrg# Interface to module:
8961c7386f4Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8971c7386f4Smrg# PERL:	     returns the path of the perl program found
8981c7386f4Smrg#	     returns the path set by the user in the environment
8991c7386f4Smrg# --with-perl: 'yes' user instructs the module to use perl
9001c7386f4Smrg#	       'no' user instructs the module not to use perl
9011c7386f4Smrg# have_perl: returns yes if perl found in PATH or no
9021c7386f4Smrg#
9031c7386f4Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9041c7386f4Smrg#
9051c7386f4SmrgAC_DEFUN([XORG_WITH_PERL],[
9061c7386f4SmrgAC_ARG_VAR([PERL], [Path to perl command])
9071c7386f4Smrg# Preserves the interface, should it be implemented later
9081c7386f4Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9091c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
9101c7386f4SmrgAC_ARG_WITH(perl,
9111c7386f4Smrg	AS_HELP_STRING([--with-perl],
9121c7386f4Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9131c7386f4Smrg	   [use_perl=$withval], [use_perl=]_defopt)
9141c7386f4Smrgm4_undefine([_defopt])
9151c7386f4Smrg
9161c7386f4Smrgif test "x$use_perl" = x"auto"; then
9171c7386f4Smrg   AC_PATH_PROG([PERL], [perl])
9181c7386f4Smrg   if test "x$PERL" = "x"; then
9191c7386f4Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9201c7386f4Smrg	have_perl=no
9211c7386f4Smrg   else
9221c7386f4Smrg        have_perl=yes
9231c7386f4Smrg   fi
9241c7386f4Smrgelif test "x$use_perl" = x"yes" ; then
9251c7386f4Smrg   AC_PATH_PROG([PERL], [perl])
9261c7386f4Smrg   if test "x$PERL" = "x"; then
9271c7386f4Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9281c7386f4Smrg   fi
9291c7386f4Smrg   have_perl=yes
9301c7386f4Smrgelif test "x$use_perl" = x"no" ; then
9311c7386f4Smrg   if test "x$PERL" != "x"; then
9321c7386f4Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9331c7386f4Smrg   fi
9341c7386f4Smrg   have_perl=no
9351c7386f4Smrgelse
9361c7386f4Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9371c7386f4Smrgfi
9381c7386f4Smrg
9391c7386f4SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9401c7386f4Smrg]) # XORG_WITH_PERL
9411c7386f4Smrg
9421c7386f4Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9431c7386f4Smrg# ----------------
9441c7386f4Smrg# Minimum version: 1.5.0
9451c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9461c7386f4Smrg#
9471c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
9481c7386f4Smrg# not at the appropriate level. This macro enables a module to test for the
9491c7386f4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
950b9526c6aSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
9511c7386f4Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9521c7386f4Smrg# --with-asciidoc assumes 'auto'.
9531c7386f4Smrg#
9541c7386f4Smrg# Interface to module:
9551c7386f4Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9561c7386f4Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
9571c7386f4Smrg#		 returns the path set by the user in the environment
9581c7386f4Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9591c7386f4Smrg#		  'no' user instructs the module not to use asciidoc
9601c7386f4Smrg#
9611c7386f4Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9621c7386f4Smrg#
9631c7386f4SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9641c7386f4SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9651c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
9661c7386f4SmrgAC_ARG_WITH(asciidoc,
9671c7386f4Smrg	AS_HELP_STRING([--with-asciidoc],
9681c7386f4Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9691c7386f4Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9701c7386f4Smrgm4_undefine([_defopt])
9711c7386f4Smrg
9721c7386f4Smrgif test "x$use_asciidoc" = x"auto"; then
9731c7386f4Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9741c7386f4Smrg   if test "x$ASCIIDOC" = "x"; then
9751c7386f4Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9761c7386f4Smrg	have_asciidoc=no
9771c7386f4Smrg   else
9781c7386f4Smrg        have_asciidoc=yes
9791c7386f4Smrg   fi
9801c7386f4Smrgelif test "x$use_asciidoc" = x"yes" ; then
9811c7386f4Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9821c7386f4Smrg   if test "x$ASCIIDOC" = "x"; then
9831c7386f4Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9841c7386f4Smrg   fi
9851c7386f4Smrg   have_asciidoc=yes
9861c7386f4Smrgelif test "x$use_asciidoc" = x"no" ; then
9871c7386f4Smrg   if test "x$ASCIIDOC" != "x"; then
9881c7386f4Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9891c7386f4Smrg   fi
9901c7386f4Smrg   have_asciidoc=no
9911c7386f4Smrgelse
9921c7386f4Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9931c7386f4Smrgfi
9941c7386f4Smrgm4_ifval([$1],
9951c7386f4Smrg[if test "$have_asciidoc" = yes; then
9961c7386f4Smrg    # scrape the asciidoc version
9971c7386f4Smrg    AC_MSG_CHECKING([the asciidoc version])
9981c7386f4Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9991c7386f4Smrg    AC_MSG_RESULT([$asciidoc_version])
10001c7386f4Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10011c7386f4Smrg        [if test "x$use_asciidoc" = xauto; then
10021c7386f4Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10031c7386f4Smrg            have_asciidoc=no
10041c7386f4Smrg        else
10051c7386f4Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10061c7386f4Smrg        fi])
10071c7386f4Smrgfi])
10081c7386f4SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10091c7386f4Smrg]) # XORG_WITH_ASCIIDOC
10101c7386f4Smrg
10111c7386f4Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
10121c7386f4Smrg# -------------------------------------------
10131c7386f4Smrg# Minimum version: 1.5.0
10141c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10151c7386f4Smrg# Minimum version for optional DOT checking: 1.18.0
10161c7386f4Smrg#
10171c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
10181c7386f4Smrg# not at the appropriate level. This macro enables a module to test for the
10191c7386f4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1020b9526c6aSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
10211c7386f4Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10221c7386f4Smrg# --with-doxygen assumes 'auto'.
10231c7386f4Smrg#
10241c7386f4Smrg# Interface to module:
10251c7386f4Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10261c7386f4Smrg# DOXYGEN:	 returns the path of the doxygen program found
10271c7386f4Smrg#		 returns the path set by the user in the environment
10281c7386f4Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10291c7386f4Smrg#		  'no' user instructs the module not to use doxygen
10301c7386f4Smrg#
10311c7386f4Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10321c7386f4Smrg#
10331c7386f4SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10341c7386f4SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10351c7386f4SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10361c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
10371c7386f4SmrgAC_ARG_WITH(doxygen,
10381c7386f4Smrg	AS_HELP_STRING([--with-doxygen],
10391c7386f4Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10401c7386f4Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10411c7386f4Smrgm4_undefine([_defopt])
10421c7386f4Smrg
10431c7386f4Smrgif test "x$use_doxygen" = x"auto"; then
10441c7386f4Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10451c7386f4Smrg   if test "x$DOXYGEN" = "x"; then
10461c7386f4Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10471c7386f4Smrg	have_doxygen=no
10481c7386f4Smrg   else
10491c7386f4Smrg        have_doxygen=yes
10501c7386f4Smrg   fi
10511c7386f4Smrgelif test "x$use_doxygen" = x"yes" ; then
10521c7386f4Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10531c7386f4Smrg   if test "x$DOXYGEN" = "x"; then
10541c7386f4Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10551c7386f4Smrg   fi
10561c7386f4Smrg   have_doxygen=yes
10571c7386f4Smrgelif test "x$use_doxygen" = x"no" ; then
10581c7386f4Smrg   if test "x$DOXYGEN" != "x"; then
10591c7386f4Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10601c7386f4Smrg   fi
10611c7386f4Smrg   have_doxygen=no
10621c7386f4Smrgelse
10631c7386f4Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10641c7386f4Smrgfi
10651c7386f4Smrgm4_ifval([$1],
10661c7386f4Smrg[if test "$have_doxygen" = yes; then
10671c7386f4Smrg    # scrape the doxygen version
10681c7386f4Smrg    AC_MSG_CHECKING([the doxygen version])
10691c7386f4Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10701c7386f4Smrg    AC_MSG_RESULT([$doxygen_version])
10711c7386f4Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10721c7386f4Smrg        [if test "x$use_doxygen" = xauto; then
10731c7386f4Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10741c7386f4Smrg            have_doxygen=no
10751c7386f4Smrg        else
10761c7386f4Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10771c7386f4Smrg        fi])
10781c7386f4Smrgfi])
10791c7386f4Smrg
10801c7386f4Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10811c7386f4Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10821c7386f4Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10831c7386f4SmrgHAVE_DOT=no
10841c7386f4Smrgif test "x$have_doxygen" = "xyes"; then
10851c7386f4Smrg  AC_PATH_PROG([DOT], [dot])
10861c7386f4Smrg    if test "x$DOT" != "x"; then
10871c7386f4Smrg      HAVE_DOT=yes
10881c7386f4Smrg    fi
10891c7386f4Smrgfi
10901c7386f4Smrg
10911c7386f4SmrgAC_SUBST([HAVE_DOT])
10921c7386f4SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10931c7386f4SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10941c7386f4Smrg]) # XORG_WITH_DOXYGEN
10951c7386f4Smrg
10961c7386f4Smrg# XORG_WITH_GROFF([DEFAULT])
10971c7386f4Smrg# ----------------
10981c7386f4Smrg# Minimum version: 1.6.0
10991c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11001c7386f4Smrg#
11011c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
11021c7386f4Smrg# not at the appropriate level. This macro enables a module to test for the
11031c7386f4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1104b9526c6aSmrg# the --with-groff option, it allows maximum flexibility in making decisions
11051c7386f4Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
11061c7386f4Smrg# --with-groff assumes 'auto'.
11071c7386f4Smrg#
11081c7386f4Smrg# Interface to module:
11091c7386f4Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11101c7386f4Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11111c7386f4Smrg# HAVE_GROFF_MS: the -ms macros package
11121c7386f4Smrg# GROFF:	 returns the path of the groff program found
11131c7386f4Smrg#		 returns the path set by the user in the environment
11141c7386f4Smrg# --with-groff:	 'yes' user instructs the module to use groff
11151c7386f4Smrg#		 'no' user instructs the module not to use groff
11161c7386f4Smrg#
11171c7386f4Smrg# Added in version 1.9.0:
11181c7386f4Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11191c7386f4Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11201c7386f4Smrg#		   psselect from the psutils package.
11211c7386f4Smrg#		   the ghostcript package. Refer to the grohtml man pages
11221c7386f4Smrg#
11231c7386f4Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11241c7386f4Smrg#
11251c7386f4Smrg# OS and distros often splits groff in a basic and full package, the former
11261c7386f4Smrg# having the groff program and the later having devices, fonts and macros
11271c7386f4Smrg# Checking for the groff executable is not enough.
11281c7386f4Smrg#
11291c7386f4Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
11301c7386f4Smrg# unset HAVE_GROFF or GROFF env variables.
11311c7386f4Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11321c7386f4Smrg#
11331c7386f4SmrgAC_DEFUN([XORG_WITH_GROFF],[
11341c7386f4SmrgAC_ARG_VAR([GROFF], [Path to groff command])
11351c7386f4Smrgm4_define([_defopt], m4_default([$1], [auto]))
11361c7386f4SmrgAC_ARG_WITH(groff,
11371c7386f4Smrg	AS_HELP_STRING([--with-groff],
11381c7386f4Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11391c7386f4Smrg	   [use_groff=$withval], [use_groff=]_defopt)
11401c7386f4Smrgm4_undefine([_defopt])
11411c7386f4Smrg
11421c7386f4Smrgif test "x$use_groff" = x"auto"; then
11431c7386f4Smrg   AC_PATH_PROG([GROFF], [groff])
11441c7386f4Smrg   if test "x$GROFF" = "x"; then
11451c7386f4Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11461c7386f4Smrg	have_groff=no
11471c7386f4Smrg   else
11481c7386f4Smrg        have_groff=yes
11491c7386f4Smrg   fi
11501c7386f4Smrgelif test "x$use_groff" = x"yes" ; then
11511c7386f4Smrg   AC_PATH_PROG([GROFF], [groff])
11521c7386f4Smrg   if test "x$GROFF" = "x"; then
11531c7386f4Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11541c7386f4Smrg   fi
11551c7386f4Smrg   have_groff=yes
11561c7386f4Smrgelif test "x$use_groff" = x"no" ; then
11571c7386f4Smrg   if test "x$GROFF" != "x"; then
11581c7386f4Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11591c7386f4Smrg   fi
11601c7386f4Smrg   have_groff=no
11611c7386f4Smrgelse
11621c7386f4Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11631c7386f4Smrgfi
11641c7386f4Smrg
11651c7386f4Smrg# We have groff, test for the presence of the macro packages
11661c7386f4Smrgif test "x$have_groff" = x"yes"; then
11671c7386f4Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11681c7386f4Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11691c7386f4Smrg        groff_ms_works=yes
11701c7386f4Smrg    else
11711c7386f4Smrg        groff_ms_works=no
11721c7386f4Smrg    fi
11731c7386f4Smrg    AC_MSG_RESULT([$groff_ms_works])
11741c7386f4Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11751c7386f4Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11761c7386f4Smrg        groff_mm_works=yes
11771c7386f4Smrg    else
11781c7386f4Smrg        groff_mm_works=no
11791c7386f4Smrg    fi
11801c7386f4Smrg    AC_MSG_RESULT([$groff_mm_works])
11811c7386f4Smrgfi
11821c7386f4Smrg
11831c7386f4Smrg# We have groff, test for HTML dependencies, one command per package
11841c7386f4Smrgif test "x$have_groff" = x"yes"; then
11851c7386f4Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11861c7386f4Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11871c7386f4Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11881c7386f4Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11891c7386f4Smrg      have_groff_html=yes
11901c7386f4Smrg   else
11911c7386f4Smrg      have_groff_html=no
11921c7386f4Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11931c7386f4Smrg   fi
11941c7386f4Smrgfi
11951c7386f4Smrg
11961c7386f4Smrg# Set Automake conditionals for Makefiles
11971c7386f4SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11981c7386f4SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11991c7386f4SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12001c7386f4SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12011c7386f4Smrg]) # XORG_WITH_GROFF
12021c7386f4Smrg
12031c7386f4Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12041c7386f4Smrg# ---------------------------------------
12051c7386f4Smrg# Minimum version: 1.6.0
12061c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12071c7386f4Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12081c7386f4Smrg#
12091c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
12101c7386f4Smrg# not at the appropriate level. This macro enables a module to test for the
12111c7386f4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1212b9526c6aSmrg# the --with-fop option, it allows maximum flexibility in making decisions
12131c7386f4Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
12141c7386f4Smrg# --with-fop assumes 'auto'.
12151c7386f4Smrg#
12161c7386f4Smrg# Interface to module:
12171c7386f4Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12181c7386f4Smrg# FOP:	 	returns the path of the fop program found
12191c7386f4Smrg#		returns the path set by the user in the environment
12201c7386f4Smrg# --with-fop: 	'yes' user instructs the module to use fop
12211c7386f4Smrg#		'no' user instructs the module not to use fop
12221c7386f4Smrg#
12231c7386f4Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12241c7386f4Smrg#
12251c7386f4SmrgAC_DEFUN([XORG_WITH_FOP],[
12261c7386f4SmrgAC_ARG_VAR([FOP], [Path to fop command])
12271c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
12281c7386f4SmrgAC_ARG_WITH(fop,
12291c7386f4Smrg	AS_HELP_STRING([--with-fop],
12301c7386f4Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12311c7386f4Smrg	   [use_fop=$withval], [use_fop=]_defopt)
12321c7386f4Smrgm4_undefine([_defopt])
12331c7386f4Smrg
12341c7386f4Smrgif test "x$use_fop" = x"auto"; then
12351c7386f4Smrg   AC_PATH_PROG([FOP], [fop])
12361c7386f4Smrg   if test "x$FOP" = "x"; then
12371c7386f4Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12381c7386f4Smrg	have_fop=no
12391c7386f4Smrg   else
12401c7386f4Smrg        have_fop=yes
12411c7386f4Smrg   fi
12421c7386f4Smrgelif test "x$use_fop" = x"yes" ; then
12431c7386f4Smrg   AC_PATH_PROG([FOP], [fop])
12441c7386f4Smrg   if test "x$FOP" = "x"; then
12451c7386f4Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12461c7386f4Smrg   fi
12471c7386f4Smrg   have_fop=yes
12481c7386f4Smrgelif test "x$use_fop" = x"no" ; then
12491c7386f4Smrg   if test "x$FOP" != "x"; then
12501c7386f4Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12511c7386f4Smrg   fi
12521c7386f4Smrg   have_fop=no
12531c7386f4Smrgelse
12541c7386f4Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12551c7386f4Smrgfi
12561c7386f4Smrg
12571c7386f4Smrg# Test for a minimum version of fop, if provided.
12581c7386f4Smrgm4_ifval([$1],
12591c7386f4Smrg[if test "$have_fop" = yes; then
12601c7386f4Smrg    # scrape the fop version
12611c7386f4Smrg    AC_MSG_CHECKING([for fop minimum version])
12621c7386f4Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12631c7386f4Smrg    AC_MSG_RESULT([$fop_version])
12641c7386f4Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
12651c7386f4Smrg        [if test "x$use_fop" = xauto; then
12661c7386f4Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12671c7386f4Smrg            have_fop=no
12681c7386f4Smrg        else
12691c7386f4Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12701c7386f4Smrg        fi])
12711c7386f4Smrgfi])
12721c7386f4SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12731c7386f4Smrg]) # XORG_WITH_FOP
12741c7386f4Smrg
12751c7386f4Smrg# XORG_WITH_M4([MIN-VERSION])
12761c7386f4Smrg# ---------------------------
12771c7386f4Smrg# Minimum version: 1.19.0
12781c7386f4Smrg#
12791c7386f4Smrg# This macro attempts to locate an m4 macro processor which supports
12801c7386f4Smrg# -I option and is only useful for modules relying on M4 in order to
12811c7386f4Smrg# expand macros in source code files.
12821c7386f4Smrg#
12831c7386f4Smrg# Interface to module:
12841c7386f4Smrg# M4:	 	returns the path of the m4 program found
12851c7386f4Smrg#		returns the path set by the user in the environment
12861c7386f4Smrg#
12871c7386f4SmrgAC_DEFUN([XORG_WITH_M4], [
12881c7386f4SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12891c7386f4Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12901c7386f4Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12911c7386f4Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12921c7386f4Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12931c7386f4Smrg   [$PATH:/usr/gnu/bin])])
12941c7386f4Smrg
12951c7386f4SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12961c7386f4Smrg]) # XORG_WITH_M4
12971c7386f4Smrg
12981c7386f4Smrg# XORG_WITH_PS2PDF([DEFAULT])
12991c7386f4Smrg# ----------------
13001c7386f4Smrg# Minimum version: 1.6.0
13011c7386f4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13021c7386f4Smrg#
13031c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
13041c7386f4Smrg# not at the appropriate level. This macro enables a module to test for the
13051c7386f4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1306b9526c6aSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
13071c7386f4Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13081c7386f4Smrg# --with-ps2pdf assumes 'auto'.
13091c7386f4Smrg#
13101c7386f4Smrg# Interface to module:
13111c7386f4Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13121c7386f4Smrg# PS2PDF:	returns the path of the ps2pdf program found
13131c7386f4Smrg#		returns the path set by the user in the environment
13141c7386f4Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13151c7386f4Smrg#		 'no' user instructs the module not to use ps2pdf
13161c7386f4Smrg#
13171c7386f4Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13181c7386f4Smrg#
13191c7386f4SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13201c7386f4SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13211c7386f4Smrgm4_define([_defopt], m4_default([$1], [auto]))
13221c7386f4SmrgAC_ARG_WITH(ps2pdf,
13231c7386f4Smrg	AS_HELP_STRING([--with-ps2pdf],
13241c7386f4Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13251c7386f4Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13261c7386f4Smrgm4_undefine([_defopt])
13271c7386f4Smrg
13281c7386f4Smrgif test "x$use_ps2pdf" = x"auto"; then
13291c7386f4Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13301c7386f4Smrg   if test "x$PS2PDF" = "x"; then
13311c7386f4Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13321c7386f4Smrg	have_ps2pdf=no
13331c7386f4Smrg   else
13341c7386f4Smrg        have_ps2pdf=yes
13351c7386f4Smrg   fi
13361c7386f4Smrgelif test "x$use_ps2pdf" = x"yes" ; then
13371c7386f4Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13381c7386f4Smrg   if test "x$PS2PDF" = "x"; then
13391c7386f4Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13401c7386f4Smrg   fi
13411c7386f4Smrg   have_ps2pdf=yes
13421c7386f4Smrgelif test "x$use_ps2pdf" = x"no" ; then
13431c7386f4Smrg   if test "x$PS2PDF" != "x"; then
13441c7386f4Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13451c7386f4Smrg   fi
13461c7386f4Smrg   have_ps2pdf=no
13471c7386f4Smrgelse
13481c7386f4Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13491c7386f4Smrgfi
13501c7386f4SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13511c7386f4Smrg]) # XORG_WITH_PS2PDF
13521c7386f4Smrg
13531c7386f4Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
13541c7386f4Smrg# ----------------
13551c7386f4Smrg# Minimum version: 1.6.0
13561c7386f4Smrg#
13571c7386f4Smrg# Documentation tools are not always available on all platforms and sometimes
13581c7386f4Smrg# not at the appropriate level. This macro enables a builder to skip all
13591c7386f4Smrg# documentation targets except traditional man pages.
13601c7386f4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1361b9526c6aSmrg# maximum flexibility in controlling documentation building.
13621c7386f4Smrg# Refer to:
13631c7386f4Smrg# XORG_WITH_XMLTO         --with-xmlto
13641c7386f4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13651c7386f4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13661c7386f4Smrg# XORG_WITH_FOP           --with-fop
13671c7386f4Smrg# XORG_WITH_GROFF         --with-groff
13681c7386f4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13691c7386f4Smrg#
13701c7386f4Smrg# Interface to module:
13711c7386f4Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13721c7386f4Smrg# --enable-docs: 'yes' user instructs the module to generate docs
13731c7386f4Smrg#		 'no' user instructs the module not to generate docs
13741c7386f4Smrg# parm1:	specify the default value, yes or no.
13751c7386f4Smrg#
13761c7386f4SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13771c7386f4Smrgm4_define([docs_default], m4_default([$1], [yes]))
13781c7386f4SmrgAC_ARG_ENABLE(docs,
13791c7386f4Smrg	AS_HELP_STRING([--enable-docs],
13801c7386f4Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13811c7386f4Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13821c7386f4Smrgm4_undefine([docs_default])
13831c7386f4SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13841c7386f4SmrgAC_MSG_CHECKING([whether to build documentation])
13851c7386f4SmrgAC_MSG_RESULT([$build_docs])
13861c7386f4Smrg]) # XORG_ENABLE_DOCS
13871c7386f4Smrg
13881c7386f4Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13891c7386f4Smrg# ----------------
13901c7386f4Smrg# Minimum version: 1.6.0
13911c7386f4Smrg#
13921c7386f4Smrg# This macro enables a builder to skip all developer documentation.
13931c7386f4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1394b9526c6aSmrg# maximum flexibility in controlling documentation building.
13951c7386f4Smrg# Refer to:
13961c7386f4Smrg# XORG_WITH_XMLTO         --with-xmlto
13971c7386f4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13981c7386f4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13991c7386f4Smrg# XORG_WITH_FOP           --with-fop
14001c7386f4Smrg# XORG_WITH_GROFF         --with-groff
14011c7386f4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14021c7386f4Smrg#
14031c7386f4Smrg# Interface to module:
14041c7386f4Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14051c7386f4Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14061c7386f4Smrg#			'no' user instructs the module not to generate developer docs
14071c7386f4Smrg# parm1:		specify the default value, yes or no.
14081c7386f4Smrg#
14091c7386f4SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14101c7386f4Smrgm4_define([devel_default], m4_default([$1], [yes]))
14111c7386f4SmrgAC_ARG_ENABLE(devel-docs,
14121c7386f4Smrg	AS_HELP_STRING([--enable-devel-docs],
14131c7386f4Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14141c7386f4Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14151c7386f4Smrgm4_undefine([devel_default])
14161c7386f4SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14171c7386f4SmrgAC_MSG_CHECKING([whether to build developer documentation])
14181c7386f4SmrgAC_MSG_RESULT([$build_devel_docs])
14191c7386f4Smrg]) # XORG_ENABLE_DEVEL_DOCS
14201c7386f4Smrg
14211c7386f4Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
14221c7386f4Smrg# ----------------
14231c7386f4Smrg# Minimum version: 1.6.0
14241c7386f4Smrg#
14251c7386f4Smrg# This macro enables a builder to skip all functional specification targets.
14261c7386f4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1427b9526c6aSmrg# maximum flexibility in controlling documentation building.
14281c7386f4Smrg# Refer to:
14291c7386f4Smrg# XORG_WITH_XMLTO         --with-xmlto
14301c7386f4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14311c7386f4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
14321c7386f4Smrg# XORG_WITH_FOP           --with-fop
14331c7386f4Smrg# XORG_WITH_GROFF         --with-groff
14341c7386f4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14351c7386f4Smrg#
14361c7386f4Smrg# Interface to module:
14371c7386f4Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14381c7386f4Smrg# --enable-specs:	'yes' user instructs the module to generate specs
14391c7386f4Smrg#			'no' user instructs the module not to generate specs
14401c7386f4Smrg# parm1:		specify the default value, yes or no.
14411c7386f4Smrg#
14421c7386f4SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14431c7386f4Smrgm4_define([spec_default], m4_default([$1], [yes]))
14441c7386f4SmrgAC_ARG_ENABLE(specs,
14451c7386f4Smrg	AS_HELP_STRING([--enable-specs],
14461c7386f4Smrg	   [Enable building the specs (default: ]spec_default[)]),
14471c7386f4Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
14481c7386f4Smrgm4_undefine([spec_default])
14491c7386f4SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14501c7386f4SmrgAC_MSG_CHECKING([whether to build functional specifications])
14511c7386f4SmrgAC_MSG_RESULT([$build_specs])
14521c7386f4Smrg]) # XORG_ENABLE_SPECS
14531c7386f4Smrg
14541c7386f4Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14551c7386f4Smrg# ----------------------------------------------
14561c7386f4Smrg# Minimum version: 1.13.0
14571c7386f4Smrg#
14581c7386f4Smrg# This macro enables a builder to enable/disable unit testing
14591c7386f4Smrg# It makes no assumption about the test cases implementation
14601c7386f4Smrg# Test cases may or may not use Automake "Support for test suites"
14611c7386f4Smrg# They may or may not use the software utility library GLib
14621c7386f4Smrg#
14631c7386f4Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14641c7386f4Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14651c7386f4Smrg# The variable enable_unit_tests is used by other macros in this file.
14661c7386f4Smrg#
14671c7386f4Smrg# Interface to module:
14681c7386f4Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14691c7386f4Smrg# enable_unit_tests:    used in configure.ac for additional configuration
14701c7386f4Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14711c7386f4Smrg#			'no' user instructs the module not to build tests
14721c7386f4Smrg# parm1:		specify the default value, yes or no.
14731c7386f4Smrg#
14741c7386f4SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14751c7386f4SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14761c7386f4SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14771c7386f4SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14781c7386f4Smrgm4_define([_defopt], m4_default([$1], [auto]))
14791c7386f4SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14801c7386f4Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14811c7386f4Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14821c7386f4Smrgm4_undefine([_defopt])
14831c7386f4SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14841c7386f4SmrgAC_MSG_CHECKING([whether to build unit test cases])
14851c7386f4SmrgAC_MSG_RESULT([$enable_unit_tests])
14861c7386f4Smrg]) # XORG_ENABLE_UNIT_TESTS
14871c7386f4Smrg
14881c7386f4Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14891c7386f4Smrg# ------------------------------------------------------
14901c7386f4Smrg# Minimum version: 1.17.0
14911c7386f4Smrg#
14921c7386f4Smrg# This macro enables a builder to enable/disable integration testing
14931c7386f4Smrg# It makes no assumption about the test cases' implementation
14941c7386f4Smrg# Test cases may or may not use Automake "Support for test suites"
14951c7386f4Smrg#
14961c7386f4Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14971c7386f4Smrg# usually requires less dependencies and may be built and run under less
14981c7386f4Smrg# stringent environments than integration tests.
14991c7386f4Smrg#
15001c7386f4Smrg# Interface to module:
15011c7386f4Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15021c7386f4Smrg# enable_integration_tests:   used in configure.ac for additional configuration
15031c7386f4Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15041c7386f4Smrg#                             'no' user instructs the module not to build tests
15051c7386f4Smrg# parm1:                      specify the default value, yes or no.
15061c7386f4Smrg#
15071c7386f4SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15081c7386f4SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15091c7386f4Smrgm4_define([_defopt], m4_default([$1], [auto]))
15101c7386f4SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15111c7386f4Smrg	[Enable building integration test cases (default: ]_defopt[)]),
15121c7386f4Smrg	[enable_integration_tests=$enableval],
15131c7386f4Smrg	[enable_integration_tests=]_defopt)
15141c7386f4Smrgm4_undefine([_defopt])
15151c7386f4SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15161c7386f4Smrg	[test "x$enable_integration_tests" != xno])
15171c7386f4SmrgAC_MSG_CHECKING([whether to build unit test cases])
15181c7386f4SmrgAC_MSG_RESULT([$enable_integration_tests])
15191c7386f4Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
15201c7386f4Smrg
15211c7386f4Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15221c7386f4Smrg# ----------------------------------------
15231c7386f4Smrg# Minimum version: 1.13.0
15241c7386f4Smrg#
15251c7386f4Smrg# GLib is a library which provides advanced data structures and functions.
15261c7386f4Smrg# This macro enables a module to test for the presence of Glib.
15271c7386f4Smrg#
15281c7386f4Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15291c7386f4Smrg# Otherwise the value of $enable_unit_tests is blank.
15301c7386f4Smrg#
15311c7386f4Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15321c7386f4Smrg# test support usually requires less dependencies and may be built and run under
15331c7386f4Smrg# less stringent environments than integration tests.
15341c7386f4Smrg#
15351c7386f4Smrg# Interface to module:
15361c7386f4Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
15371c7386f4Smrg# with_glib: used in configure.ac to know if GLib has been found
15381c7386f4Smrg# --with-glib:	'yes' user instructs the module to use glib
15391c7386f4Smrg#		'no' user instructs the module not to use glib
15401c7386f4Smrg#
15411c7386f4SmrgAC_DEFUN([XORG_WITH_GLIB],[
15421c7386f4SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15431c7386f4Smrgm4_define([_defopt], m4_default([$2], [auto]))
15441c7386f4SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15451c7386f4Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15461c7386f4Smrg	[with_glib=$withval], [with_glib=]_defopt)
15471c7386f4Smrgm4_undefine([_defopt])
15481c7386f4Smrg
15491c7386f4Smrghave_glib=no
15501c7386f4Smrg# Do not probe GLib if user explicitly disabled unit testing
15511c7386f4Smrgif test "x$enable_unit_tests" != x"no"; then
15521c7386f4Smrg  # Do not probe GLib if user explicitly disabled it
15531c7386f4Smrg  if test "x$with_glib" != x"no"; then
15541c7386f4Smrg    m4_ifval(
15551c7386f4Smrg      [$1],
15561c7386f4Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15571c7386f4Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15581c7386f4Smrg    )
15591c7386f4Smrg  fi
15601c7386f4Smrgfi
15611c7386f4Smrg
15621c7386f4Smrg# Not having GLib when unit testing has been explicitly requested is an error
15631c7386f4Smrgif test "x$enable_unit_tests" = x"yes"; then
15641c7386f4Smrg  if test "x$have_glib" = x"no"; then
15651c7386f4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15661c7386f4Smrg  fi
15671c7386f4Smrgfi
15681c7386f4Smrg
15691c7386f4Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
15701c7386f4Smrgif test "x$enable_unit_tests" = x"no"; then
15711c7386f4Smrg  if test "x$with_glib" = x"yes"; then
15721c7386f4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15731c7386f4Smrg  fi
15741c7386f4Smrgfi
15751c7386f4Smrg
15761c7386f4Smrg# Not having GLib when it has been explicitly requested is an error
15771c7386f4Smrgif test "x$with_glib" = x"yes"; then
15781c7386f4Smrg  if test "x$have_glib" = x"no"; then
15791c7386f4Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15801c7386f4Smrg  fi
15811c7386f4Smrgfi
15821c7386f4Smrg
15831c7386f4SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15841c7386f4Smrg]) # XORG_WITH_GLIB
15851c7386f4Smrg
15861c7386f4Smrg# XORG_LD_WRAP([required|optional])
15871c7386f4Smrg# ---------------------------------
15881c7386f4Smrg# Minimum version: 1.13.0
15891c7386f4Smrg#
15901c7386f4Smrg# Check if linker supports -wrap, passed via compiler flags
15911c7386f4Smrg#
15921c7386f4Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15931c7386f4Smrg# Otherwise the value of $enable_unit_tests is blank.
15941c7386f4Smrg#
15951c7386f4Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15961c7386f4Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15971c7386f4Smrg# available, an argument of "optional" allows use when some unit tests require
15981c7386f4Smrg# ld -wrap and others do not.
15991c7386f4Smrg#
16001c7386f4SmrgAC_DEFUN([XORG_LD_WRAP],[
16011c7386f4SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16021c7386f4Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16031c7386f4Smrg                      void __wrap_exit(int status) { return; }],
16041c7386f4Smrg                     [exit(0);])])
16051c7386f4Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
16061c7386f4Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16071c7386f4Smrg  if test "x$have_ld_wrap" = x"no"; then
16081c7386f4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16091c7386f4Smrg  fi
16101c7386f4Smrgfi
16111c7386f4SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16121c7386f4Smrg#
16131c7386f4Smrg]) # XORG_LD_WRAP
16141c7386f4Smrg
16151c7386f4Smrg# XORG_CHECK_LINKER_FLAGS
16161c7386f4Smrg# -----------------------
16171c7386f4Smrg# SYNOPSIS
16181c7386f4Smrg#
16191c7386f4Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16201c7386f4Smrg#
16211c7386f4Smrg# DESCRIPTION
16221c7386f4Smrg#
16231c7386f4Smrg#   Check whether the given linker FLAGS work with the current language's
16241c7386f4Smrg#   linker, or whether they give an error.
16251c7386f4Smrg#
16261c7386f4Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16271c7386f4Smrg#   success/failure.
16281c7386f4Smrg#
16291c7386f4Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
16301c7386f4Smrg#
16311c7386f4Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16321c7386f4Smrg#
16331c7386f4Smrg# LICENSE
16341c7386f4Smrg#
16351c7386f4Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16361c7386f4Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16371c7386f4Smrg#   Copyright (c) 2009 Matteo Frigo
16381c7386f4Smrg#
16391c7386f4Smrg#   This program is free software: you can redistribute it and/or modify it
16401c7386f4Smrg#   under the terms of the GNU General Public License as published by the
16411c7386f4Smrg#   Free Software Foundation, either version 3 of the License, or (at your
16421c7386f4Smrg#   option) any later version.
16431c7386f4Smrg#
16441c7386f4Smrg#   This program is distributed in the hope that it will be useful, but
16451c7386f4Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16461c7386f4Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16471c7386f4Smrg#   Public License for more details.
16481c7386f4Smrg#
16491c7386f4Smrg#   You should have received a copy of the GNU General Public License along
16501c7386f4Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16511c7386f4Smrg#
16521c7386f4Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
16531c7386f4Smrg#   gives unlimited permission to copy, distribute and modify the configure
16541c7386f4Smrg#   scripts that are the output of Autoconf when processing the Macro. You
16551c7386f4Smrg#   need not follow the terms of the GNU General Public License when using
16561c7386f4Smrg#   or distributing such scripts, even though portions of the text of the
16571c7386f4Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16581c7386f4Smrg#   all other use of the material that constitutes the Autoconf Macro.
16591c7386f4Smrg#
16601c7386f4Smrg#   This special exception to the GPL applies to versions of the Autoconf
16611c7386f4Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
16621c7386f4Smrg#   modified version of the Autoconf Macro, you may extend this special
16631c7386f4Smrg#   exception to the GPL to apply to your modified version as well.#
16641c7386f4SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16651c7386f4Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
16661c7386f4Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16671c7386f4SmrgAS_LITERAL_IF([$1],
16681c7386f4Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16691c7386f4Smrg      ax_save_FLAGS=$LDFLAGS
16701c7386f4Smrg      LDFLAGS="$1"
16711c7386f4Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16721c7386f4Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16731c7386f4Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16741c7386f4Smrg      LDFLAGS=$ax_save_FLAGS])],
16751c7386f4Smrg  [ax_save_FLAGS=$LDFLAGS
16761c7386f4Smrg   LDFLAGS="$1"
16771c7386f4Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16781c7386f4Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16791c7386f4Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16801c7386f4Smrg   LDFLAGS=$ax_save_FLAGS])
16811c7386f4Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16821c7386f4SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16831c7386f4Smrgif test "x$xorg_check_linker_flags" = xyes; then
16841c7386f4Smrg	m4_default([$2], :)
16851c7386f4Smrgelse
16861c7386f4Smrg	m4_default([$3], :)
16871c7386f4Smrgfi
16881c7386f4Smrg]) # XORG_CHECK_LINKER_FLAGS
16891c7386f4Smrg
16901c7386f4Smrg# XORG_MEMORY_CHECK_FLAGS
16911c7386f4Smrg# -----------------------
16921c7386f4Smrg# Minimum version: 1.16.0
16931c7386f4Smrg#
16941c7386f4Smrg# This macro attempts to find appropriate memory checking functionality
16951c7386f4Smrg# for various platforms which unit testing code may use to catch various
16961c7386f4Smrg# forms of memory allocation and access errors in testing.
16971c7386f4Smrg#
16981c7386f4Smrg# Interface to module:
16991c7386f4Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17001c7386f4Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17011c7386f4Smrg#
17021c7386f4Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17031c7386f4Smrg#
17041c7386f4SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17051c7386f4Smrg
17061c7386f4SmrgAC_REQUIRE([AC_CANONICAL_HOST])
17071c7386f4SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17081c7386f4Smrg           [Environment variables to enable memory checking in tests])
17091c7386f4Smrg
17101c7386f4Smrg# Check for different types of support on different platforms
17111c7386f4Smrgcase $host_os in
17121c7386f4Smrg    solaris*)
17131c7386f4Smrg        AC_CHECK_LIB([umem], [umem_alloc],
17141c7386f4Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17151c7386f4Smrg        ;;
17161c7386f4Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17171c7386f4Smrg        # both directly and inverted, so should not be 0 or 255.
17181c7386f4Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
17191c7386f4Smrg        ;;
17201c7386f4Smrg    darwin*)
17211c7386f4Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17221c7386f4Smrg        ;;
17231c7386f4Smrg    *bsd*)
17241c7386f4Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17251c7386f4Smrg        ;;
17261c7386f4Smrgesac
17271c7386f4Smrg
17281c7386f4Smrg# User supplied flags override default flags
17291c7386f4Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17301c7386f4Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
17311c7386f4Smrgfi
17321c7386f4Smrg
17331c7386f4SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17341c7386f4Smrg]) # XORG_WITH_LINT
17351c7386f4Smrg
17361c7386f4Smrg# XORG_CHECK_MALLOC_ZERO
17371c7386f4Smrg# ----------------------
17381c7386f4Smrg# Minimum version: 1.0.0
17391c7386f4Smrg#
17401c7386f4Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17411c7386f4Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17421c7386f4Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17431c7386f4SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17441c7386f4SmrgAC_ARG_ENABLE(malloc0returnsnull,
17451c7386f4Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17461c7386f4Smrg		       [malloc(0) returns NULL (default: auto)]),
17471c7386f4Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17481c7386f4Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
17491c7386f4Smrg
17501c7386f4SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17511c7386f4Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17521c7386f4SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17531c7386f4Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17541c7386f4Smrg#include <stdlib.h>
17551c7386f4Smrg],[
17561c7386f4Smrg    char *m0, *r0, *c0, *p;
17571c7386f4Smrg    m0 = malloc(0);
17581c7386f4Smrg    p = malloc(10);
17591c7386f4Smrg    r0 = realloc(p,0);
17601c7386f4Smrg    c0 = calloc(0,10);
17611c7386f4Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17621c7386f4Smrg])],
17631c7386f4Smrg		[xorg_cv_malloc0_returns_null=yes],
17641c7386f4Smrg		[xorg_cv_malloc0_returns_null=no])])
17651c7386f4SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
17661c7386f4Smrgfi
17671c7386f4SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17681c7386f4Smrg
17691c7386f4Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17701c7386f4Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17711c7386f4Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17721c7386f4Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17731c7386f4Smrgelse
17741c7386f4Smrg	MALLOC_ZERO_CFLAGS=""
17751c7386f4Smrg	XMALLOC_ZERO_CFLAGS=""
17761c7386f4Smrg	XTMALLOC_ZERO_CFLAGS=""
17771c7386f4Smrgfi
17781c7386f4Smrg
17791c7386f4SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17801c7386f4SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17811c7386f4SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17821c7386f4Smrg]) # XORG_CHECK_MALLOC_ZERO
17831c7386f4Smrg
17841c7386f4Smrg# XORG_WITH_LINT()
17851c7386f4Smrg# ----------------
17861c7386f4Smrg# Minimum version: 1.1.0
17871c7386f4Smrg#
17881c7386f4Smrg# This macro enables the use of a tool that flags some suspicious and
17891c7386f4Smrg# non-portable constructs (likely to be bugs) in C language source code.
17901c7386f4Smrg# It will attempt to locate the tool and use appropriate options.
17911c7386f4Smrg# There are various lint type tools on different platforms.
17921c7386f4Smrg#
17931c7386f4Smrg# Interface to module:
17941c7386f4Smrg# LINT:		returns the path to the tool found on the platform
17951c7386f4Smrg#		or the value set to LINT on the configure cmd line
17961c7386f4Smrg#		also an Automake conditional
17971c7386f4Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17981c7386f4Smrg#
17991c7386f4Smrg# --with-lint:	'yes' user instructs the module to use lint
18001c7386f4Smrg#		'no' user instructs the module not to use lint (default)
18011c7386f4Smrg#
18021c7386f4Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18031c7386f4Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18041c7386f4Smrg#
18051c7386f4SmrgAC_DEFUN([XORG_WITH_LINT],[
18061c7386f4Smrg
18071c7386f4SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18081c7386f4SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18091c7386f4SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18101c7386f4Smrg		[Use a lint-style source code checker (default: disabled)])],
18111c7386f4Smrg		[use_lint=$withval], [use_lint=no])
18121c7386f4Smrg
18131c7386f4Smrg# Obtain platform specific info like program name and options
18141c7386f4Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18151c7386f4Smrgcase $host_os in
18161c7386f4Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18171c7386f4Smrg	lint_name=splint
18181c7386f4Smrg	lint_options="-badflag"
18191c7386f4Smrg	;;
18201c7386f4Smrg  *freebsd* | *netbsd*)
18211c7386f4Smrg	lint_name=lint
18221c7386f4Smrg	lint_options="-u -b"
18231c7386f4Smrg	;;
18241c7386f4Smrg  *solaris*)
18251c7386f4Smrg	lint_name=lint
18261c7386f4Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18271c7386f4Smrg	;;
18281c7386f4Smrgesac
18291c7386f4Smrg
18301c7386f4Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18311c7386f4Smrgif test "x$use_lint" = x"yes" ; then
18321c7386f4Smrg   AC_PATH_PROG([LINT], [$lint_name])
18331c7386f4Smrg   if test "x$LINT" = "x"; then
18341c7386f4Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18351c7386f4Smrg   fi
18361c7386f4Smrgelif test "x$use_lint" = x"no" ; then
18371c7386f4Smrg   if test "x$LINT" != "x"; then
18381c7386f4Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18391c7386f4Smrg   fi
18401c7386f4Smrgelse
18411c7386f4Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18421c7386f4Smrgfi
18431c7386f4Smrg
18441c7386f4Smrg# User supplied flags override default flags
18451c7386f4Smrgif test "x$LINT_FLAGS" != "x"; then
18461c7386f4Smrg   lint_options=$LINT_FLAGS
18471c7386f4Smrgfi
18481c7386f4Smrg
18491c7386f4SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18501c7386f4SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
18511c7386f4Smrg
18521c7386f4Smrg]) # XORG_WITH_LINT
18531c7386f4Smrg
18541c7386f4Smrg# XORG_LINT_LIBRARY(LIBNAME)
18551c7386f4Smrg# --------------------------
18561c7386f4Smrg# Minimum version: 1.1.0
18571c7386f4Smrg#
18581c7386f4Smrg# Sets up flags for building lint libraries for checking programs that call
18591c7386f4Smrg# functions in the library.
18601c7386f4Smrg#
18611c7386f4Smrg# Interface to module:
18621c7386f4Smrg# LINTLIB		- Automake variable with the name of lint library file to make
18631c7386f4Smrg# MAKE_LINT_LIB		- Automake conditional
18641c7386f4Smrg#
18651c7386f4Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18661c7386f4Smrg#			  - 'no' user instructs the module not to create a lint library (default)
18671c7386f4Smrg
18681c7386f4SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18691c7386f4SmrgAC_REQUIRE([XORG_WITH_LINT])
18701c7386f4SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18711c7386f4Smrg	[Create lint library (default: disabled)])],
18721c7386f4Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18731c7386f4Smrg
18741c7386f4Smrgif test "x$make_lint_lib" = x"yes" ; then
18751c7386f4Smrg   LINTLIB=llib-l$1.ln
18761c7386f4Smrg   if test "x$LINT" = "x"; then
18771c7386f4Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18781c7386f4Smrg   fi
18791c7386f4Smrgelif test "x$make_lint_lib" != x"no" ; then
18801c7386f4Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18811c7386f4Smrgfi
18821c7386f4Smrg
18831c7386f4SmrgAC_SUBST(LINTLIB)
18841c7386f4SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18851c7386f4Smrg
18861c7386f4Smrg]) # XORG_LINT_LIBRARY
18871c7386f4Smrg
18881c7386f4Smrg# XORG_COMPILER_BRAND
18891c7386f4Smrg# -------------------
18901c7386f4Smrg# Minimum version: 1.14.0
18911c7386f4Smrg#
18921c7386f4Smrg# Checks for various brands of compilers and sets flags as appropriate:
18931c7386f4Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18941c7386f4Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18951c7386f4Smrg#   clang compiler - sets CLANGCC to "yes"
18961c7386f4Smrg#   Intel compiler - sets INTELCC to "yes"
18971c7386f4Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18981c7386f4Smrg#
18991c7386f4SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19001c7386f4SmrgAC_LANG_CASE(
19011c7386f4Smrg	[C], [
1902b9526c6aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
1903b9526c6aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
1904b9526c6aSmrg		m4_version_prereq([2.70],
1905b9526c6aSmrg			[AC_REQUIRE([AC_PROG_CC])],
1906b9526c6aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
19071c7386f4Smrg	],
19081c7386f4Smrg	[C++], [
19091c7386f4Smrg		AC_REQUIRE([AC_PROG_CXX])
19101c7386f4Smrg	]
19111c7386f4Smrg)
19121c7386f4SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19131c7386f4SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19141c7386f4SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19151c7386f4Smrg]) # XORG_COMPILER_BRAND
19161c7386f4Smrg
19171c7386f4Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19181c7386f4Smrg# ---------------
19191c7386f4Smrg# Minimum version: 1.16.0
19201c7386f4Smrg#
19211c7386f4Smrg# Test if the compiler works when passed the given flag as a command line argument.
1922b9526c6aSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
19231c7386f4Smrg# next flag in the list until there are no more options.
19241c7386f4Smrg#
19251c7386f4Smrg# Note that this does not guarantee that the compiler supports the flag as some
19261c7386f4Smrg# compilers will simply ignore arguments that they do not understand, but we do
19271c7386f4Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19281c7386f4Smrg# -Werror=unused-command-line-argument
19291c7386f4Smrg#
19301c7386f4SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19311c7386f4Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19321c7386f4Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19331c7386f4Smrg
19341c7386f4SmrgAC_LANG_COMPILER_REQUIRE
19351c7386f4Smrg
19361c7386f4SmrgAC_LANG_CASE(
19371c7386f4Smrg	[C], [
1938b9526c6aSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
1939b9526c6aSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
1940b9526c6aSmrg		m4_version_prereq([2.70],
1941b9526c6aSmrg			[AC_REQUIRE([AC_PROG_CC])],
1942b9526c6aSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
19431c7386f4Smrg		define([PREFIX], [C])
19441c7386f4Smrg		define([CACHE_PREFIX], [cc])
19451c7386f4Smrg		define([COMPILER], [$CC])
19461c7386f4Smrg	],
19471c7386f4Smrg	[C++], [
19481c7386f4Smrg		define([PREFIX], [CXX])
19491c7386f4Smrg		define([CACHE_PREFIX], [cxx])
19501c7386f4Smrg		define([COMPILER], [$CXX])
19511c7386f4Smrg	]
19521c7386f4Smrg)
19531c7386f4Smrg
19541c7386f4Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19551c7386f4Smrg
19561c7386f4Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19571c7386f4Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19581c7386f4Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19591c7386f4Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19601c7386f4Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19611c7386f4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19621c7386f4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19631c7386f4Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19641c7386f4Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19651c7386f4Smrgfi
19661c7386f4Smrg
19671c7386f4Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19681c7386f4Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19691c7386f4Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19701c7386f4Smrg	fi
19711c7386f4Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19721c7386f4Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19731c7386f4Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19741c7386f4Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19751c7386f4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19761c7386f4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19771c7386f4Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19781c7386f4Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19791c7386f4Smrgfi
19801c7386f4Smrg
19811c7386f4Smrgfound="no"
19821c7386f4Smrgm4_foreach([flag], m4_cdr($@), [
19831c7386f4Smrg	if test $found = "no" ; then
19841c7386f4Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19851c7386f4Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19861c7386f4Smrg		fi
19871c7386f4Smrg
19881c7386f4Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19891c7386f4Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19901c7386f4Smrg		fi
19911c7386f4Smrg
19921c7386f4Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19931c7386f4Smrg
19941c7386f4Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19951c7386f4Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19961c7386f4Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19971c7386f4Smrg		AC_CACHE_VAL($cacheid,
19981c7386f4Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19991c7386f4Smrg					     [eval $cacheid=yes],
20001c7386f4Smrg					     [eval $cacheid=no])])
20011c7386f4Smrg
20021c7386f4Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
20031c7386f4Smrg
20041c7386f4Smrg		eval supported=\$$cacheid
20051c7386f4Smrg		AC_MSG_RESULT([$supported])
20061c7386f4Smrg		if test "$supported" = "yes" ; then
20071c7386f4Smrg			$1="$$1 ]flag["
20081c7386f4Smrg			found="yes"
20091c7386f4Smrg		fi
20101c7386f4Smrg	fi
20111c7386f4Smrg])
20121c7386f4Smrg]) # XORG_TESTSET_CFLAG
20131c7386f4Smrg
20141c7386f4Smrg# XORG_COMPILER_FLAGS
20151c7386f4Smrg# ---------------
20161c7386f4Smrg# Minimum version: 1.16.0
20171c7386f4Smrg#
20181c7386f4Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20191c7386f4Smrg# arguments supported by the selected compiler which do NOT alter the generated
20201c7386f4Smrg# code.  These arguments will cause the compiler to print various warnings
20211c7386f4Smrg# during compilation AND turn a conservative set of warnings into errors.
20221c7386f4Smrg#
20231c7386f4Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20241c7386f4Smrg# future versions of util-macros as options are added to new compilers.
20251c7386f4Smrg#
20261c7386f4SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20271c7386f4SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20281c7386f4Smrg
20291c7386f4SmrgAC_ARG_ENABLE(selective-werror,
20301c7386f4Smrg              AS_HELP_STRING([--disable-selective-werror],
20311c7386f4Smrg                             [Turn off selective compiler errors. (default: enabled)]),
20321c7386f4Smrg              [SELECTIVE_WERROR=$enableval],
20331c7386f4Smrg              [SELECTIVE_WERROR=yes])
20341c7386f4Smrg
20351c7386f4SmrgAC_LANG_CASE(
20361c7386f4Smrg        [C], [
20371c7386f4Smrg                define([PREFIX], [C])
20381c7386f4Smrg        ],
20391c7386f4Smrg        [C++], [
20401c7386f4Smrg                define([PREFIX], [CXX])
20411c7386f4Smrg        ]
20421c7386f4Smrg)
20431c7386f4Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20441c7386f4Smrgif test "x$SUNCC" = "xyes"; then
20451c7386f4Smrg    [BASE_]PREFIX[FLAGS]="-v"
20461c7386f4Smrgelse
20471c7386f4Smrg    [BASE_]PREFIX[FLAGS]=""
20481c7386f4Smrgfi
20491c7386f4Smrg
20501c7386f4Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20511c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20521c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20531c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20541c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20551c7386f4Smrg
20561c7386f4SmrgAC_LANG_CASE(
20571c7386f4Smrg	[C], [
20581c7386f4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20591c7386f4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20601c7386f4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20611c7386f4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20621c7386f4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20631c7386f4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20641c7386f4Smrg	]
20651c7386f4Smrg)
20661c7386f4Smrg
20671c7386f4Smrg# This chunk adds additional warnings that could catch undesired effects.
20681c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20691c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20701c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20711c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20721c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20731c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20741c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20751c7386f4Smrg
20761c7386f4Smrg# These are currently disabled because they are noisy.  They will be enabled
20771c7386f4Smrg# in the future once the codebase is sufficiently modernized to silence
20781c7386f4Smrg# them.  For now, I don't want them to drown out the other warnings.
20791c7386f4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20801c7386f4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20811c7386f4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20821c7386f4Smrg
2083b9526c6aSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
20841c7386f4Smrg# when there are problems that should be fixed.
20851c7386f4Smrg
20861c7386f4Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20871c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20881c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20891c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20901c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20911c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20921c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20931c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20941c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20951c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20961c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20971c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20981c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20991c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
21001c7386f4Smrgelse
21011c7386f4SmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
21021c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
21031c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
21041c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
21051c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
21061c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
21071c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21081c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21091c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21101c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21111c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21121c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21131c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21141c7386f4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
21151c7386f4Smrgfi
21161c7386f4Smrg
21171c7386f4SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21181c7386f4Smrg]) # XORG_COMPILER_FLAGS
21191c7386f4Smrg
21201c7386f4Smrg# XORG_CWARNFLAGS
21211c7386f4Smrg# ---------------
21221c7386f4Smrg# Minimum version: 1.2.0
21231c7386f4Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21241c7386f4Smrg#
21251c7386f4Smrg# Defines CWARNFLAGS to enable C compiler warnings.
21261c7386f4Smrg#
21271c7386f4Smrg# This function is deprecated because it defines -fno-strict-aliasing
21281c7386f4Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21291c7386f4Smrg# is needed, then it should be added explicitly in the module when
21301c7386f4Smrg# it is updated to use BASE_CFLAGS.
21311c7386f4Smrg#
21321c7386f4SmrgAC_DEFUN([XORG_CWARNFLAGS], [
21331c7386f4SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21341c7386f4SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21351c7386f4SmrgAC_LANG_CASE(
21361c7386f4Smrg	[C], [
21371c7386f4Smrg		CWARNFLAGS="$BASE_CFLAGS"
21381c7386f4Smrg		if  test "x$GCC" = xyes ; then
21391c7386f4Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21401c7386f4Smrg		fi
21411c7386f4Smrg		AC_SUBST(CWARNFLAGS)
21421c7386f4Smrg	]
21431c7386f4Smrg)
21441c7386f4Smrg]) # XORG_CWARNFLAGS
21451c7386f4Smrg
21461c7386f4Smrg# XORG_STRICT_OPTION
21471c7386f4Smrg# -----------------------
21481c7386f4Smrg# Minimum version: 1.3.0
21491c7386f4Smrg#
21501c7386f4Smrg# Add configure option to enable strict compilation flags, such as treating
21511c7386f4Smrg# warnings as fatal errors.
21521c7386f4Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21531c7386f4Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21541c7386f4Smrg#
21551c7386f4Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21561c7386f4Smrg# when strict compilation is unconditionally desired.
21571c7386f4SmrgAC_DEFUN([XORG_STRICT_OPTION], [
21581c7386f4SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21591c7386f4SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21601c7386f4Smrg
21611c7386f4SmrgAC_ARG_ENABLE(strict-compilation,
21621c7386f4Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21631c7386f4Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21641c7386f4Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21651c7386f4Smrg
21661c7386f4SmrgAC_LANG_CASE(
21671c7386f4Smrg        [C], [
21681c7386f4Smrg                define([PREFIX], [C])
21691c7386f4Smrg        ],
21701c7386f4Smrg        [C++], [
21711c7386f4Smrg                define([PREFIX], [CXX])
21721c7386f4Smrg        ]
21731c7386f4Smrg)
21741c7386f4Smrg
21751c7386f4Smrg[STRICT_]PREFIX[FLAGS]=""
21761c7386f4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21771c7386f4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21781c7386f4Smrg
21791c7386f4Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21801c7386f4Smrg# activate it with -Werror, so we add it here explicitly.
21811c7386f4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21821c7386f4Smrg
21831c7386f4Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21841c7386f4Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21851c7386f4Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21861c7386f4Smrgfi
21871c7386f4SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21881c7386f4SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21891c7386f4SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21901c7386f4Smrg]) # XORG_STRICT_OPTION
21911c7386f4Smrg
2192b9526c6aSmrg# XORG_DEFAULT_NOCODE_OPTIONS
2193b9526c6aSmrg# ---------------------------
2194b9526c6aSmrg# Minimum version: 1.20.0
2195b9526c6aSmrg#
2196b9526c6aSmrg# Defines default options for X.Org modules which don't compile code,
2197b9526c6aSmrg# such as fonts, bitmaps, cursors, and docs.
2198b9526c6aSmrg#
2199b9526c6aSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
2200b9526c6aSmrgAC_REQUIRE([AC_PROG_INSTALL])
2201b9526c6aSmrgXORG_RELEASE_VERSION
2202b9526c6aSmrgXORG_CHANGELOG
2203b9526c6aSmrgXORG_INSTALL
2204b9526c6aSmrgXORG_MANPAGE_SECTIONS
2205b9526c6aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2206b9526c6aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2207b9526c6aSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
2208b9526c6aSmrg
22091c7386f4Smrg# XORG_DEFAULT_OPTIONS
22101c7386f4Smrg# --------------------
22111c7386f4Smrg# Minimum version: 1.3.0
22121c7386f4Smrg#
2213b9526c6aSmrg# Defines default options for X.Org modules which compile code.
22141c7386f4Smrg#
22151c7386f4SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
22161c7386f4SmrgAC_REQUIRE([AC_PROG_INSTALL])
22171c7386f4SmrgXORG_COMPILER_FLAGS
22181c7386f4SmrgXORG_CWARNFLAGS
22191c7386f4SmrgXORG_STRICT_OPTION
2220b9526c6aSmrgXORG_DEFAULT_NOCODE_OPTIONS
22211c7386f4Smrg]) # XORG_DEFAULT_OPTIONS
22221c7386f4Smrg
22231c7386f4Smrg# XORG_INSTALL()
22241c7386f4Smrg# ----------------
22251c7386f4Smrg# Minimum version: 1.4.0
22261c7386f4Smrg#
22271c7386f4Smrg# Defines the variable INSTALL_CMD as the command to copy
22281c7386f4Smrg# INSTALL from $prefix/share/util-macros.
22291c7386f4Smrg#
22301c7386f4SmrgAC_DEFUN([XORG_INSTALL], [
22311c7386f4SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22321c7386f4Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22331c7386f4SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22341c7386f4Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2235aa30ed02Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
2236aa30ed02Smrgtouch \$(top_srcdir)/INSTALL; \
2237aa30ed02Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22381c7386f4SmrgAC_SUBST([INSTALL_CMD])
22391c7386f4Smrg]) # XORG_INSTALL
22401c7386f4Smrgdnl Copyright 2005 Red Hat, Inc
22411c7386f4Smrgdnl
22421c7386f4Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22431c7386f4Smrgdnl documentation for any purpose is hereby granted without fee, provided that
22441c7386f4Smrgdnl the above copyright notice appear in all copies and that both that
22451c7386f4Smrgdnl copyright notice and this permission notice appear in supporting
22461c7386f4Smrgdnl documentation.
22471c7386f4Smrgdnl
22481c7386f4Smrgdnl The above copyright notice and this permission notice shall be included
22491c7386f4Smrgdnl in all copies or substantial portions of the Software.
22501c7386f4Smrgdnl
22511c7386f4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22521c7386f4Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22531c7386f4Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22541c7386f4Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22551c7386f4Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22561c7386f4Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22571c7386f4Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
22581c7386f4Smrgdnl
22591c7386f4Smrgdnl Except as contained in this notice, the name of the copyright holders shall
22601c7386f4Smrgdnl not be used in advertising or otherwise to promote the sale, use or
22611c7386f4Smrgdnl other dealings in this Software without prior written authorization
22621c7386f4Smrgdnl from the copyright holders.
22631c7386f4Smrgdnl
22641c7386f4Smrg
22651c7386f4Smrg# XORG_RELEASE_VERSION
22661c7386f4Smrg# --------------------
22671c7386f4Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
22681c7386f4Smrg
22691c7386f4SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22701c7386f4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22711c7386f4Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22721c7386f4Smrg		[Major version of this package])
22731c7386f4Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22741c7386f4Smrg	if test "x$PVM" = "x"; then
22751c7386f4Smrg		PVM="0"
22761c7386f4Smrg	fi
22771c7386f4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22781c7386f4Smrg		[$PVM],
22791c7386f4Smrg		[Minor version of this package])
22801c7386f4Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22811c7386f4Smrg	if test "x$PVP" = "x"; then
22821c7386f4Smrg		PVP="0"
22831c7386f4Smrg	fi
22841c7386f4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22851c7386f4Smrg		[$PVP],
22861c7386f4Smrg		[Patch version of this package])
22871c7386f4Smrg])
22881c7386f4Smrg
22891c7386f4Smrg# XORG_CHANGELOG()
22901c7386f4Smrg# ----------------
22911c7386f4Smrg# Minimum version: 1.2.0
22921c7386f4Smrg#
22931c7386f4Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22941c7386f4Smrg# ChangeLog from git.
22951c7386f4Smrg#
22961c7386f4Smrg#
22971c7386f4SmrgAC_DEFUN([XORG_CHANGELOG], [
2298aa30ed02SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22991c7386f4Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2300aa30ed02Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
2301aa30ed02Smrgtouch \$(top_srcdir)/ChangeLog; \
2302aa30ed02Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
23031c7386f4SmrgAC_SUBST([CHANGELOG_CMD])
23041c7386f4Smrg]) # XORG_CHANGELOG
23051c7386f4Smrg
23068ffb90f1Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2307602e473dSmrg#
230808c70cfbSmrg# This file is free software; the Free Software Foundation
230908c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
231008c70cfbSmrg# with or without modifications, as long as this notice is preserved.
231108c70cfbSmrg
231208c70cfbSmrg# AM_AUTOMAKE_VERSION(VERSION)
231308c70cfbSmrg# ----------------------------
231408c70cfbSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
231508c70cfbSmrg# generated from the m4 files accompanying Automake X.Y.
231608c70cfbSmrg# (This private macro should not be called outside this file.)
231708c70cfbSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2318fe12f63cSmrg[am__api_version='1.16'
231908c70cfbSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
232008c70cfbSmrgdnl require some minimum version.  Point them to the right macro.
23218ffb90f1Smrgm4_if([$1], [1.16.5], [],
232208c70cfbSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
232308c70cfbSmrg])
232408c70cfbSmrg
232508c70cfbSmrg# _AM_AUTOCONF_VERSION(VERSION)
232608c70cfbSmrg# -----------------------------
232708c70cfbSmrg# aclocal traces this macro to find the Autoconf version.
232808c70cfbSmrg# This is a private macro too.  Using m4_define simplifies
232908c70cfbSmrg# the logic in aclocal, which can simply ignore this definition.
233008c70cfbSmrgm4_define([_AM_AUTOCONF_VERSION], [])
233108c70cfbSmrg
233208c70cfbSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
233308c70cfbSmrg# -------------------------------
233408c70cfbSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
233508c70cfbSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
233608c70cfbSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
23378ffb90f1Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
233808c70cfbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
233908c70cfbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
234008c70cfbSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
234108c70cfbSmrg
234208c70cfbSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
234308c70cfbSmrg
23448ffb90f1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2345602e473dSmrg#
234608c70cfbSmrg# This file is free software; the Free Software Foundation
234708c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
234808c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2349602e473dSmrg
235008c70cfbSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
235108c70cfbSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
235208c70cfbSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2353602e473dSmrg#
235408c70cfbSmrg# Of course, Automake must honor this variable whenever it calls a
235508c70cfbSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
235608c70cfbSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
235708c70cfbSmrg# depending on how configure is run.  This is pretty annoying, since
235808c70cfbSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
235908c70cfbSmrg# source directory, any form will work fine, but in subdirectories a
236008c70cfbSmrg# relative path needs to be adjusted first.
2361602e473dSmrg#
236208c70cfbSmrg# $ac_aux_dir/missing
236308c70cfbSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
236408c70cfbSmrg# $top_srcdir/$ac_aux_dir/missing
236508c70cfbSmrg#    fails if $ac_aux_dir is absolute,
236608c70cfbSmrg#    fails when called from a subdirectory in a VPATH build with
236708c70cfbSmrg#          a relative $ac_aux_dir
2368602e473dSmrg#
236908c70cfbSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
237008c70cfbSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
237108c70cfbSmrg# harmless because $srcdir is '.', but things will broke when you
237208c70cfbSmrg# start a VPATH build or use an absolute $srcdir.
2373602e473dSmrg#
237408c70cfbSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
237508c70cfbSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
237608c70cfbSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
237708c70cfbSmrg# and then we would define $MISSING as
237808c70cfbSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
237908c70cfbSmrg# This will work as long as MISSING is not called from configure, because
238008c70cfbSmrg# unfortunately $(top_srcdir) has no meaning in configure.
238108c70cfbSmrg# However there are other variables, like CC, which are often used in
238208c70cfbSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2383602e473dSmrg#
238408c70cfbSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
238508c70cfbSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
238608c70cfbSmrg# configured tree to be moved without reconfiguration.
2387602e473dSmrg
238808c70cfbSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
2389709d36bbSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2390709d36bbSmrg# Expand $ac_aux_dir to an absolute path.
2391709d36bbSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
2392602e473dSmrg])
2393602e473dSmrg
239408c70cfbSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2395602e473dSmrg
23968ffb90f1Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
239708c70cfbSmrg#
239808c70cfbSmrg# This file is free software; the Free Software Foundation
239908c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
240008c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2401602e473dSmrg
240208c70cfbSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
240308c70cfbSmrg# -------------------------------------
240408c70cfbSmrg# Define a conditional.
240508c70cfbSmrgAC_DEFUN([AM_CONDITIONAL],
240608c70cfbSmrg[AC_PREREQ([2.52])dnl
240708c70cfbSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
240808c70cfbSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
240908c70cfbSmrgAC_SUBST([$1_TRUE])dnl
241008c70cfbSmrgAC_SUBST([$1_FALSE])dnl
241108c70cfbSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
241208c70cfbSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
241308c70cfbSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
241408c70cfbSmrgif $2; then
241508c70cfbSmrg  $1_TRUE=
241608c70cfbSmrg  $1_FALSE='#'
241708c70cfbSmrgelse
241808c70cfbSmrg  $1_TRUE='#'
241908c70cfbSmrg  $1_FALSE=
242008c70cfbSmrgfi
242108c70cfbSmrgAC_CONFIG_COMMANDS_PRE(
242208c70cfbSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
242308c70cfbSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
242408c70cfbSmrgUsually this means the macro was only invoked conditionally.]])
242508c70cfbSmrgfi])])
2426602e473dSmrg
24278ffb90f1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
242808c70cfbSmrg#
242908c70cfbSmrg# This file is free software; the Free Software Foundation
243008c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
243108c70cfbSmrg# with or without modifications, as long as this notice is preserved.
243221298544Smrg
2433602e473dSmrg
243408c70cfbSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
243508c70cfbSmrg# written in clear, in which case automake, when reading aclocal.m4,
243608c70cfbSmrg# will think it sees a *use*, and therefore will trigger all it's
243708c70cfbSmrg# C support machinery.  Also note that it means that autoscan, seeing
243808c70cfbSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2439602e473dSmrg
2440602e473dSmrg
244108c70cfbSmrg# _AM_DEPENDENCIES(NAME)
244208c70cfbSmrg# ----------------------
244308c70cfbSmrg# See how the compiler implements dependency checking.
244408c70cfbSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
244508c70cfbSmrg# We try a few techniques and use that to set a single cache variable.
244608c70cfbSmrg#
244708c70cfbSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
244808c70cfbSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
244908c70cfbSmrg# dependency, and given that the user is not expected to run this macro,
245008c70cfbSmrg# just rely on AC_PROG_CC.
245108c70cfbSmrgAC_DEFUN([_AM_DEPENDENCIES],
245208c70cfbSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
245308c70cfbSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
245408c70cfbSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
245508c70cfbSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2456602e473dSmrg
245708c70cfbSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
245808c70cfbSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
245908c70cfbSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
246008c70cfbSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
246108c70cfbSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
246208c70cfbSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
246308c70cfbSmrg                    [depcc="$$1"   am_compiler_list=])
2464602e473dSmrg
246508c70cfbSmrgAC_CACHE_CHECK([dependency style of $depcc],
246608c70cfbSmrg               [am_cv_$1_dependencies_compiler_type],
246708c70cfbSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
246808c70cfbSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
246908c70cfbSmrg  # making bogus files that we don't know about and never remove.  For
247008c70cfbSmrg  # instance it was reported that on HP-UX the gcc test will end up
247108c70cfbSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
247208c70cfbSmrg  # in D".
247308c70cfbSmrg  rm -rf conftest.dir
247408c70cfbSmrg  mkdir conftest.dir
247508c70cfbSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
247608c70cfbSmrg  # using a relative directory.
247708c70cfbSmrg  cp "$am_depcomp" conftest.dir
247808c70cfbSmrg  cd conftest.dir
247908c70cfbSmrg  # We will build objects and dependencies in a subdirectory because
248008c70cfbSmrg  # it helps to detect inapplicable dependency modes.  For instance
248108c70cfbSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
248208c70cfbSmrg  # side effect of compilation, but ICC will put the dependencies in
248308c70cfbSmrg  # the current directory while Tru64 will put them in the object
248408c70cfbSmrg  # directory.
248508c70cfbSmrg  mkdir sub
2486602e473dSmrg
248708c70cfbSmrg  am_cv_$1_dependencies_compiler_type=none
248808c70cfbSmrg  if test "$am_compiler_list" = ""; then
248908c70cfbSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
249008c70cfbSmrg  fi
249108c70cfbSmrg  am__universal=false
249208c70cfbSmrg  m4_case([$1], [CC],
249308c70cfbSmrg    [case " $depcc " in #(
249408c70cfbSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
249508c70cfbSmrg     esac],
249608c70cfbSmrg    [CXX],
249708c70cfbSmrg    [case " $depcc " in #(
249808c70cfbSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
249908c70cfbSmrg     esac])
2500602e473dSmrg
250108c70cfbSmrg  for depmode in $am_compiler_list; do
250208c70cfbSmrg    # Setup a source with many dependencies, because some compilers
250308c70cfbSmrg    # like to wrap large dependency lists on column 80 (with \), and
250408c70cfbSmrg    # we should not choose a depcomp mode which is confused by this.
250508c70cfbSmrg    #
250608c70cfbSmrg    # We need to recreate these files for each test, as the compiler may
250708c70cfbSmrg    # overwrite some of them when testing with obscure command lines.
250808c70cfbSmrg    # This happens at least with the AIX C compiler.
250908c70cfbSmrg    : > sub/conftest.c
251008c70cfbSmrg    for i in 1 2 3 4 5 6; do
251108c70cfbSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
251208c70cfbSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
251308c70cfbSmrg      # Solaris 10 /bin/sh.
251408c70cfbSmrg      echo '/* dummy */' > sub/conftst$i.h
251508c70cfbSmrg    done
251608c70cfbSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2517602e473dSmrg
251808c70cfbSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
251908c70cfbSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
252008c70cfbSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
252108c70cfbSmrg    # versions had trouble with output in subdirs.
252208c70cfbSmrg    am__obj=sub/conftest.${OBJEXT-o}
252308c70cfbSmrg    am__minus_obj="-o $am__obj"
252408c70cfbSmrg    case $depmode in
252508c70cfbSmrg    gcc)
252608c70cfbSmrg      # This depmode causes a compiler race in universal mode.
252708c70cfbSmrg      test "$am__universal" = false || continue
252808c70cfbSmrg      ;;
252908c70cfbSmrg    nosideeffect)
253008c70cfbSmrg      # After this tag, mechanisms are not by side-effect, so they'll
253108c70cfbSmrg      # only be used when explicitly requested.
253208c70cfbSmrg      if test "x$enable_dependency_tracking" = xyes; then
253308c70cfbSmrg	continue
253408c70cfbSmrg      else
253508c70cfbSmrg	break
253608c70cfbSmrg      fi
253708c70cfbSmrg      ;;
253808c70cfbSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
253908c70cfbSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
254008c70cfbSmrg      # not run yet.  These depmodes are late enough in the game, and
254108c70cfbSmrg      # so weak that their functioning should not be impacted.
254208c70cfbSmrg      am__obj=conftest.${OBJEXT-o}
254308c70cfbSmrg      am__minus_obj=
254408c70cfbSmrg      ;;
254508c70cfbSmrg    none) break ;;
254608c70cfbSmrg    esac
254708c70cfbSmrg    if depmode=$depmode \
254808c70cfbSmrg       source=sub/conftest.c object=$am__obj \
254908c70cfbSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
255008c70cfbSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
255108c70cfbSmrg         >/dev/null 2>conftest.err &&
255208c70cfbSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
255308c70cfbSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
255408c70cfbSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
255508c70cfbSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
255608c70cfbSmrg      # icc doesn't choke on unknown options, it will just issue warnings
255708c70cfbSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
255808c70cfbSmrg      # that says an option was ignored or not supported.
255908c70cfbSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
256008c70cfbSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
256108c70cfbSmrg      # The diagnosis changed in icc 8.0:
256208c70cfbSmrg      #   icc: Command line remark: option '-MP' not supported
256308c70cfbSmrg      if (grep 'ignoring option' conftest.err ||
256408c70cfbSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
256508c70cfbSmrg        am_cv_$1_dependencies_compiler_type=$depmode
256608c70cfbSmrg        break
256708c70cfbSmrg      fi
256808c70cfbSmrg    fi
256908c70cfbSmrg  done
2570602e473dSmrg
257108c70cfbSmrg  cd ..
257208c70cfbSmrg  rm -rf conftest.dir
257308c70cfbSmrgelse
257408c70cfbSmrg  am_cv_$1_dependencies_compiler_type=none
257508c70cfbSmrgfi
257608c70cfbSmrg])
257708c70cfbSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
257808c70cfbSmrgAM_CONDITIONAL([am__fastdep$1], [
257908c70cfbSmrg  test "x$enable_dependency_tracking" != xno \
258008c70cfbSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
258108c70cfbSmrg])
2582602e473dSmrg
2583602e473dSmrg
258408c70cfbSmrg# AM_SET_DEPDIR
258508c70cfbSmrg# -------------
258608c70cfbSmrg# Choose a directory name for dependency files.
258708c70cfbSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
258808c70cfbSmrgAC_DEFUN([AM_SET_DEPDIR],
258908c70cfbSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
259008c70cfbSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
259108c70cfbSmrg])
259221298544Smrg
2593602e473dSmrg
259408c70cfbSmrg# AM_DEP_TRACK
259508c70cfbSmrg# ------------
259608c70cfbSmrgAC_DEFUN([AM_DEP_TRACK],
259708c70cfbSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
259808c70cfbSmrgAS_HELP_STRING(
259908c70cfbSmrg  [--enable-dependency-tracking],
260008c70cfbSmrg  [do not reject slow dependency extractors])
260108c70cfbSmrgAS_HELP_STRING(
260208c70cfbSmrg  [--disable-dependency-tracking],
260308c70cfbSmrg  [speeds up one-time build])])
260408c70cfbSmrgif test "x$enable_dependency_tracking" != xno; then
260508c70cfbSmrg  am_depcomp="$ac_aux_dir/depcomp"
260608c70cfbSmrg  AMDEPBACKSLASH='\'
260708c70cfbSmrg  am__nodep='_no'
2608602e473dSmrgfi
260908c70cfbSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
261008c70cfbSmrgAC_SUBST([AMDEPBACKSLASH])dnl
261108c70cfbSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
261208c70cfbSmrgAC_SUBST([am__nodep])dnl
261308c70cfbSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2614602e473dSmrg])
2615602e473dSmrg
261608c70cfbSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2617602e473dSmrg
26188ffb90f1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
261908c70cfbSmrg#
262008c70cfbSmrg# This file is free software; the Free Software Foundation
262108c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
262208c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2623602e473dSmrg
262408c70cfbSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
262508c70cfbSmrg# ------------------------------
262608c70cfbSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
262708c70cfbSmrg[{
262808c70cfbSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
262908c70cfbSmrg  # are listed without --file.  Let's play safe and only enable the eval
263008c70cfbSmrg  # if we detect the quoting.
2631fe12f63cSmrg  # TODO: see whether this extra hack can be removed once we start
2632fe12f63cSmrg  # requiring Autoconf 2.70 or later.
2633fe12f63cSmrg  AS_CASE([$CONFIG_FILES],
2634fe12f63cSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
2635fe12f63cSmrg          [*], [set x $CONFIG_FILES])
263608c70cfbSmrg  shift
2637fe12f63cSmrg  # Used to flag and report bootstrapping failures.
2638fe12f63cSmrg  am_rc=0
2639fe12f63cSmrg  for am_mf
264008c70cfbSmrg  do
264108c70cfbSmrg    # Strip MF so we end up with the name of the file.
2642fe12f63cSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2643fe12f63cSmrg    # Check whether this is an Automake generated Makefile which includes
2644fe12f63cSmrg    # dependency-tracking related rules and includes.
2645fe12f63cSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
264608c70cfbSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
2647fe12f63cSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2648fe12f63cSmrg      || continue
2649fe12f63cSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2650fe12f63cSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
2651fe12f63cSmrg    AM_RUN_LOG([cd "$am_dirpart" \
2652fe12f63cSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
2653fe12f63cSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
265408c70cfbSmrg  done
2655fe12f63cSmrg  if test $am_rc -ne 0; then
2656fe12f63cSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
26578ffb90f1Smrg    for automatic dependency tracking.  If GNU make was not used, consider
26588ffb90f1Smrg    re-running the configure script with MAKE="gmake" (or whatever is
26598ffb90f1Smrg    necessary).  You can also try re-running configure with the
2660fe12f63cSmrg    '--disable-dependency-tracking' option to at least be able to build
2661fe12f63cSmrg    the package (albeit without support for automatic dependency tracking).])
2662fe12f63cSmrg  fi
2663fe12f63cSmrg  AS_UNSET([am_dirpart])
2664fe12f63cSmrg  AS_UNSET([am_filepart])
2665fe12f63cSmrg  AS_UNSET([am_mf])
2666fe12f63cSmrg  AS_UNSET([am_rc])
2667fe12f63cSmrg  rm -f conftest-deps.mk
266808c70cfbSmrg}
266908c70cfbSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2670602e473dSmrg
2671602e473dSmrg
267208c70cfbSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
267308c70cfbSmrg# -----------------------------
267408c70cfbSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
267508c70cfbSmrg#
2676fe12f63cSmrg# This code is only required when automatic dependency tracking is enabled.
2677fe12f63cSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2678fe12f63cSmrg# order to bootstrap the dependency handling code.
267908c70cfbSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
268008c70cfbSmrg[AC_CONFIG_COMMANDS([depfiles],
268108c70cfbSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2682fe12f63cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2683602e473dSmrg
268408c70cfbSmrg# Do all the work for Automake.                             -*- Autoconf -*-
2685602e473dSmrg
26868ffb90f1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
268708c70cfbSmrg#
268808c70cfbSmrg# This file is free software; the Free Software Foundation
268908c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
269008c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2691602e473dSmrg
269208c70cfbSmrg# This macro actually does too much.  Some checks are only needed if
269308c70cfbSmrg# your package does certain things.  But this isn't really a big deal.
2694602e473dSmrg
26951016ad83Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26961016ad83Smrgm4_define([AC_PROG_CC],
26971016ad83Smrgm4_defn([AC_PROG_CC])
26981016ad83Smrg[_AM_PROG_CC_C_O
26991016ad83Smrg])
27001016ad83Smrg
270108c70cfbSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
270208c70cfbSmrg# AM_INIT_AUTOMAKE([OPTIONS])
270308c70cfbSmrg# -----------------------------------------------
270408c70cfbSmrg# The call with PACKAGE and VERSION arguments is the old style
270508c70cfbSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
270608c70cfbSmrg# and VERSION should now be passed to AC_INIT and removed from
270708c70cfbSmrg# the call to AM_INIT_AUTOMAKE.
270808c70cfbSmrg# We support both call styles for the transition.  After
270908c70cfbSmrg# the next Automake release, Autoconf can make the AC_INIT
271008c70cfbSmrg# arguments mandatory, and then we can depend on a new Autoconf
271108c70cfbSmrg# release and drop the old call support.
271208c70cfbSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
271308c70cfbSmrg[AC_PREREQ([2.65])dnl
27148ffb90f1Smrgm4_ifdef([_$0_ALREADY_INIT],
27158ffb90f1Smrg  [m4_fatal([$0 expanded multiple times
27168ffb90f1Smrg]m4_defn([_$0_ALREADY_INIT]))],
27178ffb90f1Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
271808c70cfbSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
271908c70cfbSmrgdnl the ones we care about.
272008c70cfbSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
272108c70cfbSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
272208c70cfbSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
272308c70cfbSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
272408c70cfbSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
272508c70cfbSmrg  # is not polluted with repeated "-I."
272608c70cfbSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
272708c70cfbSmrg  # test to see if srcdir already configured
272808c70cfbSmrg  if test -f $srcdir/config.status; then
272908c70cfbSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
273008c70cfbSmrg  fi
273108c70cfbSmrgfi
273221298544Smrg
273308c70cfbSmrg# test whether we have cygpath
273408c70cfbSmrgif test -z "$CYGPATH_W"; then
273508c70cfbSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
273608c70cfbSmrg    CYGPATH_W='cygpath -w'
273708c70cfbSmrg  else
273808c70cfbSmrg    CYGPATH_W=echo
273908c70cfbSmrg  fi
274008c70cfbSmrgfi
274108c70cfbSmrgAC_SUBST([CYGPATH_W])
274221298544Smrg
274308c70cfbSmrg# Define the identity of the package.
274408c70cfbSmrgdnl Distinguish between old-style and new-style calls.
274508c70cfbSmrgm4_ifval([$2],
274608c70cfbSmrg[AC_DIAGNOSE([obsolete],
274708c70cfbSmrg             [$0: two- and three-arguments forms are deprecated.])
274808c70cfbSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
274908c70cfbSmrg AC_SUBST([PACKAGE], [$1])dnl
275008c70cfbSmrg AC_SUBST([VERSION], [$2])],
275108c70cfbSmrg[_AM_SET_OPTIONS([$1])dnl
275208c70cfbSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
275308c70cfbSmrgm4_if(
27548ffb90f1Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
275508c70cfbSmrg  [ok:ok],,
275608c70cfbSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
275708c70cfbSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
275808c70cfbSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
275921298544Smrg
276008c70cfbSmrg_AM_IF_OPTION([no-define],,
276108c70cfbSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
276208c70cfbSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
276321298544Smrg
276408c70cfbSmrg# Some tools Automake needs.
276508c70cfbSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
276608c70cfbSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
276708c70cfbSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
276808c70cfbSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
276908c70cfbSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
277008c70cfbSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
277108c70cfbSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
277208c70cfbSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
277308c70cfbSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
277408c70cfbSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
277508c70cfbSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
277608c70cfbSmrg# dies out for good.  For more background, see:
2777fe12f63cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2778fe12f63cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
277908c70cfbSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2780709d36bbSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
2781709d36bbSmrg# system "awk" is bad on some platforms.
278208c70cfbSmrgAC_REQUIRE([AC_PROG_AWK])dnl
278308c70cfbSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
278408c70cfbSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
278508c70cfbSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
278608c70cfbSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
278708c70cfbSmrg			     [_AM_PROG_TAR([v7])])])
278808c70cfbSmrg_AM_IF_OPTION([no-dependencies],,
278908c70cfbSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
279008c70cfbSmrg		  [_AM_DEPENDENCIES([CC])],
279108c70cfbSmrg		  [m4_define([AC_PROG_CC],
279208c70cfbSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
279308c70cfbSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
279408c70cfbSmrg		  [_AM_DEPENDENCIES([CXX])],
279508c70cfbSmrg		  [m4_define([AC_PROG_CXX],
279608c70cfbSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
279708c70cfbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
279808c70cfbSmrg		  [_AM_DEPENDENCIES([OBJC])],
279908c70cfbSmrg		  [m4_define([AC_PROG_OBJC],
280008c70cfbSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
280108c70cfbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
280208c70cfbSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
280308c70cfbSmrg		  [m4_define([AC_PROG_OBJCXX],
280408c70cfbSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
280508c70cfbSmrg])
28068ffb90f1Smrg# Variables for tags utilities; see am/tags.am
28078ffb90f1Smrgif test -z "$CTAGS"; then
28088ffb90f1Smrg  CTAGS=ctags
28098ffb90f1Smrgfi
28108ffb90f1SmrgAC_SUBST([CTAGS])
28118ffb90f1Smrgif test -z "$ETAGS"; then
28128ffb90f1Smrg  ETAGS=etags
28138ffb90f1Smrgfi
28148ffb90f1SmrgAC_SUBST([ETAGS])
28158ffb90f1Smrgif test -z "$CSCOPE"; then
28168ffb90f1Smrg  CSCOPE=cscope
28178ffb90f1Smrgfi
28188ffb90f1SmrgAC_SUBST([CSCOPE])
28198ffb90f1Smrg
282008c70cfbSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
282108c70cfbSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
282208c70cfbSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
282308c70cfbSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
282408c70cfbSmrgAC_CONFIG_COMMANDS_PRE(dnl
282508c70cfbSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
282608c70cfbSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
28271016ad83Smrg
28281016ad83Smrg# POSIX will say in a future version that running "rm -f" with no argument
28291016ad83Smrg# is OK; and we want to be able to make that assumption in our Makefile
28301016ad83Smrg# recipes.  So use an aggressive probe to check that the usage we want is
28311016ad83Smrg# actually supported "in the wild" to an acceptable degree.
28321016ad83Smrg# See automake bug#10828.
28331016ad83Smrg# To make any issue more visible, cause the running configure to be aborted
28341016ad83Smrg# by default if the 'rm' program in use doesn't match our expectations; the
28351016ad83Smrg# user can still override this though.
28361016ad83Smrgif rm -f && rm -fr && rm -rf; then : OK; else
28371016ad83Smrg  cat >&2 <<'END'
28381016ad83SmrgOops!
28391016ad83Smrg
28401016ad83SmrgYour 'rm' program seems unable to run without file operands specified
28411016ad83Smrgon the command line, even when the '-f' option is present.  This is contrary
28421016ad83Smrgto the behaviour of most rm programs out there, and not conforming with
28431016ad83Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
28441016ad83Smrg
28451016ad83SmrgPlease tell bug-automake@gnu.org about your system, including the value
28461016ad83Smrgof your $PATH and any error possibly output before this message.  This
28471016ad83Smrgcan help us improve future automake versions.
28481016ad83Smrg
28491016ad83SmrgEND
28501016ad83Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28511016ad83Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28521016ad83Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28531016ad83Smrg    echo >&2
28541016ad83Smrg  else
28551016ad83Smrg    cat >&2 <<'END'
28561016ad83SmrgAborting the configuration process, to ensure you take notice of the issue.
28571016ad83Smrg
28581016ad83SmrgYou can download and install GNU coreutils to get an 'rm' implementation
2859fe12f63cSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28601016ad83Smrg
28611016ad83SmrgIf you want to complete the configuration process using your problematic
28621016ad83Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28631016ad83Smrgto "yes", and re-run configure.
28641016ad83Smrg
28651016ad83SmrgEND
28661016ad83Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28671016ad83Smrg  fi
28681c7386f4Smrgfi
2869709d36bbSmrgdnl The trailing newline in this macro's definition is deliberate, for
2870709d36bbSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
2871709d36bbSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28721c7386f4Smrg])
287321298544Smrg
287408c70cfbSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
287508c70cfbSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
287608c70cfbSmrgdnl mangled by Autoconf and run in a shell conditional statement.
287708c70cfbSmrgm4_define([_AC_COMPILER_EXEEXT],
287808c70cfbSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2879602e473dSmrg
288008c70cfbSmrg# When config.status generates a header, we must update the stamp-h file.
288108c70cfbSmrg# This file resides in the same directory as the config header
288208c70cfbSmrg# that is generated.  The stamp files are numbered to have different names.
2883602e473dSmrg
288408c70cfbSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
288508c70cfbSmrg# loop where config.status creates the headers, so we can generate
288608c70cfbSmrg# our stamp files there.
288708c70cfbSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
288808c70cfbSmrg[# Compute $1's index in $config_headers.
288908c70cfbSmrg_am_arg=$1
289008c70cfbSmrg_am_stamp_count=1
289108c70cfbSmrgfor _am_header in $config_headers :; do
289208c70cfbSmrg  case $_am_header in
289308c70cfbSmrg    $_am_arg | $_am_arg:* )
289408c70cfbSmrg      break ;;
289508c70cfbSmrg    * )
289608c70cfbSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
289708c70cfbSmrg  esac
289808c70cfbSmrgdone
289908c70cfbSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2900602e473dSmrg
29018ffb90f1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
290208c70cfbSmrg#
290308c70cfbSmrg# This file is free software; the Free Software Foundation
290408c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
290508c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2906602e473dSmrg
290708c70cfbSmrg# AM_PROG_INSTALL_SH
290808c70cfbSmrg# ------------------
290908c70cfbSmrg# Define $install_sh.
291008c70cfbSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
291108c70cfbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2912709d36bbSmrgif test x"${install_sh+set}" != xset; then
291308c70cfbSmrg  case $am_aux_dir in
291408c70cfbSmrg  *\ * | *\	*)
291508c70cfbSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
291608c70cfbSmrg  *)
291708c70cfbSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
291808c70cfbSmrg  esac
291908c70cfbSmrgfi
292008c70cfbSmrgAC_SUBST([install_sh])])
2921602e473dSmrg
29228ffb90f1Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
292308c70cfbSmrg#
292408c70cfbSmrg# This file is free software; the Free Software Foundation
292508c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
292608c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2927602e473dSmrg
292808c70cfbSmrg# Check whether the underlying file-system supports filenames
292908c70cfbSmrg# with a leading dot.  For instance MS-DOS doesn't.
293008c70cfbSmrgAC_DEFUN([AM_SET_LEADING_DOT],
293108c70cfbSmrg[rm -rf .tst 2>/dev/null
293208c70cfbSmrgmkdir .tst 2>/dev/null
293308c70cfbSmrgif test -d .tst; then
293408c70cfbSmrg  am__leading_dot=.
293508c70cfbSmrgelse
293608c70cfbSmrg  am__leading_dot=_
293708c70cfbSmrgfi
293808c70cfbSmrgrmdir .tst 2>/dev/null
293908c70cfbSmrgAC_SUBST([am__leading_dot])])
2940602e473dSmrg
294108c70cfbSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2942602e473dSmrg
29438ffb90f1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
294408c70cfbSmrg#
294508c70cfbSmrg# This file is free software; the Free Software Foundation
294608c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
294708c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2948602e473dSmrg
294908c70cfbSmrg# AM_MAKE_INCLUDE()
295008c70cfbSmrg# -----------------
2951fe12f63cSmrg# Check whether make has an 'include' directive that can support all
2952fe12f63cSmrg# the idioms we need for our automatic dependency tracking code.
295308c70cfbSmrgAC_DEFUN([AM_MAKE_INCLUDE],
2954fe12f63cSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
2955fe12f63cSmrgcat > confinc.mk << 'END'
295608c70cfbSmrgam__doit:
2957fe12f63cSmrg	@echo this is the am__doit target >confinc.out
295808c70cfbSmrg.PHONY: am__doit
295908c70cfbSmrgEND
296008c70cfbSmrgam__include="#"
296108c70cfbSmrgam__quote=
2962fe12f63cSmrg# BSD make does it like this.
2963fe12f63cSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
2964fe12f63cSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
2965fe12f63cSmrgecho 'include confinc.mk # ignored' > confmf.GNU
2966fe12f63cSmrg_am_result=no
2967fe12f63cSmrgfor s in GNU BSD; do
2968fe12f63cSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
2969fe12f63cSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
2970fe12f63cSmrg      ['0:this is the am__doit target'],
2971fe12f63cSmrg      [AS_CASE([$s],
2972fe12f63cSmrg          [BSD], [am__include='.include' am__quote='"'],
2973fe12f63cSmrg          [am__include='include' am__quote=''])])
2974fe12f63cSmrg  if test "$am__include" != "#"; then
2975fe12f63cSmrg    _am_result="yes ($s style)"
2976fe12f63cSmrg    break
2977fe12f63cSmrg  fi
2978fe12f63cSmrgdone
2979fe12f63cSmrgrm -f confinc.* confmf.*
2980fe12f63cSmrgAC_MSG_RESULT([${_am_result}])
2981fe12f63cSmrgAC_SUBST([am__include])])
2982fe12f63cSmrgAC_SUBST([am__quote])])
2983602e473dSmrg
298408c70cfbSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2985602e473dSmrg
29868ffb90f1Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
298708c70cfbSmrg#
298808c70cfbSmrg# This file is free software; the Free Software Foundation
298908c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
299008c70cfbSmrg# with or without modifications, as long as this notice is preserved.
2991602e473dSmrg
299208c70cfbSmrg# AM_MISSING_PROG(NAME, PROGRAM)
299308c70cfbSmrg# ------------------------------
299408c70cfbSmrgAC_DEFUN([AM_MISSING_PROG],
299508c70cfbSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
299608c70cfbSmrg$1=${$1-"${am_missing_run}$2"}
299708c70cfbSmrgAC_SUBST($1)])
2998602e473dSmrg
299908c70cfbSmrg# AM_MISSING_HAS_RUN
300008c70cfbSmrg# ------------------
300108c70cfbSmrg# Define MISSING if not defined so far and test if it is modern enough.
300208c70cfbSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
300308c70cfbSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
300408c70cfbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
300508c70cfbSmrgAC_REQUIRE_AUX_FILE([missing])dnl
300608c70cfbSmrgif test x"${MISSING+set}" != xset; then
30078ffb90f1Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
300808c70cfbSmrgfi
300908c70cfbSmrg# Use eval to expand $SHELL
301008c70cfbSmrgif eval "$MISSING --is-lightweight"; then
301108c70cfbSmrg  am_missing_run="$MISSING "
301208c70cfbSmrgelse
301308c70cfbSmrg  am_missing_run=
301408c70cfbSmrg  AC_MSG_WARN(['missing' script is too old or missing])
301508c70cfbSmrgfi
3016602e473dSmrg])
3017602e473dSmrg
301808c70cfbSmrg# Helper functions for option handling.                     -*- Autoconf -*-
3019602e473dSmrg
30208ffb90f1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
302108c70cfbSmrg#
302208c70cfbSmrg# This file is free software; the Free Software Foundation
302308c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
302408c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3025602e473dSmrg
302608c70cfbSmrg# _AM_MANGLE_OPTION(NAME)
302708c70cfbSmrg# -----------------------
302808c70cfbSmrgAC_DEFUN([_AM_MANGLE_OPTION],
302908c70cfbSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3030602e473dSmrg
303108c70cfbSmrg# _AM_SET_OPTION(NAME)
303208c70cfbSmrg# --------------------
303308c70cfbSmrg# Set option NAME.  Presently that only means defining a flag for this option.
303408c70cfbSmrgAC_DEFUN([_AM_SET_OPTION],
303508c70cfbSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3036602e473dSmrg
303708c70cfbSmrg# _AM_SET_OPTIONS(OPTIONS)
303808c70cfbSmrg# ------------------------
303908c70cfbSmrg# OPTIONS is a space-separated list of Automake options.
304008c70cfbSmrgAC_DEFUN([_AM_SET_OPTIONS],
304108c70cfbSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3042602e473dSmrg
304308c70cfbSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
304408c70cfbSmrg# -------------------------------------------
304508c70cfbSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
304608c70cfbSmrgAC_DEFUN([_AM_IF_OPTION],
304708c70cfbSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3048602e473dSmrg
30498ffb90f1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
305008c70cfbSmrg#
305108c70cfbSmrg# This file is free software; the Free Software Foundation
305208c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
305308c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3054602e473dSmrg
30551016ad83Smrg# _AM_PROG_CC_C_O
30561016ad83Smrg# ---------------
30571016ad83Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30581016ad83Smrg# to automatically call this.
30591016ad83SmrgAC_DEFUN([_AM_PROG_CC_C_O],
30601016ad83Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30611016ad83SmrgAC_REQUIRE_AUX_FILE([compile])dnl
30621016ad83SmrgAC_LANG_PUSH([C])dnl
30631016ad83SmrgAC_CACHE_CHECK(
30641016ad83Smrg  [whether $CC understands -c and -o together],
30651016ad83Smrg  [am_cv_prog_cc_c_o],
30661016ad83Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30671016ad83Smrg  # Make sure it works both with $CC and with simple cc.
30681016ad83Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30691016ad83Smrg  # compilers refuse to overwrite an existing .o file with -o,
30701016ad83Smrg  # though they will create one.
30711016ad83Smrg  am_cv_prog_cc_c_o=yes
30721016ad83Smrg  for am_i in 1 2; do
30731016ad83Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30741016ad83Smrg         && test -f conftest2.$ac_objext; then
30751016ad83Smrg      : OK
30761016ad83Smrg    else
30771016ad83Smrg      am_cv_prog_cc_c_o=no
30781016ad83Smrg      break
30791016ad83Smrg    fi
30801016ad83Smrg  done
30811016ad83Smrg  rm -f core conftest*
30821016ad83Smrg  unset am_i])
30831016ad83Smrgif test "$am_cv_prog_cc_c_o" != yes; then
30841016ad83Smrg   # Losing compiler, so override with the script.
30851016ad83Smrg   # FIXME: It is wrong to rewrite CC.
30861016ad83Smrg   # But if we don't then we get into trouble of one sort or another.
30871016ad83Smrg   # A longer-term fix would be to have automake use am__CC in this case,
30881016ad83Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30891016ad83Smrg   CC="$am_aux_dir/compile $CC"
30901016ad83Smrgfi
30911016ad83SmrgAC_LANG_POP([C])])
30921016ad83Smrg
30931016ad83Smrg# For backward compatibility.
30941016ad83SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30951016ad83Smrg
30968ffb90f1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
30971016ad83Smrg#
30981016ad83Smrg# This file is free software; the Free Software Foundation
30991016ad83Smrg# gives unlimited permission to copy and/or distribute it,
31001016ad83Smrg# with or without modifications, as long as this notice is preserved.
31011016ad83Smrg
3102602e473dSmrg
310308c70cfbSmrg# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
310408c70cfbSmrg# ---------------------------------------------------------------------------
310508c70cfbSmrg# Adds support for distributing Python modules and packages.  To
310608c70cfbSmrg# install modules, copy them to $(pythondir), using the python_PYTHON
310708c70cfbSmrg# automake variable.  To install a package with the same name as the
310808c70cfbSmrg# automake package, install to $(pkgpythondir), or use the
310908c70cfbSmrg# pkgpython_PYTHON automake variable.
3110602e473dSmrg#
311108c70cfbSmrg# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
311208c70cfbSmrg# locations to install python extension modules (shared libraries).
311308c70cfbSmrg# Another macro is required to find the appropriate flags to compile
311408c70cfbSmrg# extension modules.
311508c70cfbSmrg#
311608c70cfbSmrg# If your package is configured with a different prefix to python,
311708c70cfbSmrg# users will have to add the install directory to the PYTHONPATH
311808c70cfbSmrg# environment variable, or create a .pth file (see the python
311908c70cfbSmrg# documentation for details).
312008c70cfbSmrg#
312108c70cfbSmrg# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
312208c70cfbSmrg# cause an error if the version of python installed on the system
312308c70cfbSmrg# doesn't meet the requirement.  MINIMUM-VERSION should consist of
312408c70cfbSmrg# numbers and dots only.
312508c70cfbSmrgAC_DEFUN([AM_PATH_PYTHON],
312608c70cfbSmrg [
312708c70cfbSmrg  dnl Find a Python interpreter.  Python versions prior to 2.0 are not
312808c70cfbSmrg  dnl supported. (2.0 was released on October 16, 2000).
312908c70cfbSmrg  m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
3130fe12f63cSmrg[python python2 python3 dnl
3131fe12f63cSmrg python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
3132fe12f63cSmrg python3.2 python3.1 python3.0 dnl
3133fe12f63cSmrg python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
3134fe12f63cSmrg python2.0])
3135602e473dSmrg
313608c70cfbSmrg  AC_ARG_VAR([PYTHON], [the Python interpreter])
3137602e473dSmrg
313808c70cfbSmrg  m4_if([$1],[],[
313908c70cfbSmrg    dnl No version check is needed.
314008c70cfbSmrg    # Find any Python interpreter.
314108c70cfbSmrg    if test -z "$PYTHON"; then
314208c70cfbSmrg      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
314308c70cfbSmrg    fi
314408c70cfbSmrg    am_display_PYTHON=python
314508c70cfbSmrg  ], [
314608c70cfbSmrg    dnl A version check is needed.
314708c70cfbSmrg    if test -n "$PYTHON"; then
314808c70cfbSmrg      # If the user set $PYTHON, use it and don't search something else.
314908c70cfbSmrg      AC_MSG_CHECKING([whether $PYTHON version is >= $1])
315008c70cfbSmrg      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
315108c70cfbSmrg			      [AC_MSG_RESULT([yes])],
315208c70cfbSmrg			      [AC_MSG_RESULT([no])
315308c70cfbSmrg			       AC_MSG_ERROR([Python interpreter is too old])])
315408c70cfbSmrg      am_display_PYTHON=$PYTHON
315508c70cfbSmrg    else
315608c70cfbSmrg      # Otherwise, try each interpreter until we find one that satisfies
315708c70cfbSmrg      # VERSION.
315808c70cfbSmrg      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
315908c70cfbSmrg	[am_cv_pathless_PYTHON],[
316008c70cfbSmrg	for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
316108c70cfbSmrg	  test "$am_cv_pathless_PYTHON" = none && break
316208c70cfbSmrg	  AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
316308c70cfbSmrg	done])
316408c70cfbSmrg      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
316508c70cfbSmrg      if test "$am_cv_pathless_PYTHON" = none; then
316608c70cfbSmrg	PYTHON=:
316708c70cfbSmrg      else
316808c70cfbSmrg        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
316908c70cfbSmrg      fi
317008c70cfbSmrg      am_display_PYTHON=$am_cv_pathless_PYTHON
317108c70cfbSmrg    fi
317208c70cfbSmrg  ])
3173602e473dSmrg
317408c70cfbSmrg  if test "$PYTHON" = :; then
31758ffb90f1Smrg    dnl Run any user-specified action, or abort.
317608c70cfbSmrg    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
317708c70cfbSmrg  else
3178602e473dSmrg
31798ffb90f1Smrg  dnl Query Python for its version number.  Although site.py simply uses
31808ffb90f1Smrg  dnl sys.version[:3], printing that failed with Python 3.10, since the
31818ffb90f1Smrg  dnl trailing zero was eliminated. So now we output just the major
31828ffb90f1Smrg  dnl and minor version numbers, as numbers. Apparently the tertiary
31838ffb90f1Smrg  dnl version is not of interest.
31848ffb90f1Smrg  dnl
318508c70cfbSmrg  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
31868ffb90f1Smrg    [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
318708c70cfbSmrg  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
3188602e473dSmrg
31898ffb90f1Smrg  dnl At times, e.g., when building shared libraries, you may want
319008c70cfbSmrg  dnl to know which OS platform Python thinks this is.
31918ffb90f1Smrg  dnl
319208c70cfbSmrg  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
319308c70cfbSmrg    [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
319408c70cfbSmrg  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
3195602e473dSmrg
31968ffb90f1Smrg  dnl emacs-page
31978ffb90f1Smrg  dnl If --with-python-sys-prefix is given, use the values of sys.prefix
31988ffb90f1Smrg  dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX
31998ffb90f1Smrg  dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and
32008ffb90f1Smrg  dnl ${exec_prefix} variables.
32018ffb90f1Smrg  dnl
32028ffb90f1Smrg  dnl The two are made distinct variables so they can be overridden if
32038ffb90f1Smrg  dnl need be, although general consensus is that you shouldn't need
32048ffb90f1Smrg  dnl this separation.
32058ffb90f1Smrg  dnl
32068ffb90f1Smrg  dnl Also allow directly setting the prefixes via configure options,
32078ffb90f1Smrg  dnl overriding any default.
32088ffb90f1Smrg  dnl
32098ffb90f1Smrg  if test "x$prefix" = xNONE; then
32108ffb90f1Smrg    am__usable_prefix=$ac_default_prefix
32118ffb90f1Smrg  else
32128ffb90f1Smrg    am__usable_prefix=$prefix
32138ffb90f1Smrg  fi
32148ffb90f1Smrg
32158ffb90f1Smrg  # Allow user to request using sys.* values from Python,
32168ffb90f1Smrg  # instead of the GNU $prefix values.
32178ffb90f1Smrg  AC_ARG_WITH([python-sys-prefix],
32188ffb90f1Smrg  [AS_HELP_STRING([--with-python-sys-prefix],
32198ffb90f1Smrg                  [use Python's sys.prefix and sys.exec_prefix values])],
32208ffb90f1Smrg  [am_use_python_sys=:],
32218ffb90f1Smrg  [am_use_python_sys=false])
32228ffb90f1Smrg
32238ffb90f1Smrg  # Allow user to override whatever the default Python prefix is.
32248ffb90f1Smrg  AC_ARG_WITH([python_prefix],
32258ffb90f1Smrg  [AS_HELP_STRING([--with-python_prefix],
32268ffb90f1Smrg                  [override the default PYTHON_PREFIX])],
32278ffb90f1Smrg  [am_python_prefix_subst=$withval
32288ffb90f1Smrg   am_cv_python_prefix=$withval
32298ffb90f1Smrg   AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix])
32308ffb90f1Smrg   AC_MSG_RESULT([$am_cv_python_prefix])],
32318ffb90f1Smrg  [
32328ffb90f1Smrg   if $am_use_python_sys; then
32338ffb90f1Smrg     # using python sys.prefix value, not GNU
32348ffb90f1Smrg     AC_CACHE_CHECK([for python default $am_display_PYTHON prefix],
32358ffb90f1Smrg     [am_cv_python_prefix],
32368ffb90f1Smrg     [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`])
32378ffb90f1Smrg
32388ffb90f1Smrg     dnl If sys.prefix is a subdir of $prefix, replace the literal value of
32398ffb90f1Smrg     dnl $prefix with a variable reference so it can be overridden.
32408ffb90f1Smrg     case $am_cv_python_prefix in
32418ffb90f1Smrg     $am__usable_prefix*)
32428ffb90f1Smrg       am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'`
32438ffb90f1Smrg       am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"`
32448ffb90f1Smrg       ;;
32458ffb90f1Smrg     *)
32468ffb90f1Smrg       am_python_prefix_subst=$am_cv_python_prefix
32478ffb90f1Smrg       ;;
32488ffb90f1Smrg     esac
32498ffb90f1Smrg   else # using GNU prefix value, not python sys.prefix
32508ffb90f1Smrg     am_python_prefix_subst='${prefix}'
32518ffb90f1Smrg     am_python_prefix=$am_python_prefix_subst
32528ffb90f1Smrg     AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix])
32538ffb90f1Smrg     AC_MSG_RESULT([$am_python_prefix])
32548ffb90f1Smrg   fi])
32558ffb90f1Smrg  # Substituting python_prefix_subst value.
32568ffb90f1Smrg  AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst])
32578ffb90f1Smrg
32588ffb90f1Smrg  # emacs-page Now do it all over again for Python exec_prefix, but with yet
32598ffb90f1Smrg  # another conditional: fall back to regular prefix if that was specified.
32608ffb90f1Smrg  AC_ARG_WITH([python_exec_prefix],
32618ffb90f1Smrg  [AS_HELP_STRING([--with-python_exec_prefix],
32628ffb90f1Smrg                  [override the default PYTHON_EXEC_PREFIX])],
32638ffb90f1Smrg  [am_python_exec_prefix_subst=$withval
32648ffb90f1Smrg   am_cv_python_exec_prefix=$withval
32658ffb90f1Smrg   AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix])
32668ffb90f1Smrg   AC_MSG_RESULT([$am_cv_python_exec_prefix])],
32678ffb90f1Smrg  [
32688ffb90f1Smrg   # no explicit --with-python_exec_prefix, but if
32698ffb90f1Smrg   # --with-python_prefix was given, use its value for python_exec_prefix too.
32708ffb90f1Smrg   AS_IF([test -n "$with_python_prefix"],
32718ffb90f1Smrg   [am_python_exec_prefix_subst=$with_python_prefix
32728ffb90f1Smrg    am_cv_python_exec_prefix=$with_python_prefix
32738ffb90f1Smrg    AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix])
32748ffb90f1Smrg    AC_MSG_RESULT([$am_cv_python_exec_prefix])],
32758ffb90f1Smrg   [
32768ffb90f1Smrg    # Set am__usable_exec_prefix whether using GNU or Python values,
32778ffb90f1Smrg    # since we use that variable for pyexecdir.
32788ffb90f1Smrg    if test "x$exec_prefix" = xNONE; then
32798ffb90f1Smrg      am__usable_exec_prefix=$am__usable_prefix
32808ffb90f1Smrg    else
32818ffb90f1Smrg      am__usable_exec_prefix=$exec_prefix
32828ffb90f1Smrg    fi
32838ffb90f1Smrg    #
32848ffb90f1Smrg    if $am_use_python_sys; then # using python sys.exec_prefix, not GNU
32858ffb90f1Smrg      AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix],
32868ffb90f1Smrg      [am_cv_python_exec_prefix],
32878ffb90f1Smrg      [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`])
32888ffb90f1Smrg      dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the
32898ffb90f1Smrg      dnl literal value of $exec_prefix with a variable reference so it can
32908ffb90f1Smrg      dnl be overridden.
32918ffb90f1Smrg      case $am_cv_python_exec_prefix in
32928ffb90f1Smrg      $am__usable_exec_prefix*)
32938ffb90f1Smrg        am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'`
32948ffb90f1Smrg        am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"`
32958ffb90f1Smrg        ;;
32968ffb90f1Smrg      *)
32978ffb90f1Smrg        am_python_exec_prefix_subst=$am_cv_python_exec_prefix
32988ffb90f1Smrg        ;;
32998ffb90f1Smrg     esac
33008ffb90f1Smrg   else # using GNU $exec_prefix, not python sys.exec_prefix
33018ffb90f1Smrg     am_python_exec_prefix_subst='${exec_prefix}'
33028ffb90f1Smrg     am_python_exec_prefix=$am_python_exec_prefix_subst
33038ffb90f1Smrg     AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix])
33048ffb90f1Smrg     AC_MSG_RESULT([$am_python_exec_prefix])
33058ffb90f1Smrg   fi])])
33068ffb90f1Smrg  # Substituting python_exec_prefix_subst.
33078ffb90f1Smrg  AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst])
33088ffb90f1Smrg
33098ffb90f1Smrg  # Factor out some code duplication into this shell variable.
331008c70cfbSmrg  am_python_setup_sysconfig="\
331108c70cfbSmrgimport sys
331208c70cfbSmrg# Prefer sysconfig over distutils.sysconfig, for better compatibility
331308c70cfbSmrg# with python 3.x.  See automake bug#10227.
331408c70cfbSmrgtry:
331508c70cfbSmrg    import sysconfig
331608c70cfbSmrgexcept ImportError:
331708c70cfbSmrg    can_use_sysconfig = 0
331808c70cfbSmrgelse:
331908c70cfbSmrg    can_use_sysconfig = 1
332008c70cfbSmrg# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
332108c70cfbSmrg# <https://github.com/pypa/virtualenv/issues/118>
332208c70cfbSmrgtry:
332308c70cfbSmrg    from platform import python_implementation
332408c70cfbSmrg    if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
332508c70cfbSmrg        can_use_sysconfig = 0
332608c70cfbSmrgexcept ImportError:
332708c70cfbSmrg    pass"
3328602e473dSmrg
33298ffb90f1Smrg  dnl emacs-page Set up 4 directories:
3330602e473dSmrg
33318ffb90f1Smrg  dnl 1. pythondir: where to install python scripts.  This is the
33328ffb90f1Smrg  dnl    site-packages directory, not the python standard library
33338ffb90f1Smrg  dnl    directory like in previous automake betas.  This behavior
33348ffb90f1Smrg  dnl    is more consistent with lispdir.m4 for example.
333508c70cfbSmrg  dnl Query distutils for this directory.
33368ffb90f1Smrg  dnl
33378ffb90f1Smrg  AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
33388ffb90f1Smrg  [am_cv_python_pythondir],
33398ffb90f1Smrg  [if test "x$am_cv_python_prefix" = x; then
33408ffb90f1Smrg     am_py_prefix=$am__usable_prefix
33418ffb90f1Smrg   else
33428ffb90f1Smrg     am_py_prefix=$am_cv_python_prefix
33438ffb90f1Smrg   fi
33448ffb90f1Smrg   am_cv_python_pythondir=`$PYTHON -c "
334508c70cfbSmrg$am_python_setup_sysconfig
334608c70cfbSmrgif can_use_sysconfig:
33478ffb90f1Smrg  sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
334808c70cfbSmrgelse:
33498ffb90f1Smrg  from distutils import sysconfig
33508ffb90f1Smrg  sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
335108c70cfbSmrgsys.stdout.write(sitedir)"`
33528ffb90f1Smrg   #
33538ffb90f1Smrg   case $am_cv_python_pythondir in
33548ffb90f1Smrg   $am_py_prefix*)
33558ffb90f1Smrg     am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
33568ffb90f1Smrg     am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"`
33578ffb90f1Smrg     ;;
33588ffb90f1Smrg   *)
33598ffb90f1Smrg     case $am_py_prefix in
33608ffb90f1Smrg       /usr|/System*) ;;
33618ffb90f1Smrg       *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
33628ffb90f1Smrg          ;;
336308c70cfbSmrg     esac
33648ffb90f1Smrg     ;;
33658ffb90f1Smrg   esac
33668ffb90f1Smrg  ])
336708c70cfbSmrg  AC_SUBST([pythondir], [$am_cv_python_pythondir])
3368602e473dSmrg
33698ffb90f1Smrg  dnl 2. pkgpythondir: $PACKAGE directory under pythondir.  Was
33708ffb90f1Smrg  dnl    PYTHON_SITE_PACKAGE in previous betas, but this naming is
33718ffb90f1Smrg  dnl    more consistent with the rest of automake.
33728ffb90f1Smrg  dnl
337308c70cfbSmrg  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
3374602e473dSmrg
33758ffb90f1Smrg  dnl 3. pyexecdir: directory for installing python extension modules
33768ffb90f1Smrg  dnl    (shared libraries).
337708c70cfbSmrg  dnl Query distutils for this directory.
33788ffb90f1Smrg  dnl
33798ffb90f1Smrg  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)],
33808ffb90f1Smrg  [am_cv_python_pyexecdir],
33818ffb90f1Smrg  [if test "x$am_cv_python_exec_prefix" = x; then
33828ffb90f1Smrg     am_py_exec_prefix=$am__usable_exec_prefix
33838ffb90f1Smrg   else
33848ffb90f1Smrg     am_py_exec_prefix=$am_cv_python_exec_prefix
33858ffb90f1Smrg   fi
33868ffb90f1Smrg   am_cv_python_pyexecdir=`$PYTHON -c "
338708c70cfbSmrg$am_python_setup_sysconfig
338808c70cfbSmrgif can_use_sysconfig:
33898ffb90f1Smrg  sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'})
339008c70cfbSmrgelse:
33918ffb90f1Smrg  from distutils import sysconfig
33928ffb90f1Smrg  sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
339308c70cfbSmrgsys.stdout.write(sitedir)"`
33948ffb90f1Smrg   #
33958ffb90f1Smrg   case $am_cv_python_pyexecdir in
33968ffb90f1Smrg   $am_py_exec_prefix*)
33978ffb90f1Smrg     am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
33988ffb90f1Smrg     am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"`
33998ffb90f1Smrg     ;;
34008ffb90f1Smrg   *)
34018ffb90f1Smrg     case $am_py_exec_prefix in
34028ffb90f1Smrg       /usr|/System*) ;;
34038ffb90f1Smrg       *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
34048ffb90f1Smrg          ;;
340508c70cfbSmrg     esac
34068ffb90f1Smrg     ;;
34078ffb90f1Smrg   esac
34088ffb90f1Smrg  ])
340908c70cfbSmrg  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
3410602e473dSmrg
34118ffb90f1Smrg  dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE)
34128ffb90f1Smrg  dnl
341308c70cfbSmrg  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
3414602e473dSmrg
341508c70cfbSmrg  dnl Run any user-specified action.
341608c70cfbSmrg  $2
341708c70cfbSmrg  fi
3418602e473dSmrg])
3419602e473dSmrg
3420602e473dSmrg
342108c70cfbSmrg# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
342208c70cfbSmrg# ---------------------------------------------------------------------------
342308c70cfbSmrg# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
342408c70cfbSmrg# Run ACTION-IF-FALSE otherwise.
342508c70cfbSmrg# This test uses sys.hexversion instead of the string equivalent (first
342608c70cfbSmrg# word of sys.version), in order to cope with versions such as 2.2c1.
342708c70cfbSmrg# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
342808c70cfbSmrgAC_DEFUN([AM_PYTHON_CHECK_VERSION],
342908c70cfbSmrg [prog="import sys
343008c70cfbSmrg# split strings by '.' and convert to numeric.  Append some zeros
343108c70cfbSmrg# because we need at least 4 digits for the hex conversion.
343208c70cfbSmrg# map returns an iterator in Python 3.0 and a list in 2.x
343308c70cfbSmrgminver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
343408c70cfbSmrgminverhex = 0
343508c70cfbSmrg# xrange is not present in Python 3.0 and range returns an iterator
343608c70cfbSmrgfor i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
343708c70cfbSmrgsys.exit(sys.hexversion < minverhex)"
343808c70cfbSmrg  AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
3439602e473dSmrg
34408ffb90f1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
344108c70cfbSmrg#
344208c70cfbSmrg# This file is free software; the Free Software Foundation
344308c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
344408c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3445602e473dSmrg
344608c70cfbSmrg# AM_RUN_LOG(COMMAND)
344708c70cfbSmrg# -------------------
344808c70cfbSmrg# Run COMMAND, save the exit status in ac_status, and log it.
344908c70cfbSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
345008c70cfbSmrgAC_DEFUN([AM_RUN_LOG],
345108c70cfbSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
345208c70cfbSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
345308c70cfbSmrg   ac_status=$?
345408c70cfbSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
345508c70cfbSmrg   (exit $ac_status); }])
3456602e473dSmrg
345708c70cfbSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3458602e473dSmrg
34598ffb90f1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
346008c70cfbSmrg#
346108c70cfbSmrg# This file is free software; the Free Software Foundation
346208c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
346308c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3464602e473dSmrg
346508c70cfbSmrg# AM_SANITY_CHECK
346608c70cfbSmrg# ---------------
346708c70cfbSmrgAC_DEFUN([AM_SANITY_CHECK],
346808c70cfbSmrg[AC_MSG_CHECKING([whether build environment is sane])
346908c70cfbSmrg# Reject unsafe characters in $srcdir or the absolute working directory
347008c70cfbSmrg# name.  Accept space and tab only in the latter.
347108c70cfbSmrgam_lf='
347208c70cfbSmrg'
347308c70cfbSmrgcase `pwd` in
347408c70cfbSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
347508c70cfbSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
347608c70cfbSmrgesac
347708c70cfbSmrgcase $srcdir in
347808c70cfbSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
347908c70cfbSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
348008c70cfbSmrgesac
3481602e473dSmrg
348208c70cfbSmrg# Do 'set' in a subshell so we don't clobber the current shell's
348308c70cfbSmrg# arguments.  Must try -L first in case configure is actually a
348408c70cfbSmrg# symlink; some systems play weird games with the mod time of symlinks
348508c70cfbSmrg# (eg FreeBSD returns the mod time of the symlink's containing
348608c70cfbSmrg# directory).
348708c70cfbSmrgif (
348808c70cfbSmrg   am_has_slept=no
348908c70cfbSmrg   for am_try in 1 2; do
349008c70cfbSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
349108c70cfbSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
349208c70cfbSmrg     if test "$[*]" = "X"; then
349308c70cfbSmrg	# -L didn't work.
349408c70cfbSmrg	set X `ls -t "$srcdir/configure" conftest.file`
349508c70cfbSmrg     fi
349608c70cfbSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
349708c70cfbSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
349808c70cfbSmrg
349908c70cfbSmrg	# If neither matched, then we have a broken ls.  This can happen
350008c70cfbSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
350108c70cfbSmrg	# broken ls alias from the environment.  This has actually
350208c70cfbSmrg	# happened.  Such a system could not be considered "sane".
350308c70cfbSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
350408c70cfbSmrg  alias in your environment])
350508c70cfbSmrg     fi
350608c70cfbSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
350708c70cfbSmrg       break
350808c70cfbSmrg     fi
350908c70cfbSmrg     # Just in case.
351008c70cfbSmrg     sleep 1
351108c70cfbSmrg     am_has_slept=yes
351208c70cfbSmrg   done
351308c70cfbSmrg   test "$[2]" = conftest.file
351408c70cfbSmrg   )
351508c70cfbSmrgthen
351608c70cfbSmrg   # Ok.
351708c70cfbSmrg   :
351808c70cfbSmrgelse
351908c70cfbSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
352008c70cfbSmrgCheck your system clock])
352108c70cfbSmrgfi
352208c70cfbSmrgAC_MSG_RESULT([yes])
352308c70cfbSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
352408c70cfbSmrg# generated files are strictly newer.
352508c70cfbSmrgam_sleep_pid=
352608c70cfbSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
352708c70cfbSmrg  ( sleep 1 ) &
352808c70cfbSmrg  am_sleep_pid=$!
352908c70cfbSmrgfi
353008c70cfbSmrgAC_CONFIG_COMMANDS_PRE(
353108c70cfbSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
353208c70cfbSmrg   if test -n "$am_sleep_pid"; then
353308c70cfbSmrg     # Hide warnings about reused PIDs.
353408c70cfbSmrg     wait $am_sleep_pid 2>/dev/null
353508c70cfbSmrg   fi
353608c70cfbSmrg   AC_MSG_RESULT([done])])
353708c70cfbSmrgrm -f conftest.file
353808c70cfbSmrg])
3539602e473dSmrg
35408ffb90f1Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
354108c70cfbSmrg#
354208c70cfbSmrg# This file is free software; the Free Software Foundation
354308c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
354408c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3545602e473dSmrg
354608c70cfbSmrg# AM_SILENT_RULES([DEFAULT])
354708c70cfbSmrg# --------------------------
354808c70cfbSmrg# Enable less verbose build rules; with the default set to DEFAULT
354908c70cfbSmrg# ("yes" being less verbose, "no" or empty being verbose).
355008c70cfbSmrgAC_DEFUN([AM_SILENT_RULES],
355108c70cfbSmrg[AC_ARG_ENABLE([silent-rules], [dnl
355208c70cfbSmrgAS_HELP_STRING(
355308c70cfbSmrg  [--enable-silent-rules],
355408c70cfbSmrg  [less verbose build output (undo: "make V=1")])
355508c70cfbSmrgAS_HELP_STRING(
355608c70cfbSmrg  [--disable-silent-rules],
355708c70cfbSmrg  [verbose build output (undo: "make V=0")])dnl
355808c70cfbSmrg])
355908c70cfbSmrgcase $enable_silent_rules in @%:@ (((
356008c70cfbSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
356108c70cfbSmrg   no) AM_DEFAULT_VERBOSITY=1;;
356208c70cfbSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
356308c70cfbSmrgesac
356408c70cfbSmrgdnl
356508c70cfbSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
356608c70cfbSmrgdnl do not support nested variable expansions.
356708c70cfbSmrgdnl See automake bug#9928 and bug#10237.
356808c70cfbSmrgam_make=${MAKE-make}
356908c70cfbSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
357008c70cfbSmrg   [am_cv_make_support_nested_variables],
357108c70cfbSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
357208c70cfbSmrgBAR0=false
357308c70cfbSmrgBAR1=true
357408c70cfbSmrgV=1
357508c70cfbSmrgam__doit:
357608c70cfbSmrg	@$(TRUE)
357708c70cfbSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
357808c70cfbSmrg  am_cv_make_support_nested_variables=yes
357908c70cfbSmrgelse
358008c70cfbSmrg  am_cv_make_support_nested_variables=no
358108c70cfbSmrgfi])
358208c70cfbSmrgif test $am_cv_make_support_nested_variables = yes; then
358308c70cfbSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
358408c70cfbSmrg  AM_V='$(V)'
358508c70cfbSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
358608c70cfbSmrgelse
358708c70cfbSmrg  AM_V=$AM_DEFAULT_VERBOSITY
358808c70cfbSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3589602e473dSmrgfi
359008c70cfbSmrgAC_SUBST([AM_V])dnl
359108c70cfbSmrgAM_SUBST_NOTMAKE([AM_V])dnl
359208c70cfbSmrgAC_SUBST([AM_DEFAULT_V])dnl
359308c70cfbSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
359408c70cfbSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
359508c70cfbSmrgAM_BACKSLASH='\'
359608c70cfbSmrgAC_SUBST([AM_BACKSLASH])dnl
359708c70cfbSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
359808c70cfbSmrg])
3599602e473dSmrg
36008ffb90f1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
360108c70cfbSmrg#
360208c70cfbSmrg# This file is free software; the Free Software Foundation
360308c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
360408c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3605602e473dSmrg
360608c70cfbSmrg# AM_PROG_INSTALL_STRIP
360708c70cfbSmrg# ---------------------
360808c70cfbSmrg# One issue with vendor 'install' (even GNU) is that you can't
360908c70cfbSmrg# specify the program used to strip binaries.  This is especially
361008c70cfbSmrg# annoying in cross-compiling environments, where the build's strip
361108c70cfbSmrg# is unlikely to handle the host's binaries.
361208c70cfbSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
361308c70cfbSmrg# always use install-sh in "make install-strip", and initialize
361408c70cfbSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
361508c70cfbSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
361608c70cfbSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
361708c70cfbSmrg# Installed binaries are usually stripped using 'strip' when the user
361808c70cfbSmrg# run "make install-strip".  However 'strip' might not be the right
361908c70cfbSmrg# tool to use in cross-compilation environments, therefore Automake
362008c70cfbSmrg# will honor the 'STRIP' environment variable to overrule this program.
362108c70cfbSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
362208c70cfbSmrgif test "$cross_compiling" != no; then
362308c70cfbSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
362408c70cfbSmrgfi
362508c70cfbSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
362608c70cfbSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3627602e473dSmrg
36288ffb90f1Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
362908c70cfbSmrg#
363008c70cfbSmrg# This file is free software; the Free Software Foundation
363108c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
363208c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3633602e473dSmrg
363408c70cfbSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
363508c70cfbSmrg# ---------------------------
363608c70cfbSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
363708c70cfbSmrg# This macro is traced by Automake.
363808c70cfbSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3639602e473dSmrg
364008c70cfbSmrg# AM_SUBST_NOTMAKE(VARIABLE)
364108c70cfbSmrg# --------------------------
364208c70cfbSmrg# Public sister of _AM_SUBST_NOTMAKE.
364308c70cfbSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3644602e473dSmrg
364508c70cfbSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3646602e473dSmrg
36478ffb90f1Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
3648602e473dSmrg#
364908c70cfbSmrg# This file is free software; the Free Software Foundation
365008c70cfbSmrg# gives unlimited permission to copy and/or distribute it,
365108c70cfbSmrg# with or without modifications, as long as this notice is preserved.
3652602e473dSmrg
365308c70cfbSmrg# _AM_PROG_TAR(FORMAT)
365408c70cfbSmrg# --------------------
365508c70cfbSmrg# Check how to create a tarball in format FORMAT.
365608c70cfbSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
365708c70cfbSmrg#
365808c70cfbSmrg# Substitute a variable $(am__tar) that is a command
365908c70cfbSmrg# writing to stdout a FORMAT-tarball containing the directory
366008c70cfbSmrg# $tardir.
366108c70cfbSmrg#     tardir=directory && $(am__tar) > result.tar
366208c70cfbSmrg#
366308c70cfbSmrg# Substitute a variable $(am__untar) that extract such
366408c70cfbSmrg# a tarball read from stdin.
366508c70cfbSmrg#     $(am__untar) < result.tar
366608c70cfbSmrg#
366708c70cfbSmrgAC_DEFUN([_AM_PROG_TAR],
366808c70cfbSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
366908c70cfbSmrg# in the wild :-(  We should find a proper way to deprecate it ...
367008c70cfbSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3671602e473dSmrg
367208c70cfbSmrg# We'll loop over all known methods to create a tar archive until one works.
367308c70cfbSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3674602e473dSmrg
367508c70cfbSmrgm4_if([$1], [v7],
367608c70cfbSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
367708c70cfbSmrg
367808c70cfbSmrg  [m4_case([$1],
367908c70cfbSmrg    [ustar],
368008c70cfbSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
368108c70cfbSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
368208c70cfbSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
368308c70cfbSmrg      # and bug#13588).
368408c70cfbSmrg      am_max_uid=2097151 # 2^21 - 1
368508c70cfbSmrg      am_max_gid=$am_max_uid
368608c70cfbSmrg      # The $UID and $GID variables are not portable, so we need to resort
368708c70cfbSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
368808c70cfbSmrg      # below are definitely unexpected, so allow the users to see them
368908c70cfbSmrg      # (that is, avoid stderr redirection).
369008c70cfbSmrg      am_uid=`id -u || echo unknown`
369108c70cfbSmrg      am_gid=`id -g || echo unknown`
369208c70cfbSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
369308c70cfbSmrg      if test $am_uid -le $am_max_uid; then
369408c70cfbSmrg         AC_MSG_RESULT([yes])
369508c70cfbSmrg      else
369608c70cfbSmrg         AC_MSG_RESULT([no])
369708c70cfbSmrg         _am_tools=none
369808c70cfbSmrg      fi
369908c70cfbSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
370008c70cfbSmrg      if test $am_gid -le $am_max_gid; then
370108c70cfbSmrg         AC_MSG_RESULT([yes])
370208c70cfbSmrg      else
370308c70cfbSmrg        AC_MSG_RESULT([no])
370408c70cfbSmrg        _am_tools=none
370508c70cfbSmrg      fi],
3706602e473dSmrg
370708c70cfbSmrg  [pax],
370808c70cfbSmrg    [],
3709602e473dSmrg
371008c70cfbSmrg  [m4_fatal([Unknown tar format])])
3711602e473dSmrg
371208c70cfbSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3713602e473dSmrg
371408c70cfbSmrg  # Go ahead even if we have the value already cached.  We do so because we
371508c70cfbSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
371608c70cfbSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3717602e473dSmrg
371808c70cfbSmrg  for _am_tool in $_am_tools; do
371908c70cfbSmrg    case $_am_tool in
372008c70cfbSmrg    gnutar)
372108c70cfbSmrg      for _am_tar in tar gnutar gtar; do
372208c70cfbSmrg        AM_RUN_LOG([$_am_tar --version]) && break
372308c70cfbSmrg      done
372408c70cfbSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
372508c70cfbSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
372608c70cfbSmrg      am__untar="$_am_tar -xf -"
372708c70cfbSmrg      ;;
372808c70cfbSmrg    plaintar)
372908c70cfbSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
373008c70cfbSmrg      # ustar tarball either.
373108c70cfbSmrg      (tar --version) >/dev/null 2>&1 && continue
373208c70cfbSmrg      am__tar='tar chf - "$$tardir"'
373308c70cfbSmrg      am__tar_='tar chf - "$tardir"'
373408c70cfbSmrg      am__untar='tar xf -'
373508c70cfbSmrg      ;;
373608c70cfbSmrg    pax)
373708c70cfbSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
373808c70cfbSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
373908c70cfbSmrg      am__untar='pax -r'
374008c70cfbSmrg      ;;
374108c70cfbSmrg    cpio)
374208c70cfbSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
374308c70cfbSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
374408c70cfbSmrg      am__untar='cpio -i -H $1 -d'
374508c70cfbSmrg      ;;
374608c70cfbSmrg    none)
374708c70cfbSmrg      am__tar=false
374808c70cfbSmrg      am__tar_=false
374908c70cfbSmrg      am__untar=false
375008c70cfbSmrg      ;;
375108c70cfbSmrg    esac
3752602e473dSmrg
375308c70cfbSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
375408c70cfbSmrg    # and am__untar set.
375508c70cfbSmrg    test -n "${am_cv_prog_tar_$1}" && break
375608c70cfbSmrg
375708c70cfbSmrg    # tar/untar a dummy directory, and stop if the command works.
375808c70cfbSmrg    rm -rf conftest.dir
375908c70cfbSmrg    mkdir conftest.dir
376008c70cfbSmrg    echo GrepMe > conftest.dir/file
376108c70cfbSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
376208c70cfbSmrg    rm -rf conftest.dir
376308c70cfbSmrg    if test -s conftest.tar; then
376408c70cfbSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
376508c70cfbSmrg      AM_RUN_LOG([cat conftest.dir/file])
376608c70cfbSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
376708c70cfbSmrg    fi
376808c70cfbSmrg  done
376908c70cfbSmrg  rm -rf conftest.dir
3770602e473dSmrg
377108c70cfbSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
377208c70cfbSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3773602e473dSmrg
377408c70cfbSmrgAC_SUBST([am__tar])
377508c70cfbSmrgAC_SUBST([am__untar])
377608c70cfbSmrg]) # _AM_PROG_TAR
3777602e473dSmrg
37781016ad83Smrgm4_include([m4/libtool.m4])
37791016ad83Smrgm4_include([m4/ltoptions.m4])
37801016ad83Smrgm4_include([m4/ltsugar.m4])
37811016ad83Smrgm4_include([m4/ltversion.m4])
37821016ad83Smrgm4_include([m4/lt~obsolete.m4])
37831016ad83Smrgm4_include([m4/xcb.m4])
3784