1fdf6a26fSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
29e7bcd65Smrg
3fdf6a26fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4444c061aSmrg
5444c061aSmrg# This file is free software; the Free Software Foundation
6444c061aSmrg# gives unlimited permission to copy and/or distribute it,
7444c061aSmrg# with or without modifications, as long as this notice is preserved.
8444c061aSmrg
9444c061aSmrg# This program is distributed in the hope that it will be useful,
10444c061aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11444c061aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12444c061aSmrg# PARTICULAR PURPOSE.
13444c061aSmrg
149e7bcd65Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152265a131Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162265a131Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1735525df4Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1835525df4Smrg[m4_warning([this file was generated for autoconf 2.72.
192265a131SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202265a131SmrgIf you have problems, you may need to regenerate the build system entirely.
219e7bcd65SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22444c061aSmrg
2335525df4Smrg# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
2435525df4Smrg# serial 12 (pkg-config-0.29.2)
25249c3046Smrg
2635525df4Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2735525df4Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2835525df4Smrgdnl
2935525df4Smrgdnl This program is free software; you can redistribute it and/or modify
3035525df4Smrgdnl it under the terms of the GNU General Public License as published by
3135525df4Smrgdnl the Free Software Foundation; either version 2 of the License, or
3235525df4Smrgdnl (at your option) any later version.
3335525df4Smrgdnl
3435525df4Smrgdnl This program is distributed in the hope that it will be useful, but
3535525df4Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3635525df4Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3735525df4Smrgdnl General Public License for more details.
3835525df4Smrgdnl
3935525df4Smrgdnl You should have received a copy of the GNU General Public License
4035525df4Smrgdnl along with this program; if not, write to the Free Software
4135525df4Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4235525df4Smrgdnl 02111-1307, USA.
4335525df4Smrgdnl
4435525df4Smrgdnl As a special exception to the GNU General Public License, if you
4535525df4Smrgdnl distribute this file as part of a program that contains a
4635525df4Smrgdnl configuration script generated by Autoconf, you may include it under
4735525df4Smrgdnl the same distribution terms that you use for the rest of that
4835525df4Smrgdnl program.
49249c3046Smrg
5035525df4Smrgdnl PKG_PREREQ(MIN-VERSION)
5135525df4Smrgdnl -----------------------
5235525df4Smrgdnl Since: 0.29
5335525df4Smrgdnl
5435525df4Smrgdnl Verify that the version of the pkg-config macros are at least
5535525df4Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5635525df4Smrgdnl installed version of pkg-config, this checks the developer's version
5735525df4Smrgdnl of pkg.m4 when generating configure.
5835525df4Smrgdnl
5935525df4Smrgdnl To ensure that this macro is defined, also add:
6035525df4Smrgdnl m4_ifndef([PKG_PREREQ],
6135525df4Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6235525df4Smrgdnl
6335525df4Smrgdnl See the "Since" comment for each macro you use to see what version
6435525df4Smrgdnl of the macros you require.
6535525df4Smrgm4_defun([PKG_PREREQ],
6635525df4Smrg[m4_define([PKG_MACROS_VERSION], [0.29.2])
6735525df4Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6835525df4Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6935525df4Smrg])dnl PKG_PREREQ
70249c3046Smrg
7135525df4Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
7235525df4Smrgdnl ---------------------------------------------------------
7335525df4Smrgdnl Since: 0.16
7435525df4Smrgdnl
7535525df4Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7635525df4Smrgdnl first found in the path. Checks that the version of pkg-config found
7735525df4Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7835525df4Smrgdnl used since that's the first version where most current features of
7935525df4Smrgdnl pkg-config existed.
8035525df4Smrgdnl
8135525df4Smrgdnl If pkg-config is not found or older than specified, it will result
8235525df4Smrgdnl in an empty PKG_CONFIG variable. To avoid widespread issues with
8335525df4Smrgdnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
8435525df4Smrgdnl You can specify [PKG_CONFIG=false] as an action instead, which would
8535525df4Smrgdnl result in pkg-config tests failing, but no bogus error messages.
8635525df4SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8735525df4Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8835525df4Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8935525df4Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
9035525df4SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
9135525df4SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
9235525df4SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
93249c3046Smrg
9435525df4Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
9535525df4Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9635525df4Smrgfi
9735525df4Smrgif test -n "$PKG_CONFIG"; then
9835525df4Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9935525df4Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10035525df4Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10135525df4Smrg		AC_MSG_RESULT([yes])
10235525df4Smrg	else
10335525df4Smrg		AC_MSG_RESULT([no])
10435525df4Smrg		PKG_CONFIG=""
10535525df4Smrg	fi
10635525df4Smrgfi
10735525df4Smrgif test -z "$PKG_CONFIG"; then
10835525df4Smrg	m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
10935525df4Smrgfi[]dnl
11035525df4Smrg])dnl PKG_PROG_PKG_CONFIG
1111477040fSmrg
11235525df4Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
11335525df4Smrgdnl -------------------------------------------------------------------
11435525df4Smrgdnl Since: 0.18
11535525df4Smrgdnl
11635525df4Smrgdnl Check to see whether a particular set of modules exists. Similar to
11735525df4Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
11835525df4Smrgdnl
11935525df4Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12035525df4Smrgdnl only at the first occurrence in configure.ac, so if the first place
12135525df4Smrgdnl it's called might be skipped (such as if it is within an "if", you
12235525df4Smrgdnl have to call PKG_CHECK_EXISTS manually
12335525df4SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12435525df4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12535525df4Smrgif test -n "$PKG_CONFIG" && \
12635525df4Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12735525df4Smrg  m4_default([$2], [:])
12835525df4Smrgm4_ifvaln([$3], [else
12935525df4Smrg  $3])dnl
13035525df4Smrgfi])
131bdf0f55dSmrg
13235525df4Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
13335525df4Smrgdnl ---------------------------------------------
13435525df4Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
13535525df4Smrgdnl pkg_failed based on the result.
13635525df4Smrgm4_define([_PKG_CONFIG],
13735525df4Smrg[if test -n "$$1"; then
13835525df4Smrg    pkg_cv_[]$1="$$1"
13935525df4Smrg elif test -n "$PKG_CONFIG"; then
14035525df4Smrg    PKG_CHECK_EXISTS([$3],
14135525df4Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
14235525df4Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
14335525df4Smrg		     [pkg_failed=yes])
14435525df4Smrg else
14535525df4Smrg    pkg_failed=untried
14635525df4Smrgfi[]dnl
14735525df4Smrg])dnl _PKG_CONFIG
1481477040fSmrg
14935525df4Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
15035525df4Smrgdnl ---------------------------
15135525df4Smrgdnl Internal check to see if pkg-config supports short errors.
15235525df4SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
15335525df4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
15435525df4Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
15535525df4Smrg        _pkg_short_errors_supported=yes
156fdf6a26fSmrgelse
15735525df4Smrg        _pkg_short_errors_supported=no
15835525df4Smrgfi[]dnl
15935525df4Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
160444c061aSmrg
161444c061aSmrg
16235525df4Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
16335525df4Smrgdnl   [ACTION-IF-NOT-FOUND])
16435525df4Smrgdnl --------------------------------------------------------------
16535525df4Smrgdnl Since: 0.4.0
16635525df4Smrgdnl
16735525df4Smrgdnl Note that if there is a possibility the first call to
16835525df4Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16935525df4Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
17035525df4SmrgAC_DEFUN([PKG_CHECK_MODULES],
17135525df4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
17235525df4SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
17335525df4SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
174444c061aSmrg
17535525df4Smrgpkg_failed=no
17635525df4SmrgAC_MSG_CHECKING([for $2])
177444c061aSmrg
17835525df4Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17935525df4Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
180444c061aSmrg
18135525df4Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
18235525df4Smrgand $1[]_LIBS to avoid the need to call pkg-config.
18335525df4SmrgSee the pkg-config man page for more details.])
184444c061aSmrg
18535525df4Smrgif test $pkg_failed = yes; then
18635525df4Smrg        AC_MSG_RESULT([no])
18735525df4Smrg        _PKG_SHORT_ERRORS_SUPPORTED
18835525df4Smrg        if test $_pkg_short_errors_supported = yes; then
18935525df4Smrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
19035525df4Smrg        else
19135525df4Smrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
19235525df4Smrg        fi
19335525df4Smrg        # Put the nasty error message in config.log where it belongs
19435525df4Smrg        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1952265a131Smrg
19635525df4Smrg        m4_default([$4], [AC_MSG_ERROR(
19735525df4Smrg[Package requirements ($2) were not met:
1981477040fSmrg
19935525df4Smrg$$1_PKG_ERRORS
2001477040fSmrg
20135525df4SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
20235525df4Smrginstalled software in a non-standard prefix.
2031477040fSmrg
20435525df4Smrg_PKG_TEXT])[]dnl
20535525df4Smrg        ])
20635525df4Smrgelif test $pkg_failed = untried; then
20735525df4Smrg        AC_MSG_RESULT([no])
20835525df4Smrg        m4_default([$4], [AC_MSG_FAILURE(
20935525df4Smrg[The pkg-config script could not be found or is too old.  Make sure it
21035525df4Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
21135525df4Smrgpath to pkg-config.
2121477040fSmrg
21335525df4Smrg_PKG_TEXT
21435525df4Smrg
21535525df4SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
21635525df4Smrg        ])
217fdf6a26fSmrgelse
21835525df4Smrg        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21935525df4Smrg        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
22035525df4Smrg        AC_MSG_RESULT([yes])
22135525df4Smrg        $3
22235525df4Smrgfi[]dnl
22335525df4Smrg])dnl PKG_CHECK_MODULES
2241477040fSmrg
2251477040fSmrg
22635525df4Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
22735525df4Smrgdnl   [ACTION-IF-NOT-FOUND])
22835525df4Smrgdnl ---------------------------------------------------------------------
22935525df4Smrgdnl Since: 0.29
23035525df4Smrgdnl
23135525df4Smrgdnl Checks for existence of MODULES and gathers its build flags with
23235525df4Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
23335525df4Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
23435525df4Smrgdnl
23535525df4Smrgdnl Note that if there is a possibility the first call to
23635525df4Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
23735525df4Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
23835525df4Smrgdnl configure.ac.
23935525df4SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
24035525df4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
24135525df4Smrg_save_PKG_CONFIG=$PKG_CONFIG
24235525df4SmrgPKG_CONFIG="$PKG_CONFIG --static"
24335525df4SmrgPKG_CHECK_MODULES($@)
24435525df4SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
24535525df4Smrg])dnl PKG_CHECK_MODULES_STATIC
2460568f49bSmrg
2470568f49bSmrg
24835525df4Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24935525df4Smrgdnl -------------------------
25035525df4Smrgdnl Since: 0.27
25135525df4Smrgdnl
25235525df4Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
25335525df4Smrgdnl should install pkg-config .pc files. By default the directory is
25435525df4Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
25535525df4Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
25635525df4Smrgdnl parameter.
25735525df4SmrgAC_DEFUN([PKG_INSTALLDIR],
25835525df4Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25935525df4Smrgm4_pushdef([pkg_description],
26035525df4Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
26135525df4SmrgAC_ARG_WITH([pkgconfigdir],
26235525df4Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
26335525df4Smrg    [with_pkgconfigdir=]pkg_default)
26435525df4SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
26535525df4Smrgm4_popdef([pkg_default])
26635525df4Smrgm4_popdef([pkg_description])
26735525df4Smrg])dnl PKG_INSTALLDIR
2680568f49bSmrg
2690568f49bSmrg
27035525df4Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
27135525df4Smrgdnl --------------------------------
27235525df4Smrgdnl Since: 0.27
27335525df4Smrgdnl
27435525df4Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
27535525df4Smrgdnl module should install arch-independent pkg-config .pc files. By
27635525df4Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
27735525df4Smrgdnl changed by passing DIRECTORY. The user can override through the
27835525df4Smrgdnl --with-noarch-pkgconfigdir parameter.
27935525df4SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
28035525df4Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
28135525df4Smrgm4_pushdef([pkg_description],
28235525df4Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
28335525df4SmrgAC_ARG_WITH([noarch-pkgconfigdir],
28435525df4Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
28535525df4Smrg    [with_noarch_pkgconfigdir=]pkg_default)
28635525df4SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
28735525df4Smrgm4_popdef([pkg_default])
28835525df4Smrgm4_popdef([pkg_description])
28935525df4Smrg])dnl PKG_NOARCH_INSTALLDIR
290a3bd7f05Smrg
2911477040fSmrg
29235525df4Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
29335525df4Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
29435525df4Smrgdnl -------------------------------------------
29535525df4Smrgdnl Since: 0.28
29635525df4Smrgdnl
29735525df4Smrgdnl Retrieves the value of the pkg-config variable for the given module.
29835525df4SmrgAC_DEFUN([PKG_CHECK_VAR],
29935525df4Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
30035525df4SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
3011477040fSmrg
30235525df4Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
30335525df4SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
3041477040fSmrg
30535525df4SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
30635525df4Smrg])dnl PKG_CHECK_VAR
3071477040fSmrg
30835525df4Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
30935525df4Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
31035525df4Smrgdnl   [DESCRIPTION], [DEFAULT])
31135525df4Smrgdnl ------------------------------------------
31235525df4Smrgdnl
31335525df4Smrgdnl Prepare a "--with-" configure option using the lowercase
31435525df4Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
31535525df4Smrgdnl PKG_CHECK_MODULES in a single macro.
31635525df4SmrgAC_DEFUN([PKG_WITH_MODULES],
31735525df4Smrg[
31835525df4Smrgm4_pushdef([with_arg], m4_tolower([$1]))
31935525df4Smrg
32035525df4Smrgm4_pushdef([description],
32135525df4Smrg           [m4_default([$5], [build with ]with_arg[ support])])
32235525df4Smrg
32335525df4Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
32435525df4Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
32535525df4Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
32635525df4Smrg
32735525df4Smrgm4_case(def_arg,
32835525df4Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
32935525df4Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
33035525df4Smrg
33135525df4SmrgAC_ARG_WITH(with_arg,
33235525df4Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
33335525df4Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
33435525df4Smrg
33535525df4SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
33635525df4Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
33735525df4Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
33835525df4Smrg                                        [m4_n([def_action_if_found]) $3],
33935525df4Smrg                                        [m4_n([def_action_if_not_found]) $4])])
34035525df4Smrg
34135525df4Smrgm4_popdef([with_arg])
34235525df4Smrgm4_popdef([description])
34335525df4Smrgm4_popdef([def_arg])
34435525df4Smrg
34535525df4Smrg])dnl PKG_WITH_MODULES
34635525df4Smrg
34735525df4Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
34835525df4Smrgdnl   [DESCRIPTION], [DEFAULT])
34935525df4Smrgdnl -----------------------------------------------
35035525df4Smrgdnl
35135525df4Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
35235525df4Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
35335525df4SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
35435525df4Smrg[
35535525df4SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
35635525df4Smrg
35735525df4SmrgAM_CONDITIONAL([HAVE_][$1],
35835525df4Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
35935525df4Smrg])dnl PKG_HAVE_WITH_MODULES
36035525df4Smrg
36135525df4Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
36235525df4Smrgdnl   [DESCRIPTION], [DEFAULT])
36335525df4Smrgdnl ------------------------------------------------------
36435525df4Smrgdnl
36535525df4Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
36635525df4Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
36735525df4Smrgdnl and preprocessor variable.
36835525df4SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
36935525df4Smrg[
37035525df4SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
3711477040fSmrg
37235525df4SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
37335525df4Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
37435525df4Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
375bdf0f55dSmrg
37635525df4Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
37735525df4Smrgdnl
37835525df4Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
37935525df4Smrgdnl
38035525df4Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
38135525df4Smrgdnl copy of this software and associated documentation files (the "Software"),
38235525df4Smrgdnl to deal in the Software without restriction, including without limitation
38335525df4Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
38435525df4Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
38535525df4Smrgdnl Software is furnished to do so, subject to the following conditions:
38635525df4Smrgdnl
38735525df4Smrgdnl The above copyright notice and this permission notice (including the next
38835525df4Smrgdnl paragraph) shall be included in all copies or substantial portions of the
38935525df4Smrgdnl Software.
39035525df4Smrgdnl
39135525df4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39235525df4Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39335525df4Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
39435525df4Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39535525df4Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39635525df4Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39735525df4Smrgdnl DEALINGS IN THE SOFTWARE.
3982265a131Smrg
39935525df4Smrg# XORG_MACROS_VERSION(required-version)
40035525df4Smrg# -------------------------------------
40135525df4Smrg# Minimum version: 1.1.0
40235525df4Smrg#
40335525df4Smrg# If you're using a macro added in Version 1.1 or newer, include this in
40435525df4Smrg# your configure.ac with the minimum required version, such as:
40535525df4Smrg# XORG_MACROS_VERSION(1.1)
40635525df4Smrg#
40735525df4Smrg# To ensure that this macro is defined, also add:
40835525df4Smrg# m4_ifndef([XORG_MACROS_VERSION],
40935525df4Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
41035525df4Smrg#
41135525df4Smrg#
41235525df4Smrg# See the "minimum version" comment for each macro you use to see what
41335525df4Smrg# version you require.
41435525df4Smrgm4_defun([XORG_MACROS_VERSION],[
41535525df4Smrgm4_define([vers_have], [1.20.2])
41635525df4Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
41735525df4Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
41835525df4Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
41935525df4Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
42035525df4Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
42135525df4Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
42235525df4Smrgm4_undefine([vers_have])
42335525df4Smrgm4_undefine([maj_have])
42435525df4Smrgm4_undefine([maj_needed])
42535525df4Smrg]) # XORG_MACROS_VERSION
42635525df4Smrg
42735525df4Smrg# XORG_PROG_RAWCPP()
42835525df4Smrg# ------------------
42935525df4Smrg# Minimum version: 1.0.0
43035525df4Smrg#
43135525df4Smrg# Find cpp program and necessary flags for use in pre-processing text files
43235525df4Smrg# such as man pages and config files
43335525df4SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
43435525df4SmrgAC_REQUIRE([AC_PROG_CPP])
43535525df4SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
43635525df4Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
43735525df4Smrg
43835525df4Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
43935525df4Smrg# which is not the best choice for supporting other OS'es, but covers most
44035525df4Smrg# of the ones we need for now.
44135525df4SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
44235525df4SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
44335525df4Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
44435525df4Smrg	AC_MSG_RESULT([no])
44535525df4Smrgelse
44635525df4Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
44735525df4Smrg		RAWCPPFLAGS=-undef
44835525df4Smrg		AC_MSG_RESULT([yes])
44935525df4Smrg	# under Cygwin unix is still defined even with -undef
45035525df4Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
45135525df4Smrg		RAWCPPFLAGS="-undef -ansi"
45235525df4Smrg		AC_MSG_RESULT([yes, with -ansi])
45335525df4Smrg	else
45435525df4Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
45535525df4Smrg	fi
4560568f49bSmrgfi
45735525df4Smrgrm -f conftest.$ac_ext
4582265a131Smrg
45935525df4SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
46035525df4SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
46135525df4Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
46235525df4Smrg	AC_MSG_RESULT([no])
46335525df4Smrgelse
46435525df4Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
46535525df4Smrg		TRADITIONALCPPFLAGS="-traditional"
46635525df4Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
46735525df4Smrg		AC_MSG_RESULT([yes])
46835525df4Smrg	else
46935525df4Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
47035525df4Smrg	fi
4710568f49bSmrgfi
47235525df4Smrgrm -f conftest.$ac_ext
47335525df4SmrgAC_SUBST(RAWCPPFLAGS)
47435525df4SmrgAC_SUBST(TRADITIONALCPPFLAGS)
47535525df4Smrg]) # XORG_PROG_RAWCPP
476339a7c43Smrg
47735525df4Smrg# XORG_MANPAGE_SECTIONS()
47835525df4Smrg# -----------------------
47935525df4Smrg# Minimum version: 1.0.0
48035525df4Smrg#
48135525df4Smrg# Determine which sections man pages go in for the different man page types
48235525df4Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
48335525df4Smrg# Not sure if there's any better way than just hardcoding by OS name.
48435525df4Smrg# Override default settings by setting environment variables
48535525df4Smrg# Added MAN_SUBSTS in version 1.8
48635525df4Smrg# Added AC_PROG_SED in version 1.8
4871477040fSmrg
48835525df4SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
48935525df4SmrgAC_REQUIRE([AC_CANONICAL_HOST])
49035525df4SmrgAC_REQUIRE([AC_PROG_SED])
491bdf0f55dSmrg
49235525df4Smrgcase $host_os in
49335525df4Smrg    solaris*)
49435525df4Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
49535525df4Smrg        # check for a man page file found in later versions that use
49635525df4Smrg        # traditional section numbers instead
49735525df4Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
49835525df4Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
49935525df4Smrg        ;;
50035525df4Smrg    *) SYSV_MAN_SECTIONS=false ;;
50135525df4Smrgesac
50235525df4Smrg
50335525df4Smrgif test x$APP_MAN_SUFFIX = x    ; then
50435525df4Smrg    APP_MAN_SUFFIX=1
5050568f49bSmrgfi
50635525df4Smrgif test x$APP_MAN_DIR = x    ; then
50735525df4Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
5080568f49bSmrgfi
509339a7c43Smrg
51035525df4Smrgif test x$LIB_MAN_SUFFIX = x    ; then
51135525df4Smrg    LIB_MAN_SUFFIX=3
51235525df4Smrgfi
51335525df4Smrgif test x$LIB_MAN_DIR = x    ; then
51435525df4Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
51535525df4Smrgfi
516339a7c43Smrg
51735525df4Smrgif test x$FILE_MAN_SUFFIX = x    ; then
51835525df4Smrg    case $SYSV_MAN_SECTIONS in
51935525df4Smrg	true)				FILE_MAN_SUFFIX=4  ;;
52035525df4Smrg	*)				FILE_MAN_SUFFIX=5  ;;
52135525df4Smrg    esac
52235525df4Smrgfi
52335525df4Smrgif test x$FILE_MAN_DIR = x    ; then
52435525df4Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
52535525df4Smrgfi
526fdf6a26fSmrg
52735525df4Smrgif test x$MISC_MAN_SUFFIX = x    ; then
52835525df4Smrg    case $SYSV_MAN_SECTIONS in
52935525df4Smrg	true)				MISC_MAN_SUFFIX=5  ;;
53035525df4Smrg	*)				MISC_MAN_SUFFIX=7  ;;
53135525df4Smrg    esac
53235525df4Smrgfi
53335525df4Smrgif test x$MISC_MAN_DIR = x    ; then
53435525df4Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
53535525df4Smrgfi
536fdf6a26fSmrg
53735525df4Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
53835525df4Smrg    case $SYSV_MAN_SECTIONS in
53935525df4Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
54035525df4Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
54135525df4Smrg    esac
54235525df4Smrgfi
54335525df4Smrgif test x$DRIVER_MAN_DIR = x    ; then
54435525df4Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5450568f49bSmrgfi
546339a7c43Smrg
54735525df4Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
54835525df4Smrg    case $SYSV_MAN_SECTIONS in
54935525df4Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
55035525df4Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
55135525df4Smrg    esac
55235525df4Smrgfi
55335525df4Smrgif test x$ADMIN_MAN_DIR = x    ; then
55435525df4Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
55535525df4Smrgfi
556339a7c43Smrg
5571477040fSmrg
55835525df4SmrgAC_SUBST([APP_MAN_SUFFIX])
55935525df4SmrgAC_SUBST([LIB_MAN_SUFFIX])
56035525df4SmrgAC_SUBST([FILE_MAN_SUFFIX])
56135525df4SmrgAC_SUBST([MISC_MAN_SUFFIX])
56235525df4SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
56335525df4SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
56435525df4SmrgAC_SUBST([APP_MAN_DIR])
56535525df4SmrgAC_SUBST([LIB_MAN_DIR])
56635525df4SmrgAC_SUBST([FILE_MAN_DIR])
56735525df4SmrgAC_SUBST([MISC_MAN_DIR])
56835525df4SmrgAC_SUBST([DRIVER_MAN_DIR])
56935525df4SmrgAC_SUBST([ADMIN_MAN_DIR])
5701477040fSmrg
57135525df4SmrgXORG_MAN_PAGE="X Version 11"
57235525df4SmrgAC_SUBST([XORG_MAN_PAGE])
57335525df4SmrgMAN_SUBSTS="\
57435525df4Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
57535525df4Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
57635525df4Smrg	-e 's|__xservername__|Xorg|g' \
57735525df4Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
57835525df4Smrg	-e 's|__projectroot__|\$(prefix)|g' \
57935525df4Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
58035525df4Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
58135525df4Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
58235525df4Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
58335525df4Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
58435525df4Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
58535525df4Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
58635525df4SmrgAC_SUBST([MAN_SUBSTS])
5871477040fSmrg
58835525df4Smrg]) # XORG_MANPAGE_SECTIONS
5891477040fSmrg
59035525df4Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
59135525df4Smrg# ------------------------
59235525df4Smrg# Minimum version: 1.7.0
593fdf6a26fSmrg#
59435525df4Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
59535525df4Smrg# provided by xorg-sgml-doctools, if installed.
59635525df4SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
59735525df4SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
59835525df4SmrgXORG_SGML_PATH=
59935525df4SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
60035525df4Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
60135525df4Smrg    [m4_ifval([$1],[:],
60235525df4Smrg        [if test x"$cross_compiling" != x"yes" ; then
60335525df4Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
60435525df4Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
60535525df4Smrg         fi])
60635525df4Smrg    ])
6071477040fSmrg
60835525df4Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
60935525df4Smrg# the path and the name of the doc stylesheet
61035525df4Smrgif test "x$XORG_SGML_PATH" != "x" ; then
61135525df4Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
61235525df4Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
61335525df4Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6149e7bcd65Smrgelse
61535525df4Smrg   AC_MSG_RESULT([no])
616249c3046Smrgfi
6172265a131Smrg
61835525df4SmrgAC_SUBST(XORG_SGML_PATH)
61935525df4SmrgAC_SUBST(STYLESHEET_SRCDIR)
62035525df4SmrgAC_SUBST(XSL_STYLESHEET)
62135525df4SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
62235525df4Smrg]) # XORG_CHECK_SGML_DOCTOOLS
6232265a131Smrg
62435525df4Smrg# XORG_CHECK_LINUXDOC
62535525df4Smrg# -------------------
62635525df4Smrg# Minimum version: 1.0.0
627fdf6a26fSmrg#
62835525df4Smrg# Defines the variable MAKE_TEXT if the necessary tools and
62935525df4Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
63035525df4Smrg# Whether or not the necessary tools and files are found can be checked
63135525df4Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
63235525df4SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
63335525df4SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
63435525df4SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
6352265a131Smrg
63635525df4SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
6371477040fSmrg
63835525df4SmrgAC_MSG_CHECKING([whether to build documentation])
639444c061aSmrg
64035525df4Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
64135525df4Smrg   BUILDDOC=yes
64235525df4Smrgelse
64335525df4Smrg   BUILDDOC=no
64435525df4Smrgfi
645444c061aSmrg
64635525df4SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
647444c061aSmrg
64835525df4SmrgAC_MSG_RESULT([$BUILDDOC])
64935525df4Smrg
65035525df4SmrgAC_MSG_CHECKING([whether to build pdf documentation])
65135525df4Smrg
65235525df4Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
65335525df4Smrg   BUILDPDFDOC=yes
654fdf6a26fSmrgelse
65535525df4Smrg   BUILDPDFDOC=no
6560568f49bSmrgfi
6579e7bcd65Smrg
65835525df4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6599e7bcd65Smrg
66035525df4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
6619e7bcd65Smrg
66235525df4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
66335525df4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
66435525df4SmrgMAKE_PDF="$PS2PDF"
66535525df4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
6669e7bcd65Smrg
66735525df4SmrgAC_SUBST(MAKE_TEXT)
66835525df4SmrgAC_SUBST(MAKE_PS)
66935525df4SmrgAC_SUBST(MAKE_PDF)
67035525df4SmrgAC_SUBST(MAKE_HTML)
67135525df4Smrg]) # XORG_CHECK_LINUXDOC
672339a7c43Smrg
67335525df4Smrg# XORG_CHECK_DOCBOOK
67435525df4Smrg# -------------------
67535525df4Smrg# Minimum version: 1.0.0
67635525df4Smrg#
67735525df4Smrg# Checks for the ability to build output formats from SGML DocBook source.
67835525df4Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
67935525df4Smrg# indicates whether the necessary tools and files are found and, if set,
68035525df4Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
68135525df4SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
68235525df4SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
683339a7c43Smrg
68435525df4SmrgBUILDTXTDOC=no
68535525df4SmrgBUILDPDFDOC=no
68635525df4SmrgBUILDPSDOC=no
68735525df4SmrgBUILDHTMLDOC=no
6889e7bcd65Smrg
68935525df4SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
69035525df4SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
69135525df4SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
69235525df4SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6939e7bcd65Smrg
69435525df4SmrgAC_MSG_CHECKING([whether to build text documentation])
69535525df4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
69635525df4Smrg   test x$BUILD_TXTDOC != xno; then
69735525df4Smrg	BUILDTXTDOC=yes
6989e7bcd65Smrgfi
69935525df4SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
70035525df4SmrgAC_MSG_RESULT([$BUILDTXTDOC])
7019e7bcd65Smrg
70235525df4SmrgAC_MSG_CHECKING([whether to build PDF documentation])
70335525df4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
70435525df4Smrg   test x$BUILD_PDFDOC != xno; then
70535525df4Smrg	BUILDPDFDOC=yes
70635525df4Smrgfi
70735525df4SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
70835525df4SmrgAC_MSG_RESULT([$BUILDPDFDOC])
7090568f49bSmrg
71035525df4SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
71135525df4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
71235525df4Smrg   test x$BUILD_PSDOC != xno; then
71335525df4Smrg	BUILDPSDOC=yes
71435525df4Smrgfi
71535525df4SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
71635525df4SmrgAC_MSG_RESULT([$BUILDPSDOC])
7179e7bcd65Smrg
71835525df4SmrgAC_MSG_CHECKING([whether to build HTML documentation])
71935525df4Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
72035525df4Smrg   test x$BUILD_HTMLDOC != xno; then
72135525df4Smrg	BUILDHTMLDOC=yes
72235525df4Smrgfi
72335525df4SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
72435525df4SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7259e7bcd65Smrg
72635525df4SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
72735525df4SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
72835525df4SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
72935525df4SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
7309e7bcd65Smrg
73135525df4SmrgAC_SUBST(MAKE_TEXT)
73235525df4SmrgAC_SUBST(MAKE_PS)
73335525df4SmrgAC_SUBST(MAKE_PDF)
73435525df4SmrgAC_SUBST(MAKE_HTML)
73535525df4Smrg]) # XORG_CHECK_DOCBOOK
7369e7bcd65Smrg
73735525df4Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
73835525df4Smrg# ----------------
73935525df4Smrg# Minimum version: 1.5.0
74035525df4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
74135525df4Smrg#
74235525df4Smrg# Documentation tools are not always available on all platforms and sometimes
74335525df4Smrg# not at the appropriate level. This macro enables a module to test for the
74435525df4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
74535525df4Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
74635525df4Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
74735525df4Smrg# --with-xmlto assumes 'auto'.
74835525df4Smrg#
74935525df4Smrg# Interface to module:
75035525df4Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
75135525df4Smrg# XMLTO:	returns the path of the xmlto program found
75235525df4Smrg#		returns the path set by the user in the environment
75335525df4Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
75435525df4Smrg#		'no' user instructs the module not to use xmlto
75535525df4Smrg#
75635525df4Smrg# Added in version 1.10.0
75735525df4Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
75835525df4Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
75935525df4Smrg#
76035525df4Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
76135525df4Smrg#
76235525df4SmrgAC_DEFUN([XORG_WITH_XMLTO],[
76335525df4SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
76435525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
76535525df4SmrgAC_ARG_WITH(xmlto,
76635525df4Smrg	AS_HELP_STRING([--with-xmlto],
76735525df4Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
76835525df4Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
76935525df4Smrgm4_undefine([_defopt])
7701477040fSmrg
77135525df4Smrgif test "x$use_xmlto" = x"auto"; then
77235525df4Smrg   AC_PATH_PROG([XMLTO], [xmlto])
77335525df4Smrg   if test "x$XMLTO" = "x"; then
77435525df4Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
77535525df4Smrg	have_xmlto=no
77635525df4Smrg   else
77735525df4Smrg        have_xmlto=yes
77835525df4Smrg   fi
77935525df4Smrgelif test "x$use_xmlto" = x"yes" ; then
78035525df4Smrg   AC_PATH_PROG([XMLTO], [xmlto])
78135525df4Smrg   if test "x$XMLTO" = "x"; then
78235525df4Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
78335525df4Smrg   fi
78435525df4Smrg   have_xmlto=yes
78535525df4Smrgelif test "x$use_xmlto" = x"no" ; then
78635525df4Smrg   if test "x$XMLTO" != "x"; then
78735525df4Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
78835525df4Smrg   fi
78935525df4Smrg   have_xmlto=no
7900568f49bSmrgelse
79135525df4Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7929e7bcd65Smrgfi
7939e7bcd65Smrg
79435525df4Smrg# Test for a minimum version of xmlto, if provided.
79535525df4Smrgm4_ifval([$1],
79635525df4Smrg[if test "$have_xmlto" = yes; then
79735525df4Smrg    # scrape the xmlto version
79835525df4Smrg    AC_MSG_CHECKING([the xmlto version])
79935525df4Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
80035525df4Smrg    AC_MSG_RESULT([$xmlto_version])
80135525df4Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
80235525df4Smrg        [if test "x$use_xmlto" = xauto; then
80335525df4Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
80435525df4Smrg            have_xmlto=no
80535525df4Smrg        else
80635525df4Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
80735525df4Smrg        fi])
808fdf6a26fSmrgfi])
8099e7bcd65Smrg
81035525df4Smrg# Test for the ability of xmlto to generate a text target
8110568f49bSmrg#
81235525df4Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
81335525df4Smrg# following test for empty XML docbook files.
81435525df4Smrg# For compatibility reasons use the following empty XML docbook file and if
81535525df4Smrg# it fails try it again with a non-empty XML file.
81635525df4Smrghave_xmlto_text=no
81735525df4Smrgcat > conftest.xml << "EOF"
81835525df4SmrgEOF
81935525df4SmrgAS_IF([test "$have_xmlto" = yes],
82035525df4Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
82135525df4Smrg             [have_xmlto_text=yes],
82235525df4Smrg             [# Try it again with a non-empty XML file.
82335525df4Smrg              cat > conftest.xml << "EOF"
82435525df4Smrg<x></x>
82535525df4SmrgEOF
82635525df4Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
82735525df4Smrg                    [have_xmlto_text=yes],
82835525df4Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
82935525df4Smrgrm -f conftest.xml
83035525df4SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
83135525df4SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
83235525df4Smrg]) # XORG_WITH_XMLTO
8339e7bcd65Smrg
83435525df4Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
83535525df4Smrg# --------------------------------------------
83635525df4Smrg# Minimum version: 1.12.0
83735525df4Smrg# Minimum version for optional DEFAULT argument: 1.12.0
838fdf6a26fSmrg#
83935525df4Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
84035525df4Smrg# XML-based language used for the transformation of XML documents.
84135525df4Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
84235525df4Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
84335525df4Smrg# The XSLT processor is often used as a standalone tool for transformations.
84435525df4Smrg# It should not be assumed that this tool is used only to work with documnetation.
84535525df4Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8460568f49bSmrg#
84735525df4Smrg# Interface to module:
84835525df4Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
84935525df4Smrg# XSLTPROC:	 returns the path of the xsltproc program found
85035525df4Smrg#		 returns the path set by the user in the environment
85135525df4Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
85235525df4Smrg#		  'no' user instructs the module not to use xsltproc
85335525df4Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8549e7bcd65Smrg#
85535525df4Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8569e7bcd65Smrg#
85735525df4SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
85835525df4SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
85935525df4Smrg# Preserves the interface, should it be implemented later
86035525df4Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
86135525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
86235525df4SmrgAC_ARG_WITH(xsltproc,
86335525df4Smrg	AS_HELP_STRING([--with-xsltproc],
86435525df4Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
86535525df4Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
86635525df4Smrgm4_undefine([_defopt])
8679e7bcd65Smrg
86835525df4Smrgif test "x$use_xsltproc" = x"auto"; then
86935525df4Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
87035525df4Smrg   if test "x$XSLTPROC" = "x"; then
87135525df4Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
87235525df4Smrg	have_xsltproc=no
87335525df4Smrg   else
87435525df4Smrg        have_xsltproc=yes
87535525df4Smrg   fi
87635525df4Smrgelif test "x$use_xsltproc" = x"yes" ; then
87735525df4Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
87835525df4Smrg   if test "x$XSLTPROC" = "x"; then
87935525df4Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
88035525df4Smrg   fi
88135525df4Smrg   have_xsltproc=yes
88235525df4Smrgelif test "x$use_xsltproc" = x"no" ; then
88335525df4Smrg   if test "x$XSLTPROC" != "x"; then
88435525df4Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
88535525df4Smrg   fi
88635525df4Smrg   have_xsltproc=no
88735525df4Smrgelse
88835525df4Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
88935525df4Smrgfi
8909e7bcd65Smrg
89135525df4SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
89235525df4Smrg]) # XORG_WITH_XSLTPROC
8939e7bcd65Smrg
89435525df4Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
89535525df4Smrg# ----------------------------------------
89635525df4Smrg# Minimum version: 1.15.0
89735525df4Smrg#
89835525df4Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
89935525df4Smrg# scanning arbitrary text files, extracting information from those text files,
90035525df4Smrg# and printing reports based on that information.
90135525df4Smrg#
90235525df4Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
90335525df4Smrg#
90435525df4Smrg# Interface to module:
90535525df4Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
90635525df4Smrg# PERL:	     returns the path of the perl program found
90735525df4Smrg#	     returns the path set by the user in the environment
90835525df4Smrg# --with-perl: 'yes' user instructs the module to use perl
90935525df4Smrg#	       'no' user instructs the module not to use perl
91035525df4Smrg# have_perl: returns yes if perl found in PATH or no
91135525df4Smrg#
91235525df4Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
91335525df4Smrg#
91435525df4SmrgAC_DEFUN([XORG_WITH_PERL],[
91535525df4SmrgAC_ARG_VAR([PERL], [Path to perl command])
91635525df4Smrg# Preserves the interface, should it be implemented later
91735525df4Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
91835525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
91935525df4SmrgAC_ARG_WITH(perl,
92035525df4Smrg	AS_HELP_STRING([--with-perl],
92135525df4Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
92235525df4Smrg	   [use_perl=$withval], [use_perl=]_defopt)
92335525df4Smrgm4_undefine([_defopt])
924fdf6a26fSmrg
92535525df4Smrgif test "x$use_perl" = x"auto"; then
92635525df4Smrg   AC_PATH_PROG([PERL], [perl])
92735525df4Smrg   if test "x$PERL" = "x"; then
92835525df4Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
92935525df4Smrg	have_perl=no
93035525df4Smrg   else
93135525df4Smrg        have_perl=yes
93235525df4Smrg   fi
93335525df4Smrgelif test "x$use_perl" = x"yes" ; then
93435525df4Smrg   AC_PATH_PROG([PERL], [perl])
93535525df4Smrg   if test "x$PERL" = "x"; then
93635525df4Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
93735525df4Smrg   fi
93835525df4Smrg   have_perl=yes
93935525df4Smrgelif test "x$use_perl" = x"no" ; then
94035525df4Smrg   if test "x$PERL" != "x"; then
94135525df4Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
94235525df4Smrg   fi
94335525df4Smrg   have_perl=no
94435525df4Smrgelse
94535525df4Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
94635525df4Smrgfi
947fdf6a26fSmrg
94835525df4SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
94935525df4Smrg]) # XORG_WITH_PERL
950fdf6a26fSmrg
95135525df4Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
95235525df4Smrg# ----------------
95335525df4Smrg# Minimum version: 1.5.0
95435525df4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
95535525df4Smrg#
95635525df4Smrg# Documentation tools are not always available on all platforms and sometimes
95735525df4Smrg# not at the appropriate level. This macro enables a module to test for the
95835525df4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
95935525df4Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
96035525df4Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
96135525df4Smrg# --with-asciidoc assumes 'auto'.
96235525df4Smrg#
96335525df4Smrg# Interface to module:
96435525df4Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
96535525df4Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
96635525df4Smrg#		 returns the path set by the user in the environment
96735525df4Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
96835525df4Smrg#		  'no' user instructs the module not to use asciidoc
96935525df4Smrg#
97035525df4Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
97135525df4Smrg#
97235525df4SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
97335525df4SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
97435525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
97535525df4SmrgAC_ARG_WITH(asciidoc,
97635525df4Smrg	AS_HELP_STRING([--with-asciidoc],
97735525df4Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
97835525df4Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
97935525df4Smrgm4_undefine([_defopt])
980fdf6a26fSmrg
98135525df4Smrgif test "x$use_asciidoc" = x"auto"; then
98235525df4Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
98335525df4Smrg   if test "x$ASCIIDOC" = "x"; then
98435525df4Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
98535525df4Smrg	have_asciidoc=no
98635525df4Smrg   else
98735525df4Smrg        have_asciidoc=yes
98835525df4Smrg   fi
98935525df4Smrgelif test "x$use_asciidoc" = x"yes" ; then
99035525df4Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
99135525df4Smrg   if test "x$ASCIIDOC" = "x"; then
99235525df4Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
99335525df4Smrg   fi
99435525df4Smrg   have_asciidoc=yes
99535525df4Smrgelif test "x$use_asciidoc" = x"no" ; then
99635525df4Smrg   if test "x$ASCIIDOC" != "x"; then
99735525df4Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
99835525df4Smrg   fi
99935525df4Smrg   have_asciidoc=no
10009e7bcd65Smrgelse
100135525df4Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
100235525df4Smrgfi
100335525df4Smrgm4_ifval([$1],
100435525df4Smrg[if test "$have_asciidoc" = yes; then
100535525df4Smrg    # scrape the asciidoc version
100635525df4Smrg    AC_MSG_CHECKING([the asciidoc version])
100735525df4Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
100835525df4Smrg    AC_MSG_RESULT([$asciidoc_version])
100935525df4Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
101035525df4Smrg        [if test "x$use_asciidoc" = xauto; then
101135525df4Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
101235525df4Smrg            have_asciidoc=no
101335525df4Smrg        else
101435525df4Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
101535525df4Smrg        fi])
101635525df4Smrgfi])
101735525df4SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
101835525df4Smrg]) # XORG_WITH_ASCIIDOC
10199e7bcd65Smrg
102035525df4Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
102135525df4Smrg# -------------------------------------------
102235525df4Smrg# Minimum version: 1.5.0
102335525df4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
102435525df4Smrg# Minimum version for optional DOT checking: 1.18.0
10250568f49bSmrg#
102635525df4Smrg# Documentation tools are not always available on all platforms and sometimes
102735525df4Smrg# not at the appropriate level. This macro enables a module to test for the
102835525df4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
102935525df4Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
103035525df4Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
103135525df4Smrg# --with-doxygen assumes 'auto'.
10320568f49bSmrg#
103335525df4Smrg# Interface to module:
103435525df4Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
103535525df4Smrg# DOXYGEN:	 returns the path of the doxygen program found
103635525df4Smrg#		 returns the path set by the user in the environment
103735525df4Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
103835525df4Smrg#		  'no' user instructs the module not to use doxygen
1039fdf6a26fSmrg#
104035525df4Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1041fdf6a26fSmrg#
104235525df4SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
104335525df4SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
104435525df4SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
104535525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
104635525df4SmrgAC_ARG_WITH(doxygen,
104735525df4Smrg	AS_HELP_STRING([--with-doxygen],
104835525df4Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
104935525df4Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
105035525df4Smrgm4_undefine([_defopt])
10519e7bcd65Smrg
105235525df4Smrgif test "x$use_doxygen" = x"auto"; then
105335525df4Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
105435525df4Smrg   if test "x$DOXYGEN" = "x"; then
105535525df4Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
105635525df4Smrg	have_doxygen=no
105735525df4Smrg   else
105835525df4Smrg        have_doxygen=yes
105935525df4Smrg   fi
106035525df4Smrgelif test "x$use_doxygen" = x"yes" ; then
106135525df4Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
106235525df4Smrg   if test "x$DOXYGEN" = "x"; then
106335525df4Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
106435525df4Smrg   fi
106535525df4Smrg   have_doxygen=yes
106635525df4Smrgelif test "x$use_doxygen" = x"no" ; then
106735525df4Smrg   if test "x$DOXYGEN" != "x"; then
106835525df4Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
106935525df4Smrg   fi
107035525df4Smrg   have_doxygen=no
1071fdf6a26fSmrgelse
107235525df4Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1073fdf6a26fSmrgfi
107435525df4Smrgm4_ifval([$1],
107535525df4Smrg[if test "$have_doxygen" = yes; then
107635525df4Smrg    # scrape the doxygen version
107735525df4Smrg    AC_MSG_CHECKING([the doxygen version])
107835525df4Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
107935525df4Smrg    AC_MSG_RESULT([$doxygen_version])
108035525df4Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
108135525df4Smrg        [if test "x$use_doxygen" = xauto; then
108235525df4Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
108335525df4Smrg            have_doxygen=no
108435525df4Smrg        else
108535525df4Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
108635525df4Smrg        fi])
108735525df4Smrgfi])
10880568f49bSmrg
108935525df4Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
109035525df4Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
109135525df4Smrgdnl 	HAVE_DOT = @HAVE_DOT@
109235525df4SmrgHAVE_DOT=no
109335525df4Smrgif test "x$have_doxygen" = "xyes"; then
109435525df4Smrg  AC_PATH_PROG([DOT], [dot])
109535525df4Smrg    if test "x$DOT" != "x"; then
109635525df4Smrg      HAVE_DOT=yes
109735525df4Smrg    fi
1098fdf6a26fSmrgfi
10990568f49bSmrg
110035525df4SmrgAC_SUBST([HAVE_DOT])
110135525df4SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
110235525df4SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
110335525df4Smrg]) # XORG_WITH_DOXYGEN
11040568f49bSmrg
110535525df4Smrg# XORG_WITH_GROFF([DEFAULT])
110635525df4Smrg# ----------------
110735525df4Smrg# Minimum version: 1.6.0
110835525df4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
110935525df4Smrg#
111035525df4Smrg# Documentation tools are not always available on all platforms and sometimes
111135525df4Smrg# not at the appropriate level. This macro enables a module to test for the
111235525df4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
111335525df4Smrg# the --with-groff option, it allows maximum flexibility in making decisions
111435525df4Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
111535525df4Smrg# --with-groff assumes 'auto'.
111635525df4Smrg#
111735525df4Smrg# Interface to module:
111835525df4Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
111935525df4Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
112035525df4Smrg# HAVE_GROFF_MS: the -ms macros package
112135525df4Smrg# GROFF:	 returns the path of the groff program found
112235525df4Smrg#		 returns the path set by the user in the environment
112335525df4Smrg# --with-groff:	 'yes' user instructs the module to use groff
112435525df4Smrg#		 'no' user instructs the module not to use groff
112535525df4Smrg#
112635525df4Smrg# Added in version 1.9.0:
112735525df4Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
112835525df4Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
112935525df4Smrg#		   psselect from the psutils package.
113035525df4Smrg#		   the ghostcript package. Refer to the grohtml man pages
113135525df4Smrg#
113235525df4Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
113335525df4Smrg#
113435525df4Smrg# OS and distros often splits groff in a basic and full package, the former
113535525df4Smrg# having the groff program and the later having devices, fonts and macros
113635525df4Smrg# Checking for the groff executable is not enough.
113735525df4Smrg#
113835525df4Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
113935525df4Smrg# unset HAVE_GROFF or GROFF env variables.
114035525df4Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
114135525df4Smrg#
114235525df4SmrgAC_DEFUN([XORG_WITH_GROFF],[
114335525df4SmrgAC_ARG_VAR([GROFF], [Path to groff command])
114435525df4Smrgm4_define([_defopt], m4_default([$1], [auto]))
114535525df4SmrgAC_ARG_WITH(groff,
114635525df4Smrg	AS_HELP_STRING([--with-groff],
114735525df4Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
114835525df4Smrg	   [use_groff=$withval], [use_groff=]_defopt)
114935525df4Smrgm4_undefine([_defopt])
11509e7bcd65Smrg
115135525df4Smrgif test "x$use_groff" = x"auto"; then
115235525df4Smrg   AC_PATH_PROG([GROFF], [groff])
115335525df4Smrg   if test "x$GROFF" = "x"; then
115435525df4Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
115535525df4Smrg	have_groff=no
115635525df4Smrg   else
115735525df4Smrg        have_groff=yes
115835525df4Smrg   fi
115935525df4Smrgelif test "x$use_groff" = x"yes" ; then
116035525df4Smrg   AC_PATH_PROG([GROFF], [groff])
116135525df4Smrg   if test "x$GROFF" = "x"; then
116235525df4Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
116335525df4Smrg   fi
116435525df4Smrg   have_groff=yes
116535525df4Smrgelif test "x$use_groff" = x"no" ; then
116635525df4Smrg   if test "x$GROFF" != "x"; then
116735525df4Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
116835525df4Smrg   fi
116935525df4Smrg   have_groff=no
117035525df4Smrgelse
117135525df4Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1172fdf6a26fSmrgfi
1173fdf6a26fSmrg
117435525df4Smrg# We have groff, test for the presence of the macro packages
117535525df4Smrgif test "x$have_groff" = x"yes"; then
117635525df4Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
117735525df4Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
117835525df4Smrg        groff_ms_works=yes
117935525df4Smrg    else
118035525df4Smrg        groff_ms_works=no
118135525df4Smrg    fi
118235525df4Smrg    AC_MSG_RESULT([$groff_ms_works])
118335525df4Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
118435525df4Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
118535525df4Smrg        groff_mm_works=yes
118635525df4Smrg    else
118735525df4Smrg        groff_mm_works=no
118835525df4Smrg    fi
118935525df4Smrg    AC_MSG_RESULT([$groff_mm_works])
1190fdf6a26fSmrgfi
1191fdf6a26fSmrg
119235525df4Smrg# We have groff, test for HTML dependencies, one command per package
119335525df4Smrgif test "x$have_groff" = x"yes"; then
119435525df4Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
119535525df4Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
119635525df4Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
119735525df4Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
119835525df4Smrg      have_groff_html=yes
119935525df4Smrg   else
120035525df4Smrg      have_groff_html=no
120135525df4Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
120235525df4Smrg   fi
12030568f49bSmrgfi
12049e7bcd65Smrg
120535525df4Smrg# Set Automake conditionals for Makefiles
120635525df4SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
120735525df4SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
120835525df4SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
120935525df4SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
121035525df4Smrg]) # XORG_WITH_GROFF
12119e7bcd65Smrg
121235525df4Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
121335525df4Smrg# ---------------------------------------
121435525df4Smrg# Minimum version: 1.6.0
121535525df4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
121635525df4Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1217fdf6a26fSmrg#
121835525df4Smrg# Documentation tools are not always available on all platforms and sometimes
121935525df4Smrg# not at the appropriate level. This macro enables a module to test for the
122035525df4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
122135525df4Smrg# the --with-fop option, it allows maximum flexibility in making decisions
122235525df4Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
122335525df4Smrg# --with-fop assumes 'auto'.
122435525df4Smrg#
122535525df4Smrg# Interface to module:
122635525df4Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
122735525df4Smrg# FOP:	 	returns the path of the fop program found
122835525df4Smrg#		returns the path set by the user in the environment
122935525df4Smrg# --with-fop: 	'yes' user instructs the module to use fop
123035525df4Smrg#		'no' user instructs the module not to use fop
123135525df4Smrg#
123235525df4Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
123335525df4Smrg#
123435525df4SmrgAC_DEFUN([XORG_WITH_FOP],[
123535525df4SmrgAC_ARG_VAR([FOP], [Path to fop command])
123635525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
123735525df4SmrgAC_ARG_WITH(fop,
123835525df4Smrg	AS_HELP_STRING([--with-fop],
123935525df4Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
124035525df4Smrg	   [use_fop=$withval], [use_fop=]_defopt)
124135525df4Smrgm4_undefine([_defopt])
12420568f49bSmrg
124335525df4Smrgif test "x$use_fop" = x"auto"; then
124435525df4Smrg   AC_PATH_PROG([FOP], [fop])
124535525df4Smrg   if test "x$FOP" = "x"; then
124635525df4Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
124735525df4Smrg	have_fop=no
124835525df4Smrg   else
124935525df4Smrg        have_fop=yes
125035525df4Smrg   fi
125135525df4Smrgelif test "x$use_fop" = x"yes" ; then
125235525df4Smrg   AC_PATH_PROG([FOP], [fop])
125335525df4Smrg   if test "x$FOP" = "x"; then
125435525df4Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
125535525df4Smrg   fi
125635525df4Smrg   have_fop=yes
125735525df4Smrgelif test "x$use_fop" = x"no" ; then
125835525df4Smrg   if test "x$FOP" != "x"; then
125935525df4Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
126035525df4Smrg   fi
126135525df4Smrg   have_fop=no
1262fdf6a26fSmrgelse
126335525df4Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1264fdf6a26fSmrgfi
12650568f49bSmrg
126635525df4Smrg# Test for a minimum version of fop, if provided.
126735525df4Smrgm4_ifval([$1],
126835525df4Smrg[if test "$have_fop" = yes; then
126935525df4Smrg    # scrape the fop version
127035525df4Smrg    AC_MSG_CHECKING([for fop minimum version])
127135525df4Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
127235525df4Smrg    AC_MSG_RESULT([$fop_version])
127335525df4Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
127435525df4Smrg        [if test "x$use_fop" = xauto; then
127535525df4Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
127635525df4Smrg            have_fop=no
127735525df4Smrg        else
127835525df4Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
127935525df4Smrg        fi])
128035525df4Smrgfi])
128135525df4SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
128235525df4Smrg]) # XORG_WITH_FOP
1283fdf6a26fSmrg
128435525df4Smrg# XORG_WITH_M4([MIN-VERSION])
128535525df4Smrg# ---------------------------
128635525df4Smrg# Minimum version: 1.19.0
12879e7bcd65Smrg#
128835525df4Smrg# This macro attempts to locate an m4 macro processor which supports
128935525df4Smrg# -I option and is only useful for modules relying on M4 in order to
129035525df4Smrg# expand macros in source code files.
129135525df4Smrg#
129235525df4Smrg# Interface to module:
129335525df4Smrg# M4:	 	returns the path of the m4 program found
129435525df4Smrg#		returns the path set by the user in the environment
129535525df4Smrg#
129635525df4SmrgAC_DEFUN([XORG_WITH_M4], [
129735525df4SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
129835525df4Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
129935525df4Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
130035525df4Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
130135525df4Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
130235525df4Smrg   [$PATH:/usr/gnu/bin])])
13030568f49bSmrg
130435525df4SmrgAC_SUBST([M4], [$ac_cv_path_M4])
130535525df4Smrg]) # XORG_WITH_M4
13060568f49bSmrg
130735525df4Smrg# XORG_WITH_PS2PDF([DEFAULT])
130835525df4Smrg# ----------------
130935525df4Smrg# Minimum version: 1.6.0
131035525df4Smrg# Minimum version for optional DEFAULT argument: 1.11.0
131135525df4Smrg#
131235525df4Smrg# Documentation tools are not always available on all platforms and sometimes
131335525df4Smrg# not at the appropriate level. This macro enables a module to test for the
131435525df4Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
131535525df4Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
131635525df4Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
131735525df4Smrg# --with-ps2pdf assumes 'auto'.
131835525df4Smrg#
131935525df4Smrg# Interface to module:
132035525df4Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
132135525df4Smrg# PS2PDF:	returns the path of the ps2pdf program found
132235525df4Smrg#		returns the path set by the user in the environment
132335525df4Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
132435525df4Smrg#		 'no' user instructs the module not to use ps2pdf
132535525df4Smrg#
132635525df4Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
132735525df4Smrg#
132835525df4SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
132935525df4SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
133035525df4Smrgm4_define([_defopt], m4_default([$1], [auto]))
133135525df4SmrgAC_ARG_WITH(ps2pdf,
133235525df4Smrg	AS_HELP_STRING([--with-ps2pdf],
133335525df4Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
133435525df4Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
133535525df4Smrgm4_undefine([_defopt])
13360568f49bSmrg
133735525df4Smrgif test "x$use_ps2pdf" = x"auto"; then
133835525df4Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
133935525df4Smrg   if test "x$PS2PDF" = "x"; then
134035525df4Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
134135525df4Smrg	have_ps2pdf=no
134235525df4Smrg   else
134335525df4Smrg        have_ps2pdf=yes
134435525df4Smrg   fi
134535525df4Smrgelif test "x$use_ps2pdf" = x"yes" ; then
134635525df4Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
134735525df4Smrg   if test "x$PS2PDF" = "x"; then
134835525df4Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
134935525df4Smrg   fi
135035525df4Smrg   have_ps2pdf=yes
135135525df4Smrgelif test "x$use_ps2pdf" = x"no" ; then
135235525df4Smrg   if test "x$PS2PDF" != "x"; then
135335525df4Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
135435525df4Smrg   fi
135535525df4Smrg   have_ps2pdf=no
13569e7bcd65Smrgelse
135735525df4Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13589e7bcd65Smrgfi
135935525df4SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
136035525df4Smrg]) # XORG_WITH_PS2PDF
13619e7bcd65Smrg
136235525df4Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
136335525df4Smrg# ----------------
136435525df4Smrg# Minimum version: 1.6.0
136535525df4Smrg#
136635525df4Smrg# Documentation tools are not always available on all platforms and sometimes
136735525df4Smrg# not at the appropriate level. This macro enables a builder to skip all
136835525df4Smrg# documentation targets except traditional man pages.
136935525df4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
137035525df4Smrg# maximum flexibility in controlling documentation building.
137135525df4Smrg# Refer to:
137235525df4Smrg# XORG_WITH_XMLTO         --with-xmlto
137335525df4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
137435525df4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
137535525df4Smrg# XORG_WITH_FOP           --with-fop
137635525df4Smrg# XORG_WITH_GROFF         --with-groff
137735525df4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
137835525df4Smrg#
137935525df4Smrg# Interface to module:
138035525df4Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
138135525df4Smrg# --enable-docs: 'yes' user instructs the module to generate docs
138235525df4Smrg#		 'no' user instructs the module not to generate docs
138335525df4Smrg# parm1:	specify the default value, yes or no.
138435525df4Smrg#
138535525df4SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
138635525df4Smrgm4_define([docs_default], m4_default([$1], [yes]))
138735525df4SmrgAC_ARG_ENABLE(docs,
138835525df4Smrg	AS_HELP_STRING([--enable-docs],
138935525df4Smrg	   [Enable building the documentation (default: ]docs_default[)]),
139035525df4Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
139135525df4Smrgm4_undefine([docs_default])
139235525df4SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
139335525df4SmrgAC_MSG_CHECKING([whether to build documentation])
139435525df4SmrgAC_MSG_RESULT([$build_docs])
139535525df4Smrg]) # XORG_ENABLE_DOCS
13960568f49bSmrg
139735525df4Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
139835525df4Smrg# ----------------
139935525df4Smrg# Minimum version: 1.6.0
140035525df4Smrg#
140135525df4Smrg# This macro enables a builder to skip all developer documentation.
140235525df4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
140335525df4Smrg# maximum flexibility in controlling documentation building.
140435525df4Smrg# Refer to:
140535525df4Smrg# XORG_WITH_XMLTO         --with-xmlto
140635525df4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
140735525df4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
140835525df4Smrg# XORG_WITH_FOP           --with-fop
140935525df4Smrg# XORG_WITH_GROFF         --with-groff
141035525df4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
141135525df4Smrg#
141235525df4Smrg# Interface to module:
141335525df4Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
141435525df4Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
141535525df4Smrg#			'no' user instructs the module not to generate developer docs
141635525df4Smrg# parm1:		specify the default value, yes or no.
141735525df4Smrg#
141835525df4SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
141935525df4Smrgm4_define([devel_default], m4_default([$1], [yes]))
142035525df4SmrgAC_ARG_ENABLE(devel-docs,
142135525df4Smrg	AS_HELP_STRING([--enable-devel-docs],
142235525df4Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
142335525df4Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
142435525df4Smrgm4_undefine([devel_default])
142535525df4SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
142635525df4SmrgAC_MSG_CHECKING([whether to build developer documentation])
142735525df4SmrgAC_MSG_RESULT([$build_devel_docs])
142835525df4Smrg]) # XORG_ENABLE_DEVEL_DOCS
1429fdf6a26fSmrg
143035525df4Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
143135525df4Smrg# ----------------
143235525df4Smrg# Minimum version: 1.6.0
143335525df4Smrg#
143435525df4Smrg# This macro enables a builder to skip all functional specification targets.
143535525df4Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
143635525df4Smrg# maximum flexibility in controlling documentation building.
143735525df4Smrg# Refer to:
143835525df4Smrg# XORG_WITH_XMLTO         --with-xmlto
143935525df4Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
144035525df4Smrg# XORG_WITH_DOXYGEN       --with-doxygen
144135525df4Smrg# XORG_WITH_FOP           --with-fop
144235525df4Smrg# XORG_WITH_GROFF         --with-groff
144335525df4Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
144435525df4Smrg#
144535525df4Smrg# Interface to module:
144635525df4Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
144735525df4Smrg# --enable-specs:	'yes' user instructs the module to generate specs
144835525df4Smrg#			'no' user instructs the module not to generate specs
144935525df4Smrg# parm1:		specify the default value, yes or no.
145035525df4Smrg#
145135525df4SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
145235525df4Smrgm4_define([spec_default], m4_default([$1], [yes]))
145335525df4SmrgAC_ARG_ENABLE(specs,
145435525df4Smrg	AS_HELP_STRING([--enable-specs],
145535525df4Smrg	   [Enable building the specs (default: ]spec_default[)]),
145635525df4Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
145735525df4Smrgm4_undefine([spec_default])
145835525df4SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
145935525df4SmrgAC_MSG_CHECKING([whether to build functional specifications])
146035525df4SmrgAC_MSG_RESULT([$build_specs])
146135525df4Smrg]) # XORG_ENABLE_SPECS
1462fdf6a26fSmrg
146335525df4Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
146435525df4Smrg# ----------------------------------------------
146535525df4Smrg# Minimum version: 1.13.0
14660568f49bSmrg#
146735525df4Smrg# This macro enables a builder to enable/disable unit testing
146835525df4Smrg# It makes no assumption about the test cases implementation
146935525df4Smrg# Test cases may or may not use Automake "Support for test suites"
147035525df4Smrg# They may or may not use the software utility library GLib
147135525df4Smrg#
147235525df4Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
147335525df4Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
147435525df4Smrg# The variable enable_unit_tests is used by other macros in this file.
147535525df4Smrg#
147635525df4Smrg# Interface to module:
147735525df4Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
147835525df4Smrg# enable_unit_tests:    used in configure.ac for additional configuration
147935525df4Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
148035525df4Smrg#			'no' user instructs the module not to build tests
148135525df4Smrg# parm1:		specify the default value, yes or no.
148235525df4Smrg#
148335525df4SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
148435525df4SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
148535525df4SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
148635525df4SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
148735525df4Smrgm4_define([_defopt], m4_default([$1], [auto]))
148835525df4SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
148935525df4Smrg	[Enable building unit test cases (default: ]_defopt[)]),
149035525df4Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
149135525df4Smrgm4_undefine([_defopt])
149235525df4SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
149335525df4SmrgAC_MSG_CHECKING([whether to build unit test cases])
149435525df4SmrgAC_MSG_RESULT([$enable_unit_tests])
149535525df4Smrg]) # XORG_ENABLE_UNIT_TESTS
14969e7bcd65Smrg
149735525df4Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
149835525df4Smrg# ------------------------------------------------------
149935525df4Smrg# Minimum version: 1.17.0
150035525df4Smrg#
150135525df4Smrg# This macro enables a builder to enable/disable integration testing
150235525df4Smrg# It makes no assumption about the test cases' implementation
150335525df4Smrg# Test cases may or may not use Automake "Support for test suites"
150435525df4Smrg#
150535525df4Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
150635525df4Smrg# usually requires less dependencies and may be built and run under less
150735525df4Smrg# stringent environments than integration tests.
150835525df4Smrg#
150935525df4Smrg# Interface to module:
151035525df4Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
151135525df4Smrg# enable_integration_tests:   used in configure.ac for additional configuration
151235525df4Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
151335525df4Smrg#                             'no' user instructs the module not to build tests
151435525df4Smrg# parm1:                      specify the default value, yes or no.
151535525df4Smrg#
151635525df4SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
151735525df4SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
151835525df4Smrgm4_define([_defopt], m4_default([$1], [auto]))
151935525df4SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
152035525df4Smrg	[Enable building integration test cases (default: ]_defopt[)]),
152135525df4Smrg	[enable_integration_tests=$enableval],
152235525df4Smrg	[enable_integration_tests=]_defopt)
152335525df4Smrgm4_undefine([_defopt])
152435525df4SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
152535525df4Smrg	[test "x$enable_integration_tests" != xno])
152635525df4SmrgAC_MSG_CHECKING([whether to build unit test cases])
152735525df4SmrgAC_MSG_RESULT([$enable_integration_tests])
152835525df4Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
15290568f49bSmrg
153035525df4Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
153135525df4Smrg# ----------------------------------------
153235525df4Smrg# Minimum version: 1.13.0
153335525df4Smrg#
153435525df4Smrg# GLib is a library which provides advanced data structures and functions.
153535525df4Smrg# This macro enables a module to test for the presence of Glib.
153635525df4Smrg#
153735525df4Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
153835525df4Smrg# Otherwise the value of $enable_unit_tests is blank.
153935525df4Smrg#
154035525df4Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
154135525df4Smrg# test support usually requires less dependencies and may be built and run under
154235525df4Smrg# less stringent environments than integration tests.
154335525df4Smrg#
154435525df4Smrg# Interface to module:
154535525df4Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
154635525df4Smrg# with_glib: used in configure.ac to know if GLib has been found
154735525df4Smrg# --with-glib:	'yes' user instructs the module to use glib
154835525df4Smrg#		'no' user instructs the module not to use glib
154935525df4Smrg#
155035525df4SmrgAC_DEFUN([XORG_WITH_GLIB],[
155135525df4SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
155235525df4Smrgm4_define([_defopt], m4_default([$2], [auto]))
155335525df4SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
155435525df4Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
155535525df4Smrg	[with_glib=$withval], [with_glib=]_defopt)
155635525df4Smrgm4_undefine([_defopt])
15570568f49bSmrg
155835525df4Smrghave_glib=no
155935525df4Smrg# Do not probe GLib if user explicitly disabled unit testing
156035525df4Smrgif test "x$enable_unit_tests" != x"no"; then
156135525df4Smrg  # Do not probe GLib if user explicitly disabled it
156235525df4Smrg  if test "x$with_glib" != x"no"; then
156335525df4Smrg    m4_ifval(
156435525df4Smrg      [$1],
156535525df4Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
156635525df4Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
156735525df4Smrg    )
156835525df4Smrg  fi
1569fdf6a26fSmrgfi
15700568f49bSmrg
157135525df4Smrg# Not having GLib when unit testing has been explicitly requested is an error
157235525df4Smrgif test "x$enable_unit_tests" = x"yes"; then
157335525df4Smrg  if test "x$have_glib" = x"no"; then
157435525df4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
157535525df4Smrg  fi
1576fdf6a26fSmrgfi
15770568f49bSmrg
157835525df4Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
157935525df4Smrgif test "x$enable_unit_tests" = x"no"; then
158035525df4Smrg  if test "x$with_glib" = x"yes"; then
158135525df4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
158235525df4Smrg  fi
15839e7bcd65Smrgfi
15849e7bcd65Smrg
158535525df4Smrg# Not having GLib when it has been explicitly requested is an error
158635525df4Smrgif test "x$with_glib" = x"yes"; then
158735525df4Smrg  if test "x$have_glib" = x"no"; then
158835525df4Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
158935525df4Smrg  fi
1590fdf6a26fSmrgfi
1591fdf6a26fSmrg
159235525df4SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
159335525df4Smrg]) # XORG_WITH_GLIB
1594fdf6a26fSmrg
159535525df4Smrg# XORG_LD_WRAP([required|optional])
159635525df4Smrg# ---------------------------------
159735525df4Smrg# Minimum version: 1.13.0
15989e7bcd65Smrg#
159935525df4Smrg# Check if linker supports -wrap, passed via compiler flags
1600fdf6a26fSmrg#
160135525df4Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
160235525df4Smrg# Otherwise the value of $enable_unit_tests is blank.
1603fdf6a26fSmrg#
160435525df4Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
160535525df4Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
160635525df4Smrg# available, an argument of "optional" allows use when some unit tests require
160735525df4Smrg# ld -wrap and others do not.
1608fdf6a26fSmrg#
160935525df4SmrgAC_DEFUN([XORG_LD_WRAP],[
161035525df4SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
161135525df4Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
161235525df4Smrg                      void __wrap_exit(int status) { return; }],
161335525df4Smrg                     [exit(0);])])
161435525df4Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
161535525df4Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
161635525df4Smrg  if test "x$have_ld_wrap" = x"no"; then
161735525df4Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
161835525df4Smrg  fi
1619fdf6a26fSmrgfi
162035525df4SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16219e7bcd65Smrg#
162235525df4Smrg]) # XORG_LD_WRAP
1623fdf6a26fSmrg
162435525df4Smrg# XORG_CHECK_LINKER_FLAGS
162535525df4Smrg# -----------------------
162635525df4Smrg# SYNOPSIS
1627fdf6a26fSmrg#
162835525df4Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16299e7bcd65Smrg#
163035525df4Smrg# DESCRIPTION
16319e7bcd65Smrg#
163235525df4Smrg#   Check whether the given linker FLAGS work with the current language's
163335525df4Smrg#   linker, or whether they give an error.
16349e7bcd65Smrg#
163535525df4Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
163635525df4Smrg#   success/failure.
163735525df4Smrg#
163835525df4Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
163935525df4Smrg#
164035525df4Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
164135525df4Smrg#
164235525df4Smrg# LICENSE
164335525df4Smrg#
164435525df4Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
164535525df4Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
164635525df4Smrg#   Copyright (c) 2009 Matteo Frigo
164735525df4Smrg#
164835525df4Smrg#   This program is free software: you can redistribute it and/or modify it
164935525df4Smrg#   under the terms of the GNU General Public License as published by the
165035525df4Smrg#   Free Software Foundation, either version 3 of the License, or (at your
165135525df4Smrg#   option) any later version.
165235525df4Smrg#
165335525df4Smrg#   This program is distributed in the hope that it will be useful, but
165435525df4Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
165535525df4Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
165635525df4Smrg#   Public License for more details.
165735525df4Smrg#
165835525df4Smrg#   You should have received a copy of the GNU General Public License along
165935525df4Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
166035525df4Smrg#
166135525df4Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
166235525df4Smrg#   gives unlimited permission to copy, distribute and modify the configure
166335525df4Smrg#   scripts that are the output of Autoconf when processing the Macro. You
166435525df4Smrg#   need not follow the terms of the GNU General Public License when using
166535525df4Smrg#   or distributing such scripts, even though portions of the text of the
166635525df4Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
166735525df4Smrg#   all other use of the material that constitutes the Autoconf Macro.
166835525df4Smrg#
166935525df4Smrg#   This special exception to the GPL applies to versions of the Autoconf
167035525df4Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
167135525df4Smrg#   modified version of the Autoconf Macro, you may extend this special
167235525df4Smrg#   exception to the GPL to apply to your modified version as well.#
167335525df4SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
167435525df4Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
167535525df4Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
167635525df4SmrgAS_LITERAL_IF([$1],
167735525df4Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
167835525df4Smrg      ax_save_FLAGS=$LDFLAGS
167935525df4Smrg      LDFLAGS="$1"
168035525df4Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
168135525df4Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
168235525df4Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
168335525df4Smrg      LDFLAGS=$ax_save_FLAGS])],
168435525df4Smrg  [ax_save_FLAGS=$LDFLAGS
168535525df4Smrg   LDFLAGS="$1"
168635525df4Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
168735525df4Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
168835525df4Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
168935525df4Smrg   LDFLAGS=$ax_save_FLAGS])
169035525df4Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
169135525df4SmrgAC_MSG_RESULT($xorg_check_linker_flags)
169235525df4Smrgif test "x$xorg_check_linker_flags" = xyes; then
169335525df4Smrg	m4_default([$2], :)
1694fdf6a26fSmrgelse
169535525df4Smrg	m4_default([$3], :)
1696fdf6a26fSmrgfi
169735525df4Smrg]) # XORG_CHECK_LINKER_FLAGS
16989e7bcd65Smrg
169935525df4Smrg# XORG_MEMORY_CHECK_FLAGS
170035525df4Smrg# -----------------------
170135525df4Smrg# Minimum version: 1.16.0
1702fdf6a26fSmrg#
170335525df4Smrg# This macro attempts to find appropriate memory checking functionality
170435525df4Smrg# for various platforms which unit testing code may use to catch various
170535525df4Smrg# forms of memory allocation and access errors in testing.
1706fdf6a26fSmrg#
1707fdf6a26fSmrg# Interface to module:
170835525df4Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
170935525df4Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
1710fdf6a26fSmrg#
171135525df4Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
1712fdf6a26fSmrg#
171335525df4SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17149e7bcd65Smrg
171535525df4SmrgAC_REQUIRE([AC_CANONICAL_HOST])
171635525df4SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
171735525df4Smrg           [Environment variables to enable memory checking in tests])
171835525df4Smrg
171935525df4Smrg# Check for different types of support on different platforms
172035525df4Smrgcase $host_os in
172135525df4Smrg    solaris*)
172235525df4Smrg        AC_CHECK_LIB([umem], [umem_alloc],
172335525df4Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
172435525df4Smrg        ;;
172535525df4Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
172635525df4Smrg        # both directly and inverted, so should not be 0 or 255.
172735525df4Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
172835525df4Smrg        ;;
172935525df4Smrg    darwin*)
173035525df4Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
173135525df4Smrg        ;;
173235525df4Smrg    *bsd*)
173335525df4Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
173435525df4Smrg        ;;
173535525df4Smrgesac
173635525df4Smrg
173735525df4Smrg# User supplied flags override default flags
173835525df4Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
173935525df4Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1740fdf6a26fSmrgfi
17419e7bcd65Smrg
174235525df4SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
174335525df4Smrg]) # XORG_WITH_LINT
17449e7bcd65Smrg
174535525df4Smrg# XORG_CHECK_MALLOC_ZERO
174635525df4Smrg# ----------------------
174735525df4Smrg# Minimum version: 1.0.0
1748339a7c43Smrg#
174935525df4Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
175035525df4Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
175135525df4Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17520568f49bSmrg#
175335525df4Smrg# No longer actually tests since there is no guarantee applications will
175435525df4Smrg# run with the same malloc implementation we tested against, and the cost
175535525df4Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
175635525df4Smrg# Still allows builders to override when they have complete control over
175735525df4Smrg# which malloc implementation will be used.
175835525df4SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
175935525df4SmrgAC_ARG_ENABLE(malloc0returnsnull,
176035525df4Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
176135525df4Smrg		       [assume malloc(0) can return NULL (default: yes)]),
176235525df4Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
176335525df4Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
1764339a7c43Smrg
176535525df4SmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
176635525df4SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
176735525df4Smrg
176835525df4Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
176935525df4Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
177035525df4Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
177135525df4Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1772fdf6a26fSmrgelse
177335525df4Smrg	MALLOC_ZERO_CFLAGS=""
177435525df4Smrg	XMALLOC_ZERO_CFLAGS=""
177535525df4Smrg	XTMALLOC_ZERO_CFLAGS=""
1776fdf6a26fSmrgfi
17770568f49bSmrg
177835525df4SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
177935525df4SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
178035525df4SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
178135525df4Smrg]) # XORG_CHECK_MALLOC_ZERO
178235525df4Smrg
178335525df4Smrg# XORG_WITH_LINT()
178435525df4Smrg# ----------------
178535525df4Smrg# Minimum version: 1.1.0
1786fdf6a26fSmrg#
178735525df4Smrg# This macro enables the use of a tool that flags some suspicious and
178835525df4Smrg# non-portable constructs (likely to be bugs) in C language source code.
178935525df4Smrg# It will attempt to locate the tool and use appropriate options.
179035525df4Smrg# There are various lint type tools on different platforms.
1791fdf6a26fSmrg#
1792fdf6a26fSmrg# Interface to module:
179335525df4Smrg# LINT:		returns the path to the tool found on the platform
179435525df4Smrg#		or the value set to LINT on the configure cmd line
179535525df4Smrg#		also an Automake conditional
179635525df4Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17979e7bcd65Smrg#
179835525df4Smrg# --with-lint:	'yes' user instructs the module to use lint
179935525df4Smrg#		'no' user instructs the module not to use lint (default)
1800fdf6a26fSmrg#
180135525df4Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
180235525df4Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
180335525df4Smrg#
180435525df4SmrgAC_DEFUN([XORG_WITH_LINT],[
180535525df4Smrg
180635525df4SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
180735525df4SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
180835525df4SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
180935525df4Smrg		[Use a lint-style source code checker (default: disabled)])],
181035525df4Smrg		[use_lint=$withval], [use_lint=no])
181135525df4Smrg
181235525df4Smrg# Obtain platform specific info like program name and options
181335525df4Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
181435525df4Smrgcase $host_os in
181535525df4Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
181635525df4Smrg	lint_name=splint
181735525df4Smrg	lint_options="-badflag"
181835525df4Smrg	;;
181935525df4Smrg  *freebsd* | *netbsd*)
182035525df4Smrg	lint_name=lint
182135525df4Smrg	lint_options="-u -b"
182235525df4Smrg	;;
182335525df4Smrg  *solaris*)
182435525df4Smrg	lint_name=lint
182535525df4Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
182635525df4Smrg	;;
182735525df4Smrgesac
18280568f49bSmrg
182935525df4Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
183035525df4Smrgif test "x$use_lint" = x"yes" ; then
183135525df4Smrg   AC_PATH_PROG([LINT], [$lint_name])
183235525df4Smrg   if test "x$LINT" = "x"; then
183335525df4Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1834fdf6a26fSmrg   fi
183535525df4Smrgelif test "x$use_lint" = x"no" ; then
183635525df4Smrg   if test "x$LINT" != "x"; then
183735525df4Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1838fdf6a26fSmrg   fi
18390568f49bSmrgelse
184035525df4Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18410568f49bSmrgfi
18420568f49bSmrg
184335525df4Smrg# User supplied flags override default flags
184435525df4Smrgif test "x$LINT_FLAGS" != "x"; then
184535525df4Smrg   lint_options=$LINT_FLAGS
1846fdf6a26fSmrgfi
18470568f49bSmrg
184835525df4SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
184935525df4SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
18500568f49bSmrg
185135525df4Smrg]) # XORG_WITH_LINT
185235525df4Smrg
185335525df4Smrg# XORG_LINT_LIBRARY(LIBNAME)
185435525df4Smrg# --------------------------
185535525df4Smrg# Minimum version: 1.1.0
18569e7bcd65Smrg#
185735525df4Smrg# Sets up flags for building lint libraries for checking programs that call
185835525df4Smrg# functions in the library.
1859fdf6a26fSmrg#
1860fdf6a26fSmrg# Interface to module:
186135525df4Smrg# LINTLIB		- Automake variable with the name of lint library file to make
186235525df4Smrg# MAKE_LINT_LIB		- Automake conditional
1863fdf6a26fSmrg#
186435525df4Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
186535525df4Smrg#			  - 'no' user instructs the module not to create a lint library (default)
186635525df4Smrg
186735525df4SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
186835525df4SmrgAC_REQUIRE([XORG_WITH_LINT])
186935525df4SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
187035525df4Smrg	[Create lint library (default: disabled)])],
187135525df4Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
187235525df4Smrg
187335525df4Smrgif test "x$make_lint_lib" = x"yes" ; then
187435525df4Smrg   LINTLIB=llib-l$1.ln
187535525df4Smrg   if test "x$LINT" = "x"; then
187635525df4Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
187735525df4Smrg   fi
187835525df4Smrgelif test "x$make_lint_lib" != x"no" ; then
187935525df4Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
188035525df4Smrgfi
188135525df4Smrg
188235525df4SmrgAC_SUBST(LINTLIB)
188335525df4SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
188435525df4Smrg
188535525df4Smrg]) # XORG_LINT_LIBRARY
188635525df4Smrg
188735525df4Smrg# XORG_COMPILER_BRAND
188835525df4Smrg# -------------------
188935525df4Smrg# Minimum version: 1.14.0
1890fdf6a26fSmrg#
189135525df4Smrg# Checks for various brands of compilers and sets flags as appropriate:
189235525df4Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
189335525df4Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
189435525df4Smrg#   clang compiler - sets CLANGCC to "yes"
189535525df4Smrg#   Intel compiler - sets INTELCC to "yes"
189635525df4Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1897fdf6a26fSmrg#
189835525df4SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
189935525df4SmrgAC_LANG_CASE(
190035525df4Smrg	[C], [
190135525df4Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
190235525df4Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
190335525df4Smrg		m4_version_prereq([2.70],
190435525df4Smrg			[AC_REQUIRE([AC_PROG_CC])],
190535525df4Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
190635525df4Smrg	],
190735525df4Smrg	[C++], [
190835525df4Smrg		AC_REQUIRE([AC_PROG_CXX])
190935525df4Smrg	]
191035525df4Smrg)
191135525df4SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
191235525df4SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
191335525df4SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
191435525df4Smrg]) # XORG_COMPILER_BRAND
191535525df4Smrg
191635525df4Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
191735525df4Smrg# ---------------
191835525df4Smrg# Minimum version: 1.16.0
1919fdf6a26fSmrg#
192035525df4Smrg# Test if the compiler works when passed the given flag as a command line argument.
192135525df4Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
192235525df4Smrg# next flag in the list until there are no more options.
1923fdf6a26fSmrg#
192435525df4Smrg# Note that this does not guarantee that the compiler supports the flag as some
192535525df4Smrg# compilers will simply ignore arguments that they do not understand, but we do
192635525df4Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
192735525df4Smrg# -Werror=unused-command-line-argument
192835525df4Smrg#
192935525df4SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
193035525df4Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
193135525df4Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19320568f49bSmrg
193335525df4SmrgAC_LANG_COMPILER_REQUIRE
193435525df4Smrg
193535525df4SmrgAC_LANG_CASE(
193635525df4Smrg	[C], [
193735525df4Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
193835525df4Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
193935525df4Smrg		m4_version_prereq([2.70],
194035525df4Smrg			[AC_REQUIRE([AC_PROG_CC])],
194135525df4Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
194235525df4Smrg		define([PREFIX], [C])
194335525df4Smrg		define([CACHE_PREFIX], [cc])
194435525df4Smrg		define([COMPILER], [$CC])
194535525df4Smrg	],
194635525df4Smrg	[C++], [
194735525df4Smrg		define([PREFIX], [CXX])
194835525df4Smrg		define([CACHE_PREFIX], [cxx])
194935525df4Smrg		define([COMPILER], [$CXX])
195035525df4Smrg	]
195135525df4Smrg)
195235525df4Smrg
195335525df4Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
195435525df4Smrg
195535525df4Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
195635525df4Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
195735525df4Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
195835525df4Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
195935525df4Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
196035525df4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
196135525df4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
196235525df4Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
196335525df4Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19649e7bcd65Smrgfi
1965444c061aSmrg
196635525df4Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
196735525df4Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
196835525df4Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
196935525df4Smrg	fi
197035525df4Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
197135525df4Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
197235525df4Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
197335525df4Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
197435525df4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
197535525df4Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
197635525df4Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
197735525df4Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1978fdf6a26fSmrgfi
19791477040fSmrg
198035525df4Smrgfound="no"
198135525df4Smrgm4_foreach([flag], m4_cdr($@), [
198235525df4Smrg	if test $found = "no" ; then
198335525df4Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
198435525df4Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
198535525df4Smrg		fi
1986444c061aSmrg
198735525df4Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
198835525df4Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
198935525df4Smrg		fi
1990444c061aSmrg
199135525df4Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
199235525df4Smrg
199335525df4Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
199435525df4Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
199535525df4Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
199635525df4Smrg		AC_CACHE_VAL($cacheid,
199735525df4Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
199835525df4Smrg					     [eval $cacheid=yes],
199935525df4Smrg					     [eval $cacheid=no])])
200035525df4Smrg
200135525df4Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
200235525df4Smrg
200335525df4Smrg		eval supported=\$$cacheid
200435525df4Smrg		AC_MSG_RESULT([$supported])
200535525df4Smrg		if test "$supported" = "yes" ; then
200635525df4Smrg			$1="$$1 ]flag["
200735525df4Smrg			found="yes"
200835525df4Smrg		fi
200935525df4Smrg	fi
201035525df4Smrg])
201135525df4Smrg]) # XORG_TESTSET_CFLAG
201235525df4Smrg
201335525df4Smrg# XORG_COMPILER_FLAGS
201435525df4Smrg# ---------------
201535525df4Smrg# Minimum version: 1.16.0
2016fdf6a26fSmrg#
201735525df4Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
201835525df4Smrg# arguments supported by the selected compiler which do NOT alter the generated
201935525df4Smrg# code.  These arguments will cause the compiler to print various warnings
202035525df4Smrg# during compilation AND turn a conservative set of warnings into errors.
2021fdf6a26fSmrg#
202235525df4Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
202335525df4Smrg# future versions of util-macros as options are added to new compilers.
2024fdf6a26fSmrg#
202535525df4SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
202635525df4SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2027fdf6a26fSmrg
202835525df4SmrgAC_ARG_ENABLE(selective-werror,
202935525df4Smrg              AS_HELP_STRING([--disable-selective-werror],
203035525df4Smrg                             [Turn off selective compiler errors. (default: enabled)]),
203135525df4Smrg              [SELECTIVE_WERROR=$enableval],
203235525df4Smrg              [SELECTIVE_WERROR=yes])
203335525df4Smrg
203435525df4SmrgAC_LANG_CASE(
203535525df4Smrg        [C], [
203635525df4Smrg                define([PREFIX], [C])
203735525df4Smrg        ],
203835525df4Smrg        [C++], [
203935525df4Smrg                define([PREFIX], [CXX])
204035525df4Smrg        ]
204135525df4Smrg)
204235525df4Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
204335525df4Smrgif test "x$SUNCC" = "xyes"; then
204435525df4Smrg    [BASE_]PREFIX[FLAGS]="-v"
2045fdf6a26fSmrgelse
204635525df4Smrg    [BASE_]PREFIX[FLAGS]=""
20470568f49bSmrgfi
20489e7bcd65Smrg
204935525df4Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
205035525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
205135525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
205235525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
205335525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20549e7bcd65Smrg
205535525df4SmrgAC_LANG_CASE(
205635525df4Smrg	[C], [
205735525df4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
205835525df4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
205935525df4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
206035525df4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
206135525df4Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
206235525df4Smrg	]
206335525df4Smrg)
20640568f49bSmrg
206535525df4Smrg# This chunk adds additional warnings that could catch undesired effects.
206635525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
206735525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
206835525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
206935525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
207035525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
207135525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
207235525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2073fdf6a26fSmrg
207435525df4Smrg# These are currently disabled because they are noisy.  They will be enabled
207535525df4Smrg# in the future once the codebase is sufficiently modernized to silence
207635525df4Smrg# them.  For now, I don't want them to drown out the other warnings.
207735525df4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
207835525df4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
207935525df4Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
208035525df4Smrg
208135525df4Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
208235525df4Smrg# when there are problems that should be fixed.
208335525df4Smrg
208435525df4Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
208535525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
208635525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
208735525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
208835525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
208935525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
209035525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
209135525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
209235525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
209335525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
209435525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
209535525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
209635525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
209735525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
209835525df4Smrgelse
209935525df4SmrgAC_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])
210035525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
210135525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
210235525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
210335525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
210435525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
210535525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
210635525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
210735525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
210835525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
210935525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
211035525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
211135525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
211235525df4SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
211335525df4Smrgfi
211435525df4Smrg
211535525df4SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
211635525df4Smrg]) # XORG_COMPILER_FLAGS
211735525df4Smrg
211835525df4Smrg# XORG_CWARNFLAGS
211935525df4Smrg# ---------------
212035525df4Smrg# Minimum version: 1.2.0
212135525df4Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2122fdf6a26fSmrg#
212335525df4Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2124fdf6a26fSmrg#
212535525df4Smrg# This function is deprecated because it defines -fno-strict-aliasing
212635525df4Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
212735525df4Smrg# is needed, then it should be added explicitly in the module when
212835525df4Smrg# it is updated to use BASE_CFLAGS.
212935525df4Smrg#
213035525df4SmrgAC_DEFUN([XORG_CWARNFLAGS], [
213135525df4SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
213235525df4SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
213335525df4SmrgAC_LANG_CASE(
213435525df4Smrg	[C], [
213535525df4Smrg		CWARNFLAGS="$BASE_CFLAGS"
213635525df4Smrg		if  test "x$GCC" = xyes ; then
213735525df4Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
213835525df4Smrg		fi
213935525df4Smrg		AC_SUBST(CWARNFLAGS)
214035525df4Smrg	]
214135525df4Smrg)
214235525df4Smrg]) # XORG_CWARNFLAGS
214335525df4Smrg
214435525df4Smrg# XORG_STRICT_OPTION
214535525df4Smrg# -----------------------
214635525df4Smrg# Minimum version: 1.3.0
2147fdf6a26fSmrg#
214835525df4Smrg# Add configure option to enable strict compilation flags, such as treating
214935525df4Smrg# warnings as fatal errors.
215035525df4Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
215135525df4Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2152fdf6a26fSmrg#
215335525df4Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
215435525df4Smrg# when strict compilation is unconditionally desired.
215535525df4SmrgAC_DEFUN([XORG_STRICT_OPTION], [
215635525df4SmrgAC_REQUIRE([XORG_CWARNFLAGS])
215735525df4SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21580568f49bSmrg
215935525df4SmrgAC_ARG_ENABLE(strict-compilation,
216035525df4Smrg			  AS_HELP_STRING([--enable-strict-compilation],
216135525df4Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
216235525df4Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
216335525df4Smrg
216435525df4SmrgAC_LANG_CASE(
216535525df4Smrg        [C], [
216635525df4Smrg                define([PREFIX], [C])
216735525df4Smrg        ],
216835525df4Smrg        [C++], [
216935525df4Smrg                define([PREFIX], [CXX])
217035525df4Smrg        ]
217135525df4Smrg)
217235525df4Smrg
217335525df4Smrg[STRICT_]PREFIX[FLAGS]=""
217435525df4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
217535525df4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
217635525df4Smrg
217735525df4Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
217835525df4Smrg# activate it with -Werror, so we add it here explicitly.
217935525df4SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
218035525df4Smrg
218135525df4Smrgif test "x$STRICT_COMPILE" = "xyes"; then
218235525df4Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
218335525df4Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2184fdf6a26fSmrgfi
218535525df4SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
218635525df4SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
218735525df4SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
218835525df4Smrg]) # XORG_STRICT_OPTION
21890568f49bSmrg
219035525df4Smrg# XORG_DEFAULT_NOCODE_OPTIONS
219135525df4Smrg# ---------------------------
219235525df4Smrg# Minimum version: 1.20.0
2193fdf6a26fSmrg#
219435525df4Smrg# Defines default options for X.Org modules which don't compile code,
219535525df4Smrg# such as fonts, bitmaps, cursors, and docs.
2196fdf6a26fSmrg#
219735525df4SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
219835525df4SmrgAC_REQUIRE([AC_PROG_INSTALL])
219935525df4SmrgXORG_RELEASE_VERSION
220035525df4SmrgXORG_CHANGELOG
220135525df4SmrgXORG_INSTALL
220235525df4SmrgXORG_MANPAGE_SECTIONS
220335525df4Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
220435525df4Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
220535525df4Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
22060568f49bSmrg
220735525df4Smrg# XORG_DEFAULT_OPTIONS
220835525df4Smrg# --------------------
220935525df4Smrg# Minimum version: 1.3.0
2210fdf6a26fSmrg#
221135525df4Smrg# Defines default options for X.Org modules which compile code.
2212fdf6a26fSmrg#
221335525df4SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
221435525df4SmrgAC_REQUIRE([AC_PROG_INSTALL])
221535525df4SmrgXORG_COMPILER_FLAGS
221635525df4SmrgXORG_CWARNFLAGS
221735525df4SmrgXORG_STRICT_OPTION
221835525df4SmrgXORG_DEFAULT_NOCODE_OPTIONS
221935525df4Smrg]) # XORG_DEFAULT_OPTIONS
22200568f49bSmrg
222135525df4Smrg# XORG_INSTALL()
2222fdf6a26fSmrg# ----------------
222335525df4Smrg# Minimum version: 1.4.0
2224fdf6a26fSmrg#
222535525df4Smrg# Defines the variable INSTALL_CMD as the command to copy
222635525df4Smrg# INSTALL from $prefix/share/util-macros.
2227fdf6a26fSmrg#
222835525df4SmrgAC_DEFUN([XORG_INSTALL], [
222935525df4SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
223035525df4Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
223135525df4SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
223235525df4Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
223335525df4Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
223435525df4Smrgtouch \$(top_srcdir)/INSTALL; \
223535525df4Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
223635525df4SmrgAC_SUBST([INSTALL_CMD])
223735525df4Smrg]) # XORG_INSTALL
223835525df4Smrgdnl Copyright 2005 Red Hat, Inc
223935525df4Smrgdnl
224035525df4Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
224135525df4Smrgdnl documentation for any purpose is hereby granted without fee, provided that
224235525df4Smrgdnl the above copyright notice appear in all copies and that both that
224335525df4Smrgdnl copyright notice and this permission notice appear in supporting
224435525df4Smrgdnl documentation.
224535525df4Smrgdnl
224635525df4Smrgdnl The above copyright notice and this permission notice shall be included
224735525df4Smrgdnl in all copies or substantial portions of the Software.
224835525df4Smrgdnl
224935525df4Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
225035525df4Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
225135525df4Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
225235525df4Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
225335525df4Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
225435525df4Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
225535525df4Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
225635525df4Smrgdnl
225735525df4Smrgdnl Except as contained in this notice, the name of the copyright holders shall
225835525df4Smrgdnl not be used in advertising or otherwise to promote the sale, use or
225935525df4Smrgdnl other dealings in this Software without prior written authorization
226035525df4Smrgdnl from the copyright holders.
226135525df4Smrgdnl
226235525df4Smrg
226335525df4Smrg# XORG_RELEASE_VERSION
226435525df4Smrg# --------------------
226535525df4Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
226635525df4Smrg
226735525df4SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
226835525df4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
226935525df4Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
227035525df4Smrg		[Major version of this package])
227135525df4Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
227235525df4Smrg	if test "x$PVM" = "x"; then
227335525df4Smrg		PVM="0"
227435525df4Smrg	fi
227535525df4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
227635525df4Smrg		[$PVM],
227735525df4Smrg		[Minor version of this package])
227835525df4Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
227935525df4Smrg	if test "x$PVP" = "x"; then
228035525df4Smrg		PVP="0"
228135525df4Smrg	fi
228235525df4Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
228335525df4Smrg		[$PVP],
228435525df4Smrg		[Patch version of this package])
228535525df4Smrg])
22869e7bcd65Smrg
228735525df4Smrg# XORG_CHANGELOG()
228835525df4Smrg# ----------------
228935525df4Smrg# Minimum version: 1.2.0
2290fdf6a26fSmrg#
229135525df4Smrg# Defines the variable CHANGELOG_CMD as the command to generate
229235525df4Smrg# ChangeLog from git.
2293fdf6a26fSmrg#
2294fdf6a26fSmrg#
229535525df4SmrgAC_DEFUN([XORG_CHANGELOG], [
229635525df4SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
229735525df4Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
229835525df4Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
229935525df4Smrgtouch \$(top_srcdir)/ChangeLog; \
230035525df4Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
230135525df4SmrgAC_SUBST([CHANGELOG_CMD])
230235525df4Smrg]) # XORG_CHANGELOG
230335525df4Smrg
230435525df4Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2305fdf6a26fSmrg#
230635525df4Smrg# This file is free software; the Free Software Foundation
230735525df4Smrg# gives unlimited permission to copy and/or distribute it,
230835525df4Smrg# with or without modifications, as long as this notice is preserved.
2309444c061aSmrg
231035525df4Smrg# AM_AUTOMAKE_VERSION(VERSION)
231135525df4Smrg# ----------------------------
231235525df4Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
231335525df4Smrg# generated from the m4 files accompanying Automake X.Y.
231435525df4Smrg# (This private macro should not be called outside this file.)
231535525df4SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
231635525df4Smrg[am__api_version='1.16'
231735525df4Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
231835525df4Smrgdnl require some minimum version.  Point them to the right macro.
231935525df4Smrgm4_if([$1], [1.16.5], [],
232035525df4Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
232135525df4Smrg])
232235525df4Smrg
232335525df4Smrg# _AM_AUTOCONF_VERSION(VERSION)
232435525df4Smrg# -----------------------------
232535525df4Smrg# aclocal traces this macro to find the Autoconf version.
232635525df4Smrg# This is a private macro too.  Using m4_define simplifies
232735525df4Smrg# the logic in aclocal, which can simply ignore this definition.
232835525df4Smrgm4_define([_AM_AUTOCONF_VERSION], [])
232935525df4Smrg
233035525df4Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
233135525df4Smrg# -------------------------------
233235525df4Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
233335525df4Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
233435525df4SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
233535525df4Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
233635525df4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
233735525df4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
233835525df4Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
233935525df4Smrg
234035525df4Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
234135525df4Smrg
234235525df4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2343fdf6a26fSmrg#
234435525df4Smrg# This file is free software; the Free Software Foundation
234535525df4Smrg# gives unlimited permission to copy and/or distribute it,
234635525df4Smrg# with or without modifications, as long as this notice is preserved.
234735525df4Smrg
234835525df4Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
234935525df4Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
235035525df4Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2351fdf6a26fSmrg#
235235525df4Smrg# Of course, Automake must honor this variable whenever it calls a
235335525df4Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
235435525df4Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
235535525df4Smrg# depending on how configure is run.  This is pretty annoying, since
235635525df4Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
235735525df4Smrg# source directory, any form will work fine, but in subdirectories a
235835525df4Smrg# relative path needs to be adjusted first.
2359fdf6a26fSmrg#
236035525df4Smrg# $ac_aux_dir/missing
236135525df4Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
236235525df4Smrg# $top_srcdir/$ac_aux_dir/missing
236335525df4Smrg#    fails if $ac_aux_dir is absolute,
236435525df4Smrg#    fails when called from a subdirectory in a VPATH build with
236535525df4Smrg#          a relative $ac_aux_dir
2366fdf6a26fSmrg#
236735525df4Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
236835525df4Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
236935525df4Smrg# harmless because $srcdir is '.', but things will broke when you
237035525df4Smrg# start a VPATH build or use an absolute $srcdir.
2371fdf6a26fSmrg#
237235525df4Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
237335525df4Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
237435525df4Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
237535525df4Smrg# and then we would define $MISSING as
237635525df4Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
237735525df4Smrg# This will work as long as MISSING is not called from configure, because
237835525df4Smrg# unfortunately $(top_srcdir) has no meaning in configure.
237935525df4Smrg# However there are other variables, like CC, which are often used in
238035525df4Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2381fdf6a26fSmrg#
238235525df4Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
238335525df4Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
238435525df4Smrg# configured tree to be moved without reconfiguration.
238535525df4Smrg
238635525df4SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
238735525df4Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
238835525df4Smrg# Expand $ac_aux_dir to an absolute path.
238935525df4Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
239035525df4Smrg])
239135525df4Smrg
239235525df4Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
239335525df4Smrg
239435525df4Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
2395fdf6a26fSmrg#
239635525df4Smrg# This file is free software; the Free Software Foundation
239735525df4Smrg# gives unlimited permission to copy and/or distribute it,
239835525df4Smrg# with or without modifications, as long as this notice is preserved.
239935525df4Smrg
240035525df4Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
240135525df4Smrg# -------------------------------------
240235525df4Smrg# Define a conditional.
240335525df4SmrgAC_DEFUN([AM_CONDITIONAL],
240435525df4Smrg[AC_PREREQ([2.52])dnl
240535525df4Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
240635525df4Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
240735525df4SmrgAC_SUBST([$1_TRUE])dnl
240835525df4SmrgAC_SUBST([$1_FALSE])dnl
240935525df4Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
241035525df4Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
241135525df4Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
241235525df4Smrgif $2; then
241335525df4Smrg  $1_TRUE=
241435525df4Smrg  $1_FALSE='#'
241535525df4Smrgelse
241635525df4Smrg  $1_TRUE='#'
241735525df4Smrg  $1_FALSE=
241835525df4Smrgfi
241935525df4SmrgAC_CONFIG_COMMANDS_PRE(
242035525df4Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
242135525df4Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
242235525df4SmrgUsually this means the macro was only invoked conditionally.]])
242335525df4Smrgfi])])
242435525df4Smrg
242535525df4Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2426fdf6a26fSmrg#
242735525df4Smrg# This file is free software; the Free Software Foundation
242835525df4Smrg# gives unlimited permission to copy and/or distribute it,
242935525df4Smrg# with or without modifications, as long as this notice is preserved.
243035525df4Smrg
243135525df4Smrg
243235525df4Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
243335525df4Smrg# written in clear, in which case automake, when reading aclocal.m4,
243435525df4Smrg# will think it sees a *use*, and therefore will trigger all it's
243535525df4Smrg# C support machinery.  Also note that it means that autoscan, seeing
243635525df4Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
243735525df4Smrg
243835525df4Smrg
243935525df4Smrg# _AM_DEPENDENCIES(NAME)
244035525df4Smrg# ----------------------
244135525df4Smrg# See how the compiler implements dependency checking.
244235525df4Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
244335525df4Smrg# We try a few techniques and use that to set a single cache variable.
2444fdf6a26fSmrg#
244535525df4Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
244635525df4Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
244735525df4Smrg# dependency, and given that the user is not expected to run this macro,
244835525df4Smrg# just rely on AC_PROG_CC.
244935525df4SmrgAC_DEFUN([_AM_DEPENDENCIES],
245035525df4Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
245135525df4SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
245235525df4SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
245335525df4SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
245435525df4Smrg
245535525df4Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
245635525df4Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
245735525df4Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
245835525df4Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
245935525df4Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
246035525df4Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
246135525df4Smrg                    [depcc="$$1"   am_compiler_list=])
246235525df4Smrg
246335525df4SmrgAC_CACHE_CHECK([dependency style of $depcc],
246435525df4Smrg               [am_cv_$1_dependencies_compiler_type],
246535525df4Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
246635525df4Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
246735525df4Smrg  # making bogus files that we don't know about and never remove.  For
246835525df4Smrg  # instance it was reported that on HP-UX the gcc test will end up
246935525df4Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
247035525df4Smrg  # in D".
247135525df4Smrg  rm -rf conftest.dir
247235525df4Smrg  mkdir conftest.dir
247335525df4Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
247435525df4Smrg  # using a relative directory.
247535525df4Smrg  cp "$am_depcomp" conftest.dir
247635525df4Smrg  cd conftest.dir
247735525df4Smrg  # We will build objects and dependencies in a subdirectory because
247835525df4Smrg  # it helps to detect inapplicable dependency modes.  For instance
247935525df4Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
248035525df4Smrg  # side effect of compilation, but ICC will put the dependencies in
248135525df4Smrg  # the current directory while Tru64 will put them in the object
248235525df4Smrg  # directory.
248335525df4Smrg  mkdir sub
2484fdf6a26fSmrg
248535525df4Smrg  am_cv_$1_dependencies_compiler_type=none
248635525df4Smrg  if test "$am_compiler_list" = ""; then
248735525df4Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24889e7bcd65Smrg  fi
248935525df4Smrg  am__universal=false
249035525df4Smrg  m4_case([$1], [CC],
249135525df4Smrg    [case " $depcc " in #(
249235525df4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
249335525df4Smrg     esac],
249435525df4Smrg    [CXX],
249535525df4Smrg    [case " $depcc " in #(
249635525df4Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
249735525df4Smrg     esac])
24982ae83157Smrg
249935525df4Smrg  for depmode in $am_compiler_list; do
250035525df4Smrg    # Setup a source with many dependencies, because some compilers
250135525df4Smrg    # like to wrap large dependency lists on column 80 (with \), and
250235525df4Smrg    # we should not choose a depcomp mode which is confused by this.
250335525df4Smrg    #
250435525df4Smrg    # We need to recreate these files for each test, as the compiler may
250535525df4Smrg    # overwrite some of them when testing with obscure command lines.
250635525df4Smrg    # This happens at least with the AIX C compiler.
250735525df4Smrg    : > sub/conftest.c
250835525df4Smrg    for i in 1 2 3 4 5 6; do
250935525df4Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
251035525df4Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
251135525df4Smrg      # Solaris 10 /bin/sh.
251235525df4Smrg      echo '/* dummy */' > sub/conftst$i.h
251335525df4Smrg    done
251435525df4Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2515444c061aSmrg
251635525df4Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
251735525df4Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
251835525df4Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
251935525df4Smrg    # versions had trouble with output in subdirs.
252035525df4Smrg    am__obj=sub/conftest.${OBJEXT-o}
252135525df4Smrg    am__minus_obj="-o $am__obj"
252235525df4Smrg    case $depmode in
252335525df4Smrg    gcc)
252435525df4Smrg      # This depmode causes a compiler race in universal mode.
252535525df4Smrg      test "$am__universal" = false || continue
252635525df4Smrg      ;;
252735525df4Smrg    nosideeffect)
252835525df4Smrg      # After this tag, mechanisms are not by side-effect, so they'll
252935525df4Smrg      # only be used when explicitly requested.
253035525df4Smrg      if test "x$enable_dependency_tracking" = xyes; then
253135525df4Smrg	continue
253235525df4Smrg      else
253335525df4Smrg	break
253435525df4Smrg      fi
253535525df4Smrg      ;;
253635525df4Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
253735525df4Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
253835525df4Smrg      # not run yet.  These depmodes are late enough in the game, and
253935525df4Smrg      # so weak that their functioning should not be impacted.
254035525df4Smrg      am__obj=conftest.${OBJEXT-o}
254135525df4Smrg      am__minus_obj=
254235525df4Smrg      ;;
254335525df4Smrg    none) break ;;
254435525df4Smrg    esac
254535525df4Smrg    if depmode=$depmode \
254635525df4Smrg       source=sub/conftest.c object=$am__obj \
254735525df4Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
254835525df4Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
254935525df4Smrg         >/dev/null 2>conftest.err &&
255035525df4Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
255135525df4Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
255235525df4Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
255335525df4Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
255435525df4Smrg      # icc doesn't choke on unknown options, it will just issue warnings
255535525df4Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
255635525df4Smrg      # that says an option was ignored or not supported.
255735525df4Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
255835525df4Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
255935525df4Smrg      # The diagnosis changed in icc 8.0:
256035525df4Smrg      #   icc: Command line remark: option '-MP' not supported
256135525df4Smrg      if (grep 'ignoring option' conftest.err ||
256235525df4Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
256335525df4Smrg        am_cv_$1_dependencies_compiler_type=$depmode
256435525df4Smrg        break
256535525df4Smrg      fi
256635525df4Smrg    fi
256735525df4Smrg  done
2568444c061aSmrg
256935525df4Smrg  cd ..
257035525df4Smrg  rm -rf conftest.dir
257135525df4Smrgelse
257235525df4Smrg  am_cv_$1_dependencies_compiler_type=none
2573fdf6a26fSmrgfi
257435525df4Smrg])
257535525df4SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
257635525df4SmrgAM_CONDITIONAL([am__fastdep$1], [
257735525df4Smrg  test "x$enable_dependency_tracking" != xno \
257835525df4Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
257935525df4Smrg])
25800568f49bSmrg
2581444c061aSmrg
258235525df4Smrg# AM_SET_DEPDIR
258335525df4Smrg# -------------
258435525df4Smrg# Choose a directory name for dependency files.
258535525df4Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
258635525df4SmrgAC_DEFUN([AM_SET_DEPDIR],
258735525df4Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
258835525df4SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
258935525df4Smrg])
2590444c061aSmrg
259135525df4Smrg
259235525df4Smrg# AM_DEP_TRACK
259335525df4Smrg# ------------
259435525df4SmrgAC_DEFUN([AM_DEP_TRACK],
259535525df4Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
259635525df4SmrgAS_HELP_STRING(
259735525df4Smrg  [--enable-dependency-tracking],
259835525df4Smrg  [do not reject slow dependency extractors])
259935525df4SmrgAS_HELP_STRING(
260035525df4Smrg  [--disable-dependency-tracking],
260135525df4Smrg  [speeds up one-time build])])
260235525df4Smrgif test "x$enable_dependency_tracking" != xno; then
260335525df4Smrg  am_depcomp="$ac_aux_dir/depcomp"
260435525df4Smrg  AMDEPBACKSLASH='\'
260535525df4Smrg  am__nodep='_no'
2606fdf6a26fSmrgfi
260735525df4SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
260835525df4SmrgAC_SUBST([AMDEPBACKSLASH])dnl
260935525df4Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
261035525df4SmrgAC_SUBST([am__nodep])dnl
261135525df4Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
261235525df4Smrg])
2613444c061aSmrg
261435525df4Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
261535525df4Smrg
261635525df4Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2617fdf6a26fSmrg#
261835525df4Smrg# This file is free software; the Free Software Foundation
261935525df4Smrg# gives unlimited permission to copy and/or distribute it,
262035525df4Smrg# with or without modifications, as long as this notice is preserved.
262135525df4Smrg
262235525df4Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
262335525df4Smrg# ------------------------------
262435525df4SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
262535525df4Smrg[{
262635525df4Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
262735525df4Smrg  # are listed without --file.  Let's play safe and only enable the eval
262835525df4Smrg  # if we detect the quoting.
262935525df4Smrg  # TODO: see whether this extra hack can be removed once we start
263035525df4Smrg  # requiring Autoconf 2.70 or later.
263135525df4Smrg  AS_CASE([$CONFIG_FILES],
263235525df4Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
263335525df4Smrg          [*], [set x $CONFIG_FILES])
263435525df4Smrg  shift
263535525df4Smrg  # Used to flag and report bootstrapping failures.
263635525df4Smrg  am_rc=0
263735525df4Smrg  for am_mf
263835525df4Smrg  do
263935525df4Smrg    # Strip MF so we end up with the name of the file.
264035525df4Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
264135525df4Smrg    # Check whether this is an Automake generated Makefile which includes
264235525df4Smrg    # dependency-tracking related rules and includes.
264335525df4Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
264435525df4Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
264535525df4Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
264635525df4Smrg      || continue
264735525df4Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
264835525df4Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
264935525df4Smrg    AM_RUN_LOG([cd "$am_dirpart" \
265035525df4Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
265135525df4Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
265235525df4Smrg  done
265335525df4Smrg  if test $am_rc -ne 0; then
265435525df4Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
265535525df4Smrg    for automatic dependency tracking.  If GNU make was not used, consider
265635525df4Smrg    re-running the configure script with MAKE="gmake" (or whatever is
265735525df4Smrg    necessary).  You can also try re-running configure with the
265835525df4Smrg    '--disable-dependency-tracking' option to at least be able to build
265935525df4Smrg    the package (albeit without support for automatic dependency tracking).])
266035525df4Smrg  fi
266135525df4Smrg  AS_UNSET([am_dirpart])
266235525df4Smrg  AS_UNSET([am_filepart])
266335525df4Smrg  AS_UNSET([am_mf])
266435525df4Smrg  AS_UNSET([am_rc])
266535525df4Smrg  rm -f conftest-deps.mk
266635525df4Smrg}
266735525df4Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
266835525df4Smrg
266935525df4Smrg
267035525df4Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
267135525df4Smrg# -----------------------------
267235525df4Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2673fdf6a26fSmrg#
267435525df4Smrg# This code is only required when automatic dependency tracking is enabled.
267535525df4Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
267635525df4Smrg# order to bootstrap the dependency handling code.
267735525df4SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
267835525df4Smrg[AC_CONFIG_COMMANDS([depfiles],
267935525df4Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
268035525df4Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
268135525df4Smrg
268235525df4Smrg# Do all the work for Automake.                             -*- Autoconf -*-
268335525df4Smrg
268435525df4Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
2685fdf6a26fSmrg#
268635525df4Smrg# This file is free software; the Free Software Foundation
268735525df4Smrg# gives unlimited permission to copy and/or distribute it,
268835525df4Smrg# with or without modifications, as long as this notice is preserved.
2689444c061aSmrg
269035525df4Smrg# This macro actually does too much.  Some checks are only needed if
269135525df4Smrg# your package does certain things.  But this isn't really a big deal.
26920568f49bSmrg
269335525df4Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
269435525df4Smrgm4_define([AC_PROG_CC],
269535525df4Smrgm4_defn([AC_PROG_CC])
269635525df4Smrg[_AM_PROG_CC_C_O
269735525df4Smrg])
26980568f49bSmrg
269935525df4Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
270035525df4Smrg# AM_INIT_AUTOMAKE([OPTIONS])
270135525df4Smrg# -----------------------------------------------
270235525df4Smrg# The call with PACKAGE and VERSION arguments is the old style
270335525df4Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
270435525df4Smrg# and VERSION should now be passed to AC_INIT and removed from
270535525df4Smrg# the call to AM_INIT_AUTOMAKE.
270635525df4Smrg# We support both call styles for the transition.  After
270735525df4Smrg# the next Automake release, Autoconf can make the AC_INIT
270835525df4Smrg# arguments mandatory, and then we can depend on a new Autoconf
270935525df4Smrg# release and drop the old call support.
271035525df4SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
271135525df4Smrg[AC_PREREQ([2.65])dnl
271235525df4Smrgm4_ifdef([_$0_ALREADY_INIT],
271335525df4Smrg  [m4_fatal([$0 expanded multiple times
271435525df4Smrg]m4_defn([_$0_ALREADY_INIT]))],
271535525df4Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
271635525df4Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
271735525df4Smrgdnl the ones we care about.
271835525df4Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
271935525df4SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
272035525df4SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
272135525df4Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
272235525df4Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
272335525df4Smrg  # is not polluted with repeated "-I."
272435525df4Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
272535525df4Smrg  # test to see if srcdir already configured
272635525df4Smrg  if test -f $srcdir/config.status; then
272735525df4Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
272835525df4Smrg  fi
27299e7bcd65Smrgfi
27300568f49bSmrg
273135525df4Smrg# test whether we have cygpath
273235525df4Smrgif test -z "$CYGPATH_W"; then
273335525df4Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
273435525df4Smrg    CYGPATH_W='cygpath -w'
273535525df4Smrg  else
273635525df4Smrg    CYGPATH_W=echo
273735525df4Smrg  fi
27389e7bcd65Smrgfi
273935525df4SmrgAC_SUBST([CYGPATH_W])
27400568f49bSmrg
274135525df4Smrg# Define the identity of the package.
274235525df4Smrgdnl Distinguish between old-style and new-style calls.
274335525df4Smrgm4_ifval([$2],
274435525df4Smrg[AC_DIAGNOSE([obsolete],
274535525df4Smrg             [$0: two- and three-arguments forms are deprecated.])
274635525df4Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
274735525df4Smrg AC_SUBST([PACKAGE], [$1])dnl
274835525df4Smrg AC_SUBST([VERSION], [$2])],
274935525df4Smrg[_AM_SET_OPTIONS([$1])dnl
275035525df4Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
275135525df4Smrgm4_if(
275235525df4Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
275335525df4Smrg  [ok:ok],,
275435525df4Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
275535525df4Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
275635525df4Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
275735525df4Smrg
275835525df4Smrg_AM_IF_OPTION([no-define],,
275935525df4Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
276035525df4Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
276135525df4Smrg
276235525df4Smrg# Some tools Automake needs.
276335525df4SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
276435525df4SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
276535525df4SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
276635525df4SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
276735525df4SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
276835525df4SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
276935525df4SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
277035525df4SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
277135525df4SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
277235525df4SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
277335525df4Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
277435525df4Smrg# dies out for good.  For more background, see:
277535525df4Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
277635525df4Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
277735525df4SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
277835525df4Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
277935525df4Smrg# system "awk" is bad on some platforms.
278035525df4SmrgAC_REQUIRE([AC_PROG_AWK])dnl
278135525df4SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
278235525df4SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
278335525df4Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
278435525df4Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
278535525df4Smrg			     [_AM_PROG_TAR([v7])])])
278635525df4Smrg_AM_IF_OPTION([no-dependencies],,
278735525df4Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
278835525df4Smrg		  [_AM_DEPENDENCIES([CC])],
278935525df4Smrg		  [m4_define([AC_PROG_CC],
279035525df4Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
279135525df4SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
279235525df4Smrg		  [_AM_DEPENDENCIES([CXX])],
279335525df4Smrg		  [m4_define([AC_PROG_CXX],
279435525df4Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
279535525df4SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
279635525df4Smrg		  [_AM_DEPENDENCIES([OBJC])],
279735525df4Smrg		  [m4_define([AC_PROG_OBJC],
279835525df4Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
279935525df4SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
280035525df4Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
280135525df4Smrg		  [m4_define([AC_PROG_OBJCXX],
280235525df4Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
280335525df4Smrg])
280435525df4Smrg# Variables for tags utilities; see am/tags.am
280535525df4Smrgif test -z "$CTAGS"; then
280635525df4Smrg  CTAGS=ctags
280735525df4Smrgfi
280835525df4SmrgAC_SUBST([CTAGS])
280935525df4Smrgif test -z "$ETAGS"; then
281035525df4Smrg  ETAGS=etags
281135525df4Smrgfi
281235525df4SmrgAC_SUBST([ETAGS])
281335525df4Smrgif test -z "$CSCOPE"; then
281435525df4Smrg  CSCOPE=cscope
2815bdf0f55dSmrgfi
281635525df4SmrgAC_SUBST([CSCOPE])
28172ae83157Smrg
281835525df4SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
281935525df4Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
282035525df4Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
282135525df4Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
282235525df4SmrgAC_CONFIG_COMMANDS_PRE(dnl
282335525df4Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
282435525df4Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2825444c061aSmrg
282635525df4Smrg# POSIX will say in a future version that running "rm -f" with no argument
282735525df4Smrg# is OK; and we want to be able to make that assumption in our Makefile
282835525df4Smrg# recipes.  So use an aggressive probe to check that the usage we want is
282935525df4Smrg# actually supported "in the wild" to an acceptable degree.
283035525df4Smrg# See automake bug#10828.
283135525df4Smrg# To make any issue more visible, cause the running configure to be aborted
283235525df4Smrg# by default if the 'rm' program in use doesn't match our expectations; the
283335525df4Smrg# user can still override this though.
283435525df4Smrgif rm -f && rm -fr && rm -rf; then : OK; else
283535525df4Smrg  cat >&2 <<'END'
283635525df4SmrgOops!
28370568f49bSmrg
283835525df4SmrgYour 'rm' program seems unable to run without file operands specified
283935525df4Smrgon the command line, even when the '-f' option is present.  This is contrary
284035525df4Smrgto the behaviour of most rm programs out there, and not conforming with
284135525df4Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
28420568f49bSmrg
284335525df4SmrgPlease tell bug-automake@gnu.org about your system, including the value
284435525df4Smrgof your $PATH and any error possibly output before this message.  This
284535525df4Smrgcan help us improve future automake versions.
2846fdf6a26fSmrg
284735525df4SmrgEND
284835525df4Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
284935525df4Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
285035525df4Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
285135525df4Smrg    echo >&2
285235525df4Smrg  else
285335525df4Smrg    cat >&2 <<'END'
285435525df4SmrgAborting the configuration process, to ensure you take notice of the issue.
28552265a131Smrg
285635525df4SmrgYou can download and install GNU coreutils to get an 'rm' implementation
285735525df4Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
285835525df4Smrg
285935525df4SmrgIf you want to complete the configuration process using your problematic
286035525df4Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
286135525df4Smrgto "yes", and re-run configure.
286235525df4Smrg
286335525df4SmrgEND
286435525df4Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
286535525df4Smrg  fi
2866fdf6a26fSmrgfi
286735525df4Smrgdnl The trailing newline in this macro's definition is deliberate, for
286835525df4Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
286935525df4Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
287035525df4Smrg])
2871444c061aSmrg
287235525df4Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
287335525df4Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
287435525df4Smrgdnl mangled by Autoconf and run in a shell conditional statement.
287535525df4Smrgm4_define([_AC_COMPILER_EXEEXT],
287635525df4Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2877444c061aSmrg
287835525df4Smrg# When config.status generates a header, we must update the stamp-h file.
287935525df4Smrg# This file resides in the same directory as the config header
288035525df4Smrg# that is generated.  The stamp files are numbered to have different names.
28812265a131Smrg
288235525df4Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
288335525df4Smrg# loop where config.status creates the headers, so we can generate
288435525df4Smrg# our stamp files there.
288535525df4SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
288635525df4Smrg[# Compute $1's index in $config_headers.
288735525df4Smrg_am_arg=$1
288835525df4Smrg_am_stamp_count=1
288935525df4Smrgfor _am_header in $config_headers :; do
289035525df4Smrg  case $_am_header in
289135525df4Smrg    $_am_arg | $_am_arg:* )
289235525df4Smrg      break ;;
289335525df4Smrg    * )
289435525df4Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
289535525df4Smrg  esac
289635525df4Smrgdone
289735525df4Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2898249c3046Smrg
289935525df4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
290035525df4Smrg#
290135525df4Smrg# This file is free software; the Free Software Foundation
290235525df4Smrg# gives unlimited permission to copy and/or distribute it,
290335525df4Smrg# with or without modifications, as long as this notice is preserved.
2904fdf6a26fSmrg
290535525df4Smrg# AM_PROG_INSTALL_SH
290635525df4Smrg# ------------------
290735525df4Smrg# Define $install_sh.
290835525df4SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
290935525df4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
291035525df4Smrgif test x"${install_sh+set}" != xset; then
291135525df4Smrg  case $am_aux_dir in
291235525df4Smrg  *\ * | *\	*)
291335525df4Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
291435525df4Smrg  *)
291535525df4Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
291635525df4Smrg  esac
2917bdf0f55dSmrgfi
291835525df4SmrgAC_SUBST([install_sh])])
29192265a131Smrg
292035525df4Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
292135525df4Smrg#
292235525df4Smrg# This file is free software; the Free Software Foundation
292335525df4Smrg# gives unlimited permission to copy and/or distribute it,
292435525df4Smrg# with or without modifications, as long as this notice is preserved.
2925444c061aSmrg
292635525df4Smrg# Check whether the underlying file-system supports filenames
292735525df4Smrg# with a leading dot.  For instance MS-DOS doesn't.
292835525df4SmrgAC_DEFUN([AM_SET_LEADING_DOT],
292935525df4Smrg[rm -rf .tst 2>/dev/null
293035525df4Smrgmkdir .tst 2>/dev/null
293135525df4Smrgif test -d .tst; then
293235525df4Smrg  am__leading_dot=.
293335525df4Smrgelse
293435525df4Smrg  am__leading_dot=_
293535525df4Smrgfi
293635525df4Smrgrmdir .tst 2>/dev/null
293735525df4SmrgAC_SUBST([am__leading_dot])])
29389e7bcd65Smrg
293935525df4Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
29409e7bcd65Smrg
294135525df4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2942fdf6a26fSmrg#
294335525df4Smrg# This file is free software; the Free Software Foundation
294435525df4Smrg# gives unlimited permission to copy and/or distribute it,
294535525df4Smrg# with or without modifications, as long as this notice is preserved.
294635525df4Smrg
294735525df4Smrg# AM_MAKE_INCLUDE()
294835525df4Smrg# -----------------
294935525df4Smrg# Check whether make has an 'include' directive that can support all
295035525df4Smrg# the idioms we need for our automatic dependency tracking code.
295135525df4SmrgAC_DEFUN([AM_MAKE_INCLUDE],
295235525df4Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
295335525df4Smrgcat > confinc.mk << 'END'
295435525df4Smrgam__doit:
295535525df4Smrg	@echo this is the am__doit target >confinc.out
295635525df4Smrg.PHONY: am__doit
295735525df4SmrgEND
295835525df4Smrgam__include="#"
295935525df4Smrgam__quote=
296035525df4Smrg# BSD make does it like this.
296135525df4Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
296235525df4Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
296335525df4Smrgecho 'include confinc.mk # ignored' > confmf.GNU
296435525df4Smrg_am_result=no
296535525df4Smrgfor s in GNU BSD; do
296635525df4Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
296735525df4Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
296835525df4Smrg      ['0:this is the am__doit target'],
296935525df4Smrg      [AS_CASE([$s],
297035525df4Smrg          [BSD], [am__include='.include' am__quote='"'],
297135525df4Smrg          [am__include='include' am__quote=''])])
297235525df4Smrg  if test "$am__include" != "#"; then
297335525df4Smrg    _am_result="yes ($s style)"
297435525df4Smrg    break
297535525df4Smrg  fi
297635525df4Smrgdone
297735525df4Smrgrm -f confinc.* confmf.*
297835525df4SmrgAC_MSG_RESULT([${_am_result}])
297935525df4SmrgAC_SUBST([am__include])])
298035525df4SmrgAC_SUBST([am__quote])])
29810568f49bSmrg
298235525df4Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
29839e7bcd65Smrg
298435525df4Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
298535525df4Smrg#
298635525df4Smrg# This file is free software; the Free Software Foundation
298735525df4Smrg# gives unlimited permission to copy and/or distribute it,
298835525df4Smrg# with or without modifications, as long as this notice is preserved.
2989fdf6a26fSmrg
299035525df4Smrg# AM_MISSING_PROG(NAME, PROGRAM)
299135525df4Smrg# ------------------------------
299235525df4SmrgAC_DEFUN([AM_MISSING_PROG],
299335525df4Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
299435525df4Smrg$1=${$1-"${am_missing_run}$2"}
299535525df4SmrgAC_SUBST($1)])
2996fdf6a26fSmrg
299735525df4Smrg# AM_MISSING_HAS_RUN
299835525df4Smrg# ------------------
299935525df4Smrg# Define MISSING if not defined so far and test if it is modern enough.
300035525df4Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
300135525df4SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
300235525df4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
300335525df4SmrgAC_REQUIRE_AUX_FILE([missing])dnl
300435525df4Smrgif test x"${MISSING+set}" != xset; then
300535525df4Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
30060568f49bSmrgfi
300735525df4Smrg# Use eval to expand $SHELL
300835525df4Smrgif eval "$MISSING --is-lightweight"; then
300935525df4Smrg  am_missing_run="$MISSING "
301035525df4Smrgelse
301135525df4Smrg  am_missing_run=
301235525df4Smrg  AC_MSG_WARN(['missing' script is too old or missing])
30130568f49bSmrgfi
301435525df4Smrg])
3015fdf6a26fSmrg
301635525df4Smrg# Helper functions for option handling.                     -*- Autoconf -*-
3017fdf6a26fSmrg
301835525df4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
301935525df4Smrg#
302035525df4Smrg# This file is free software; the Free Software Foundation
302135525df4Smrg# gives unlimited permission to copy and/or distribute it,
302235525df4Smrg# with or without modifications, as long as this notice is preserved.
3023fdf6a26fSmrg
302435525df4Smrg# _AM_MANGLE_OPTION(NAME)
302535525df4Smrg# -----------------------
302635525df4SmrgAC_DEFUN([_AM_MANGLE_OPTION],
302735525df4Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3028fdf6a26fSmrg
302935525df4Smrg# _AM_SET_OPTION(NAME)
303035525df4Smrg# --------------------
303135525df4Smrg# Set option NAME.  Presently that only means defining a flag for this option.
303235525df4SmrgAC_DEFUN([_AM_SET_OPTION],
303335525df4Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3034fdf6a26fSmrg
303535525df4Smrg# _AM_SET_OPTIONS(OPTIONS)
303635525df4Smrg# ------------------------
303735525df4Smrg# OPTIONS is a space-separated list of Automake options.
303835525df4SmrgAC_DEFUN([_AM_SET_OPTIONS],
303935525df4Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3040fdf6a26fSmrg
304135525df4Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
304235525df4Smrg# -------------------------------------------
304335525df4Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
304435525df4SmrgAC_DEFUN([_AM_IF_OPTION],
304535525df4Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
30462ae83157Smrg
304735525df4Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3048fdf6a26fSmrg#
304935525df4Smrg# This file is free software; the Free Software Foundation
305035525df4Smrg# gives unlimited permission to copy and/or distribute it,
305135525df4Smrg# with or without modifications, as long as this notice is preserved.
3052fdf6a26fSmrg
305335525df4Smrg# _AM_PROG_CC_C_O
305435525df4Smrg# ---------------
305535525df4Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
305635525df4Smrg# to automatically call this.
305735525df4SmrgAC_DEFUN([_AM_PROG_CC_C_O],
305835525df4Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
305935525df4SmrgAC_REQUIRE_AUX_FILE([compile])dnl
306035525df4SmrgAC_LANG_PUSH([C])dnl
306135525df4SmrgAC_CACHE_CHECK(
306235525df4Smrg  [whether $CC understands -c and -o together],
306335525df4Smrg  [am_cv_prog_cc_c_o],
306435525df4Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
306535525df4Smrg  # Make sure it works both with $CC and with simple cc.
306635525df4Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
306735525df4Smrg  # compilers refuse to overwrite an existing .o file with -o,
306835525df4Smrg  # though they will create one.
306935525df4Smrg  am_cv_prog_cc_c_o=yes
307035525df4Smrg  for am_i in 1 2; do
307135525df4Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
307235525df4Smrg         && test -f conftest2.$ac_objext; then
307335525df4Smrg      : OK
307435525df4Smrg    else
307535525df4Smrg      am_cv_prog_cc_c_o=no
307635525df4Smrg      break
307735525df4Smrg    fi
307835525df4Smrg  done
307935525df4Smrg  rm -f core conftest*
308035525df4Smrg  unset am_i])
308135525df4Smrgif test "$am_cv_prog_cc_c_o" != yes; then
308235525df4Smrg   # Losing compiler, so override with the script.
308335525df4Smrg   # FIXME: It is wrong to rewrite CC.
308435525df4Smrg   # But if we don't then we get into trouble of one sort or another.
308535525df4Smrg   # A longer-term fix would be to have automake use am__CC in this case,
308635525df4Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
308735525df4Smrg   CC="$am_aux_dir/compile $CC"
30889e7bcd65Smrgfi
308935525df4SmrgAC_LANG_POP([C])])
3090bdf0f55dSmrg
309135525df4Smrg# For backward compatibility.
309235525df4SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30939e7bcd65Smrg
309435525df4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
309535525df4Smrg#
309635525df4Smrg# This file is free software; the Free Software Foundation
309735525df4Smrg# gives unlimited permission to copy and/or distribute it,
309835525df4Smrg# with or without modifications, as long as this notice is preserved.
309935525df4Smrg
310035525df4Smrg# AM_RUN_LOG(COMMAND)
310135525df4Smrg# -------------------
310235525df4Smrg# Run COMMAND, save the exit status in ac_status, and log it.
310335525df4Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
310435525df4SmrgAC_DEFUN([AM_RUN_LOG],
310535525df4Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
310635525df4Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
310735525df4Smrg   ac_status=$?
310835525df4Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
310935525df4Smrg   (exit $ac_status); }])
31109e7bcd65Smrg
311135525df4Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
31129e7bcd65Smrg
311335525df4Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
311435525df4Smrg#
311535525df4Smrg# This file is free software; the Free Software Foundation
311635525df4Smrg# gives unlimited permission to copy and/or distribute it,
311735525df4Smrg# with or without modifications, as long as this notice is preserved.
31189e7bcd65Smrg
311935525df4Smrg# AM_SANITY_CHECK
312035525df4Smrg# ---------------
312135525df4SmrgAC_DEFUN([AM_SANITY_CHECK],
312235525df4Smrg[AC_MSG_CHECKING([whether build environment is sane])
312335525df4Smrg# Reject unsafe characters in $srcdir or the absolute working directory
312435525df4Smrg# name.  Accept space and tab only in the latter.
312535525df4Smrgam_lf='
312635525df4Smrg'
312735525df4Smrgcase `pwd` in
312835525df4Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
312935525df4Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
313035525df4Smrgesac
313135525df4Smrgcase $srcdir in
313235525df4Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
313335525df4Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
313435525df4Smrgesac
31359e7bcd65Smrg
313635525df4Smrg# Do 'set' in a subshell so we don't clobber the current shell's
313735525df4Smrg# arguments.  Must try -L first in case configure is actually a
313835525df4Smrg# symlink; some systems play weird games with the mod time of symlinks
313935525df4Smrg# (eg FreeBSD returns the mod time of the symlink's containing
314035525df4Smrg# directory).
314135525df4Smrgif (
314235525df4Smrg   am_has_slept=no
314335525df4Smrg   for am_try in 1 2; do
314435525df4Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
314535525df4Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
314635525df4Smrg     if test "$[*]" = "X"; then
314735525df4Smrg	# -L didn't work.
314835525df4Smrg	set X `ls -t "$srcdir/configure" conftest.file`
314935525df4Smrg     fi
315035525df4Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
315135525df4Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
315235525df4Smrg
315335525df4Smrg	# If neither matched, then we have a broken ls.  This can happen
315435525df4Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
315535525df4Smrg	# broken ls alias from the environment.  This has actually
315635525df4Smrg	# happened.  Such a system could not be considered "sane".
315735525df4Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
315835525df4Smrg  alias in your environment])
315935525df4Smrg     fi
316035525df4Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
316135525df4Smrg       break
316235525df4Smrg     fi
316335525df4Smrg     # Just in case.
316435525df4Smrg     sleep 1
316535525df4Smrg     am_has_slept=yes
316635525df4Smrg   done
316735525df4Smrg   test "$[2]" = conftest.file
316835525df4Smrg   )
316935525df4Smrgthen
317035525df4Smrg   # Ok.
317135525df4Smrg   :
3172fdf6a26fSmrgelse
317335525df4Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
317435525df4SmrgCheck your system clock])
3175fdf6a26fSmrgfi
317635525df4SmrgAC_MSG_RESULT([yes])
317735525df4Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
317835525df4Smrg# generated files are strictly newer.
317935525df4Smrgam_sleep_pid=
318035525df4Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
318135525df4Smrg  ( sleep 1 ) &
318235525df4Smrg  am_sleep_pid=$!
318335525df4Smrgfi
318435525df4SmrgAC_CONFIG_COMMANDS_PRE(
318535525df4Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
318635525df4Smrg   if test -n "$am_sleep_pid"; then
318735525df4Smrg     # Hide warnings about reused PIDs.
318835525df4Smrg     wait $am_sleep_pid 2>/dev/null
318935525df4Smrg   fi
319035525df4Smrg   AC_MSG_RESULT([done])])
319135525df4Smrgrm -f conftest.file
319235525df4Smrg])
3193fdf6a26fSmrg
319435525df4Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
3195fdf6a26fSmrg#
319635525df4Smrg# This file is free software; the Free Software Foundation
319735525df4Smrg# gives unlimited permission to copy and/or distribute it,
319835525df4Smrg# with or without modifications, as long as this notice is preserved.
31999e7bcd65Smrg
320035525df4Smrg# AM_SILENT_RULES([DEFAULT])
320135525df4Smrg# --------------------------
320235525df4Smrg# Enable less verbose build rules; with the default set to DEFAULT
320335525df4Smrg# ("yes" being less verbose, "no" or empty being verbose).
320435525df4SmrgAC_DEFUN([AM_SILENT_RULES],
320535525df4Smrg[AC_ARG_ENABLE([silent-rules], [dnl
320635525df4SmrgAS_HELP_STRING(
320735525df4Smrg  [--enable-silent-rules],
320835525df4Smrg  [less verbose build output (undo: "make V=1")])
320935525df4SmrgAS_HELP_STRING(
321035525df4Smrg  [--disable-silent-rules],
321135525df4Smrg  [verbose build output (undo: "make V=0")])dnl
321235525df4Smrg])
321335525df4Smrgcase $enable_silent_rules in @%:@ (((
321435525df4Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
321535525df4Smrg   no) AM_DEFAULT_VERBOSITY=1;;
321635525df4Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
321735525df4Smrgesac
321835525df4Smrgdnl
321935525df4Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
322035525df4Smrgdnl do not support nested variable expansions.
322135525df4Smrgdnl See automake bug#9928 and bug#10237.
322235525df4Smrgam_make=${MAKE-make}
322335525df4SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
322435525df4Smrg   [am_cv_make_support_nested_variables],
322535525df4Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
322635525df4SmrgBAR0=false
322735525df4SmrgBAR1=true
322835525df4SmrgV=1
322935525df4Smrgam__doit:
323035525df4Smrg	@$(TRUE)
323135525df4Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
323235525df4Smrg  am_cv_make_support_nested_variables=yes
323335525df4Smrgelse
323435525df4Smrg  am_cv_make_support_nested_variables=no
323535525df4Smrgfi])
323635525df4Smrgif test $am_cv_make_support_nested_variables = yes; then
323735525df4Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
323835525df4Smrg  AM_V='$(V)'
323935525df4Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
324035525df4Smrgelse
324135525df4Smrg  AM_V=$AM_DEFAULT_VERBOSITY
324235525df4Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
324335525df4Smrgfi
324435525df4SmrgAC_SUBST([AM_V])dnl
324535525df4SmrgAM_SUBST_NOTMAKE([AM_V])dnl
324635525df4SmrgAC_SUBST([AM_DEFAULT_V])dnl
324735525df4SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
324835525df4SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
324935525df4SmrgAM_BACKSLASH='\'
325035525df4SmrgAC_SUBST([AM_BACKSLASH])dnl
325135525df4Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
325235525df4Smrg])
32532265a131Smrg
325435525df4Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
325535525df4Smrg#
325635525df4Smrg# This file is free software; the Free Software Foundation
325735525df4Smrg# gives unlimited permission to copy and/or distribute it,
325835525df4Smrg# with or without modifications, as long as this notice is preserved.
3259444c061aSmrg
326035525df4Smrg# AM_PROG_INSTALL_STRIP
326135525df4Smrg# ---------------------
326235525df4Smrg# One issue with vendor 'install' (even GNU) is that you can't
326335525df4Smrg# specify the program used to strip binaries.  This is especially
326435525df4Smrg# annoying in cross-compiling environments, where the build's strip
326535525df4Smrg# is unlikely to handle the host's binaries.
326635525df4Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
326735525df4Smrg# always use install-sh in "make install-strip", and initialize
326835525df4Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
326935525df4SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
327035525df4Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
327135525df4Smrg# Installed binaries are usually stripped using 'strip' when the user
327235525df4Smrg# run "make install-strip".  However 'strip' might not be the right
327335525df4Smrg# tool to use in cross-compilation environments, therefore Automake
327435525df4Smrg# will honor the 'STRIP' environment variable to overrule this program.
327535525df4Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
327635525df4Smrgif test "$cross_compiling" != no; then
327735525df4Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
327835525df4Smrgfi
327935525df4SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
328035525df4SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3281444c061aSmrg
328235525df4Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
328335525df4Smrg#
328435525df4Smrg# This file is free software; the Free Software Foundation
328535525df4Smrg# gives unlimited permission to copy and/or distribute it,
328635525df4Smrg# with or without modifications, as long as this notice is preserved.
3287444c061aSmrg
328835525df4Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
328935525df4Smrg# ---------------------------
329035525df4Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
329135525df4Smrg# This macro is traced by Automake.
329235525df4SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3293444c061aSmrg
329435525df4Smrg# AM_SUBST_NOTMAKE(VARIABLE)
329535525df4Smrg# --------------------------
329635525df4Smrg# Public sister of _AM_SUBST_NOTMAKE.
329735525df4SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3298444c061aSmrg
329935525df4Smrg# Check how to create a tarball.                            -*- Autoconf -*-
330035525df4Smrg
330135525df4Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
3302fdf6a26fSmrg#
330335525df4Smrg# This file is free software; the Free Software Foundation
330435525df4Smrg# gives unlimited permission to copy and/or distribute it,
330535525df4Smrg# with or without modifications, as long as this notice is preserved.
3306bdf0f55dSmrg
330735525df4Smrg# _AM_PROG_TAR(FORMAT)
3308fdf6a26fSmrg# --------------------
330935525df4Smrg# Check how to create a tarball in format FORMAT.
331035525df4Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3311fdf6a26fSmrg#
331235525df4Smrg# Substitute a variable $(am__tar) that is a command
331335525df4Smrg# writing to stdout a FORMAT-tarball containing the directory
331435525df4Smrg# $tardir.
331535525df4Smrg#     tardir=directory && $(am__tar) > result.tar
3316fdf6a26fSmrg#
331735525df4Smrg# Substitute a variable $(am__untar) that extract such
331835525df4Smrg# a tarball read from stdin.
331935525df4Smrg#     $(am__untar) < result.tar
3320fdf6a26fSmrg#
332135525df4SmrgAC_DEFUN([_AM_PROG_TAR],
332235525df4Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
332335525df4Smrg# in the wild :-(  We should find a proper way to deprecate it ...
332435525df4SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3325339a7c43Smrg
332635525df4Smrg# We'll loop over all known methods to create a tar archive until one works.
332735525df4Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3328bdf0f55dSmrg
332935525df4Smrgm4_if([$1], [v7],
333035525df4Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
33310568f49bSmrg
333235525df4Smrg  [m4_case([$1],
333335525df4Smrg    [ustar],
333435525df4Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
333535525df4Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
333635525df4Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
333735525df4Smrg      # and bug#13588).
333835525df4Smrg      am_max_uid=2097151 # 2^21 - 1
333935525df4Smrg      am_max_gid=$am_max_uid
334035525df4Smrg      # The $UID and $GID variables are not portable, so we need to resort
334135525df4Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
334235525df4Smrg      # below are definitely unexpected, so allow the users to see them
334335525df4Smrg      # (that is, avoid stderr redirection).
334435525df4Smrg      am_uid=`id -u || echo unknown`
334535525df4Smrg      am_gid=`id -g || echo unknown`
334635525df4Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
334735525df4Smrg      if test $am_uid -le $am_max_uid; then
334835525df4Smrg         AC_MSG_RESULT([yes])
334935525df4Smrg      else
335035525df4Smrg         AC_MSG_RESULT([no])
335135525df4Smrg         _am_tools=none
335235525df4Smrg      fi
335335525df4Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
335435525df4Smrg      if test $am_gid -le $am_max_gid; then
335535525df4Smrg         AC_MSG_RESULT([yes])
335635525df4Smrg      else
335735525df4Smrg        AC_MSG_RESULT([no])
335835525df4Smrg        _am_tools=none
335935525df4Smrg      fi],
336035525df4Smrg
336135525df4Smrg  [pax],
336235525df4Smrg    [],
336335525df4Smrg
336435525df4Smrg  [m4_fatal([Unknown tar format])])
336535525df4Smrg
336635525df4Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
336735525df4Smrg
336835525df4Smrg  # Go ahead even if we have the value already cached.  We do so because we
336935525df4Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
337035525df4Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
337135525df4Smrg
337235525df4Smrg  for _am_tool in $_am_tools; do
337335525df4Smrg    case $_am_tool in
337435525df4Smrg    gnutar)
337535525df4Smrg      for _am_tar in tar gnutar gtar; do
337635525df4Smrg        AM_RUN_LOG([$_am_tar --version]) && break
337735525df4Smrg      done
337835525df4Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
337935525df4Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
338035525df4Smrg      am__untar="$_am_tar -xf -"
338135525df4Smrg      ;;
338235525df4Smrg    plaintar)
338335525df4Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
338435525df4Smrg      # ustar tarball either.
338535525df4Smrg      (tar --version) >/dev/null 2>&1 && continue
338635525df4Smrg      am__tar='tar chf - "$$tardir"'
338735525df4Smrg      am__tar_='tar chf - "$tardir"'
338835525df4Smrg      am__untar='tar xf -'
338935525df4Smrg      ;;
339035525df4Smrg    pax)
339135525df4Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
339235525df4Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
339335525df4Smrg      am__untar='pax -r'
339435525df4Smrg      ;;
339535525df4Smrg    cpio)
339635525df4Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
339735525df4Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
339835525df4Smrg      am__untar='cpio -i -H $1 -d'
339935525df4Smrg      ;;
340035525df4Smrg    none)
340135525df4Smrg      am__tar=false
340235525df4Smrg      am__tar_=false
340335525df4Smrg      am__untar=false
340435525df4Smrg      ;;
340535525df4Smrg    esac
340635525df4Smrg
340735525df4Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
340835525df4Smrg    # and am__untar set.
340935525df4Smrg    test -n "${am_cv_prog_tar_$1}" && break
341035525df4Smrg
341135525df4Smrg    # tar/untar a dummy directory, and stop if the command works.
341235525df4Smrg    rm -rf conftest.dir
341335525df4Smrg    mkdir conftest.dir
341435525df4Smrg    echo GrepMe > conftest.dir/file
341535525df4Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
341635525df4Smrg    rm -rf conftest.dir
341735525df4Smrg    if test -s conftest.tar; then
341835525df4Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
341935525df4Smrg      AM_RUN_LOG([cat conftest.dir/file])
342035525df4Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
342135525df4Smrg    fi
342235525df4Smrg  done
342335525df4Smrg  rm -rf conftest.dir
342435525df4Smrg
342535525df4Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
342635525df4Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
342735525df4Smrg
342835525df4SmrgAC_SUBST([am__tar])
342935525df4SmrgAC_SUBST([am__untar])
343035525df4Smrg]) # _AM_PROG_TAR
3431444c061aSmrg
34320568f49bSmrgm4_include([m4/ax_define_dir.m4])
34330568f49bSmrgm4_include([m4/libtool.m4])
34340568f49bSmrgm4_include([m4/ltoptions.m4])
34350568f49bSmrgm4_include([m4/ltsugar.m4])
34360568f49bSmrgm4_include([m4/ltversion.m4])
34370568f49bSmrgm4_include([m4/lt~obsolete.m4])
3438