14e8f48c7Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2f1ee322dSmrg
34e8f48c7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4c43cc173Smrg
5c43cc173Smrg# This file is free software; the Free Software Foundation
6c43cc173Smrg# gives unlimited permission to copy and/or distribute it,
7c43cc173Smrg# with or without modifications, as long as this notice is preserved.
8c43cc173Smrg
9c43cc173Smrg# This program is distributed in the hope that it will be useful,
10c43cc173Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11c43cc173Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12c43cc173Smrg# PARTICULAR PURPOSE.
13c43cc173Smrg
1406c34b88Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1521e67964Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1621e67964Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
174e8f48c7Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
184e8f48c7Smrg[m4_warning([this file was generated for autoconf 2.71.
1921e67964SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2021e67964SmrgIf you have problems, you may need to regenerate the build system entirely.
21f1ee322dSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22c43cc173Smrg
23c6b4a769Smrg# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
24c6b4a769Smrg# serial 12 (pkg-config-0.29.2)
254940c694Smrg
2648e5ce07Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2748e5ce07Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2848e5ce07Smrgdnl
2948e5ce07Smrgdnl This program is free software; you can redistribute it and/or modify
3048e5ce07Smrgdnl it under the terms of the GNU General Public License as published by
3148e5ce07Smrgdnl the Free Software Foundation; either version 2 of the License, or
3248e5ce07Smrgdnl (at your option) any later version.
3348e5ce07Smrgdnl
3448e5ce07Smrgdnl This program is distributed in the hope that it will be useful, but
3548e5ce07Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3648e5ce07Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3748e5ce07Smrgdnl General Public License for more details.
3848e5ce07Smrgdnl
3948e5ce07Smrgdnl You should have received a copy of the GNU General Public License
4048e5ce07Smrgdnl along with this program; if not, write to the Free Software
4148e5ce07Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4248e5ce07Smrgdnl 02111-1307, USA.
4348e5ce07Smrgdnl
4448e5ce07Smrgdnl As a special exception to the GNU General Public License, if you
4548e5ce07Smrgdnl distribute this file as part of a program that contains a
4648e5ce07Smrgdnl configuration script generated by Autoconf, you may include it under
4748e5ce07Smrgdnl the same distribution terms that you use for the rest of that
4848e5ce07Smrgdnl program.
4948e5ce07Smrg
5048e5ce07Smrgdnl PKG_PREREQ(MIN-VERSION)
5148e5ce07Smrgdnl -----------------------
5248e5ce07Smrgdnl Since: 0.29
5348e5ce07Smrgdnl
5448e5ce07Smrgdnl Verify that the version of the pkg-config macros are at least
5548e5ce07Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5648e5ce07Smrgdnl installed version of pkg-config, this checks the developer's version
5748e5ce07Smrgdnl of pkg.m4 when generating configure.
5848e5ce07Smrgdnl
5948e5ce07Smrgdnl To ensure that this macro is defined, also add:
6048e5ce07Smrgdnl m4_ifndef([PKG_PREREQ],
6148e5ce07Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6248e5ce07Smrgdnl
6348e5ce07Smrgdnl See the "Since" comment for each macro you use to see what version
6448e5ce07Smrgdnl of the macros you require.
6548e5ce07Smrgm4_defun([PKG_PREREQ],
66c6b4a769Smrg[m4_define([PKG_MACROS_VERSION], [0.29.2])
6748e5ce07Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6848e5ce07Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6948e5ce07Smrg])dnl PKG_PREREQ
7048e5ce07Smrg
7148e5ce07Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7248e5ce07Smrgdnl ----------------------------------
7348e5ce07Smrgdnl Since: 0.16
7448e5ce07Smrgdnl
7548e5ce07Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7648e5ce07Smrgdnl first found in the path. Checks that the version of pkg-config found
7748e5ce07Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7848e5ce07Smrgdnl used since that's the first version where most current features of
7948e5ce07Smrgdnl pkg-config existed.
8006c34b88SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8106c34b88Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
82dc9477beSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
83dc9477beSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8406c34b88SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8506c34b88SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8606c34b88SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8706c34b88Smrg
8806c34b88Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8906c34b88Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9006c34b88Smrgfi
9106c34b88Smrgif test -n "$PKG_CONFIG"; then
9206c34b88Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9306c34b88Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9406c34b88Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9506c34b88Smrg		AC_MSG_RESULT([yes])
9606c34b88Smrg	else
9706c34b88Smrg		AC_MSG_RESULT([no])
9806c34b88Smrg		PKG_CONFIG=""
9906c34b88Smrg	fi
10006c34b88Smrgfi[]dnl
10148e5ce07Smrg])dnl PKG_PROG_PKG_CONFIG
102b789ec8aSmrg
10348e5ce07Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10448e5ce07Smrgdnl -------------------------------------------------------------------
10548e5ce07Smrgdnl Since: 0.18
10648e5ce07Smrgdnl
10748e5ce07Smrgdnl Check to see whether a particular set of modules exists. Similar to
10848e5ce07Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10948e5ce07Smrgdnl
11048e5ce07Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
111c6b4a769Smrgdnl only at the first occurrence in configure.ac, so if the first place
11248e5ce07Smrgdnl it's called might be skipped (such as if it is within an "if", you
11348e5ce07Smrgdnl have to call PKG_CHECK_EXISTS manually
11406c34b88SmrgAC_DEFUN([PKG_CHECK_EXISTS],
11506c34b88Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11606c34b88Smrgif test -n "$PKG_CONFIG" && \
11706c34b88Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11806c34b88Smrg  m4_default([$2], [:])
11906c34b88Smrgm4_ifvaln([$3], [else
12006c34b88Smrg  $3])dnl
12106c34b88Smrgfi])
122b789ec8aSmrg
12348e5ce07Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12448e5ce07Smrgdnl ---------------------------------------------
12548e5ce07Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12648e5ce07Smrgdnl pkg_failed based on the result.
12706c34b88Smrgm4_define([_PKG_CONFIG],
12806c34b88Smrg[if test -n "$$1"; then
12906c34b88Smrg    pkg_cv_[]$1="$$1"
13006c34b88Smrg elif test -n "$PKG_CONFIG"; then
13106c34b88Smrg    PKG_CHECK_EXISTS([$3],
132dc9477beSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
133dc9477beSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
13406c34b88Smrg		     [pkg_failed=yes])
13506c34b88Smrg else
13606c34b88Smrg    pkg_failed=untried
13706c34b88Smrgfi[]dnl
13848e5ce07Smrg])dnl _PKG_CONFIG
13906c34b88Smrg
14048e5ce07Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14148e5ce07Smrgdnl ---------------------------
14248e5ce07Smrgdnl Internal check to see if pkg-config supports short errors.
14306c34b88SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14406c34b88Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14506c34b88Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14606c34b88Smrg        _pkg_short_errors_supported=yes
14706c34b88Smrgelse
14806c34b88Smrg        _pkg_short_errors_supported=no
14906c34b88Smrgfi[]dnl
15048e5ce07Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
15106c34b88Smrg
15206c34b88Smrg
15348e5ce07Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15448e5ce07Smrgdnl   [ACTION-IF-NOT-FOUND])
15548e5ce07Smrgdnl --------------------------------------------------------------
15648e5ce07Smrgdnl Since: 0.4.0
15748e5ce07Smrgdnl
15848e5ce07Smrgdnl Note that if there is a possibility the first call to
15948e5ce07Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16048e5ce07Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16106c34b88SmrgAC_DEFUN([PKG_CHECK_MODULES],
16206c34b88Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16306c34b88SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16406c34b88SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165f1ee322dSmrg
16606c34b88Smrgpkg_failed=no
167c6b4a769SmrgAC_MSG_CHECKING([for $2])
16806c34b88Smrg
16906c34b88Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17006c34b88Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
17106c34b88Smrg
17206c34b88Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17306c34b88Smrgand $1[]_LIBS to avoid the need to call pkg-config.
17406c34b88SmrgSee the pkg-config man page for more details.])
17506c34b88Smrg
17606c34b88Smrgif test $pkg_failed = yes; then
177c6b4a769Smrg        AC_MSG_RESULT([no])
17806c34b88Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17906c34b88Smrg        if test $_pkg_short_errors_supported = yes; then
180c6b4a769Smrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
181c6b4a769Smrg        else
182c6b4a769Smrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18306c34b88Smrg        fi
184c6b4a769Smrg        # Put the nasty error message in config.log where it belongs
185c6b4a769Smrg        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
18606c34b88Smrg
187c6b4a769Smrg        m4_default([$4], [AC_MSG_ERROR(
18806c34b88Smrg[Package requirements ($2) were not met:
18906c34b88Smrg
19006c34b88Smrg$$1_PKG_ERRORS
19106c34b88Smrg
19206c34b88SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19306c34b88Smrginstalled software in a non-standard prefix.
19406c34b88Smrg
195dc9477beSmrg_PKG_TEXT])[]dnl
19606c34b88Smrg        ])
19706c34b88Smrgelif test $pkg_failed = untried; then
198c6b4a769Smrg        AC_MSG_RESULT([no])
199c6b4a769Smrg        m4_default([$4], [AC_MSG_FAILURE(
20006c34b88Smrg[The pkg-config script could not be found or is too old.  Make sure it
20106c34b88Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
20206c34b88Smrgpath to pkg-config.
20306c34b88Smrg
20406c34b88Smrg_PKG_TEXT
20506c34b88Smrg
206dc9477beSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20706c34b88Smrg        ])
20806c34b88Smrgelse
209c6b4a769Smrg        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
210c6b4a769Smrg        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21106c34b88Smrg        AC_MSG_RESULT([yes])
212c6b4a769Smrg        $3
21306c34b88Smrgfi[]dnl
21448e5ce07Smrg])dnl PKG_CHECK_MODULES
21506c34b88Smrg
21606c34b88Smrg
21748e5ce07Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21848e5ce07Smrgdnl   [ACTION-IF-NOT-FOUND])
21948e5ce07Smrgdnl ---------------------------------------------------------------------
22048e5ce07Smrgdnl Since: 0.29
22148e5ce07Smrgdnl
22248e5ce07Smrgdnl Checks for existence of MODULES and gathers its build flags with
22348e5ce07Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22448e5ce07Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22548e5ce07Smrgdnl
22648e5ce07Smrgdnl Note that if there is a possibility the first call to
22748e5ce07Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22848e5ce07Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22948e5ce07Smrgdnl configure.ac.
23048e5ce07SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23148e5ce07Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23248e5ce07Smrg_save_PKG_CONFIG=$PKG_CONFIG
23348e5ce07SmrgPKG_CONFIG="$PKG_CONFIG --static"
23448e5ce07SmrgPKG_CHECK_MODULES($@)
23548e5ce07SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23648e5ce07Smrg])dnl PKG_CHECK_MODULES_STATIC
23744584a44Smrg
23844584a44Smrg
23948e5ce07Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24048e5ce07Smrgdnl -------------------------
24148e5ce07Smrgdnl Since: 0.27
24248e5ce07Smrgdnl
24348e5ce07Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
24448e5ce07Smrgdnl should install pkg-config .pc files. By default the directory is
24548e5ce07Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
24648e5ce07Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24748e5ce07Smrgdnl parameter.
24848e5ce07SmrgAC_DEFUN([PKG_INSTALLDIR],
24948e5ce07Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25048e5ce07Smrgm4_pushdef([pkg_description],
25148e5ce07Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25248e5ce07SmrgAC_ARG_WITH([pkgconfigdir],
25348e5ce07Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25448e5ce07Smrg    [with_pkgconfigdir=]pkg_default)
25548e5ce07SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25648e5ce07Smrgm4_popdef([pkg_default])
25748e5ce07Smrgm4_popdef([pkg_description])
25848e5ce07Smrg])dnl PKG_INSTALLDIR
25948e5ce07Smrg
26048e5ce07Smrg
26148e5ce07Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26248e5ce07Smrgdnl --------------------------------
26348e5ce07Smrgdnl Since: 0.27
26448e5ce07Smrgdnl
26548e5ce07Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26648e5ce07Smrgdnl module should install arch-independent pkg-config .pc files. By
26748e5ce07Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
26848e5ce07Smrgdnl changed by passing DIRECTORY. The user can override through the
26948e5ce07Smrgdnl --with-noarch-pkgconfigdir parameter.
27048e5ce07SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27148e5ce07Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27248e5ce07Smrgm4_pushdef([pkg_description],
27348e5ce07Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27448e5ce07SmrgAC_ARG_WITH([noarch-pkgconfigdir],
27548e5ce07Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27648e5ce07Smrg    [with_noarch_pkgconfigdir=]pkg_default)
27748e5ce07SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27848e5ce07Smrgm4_popdef([pkg_default])
27948e5ce07Smrgm4_popdef([pkg_description])
28048e5ce07Smrg])dnl PKG_NOARCH_INSTALLDIR
28148e5ce07Smrg
28248e5ce07Smrg
28348e5ce07Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28448e5ce07Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28548e5ce07Smrgdnl -------------------------------------------
28648e5ce07Smrgdnl Since: 0.28
28748e5ce07Smrgdnl
28848e5ce07Smrgdnl Retrieves the value of the pkg-config variable for the given module.
28948e5ce07SmrgAC_DEFUN([PKG_CHECK_VAR],
29048e5ce07Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29148e5ce07SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
29244584a44Smrg
29348e5ce07Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29448e5ce07SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29544584a44Smrg
29648e5ce07SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29748e5ce07Smrg])dnl PKG_CHECK_VAR
29844584a44Smrg
2994940c694Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3004940c694Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3014940c694Smrgdnl   [DESCRIPTION], [DEFAULT])
3024940c694Smrgdnl ------------------------------------------
3034940c694Smrgdnl
3044940c694Smrgdnl Prepare a "--with-" configure option using the lowercase
3054940c694Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
3064940c694Smrgdnl PKG_CHECK_MODULES in a single macro.
3074940c694SmrgAC_DEFUN([PKG_WITH_MODULES],
3084940c694Smrg[
3094940c694Smrgm4_pushdef([with_arg], m4_tolower([$1]))
3104940c694Smrg
3114940c694Smrgm4_pushdef([description],
3124940c694Smrg           [m4_default([$5], [build with ]with_arg[ support])])
3134940c694Smrg
3144940c694Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
3154940c694Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
3164940c694Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
3174940c694Smrg
3184940c694Smrgm4_case(def_arg,
3194940c694Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3204940c694Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
3214940c694Smrg
3224940c694SmrgAC_ARG_WITH(with_arg,
3234940c694Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
3244940c694Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
3254940c694Smrg
3264940c694SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
3274940c694Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
3284940c694Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
3294940c694Smrg                                        [m4_n([def_action_if_found]) $3],
3304940c694Smrg                                        [m4_n([def_action_if_not_found]) $4])])
3314940c694Smrg
3324940c694Smrgm4_popdef([with_arg])
3334940c694Smrgm4_popdef([description])
3344940c694Smrgm4_popdef([def_arg])
3354940c694Smrg
3364940c694Smrg])dnl PKG_WITH_MODULES
3374940c694Smrg
3384940c694Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3394940c694Smrgdnl   [DESCRIPTION], [DEFAULT])
3404940c694Smrgdnl -----------------------------------------------
3414940c694Smrgdnl
3424940c694Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
3434940c694Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
3444940c694SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
3454940c694Smrg[
3464940c694SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3474940c694Smrg
3484940c694SmrgAM_CONDITIONAL([HAVE_][$1],
3494940c694Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3504940c694Smrg])dnl PKG_HAVE_WITH_MODULES
3514940c694Smrg
3524940c694Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3534940c694Smrgdnl   [DESCRIPTION], [DEFAULT])
3544940c694Smrgdnl ------------------------------------------------------
3554940c694Smrgdnl
3564940c694Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
3574940c694Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
3584940c694Smrgdnl and preprocessor variable.
3594940c694SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
3604940c694Smrg[
3614940c694SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
3624940c694Smrg
3634940c694SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
3644940c694Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
3654940c694Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
3664940c694Smrg
36748e5ce07Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
36848e5ce07Smrgdnl
369c6b4a769Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
37048e5ce07Smrgdnl
37148e5ce07Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
37248e5ce07Smrgdnl copy of this software and associated documentation files (the "Software"),
37348e5ce07Smrgdnl to deal in the Software without restriction, including without limitation
37448e5ce07Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
37548e5ce07Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
37648e5ce07Smrgdnl Software is furnished to do so, subject to the following conditions:
37748e5ce07Smrgdnl
37848e5ce07Smrgdnl The above copyright notice and this permission notice (including the next
37948e5ce07Smrgdnl paragraph) shall be included in all copies or substantial portions of the
38048e5ce07Smrgdnl Software.
38148e5ce07Smrgdnl
38248e5ce07Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38348e5ce07Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38448e5ce07Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
38548e5ce07Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38648e5ce07Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
38748e5ce07Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
38848e5ce07Smrgdnl DEALINGS IN THE SOFTWARE.
38948e5ce07Smrg
39048e5ce07Smrg# XORG_MACROS_VERSION(required-version)
39148e5ce07Smrg# -------------------------------------
39248e5ce07Smrg# Minimum version: 1.1.0
393b789ec8aSmrg#
39448e5ce07Smrg# If you're using a macro added in Version 1.1 or newer, include this in
39548e5ce07Smrg# your configure.ac with the minimum required version, such as:
39648e5ce07Smrg# XORG_MACROS_VERSION(1.1)
397f1ee322dSmrg#
39848e5ce07Smrg# To ensure that this macro is defined, also add:
39948e5ce07Smrg# m4_ifndef([XORG_MACROS_VERSION],
40048e5ce07Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
40106c34b88Smrg#
40244584a44Smrg#
40348e5ce07Smrg# See the "minimum version" comment for each macro you use to see what
40448e5ce07Smrg# version you require.
40548e5ce07Smrgm4_defun([XORG_MACROS_VERSION],[
406c6b4a769Smrgm4_define([vers_have], [1.20.0])
40748e5ce07Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
40848e5ce07Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
40948e5ce07Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
41048e5ce07Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
41148e5ce07Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
41248e5ce07Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
41348e5ce07Smrgm4_undefine([vers_have])
41448e5ce07Smrgm4_undefine([maj_have])
41548e5ce07Smrgm4_undefine([maj_needed])
41648e5ce07Smrg]) # XORG_MACROS_VERSION
41744584a44Smrg
41848e5ce07Smrg# XORG_PROG_RAWCPP()
41948e5ce07Smrg# ------------------
42048e5ce07Smrg# Minimum version: 1.0.0
42144584a44Smrg#
42248e5ce07Smrg# Find cpp program and necessary flags for use in pre-processing text files
42348e5ce07Smrg# such as man pages and config files
42448e5ce07SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
42548e5ce07SmrgAC_REQUIRE([AC_PROG_CPP])
4264e8f48c7SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
42748e5ce07Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
42844584a44Smrg
42948e5ce07Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
43048e5ce07Smrg# which is not the best choice for supporting other OS'es, but covers most
43148e5ce07Smrg# of the ones we need for now.
43248e5ce07SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
43348e5ce07SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
43448e5ce07Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43548e5ce07Smrg	AC_MSG_RESULT([no])
43606c34b88Smrgelse
43748e5ce07Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43848e5ce07Smrg		RAWCPPFLAGS=-undef
43948e5ce07Smrg		AC_MSG_RESULT([yes])
44048e5ce07Smrg	# under Cygwin unix is still defined even with -undef
44148e5ce07Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
44248e5ce07Smrg		RAWCPPFLAGS="-undef -ansi"
44348e5ce07Smrg		AC_MSG_RESULT([yes, with -ansi])
44448e5ce07Smrg	else
44548e5ce07Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
44648e5ce07Smrg	fi
44748e5ce07Smrgfi
44848e5ce07Smrgrm -f conftest.$ac_ext
449c43cc173Smrg
45048e5ce07SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
45148e5ce07SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
45248e5ce07Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45348e5ce07Smrg	AC_MSG_RESULT([no])
45448e5ce07Smrgelse
45548e5ce07Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45648e5ce07Smrg		TRADITIONALCPPFLAGS="-traditional"
45748e5ce07Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
45848e5ce07Smrg		AC_MSG_RESULT([yes])
45948e5ce07Smrg	else
46048e5ce07Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
46148e5ce07Smrg	fi
46248e5ce07Smrgfi
46348e5ce07Smrgrm -f conftest.$ac_ext
46448e5ce07SmrgAC_SUBST(RAWCPPFLAGS)
46548e5ce07SmrgAC_SUBST(TRADITIONALCPPFLAGS)
46648e5ce07Smrg]) # XORG_PROG_RAWCPP
467c43cc173Smrg
46848e5ce07Smrg# XORG_MANPAGE_SECTIONS()
46948e5ce07Smrg# -----------------------
47048e5ce07Smrg# Minimum version: 1.0.0
47144584a44Smrg#
47248e5ce07Smrg# Determine which sections man pages go in for the different man page types
47348e5ce07Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
47448e5ce07Smrg# Not sure if there's any better way than just hardcoding by OS name.
47548e5ce07Smrg# Override default settings by setting environment variables
47648e5ce07Smrg# Added MAN_SUBSTS in version 1.8
47748e5ce07Smrg# Added AC_PROG_SED in version 1.8
478b789ec8aSmrg
47948e5ce07SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
48048e5ce07SmrgAC_REQUIRE([AC_CANONICAL_HOST])
48148e5ce07SmrgAC_REQUIRE([AC_PROG_SED])
482b789ec8aSmrg
4834e8f48c7Smrgcase $host_os in
4844e8f48c7Smrg    solaris*)
4854e8f48c7Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4864e8f48c7Smrg        # check for a man page file found in later versions that use
4874e8f48c7Smrg        # traditional section numbers instead
4884e8f48c7Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4894e8f48c7Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4904e8f48c7Smrg        ;;
4914e8f48c7Smrg    *) SYSV_MAN_SECTIONS=false ;;
4924e8f48c7Smrgesac
4934e8f48c7Smrg
49448e5ce07Smrgif test x$APP_MAN_SUFFIX = x    ; then
49548e5ce07Smrg    APP_MAN_SUFFIX=1
49648e5ce07Smrgfi
49748e5ce07Smrgif test x$APP_MAN_DIR = x    ; then
49848e5ce07Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
49948e5ce07Smrgfi
50044584a44Smrg
50148e5ce07Smrgif test x$LIB_MAN_SUFFIX = x    ; then
50248e5ce07Smrg    LIB_MAN_SUFFIX=3
50348e5ce07Smrgfi
50448e5ce07Smrgif test x$LIB_MAN_DIR = x    ; then
50548e5ce07Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
50648e5ce07Smrgfi
50744584a44Smrg
50848e5ce07Smrgif test x$FILE_MAN_SUFFIX = x    ; then
5094e8f48c7Smrg    case $SYSV_MAN_SECTIONS in
5104e8f48c7Smrg	true)				FILE_MAN_SUFFIX=4  ;;
5114e8f48c7Smrg	*)				FILE_MAN_SUFFIX=5  ;;
51206c34b88Smrg    esac
51306c34b88Smrgfi
51448e5ce07Smrgif test x$FILE_MAN_DIR = x    ; then
51548e5ce07Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
51648e5ce07Smrgfi
51706c34b88Smrg
51848e5ce07Smrgif test x$MISC_MAN_SUFFIX = x    ; then
5194e8f48c7Smrg    case $SYSV_MAN_SECTIONS in
5204e8f48c7Smrg	true)				MISC_MAN_SUFFIX=5  ;;
5214e8f48c7Smrg	*)				MISC_MAN_SUFFIX=7  ;;
52248e5ce07Smrg    esac
52348e5ce07Smrgfi
52448e5ce07Smrgif test x$MISC_MAN_DIR = x    ; then
52548e5ce07Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
52648e5ce07Smrgfi
52706c34b88Smrg
52848e5ce07Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
5294e8f48c7Smrg    case $SYSV_MAN_SECTIONS in
5304e8f48c7Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
5314e8f48c7Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
53248e5ce07Smrg    esac
53348e5ce07Smrgfi
53448e5ce07Smrgif test x$DRIVER_MAN_DIR = x    ; then
53548e5ce07Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
53648e5ce07Smrgfi
53706c34b88Smrg
53848e5ce07Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
5394e8f48c7Smrg    case $SYSV_MAN_SECTIONS in
5404e8f48c7Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
5414e8f48c7Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
54248e5ce07Smrg    esac
54348e5ce07Smrgfi
54448e5ce07Smrgif test x$ADMIN_MAN_DIR = x    ; then
54548e5ce07Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
54644584a44Smrgfi
54706c34b88Smrg
548c43cc173Smrg
54948e5ce07SmrgAC_SUBST([APP_MAN_SUFFIX])
55048e5ce07SmrgAC_SUBST([LIB_MAN_SUFFIX])
55148e5ce07SmrgAC_SUBST([FILE_MAN_SUFFIX])
55248e5ce07SmrgAC_SUBST([MISC_MAN_SUFFIX])
55348e5ce07SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
55448e5ce07SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
55548e5ce07SmrgAC_SUBST([APP_MAN_DIR])
55648e5ce07SmrgAC_SUBST([LIB_MAN_DIR])
55748e5ce07SmrgAC_SUBST([FILE_MAN_DIR])
55848e5ce07SmrgAC_SUBST([MISC_MAN_DIR])
55948e5ce07SmrgAC_SUBST([DRIVER_MAN_DIR])
56048e5ce07SmrgAC_SUBST([ADMIN_MAN_DIR])
561c43cc173Smrg
56248e5ce07SmrgXORG_MAN_PAGE="X Version 11"
56348e5ce07SmrgAC_SUBST([XORG_MAN_PAGE])
56448e5ce07SmrgMAN_SUBSTS="\
56548e5ce07Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
56648e5ce07Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
56748e5ce07Smrg	-e 's|__xservername__|Xorg|g' \
56848e5ce07Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
56948e5ce07Smrg	-e 's|__projectroot__|\$(prefix)|g' \
57048e5ce07Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
57148e5ce07Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
57248e5ce07Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
57348e5ce07Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
57448e5ce07Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
57548e5ce07Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
57648e5ce07Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
57748e5ce07SmrgAC_SUBST([MAN_SUBSTS])
578b789ec8aSmrg
57948e5ce07Smrg]) # XORG_MANPAGE_SECTIONS
580c43cc173Smrg
58148e5ce07Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
58248e5ce07Smrg# ------------------------
58348e5ce07Smrg# Minimum version: 1.7.0
58444584a44Smrg#
58548e5ce07Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
58648e5ce07Smrg# provided by xorg-sgml-doctools, if installed.
58748e5ce07SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
58848e5ce07SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
58948e5ce07SmrgXORG_SGML_PATH=
59048e5ce07SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
59148e5ce07Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
59248e5ce07Smrg    [m4_ifval([$1],[:],
59348e5ce07Smrg        [if test x"$cross_compiling" != x"yes" ; then
59448e5ce07Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
59548e5ce07Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
59648e5ce07Smrg         fi])
59748e5ce07Smrg    ])
598c43cc173Smrg
59948e5ce07Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
60048e5ce07Smrg# the path and the name of the doc stylesheet
60148e5ce07Smrgif test "x$XORG_SGML_PATH" != "x" ; then
60248e5ce07Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
60348e5ce07Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
60448e5ce07Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
60548e5ce07Smrgelse
60648e5ce07Smrg   AC_MSG_RESULT([no])
60748e5ce07Smrgfi
60848e5ce07Smrg
60948e5ce07SmrgAC_SUBST(XORG_SGML_PATH)
61048e5ce07SmrgAC_SUBST(STYLESHEET_SRCDIR)
61148e5ce07SmrgAC_SUBST(XSL_STYLESHEET)
61248e5ce07SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
61348e5ce07Smrg]) # XORG_CHECK_SGML_DOCTOOLS
6143e256790Smrg
61548e5ce07Smrg# XORG_CHECK_LINUXDOC
61648e5ce07Smrg# -------------------
61748e5ce07Smrg# Minimum version: 1.0.0
61806c34b88Smrg#
61948e5ce07Smrg# Defines the variable MAKE_TEXT if the necessary tools and
62048e5ce07Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
62148e5ce07Smrg# Whether or not the necessary tools and files are found can be checked
62248e5ce07Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
62348e5ce07SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
62448e5ce07SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
62548e5ce07SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
626c43cc173Smrg
62748e5ce07SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
628c43cc173Smrg
62948e5ce07SmrgAC_MSG_CHECKING([whether to build documentation])
63021e67964Smrg
63148e5ce07Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
63248e5ce07Smrg   BUILDDOC=yes
63348e5ce07Smrgelse
63448e5ce07Smrg   BUILDDOC=no
63506c34b88Smrgfi
636c43cc173Smrg
63748e5ce07SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
63848e5ce07Smrg
63948e5ce07SmrgAC_MSG_RESULT([$BUILDDOC])
64048e5ce07Smrg
64148e5ce07SmrgAC_MSG_CHECKING([whether to build pdf documentation])
64248e5ce07Smrg
64348e5ce07Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
64448e5ce07Smrg   BUILDPDFDOC=yes
64548e5ce07Smrgelse
64648e5ce07Smrg   BUILDPDFDOC=no
64706c34b88Smrgfi
648c43cc173Smrg
64948e5ce07SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
650c43cc173Smrg
65148e5ce07SmrgAC_MSG_RESULT([$BUILDPDFDOC])
652c43cc173Smrg
65348e5ce07SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
65448e5ce07SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
65548e5ce07SmrgMAKE_PDF="$PS2PDF"
65648e5ce07SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
65721e67964Smrg
65848e5ce07SmrgAC_SUBST(MAKE_TEXT)
65948e5ce07SmrgAC_SUBST(MAKE_PS)
66048e5ce07SmrgAC_SUBST(MAKE_PDF)
66148e5ce07SmrgAC_SUBST(MAKE_HTML)
66248e5ce07Smrg]) # XORG_CHECK_LINUXDOC
66344584a44Smrg
66448e5ce07Smrg# XORG_CHECK_DOCBOOK
66548e5ce07Smrg# -------------------
66648e5ce07Smrg# Minimum version: 1.0.0
66748e5ce07Smrg#
66848e5ce07Smrg# Checks for the ability to build output formats from SGML DocBook source.
66948e5ce07Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
67048e5ce07Smrg# indicates whether the necessary tools and files are found and, if set,
67148e5ce07Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
67248e5ce07SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
67348e5ce07SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
67444584a44Smrg
67548e5ce07SmrgBUILDTXTDOC=no
67648e5ce07SmrgBUILDPDFDOC=no
67748e5ce07SmrgBUILDPSDOC=no
67848e5ce07SmrgBUILDHTMLDOC=no
679f1ee322dSmrg
68048e5ce07SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
68148e5ce07SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
68248e5ce07SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
68348e5ce07SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
68444584a44Smrg
68548e5ce07SmrgAC_MSG_CHECKING([whether to build text documentation])
68648e5ce07Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
68748e5ce07Smrg   test x$BUILD_TXTDOC != xno; then
68848e5ce07Smrg	BUILDTXTDOC=yes
68948e5ce07Smrgfi
69048e5ce07SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
69148e5ce07SmrgAC_MSG_RESULT([$BUILDTXTDOC])
69244584a44Smrg
69348e5ce07SmrgAC_MSG_CHECKING([whether to build PDF documentation])
69448e5ce07Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
69548e5ce07Smrg   test x$BUILD_PDFDOC != xno; then
69648e5ce07Smrg	BUILDPDFDOC=yes
69748e5ce07Smrgfi
69848e5ce07SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
69948e5ce07SmrgAC_MSG_RESULT([$BUILDPDFDOC])
70044584a44Smrg
70148e5ce07SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
70248e5ce07Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
70348e5ce07Smrg   test x$BUILD_PSDOC != xno; then
70448e5ce07Smrg	BUILDPSDOC=yes
70548e5ce07Smrgfi
70648e5ce07SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
70748e5ce07SmrgAC_MSG_RESULT([$BUILDPSDOC])
708f1ee322dSmrg
70948e5ce07SmrgAC_MSG_CHECKING([whether to build HTML documentation])
71048e5ce07Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
71148e5ce07Smrg   test x$BUILD_HTMLDOC != xno; then
71248e5ce07Smrg	BUILDHTMLDOC=yes
71348e5ce07Smrgfi
71448e5ce07SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
71548e5ce07SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
716f1ee322dSmrg
71748e5ce07SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
71848e5ce07SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
71948e5ce07SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
72048e5ce07SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
721f1ee322dSmrg
72248e5ce07SmrgAC_SUBST(MAKE_TEXT)
72348e5ce07SmrgAC_SUBST(MAKE_PS)
72448e5ce07SmrgAC_SUBST(MAKE_PDF)
72548e5ce07SmrgAC_SUBST(MAKE_HTML)
72648e5ce07Smrg]) # XORG_CHECK_DOCBOOK
72744584a44Smrg
72848e5ce07Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
72948e5ce07Smrg# ----------------
73048e5ce07Smrg# Minimum version: 1.5.0
73148e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.11.0
73206c34b88Smrg#
73348e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
73448e5ce07Smrg# not at the appropriate level. This macro enables a module to test for the
73548e5ce07Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
736c6b4a769Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
73748e5ce07Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
73848e5ce07Smrg# --with-xmlto assumes 'auto'.
73906c34b88Smrg#
74048e5ce07Smrg# Interface to module:
74148e5ce07Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
74248e5ce07Smrg# XMLTO:	returns the path of the xmlto program found
74348e5ce07Smrg#		returns the path set by the user in the environment
74448e5ce07Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
74548e5ce07Smrg#		'no' user instructs the module not to use xmlto
74648e5ce07Smrg#
74748e5ce07Smrg# Added in version 1.10.0
74848e5ce07Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
74948e5ce07Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
75048e5ce07Smrg#
75148e5ce07Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
75248e5ce07Smrg#
75348e5ce07SmrgAC_DEFUN([XORG_WITH_XMLTO],[
75448e5ce07SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
75548e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
75648e5ce07SmrgAC_ARG_WITH(xmlto,
75748e5ce07Smrg	AS_HELP_STRING([--with-xmlto],
75848e5ce07Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
75948e5ce07Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
76048e5ce07Smrgm4_undefine([_defopt])
761f1ee322dSmrg
76248e5ce07Smrgif test "x$use_xmlto" = x"auto"; then
76348e5ce07Smrg   AC_PATH_PROG([XMLTO], [xmlto])
76448e5ce07Smrg   if test "x$XMLTO" = "x"; then
76548e5ce07Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
76648e5ce07Smrg	have_xmlto=no
76748e5ce07Smrg   else
76848e5ce07Smrg        have_xmlto=yes
76948e5ce07Smrg   fi
77048e5ce07Smrgelif test "x$use_xmlto" = x"yes" ; then
77148e5ce07Smrg   AC_PATH_PROG([XMLTO], [xmlto])
77248e5ce07Smrg   if test "x$XMLTO" = "x"; then
77348e5ce07Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
77448e5ce07Smrg   fi
77548e5ce07Smrg   have_xmlto=yes
77648e5ce07Smrgelif test "x$use_xmlto" = x"no" ; then
77748e5ce07Smrg   if test "x$XMLTO" != "x"; then
77848e5ce07Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
77948e5ce07Smrg   fi
78048e5ce07Smrg   have_xmlto=no
78106c34b88Smrgelse
78248e5ce07Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
78306c34b88Smrgfi
784f1ee322dSmrg
78548e5ce07Smrg# Test for a minimum version of xmlto, if provided.
78648e5ce07Smrgm4_ifval([$1],
78748e5ce07Smrg[if test "$have_xmlto" = yes; then
78848e5ce07Smrg    # scrape the xmlto version
78948e5ce07Smrg    AC_MSG_CHECKING([the xmlto version])
79048e5ce07Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
79148e5ce07Smrg    AC_MSG_RESULT([$xmlto_version])
79248e5ce07Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
79348e5ce07Smrg        [if test "x$use_xmlto" = xauto; then
79448e5ce07Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
79548e5ce07Smrg            have_xmlto=no
79648e5ce07Smrg        else
79748e5ce07Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
79848e5ce07Smrg        fi])
79948e5ce07Smrgfi])
80006c34b88Smrg
80148e5ce07Smrg# Test for the ability of xmlto to generate a text target
8024940c694Smrg#
8034940c694Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
8044940c694Smrg# following test for empty XML docbook files.
8054940c694Smrg# For compatibility reasons use the following empty XML docbook file and if
8064940c694Smrg# it fails try it again with a non-empty XML file.
80748e5ce07Smrghave_xmlto_text=no
80848e5ce07Smrgcat > conftest.xml << "EOF"
80948e5ce07SmrgEOF
81048e5ce07SmrgAS_IF([test "$have_xmlto" = yes],
81148e5ce07Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
81248e5ce07Smrg             [have_xmlto_text=yes],
8134940c694Smrg             [# Try it again with a non-empty XML file.
8144940c694Smrg              cat > conftest.xml << "EOF"
8154940c694Smrg<x></x>
8164940c694SmrgEOF
8174940c694Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8184940c694Smrg                    [have_xmlto_text=yes],
8194940c694Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
82048e5ce07Smrgrm -f conftest.xml
82148e5ce07SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
82248e5ce07SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
82348e5ce07Smrg]) # XORG_WITH_XMLTO
824f1ee322dSmrg
82548e5ce07Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
82648e5ce07Smrg# --------------------------------------------
82748e5ce07Smrg# Minimum version: 1.12.0
82848e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.12.0
82906c34b88Smrg#
83048e5ce07Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
83148e5ce07Smrg# XML-based language used for the transformation of XML documents.
83248e5ce07Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
83348e5ce07Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
83448e5ce07Smrg# The XSLT processor is often used as a standalone tool for transformations.
83548e5ce07Smrg# It should not be assumed that this tool is used only to work with documnetation.
83648e5ce07Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
83748e5ce07Smrg#
83848e5ce07Smrg# Interface to module:
83948e5ce07Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
84048e5ce07Smrg# XSLTPROC:	 returns the path of the xsltproc program found
84148e5ce07Smrg#		 returns the path set by the user in the environment
84248e5ce07Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
84348e5ce07Smrg#		  'no' user instructs the module not to use xsltproc
84448e5ce07Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
84548e5ce07Smrg#
84648e5ce07Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
84748e5ce07Smrg#
84848e5ce07SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
84948e5ce07SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
85048e5ce07Smrg# Preserves the interface, should it be implemented later
85148e5ce07Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
85248e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
85348e5ce07SmrgAC_ARG_WITH(xsltproc,
85448e5ce07Smrg	AS_HELP_STRING([--with-xsltproc],
85548e5ce07Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
85648e5ce07Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
85748e5ce07Smrgm4_undefine([_defopt])
85844584a44Smrg
85948e5ce07Smrgif test "x$use_xsltproc" = x"auto"; then
86048e5ce07Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
86148e5ce07Smrg   if test "x$XSLTPROC" = "x"; then
86248e5ce07Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
86348e5ce07Smrg	have_xsltproc=no
86448e5ce07Smrg   else
86548e5ce07Smrg        have_xsltproc=yes
86648e5ce07Smrg   fi
86748e5ce07Smrgelif test "x$use_xsltproc" = x"yes" ; then
86848e5ce07Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
86948e5ce07Smrg   if test "x$XSLTPROC" = "x"; then
87048e5ce07Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
87148e5ce07Smrg   fi
87248e5ce07Smrg   have_xsltproc=yes
87348e5ce07Smrgelif test "x$use_xsltproc" = x"no" ; then
87448e5ce07Smrg   if test "x$XSLTPROC" != "x"; then
87548e5ce07Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
87648e5ce07Smrg   fi
87748e5ce07Smrg   have_xsltproc=no
878f1ee322dSmrgelse
87948e5ce07Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
880f1ee322dSmrgfi
881f1ee322dSmrg
88248e5ce07SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
88348e5ce07Smrg]) # XORG_WITH_XSLTPROC
88444584a44Smrg
88548e5ce07Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
88648e5ce07Smrg# ----------------------------------------
88748e5ce07Smrg# Minimum version: 1.15.0
88806c34b88Smrg#
88948e5ce07Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
89048e5ce07Smrg# scanning arbitrary text files, extracting information from those text files,
89148e5ce07Smrg# and printing reports based on that information.
89206c34b88Smrg#
89348e5ce07Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
89448e5ce07Smrg#
89548e5ce07Smrg# Interface to module:
89648e5ce07Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
89748e5ce07Smrg# PERL:	     returns the path of the perl program found
89848e5ce07Smrg#	     returns the path set by the user in the environment
89948e5ce07Smrg# --with-perl: 'yes' user instructs the module to use perl
90048e5ce07Smrg#	       'no' user instructs the module not to use perl
90148e5ce07Smrg# have_perl: returns yes if perl found in PATH or no
90248e5ce07Smrg#
90348e5ce07Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
90448e5ce07Smrg#
90548e5ce07SmrgAC_DEFUN([XORG_WITH_PERL],[
90648e5ce07SmrgAC_ARG_VAR([PERL], [Path to perl command])
90748e5ce07Smrg# Preserves the interface, should it be implemented later
90848e5ce07Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
90948e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
91048e5ce07SmrgAC_ARG_WITH(perl,
91148e5ce07Smrg	AS_HELP_STRING([--with-perl],
91248e5ce07Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
91348e5ce07Smrg	   [use_perl=$withval], [use_perl=]_defopt)
91448e5ce07Smrgm4_undefine([_defopt])
91544584a44Smrg
91648e5ce07Smrgif test "x$use_perl" = x"auto"; then
91748e5ce07Smrg   AC_PATH_PROG([PERL], [perl])
91848e5ce07Smrg   if test "x$PERL" = "x"; then
91948e5ce07Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
92048e5ce07Smrg	have_perl=no
92148e5ce07Smrg   else
92248e5ce07Smrg        have_perl=yes
92348e5ce07Smrg   fi
92448e5ce07Smrgelif test "x$use_perl" = x"yes" ; then
92548e5ce07Smrg   AC_PATH_PROG([PERL], [perl])
92648e5ce07Smrg   if test "x$PERL" = "x"; then
92748e5ce07Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
92848e5ce07Smrg   fi
92948e5ce07Smrg   have_perl=yes
93048e5ce07Smrgelif test "x$use_perl" = x"no" ; then
93148e5ce07Smrg   if test "x$PERL" != "x"; then
93248e5ce07Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
93348e5ce07Smrg   fi
93448e5ce07Smrg   have_perl=no
93548e5ce07Smrgelse
93648e5ce07Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
93744584a44Smrgfi
93844584a44Smrg
93948e5ce07SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
94048e5ce07Smrg]) # XORG_WITH_PERL
94144584a44Smrg
94248e5ce07Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
94348e5ce07Smrg# ----------------
94448e5ce07Smrg# Minimum version: 1.5.0
94548e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.11.0
94606c34b88Smrg#
94748e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
94848e5ce07Smrg# not at the appropriate level. This macro enables a module to test for the
94948e5ce07Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
950c6b4a769Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
95148e5ce07Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
95248e5ce07Smrg# --with-asciidoc assumes 'auto'.
95348e5ce07Smrg#
95448e5ce07Smrg# Interface to module:
95548e5ce07Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
95648e5ce07Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
95748e5ce07Smrg#		 returns the path set by the user in the environment
95848e5ce07Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
95948e5ce07Smrg#		  'no' user instructs the module not to use asciidoc
96048e5ce07Smrg#
96148e5ce07Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
96248e5ce07Smrg#
96348e5ce07SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
96448e5ce07SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
96548e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
96648e5ce07SmrgAC_ARG_WITH(asciidoc,
96748e5ce07Smrg	AS_HELP_STRING([--with-asciidoc],
96848e5ce07Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
96948e5ce07Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
97048e5ce07Smrgm4_undefine([_defopt])
971f1ee322dSmrg
97248e5ce07Smrgif test "x$use_asciidoc" = x"auto"; then
97348e5ce07Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
97448e5ce07Smrg   if test "x$ASCIIDOC" = "x"; then
97548e5ce07Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
97648e5ce07Smrg	have_asciidoc=no
97748e5ce07Smrg   else
97848e5ce07Smrg        have_asciidoc=yes
97948e5ce07Smrg   fi
98048e5ce07Smrgelif test "x$use_asciidoc" = x"yes" ; then
98148e5ce07Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
98248e5ce07Smrg   if test "x$ASCIIDOC" = "x"; then
98348e5ce07Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
98448e5ce07Smrg   fi
98548e5ce07Smrg   have_asciidoc=yes
98648e5ce07Smrgelif test "x$use_asciidoc" = x"no" ; then
98748e5ce07Smrg   if test "x$ASCIIDOC" != "x"; then
98848e5ce07Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
98948e5ce07Smrg   fi
99048e5ce07Smrg   have_asciidoc=no
99148e5ce07Smrgelse
99248e5ce07Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
99348e5ce07Smrgfi
99448e5ce07Smrgm4_ifval([$1],
99548e5ce07Smrg[if test "$have_asciidoc" = yes; then
99648e5ce07Smrg    # scrape the asciidoc version
99748e5ce07Smrg    AC_MSG_CHECKING([the asciidoc version])
99848e5ce07Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
99948e5ce07Smrg    AC_MSG_RESULT([$asciidoc_version])
100048e5ce07Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
100148e5ce07Smrg        [if test "x$use_asciidoc" = xauto; then
100248e5ce07Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
100348e5ce07Smrg            have_asciidoc=no
100448e5ce07Smrg        else
100548e5ce07Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
100648e5ce07Smrg        fi])
100748e5ce07Smrgfi])
100848e5ce07SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
100948e5ce07Smrg]) # XORG_WITH_ASCIIDOC
101044584a44Smrg
101148e5ce07Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
101248e5ce07Smrg# -------------------------------------------
101348e5ce07Smrg# Minimum version: 1.5.0
101448e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.11.0
101548e5ce07Smrg# Minimum version for optional DOT checking: 1.18.0
101606c34b88Smrg#
101748e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
101848e5ce07Smrg# not at the appropriate level. This macro enables a module to test for the
101948e5ce07Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1020c6b4a769Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
102148e5ce07Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
102248e5ce07Smrg# --with-doxygen assumes 'auto'.
102348e5ce07Smrg#
102448e5ce07Smrg# Interface to module:
102548e5ce07Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
102648e5ce07Smrg# DOXYGEN:	 returns the path of the doxygen program found
102748e5ce07Smrg#		 returns the path set by the user in the environment
102848e5ce07Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
102948e5ce07Smrg#		  'no' user instructs the module not to use doxygen
103048e5ce07Smrg#
103148e5ce07Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
103248e5ce07Smrg#
103348e5ce07SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
103448e5ce07SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
103548e5ce07SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
103648e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
103748e5ce07SmrgAC_ARG_WITH(doxygen,
103848e5ce07Smrg	AS_HELP_STRING([--with-doxygen],
103948e5ce07Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
104048e5ce07Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
104148e5ce07Smrgm4_undefine([_defopt])
1042f1ee322dSmrg
104348e5ce07Smrgif test "x$use_doxygen" = x"auto"; then
104448e5ce07Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
104548e5ce07Smrg   if test "x$DOXYGEN" = "x"; then
104648e5ce07Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
104748e5ce07Smrg	have_doxygen=no
104848e5ce07Smrg   else
104948e5ce07Smrg        have_doxygen=yes
105048e5ce07Smrg   fi
105148e5ce07Smrgelif test "x$use_doxygen" = x"yes" ; then
105248e5ce07Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
105348e5ce07Smrg   if test "x$DOXYGEN" = "x"; then
105448e5ce07Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
105548e5ce07Smrg   fi
105648e5ce07Smrg   have_doxygen=yes
105748e5ce07Smrgelif test "x$use_doxygen" = x"no" ; then
105848e5ce07Smrg   if test "x$DOXYGEN" != "x"; then
105948e5ce07Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
106048e5ce07Smrg   fi
106148e5ce07Smrg   have_doxygen=no
106248e5ce07Smrgelse
106348e5ce07Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
106448e5ce07Smrgfi
106548e5ce07Smrgm4_ifval([$1],
106648e5ce07Smrg[if test "$have_doxygen" = yes; then
106748e5ce07Smrg    # scrape the doxygen version
106848e5ce07Smrg    AC_MSG_CHECKING([the doxygen version])
106948e5ce07Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
107048e5ce07Smrg    AC_MSG_RESULT([$doxygen_version])
107148e5ce07Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
107248e5ce07Smrg        [if test "x$use_doxygen" = xauto; then
107348e5ce07Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
107448e5ce07Smrg            have_doxygen=no
107548e5ce07Smrg        else
107648e5ce07Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
107748e5ce07Smrg        fi])
107848e5ce07Smrgfi])
107944584a44Smrg
108048e5ce07Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
108148e5ce07Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
108248e5ce07Smrgdnl 	HAVE_DOT = @HAVE_DOT@
108348e5ce07SmrgHAVE_DOT=no
108448e5ce07Smrgif test "x$have_doxygen" = "xyes"; then
108548e5ce07Smrg  AC_PATH_PROG([DOT], [dot])
108648e5ce07Smrg    if test "x$DOT" != "x"; then
108748e5ce07Smrg      HAVE_DOT=yes
108848e5ce07Smrg    fi
108948e5ce07Smrgfi
109044584a44Smrg
109148e5ce07SmrgAC_SUBST([HAVE_DOT])
109248e5ce07SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
109348e5ce07SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
109448e5ce07Smrg]) # XORG_WITH_DOXYGEN
109548e5ce07Smrg
109648e5ce07Smrg# XORG_WITH_GROFF([DEFAULT])
109748e5ce07Smrg# ----------------
109848e5ce07Smrg# Minimum version: 1.6.0
109948e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.11.0
110048e5ce07Smrg#
110148e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
110248e5ce07Smrg# not at the appropriate level. This macro enables a module to test for the
110348e5ce07Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1104c6b4a769Smrg# the --with-groff option, it allows maximum flexibility in making decisions
110548e5ce07Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
110648e5ce07Smrg# --with-groff assumes 'auto'.
110748e5ce07Smrg#
110848e5ce07Smrg# Interface to module:
110948e5ce07Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
111048e5ce07Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
111148e5ce07Smrg# HAVE_GROFF_MS: the -ms macros package
111248e5ce07Smrg# GROFF:	 returns the path of the groff program found
111348e5ce07Smrg#		 returns the path set by the user in the environment
111448e5ce07Smrg# --with-groff:	 'yes' user instructs the module to use groff
111548e5ce07Smrg#		 'no' user instructs the module not to use groff
111648e5ce07Smrg#
111748e5ce07Smrg# Added in version 1.9.0:
111848e5ce07Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
111948e5ce07Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
112048e5ce07Smrg#		   psselect from the psutils package.
112148e5ce07Smrg#		   the ghostcript package. Refer to the grohtml man pages
112248e5ce07Smrg#
112348e5ce07Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
112448e5ce07Smrg#
112548e5ce07Smrg# OS and distros often splits groff in a basic and full package, the former
112648e5ce07Smrg# having the groff program and the later having devices, fonts and macros
112748e5ce07Smrg# Checking for the groff executable is not enough.
112848e5ce07Smrg#
112948e5ce07Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
113048e5ce07Smrg# unset HAVE_GROFF or GROFF env variables.
113148e5ce07Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
113248e5ce07Smrg#
113348e5ce07SmrgAC_DEFUN([XORG_WITH_GROFF],[
113448e5ce07SmrgAC_ARG_VAR([GROFF], [Path to groff command])
113548e5ce07Smrgm4_define([_defopt], m4_default([$1], [auto]))
113648e5ce07SmrgAC_ARG_WITH(groff,
113748e5ce07Smrg	AS_HELP_STRING([--with-groff],
113848e5ce07Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
113948e5ce07Smrg	   [use_groff=$withval], [use_groff=]_defopt)
114048e5ce07Smrgm4_undefine([_defopt])
114148e5ce07Smrg
114248e5ce07Smrgif test "x$use_groff" = x"auto"; then
114348e5ce07Smrg   AC_PATH_PROG([GROFF], [groff])
114448e5ce07Smrg   if test "x$GROFF" = "x"; then
114548e5ce07Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
114648e5ce07Smrg	have_groff=no
114748e5ce07Smrg   else
114848e5ce07Smrg        have_groff=yes
114948e5ce07Smrg   fi
115048e5ce07Smrgelif test "x$use_groff" = x"yes" ; then
115148e5ce07Smrg   AC_PATH_PROG([GROFF], [groff])
115248e5ce07Smrg   if test "x$GROFF" = "x"; then
115348e5ce07Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
115448e5ce07Smrg   fi
115548e5ce07Smrg   have_groff=yes
115648e5ce07Smrgelif test "x$use_groff" = x"no" ; then
115748e5ce07Smrg   if test "x$GROFF" != "x"; then
115848e5ce07Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
115948e5ce07Smrg   fi
116048e5ce07Smrg   have_groff=no
116106c34b88Smrgelse
116248e5ce07Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11633e256790Smrgfi
116448e5ce07Smrg
116548e5ce07Smrg# We have groff, test for the presence of the macro packages
116648e5ce07Smrgif test "x$have_groff" = x"yes"; then
116748e5ce07Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
116848e5ce07Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
116948e5ce07Smrg        groff_ms_works=yes
117048e5ce07Smrg    else
117148e5ce07Smrg        groff_ms_works=no
117248e5ce07Smrg    fi
117348e5ce07Smrg    AC_MSG_RESULT([$groff_ms_works])
117448e5ce07Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
117548e5ce07Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
117648e5ce07Smrg        groff_mm_works=yes
117748e5ce07Smrg    else
117848e5ce07Smrg        groff_mm_works=no
117948e5ce07Smrg    fi
118048e5ce07Smrg    AC_MSG_RESULT([$groff_mm_works])
118106c34b88Smrgfi
118248e5ce07Smrg
118348e5ce07Smrg# We have groff, test for HTML dependencies, one command per package
118448e5ce07Smrgif test "x$have_groff" = x"yes"; then
118548e5ce07Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
118648e5ce07Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
118748e5ce07Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
118848e5ce07Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
118948e5ce07Smrg      have_groff_html=yes
119048e5ce07Smrg   else
119148e5ce07Smrg      have_groff_html=no
119248e5ce07Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
119348e5ce07Smrg   fi
119448e5ce07Smrgfi
119548e5ce07Smrg
119648e5ce07Smrg# Set Automake conditionals for Makefiles
119748e5ce07SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
119848e5ce07SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
119948e5ce07SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
120048e5ce07SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
120148e5ce07Smrg]) # XORG_WITH_GROFF
120248e5ce07Smrg
120348e5ce07Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
120448e5ce07Smrg# ---------------------------------------
120548e5ce07Smrg# Minimum version: 1.6.0
120648e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.11.0
120748e5ce07Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
120848e5ce07Smrg#
120948e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
121048e5ce07Smrg# not at the appropriate level. This macro enables a module to test for the
121148e5ce07Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1212c6b4a769Smrg# the --with-fop option, it allows maximum flexibility in making decisions
121348e5ce07Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
121448e5ce07Smrg# --with-fop assumes 'auto'.
121548e5ce07Smrg#
121648e5ce07Smrg# Interface to module:
121748e5ce07Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
121848e5ce07Smrg# FOP:	 	returns the path of the fop program found
121948e5ce07Smrg#		returns the path set by the user in the environment
122048e5ce07Smrg# --with-fop: 	'yes' user instructs the module to use fop
122148e5ce07Smrg#		'no' user instructs the module not to use fop
122248e5ce07Smrg#
122348e5ce07Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
122448e5ce07Smrg#
122548e5ce07SmrgAC_DEFUN([XORG_WITH_FOP],[
122648e5ce07SmrgAC_ARG_VAR([FOP], [Path to fop command])
122748e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
122848e5ce07SmrgAC_ARG_WITH(fop,
122948e5ce07Smrg	AS_HELP_STRING([--with-fop],
123048e5ce07Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
123148e5ce07Smrg	   [use_fop=$withval], [use_fop=]_defopt)
123248e5ce07Smrgm4_undefine([_defopt])
123348e5ce07Smrg
123448e5ce07Smrgif test "x$use_fop" = x"auto"; then
123548e5ce07Smrg   AC_PATH_PROG([FOP], [fop])
123648e5ce07Smrg   if test "x$FOP" = "x"; then
123748e5ce07Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
123848e5ce07Smrg	have_fop=no
123948e5ce07Smrg   else
124048e5ce07Smrg        have_fop=yes
124148e5ce07Smrg   fi
124248e5ce07Smrgelif test "x$use_fop" = x"yes" ; then
124348e5ce07Smrg   AC_PATH_PROG([FOP], [fop])
124448e5ce07Smrg   if test "x$FOP" = "x"; then
124548e5ce07Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
124606c34b88Smrg   fi
124748e5ce07Smrg   have_fop=yes
124848e5ce07Smrgelif test "x$use_fop" = x"no" ; then
124948e5ce07Smrg   if test "x$FOP" != "x"; then
125048e5ce07Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
125148e5ce07Smrg   fi
125248e5ce07Smrg   have_fop=no
125344584a44Smrgelse
125448e5ce07Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
125544584a44Smrgfi
125637eb1ca1Smrg
125748e5ce07Smrg# Test for a minimum version of fop, if provided.
125848e5ce07Smrgm4_ifval([$1],
125948e5ce07Smrg[if test "$have_fop" = yes; then
126048e5ce07Smrg    # scrape the fop version
126148e5ce07Smrg    AC_MSG_CHECKING([for fop minimum version])
126248e5ce07Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
126348e5ce07Smrg    AC_MSG_RESULT([$fop_version])
126448e5ce07Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
126548e5ce07Smrg        [if test "x$use_fop" = xauto; then
126648e5ce07Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
126748e5ce07Smrg            have_fop=no
126848e5ce07Smrg        else
126948e5ce07Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
127048e5ce07Smrg        fi])
127148e5ce07Smrgfi])
127248e5ce07SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
127348e5ce07Smrg]) # XORG_WITH_FOP
127448e5ce07Smrg
127548e5ce07Smrg# XORG_WITH_M4([MIN-VERSION])
127648e5ce07Smrg# ---------------------------
127748e5ce07Smrg# Minimum version: 1.19.0
127806c34b88Smrg#
127948e5ce07Smrg# This macro attempts to locate an m4 macro processor which supports
128048e5ce07Smrg# -I option and is only useful for modules relying on M4 in order to
128148e5ce07Smrg# expand macros in source code files.
128248e5ce07Smrg#
128348e5ce07Smrg# Interface to module:
128448e5ce07Smrg# M4:	 	returns the path of the m4 program found
128548e5ce07Smrg#		returns the path set by the user in the environment
128648e5ce07Smrg#
128748e5ce07SmrgAC_DEFUN([XORG_WITH_M4], [
128848e5ce07SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
128948e5ce07Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
129048e5ce07Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
129148e5ce07Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
129248e5ce07Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
129348e5ce07Smrg   [$PATH:/usr/gnu/bin])])
129437eb1ca1Smrg
129548e5ce07SmrgAC_SUBST([M4], [$ac_cv_path_M4])
129648e5ce07Smrg]) # XORG_WITH_M4
129737eb1ca1Smrg
129848e5ce07Smrg# XORG_WITH_PS2PDF([DEFAULT])
129948e5ce07Smrg# ----------------
130048e5ce07Smrg# Minimum version: 1.6.0
130148e5ce07Smrg# Minimum version for optional DEFAULT argument: 1.11.0
130206c34b88Smrg#
130348e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
130448e5ce07Smrg# not at the appropriate level. This macro enables a module to test for the
130548e5ce07Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1306c6b4a769Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
130748e5ce07Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
130848e5ce07Smrg# --with-ps2pdf assumes 'auto'.
130948e5ce07Smrg#
131048e5ce07Smrg# Interface to module:
131148e5ce07Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
131248e5ce07Smrg# PS2PDF:	returns the path of the ps2pdf program found
131348e5ce07Smrg#		returns the path set by the user in the environment
131448e5ce07Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
131548e5ce07Smrg#		 'no' user instructs the module not to use ps2pdf
131648e5ce07Smrg#
131748e5ce07Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
131848e5ce07Smrg#
131948e5ce07SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
132048e5ce07SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
132148e5ce07Smrgm4_define([_defopt], m4_default([$1], [auto]))
132248e5ce07SmrgAC_ARG_WITH(ps2pdf,
132348e5ce07Smrg	AS_HELP_STRING([--with-ps2pdf],
132448e5ce07Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
132548e5ce07Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
132648e5ce07Smrgm4_undefine([_defopt])
132744584a44Smrg
132848e5ce07Smrgif test "x$use_ps2pdf" = x"auto"; then
132948e5ce07Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
133048e5ce07Smrg   if test "x$PS2PDF" = "x"; then
133148e5ce07Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
133248e5ce07Smrg	have_ps2pdf=no
133348e5ce07Smrg   else
133448e5ce07Smrg        have_ps2pdf=yes
133548e5ce07Smrg   fi
133648e5ce07Smrgelif test "x$use_ps2pdf" = x"yes" ; then
133748e5ce07Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
133848e5ce07Smrg   if test "x$PS2PDF" = "x"; then
133948e5ce07Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
134048e5ce07Smrg   fi
134148e5ce07Smrg   have_ps2pdf=yes
134248e5ce07Smrgelif test "x$use_ps2pdf" = x"no" ; then
134348e5ce07Smrg   if test "x$PS2PDF" != "x"; then
134448e5ce07Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
134548e5ce07Smrg   fi
134648e5ce07Smrg   have_ps2pdf=no
134748e5ce07Smrgelse
134848e5ce07Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
134948e5ce07Smrgfi
135048e5ce07SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
135148e5ce07Smrg]) # XORG_WITH_PS2PDF
135244584a44Smrg
135348e5ce07Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
135448e5ce07Smrg# ----------------
135548e5ce07Smrg# Minimum version: 1.6.0
135648e5ce07Smrg#
135748e5ce07Smrg# Documentation tools are not always available on all platforms and sometimes
135848e5ce07Smrg# not at the appropriate level. This macro enables a builder to skip all
135948e5ce07Smrg# documentation targets except traditional man pages.
136048e5ce07Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1361c6b4a769Smrg# maximum flexibility in controlling documentation building.
136248e5ce07Smrg# Refer to:
136348e5ce07Smrg# XORG_WITH_XMLTO         --with-xmlto
136448e5ce07Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
136548e5ce07Smrg# XORG_WITH_DOXYGEN       --with-doxygen
136648e5ce07Smrg# XORG_WITH_FOP           --with-fop
136748e5ce07Smrg# XORG_WITH_GROFF         --with-groff
136848e5ce07Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
136948e5ce07Smrg#
137048e5ce07Smrg# Interface to module:
137148e5ce07Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
137248e5ce07Smrg# --enable-docs: 'yes' user instructs the module to generate docs
137348e5ce07Smrg#		 'no' user instructs the module not to generate docs
137448e5ce07Smrg# parm1:	specify the default value, yes or no.
137548e5ce07Smrg#
137648e5ce07SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
137748e5ce07Smrgm4_define([docs_default], m4_default([$1], [yes]))
137848e5ce07SmrgAC_ARG_ENABLE(docs,
137948e5ce07Smrg	AS_HELP_STRING([--enable-docs],
138048e5ce07Smrg	   [Enable building the documentation (default: ]docs_default[)]),
138148e5ce07Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
138248e5ce07Smrgm4_undefine([docs_default])
138348e5ce07SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
138448e5ce07SmrgAC_MSG_CHECKING([whether to build documentation])
138548e5ce07SmrgAC_MSG_RESULT([$build_docs])
138648e5ce07Smrg]) # XORG_ENABLE_DOCS
138744584a44Smrg
138848e5ce07Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
138948e5ce07Smrg# ----------------
139048e5ce07Smrg# Minimum version: 1.6.0
139148e5ce07Smrg#
139248e5ce07Smrg# This macro enables a builder to skip all developer documentation.
139348e5ce07Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1394c6b4a769Smrg# maximum flexibility in controlling documentation building.
139548e5ce07Smrg# Refer to:
139648e5ce07Smrg# XORG_WITH_XMLTO         --with-xmlto
139748e5ce07Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
139848e5ce07Smrg# XORG_WITH_DOXYGEN       --with-doxygen
139948e5ce07Smrg# XORG_WITH_FOP           --with-fop
140048e5ce07Smrg# XORG_WITH_GROFF         --with-groff
140148e5ce07Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
140248e5ce07Smrg#
140348e5ce07Smrg# Interface to module:
140448e5ce07Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
140548e5ce07Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
140648e5ce07Smrg#			'no' user instructs the module not to generate developer docs
140748e5ce07Smrg# parm1:		specify the default value, yes or no.
140848e5ce07Smrg#
140948e5ce07SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
141048e5ce07Smrgm4_define([devel_default], m4_default([$1], [yes]))
141148e5ce07SmrgAC_ARG_ENABLE(devel-docs,
141248e5ce07Smrg	AS_HELP_STRING([--enable-devel-docs],
141348e5ce07Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
141448e5ce07Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
141548e5ce07Smrgm4_undefine([devel_default])
141648e5ce07SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
141748e5ce07SmrgAC_MSG_CHECKING([whether to build developer documentation])
141848e5ce07SmrgAC_MSG_RESULT([$build_devel_docs])
141948e5ce07Smrg]) # XORG_ENABLE_DEVEL_DOCS
142044584a44Smrg
142148e5ce07Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
142248e5ce07Smrg# ----------------
142348e5ce07Smrg# Minimum version: 1.6.0
142406c34b88Smrg#
142548e5ce07Smrg# This macro enables a builder to skip all functional specification targets.
142648e5ce07Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1427c6b4a769Smrg# maximum flexibility in controlling documentation building.
142848e5ce07Smrg# Refer to:
142948e5ce07Smrg# XORG_WITH_XMLTO         --with-xmlto
143048e5ce07Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
143148e5ce07Smrg# XORG_WITH_DOXYGEN       --with-doxygen
143248e5ce07Smrg# XORG_WITH_FOP           --with-fop
143348e5ce07Smrg# XORG_WITH_GROFF         --with-groff
143448e5ce07Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
143548e5ce07Smrg#
143648e5ce07Smrg# Interface to module:
143748e5ce07Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
143848e5ce07Smrg# --enable-specs:	'yes' user instructs the module to generate specs
143948e5ce07Smrg#			'no' user instructs the module not to generate specs
144048e5ce07Smrg# parm1:		specify the default value, yes or no.
144148e5ce07Smrg#
144248e5ce07SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
144348e5ce07Smrgm4_define([spec_default], m4_default([$1], [yes]))
144448e5ce07SmrgAC_ARG_ENABLE(specs,
144548e5ce07Smrg	AS_HELP_STRING([--enable-specs],
144648e5ce07Smrg	   [Enable building the specs (default: ]spec_default[)]),
144748e5ce07Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
144848e5ce07Smrgm4_undefine([spec_default])
144948e5ce07SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
145048e5ce07SmrgAC_MSG_CHECKING([whether to build functional specifications])
145148e5ce07SmrgAC_MSG_RESULT([$build_specs])
145248e5ce07Smrg]) # XORG_ENABLE_SPECS
1453f1ee322dSmrg
145448e5ce07Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
145548e5ce07Smrg# ----------------------------------------------
145648e5ce07Smrg# Minimum version: 1.13.0
145789069ce9Smrg#
145848e5ce07Smrg# This macro enables a builder to enable/disable unit testing
145948e5ce07Smrg# It makes no assumption about the test cases implementation
146048e5ce07Smrg# Test cases may or may not use Automake "Support for test suites"
146148e5ce07Smrg# They may or may not use the software utility library GLib
146289069ce9Smrg#
146348e5ce07Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
146448e5ce07Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
146548e5ce07Smrg# The variable enable_unit_tests is used by other macros in this file.
146689069ce9Smrg#
146748e5ce07Smrg# Interface to module:
146848e5ce07Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
146948e5ce07Smrg# enable_unit_tests:    used in configure.ac for additional configuration
147048e5ce07Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
147148e5ce07Smrg#			'no' user instructs the module not to build tests
147248e5ce07Smrg# parm1:		specify the default value, yes or no.
147348e5ce07Smrg#
147448e5ce07SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
147548e5ce07SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
147648e5ce07SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
147748e5ce07SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
147848e5ce07Smrgm4_define([_defopt], m4_default([$1], [auto]))
147948e5ce07SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
148048e5ce07Smrg	[Enable building unit test cases (default: ]_defopt[)]),
148148e5ce07Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
148248e5ce07Smrgm4_undefine([_defopt])
148348e5ce07SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
148448e5ce07SmrgAC_MSG_CHECKING([whether to build unit test cases])
148548e5ce07SmrgAC_MSG_RESULT([$enable_unit_tests])
148648e5ce07Smrg]) # XORG_ENABLE_UNIT_TESTS
1487dc9477beSmrg
148848e5ce07Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
148948e5ce07Smrg# ------------------------------------------------------
149048e5ce07Smrg# Minimum version: 1.17.0
149148e5ce07Smrg#
149248e5ce07Smrg# This macro enables a builder to enable/disable integration testing
149348e5ce07Smrg# It makes no assumption about the test cases' implementation
149448e5ce07Smrg# Test cases may or may not use Automake "Support for test suites"
149548e5ce07Smrg#
149648e5ce07Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
149748e5ce07Smrg# usually requires less dependencies and may be built and run under less
149848e5ce07Smrg# stringent environments than integration tests.
149948e5ce07Smrg#
150048e5ce07Smrg# Interface to module:
150148e5ce07Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
150248e5ce07Smrg# enable_integration_tests:   used in configure.ac for additional configuration
150348e5ce07Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
150448e5ce07Smrg#                             'no' user instructs the module not to build tests
150548e5ce07Smrg# parm1:                      specify the default value, yes or no.
150648e5ce07Smrg#
150748e5ce07SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
150848e5ce07SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
150948e5ce07Smrgm4_define([_defopt], m4_default([$1], [auto]))
151048e5ce07SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
151148e5ce07Smrg	[Enable building integration test cases (default: ]_defopt[)]),
151248e5ce07Smrg	[enable_integration_tests=$enableval],
151348e5ce07Smrg	[enable_integration_tests=]_defopt)
151448e5ce07Smrgm4_undefine([_defopt])
151548e5ce07SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
151648e5ce07Smrg	[test "x$enable_integration_tests" != xno])
151748e5ce07SmrgAC_MSG_CHECKING([whether to build unit test cases])
151848e5ce07SmrgAC_MSG_RESULT([$enable_integration_tests])
151948e5ce07Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1520dc9477beSmrg
152148e5ce07Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
152248e5ce07Smrg# ----------------------------------------
152348e5ce07Smrg# Minimum version: 1.13.0
1524dc9477beSmrg#
152548e5ce07Smrg# GLib is a library which provides advanced data structures and functions.
152648e5ce07Smrg# This macro enables a module to test for the presence of Glib.
1527dc9477beSmrg#
152848e5ce07Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
152948e5ce07Smrg# Otherwise the value of $enable_unit_tests is blank.
1530dc9477beSmrg#
153148e5ce07Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
153248e5ce07Smrg# test support usually requires less dependencies and may be built and run under
153348e5ce07Smrg# less stringent environments than integration tests.
1534dc9477beSmrg#
153548e5ce07Smrg# Interface to module:
153648e5ce07Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
153748e5ce07Smrg# with_glib: used in configure.ac to know if GLib has been found
153848e5ce07Smrg# --with-glib:	'yes' user instructs the module to use glib
153948e5ce07Smrg#		'no' user instructs the module not to use glib
154044584a44Smrg#
154148e5ce07SmrgAC_DEFUN([XORG_WITH_GLIB],[
154248e5ce07SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
154348e5ce07Smrgm4_define([_defopt], m4_default([$2], [auto]))
154448e5ce07SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
154548e5ce07Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
154648e5ce07Smrg	[with_glib=$withval], [with_glib=]_defopt)
154748e5ce07Smrgm4_undefine([_defopt])
1548dc9477beSmrg
154948e5ce07Smrghave_glib=no
155048e5ce07Smrg# Do not probe GLib if user explicitly disabled unit testing
155148e5ce07Smrgif test "x$enable_unit_tests" != x"no"; then
155248e5ce07Smrg  # Do not probe GLib if user explicitly disabled it
155348e5ce07Smrg  if test "x$with_glib" != x"no"; then
155448e5ce07Smrg    m4_ifval(
155548e5ce07Smrg      [$1],
155648e5ce07Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
155748e5ce07Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
155848e5ce07Smrg    )
155948e5ce07Smrg  fi
1560dc9477beSmrgfi
1561dc9477beSmrg
156248e5ce07Smrg# Not having GLib when unit testing has been explicitly requested is an error
156348e5ce07Smrgif test "x$enable_unit_tests" = x"yes"; then
156448e5ce07Smrg  if test "x$have_glib" = x"no"; then
156548e5ce07Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
156648e5ce07Smrg  fi
156744584a44Smrgfi
1568dc9477beSmrg
156948e5ce07Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
157048e5ce07Smrgif test "x$enable_unit_tests" = x"no"; then
157148e5ce07Smrg  if test "x$with_glib" = x"yes"; then
157248e5ce07Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
157348e5ce07Smrg  fi
157444584a44Smrgfi
1575dc9477beSmrg
157648e5ce07Smrg# Not having GLib when it has been explicitly requested is an error
157748e5ce07Smrgif test "x$with_glib" = x"yes"; then
157848e5ce07Smrg  if test "x$have_glib" = x"no"; then
157948e5ce07Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
158048e5ce07Smrg  fi
1581dc9477beSmrgfi
1582dc9477beSmrg
158348e5ce07SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
158448e5ce07Smrg]) # XORG_WITH_GLIB
1585dc9477beSmrg
158648e5ce07Smrg# XORG_LD_WRAP([required|optional])
158748e5ce07Smrg# ---------------------------------
158848e5ce07Smrg# Minimum version: 1.13.0
158948e5ce07Smrg#
159048e5ce07Smrg# Check if linker supports -wrap, passed via compiler flags
159148e5ce07Smrg#
159248e5ce07Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
159348e5ce07Smrg# Otherwise the value of $enable_unit_tests is blank.
159448e5ce07Smrg#
159548e5ce07Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
159648e5ce07Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
159748e5ce07Smrg# available, an argument of "optional" allows use when some unit tests require
159848e5ce07Smrg# ld -wrap and others do not.
159948e5ce07Smrg#
160048e5ce07SmrgAC_DEFUN([XORG_LD_WRAP],[
160148e5ce07SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
160248e5ce07Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
160348e5ce07Smrg                      void __wrap_exit(int status) { return; }],
160448e5ce07Smrg                     [exit(0);])])
160548e5ce07Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
160648e5ce07Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
160748e5ce07Smrg  if test "x$have_ld_wrap" = x"no"; then
160848e5ce07Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
160948e5ce07Smrg  fi
161044584a44Smrgfi
161148e5ce07SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
161248e5ce07Smrg#
161348e5ce07Smrg]) # XORG_LD_WRAP
1614dc9477beSmrg
161548e5ce07Smrg# XORG_CHECK_LINKER_FLAGS
161648e5ce07Smrg# -----------------------
161748e5ce07Smrg# SYNOPSIS
161848e5ce07Smrg#
161948e5ce07Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
162048e5ce07Smrg#
162148e5ce07Smrg# DESCRIPTION
162248e5ce07Smrg#
162348e5ce07Smrg#   Check whether the given linker FLAGS work with the current language's
162448e5ce07Smrg#   linker, or whether they give an error.
162548e5ce07Smrg#
162648e5ce07Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
162748e5ce07Smrg#   success/failure.
162848e5ce07Smrg#
162948e5ce07Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
163048e5ce07Smrg#
163148e5ce07Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
163248e5ce07Smrg#
163348e5ce07Smrg# LICENSE
163448e5ce07Smrg#
163548e5ce07Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
163648e5ce07Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
163748e5ce07Smrg#   Copyright (c) 2009 Matteo Frigo
163848e5ce07Smrg#
163948e5ce07Smrg#   This program is free software: you can redistribute it and/or modify it
164048e5ce07Smrg#   under the terms of the GNU General Public License as published by the
164148e5ce07Smrg#   Free Software Foundation, either version 3 of the License, or (at your
164248e5ce07Smrg#   option) any later version.
164348e5ce07Smrg#
164448e5ce07Smrg#   This program is distributed in the hope that it will be useful, but
164548e5ce07Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
164648e5ce07Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
164748e5ce07Smrg#   Public License for more details.
164848e5ce07Smrg#
164948e5ce07Smrg#   You should have received a copy of the GNU General Public License along
165048e5ce07Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
165148e5ce07Smrg#
165248e5ce07Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
165348e5ce07Smrg#   gives unlimited permission to copy, distribute and modify the configure
165448e5ce07Smrg#   scripts that are the output of Autoconf when processing the Macro. You
165548e5ce07Smrg#   need not follow the terms of the GNU General Public License when using
165648e5ce07Smrg#   or distributing such scripts, even though portions of the text of the
165748e5ce07Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
165848e5ce07Smrg#   all other use of the material that constitutes the Autoconf Macro.
165948e5ce07Smrg#
166048e5ce07Smrg#   This special exception to the GPL applies to versions of the Autoconf
166148e5ce07Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
166248e5ce07Smrg#   modified version of the Autoconf Macro, you may extend this special
166348e5ce07Smrg#   exception to the GPL to apply to your modified version as well.#
166448e5ce07SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
166548e5ce07Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
166648e5ce07Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
166748e5ce07SmrgAS_LITERAL_IF([$1],
166848e5ce07Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
166948e5ce07Smrg      ax_save_FLAGS=$LDFLAGS
167048e5ce07Smrg      LDFLAGS="$1"
167148e5ce07Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
167248e5ce07Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
167348e5ce07Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
167448e5ce07Smrg      LDFLAGS=$ax_save_FLAGS])],
167548e5ce07Smrg  [ax_save_FLAGS=$LDFLAGS
167648e5ce07Smrg   LDFLAGS="$1"
167748e5ce07Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
167848e5ce07Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
167948e5ce07Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
168048e5ce07Smrg   LDFLAGS=$ax_save_FLAGS])
168148e5ce07Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
168248e5ce07SmrgAC_MSG_RESULT($xorg_check_linker_flags)
168348e5ce07Smrgif test "x$xorg_check_linker_flags" = xyes; then
168448e5ce07Smrg	m4_default([$2], :)
168548e5ce07Smrgelse
168648e5ce07Smrg	m4_default([$3], :)
168744584a44Smrgfi
168848e5ce07Smrg]) # XORG_CHECK_LINKER_FLAGS
1689dc9477beSmrg
169048e5ce07Smrg# XORG_MEMORY_CHECK_FLAGS
169148e5ce07Smrg# -----------------------
169248e5ce07Smrg# Minimum version: 1.16.0
169348e5ce07Smrg#
169448e5ce07Smrg# This macro attempts to find appropriate memory checking functionality
169548e5ce07Smrg# for various platforms which unit testing code may use to catch various
169648e5ce07Smrg# forms of memory allocation and access errors in testing.
169748e5ce07Smrg#
169848e5ce07Smrg# Interface to module:
169948e5ce07Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
170048e5ce07Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
170148e5ce07Smrg#
170248e5ce07Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
170348e5ce07Smrg#
170448e5ce07SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1705dc9477beSmrg
170648e5ce07SmrgAC_REQUIRE([AC_CANONICAL_HOST])
170748e5ce07SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
170848e5ce07Smrg           [Environment variables to enable memory checking in tests])
1709dc9477beSmrg
171048e5ce07Smrg# Check for different types of support on different platforms
171148e5ce07Smrgcase $host_os in
171248e5ce07Smrg    solaris*)
171348e5ce07Smrg        AC_CHECK_LIB([umem], [umem_alloc],
171448e5ce07Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
171548e5ce07Smrg        ;;
171648e5ce07Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
171748e5ce07Smrg        # both directly and inverted, so should not be 0 or 255.
171848e5ce07Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
171948e5ce07Smrg        ;;
172048e5ce07Smrg    darwin*)
172148e5ce07Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
172248e5ce07Smrg        ;;
172348e5ce07Smrg    *bsd*)
172448e5ce07Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
172548e5ce07Smrg        ;;
172648e5ce07Smrgesac
1727dc9477beSmrg
172848e5ce07Smrg# User supplied flags override default flags
172948e5ce07Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
173048e5ce07Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
173148e5ce07Smrgfi
1732dc9477beSmrg
173348e5ce07SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
173448e5ce07Smrg]) # XORG_WITH_LINT
173548e5ce07Smrg
173648e5ce07Smrg# XORG_CHECK_MALLOC_ZERO
173748e5ce07Smrg# ----------------------
173848e5ce07Smrg# Minimum version: 1.0.0
173944584a44Smrg#
174048e5ce07Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
174148e5ce07Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
174248e5ce07Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
174348e5ce07SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
174448e5ce07SmrgAC_ARG_ENABLE(malloc0returnsnull,
174548e5ce07Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
174648e5ce07Smrg		       [malloc(0) returns NULL (default: auto)]),
174748e5ce07Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
174848e5ce07Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1749dc9477beSmrg
175048e5ce07SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
175148e5ce07Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
175248e5ce07SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
175348e5ce07Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
175448e5ce07Smrg#include <stdlib.h>
175548e5ce07Smrg],[
175648e5ce07Smrg    char *m0, *r0, *c0, *p;
175748e5ce07Smrg    m0 = malloc(0);
175848e5ce07Smrg    p = malloc(10);
175948e5ce07Smrg    r0 = realloc(p,0);
176048e5ce07Smrg    c0 = calloc(0,10);
176148e5ce07Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
176248e5ce07Smrg])],
176348e5ce07Smrg		[xorg_cv_malloc0_returns_null=yes],
176448e5ce07Smrg		[xorg_cv_malloc0_returns_null=no])])
176548e5ce07SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
176648e5ce07Smrgfi
176748e5ce07SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
176848e5ce07Smrg
176948e5ce07Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
177048e5ce07Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
177148e5ce07Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
177248e5ce07Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
177344584a44Smrgelse
177448e5ce07Smrg	MALLOC_ZERO_CFLAGS=""
177548e5ce07Smrg	XMALLOC_ZERO_CFLAGS=""
177648e5ce07Smrg	XTMALLOC_ZERO_CFLAGS=""
1777dc9477beSmrgfi
1778dc9477beSmrg
177948e5ce07SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
178048e5ce07SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
178148e5ce07SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
178248e5ce07Smrg]) # XORG_CHECK_MALLOC_ZERO
1783dc9477beSmrg
178448e5ce07Smrg# XORG_WITH_LINT()
178548e5ce07Smrg# ----------------
178648e5ce07Smrg# Minimum version: 1.1.0
178744584a44Smrg#
178848e5ce07Smrg# This macro enables the use of a tool that flags some suspicious and
178948e5ce07Smrg# non-portable constructs (likely to be bugs) in C language source code.
179048e5ce07Smrg# It will attempt to locate the tool and use appropriate options.
179148e5ce07Smrg# There are various lint type tools on different platforms.
179248e5ce07Smrg#
179348e5ce07Smrg# Interface to module:
179448e5ce07Smrg# LINT:		returns the path to the tool found on the platform
179548e5ce07Smrg#		or the value set to LINT on the configure cmd line
179648e5ce07Smrg#		also an Automake conditional
179748e5ce07Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
179848e5ce07Smrg#
179948e5ce07Smrg# --with-lint:	'yes' user instructs the module to use lint
180048e5ce07Smrg#		'no' user instructs the module not to use lint (default)
180148e5ce07Smrg#
180248e5ce07Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
180348e5ce07Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
180448e5ce07Smrg#
180548e5ce07SmrgAC_DEFUN([XORG_WITH_LINT],[
1806dc9477beSmrg
180748e5ce07SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
180848e5ce07SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
180948e5ce07SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
181048e5ce07Smrg		[Use a lint-style source code checker (default: disabled)])],
181148e5ce07Smrg		[use_lint=$withval], [use_lint=no])
1812dc9477beSmrg
181348e5ce07Smrg# Obtain platform specific info like program name and options
181448e5ce07Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
181548e5ce07Smrgcase $host_os in
181648e5ce07Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
181748e5ce07Smrg	lint_name=splint
181848e5ce07Smrg	lint_options="-badflag"
181948e5ce07Smrg	;;
182048e5ce07Smrg  *freebsd* | *netbsd*)
182148e5ce07Smrg	lint_name=lint
182248e5ce07Smrg	lint_options="-u -b"
182348e5ce07Smrg	;;
182448e5ce07Smrg  *solaris*)
182548e5ce07Smrg	lint_name=lint
182648e5ce07Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
182748e5ce07Smrg	;;
182848e5ce07Smrgesac
1829dc9477beSmrg
183048e5ce07Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
183148e5ce07Smrgif test "x$use_lint" = x"yes" ; then
183248e5ce07Smrg   AC_PATH_PROG([LINT], [$lint_name])
183348e5ce07Smrg   if test "x$LINT" = "x"; then
183448e5ce07Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
183548e5ce07Smrg   fi
183648e5ce07Smrgelif test "x$use_lint" = x"no" ; then
183748e5ce07Smrg   if test "x$LINT" != "x"; then
183848e5ce07Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
183948e5ce07Smrg   fi
184044584a44Smrgelse
184148e5ce07Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
184244584a44Smrgfi
1843dc9477beSmrg
184448e5ce07Smrg# User supplied flags override default flags
184548e5ce07Smrgif test "x$LINT_FLAGS" != "x"; then
184648e5ce07Smrg   lint_options=$LINT_FLAGS
184748e5ce07Smrgfi
1848dc9477beSmrg
184948e5ce07SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
185048e5ce07SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1851dc9477beSmrg
185248e5ce07Smrg]) # XORG_WITH_LINT
185344584a44Smrg
185448e5ce07Smrg# XORG_LINT_LIBRARY(LIBNAME)
185548e5ce07Smrg# --------------------------
185648e5ce07Smrg# Minimum version: 1.1.0
185748e5ce07Smrg#
185848e5ce07Smrg# Sets up flags for building lint libraries for checking programs that call
185948e5ce07Smrg# functions in the library.
186048e5ce07Smrg#
186148e5ce07Smrg# Interface to module:
186248e5ce07Smrg# LINTLIB		- Automake variable with the name of lint library file to make
186348e5ce07Smrg# MAKE_LINT_LIB		- Automake conditional
186448e5ce07Smrg#
186548e5ce07Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
186648e5ce07Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1867dc9477beSmrg
186848e5ce07SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
186948e5ce07SmrgAC_REQUIRE([XORG_WITH_LINT])
187048e5ce07SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
187148e5ce07Smrg	[Create lint library (default: disabled)])],
187248e5ce07Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1873dc9477beSmrg
187448e5ce07Smrgif test "x$make_lint_lib" = x"yes" ; then
187548e5ce07Smrg   LINTLIB=llib-l$1.ln
187648e5ce07Smrg   if test "x$LINT" = "x"; then
187748e5ce07Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
187848e5ce07Smrg   fi
187948e5ce07Smrgelif test "x$make_lint_lib" != x"no" ; then
188048e5ce07Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
188148e5ce07Smrgfi
1882dc9477beSmrg
188348e5ce07SmrgAC_SUBST(LINTLIB)
188448e5ce07SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1885dc9477beSmrg
188648e5ce07Smrg]) # XORG_LINT_LIBRARY
1887dc9477beSmrg
188848e5ce07Smrg# XORG_COMPILER_BRAND
188944584a44Smrg# -------------------
189048e5ce07Smrg# Minimum version: 1.14.0
189144584a44Smrg#
189248e5ce07Smrg# Checks for various brands of compilers and sets flags as appropriate:
189348e5ce07Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
189448e5ce07Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
189548e5ce07Smrg#   clang compiler - sets CLANGCC to "yes"
189648e5ce07Smrg#   Intel compiler - sets INTELCC to "yes"
189748e5ce07Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
189848e5ce07Smrg#
189948e5ce07SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
190048e5ce07SmrgAC_LANG_CASE(
190148e5ce07Smrg	[C], [
1902c6b4a769Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
1903c6b4a769Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
1904c6b4a769Smrg		m4_version_prereq([2.70],
1905c6b4a769Smrg			[AC_REQUIRE([AC_PROG_CC])],
1906c6b4a769Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
190748e5ce07Smrg	],
190848e5ce07Smrg	[C++], [
190948e5ce07Smrg		AC_REQUIRE([AC_PROG_CXX])
191048e5ce07Smrg	]
191148e5ce07Smrg)
191248e5ce07SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
191348e5ce07SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
191448e5ce07SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
191548e5ce07Smrg]) # XORG_COMPILER_BRAND
1916dc9477beSmrg
191748e5ce07Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
191848e5ce07Smrg# ---------------
191948e5ce07Smrg# Minimum version: 1.16.0
192048e5ce07Smrg#
192148e5ce07Smrg# Test if the compiler works when passed the given flag as a command line argument.
1922c6b4a769Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
192348e5ce07Smrg# next flag in the list until there are no more options.
192448e5ce07Smrg#
192548e5ce07Smrg# Note that this does not guarantee that the compiler supports the flag as some
192648e5ce07Smrg# compilers will simply ignore arguments that they do not understand, but we do
192748e5ce07Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
192848e5ce07Smrg# -Werror=unused-command-line-argument
192948e5ce07Smrg#
193048e5ce07SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
193148e5ce07Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
193248e5ce07Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
193344584a44Smrg
193448e5ce07SmrgAC_LANG_COMPILER_REQUIRE
193544584a44Smrg
193648e5ce07SmrgAC_LANG_CASE(
193748e5ce07Smrg	[C], [
1938c6b4a769Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
1939c6b4a769Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
1940c6b4a769Smrg		m4_version_prereq([2.70],
1941c6b4a769Smrg			[AC_REQUIRE([AC_PROG_CC])],
1942c6b4a769Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
194348e5ce07Smrg		define([PREFIX], [C])
194448e5ce07Smrg		define([CACHE_PREFIX], [cc])
194548e5ce07Smrg		define([COMPILER], [$CC])
194648e5ce07Smrg	],
194748e5ce07Smrg	[C++], [
194848e5ce07Smrg		define([PREFIX], [CXX])
194948e5ce07Smrg		define([CACHE_PREFIX], [cxx])
195048e5ce07Smrg		define([COMPILER], [$CXX])
195148e5ce07Smrg	]
195248e5ce07Smrg)
1953dc9477beSmrg
195448e5ce07Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1955dc9477beSmrg
195648e5ce07Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
195748e5ce07Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
195848e5ce07Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
195948e5ce07Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
196048e5ce07Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
196148e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
196248e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
196348e5ce07Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
196448e5ce07Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
196544584a44Smrgfi
196644584a44Smrg
196748e5ce07Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
196848e5ce07Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
196948e5ce07Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
197048e5ce07Smrg	fi
197148e5ce07Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
197248e5ce07Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
197348e5ce07Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
197448e5ce07Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
197548e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
197648e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
197748e5ce07Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
197848e5ce07Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
197944584a44Smrgfi
198044584a44Smrg
198148e5ce07Smrgfound="no"
198248e5ce07Smrgm4_foreach([flag], m4_cdr($@), [
198348e5ce07Smrg	if test $found = "no" ; then
198448e5ce07Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
198548e5ce07Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
198648e5ce07Smrg		fi
198744584a44Smrg
198848e5ce07Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
198948e5ce07Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
199048e5ce07Smrg		fi
199144584a44Smrg
199248e5ce07Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1993dc9477beSmrg
199448e5ce07Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
199548e5ce07Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
199648e5ce07Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
199748e5ce07Smrg		AC_CACHE_VAL($cacheid,
199848e5ce07Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
199948e5ce07Smrg					     [eval $cacheid=yes],
200048e5ce07Smrg					     [eval $cacheid=no])])
2001dc9477beSmrg
200248e5ce07Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
200344584a44Smrg
200448e5ce07Smrg		eval supported=\$$cacheid
200548e5ce07Smrg		AC_MSG_RESULT([$supported])
200648e5ce07Smrg		if test "$supported" = "yes" ; then
200748e5ce07Smrg			$1="$$1 ]flag["
200848e5ce07Smrg			found="yes"
200948e5ce07Smrg		fi
201048e5ce07Smrg	fi
201148e5ce07Smrg])
201248e5ce07Smrg]) # XORG_TESTSET_CFLAG
201344584a44Smrg
201448e5ce07Smrg# XORG_COMPILER_FLAGS
201548e5ce07Smrg# ---------------
201648e5ce07Smrg# Minimum version: 1.16.0
2017dc9477beSmrg#
201848e5ce07Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
201948e5ce07Smrg# arguments supported by the selected compiler which do NOT alter the generated
202048e5ce07Smrg# code.  These arguments will cause the compiler to print various warnings
202148e5ce07Smrg# during compilation AND turn a conservative set of warnings into errors.
2022dc9477beSmrg#
202348e5ce07Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
202448e5ce07Smrg# future versions of util-macros as options are added to new compilers.
2025dc9477beSmrg#
202648e5ce07SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
202748e5ce07SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2028dc9477beSmrg
202948e5ce07SmrgAC_ARG_ENABLE(selective-werror,
203048e5ce07Smrg              AS_HELP_STRING([--disable-selective-werror],
203148e5ce07Smrg                             [Turn off selective compiler errors. (default: enabled)]),
203248e5ce07Smrg              [SELECTIVE_WERROR=$enableval],
203348e5ce07Smrg              [SELECTIVE_WERROR=yes])
203448e5ce07Smrg
203548e5ce07SmrgAC_LANG_CASE(
203648e5ce07Smrg        [C], [
203748e5ce07Smrg                define([PREFIX], [C])
203848e5ce07Smrg        ],
203948e5ce07Smrg        [C++], [
204048e5ce07Smrg                define([PREFIX], [CXX])
204148e5ce07Smrg        ]
204248e5ce07Smrg)
204348e5ce07Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
204448e5ce07Smrgif test "x$SUNCC" = "xyes"; then
204548e5ce07Smrg    [BASE_]PREFIX[FLAGS]="-v"
204644584a44Smrgelse
204748e5ce07Smrg    [BASE_]PREFIX[FLAGS]=""
204844584a44Smrgfi
2049dc9477beSmrg
205048e5ce07Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
205148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
205248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
205348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
205448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
205544584a44Smrg
205648e5ce07SmrgAC_LANG_CASE(
205748e5ce07Smrg	[C], [
205848e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
205948e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
206048e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
206148e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
206248e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
206348e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
206448e5ce07Smrg	]
206548e5ce07Smrg)
206648e5ce07Smrg
206748e5ce07Smrg# This chunk adds additional warnings that could catch undesired effects.
206848e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
206948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
207048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
207148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
207248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
207348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
207448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
207548e5ce07Smrg
207648e5ce07Smrg# These are currently disabled because they are noisy.  They will be enabled
207748e5ce07Smrg# in the future once the codebase is sufficiently modernized to silence
207848e5ce07Smrg# them.  For now, I don't want them to drown out the other warnings.
207948e5ce07Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
208048e5ce07Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
208148e5ce07Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
208248e5ce07Smrg
2083c6b4a769Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
208448e5ce07Smrg# when there are problems that should be fixed.
208548e5ce07Smrg
208648e5ce07Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
208748e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
208848e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
208948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
209048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
209148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
209248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
209348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
209448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
209548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
209648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
209748e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
209848e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
209948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
210048e5ce07Smrgelse
210148e5ce07SmrgAC_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])
210248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
210348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
210448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
210548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
210648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
210748e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
210848e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
210948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
211048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
211148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
211248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
211348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
211448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
211548e5ce07Smrgfi
211648e5ce07Smrg
211748e5ce07SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
211848e5ce07Smrg]) # XORG_COMPILER_FLAGS
211948e5ce07Smrg
212048e5ce07Smrg# XORG_CWARNFLAGS
212148e5ce07Smrg# ---------------
212248e5ce07Smrg# Minimum version: 1.2.0
212348e5ce07Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2124dc9477beSmrg#
212548e5ce07Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2126dc9477beSmrg#
212748e5ce07Smrg# This function is deprecated because it defines -fno-strict-aliasing
212848e5ce07Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
212948e5ce07Smrg# is needed, then it should be added explicitly in the module when
213048e5ce07Smrg# it is updated to use BASE_CFLAGS.
2131dc9477beSmrg#
213248e5ce07SmrgAC_DEFUN([XORG_CWARNFLAGS], [
213348e5ce07SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
213448e5ce07SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
213548e5ce07SmrgAC_LANG_CASE(
213648e5ce07Smrg	[C], [
213748e5ce07Smrg		CWARNFLAGS="$BASE_CFLAGS"
213848e5ce07Smrg		if  test "x$GCC" = xyes ; then
213948e5ce07Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
214048e5ce07Smrg		fi
214148e5ce07Smrg		AC_SUBST(CWARNFLAGS)
214248e5ce07Smrg	]
214348e5ce07Smrg)
214448e5ce07Smrg]) # XORG_CWARNFLAGS
214548e5ce07Smrg
214648e5ce07Smrg# XORG_STRICT_OPTION
214748e5ce07Smrg# -----------------------
214848e5ce07Smrg# Minimum version: 1.3.0
2149dc9477beSmrg#
215048e5ce07Smrg# Add configure option to enable strict compilation flags, such as treating
215148e5ce07Smrg# warnings as fatal errors.
215248e5ce07Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
215348e5ce07Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
215444584a44Smrg#
215548e5ce07Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
215648e5ce07Smrg# when strict compilation is unconditionally desired.
215748e5ce07SmrgAC_DEFUN([XORG_STRICT_OPTION], [
215848e5ce07SmrgAC_REQUIRE([XORG_CWARNFLAGS])
215948e5ce07SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2160dc9477beSmrg
216148e5ce07SmrgAC_ARG_ENABLE(strict-compilation,
216248e5ce07Smrg			  AS_HELP_STRING([--enable-strict-compilation],
216348e5ce07Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
216448e5ce07Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2165dc9477beSmrg
216648e5ce07SmrgAC_LANG_CASE(
216748e5ce07Smrg        [C], [
216848e5ce07Smrg                define([PREFIX], [C])
216948e5ce07Smrg        ],
217048e5ce07Smrg        [C++], [
217148e5ce07Smrg                define([PREFIX], [CXX])
217248e5ce07Smrg        ]
217348e5ce07Smrg)
2174dc9477beSmrg
217548e5ce07Smrg[STRICT_]PREFIX[FLAGS]=""
217648e5ce07SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
217748e5ce07SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
217848e5ce07Smrg
217948e5ce07Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
218048e5ce07Smrg# activate it with -Werror, so we add it here explicitly.
218148e5ce07SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
218248e5ce07Smrg
218348e5ce07Smrgif test "x$STRICT_COMPILE" = "xyes"; then
218448e5ce07Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
218548e5ce07Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
218648e5ce07Smrgfi
218748e5ce07SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
218848e5ce07SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
218948e5ce07SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
219048e5ce07Smrg]) # XORG_STRICT_OPTION
219148e5ce07Smrg
2192c6b4a769Smrg# XORG_DEFAULT_NOCODE_OPTIONS
2193c6b4a769Smrg# ---------------------------
2194c6b4a769Smrg# Minimum version: 1.20.0
2195c6b4a769Smrg#
2196c6b4a769Smrg# Defines default options for X.Org modules which don't compile code,
2197c6b4a769Smrg# such as fonts, bitmaps, cursors, and docs.
2198c6b4a769Smrg#
2199c6b4a769SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
2200c6b4a769SmrgAC_REQUIRE([AC_PROG_INSTALL])
2201c6b4a769SmrgXORG_RELEASE_VERSION
2202c6b4a769SmrgXORG_CHANGELOG
2203c6b4a769SmrgXORG_INSTALL
2204c6b4a769SmrgXORG_MANPAGE_SECTIONS
2205c6b4a769Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2206c6b4a769Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2207c6b4a769Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
2208c6b4a769Smrg
220948e5ce07Smrg# XORG_DEFAULT_OPTIONS
221048e5ce07Smrg# --------------------
221148e5ce07Smrg# Minimum version: 1.3.0
2212dc9477beSmrg#
2213c6b4a769Smrg# Defines default options for X.Org modules which compile code.
2214dc9477beSmrg#
221548e5ce07SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
221648e5ce07SmrgAC_REQUIRE([AC_PROG_INSTALL])
221748e5ce07SmrgXORG_COMPILER_FLAGS
221848e5ce07SmrgXORG_CWARNFLAGS
221948e5ce07SmrgXORG_STRICT_OPTION
2220c6b4a769SmrgXORG_DEFAULT_NOCODE_OPTIONS
222148e5ce07Smrg]) # XORG_DEFAULT_OPTIONS
222248e5ce07Smrg
222348e5ce07Smrg# XORG_INSTALL()
222448e5ce07Smrg# ----------------
222548e5ce07Smrg# Minimum version: 1.4.0
2226dc9477beSmrg#
222748e5ce07Smrg# Defines the variable INSTALL_CMD as the command to copy
222848e5ce07Smrg# INSTALL from $prefix/share/util-macros.
2229dc9477beSmrg#
223048e5ce07SmrgAC_DEFUN([XORG_INSTALL], [
223148e5ce07SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
223248e5ce07Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
223348e5ce07SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
223448e5ce07Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
22354e8f48c7Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
22364e8f48c7Smrgtouch \$(top_srcdir)/INSTALL; \
22374e8f48c7Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
223848e5ce07SmrgAC_SUBST([INSTALL_CMD])
223948e5ce07Smrg]) # XORG_INSTALL
224048e5ce07Smrgdnl Copyright 2005 Red Hat, Inc
224148e5ce07Smrgdnl
224248e5ce07Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
224348e5ce07Smrgdnl documentation for any purpose is hereby granted without fee, provided that
224448e5ce07Smrgdnl the above copyright notice appear in all copies and that both that
224548e5ce07Smrgdnl copyright notice and this permission notice appear in supporting
224648e5ce07Smrgdnl documentation.
224748e5ce07Smrgdnl
224848e5ce07Smrgdnl The above copyright notice and this permission notice shall be included
224948e5ce07Smrgdnl in all copies or substantial portions of the Software.
225048e5ce07Smrgdnl
225148e5ce07Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
225248e5ce07Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
225348e5ce07Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
225448e5ce07Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
225548e5ce07Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
225648e5ce07Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
225748e5ce07Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
225848e5ce07Smrgdnl
225948e5ce07Smrgdnl Except as contained in this notice, the name of the copyright holders shall
226048e5ce07Smrgdnl not be used in advertising or otherwise to promote the sale, use or
226148e5ce07Smrgdnl other dealings in this Software without prior written authorization
226248e5ce07Smrgdnl from the copyright holders.
226348e5ce07Smrgdnl
2264dc9477beSmrg
226548e5ce07Smrg# XORG_RELEASE_VERSION
226648e5ce07Smrg# --------------------
226748e5ce07Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2268dc9477beSmrg
226948e5ce07SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
227048e5ce07Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
227148e5ce07Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
227248e5ce07Smrg		[Major version of this package])
227348e5ce07Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
227448e5ce07Smrg	if test "x$PVM" = "x"; then
227548e5ce07Smrg		PVM="0"
227648e5ce07Smrg	fi
227748e5ce07Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
227848e5ce07Smrg		[$PVM],
227948e5ce07Smrg		[Minor version of this package])
228048e5ce07Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
228148e5ce07Smrg	if test "x$PVP" = "x"; then
228248e5ce07Smrg		PVP="0"
228348e5ce07Smrg	fi
228448e5ce07Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
228548e5ce07Smrg		[$PVP],
228648e5ce07Smrg		[Patch version of this package])
228748e5ce07Smrg])
228848e5ce07Smrg
228948e5ce07Smrg# XORG_CHANGELOG()
229048e5ce07Smrg# ----------------
229148e5ce07Smrg# Minimum version: 1.2.0
2292dc9477beSmrg#
229348e5ce07Smrg# Defines the variable CHANGELOG_CMD as the command to generate
229448e5ce07Smrg# ChangeLog from git.
229544584a44Smrg#
229644584a44Smrg#
229748e5ce07SmrgAC_DEFUN([XORG_CHANGELOG], [
22984e8f48c7SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
229948e5ce07Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
23004e8f48c7Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
23014e8f48c7Smrgtouch \$(top_srcdir)/ChangeLog; \
23024e8f48c7Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
230348e5ce07SmrgAC_SUBST([CHANGELOG_CMD])
230448e5ce07Smrg]) # XORG_CHANGELOG
230548e5ce07Smrg
23064e8f48c7Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
230744584a44Smrg#
230848e5ce07Smrg# This file is free software; the Free Software Foundation
230948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
231048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2311dc9477beSmrg
231248e5ce07Smrg# AM_AUTOMAKE_VERSION(VERSION)
231348e5ce07Smrg# ----------------------------
231448e5ce07Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
231548e5ce07Smrg# generated from the m4 files accompanying Automake X.Y.
231648e5ce07Smrg# (This private macro should not be called outside this file.)
231748e5ce07SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
23184940c694Smrg[am__api_version='1.16'
231948e5ce07Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
232048e5ce07Smrgdnl require some minimum version.  Point them to the right macro.
23214e8f48c7Smrgm4_if([$1], [1.16.5], [],
232248e5ce07Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
232348e5ce07Smrg])
2324dc9477beSmrg
232548e5ce07Smrg# _AM_AUTOCONF_VERSION(VERSION)
232648e5ce07Smrg# -----------------------------
232748e5ce07Smrg# aclocal traces this macro to find the Autoconf version.
232848e5ce07Smrg# This is a private macro too.  Using m4_define simplifies
232948e5ce07Smrg# the logic in aclocal, which can simply ignore this definition.
233048e5ce07Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2331dc9477beSmrg
233248e5ce07Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
233348e5ce07Smrg# -------------------------------
233448e5ce07Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
233548e5ce07Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
233648e5ce07SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
23374e8f48c7Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
233848e5ce07Smrgm4_ifndef([AC_AUTOCONF_VERSION],
233948e5ce07Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
234048e5ce07Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2341dc9477beSmrg
234248e5ce07Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
234348e5ce07Smrg
23444e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2345dc9477beSmrg#
234648e5ce07Smrg# This file is free software; the Free Software Foundation
234748e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
234848e5ce07Smrg# with or without modifications, as long as this notice is preserved.
234948e5ce07Smrg
235048e5ce07Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
235148e5ce07Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
235248e5ce07Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
235344584a44Smrg#
235448e5ce07Smrg# Of course, Automake must honor this variable whenever it calls a
235548e5ce07Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
235648e5ce07Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
235748e5ce07Smrg# depending on how configure is run.  This is pretty annoying, since
235848e5ce07Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
235948e5ce07Smrg# source directory, any form will work fine, but in subdirectories a
236048e5ce07Smrg# relative path needs to be adjusted first.
236144584a44Smrg#
236248e5ce07Smrg# $ac_aux_dir/missing
236348e5ce07Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
236448e5ce07Smrg# $top_srcdir/$ac_aux_dir/missing
236548e5ce07Smrg#    fails if $ac_aux_dir is absolute,
236648e5ce07Smrg#    fails when called from a subdirectory in a VPATH build with
236748e5ce07Smrg#          a relative $ac_aux_dir
236844584a44Smrg#
236948e5ce07Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
237048e5ce07Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
237148e5ce07Smrg# harmless because $srcdir is '.', but things will broke when you
237248e5ce07Smrg# start a VPATH build or use an absolute $srcdir.
237344584a44Smrg#
237448e5ce07Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
237548e5ce07Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
237648e5ce07Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
237748e5ce07Smrg# and then we would define $MISSING as
237848e5ce07Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
237948e5ce07Smrg# This will work as long as MISSING is not called from configure, because
238048e5ce07Smrg# unfortunately $(top_srcdir) has no meaning in configure.
238148e5ce07Smrg# However there are other variables, like CC, which are often used in
238248e5ce07Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
238344584a44Smrg#
238448e5ce07Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
238548e5ce07Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
238648e5ce07Smrg# configured tree to be moved without reconfiguration.
238748e5ce07Smrg
238848e5ce07SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
238948e5ce07Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
239048e5ce07Smrg# Expand $ac_aux_dir to an absolute path.
239148e5ce07Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
239248e5ce07Smrg])
239348e5ce07Smrg
239448e5ce07Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
239548e5ce07Smrg
23964e8f48c7Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
239744584a44Smrg#
239848e5ce07Smrg# This file is free software; the Free Software Foundation
239948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
240048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2401dc9477beSmrg
240248e5ce07Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
240348e5ce07Smrg# -------------------------------------
240448e5ce07Smrg# Define a conditional.
240548e5ce07SmrgAC_DEFUN([AM_CONDITIONAL],
240648e5ce07Smrg[AC_PREREQ([2.52])dnl
240748e5ce07Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
240848e5ce07Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
240948e5ce07SmrgAC_SUBST([$1_TRUE])dnl
241048e5ce07SmrgAC_SUBST([$1_FALSE])dnl
241148e5ce07Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
241248e5ce07Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
241348e5ce07Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
241448e5ce07Smrgif $2; then
241548e5ce07Smrg  $1_TRUE=
241648e5ce07Smrg  $1_FALSE='#'
241744584a44Smrgelse
241848e5ce07Smrg  $1_TRUE='#'
241948e5ce07Smrg  $1_FALSE=
242044584a44Smrgfi
242148e5ce07SmrgAC_CONFIG_COMMANDS_PRE(
242248e5ce07Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
242348e5ce07Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
242448e5ce07SmrgUsually this means the macro was only invoked conditionally.]])
242548e5ce07Smrgfi])])
2426dc9477beSmrg
24274e8f48c7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
242848e5ce07Smrg#
242948e5ce07Smrg# This file is free software; the Free Software Foundation
243048e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
243148e5ce07Smrg# with or without modifications, as long as this notice is preserved.
243248e5ce07Smrg
243348e5ce07Smrg
243448e5ce07Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
243548e5ce07Smrg# written in clear, in which case automake, when reading aclocal.m4,
243648e5ce07Smrg# will think it sees a *use*, and therefore will trigger all it's
243748e5ce07Smrg# C support machinery.  Also note that it means that autoscan, seeing
243848e5ce07Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
243948e5ce07Smrg
244048e5ce07Smrg
244148e5ce07Smrg# _AM_DEPENDENCIES(NAME)
244248e5ce07Smrg# ----------------------
244348e5ce07Smrg# See how the compiler implements dependency checking.
244448e5ce07Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
244548e5ce07Smrg# We try a few techniques and use that to set a single cache variable.
244648e5ce07Smrg#
244748e5ce07Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
244848e5ce07Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
244948e5ce07Smrg# dependency, and given that the user is not expected to run this macro,
245048e5ce07Smrg# just rely on AC_PROG_CC.
245148e5ce07SmrgAC_DEFUN([_AM_DEPENDENCIES],
245248e5ce07Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
245348e5ce07SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
245448e5ce07SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
245548e5ce07SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
245648e5ce07Smrg
245748e5ce07Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
245848e5ce07Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
245948e5ce07Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
246048e5ce07Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
246148e5ce07Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
246248e5ce07Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
246348e5ce07Smrg                    [depcc="$$1"   am_compiler_list=])
246448e5ce07Smrg
246548e5ce07SmrgAC_CACHE_CHECK([dependency style of $depcc],
246648e5ce07Smrg               [am_cv_$1_dependencies_compiler_type],
246748e5ce07Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
246848e5ce07Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
246948e5ce07Smrg  # making bogus files that we don't know about and never remove.  For
247048e5ce07Smrg  # instance it was reported that on HP-UX the gcc test will end up
247148e5ce07Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
247248e5ce07Smrg  # in D".
247348e5ce07Smrg  rm -rf conftest.dir
247448e5ce07Smrg  mkdir conftest.dir
247548e5ce07Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
247648e5ce07Smrg  # using a relative directory.
247748e5ce07Smrg  cp "$am_depcomp" conftest.dir
247848e5ce07Smrg  cd conftest.dir
247948e5ce07Smrg  # We will build objects and dependencies in a subdirectory because
248048e5ce07Smrg  # it helps to detect inapplicable dependency modes.  For instance
248148e5ce07Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
248248e5ce07Smrg  # side effect of compilation, but ICC will put the dependencies in
248348e5ce07Smrg  # the current directory while Tru64 will put them in the object
248448e5ce07Smrg  # directory.
248548e5ce07Smrg  mkdir sub
248648e5ce07Smrg
248748e5ce07Smrg  am_cv_$1_dependencies_compiler_type=none
248848e5ce07Smrg  if test "$am_compiler_list" = ""; then
248948e5ce07Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
249048e5ce07Smrg  fi
249148e5ce07Smrg  am__universal=false
249248e5ce07Smrg  m4_case([$1], [CC],
249348e5ce07Smrg    [case " $depcc " in #(
249448e5ce07Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
249548e5ce07Smrg     esac],
249648e5ce07Smrg    [CXX],
249748e5ce07Smrg    [case " $depcc " in #(
249848e5ce07Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
249948e5ce07Smrg     esac])
250048e5ce07Smrg
250148e5ce07Smrg  for depmode in $am_compiler_list; do
250248e5ce07Smrg    # Setup a source with many dependencies, because some compilers
250348e5ce07Smrg    # like to wrap large dependency lists on column 80 (with \), and
250448e5ce07Smrg    # we should not choose a depcomp mode which is confused by this.
250548e5ce07Smrg    #
250648e5ce07Smrg    # We need to recreate these files for each test, as the compiler may
250748e5ce07Smrg    # overwrite some of them when testing with obscure command lines.
250848e5ce07Smrg    # This happens at least with the AIX C compiler.
250948e5ce07Smrg    : > sub/conftest.c
251048e5ce07Smrg    for i in 1 2 3 4 5 6; do
251148e5ce07Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
251248e5ce07Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
251348e5ce07Smrg      # Solaris 10 /bin/sh.
251448e5ce07Smrg      echo '/* dummy */' > sub/conftst$i.h
251548e5ce07Smrg    done
251648e5ce07Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
251748e5ce07Smrg
251848e5ce07Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
251948e5ce07Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
252048e5ce07Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
252148e5ce07Smrg    # versions had trouble with output in subdirs.
252248e5ce07Smrg    am__obj=sub/conftest.${OBJEXT-o}
252348e5ce07Smrg    am__minus_obj="-o $am__obj"
252448e5ce07Smrg    case $depmode in
252548e5ce07Smrg    gcc)
252648e5ce07Smrg      # This depmode causes a compiler race in universal mode.
252748e5ce07Smrg      test "$am__universal" = false || continue
252848e5ce07Smrg      ;;
252948e5ce07Smrg    nosideeffect)
253048e5ce07Smrg      # After this tag, mechanisms are not by side-effect, so they'll
253148e5ce07Smrg      # only be used when explicitly requested.
253248e5ce07Smrg      if test "x$enable_dependency_tracking" = xyes; then
253348e5ce07Smrg	continue
253448e5ce07Smrg      else
253548e5ce07Smrg	break
253648e5ce07Smrg      fi
253748e5ce07Smrg      ;;
253848e5ce07Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
253948e5ce07Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
254048e5ce07Smrg      # not run yet.  These depmodes are late enough in the game, and
254148e5ce07Smrg      # so weak that their functioning should not be impacted.
254248e5ce07Smrg      am__obj=conftest.${OBJEXT-o}
254348e5ce07Smrg      am__minus_obj=
254448e5ce07Smrg      ;;
254548e5ce07Smrg    none) break ;;
254648e5ce07Smrg    esac
254748e5ce07Smrg    if depmode=$depmode \
254848e5ce07Smrg       source=sub/conftest.c object=$am__obj \
254948e5ce07Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
255048e5ce07Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
255148e5ce07Smrg         >/dev/null 2>conftest.err &&
255248e5ce07Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
255348e5ce07Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
255448e5ce07Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
255548e5ce07Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
255648e5ce07Smrg      # icc doesn't choke on unknown options, it will just issue warnings
255748e5ce07Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
255848e5ce07Smrg      # that says an option was ignored or not supported.
255948e5ce07Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
256048e5ce07Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
256148e5ce07Smrg      # The diagnosis changed in icc 8.0:
256248e5ce07Smrg      #   icc: Command line remark: option '-MP' not supported
256348e5ce07Smrg      if (grep 'ignoring option' conftest.err ||
256448e5ce07Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
256548e5ce07Smrg        am_cv_$1_dependencies_compiler_type=$depmode
256648e5ce07Smrg        break
256748e5ce07Smrg      fi
256844584a44Smrg    fi
256948e5ce07Smrg  done
2570dc9477beSmrg
257148e5ce07Smrg  cd ..
257248e5ce07Smrg  rm -rf conftest.dir
2573dc9477beSmrgelse
257448e5ce07Smrg  am_cv_$1_dependencies_compiler_type=none
2575dc9477beSmrgfi
257648e5ce07Smrg])
257748e5ce07SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
257848e5ce07SmrgAM_CONDITIONAL([am__fastdep$1], [
257948e5ce07Smrg  test "x$enable_dependency_tracking" != xno \
258048e5ce07Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
258148e5ce07Smrg])
2582dc9477beSmrg
2583dc9477beSmrg
258448e5ce07Smrg# AM_SET_DEPDIR
258548e5ce07Smrg# -------------
258648e5ce07Smrg# Choose a directory name for dependency files.
258748e5ce07Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
258848e5ce07SmrgAC_DEFUN([AM_SET_DEPDIR],
258948e5ce07Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
259048e5ce07SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
259148e5ce07Smrg])
2592dc9477beSmrg
2593dc9477beSmrg
259448e5ce07Smrg# AM_DEP_TRACK
259548e5ce07Smrg# ------------
259648e5ce07SmrgAC_DEFUN([AM_DEP_TRACK],
259748e5ce07Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
259848e5ce07SmrgAS_HELP_STRING(
259948e5ce07Smrg  [--enable-dependency-tracking],
260048e5ce07Smrg  [do not reject slow dependency extractors])
260148e5ce07SmrgAS_HELP_STRING(
260248e5ce07Smrg  [--disable-dependency-tracking],
260348e5ce07Smrg  [speeds up one-time build])])
260448e5ce07Smrgif test "x$enable_dependency_tracking" != xno; then
260548e5ce07Smrg  am_depcomp="$ac_aux_dir/depcomp"
260648e5ce07Smrg  AMDEPBACKSLASH='\'
260748e5ce07Smrg  am__nodep='_no'
2608dc9477beSmrgfi
260948e5ce07SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
261048e5ce07SmrgAC_SUBST([AMDEPBACKSLASH])dnl
261148e5ce07Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
261248e5ce07SmrgAC_SUBST([am__nodep])dnl
261348e5ce07Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
261448e5ce07Smrg])
2615dc9477beSmrg
261648e5ce07Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2617dc9477beSmrg
26184e8f48c7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
261944584a44Smrg#
262048e5ce07Smrg# This file is free software; the Free Software Foundation
262148e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
262248e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2623dc9477beSmrg
262448e5ce07Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
262548e5ce07Smrg# ------------------------------
262648e5ce07SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
262748e5ce07Smrg[{
262848e5ce07Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
262948e5ce07Smrg  # are listed without --file.  Let's play safe and only enable the eval
263048e5ce07Smrg  # if we detect the quoting.
26314940c694Smrg  # TODO: see whether this extra hack can be removed once we start
26324940c694Smrg  # requiring Autoconf 2.70 or later.
26334940c694Smrg  AS_CASE([$CONFIG_FILES],
26344940c694Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
26354940c694Smrg          [*], [set x $CONFIG_FILES])
263648e5ce07Smrg  shift
26374940c694Smrg  # Used to flag and report bootstrapping failures.
26384940c694Smrg  am_rc=0
26394940c694Smrg  for am_mf
264048e5ce07Smrg  do
264148e5ce07Smrg    # Strip MF so we end up with the name of the file.
26424940c694Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
26434940c694Smrg    # Check whether this is an Automake generated Makefile which includes
26444940c694Smrg    # dependency-tracking related rules and includes.
26454940c694Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
264648e5ce07Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
26474940c694Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
26484940c694Smrg      || continue
26494940c694Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
26504940c694Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
26514940c694Smrg    AM_RUN_LOG([cd "$am_dirpart" \
26524940c694Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
26534940c694Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
265448e5ce07Smrg  done
26554940c694Smrg  if test $am_rc -ne 0; then
26564940c694Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
26574e8f48c7Smrg    for automatic dependency tracking.  If GNU make was not used, consider
26584e8f48c7Smrg    re-running the configure script with MAKE="gmake" (or whatever is
26594e8f48c7Smrg    necessary).  You can also try re-running configure with the
26604940c694Smrg    '--disable-dependency-tracking' option to at least be able to build
26614940c694Smrg    the package (albeit without support for automatic dependency tracking).])
26624940c694Smrg  fi
26634940c694Smrg  AS_UNSET([am_dirpart])
26644940c694Smrg  AS_UNSET([am_filepart])
26654940c694Smrg  AS_UNSET([am_mf])
26664940c694Smrg  AS_UNSET([am_rc])
26674940c694Smrg  rm -f conftest-deps.mk
266848e5ce07Smrg}
266948e5ce07Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2670b789ec8aSmrg
267148e5ce07Smrg
267248e5ce07Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
267348e5ce07Smrg# -----------------------------
267448e5ce07Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
267544584a44Smrg#
26764940c694Smrg# This code is only required when automatic dependency tracking is enabled.
26774940c694Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
26784940c694Smrg# order to bootstrap the dependency handling code.
267948e5ce07SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
268048e5ce07Smrg[AC_CONFIG_COMMANDS([depfiles],
268148e5ce07Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
26824940c694Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2683b789ec8aSmrg
268448e5ce07Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2685b789ec8aSmrg
26864e8f48c7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
268748e5ce07Smrg#
268848e5ce07Smrg# This file is free software; the Free Software Foundation
268948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
269048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2691b789ec8aSmrg
269248e5ce07Smrg# This macro actually does too much.  Some checks are only needed if
269348e5ce07Smrg# your package does certain things.  But this isn't really a big deal.
269448e5ce07Smrg
269548e5ce07Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
269648e5ce07Smrgm4_define([AC_PROG_CC],
269748e5ce07Smrgm4_defn([AC_PROG_CC])
269848e5ce07Smrg[_AM_PROG_CC_C_O
269948e5ce07Smrg])
2700b789ec8aSmrg
270148e5ce07Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
270248e5ce07Smrg# AM_INIT_AUTOMAKE([OPTIONS])
270348e5ce07Smrg# -----------------------------------------------
270448e5ce07Smrg# The call with PACKAGE and VERSION arguments is the old style
270548e5ce07Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
270648e5ce07Smrg# and VERSION should now be passed to AC_INIT and removed from
270748e5ce07Smrg# the call to AM_INIT_AUTOMAKE.
270848e5ce07Smrg# We support both call styles for the transition.  After
270948e5ce07Smrg# the next Automake release, Autoconf can make the AC_INIT
271048e5ce07Smrg# arguments mandatory, and then we can depend on a new Autoconf
271148e5ce07Smrg# release and drop the old call support.
271248e5ce07SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
271348e5ce07Smrg[AC_PREREQ([2.65])dnl
27144e8f48c7Smrgm4_ifdef([_$0_ALREADY_INIT],
27154e8f48c7Smrg  [m4_fatal([$0 expanded multiple times
27164e8f48c7Smrg]m4_defn([_$0_ALREADY_INIT]))],
27174e8f48c7Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
271848e5ce07Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
271948e5ce07Smrgdnl the ones we care about.
272048e5ce07Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
272148e5ce07SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
272248e5ce07SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
272348e5ce07Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
272448e5ce07Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
272548e5ce07Smrg  # is not polluted with repeated "-I."
272648e5ce07Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
272748e5ce07Smrg  # test to see if srcdir already configured
272848e5ce07Smrg  if test -f $srcdir/config.status; then
272948e5ce07Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
273044584a44Smrg  fi
273144584a44Smrgfi
2732b789ec8aSmrg
273348e5ce07Smrg# test whether we have cygpath
273448e5ce07Smrgif test -z "$CYGPATH_W"; then
273548e5ce07Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
273648e5ce07Smrg    CYGPATH_W='cygpath -w'
273748e5ce07Smrg  else
273848e5ce07Smrg    CYGPATH_W=echo
273944584a44Smrg  fi
274044584a44Smrgfi
274148e5ce07SmrgAC_SUBST([CYGPATH_W])
274244584a44Smrg
274348e5ce07Smrg# Define the identity of the package.
274448e5ce07Smrgdnl Distinguish between old-style and new-style calls.
274548e5ce07Smrgm4_ifval([$2],
274648e5ce07Smrg[AC_DIAGNOSE([obsolete],
274748e5ce07Smrg             [$0: two- and three-arguments forms are deprecated.])
274848e5ce07Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
274948e5ce07Smrg AC_SUBST([PACKAGE], [$1])dnl
275048e5ce07Smrg AC_SUBST([VERSION], [$2])],
275148e5ce07Smrg[_AM_SET_OPTIONS([$1])dnl
275248e5ce07Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
275348e5ce07Smrgm4_if(
27544e8f48c7Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
275548e5ce07Smrg  [ok:ok],,
275648e5ce07Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
275748e5ce07Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
275848e5ce07Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2759b789ec8aSmrg
276048e5ce07Smrg_AM_IF_OPTION([no-define],,
276148e5ce07Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
276248e5ce07Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2763b789ec8aSmrg
276448e5ce07Smrg# Some tools Automake needs.
276548e5ce07SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
276648e5ce07SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
276748e5ce07SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
276848e5ce07SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
276948e5ce07SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
277048e5ce07SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
277148e5ce07SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
277248e5ce07SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
277348e5ce07SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
277448e5ce07SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
277548e5ce07Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
277648e5ce07Smrg# dies out for good.  For more background, see:
27774940c694Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27784940c694Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
277948e5ce07SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
278048e5ce07Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
278148e5ce07Smrg# system "awk" is bad on some platforms.
278248e5ce07SmrgAC_REQUIRE([AC_PROG_AWK])dnl
278348e5ce07SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
278448e5ce07SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
278548e5ce07Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
278648e5ce07Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
278748e5ce07Smrg			     [_AM_PROG_TAR([v7])])])
278848e5ce07Smrg_AM_IF_OPTION([no-dependencies],,
278948e5ce07Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
279048e5ce07Smrg		  [_AM_DEPENDENCIES([CC])],
279148e5ce07Smrg		  [m4_define([AC_PROG_CC],
279248e5ce07Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
279348e5ce07SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
279448e5ce07Smrg		  [_AM_DEPENDENCIES([CXX])],
279548e5ce07Smrg		  [m4_define([AC_PROG_CXX],
279648e5ce07Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
279748e5ce07SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
279848e5ce07Smrg		  [_AM_DEPENDENCIES([OBJC])],
279948e5ce07Smrg		  [m4_define([AC_PROG_OBJC],
280048e5ce07Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
280148e5ce07SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
280248e5ce07Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
280348e5ce07Smrg		  [m4_define([AC_PROG_OBJCXX],
280448e5ce07Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
280548e5ce07Smrg])
28064e8f48c7Smrg# Variables for tags utilities; see am/tags.am
28074e8f48c7Smrgif test -z "$CTAGS"; then
28084e8f48c7Smrg  CTAGS=ctags
28094e8f48c7Smrgfi
28104e8f48c7SmrgAC_SUBST([CTAGS])
28114e8f48c7Smrgif test -z "$ETAGS"; then
28124e8f48c7Smrg  ETAGS=etags
28134e8f48c7Smrgfi
28144e8f48c7SmrgAC_SUBST([ETAGS])
28154e8f48c7Smrgif test -z "$CSCOPE"; then
28164e8f48c7Smrg  CSCOPE=cscope
28174e8f48c7Smrgfi
28184e8f48c7SmrgAC_SUBST([CSCOPE])
28194e8f48c7Smrg
282048e5ce07SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
282148e5ce07Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
282248e5ce07Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
282348e5ce07Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
282448e5ce07SmrgAC_CONFIG_COMMANDS_PRE(dnl
282548e5ce07Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
282648e5ce07Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
282789069ce9Smrg
282848e5ce07Smrg# POSIX will say in a future version that running "rm -f" with no argument
282948e5ce07Smrg# is OK; and we want to be able to make that assumption in our Makefile
283048e5ce07Smrg# recipes.  So use an aggressive probe to check that the usage we want is
283148e5ce07Smrg# actually supported "in the wild" to an acceptable degree.
283248e5ce07Smrg# See automake bug#10828.
283348e5ce07Smrg# To make any issue more visible, cause the running configure to be aborted
283448e5ce07Smrg# by default if the 'rm' program in use doesn't match our expectations; the
283548e5ce07Smrg# user can still override this though.
283648e5ce07Smrgif rm -f && rm -fr && rm -rf; then : OK; else
283748e5ce07Smrg  cat >&2 <<'END'
283848e5ce07SmrgOops!
2839b789ec8aSmrg
284048e5ce07SmrgYour 'rm' program seems unable to run without file operands specified
284148e5ce07Smrgon the command line, even when the '-f' option is present.  This is contrary
284248e5ce07Smrgto the behaviour of most rm programs out there, and not conforming with
284348e5ce07Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2844b789ec8aSmrg
284548e5ce07SmrgPlease tell bug-automake@gnu.org about your system, including the value
284648e5ce07Smrgof your $PATH and any error possibly output before this message.  This
284748e5ce07Smrgcan help us improve future automake versions.
2848dc9477beSmrg
284948e5ce07SmrgEND
285048e5ce07Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
285148e5ce07Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
285248e5ce07Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
285348e5ce07Smrg    echo >&2
285448e5ce07Smrg  else
285548e5ce07Smrg    cat >&2 <<'END'
285648e5ce07SmrgAborting the configuration process, to ensure you take notice of the issue.
2857b789ec8aSmrg
285848e5ce07SmrgYou can download and install GNU coreutils to get an 'rm' implementation
28594940c694Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2860dc9477beSmrg
286148e5ce07SmrgIf you want to complete the configuration process using your problematic
286248e5ce07Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
286348e5ce07Smrgto "yes", and re-run configure.
286448e5ce07Smrg
286548e5ce07SmrgEND
286648e5ce07Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
286748e5ce07Smrg  fi
286889069ce9Smrgfi
286948e5ce07Smrgdnl The trailing newline in this macro's definition is deliberate, for
287048e5ce07Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
287148e5ce07Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
287248e5ce07Smrg])
287337eb1ca1Smrg
287448e5ce07Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
287548e5ce07Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
287648e5ce07Smrgdnl mangled by Autoconf and run in a shell conditional statement.
287748e5ce07Smrgm4_define([_AC_COMPILER_EXEEXT],
287848e5ce07Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
287906c34b88Smrg
288048e5ce07Smrg# When config.status generates a header, we must update the stamp-h file.
288148e5ce07Smrg# This file resides in the same directory as the config header
288248e5ce07Smrg# that is generated.  The stamp files are numbered to have different names.
288306c34b88Smrg
288448e5ce07Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
288548e5ce07Smrg# loop where config.status creates the headers, so we can generate
288648e5ce07Smrg# our stamp files there.
288748e5ce07SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
288848e5ce07Smrg[# Compute $1's index in $config_headers.
288948e5ce07Smrg_am_arg=$1
289048e5ce07Smrg_am_stamp_count=1
289148e5ce07Smrgfor _am_header in $config_headers :; do
289248e5ce07Smrg  case $_am_header in
289348e5ce07Smrg    $_am_arg | $_am_arg:* )
289448e5ce07Smrg      break ;;
289548e5ce07Smrg    * )
289648e5ce07Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
289748e5ce07Smrg  esac
289848e5ce07Smrgdone
289948e5ce07Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2900b789ec8aSmrg
29014e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
290248e5ce07Smrg#
290348e5ce07Smrg# This file is free software; the Free Software Foundation
290448e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
290548e5ce07Smrg# with or without modifications, as long as this notice is preserved.
290644584a44Smrg
290748e5ce07Smrg# AM_PROG_INSTALL_SH
290848e5ce07Smrg# ------------------
290948e5ce07Smrg# Define $install_sh.
291048e5ce07SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
291148e5ce07Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
291248e5ce07Smrgif test x"${install_sh+set}" != xset; then
291348e5ce07Smrg  case $am_aux_dir in
291448e5ce07Smrg  *\ * | *\	*)
291548e5ce07Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
291648e5ce07Smrg  *)
291748e5ce07Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
291848e5ce07Smrg  esac
2919dc9477beSmrgfi
292048e5ce07SmrgAC_SUBST([install_sh])])
2921dc9477beSmrg
29224e8f48c7Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
292348e5ce07Smrg#
292448e5ce07Smrg# This file is free software; the Free Software Foundation
292548e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
292648e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2927dc9477beSmrg
292848e5ce07Smrg# Check whether the underlying file-system supports filenames
292948e5ce07Smrg# with a leading dot.  For instance MS-DOS doesn't.
293048e5ce07SmrgAC_DEFUN([AM_SET_LEADING_DOT],
293148e5ce07Smrg[rm -rf .tst 2>/dev/null
293248e5ce07Smrgmkdir .tst 2>/dev/null
293348e5ce07Smrgif test -d .tst; then
293448e5ce07Smrg  am__leading_dot=.
293548e5ce07Smrgelse
293648e5ce07Smrg  am__leading_dot=_
293748e5ce07Smrgfi
293848e5ce07Smrgrmdir .tst 2>/dev/null
293948e5ce07SmrgAC_SUBST([am__leading_dot])])
2940b789ec8aSmrg
294148e5ce07Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2942b789ec8aSmrg
29434e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
294444584a44Smrg#
294548e5ce07Smrg# This file is free software; the Free Software Foundation
294648e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
294748e5ce07Smrg# with or without modifications, as long as this notice is preserved.
294806c34b88Smrg
294948e5ce07Smrg# AM_MAKE_INCLUDE()
295048e5ce07Smrg# -----------------
29514940c694Smrg# Check whether make has an 'include' directive that can support all
29524940c694Smrg# the idioms we need for our automatic dependency tracking code.
295348e5ce07SmrgAC_DEFUN([AM_MAKE_INCLUDE],
29544940c694Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
29554940c694Smrgcat > confinc.mk << 'END'
295648e5ce07Smrgam__doit:
29574940c694Smrg	@echo this is the am__doit target >confinc.out
295848e5ce07Smrg.PHONY: am__doit
295948e5ce07SmrgEND
296048e5ce07Smrgam__include="#"
296148e5ce07Smrgam__quote=
29624940c694Smrg# BSD make does it like this.
29634940c694Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
29644940c694Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
29654940c694Smrgecho 'include confinc.mk # ignored' > confmf.GNU
29664940c694Smrg_am_result=no
29674940c694Smrgfor s in GNU BSD; do
29684940c694Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
29694940c694Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
29704940c694Smrg      ['0:this is the am__doit target'],
29714940c694Smrg      [AS_CASE([$s],
29724940c694Smrg          [BSD], [am__include='.include' am__quote='"'],
29734940c694Smrg          [am__include='include' am__quote=''])])
29744940c694Smrg  if test "$am__include" != "#"; then
29754940c694Smrg    _am_result="yes ($s style)"
29764940c694Smrg    break
29774940c694Smrg  fi
29784940c694Smrgdone
29794940c694Smrgrm -f confinc.* confmf.*
29804940c694SmrgAC_MSG_RESULT([${_am_result}])
29814940c694SmrgAC_SUBST([am__include])])
29824940c694SmrgAC_SUBST([am__quote])])
2983b789ec8aSmrg
298448e5ce07Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2985b789ec8aSmrg
29864e8f48c7Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
298744584a44Smrg#
298848e5ce07Smrg# This file is free software; the Free Software Foundation
298948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
299048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
299144584a44Smrg
299248e5ce07Smrg# AM_MISSING_PROG(NAME, PROGRAM)
299348e5ce07Smrg# ------------------------------
299448e5ce07SmrgAC_DEFUN([AM_MISSING_PROG],
299548e5ce07Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
299648e5ce07Smrg$1=${$1-"${am_missing_run}$2"}
299748e5ce07SmrgAC_SUBST($1)])
299844584a44Smrg
299948e5ce07Smrg# AM_MISSING_HAS_RUN
300048e5ce07Smrg# ------------------
300148e5ce07Smrg# Define MISSING if not defined so far and test if it is modern enough.
300248e5ce07Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
300348e5ce07SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
300448e5ce07Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
300548e5ce07SmrgAC_REQUIRE_AUX_FILE([missing])dnl
300648e5ce07Smrgif test x"${MISSING+set}" != xset; then
30074e8f48c7Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
300889069ce9Smrgfi
300948e5ce07Smrg# Use eval to expand $SHELL
301048e5ce07Smrgif eval "$MISSING --is-lightweight"; then
301148e5ce07Smrg  am_missing_run="$MISSING "
301248e5ce07Smrgelse
301348e5ce07Smrg  am_missing_run=
301448e5ce07Smrg  AC_MSG_WARN(['missing' script is too old or missing])
301544584a44Smrgfi
301648e5ce07Smrg])
301744584a44Smrg
301848e5ce07Smrg# Helper functions for option handling.                     -*- Autoconf -*-
301944584a44Smrg
30204e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
302148e5ce07Smrg#
302248e5ce07Smrg# This file is free software; the Free Software Foundation
302348e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
302448e5ce07Smrg# with or without modifications, as long as this notice is preserved.
302544584a44Smrg
302648e5ce07Smrg# _AM_MANGLE_OPTION(NAME)
302748e5ce07Smrg# -----------------------
302848e5ce07SmrgAC_DEFUN([_AM_MANGLE_OPTION],
302948e5ce07Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
303044584a44Smrg
303148e5ce07Smrg# _AM_SET_OPTION(NAME)
303248e5ce07Smrg# --------------------
303348e5ce07Smrg# Set option NAME.  Presently that only means defining a flag for this option.
303448e5ce07SmrgAC_DEFUN([_AM_SET_OPTION],
303548e5ce07Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
303644584a44Smrg
303748e5ce07Smrg# _AM_SET_OPTIONS(OPTIONS)
303848e5ce07Smrg# ------------------------
303948e5ce07Smrg# OPTIONS is a space-separated list of Automake options.
304048e5ce07SmrgAC_DEFUN([_AM_SET_OPTIONS],
304148e5ce07Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
304244584a44Smrg
304348e5ce07Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
304448e5ce07Smrg# -------------------------------------------
304548e5ce07Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
304648e5ce07SmrgAC_DEFUN([_AM_IF_OPTION],
304748e5ce07Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
30483e256790Smrg
30494e8f48c7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
305044584a44Smrg#
305148e5ce07Smrg# This file is free software; the Free Software Foundation
305248e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
305348e5ce07Smrg# with or without modifications, as long as this notice is preserved.
305444584a44Smrg
305548e5ce07Smrg# _AM_PROG_CC_C_O
305648e5ce07Smrg# ---------------
305748e5ce07Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
305848e5ce07Smrg# to automatically call this.
305948e5ce07SmrgAC_DEFUN([_AM_PROG_CC_C_O],
306048e5ce07Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
306148e5ce07SmrgAC_REQUIRE_AUX_FILE([compile])dnl
306248e5ce07SmrgAC_LANG_PUSH([C])dnl
306348e5ce07SmrgAC_CACHE_CHECK(
306448e5ce07Smrg  [whether $CC understands -c and -o together],
306548e5ce07Smrg  [am_cv_prog_cc_c_o],
306648e5ce07Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
306748e5ce07Smrg  # Make sure it works both with $CC and with simple cc.
306848e5ce07Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
306948e5ce07Smrg  # compilers refuse to overwrite an existing .o file with -o,
307048e5ce07Smrg  # though they will create one.
307148e5ce07Smrg  am_cv_prog_cc_c_o=yes
307248e5ce07Smrg  for am_i in 1 2; do
307348e5ce07Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
307448e5ce07Smrg         && test -f conftest2.$ac_objext; then
307548e5ce07Smrg      : OK
307648e5ce07Smrg    else
307748e5ce07Smrg      am_cv_prog_cc_c_o=no
307848e5ce07Smrg      break
307948e5ce07Smrg    fi
308048e5ce07Smrg  done
308148e5ce07Smrg  rm -f core conftest*
308248e5ce07Smrg  unset am_i])
308348e5ce07Smrgif test "$am_cv_prog_cc_c_o" != yes; then
308448e5ce07Smrg   # Losing compiler, so override with the script.
308548e5ce07Smrg   # FIXME: It is wrong to rewrite CC.
308648e5ce07Smrg   # But if we don't then we get into trouble of one sort or another.
308748e5ce07Smrg   # A longer-term fix would be to have automake use am__CC in this case,
308848e5ce07Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
308948e5ce07Smrg   CC="$am_aux_dir/compile $CC"
3090f1ee322dSmrgfi
309148e5ce07SmrgAC_LANG_POP([C])])
3092c43cc173Smrg
309348e5ce07Smrg# For backward compatibility.
309448e5ce07SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
309548e5ce07Smrg
30964e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
309748e5ce07Smrg#
309848e5ce07Smrg# This file is free software; the Free Software Foundation
309948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
310048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
310148e5ce07Smrg
310248e5ce07Smrg# AM_RUN_LOG(COMMAND)
310348e5ce07Smrg# -------------------
310448e5ce07Smrg# Run COMMAND, save the exit status in ac_status, and log it.
310548e5ce07Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
310648e5ce07SmrgAC_DEFUN([AM_RUN_LOG],
310748e5ce07Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
310848e5ce07Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
310948e5ce07Smrg   ac_status=$?
311048e5ce07Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
311148e5ce07Smrg   (exit $ac_status); }])
311206c34b88Smrg
311348e5ce07Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3114c43cc173Smrg
31154e8f48c7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
311648e5ce07Smrg#
311748e5ce07Smrg# This file is free software; the Free Software Foundation
311848e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
311948e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3120dc9477beSmrg
312148e5ce07Smrg# AM_SANITY_CHECK
312248e5ce07Smrg# ---------------
312348e5ce07SmrgAC_DEFUN([AM_SANITY_CHECK],
312448e5ce07Smrg[AC_MSG_CHECKING([whether build environment is sane])
312548e5ce07Smrg# Reject unsafe characters in $srcdir or the absolute working directory
312648e5ce07Smrg# name.  Accept space and tab only in the latter.
312748e5ce07Smrgam_lf='
312848e5ce07Smrg'
312948e5ce07Smrgcase `pwd` in
313048e5ce07Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
313148e5ce07Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
313248e5ce07Smrgesac
313348e5ce07Smrgcase $srcdir in
313448e5ce07Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
313548e5ce07Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
313648e5ce07Smrgesac
3137dc9477beSmrg
313848e5ce07Smrg# Do 'set' in a subshell so we don't clobber the current shell's
313948e5ce07Smrg# arguments.  Must try -L first in case configure is actually a
314048e5ce07Smrg# symlink; some systems play weird games with the mod time of symlinks
314148e5ce07Smrg# (eg FreeBSD returns the mod time of the symlink's containing
314248e5ce07Smrg# directory).
314348e5ce07Smrgif (
314448e5ce07Smrg   am_has_slept=no
314548e5ce07Smrg   for am_try in 1 2; do
314648e5ce07Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
314748e5ce07Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
314848e5ce07Smrg     if test "$[*]" = "X"; then
314948e5ce07Smrg	# -L didn't work.
315048e5ce07Smrg	set X `ls -t "$srcdir/configure" conftest.file`
315148e5ce07Smrg     fi
315248e5ce07Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
315348e5ce07Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
315437eb1ca1Smrg
315548e5ce07Smrg	# If neither matched, then we have a broken ls.  This can happen
315648e5ce07Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
315748e5ce07Smrg	# broken ls alias from the environment.  This has actually
315848e5ce07Smrg	# happened.  Such a system could not be considered "sane".
315948e5ce07Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
316048e5ce07Smrg  alias in your environment])
316148e5ce07Smrg     fi
316248e5ce07Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
316348e5ce07Smrg       break
316448e5ce07Smrg     fi
316548e5ce07Smrg     # Just in case.
316648e5ce07Smrg     sleep 1
316748e5ce07Smrg     am_has_slept=yes
316848e5ce07Smrg   done
316948e5ce07Smrg   test "$[2]" = conftest.file
317048e5ce07Smrg   )
317148e5ce07Smrgthen
317248e5ce07Smrg   # Ok.
317348e5ce07Smrg   :
317444584a44Smrgelse
317548e5ce07Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
317648e5ce07SmrgCheck your system clock])
317744584a44Smrgfi
317848e5ce07SmrgAC_MSG_RESULT([yes])
317948e5ce07Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
318048e5ce07Smrg# generated files are strictly newer.
318148e5ce07Smrgam_sleep_pid=
318248e5ce07Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
318348e5ce07Smrg  ( sleep 1 ) &
318448e5ce07Smrg  am_sleep_pid=$!
318548e5ce07Smrgfi
318648e5ce07SmrgAC_CONFIG_COMMANDS_PRE(
318748e5ce07Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
318848e5ce07Smrg   if test -n "$am_sleep_pid"; then
318948e5ce07Smrg     # Hide warnings about reused PIDs.
319048e5ce07Smrg     wait $am_sleep_pid 2>/dev/null
319148e5ce07Smrg   fi
319248e5ce07Smrg   AC_MSG_RESULT([done])])
319348e5ce07Smrgrm -f conftest.file
319448e5ce07Smrg])
3195dc9477beSmrg
31964e8f48c7Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
3197dc9477beSmrg#
319848e5ce07Smrg# This file is free software; the Free Software Foundation
319948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
320048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3201c27c18e8Smrg
320248e5ce07Smrg# AM_SILENT_RULES([DEFAULT])
320348e5ce07Smrg# --------------------------
320448e5ce07Smrg# Enable less verbose build rules; with the default set to DEFAULT
320548e5ce07Smrg# ("yes" being less verbose, "no" or empty being verbose).
320648e5ce07SmrgAC_DEFUN([AM_SILENT_RULES],
320748e5ce07Smrg[AC_ARG_ENABLE([silent-rules], [dnl
320848e5ce07SmrgAS_HELP_STRING(
320948e5ce07Smrg  [--enable-silent-rules],
321048e5ce07Smrg  [less verbose build output (undo: "make V=1")])
321148e5ce07SmrgAS_HELP_STRING(
321248e5ce07Smrg  [--disable-silent-rules],
321348e5ce07Smrg  [verbose build output (undo: "make V=0")])dnl
321448e5ce07Smrg])
321548e5ce07Smrgcase $enable_silent_rules in @%:@ (((
321648e5ce07Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
321748e5ce07Smrg   no) AM_DEFAULT_VERBOSITY=1;;
321848e5ce07Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
321948e5ce07Smrgesac
322048e5ce07Smrgdnl
322148e5ce07Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
322248e5ce07Smrgdnl do not support nested variable expansions.
322348e5ce07Smrgdnl See automake bug#9928 and bug#10237.
322448e5ce07Smrgam_make=${MAKE-make}
322548e5ce07SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
322648e5ce07Smrg   [am_cv_make_support_nested_variables],
322748e5ce07Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
322848e5ce07SmrgBAR0=false
322948e5ce07SmrgBAR1=true
323048e5ce07SmrgV=1
323148e5ce07Smrgam__doit:
323248e5ce07Smrg	@$(TRUE)
323348e5ce07Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
323448e5ce07Smrg  am_cv_make_support_nested_variables=yes
323548e5ce07Smrgelse
323648e5ce07Smrg  am_cv_make_support_nested_variables=no
323748e5ce07Smrgfi])
323848e5ce07Smrgif test $am_cv_make_support_nested_variables = yes; then
323948e5ce07Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
324048e5ce07Smrg  AM_V='$(V)'
324148e5ce07Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
324248e5ce07Smrgelse
324348e5ce07Smrg  AM_V=$AM_DEFAULT_VERBOSITY
324448e5ce07Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
324548e5ce07Smrgfi
324648e5ce07SmrgAC_SUBST([AM_V])dnl
324748e5ce07SmrgAM_SUBST_NOTMAKE([AM_V])dnl
324848e5ce07SmrgAC_SUBST([AM_DEFAULT_V])dnl
324948e5ce07SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
325048e5ce07SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
325148e5ce07SmrgAM_BACKSLASH='\'
325248e5ce07SmrgAC_SUBST([AM_BACKSLASH])dnl
325348e5ce07Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
325448e5ce07Smrg])
325548e5ce07Smrg
32564e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
325744584a44Smrg#
325848e5ce07Smrg# This file is free software; the Free Software Foundation
325948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
326048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
326148e5ce07Smrg
326248e5ce07Smrg# AM_PROG_INSTALL_STRIP
326348e5ce07Smrg# ---------------------
326448e5ce07Smrg# One issue with vendor 'install' (even GNU) is that you can't
326548e5ce07Smrg# specify the program used to strip binaries.  This is especially
326648e5ce07Smrg# annoying in cross-compiling environments, where the build's strip
326748e5ce07Smrg# is unlikely to handle the host's binaries.
326848e5ce07Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
326948e5ce07Smrg# always use install-sh in "make install-strip", and initialize
327048e5ce07Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
327148e5ce07SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
327248e5ce07Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
327348e5ce07Smrg# Installed binaries are usually stripped using 'strip' when the user
327448e5ce07Smrg# run "make install-strip".  However 'strip' might not be the right
327548e5ce07Smrg# tool to use in cross-compilation environments, therefore Automake
327648e5ce07Smrg# will honor the 'STRIP' environment variable to overrule this program.
327748e5ce07Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
327848e5ce07Smrgif test "$cross_compiling" != no; then
327948e5ce07Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
328048e5ce07Smrgfi
328148e5ce07SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
328248e5ce07SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3283b789ec8aSmrg
32844e8f48c7Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
328548e5ce07Smrg#
328648e5ce07Smrg# This file is free software; the Free Software Foundation
328748e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
328848e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3289b789ec8aSmrg
329048e5ce07Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
329148e5ce07Smrg# ---------------------------
329248e5ce07Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
329348e5ce07Smrg# This macro is traced by Automake.
329448e5ce07SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3295c27c18e8Smrg
329648e5ce07Smrg# AM_SUBST_NOTMAKE(VARIABLE)
329748e5ce07Smrg# --------------------------
329848e5ce07Smrg# Public sister of _AM_SUBST_NOTMAKE.
329948e5ce07SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
330089069ce9Smrg
330148e5ce07Smrg# Check how to create a tarball.                            -*- Autoconf -*-
33023e256790Smrg
33034e8f48c7Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
330448e5ce07Smrg#
330548e5ce07Smrg# This file is free software; the Free Software Foundation
330648e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
330748e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3308c43cc173Smrg
330948e5ce07Smrg# _AM_PROG_TAR(FORMAT)
331044584a44Smrg# --------------------
331148e5ce07Smrg# Check how to create a tarball in format FORMAT.
331248e5ce07Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
331344584a44Smrg#
331448e5ce07Smrg# Substitute a variable $(am__tar) that is a command
331548e5ce07Smrg# writing to stdout a FORMAT-tarball containing the directory
331648e5ce07Smrg# $tardir.
331748e5ce07Smrg#     tardir=directory && $(am__tar) > result.tar
331844584a44Smrg#
331948e5ce07Smrg# Substitute a variable $(am__untar) that extract such
332048e5ce07Smrg# a tarball read from stdin.
332148e5ce07Smrg#     $(am__untar) < result.tar
332244584a44Smrg#
332348e5ce07SmrgAC_DEFUN([_AM_PROG_TAR],
332448e5ce07Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
332548e5ce07Smrg# in the wild :-(  We should find a proper way to deprecate it ...
332648e5ce07SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3327dc9477beSmrg
332848e5ce07Smrg# We'll loop over all known methods to create a tar archive until one works.
332948e5ce07Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3330dc9477beSmrg
333148e5ce07Smrgm4_if([$1], [v7],
333248e5ce07Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3333dc9477beSmrg
333448e5ce07Smrg  [m4_case([$1],
333548e5ce07Smrg    [ustar],
333648e5ce07Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
333748e5ce07Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
333848e5ce07Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
333948e5ce07Smrg      # and bug#13588).
334048e5ce07Smrg      am_max_uid=2097151 # 2^21 - 1
334148e5ce07Smrg      am_max_gid=$am_max_uid
334248e5ce07Smrg      # The $UID and $GID variables are not portable, so we need to resort
334348e5ce07Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
334448e5ce07Smrg      # below are definitely unexpected, so allow the users to see them
334548e5ce07Smrg      # (that is, avoid stderr redirection).
334648e5ce07Smrg      am_uid=`id -u || echo unknown`
334748e5ce07Smrg      am_gid=`id -g || echo unknown`
334848e5ce07Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
334948e5ce07Smrg      if test $am_uid -le $am_max_uid; then
335048e5ce07Smrg         AC_MSG_RESULT([yes])
335148e5ce07Smrg      else
335248e5ce07Smrg         AC_MSG_RESULT([no])
335348e5ce07Smrg         _am_tools=none
335448e5ce07Smrg      fi
335548e5ce07Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
335648e5ce07Smrg      if test $am_gid -le $am_max_gid; then
335748e5ce07Smrg         AC_MSG_RESULT([yes])
335848e5ce07Smrg      else
335948e5ce07Smrg        AC_MSG_RESULT([no])
336048e5ce07Smrg        _am_tools=none
336148e5ce07Smrg      fi],
336248e5ce07Smrg
336348e5ce07Smrg  [pax],
336448e5ce07Smrg    [],
336548e5ce07Smrg
336648e5ce07Smrg  [m4_fatal([Unknown tar format])])
336748e5ce07Smrg
336848e5ce07Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
336948e5ce07Smrg
337048e5ce07Smrg  # Go ahead even if we have the value already cached.  We do so because we
337148e5ce07Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
337248e5ce07Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
337348e5ce07Smrg
337448e5ce07Smrg  for _am_tool in $_am_tools; do
337548e5ce07Smrg    case $_am_tool in
337648e5ce07Smrg    gnutar)
337748e5ce07Smrg      for _am_tar in tar gnutar gtar; do
337848e5ce07Smrg        AM_RUN_LOG([$_am_tar --version]) && break
337948e5ce07Smrg      done
338048e5ce07Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
338148e5ce07Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
338248e5ce07Smrg      am__untar="$_am_tar -xf -"
338348e5ce07Smrg      ;;
338448e5ce07Smrg    plaintar)
338548e5ce07Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
338648e5ce07Smrg      # ustar tarball either.
338748e5ce07Smrg      (tar --version) >/dev/null 2>&1 && continue
338848e5ce07Smrg      am__tar='tar chf - "$$tardir"'
338948e5ce07Smrg      am__tar_='tar chf - "$tardir"'
339048e5ce07Smrg      am__untar='tar xf -'
339148e5ce07Smrg      ;;
339248e5ce07Smrg    pax)
339348e5ce07Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
339448e5ce07Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
339548e5ce07Smrg      am__untar='pax -r'
339648e5ce07Smrg      ;;
339748e5ce07Smrg    cpio)
339848e5ce07Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
339948e5ce07Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
340048e5ce07Smrg      am__untar='cpio -i -H $1 -d'
340148e5ce07Smrg      ;;
340248e5ce07Smrg    none)
340348e5ce07Smrg      am__tar=false
340448e5ce07Smrg      am__tar_=false
340548e5ce07Smrg      am__untar=false
340648e5ce07Smrg      ;;
340748e5ce07Smrg    esac
340848e5ce07Smrg
340948e5ce07Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
341048e5ce07Smrg    # and am__untar set.
341148e5ce07Smrg    test -n "${am_cv_prog_tar_$1}" && break
341248e5ce07Smrg
341348e5ce07Smrg    # tar/untar a dummy directory, and stop if the command works.
341448e5ce07Smrg    rm -rf conftest.dir
341548e5ce07Smrg    mkdir conftest.dir
341648e5ce07Smrg    echo GrepMe > conftest.dir/file
341748e5ce07Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
341848e5ce07Smrg    rm -rf conftest.dir
341948e5ce07Smrg    if test -s conftest.tar; then
342048e5ce07Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
342148e5ce07Smrg      AM_RUN_LOG([cat conftest.dir/file])
342248e5ce07Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
342348e5ce07Smrg    fi
342448e5ce07Smrg  done
342548e5ce07Smrg  rm -rf conftest.dir
342648e5ce07Smrg
342748e5ce07Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
342848e5ce07Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
342948e5ce07Smrg
343048e5ce07SmrgAC_SUBST([am__tar])
343148e5ce07SmrgAC_SUBST([am__untar])
343248e5ce07Smrg]) # _AM_PROG_TAR
3433c43cc173Smrg
34344e8f48c7Smrgm4_include([m4/libtool.m4])
34354e8f48c7Smrgm4_include([m4/ltoptions.m4])
34364e8f48c7Smrgm4_include([m4/ltsugar.m4])
34374e8f48c7Smrgm4_include([m4/ltversion.m4])
34384e8f48c7Smrgm4_include([m4/lt~obsolete.m4])
3439