aclocal.m4 revision 4e8f48c7
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
234940c694Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
244940c694Smrg# serial 11 (pkg-config-0.29.1)
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],
6648e5ce07Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
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])
11148e5ce07Smrgdnl only at the first occurence 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
16706c34b88SmrgAC_MSG_CHECKING([for $1])
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
17706c34b88Smrg   	AC_MSG_RESULT([no])
17806c34b88Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17906c34b88Smrg        if test $_pkg_short_errors_supported = yes; then
180dc9477beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18106c34b88Smrg        else 
182dc9477beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18306c34b88Smrg        fi
18406c34b88Smrg	# Put the nasty error message in config.log where it belongs
18506c34b88Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
18606c34b88Smrg
18706c34b88Smrg	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
19806c34b88Smrg     	AC_MSG_RESULT([no])
19906c34b88Smrg	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
20906c34b88Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21006c34b88Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21106c34b88Smrg        AC_MSG_RESULT([yes])
21206c34b88Smrg	$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
3694e8f48c7Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
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],[
4064e8f48c7Smrgm4_define([vers_have], [1.19.3])
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
73648e5ce07Smrg# the --with-xmlto option, it allows maximum flexibilty 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
95048e5ce07Smrg# the --with-asciidoc option, it allows maximum flexibilty 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
102048e5ce07Smrg# the --with-doxygen option, it allows maximum flexibilty 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
110448e5ce07Smrg# the --with-groff option, it allows maximum flexibilty 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
121248e5ce07Smrg# the --with-fop option, it allows maximum flexibilty 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
130648e5ce07Smrg# the --with-ps2pdf option, it allows maximum flexibilty 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
136148e5ce07Smrg# maximum flexibilty 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
139448e5ce07Smrg# maximum flexibilty 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
142748e5ce07Smrg# maximum flexibilty 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], [
190248e5ce07Smrg		AC_REQUIRE([AC_PROG_CC_C99])
190348e5ce07Smrg	],
190448e5ce07Smrg	[C++], [
190548e5ce07Smrg		AC_REQUIRE([AC_PROG_CXX])
190648e5ce07Smrg	]
190748e5ce07Smrg)
190848e5ce07SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
190948e5ce07SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
191048e5ce07SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
191148e5ce07Smrg]) # XORG_COMPILER_BRAND
1912dc9477beSmrg
191348e5ce07Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
191448e5ce07Smrg# ---------------
191548e5ce07Smrg# Minimum version: 1.16.0
191648e5ce07Smrg#
191748e5ce07Smrg# Test if the compiler works when passed the given flag as a command line argument.
191848e5ce07Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
191948e5ce07Smrg# next flag in the list until there are no more options.
192048e5ce07Smrg#
192148e5ce07Smrg# Note that this does not guarantee that the compiler supports the flag as some
192248e5ce07Smrg# compilers will simply ignore arguments that they do not understand, but we do
192348e5ce07Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
192448e5ce07Smrg# -Werror=unused-command-line-argument
192548e5ce07Smrg#
192648e5ce07SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
192748e5ce07Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
192848e5ce07Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
192944584a44Smrg
193048e5ce07SmrgAC_LANG_COMPILER_REQUIRE
193144584a44Smrg
193248e5ce07SmrgAC_LANG_CASE(
193348e5ce07Smrg	[C], [
193448e5ce07Smrg		AC_REQUIRE([AC_PROG_CC_C99])
193548e5ce07Smrg		define([PREFIX], [C])
193648e5ce07Smrg		define([CACHE_PREFIX], [cc])
193748e5ce07Smrg		define([COMPILER], [$CC])
193848e5ce07Smrg	],
193948e5ce07Smrg	[C++], [
194048e5ce07Smrg		define([PREFIX], [CXX])
194148e5ce07Smrg		define([CACHE_PREFIX], [cxx])
194248e5ce07Smrg		define([COMPILER], [$CXX])
194348e5ce07Smrg	]
194448e5ce07Smrg)
1945dc9477beSmrg
194648e5ce07Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1947dc9477beSmrg
194848e5ce07Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
194948e5ce07Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
195048e5ce07Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
195148e5ce07Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
195248e5ce07Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
195348e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
195448e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
195548e5ce07Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
195648e5ce07Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
195744584a44Smrgfi
195844584a44Smrg
195948e5ce07Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
196048e5ce07Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
196148e5ce07Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
196248e5ce07Smrg	fi
196348e5ce07Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
196448e5ce07Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
196548e5ce07Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
196648e5ce07Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
196748e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
196848e5ce07Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
196948e5ce07Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
197048e5ce07Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
197144584a44Smrgfi
197244584a44Smrg
197348e5ce07Smrgfound="no"
197448e5ce07Smrgm4_foreach([flag], m4_cdr($@), [
197548e5ce07Smrg	if test $found = "no" ; then
197648e5ce07Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
197748e5ce07Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
197848e5ce07Smrg		fi
197944584a44Smrg
198048e5ce07Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
198148e5ce07Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
198248e5ce07Smrg		fi
198344584a44Smrg
198448e5ce07Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1985dc9477beSmrg
198648e5ce07Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
198748e5ce07Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
198848e5ce07Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
198948e5ce07Smrg		AC_CACHE_VAL($cacheid,
199048e5ce07Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
199148e5ce07Smrg					     [eval $cacheid=yes],
199248e5ce07Smrg					     [eval $cacheid=no])])
1993dc9477beSmrg
199448e5ce07Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
199544584a44Smrg
199648e5ce07Smrg		eval supported=\$$cacheid
199748e5ce07Smrg		AC_MSG_RESULT([$supported])
199848e5ce07Smrg		if test "$supported" = "yes" ; then
199948e5ce07Smrg			$1="$$1 ]flag["
200048e5ce07Smrg			found="yes"
200148e5ce07Smrg		fi
200248e5ce07Smrg	fi
200348e5ce07Smrg])
200448e5ce07Smrg]) # XORG_TESTSET_CFLAG
200544584a44Smrg
200648e5ce07Smrg# XORG_COMPILER_FLAGS
200748e5ce07Smrg# ---------------
200848e5ce07Smrg# Minimum version: 1.16.0
2009dc9477beSmrg#
201048e5ce07Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
201148e5ce07Smrg# arguments supported by the selected compiler which do NOT alter the generated
201248e5ce07Smrg# code.  These arguments will cause the compiler to print various warnings
201348e5ce07Smrg# during compilation AND turn a conservative set of warnings into errors.
2014dc9477beSmrg#
201548e5ce07Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
201648e5ce07Smrg# future versions of util-macros as options are added to new compilers.
2017dc9477beSmrg#
201848e5ce07SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
201948e5ce07SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2020dc9477beSmrg
202148e5ce07SmrgAC_ARG_ENABLE(selective-werror,
202248e5ce07Smrg              AS_HELP_STRING([--disable-selective-werror],
202348e5ce07Smrg                             [Turn off selective compiler errors. (default: enabled)]),
202448e5ce07Smrg              [SELECTIVE_WERROR=$enableval],
202548e5ce07Smrg              [SELECTIVE_WERROR=yes])
202648e5ce07Smrg
202748e5ce07SmrgAC_LANG_CASE(
202848e5ce07Smrg        [C], [
202948e5ce07Smrg                define([PREFIX], [C])
203048e5ce07Smrg        ],
203148e5ce07Smrg        [C++], [
203248e5ce07Smrg                define([PREFIX], [CXX])
203348e5ce07Smrg        ]
203448e5ce07Smrg)
203548e5ce07Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
203648e5ce07Smrgif test "x$SUNCC" = "xyes"; then
203748e5ce07Smrg    [BASE_]PREFIX[FLAGS]="-v"
203844584a44Smrgelse
203948e5ce07Smrg    [BASE_]PREFIX[FLAGS]=""
204044584a44Smrgfi
2041dc9477beSmrg
204248e5ce07Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
204348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
204448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
204548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
204648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
204744584a44Smrg
204848e5ce07SmrgAC_LANG_CASE(
204948e5ce07Smrg	[C], [
205048e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
205148e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
205248e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
205348e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
205448e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
205548e5ce07Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
205648e5ce07Smrg	]
205748e5ce07Smrg)
205848e5ce07Smrg
205948e5ce07Smrg# This chunk adds additional warnings that could catch undesired effects.
206048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
206148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
206248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
206348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
206448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
206548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
206648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
206748e5ce07Smrg
206848e5ce07Smrg# These are currently disabled because they are noisy.  They will be enabled
206948e5ce07Smrg# in the future once the codebase is sufficiently modernized to silence
207048e5ce07Smrg# them.  For now, I don't want them to drown out the other warnings.
207148e5ce07Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
207248e5ce07Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
207348e5ce07Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
207448e5ce07Smrg
207548e5ce07Smrg# Turn some warnings into errors, so we don't accidently get successful builds
207648e5ce07Smrg# when there are problems that should be fixed.
207748e5ce07Smrg
207848e5ce07Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
207948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
208048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
208148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
208248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
208348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
208448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
208548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
208648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
208748e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
208848e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
208948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
209048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
209148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
209248e5ce07Smrgelse
209348e5ce07SmrgAC_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])
209448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
209548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
209648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
209748e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
209848e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
209948e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
210048e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
210148e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
210248e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
210348e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
210448e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
210548e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
210648e5ce07SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
210748e5ce07Smrgfi
210848e5ce07Smrg
210948e5ce07SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
211048e5ce07Smrg]) # XORG_COMPILER_FLAGS
211148e5ce07Smrg
211248e5ce07Smrg# XORG_CWARNFLAGS
211348e5ce07Smrg# ---------------
211448e5ce07Smrg# Minimum version: 1.2.0
211548e5ce07Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2116dc9477beSmrg#
211748e5ce07Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2118dc9477beSmrg#
211948e5ce07Smrg# This function is deprecated because it defines -fno-strict-aliasing
212048e5ce07Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
212148e5ce07Smrg# is needed, then it should be added explicitly in the module when
212248e5ce07Smrg# it is updated to use BASE_CFLAGS.
2123dc9477beSmrg#
212448e5ce07SmrgAC_DEFUN([XORG_CWARNFLAGS], [
212548e5ce07SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
212648e5ce07SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
212748e5ce07SmrgAC_LANG_CASE(
212848e5ce07Smrg	[C], [
212948e5ce07Smrg		CWARNFLAGS="$BASE_CFLAGS"
213048e5ce07Smrg		if  test "x$GCC" = xyes ; then
213148e5ce07Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
213248e5ce07Smrg		fi
213348e5ce07Smrg		AC_SUBST(CWARNFLAGS)
213448e5ce07Smrg	]
213548e5ce07Smrg)
213648e5ce07Smrg]) # XORG_CWARNFLAGS
213748e5ce07Smrg
213848e5ce07Smrg# XORG_STRICT_OPTION
213948e5ce07Smrg# -----------------------
214048e5ce07Smrg# Minimum version: 1.3.0
2141dc9477beSmrg#
214248e5ce07Smrg# Add configure option to enable strict compilation flags, such as treating
214348e5ce07Smrg# warnings as fatal errors.
214448e5ce07Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
214548e5ce07Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
214644584a44Smrg#
214748e5ce07Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
214848e5ce07Smrg# when strict compilation is unconditionally desired.
214948e5ce07SmrgAC_DEFUN([XORG_STRICT_OPTION], [
215048e5ce07SmrgAC_REQUIRE([XORG_CWARNFLAGS])
215148e5ce07SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2152dc9477beSmrg
215348e5ce07SmrgAC_ARG_ENABLE(strict-compilation,
215448e5ce07Smrg			  AS_HELP_STRING([--enable-strict-compilation],
215548e5ce07Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
215648e5ce07Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2157dc9477beSmrg
215848e5ce07SmrgAC_LANG_CASE(
215948e5ce07Smrg        [C], [
216048e5ce07Smrg                define([PREFIX], [C])
216148e5ce07Smrg        ],
216248e5ce07Smrg        [C++], [
216348e5ce07Smrg                define([PREFIX], [CXX])
216448e5ce07Smrg        ]
216548e5ce07Smrg)
2166dc9477beSmrg
216748e5ce07Smrg[STRICT_]PREFIX[FLAGS]=""
216848e5ce07SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
216948e5ce07SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
217048e5ce07Smrg
217148e5ce07Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
217248e5ce07Smrg# activate it with -Werror, so we add it here explicitly.
217348e5ce07SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
217448e5ce07Smrg
217548e5ce07Smrgif test "x$STRICT_COMPILE" = "xyes"; then
217648e5ce07Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
217748e5ce07Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
217848e5ce07Smrgfi
217948e5ce07SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
218048e5ce07SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
218148e5ce07SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
218248e5ce07Smrg]) # XORG_STRICT_OPTION
218348e5ce07Smrg
218448e5ce07Smrg# XORG_DEFAULT_OPTIONS
218548e5ce07Smrg# --------------------
218648e5ce07Smrg# Minimum version: 1.3.0
2187dc9477beSmrg#
218848e5ce07Smrg# Defines default options for X.Org modules.
2189dc9477beSmrg#
219048e5ce07SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
219148e5ce07SmrgAC_REQUIRE([AC_PROG_INSTALL])
219248e5ce07SmrgXORG_COMPILER_FLAGS
219348e5ce07SmrgXORG_CWARNFLAGS
219448e5ce07SmrgXORG_STRICT_OPTION
219548e5ce07SmrgXORG_RELEASE_VERSION
219648e5ce07SmrgXORG_CHANGELOG
219748e5ce07SmrgXORG_INSTALL
219848e5ce07SmrgXORG_MANPAGE_SECTIONS
219948e5ce07Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
220048e5ce07Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
220148e5ce07Smrg]) # XORG_DEFAULT_OPTIONS
220248e5ce07Smrg
220348e5ce07Smrg# XORG_INSTALL()
220448e5ce07Smrg# ----------------
220548e5ce07Smrg# Minimum version: 1.4.0
2206dc9477beSmrg#
220748e5ce07Smrg# Defines the variable INSTALL_CMD as the command to copy
220848e5ce07Smrg# INSTALL from $prefix/share/util-macros.
2209dc9477beSmrg#
221048e5ce07SmrgAC_DEFUN([XORG_INSTALL], [
221148e5ce07SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
221248e5ce07Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
221348e5ce07SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
221448e5ce07Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
22154e8f48c7Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
22164e8f48c7Smrgtouch \$(top_srcdir)/INSTALL; \
22174e8f48c7Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
221848e5ce07SmrgAC_SUBST([INSTALL_CMD])
221948e5ce07Smrg]) # XORG_INSTALL
222048e5ce07Smrgdnl Copyright 2005 Red Hat, Inc
222148e5ce07Smrgdnl
222248e5ce07Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
222348e5ce07Smrgdnl documentation for any purpose is hereby granted without fee, provided that
222448e5ce07Smrgdnl the above copyright notice appear in all copies and that both that
222548e5ce07Smrgdnl copyright notice and this permission notice appear in supporting
222648e5ce07Smrgdnl documentation.
222748e5ce07Smrgdnl
222848e5ce07Smrgdnl The above copyright notice and this permission notice shall be included
222948e5ce07Smrgdnl in all copies or substantial portions of the Software.
223048e5ce07Smrgdnl
223148e5ce07Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
223248e5ce07Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
223348e5ce07Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
223448e5ce07Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
223548e5ce07Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
223648e5ce07Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
223748e5ce07Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
223848e5ce07Smrgdnl
223948e5ce07Smrgdnl Except as contained in this notice, the name of the copyright holders shall
224048e5ce07Smrgdnl not be used in advertising or otherwise to promote the sale, use or
224148e5ce07Smrgdnl other dealings in this Software without prior written authorization
224248e5ce07Smrgdnl from the copyright holders.
224348e5ce07Smrgdnl
2244dc9477beSmrg
224548e5ce07Smrg# XORG_RELEASE_VERSION
224648e5ce07Smrg# --------------------
224748e5ce07Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2248dc9477beSmrg
224948e5ce07SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
225048e5ce07Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
225148e5ce07Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
225248e5ce07Smrg		[Major version of this package])
225348e5ce07Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
225448e5ce07Smrg	if test "x$PVM" = "x"; then
225548e5ce07Smrg		PVM="0"
225648e5ce07Smrg	fi
225748e5ce07Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
225848e5ce07Smrg		[$PVM],
225948e5ce07Smrg		[Minor version of this package])
226048e5ce07Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
226148e5ce07Smrg	if test "x$PVP" = "x"; then
226248e5ce07Smrg		PVP="0"
226348e5ce07Smrg	fi
226448e5ce07Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
226548e5ce07Smrg		[$PVP],
226648e5ce07Smrg		[Patch version of this package])
226748e5ce07Smrg])
226848e5ce07Smrg
226948e5ce07Smrg# XORG_CHANGELOG()
227048e5ce07Smrg# ----------------
227148e5ce07Smrg# Minimum version: 1.2.0
2272dc9477beSmrg#
227348e5ce07Smrg# Defines the variable CHANGELOG_CMD as the command to generate
227448e5ce07Smrg# ChangeLog from git.
227544584a44Smrg#
227644584a44Smrg#
227748e5ce07SmrgAC_DEFUN([XORG_CHANGELOG], [
22784e8f48c7SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
227948e5ce07Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22804e8f48c7Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22814e8f48c7Smrgtouch \$(top_srcdir)/ChangeLog; \
22824e8f48c7Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
228348e5ce07SmrgAC_SUBST([CHANGELOG_CMD])
228448e5ce07Smrg]) # XORG_CHANGELOG
228548e5ce07Smrg
22864e8f48c7Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
228744584a44Smrg#
228848e5ce07Smrg# This file is free software; the Free Software Foundation
228948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
229048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2291dc9477beSmrg
229248e5ce07Smrg# AM_AUTOMAKE_VERSION(VERSION)
229348e5ce07Smrg# ----------------------------
229448e5ce07Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
229548e5ce07Smrg# generated from the m4 files accompanying Automake X.Y.
229648e5ce07Smrg# (This private macro should not be called outside this file.)
229748e5ce07SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22984940c694Smrg[am__api_version='1.16'
229948e5ce07Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
230048e5ce07Smrgdnl require some minimum version.  Point them to the right macro.
23014e8f48c7Smrgm4_if([$1], [1.16.5], [],
230248e5ce07Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
230348e5ce07Smrg])
2304dc9477beSmrg
230548e5ce07Smrg# _AM_AUTOCONF_VERSION(VERSION)
230648e5ce07Smrg# -----------------------------
230748e5ce07Smrg# aclocal traces this macro to find the Autoconf version.
230848e5ce07Smrg# This is a private macro too.  Using m4_define simplifies
230948e5ce07Smrg# the logic in aclocal, which can simply ignore this definition.
231048e5ce07Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2311dc9477beSmrg
231248e5ce07Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
231348e5ce07Smrg# -------------------------------
231448e5ce07Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
231548e5ce07Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
231648e5ce07SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
23174e8f48c7Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
231848e5ce07Smrgm4_ifndef([AC_AUTOCONF_VERSION],
231948e5ce07Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
232048e5ce07Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2321dc9477beSmrg
232248e5ce07Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
232348e5ce07Smrg
23244e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2325dc9477beSmrg#
232648e5ce07Smrg# This file is free software; the Free Software Foundation
232748e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
232848e5ce07Smrg# with or without modifications, as long as this notice is preserved.
232948e5ce07Smrg
233048e5ce07Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
233148e5ce07Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
233248e5ce07Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
233344584a44Smrg#
233448e5ce07Smrg# Of course, Automake must honor this variable whenever it calls a
233548e5ce07Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
233648e5ce07Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
233748e5ce07Smrg# depending on how configure is run.  This is pretty annoying, since
233848e5ce07Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
233948e5ce07Smrg# source directory, any form will work fine, but in subdirectories a
234048e5ce07Smrg# relative path needs to be adjusted first.
234144584a44Smrg#
234248e5ce07Smrg# $ac_aux_dir/missing
234348e5ce07Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
234448e5ce07Smrg# $top_srcdir/$ac_aux_dir/missing
234548e5ce07Smrg#    fails if $ac_aux_dir is absolute,
234648e5ce07Smrg#    fails when called from a subdirectory in a VPATH build with
234748e5ce07Smrg#          a relative $ac_aux_dir
234844584a44Smrg#
234948e5ce07Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
235048e5ce07Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
235148e5ce07Smrg# harmless because $srcdir is '.', but things will broke when you
235248e5ce07Smrg# start a VPATH build or use an absolute $srcdir.
235344584a44Smrg#
235448e5ce07Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
235548e5ce07Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
235648e5ce07Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
235748e5ce07Smrg# and then we would define $MISSING as
235848e5ce07Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
235948e5ce07Smrg# This will work as long as MISSING is not called from configure, because
236048e5ce07Smrg# unfortunately $(top_srcdir) has no meaning in configure.
236148e5ce07Smrg# However there are other variables, like CC, which are often used in
236248e5ce07Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
236344584a44Smrg#
236448e5ce07Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
236548e5ce07Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
236648e5ce07Smrg# configured tree to be moved without reconfiguration.
236748e5ce07Smrg
236848e5ce07SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
236948e5ce07Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
237048e5ce07Smrg# Expand $ac_aux_dir to an absolute path.
237148e5ce07Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
237248e5ce07Smrg])
237348e5ce07Smrg
237448e5ce07Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
237548e5ce07Smrg
23764e8f48c7Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
237744584a44Smrg#
237848e5ce07Smrg# This file is free software; the Free Software Foundation
237948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
238048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2381dc9477beSmrg
238248e5ce07Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
238348e5ce07Smrg# -------------------------------------
238448e5ce07Smrg# Define a conditional.
238548e5ce07SmrgAC_DEFUN([AM_CONDITIONAL],
238648e5ce07Smrg[AC_PREREQ([2.52])dnl
238748e5ce07Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
238848e5ce07Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
238948e5ce07SmrgAC_SUBST([$1_TRUE])dnl
239048e5ce07SmrgAC_SUBST([$1_FALSE])dnl
239148e5ce07Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
239248e5ce07Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
239348e5ce07Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
239448e5ce07Smrgif $2; then
239548e5ce07Smrg  $1_TRUE=
239648e5ce07Smrg  $1_FALSE='#'
239744584a44Smrgelse
239848e5ce07Smrg  $1_TRUE='#'
239948e5ce07Smrg  $1_FALSE=
240044584a44Smrgfi
240148e5ce07SmrgAC_CONFIG_COMMANDS_PRE(
240248e5ce07Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
240348e5ce07Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
240448e5ce07SmrgUsually this means the macro was only invoked conditionally.]])
240548e5ce07Smrgfi])])
2406dc9477beSmrg
24074e8f48c7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
240848e5ce07Smrg#
240948e5ce07Smrg# This file is free software; the Free Software Foundation
241048e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
241148e5ce07Smrg# with or without modifications, as long as this notice is preserved.
241248e5ce07Smrg
241348e5ce07Smrg
241448e5ce07Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
241548e5ce07Smrg# written in clear, in which case automake, when reading aclocal.m4,
241648e5ce07Smrg# will think it sees a *use*, and therefore will trigger all it's
241748e5ce07Smrg# C support machinery.  Also note that it means that autoscan, seeing
241848e5ce07Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
241948e5ce07Smrg
242048e5ce07Smrg
242148e5ce07Smrg# _AM_DEPENDENCIES(NAME)
242248e5ce07Smrg# ----------------------
242348e5ce07Smrg# See how the compiler implements dependency checking.
242448e5ce07Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
242548e5ce07Smrg# We try a few techniques and use that to set a single cache variable.
242648e5ce07Smrg#
242748e5ce07Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
242848e5ce07Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
242948e5ce07Smrg# dependency, and given that the user is not expected to run this macro,
243048e5ce07Smrg# just rely on AC_PROG_CC.
243148e5ce07SmrgAC_DEFUN([_AM_DEPENDENCIES],
243248e5ce07Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
243348e5ce07SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
243448e5ce07SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
243548e5ce07SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
243648e5ce07Smrg
243748e5ce07Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
243848e5ce07Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
243948e5ce07Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
244048e5ce07Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
244148e5ce07Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
244248e5ce07Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
244348e5ce07Smrg                    [depcc="$$1"   am_compiler_list=])
244448e5ce07Smrg
244548e5ce07SmrgAC_CACHE_CHECK([dependency style of $depcc],
244648e5ce07Smrg               [am_cv_$1_dependencies_compiler_type],
244748e5ce07Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
244848e5ce07Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
244948e5ce07Smrg  # making bogus files that we don't know about and never remove.  For
245048e5ce07Smrg  # instance it was reported that on HP-UX the gcc test will end up
245148e5ce07Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
245248e5ce07Smrg  # in D".
245348e5ce07Smrg  rm -rf conftest.dir
245448e5ce07Smrg  mkdir conftest.dir
245548e5ce07Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
245648e5ce07Smrg  # using a relative directory.
245748e5ce07Smrg  cp "$am_depcomp" conftest.dir
245848e5ce07Smrg  cd conftest.dir
245948e5ce07Smrg  # We will build objects and dependencies in a subdirectory because
246048e5ce07Smrg  # it helps to detect inapplicable dependency modes.  For instance
246148e5ce07Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
246248e5ce07Smrg  # side effect of compilation, but ICC will put the dependencies in
246348e5ce07Smrg  # the current directory while Tru64 will put them in the object
246448e5ce07Smrg  # directory.
246548e5ce07Smrg  mkdir sub
246648e5ce07Smrg
246748e5ce07Smrg  am_cv_$1_dependencies_compiler_type=none
246848e5ce07Smrg  if test "$am_compiler_list" = ""; then
246948e5ce07Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
247048e5ce07Smrg  fi
247148e5ce07Smrg  am__universal=false
247248e5ce07Smrg  m4_case([$1], [CC],
247348e5ce07Smrg    [case " $depcc " in #(
247448e5ce07Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
247548e5ce07Smrg     esac],
247648e5ce07Smrg    [CXX],
247748e5ce07Smrg    [case " $depcc " in #(
247848e5ce07Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
247948e5ce07Smrg     esac])
248048e5ce07Smrg
248148e5ce07Smrg  for depmode in $am_compiler_list; do
248248e5ce07Smrg    # Setup a source with many dependencies, because some compilers
248348e5ce07Smrg    # like to wrap large dependency lists on column 80 (with \), and
248448e5ce07Smrg    # we should not choose a depcomp mode which is confused by this.
248548e5ce07Smrg    #
248648e5ce07Smrg    # We need to recreate these files for each test, as the compiler may
248748e5ce07Smrg    # overwrite some of them when testing with obscure command lines.
248848e5ce07Smrg    # This happens at least with the AIX C compiler.
248948e5ce07Smrg    : > sub/conftest.c
249048e5ce07Smrg    for i in 1 2 3 4 5 6; do
249148e5ce07Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
249248e5ce07Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
249348e5ce07Smrg      # Solaris 10 /bin/sh.
249448e5ce07Smrg      echo '/* dummy */' > sub/conftst$i.h
249548e5ce07Smrg    done
249648e5ce07Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
249748e5ce07Smrg
249848e5ce07Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
249948e5ce07Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
250048e5ce07Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
250148e5ce07Smrg    # versions had trouble with output in subdirs.
250248e5ce07Smrg    am__obj=sub/conftest.${OBJEXT-o}
250348e5ce07Smrg    am__minus_obj="-o $am__obj"
250448e5ce07Smrg    case $depmode in
250548e5ce07Smrg    gcc)
250648e5ce07Smrg      # This depmode causes a compiler race in universal mode.
250748e5ce07Smrg      test "$am__universal" = false || continue
250848e5ce07Smrg      ;;
250948e5ce07Smrg    nosideeffect)
251048e5ce07Smrg      # After this tag, mechanisms are not by side-effect, so they'll
251148e5ce07Smrg      # only be used when explicitly requested.
251248e5ce07Smrg      if test "x$enable_dependency_tracking" = xyes; then
251348e5ce07Smrg	continue
251448e5ce07Smrg      else
251548e5ce07Smrg	break
251648e5ce07Smrg      fi
251748e5ce07Smrg      ;;
251848e5ce07Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
251948e5ce07Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
252048e5ce07Smrg      # not run yet.  These depmodes are late enough in the game, and
252148e5ce07Smrg      # so weak that their functioning should not be impacted.
252248e5ce07Smrg      am__obj=conftest.${OBJEXT-o}
252348e5ce07Smrg      am__minus_obj=
252448e5ce07Smrg      ;;
252548e5ce07Smrg    none) break ;;
252648e5ce07Smrg    esac
252748e5ce07Smrg    if depmode=$depmode \
252848e5ce07Smrg       source=sub/conftest.c object=$am__obj \
252948e5ce07Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
253048e5ce07Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
253148e5ce07Smrg         >/dev/null 2>conftest.err &&
253248e5ce07Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
253348e5ce07Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
253448e5ce07Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
253548e5ce07Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
253648e5ce07Smrg      # icc doesn't choke on unknown options, it will just issue warnings
253748e5ce07Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
253848e5ce07Smrg      # that says an option was ignored or not supported.
253948e5ce07Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
254048e5ce07Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
254148e5ce07Smrg      # The diagnosis changed in icc 8.0:
254248e5ce07Smrg      #   icc: Command line remark: option '-MP' not supported
254348e5ce07Smrg      if (grep 'ignoring option' conftest.err ||
254448e5ce07Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
254548e5ce07Smrg        am_cv_$1_dependencies_compiler_type=$depmode
254648e5ce07Smrg        break
254748e5ce07Smrg      fi
254844584a44Smrg    fi
254948e5ce07Smrg  done
2550dc9477beSmrg
255148e5ce07Smrg  cd ..
255248e5ce07Smrg  rm -rf conftest.dir
2553dc9477beSmrgelse
255448e5ce07Smrg  am_cv_$1_dependencies_compiler_type=none
2555dc9477beSmrgfi
255648e5ce07Smrg])
255748e5ce07SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
255848e5ce07SmrgAM_CONDITIONAL([am__fastdep$1], [
255948e5ce07Smrg  test "x$enable_dependency_tracking" != xno \
256048e5ce07Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
256148e5ce07Smrg])
2562dc9477beSmrg
2563dc9477beSmrg
256448e5ce07Smrg# AM_SET_DEPDIR
256548e5ce07Smrg# -------------
256648e5ce07Smrg# Choose a directory name for dependency files.
256748e5ce07Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
256848e5ce07SmrgAC_DEFUN([AM_SET_DEPDIR],
256948e5ce07Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
257048e5ce07SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
257148e5ce07Smrg])
2572dc9477beSmrg
2573dc9477beSmrg
257448e5ce07Smrg# AM_DEP_TRACK
257548e5ce07Smrg# ------------
257648e5ce07SmrgAC_DEFUN([AM_DEP_TRACK],
257748e5ce07Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
257848e5ce07SmrgAS_HELP_STRING(
257948e5ce07Smrg  [--enable-dependency-tracking],
258048e5ce07Smrg  [do not reject slow dependency extractors])
258148e5ce07SmrgAS_HELP_STRING(
258248e5ce07Smrg  [--disable-dependency-tracking],
258348e5ce07Smrg  [speeds up one-time build])])
258448e5ce07Smrgif test "x$enable_dependency_tracking" != xno; then
258548e5ce07Smrg  am_depcomp="$ac_aux_dir/depcomp"
258648e5ce07Smrg  AMDEPBACKSLASH='\'
258748e5ce07Smrg  am__nodep='_no'
2588dc9477beSmrgfi
258948e5ce07SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
259048e5ce07SmrgAC_SUBST([AMDEPBACKSLASH])dnl
259148e5ce07Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
259248e5ce07SmrgAC_SUBST([am__nodep])dnl
259348e5ce07Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
259448e5ce07Smrg])
2595dc9477beSmrg
259648e5ce07Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2597dc9477beSmrg
25984e8f48c7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
259944584a44Smrg#
260048e5ce07Smrg# This file is free software; the Free Software Foundation
260148e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
260248e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2603dc9477beSmrg
260448e5ce07Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
260548e5ce07Smrg# ------------------------------
260648e5ce07SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
260748e5ce07Smrg[{
260848e5ce07Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
260948e5ce07Smrg  # are listed without --file.  Let's play safe and only enable the eval
261048e5ce07Smrg  # if we detect the quoting.
26114940c694Smrg  # TODO: see whether this extra hack can be removed once we start
26124940c694Smrg  # requiring Autoconf 2.70 or later.
26134940c694Smrg  AS_CASE([$CONFIG_FILES],
26144940c694Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
26154940c694Smrg          [*], [set x $CONFIG_FILES])
261648e5ce07Smrg  shift
26174940c694Smrg  # Used to flag and report bootstrapping failures.
26184940c694Smrg  am_rc=0
26194940c694Smrg  for am_mf
262048e5ce07Smrg  do
262148e5ce07Smrg    # Strip MF so we end up with the name of the file.
26224940c694Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
26234940c694Smrg    # Check whether this is an Automake generated Makefile which includes
26244940c694Smrg    # dependency-tracking related rules and includes.
26254940c694Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
262648e5ce07Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
26274940c694Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
26284940c694Smrg      || continue
26294940c694Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
26304940c694Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
26314940c694Smrg    AM_RUN_LOG([cd "$am_dirpart" \
26324940c694Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
26334940c694Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
263448e5ce07Smrg  done
26354940c694Smrg  if test $am_rc -ne 0; then
26364940c694Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
26374e8f48c7Smrg    for automatic dependency tracking.  If GNU make was not used, consider
26384e8f48c7Smrg    re-running the configure script with MAKE="gmake" (or whatever is
26394e8f48c7Smrg    necessary).  You can also try re-running configure with the
26404940c694Smrg    '--disable-dependency-tracking' option to at least be able to build
26414940c694Smrg    the package (albeit without support for automatic dependency tracking).])
26424940c694Smrg  fi
26434940c694Smrg  AS_UNSET([am_dirpart])
26444940c694Smrg  AS_UNSET([am_filepart])
26454940c694Smrg  AS_UNSET([am_mf])
26464940c694Smrg  AS_UNSET([am_rc])
26474940c694Smrg  rm -f conftest-deps.mk
264848e5ce07Smrg}
264948e5ce07Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2650b789ec8aSmrg
265148e5ce07Smrg
265248e5ce07Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
265348e5ce07Smrg# -----------------------------
265448e5ce07Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
265544584a44Smrg#
26564940c694Smrg# This code is only required when automatic dependency tracking is enabled.
26574940c694Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
26584940c694Smrg# order to bootstrap the dependency handling code.
265948e5ce07SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
266048e5ce07Smrg[AC_CONFIG_COMMANDS([depfiles],
266148e5ce07Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
26624940c694Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2663b789ec8aSmrg
266448e5ce07Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2665b789ec8aSmrg
26664e8f48c7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
266748e5ce07Smrg#
266848e5ce07Smrg# This file is free software; the Free Software Foundation
266948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
267048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2671b789ec8aSmrg
267248e5ce07Smrg# This macro actually does too much.  Some checks are only needed if
267348e5ce07Smrg# your package does certain things.  But this isn't really a big deal.
267448e5ce07Smrg
267548e5ce07Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
267648e5ce07Smrgm4_define([AC_PROG_CC],
267748e5ce07Smrgm4_defn([AC_PROG_CC])
267848e5ce07Smrg[_AM_PROG_CC_C_O
267948e5ce07Smrg])
2680b789ec8aSmrg
268148e5ce07Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
268248e5ce07Smrg# AM_INIT_AUTOMAKE([OPTIONS])
268348e5ce07Smrg# -----------------------------------------------
268448e5ce07Smrg# The call with PACKAGE and VERSION arguments is the old style
268548e5ce07Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
268648e5ce07Smrg# and VERSION should now be passed to AC_INIT and removed from
268748e5ce07Smrg# the call to AM_INIT_AUTOMAKE.
268848e5ce07Smrg# We support both call styles for the transition.  After
268948e5ce07Smrg# the next Automake release, Autoconf can make the AC_INIT
269048e5ce07Smrg# arguments mandatory, and then we can depend on a new Autoconf
269148e5ce07Smrg# release and drop the old call support.
269248e5ce07SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
269348e5ce07Smrg[AC_PREREQ([2.65])dnl
26944e8f48c7Smrgm4_ifdef([_$0_ALREADY_INIT],
26954e8f48c7Smrg  [m4_fatal([$0 expanded multiple times
26964e8f48c7Smrg]m4_defn([_$0_ALREADY_INIT]))],
26974e8f48c7Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
269848e5ce07Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
269948e5ce07Smrgdnl the ones we care about.
270048e5ce07Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
270148e5ce07SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
270248e5ce07SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
270348e5ce07Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
270448e5ce07Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
270548e5ce07Smrg  # is not polluted with repeated "-I."
270648e5ce07Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
270748e5ce07Smrg  # test to see if srcdir already configured
270848e5ce07Smrg  if test -f $srcdir/config.status; then
270948e5ce07Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
271044584a44Smrg  fi
271144584a44Smrgfi
2712b789ec8aSmrg
271348e5ce07Smrg# test whether we have cygpath
271448e5ce07Smrgif test -z "$CYGPATH_W"; then
271548e5ce07Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
271648e5ce07Smrg    CYGPATH_W='cygpath -w'
271748e5ce07Smrg  else
271848e5ce07Smrg    CYGPATH_W=echo
271944584a44Smrg  fi
272044584a44Smrgfi
272148e5ce07SmrgAC_SUBST([CYGPATH_W])
272244584a44Smrg
272348e5ce07Smrg# Define the identity of the package.
272448e5ce07Smrgdnl Distinguish between old-style and new-style calls.
272548e5ce07Smrgm4_ifval([$2],
272648e5ce07Smrg[AC_DIAGNOSE([obsolete],
272748e5ce07Smrg             [$0: two- and three-arguments forms are deprecated.])
272848e5ce07Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
272948e5ce07Smrg AC_SUBST([PACKAGE], [$1])dnl
273048e5ce07Smrg AC_SUBST([VERSION], [$2])],
273148e5ce07Smrg[_AM_SET_OPTIONS([$1])dnl
273248e5ce07Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
273348e5ce07Smrgm4_if(
27344e8f48c7Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
273548e5ce07Smrg  [ok:ok],,
273648e5ce07Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
273748e5ce07Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
273848e5ce07Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2739b789ec8aSmrg
274048e5ce07Smrg_AM_IF_OPTION([no-define],,
274148e5ce07Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
274248e5ce07Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2743b789ec8aSmrg
274448e5ce07Smrg# Some tools Automake needs.
274548e5ce07SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
274648e5ce07SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
274748e5ce07SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
274848e5ce07SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
274948e5ce07SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
275048e5ce07SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
275148e5ce07SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
275248e5ce07SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
275348e5ce07SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
275448e5ce07SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
275548e5ce07Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
275648e5ce07Smrg# dies out for good.  For more background, see:
27574940c694Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27584940c694Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
275948e5ce07SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
276048e5ce07Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
276148e5ce07Smrg# system "awk" is bad on some platforms.
276248e5ce07SmrgAC_REQUIRE([AC_PROG_AWK])dnl
276348e5ce07SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
276448e5ce07SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
276548e5ce07Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
276648e5ce07Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
276748e5ce07Smrg			     [_AM_PROG_TAR([v7])])])
276848e5ce07Smrg_AM_IF_OPTION([no-dependencies],,
276948e5ce07Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
277048e5ce07Smrg		  [_AM_DEPENDENCIES([CC])],
277148e5ce07Smrg		  [m4_define([AC_PROG_CC],
277248e5ce07Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
277348e5ce07SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
277448e5ce07Smrg		  [_AM_DEPENDENCIES([CXX])],
277548e5ce07Smrg		  [m4_define([AC_PROG_CXX],
277648e5ce07Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
277748e5ce07SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
277848e5ce07Smrg		  [_AM_DEPENDENCIES([OBJC])],
277948e5ce07Smrg		  [m4_define([AC_PROG_OBJC],
278048e5ce07Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
278148e5ce07SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
278248e5ce07Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
278348e5ce07Smrg		  [m4_define([AC_PROG_OBJCXX],
278448e5ce07Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
278548e5ce07Smrg])
27864e8f48c7Smrg# Variables for tags utilities; see am/tags.am
27874e8f48c7Smrgif test -z "$CTAGS"; then
27884e8f48c7Smrg  CTAGS=ctags
27894e8f48c7Smrgfi
27904e8f48c7SmrgAC_SUBST([CTAGS])
27914e8f48c7Smrgif test -z "$ETAGS"; then
27924e8f48c7Smrg  ETAGS=etags
27934e8f48c7Smrgfi
27944e8f48c7SmrgAC_SUBST([ETAGS])
27954e8f48c7Smrgif test -z "$CSCOPE"; then
27964e8f48c7Smrg  CSCOPE=cscope
27974e8f48c7Smrgfi
27984e8f48c7SmrgAC_SUBST([CSCOPE])
27994e8f48c7Smrg
280048e5ce07SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
280148e5ce07Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
280248e5ce07Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
280348e5ce07Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
280448e5ce07SmrgAC_CONFIG_COMMANDS_PRE(dnl
280548e5ce07Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
280648e5ce07Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
280789069ce9Smrg
280848e5ce07Smrg# POSIX will say in a future version that running "rm -f" with no argument
280948e5ce07Smrg# is OK; and we want to be able to make that assumption in our Makefile
281048e5ce07Smrg# recipes.  So use an aggressive probe to check that the usage we want is
281148e5ce07Smrg# actually supported "in the wild" to an acceptable degree.
281248e5ce07Smrg# See automake bug#10828.
281348e5ce07Smrg# To make any issue more visible, cause the running configure to be aborted
281448e5ce07Smrg# by default if the 'rm' program in use doesn't match our expectations; the
281548e5ce07Smrg# user can still override this though.
281648e5ce07Smrgif rm -f && rm -fr && rm -rf; then : OK; else
281748e5ce07Smrg  cat >&2 <<'END'
281848e5ce07SmrgOops!
2819b789ec8aSmrg
282048e5ce07SmrgYour 'rm' program seems unable to run without file operands specified
282148e5ce07Smrgon the command line, even when the '-f' option is present.  This is contrary
282248e5ce07Smrgto the behaviour of most rm programs out there, and not conforming with
282348e5ce07Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2824b789ec8aSmrg
282548e5ce07SmrgPlease tell bug-automake@gnu.org about your system, including the value
282648e5ce07Smrgof your $PATH and any error possibly output before this message.  This
282748e5ce07Smrgcan help us improve future automake versions.
2828dc9477beSmrg
282948e5ce07SmrgEND
283048e5ce07Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
283148e5ce07Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
283248e5ce07Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
283348e5ce07Smrg    echo >&2
283448e5ce07Smrg  else
283548e5ce07Smrg    cat >&2 <<'END'
283648e5ce07SmrgAborting the configuration process, to ensure you take notice of the issue.
2837b789ec8aSmrg
283848e5ce07SmrgYou can download and install GNU coreutils to get an 'rm' implementation
28394940c694Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2840dc9477beSmrg
284148e5ce07SmrgIf you want to complete the configuration process using your problematic
284248e5ce07Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
284348e5ce07Smrgto "yes", and re-run configure.
284448e5ce07Smrg
284548e5ce07SmrgEND
284648e5ce07Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
284748e5ce07Smrg  fi
284889069ce9Smrgfi
284948e5ce07Smrgdnl The trailing newline in this macro's definition is deliberate, for
285048e5ce07Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
285148e5ce07Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
285248e5ce07Smrg])
285337eb1ca1Smrg
285448e5ce07Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
285548e5ce07Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
285648e5ce07Smrgdnl mangled by Autoconf and run in a shell conditional statement.
285748e5ce07Smrgm4_define([_AC_COMPILER_EXEEXT],
285848e5ce07Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
285906c34b88Smrg
286048e5ce07Smrg# When config.status generates a header, we must update the stamp-h file.
286148e5ce07Smrg# This file resides in the same directory as the config header
286248e5ce07Smrg# that is generated.  The stamp files are numbered to have different names.
286306c34b88Smrg
286448e5ce07Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
286548e5ce07Smrg# loop where config.status creates the headers, so we can generate
286648e5ce07Smrg# our stamp files there.
286748e5ce07SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
286848e5ce07Smrg[# Compute $1's index in $config_headers.
286948e5ce07Smrg_am_arg=$1
287048e5ce07Smrg_am_stamp_count=1
287148e5ce07Smrgfor _am_header in $config_headers :; do
287248e5ce07Smrg  case $_am_header in
287348e5ce07Smrg    $_am_arg | $_am_arg:* )
287448e5ce07Smrg      break ;;
287548e5ce07Smrg    * )
287648e5ce07Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
287748e5ce07Smrg  esac
287848e5ce07Smrgdone
287948e5ce07Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2880b789ec8aSmrg
28814e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
288248e5ce07Smrg#
288348e5ce07Smrg# This file is free software; the Free Software Foundation
288448e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
288548e5ce07Smrg# with or without modifications, as long as this notice is preserved.
288644584a44Smrg
288748e5ce07Smrg# AM_PROG_INSTALL_SH
288848e5ce07Smrg# ------------------
288948e5ce07Smrg# Define $install_sh.
289048e5ce07SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
289148e5ce07Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
289248e5ce07Smrgif test x"${install_sh+set}" != xset; then
289348e5ce07Smrg  case $am_aux_dir in
289448e5ce07Smrg  *\ * | *\	*)
289548e5ce07Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
289648e5ce07Smrg  *)
289748e5ce07Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
289848e5ce07Smrg  esac
2899dc9477beSmrgfi
290048e5ce07SmrgAC_SUBST([install_sh])])
2901dc9477beSmrg
29024e8f48c7Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
290348e5ce07Smrg#
290448e5ce07Smrg# This file is free software; the Free Software Foundation
290548e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
290648e5ce07Smrg# with or without modifications, as long as this notice is preserved.
2907dc9477beSmrg
290848e5ce07Smrg# Check whether the underlying file-system supports filenames
290948e5ce07Smrg# with a leading dot.  For instance MS-DOS doesn't.
291048e5ce07SmrgAC_DEFUN([AM_SET_LEADING_DOT],
291148e5ce07Smrg[rm -rf .tst 2>/dev/null
291248e5ce07Smrgmkdir .tst 2>/dev/null
291348e5ce07Smrgif test -d .tst; then
291448e5ce07Smrg  am__leading_dot=.
291548e5ce07Smrgelse
291648e5ce07Smrg  am__leading_dot=_
291748e5ce07Smrgfi
291848e5ce07Smrgrmdir .tst 2>/dev/null
291948e5ce07SmrgAC_SUBST([am__leading_dot])])
2920b789ec8aSmrg
292148e5ce07Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2922b789ec8aSmrg
29234e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
292444584a44Smrg#
292548e5ce07Smrg# This file is free software; the Free Software Foundation
292648e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
292748e5ce07Smrg# with or without modifications, as long as this notice is preserved.
292806c34b88Smrg
292948e5ce07Smrg# AM_MAKE_INCLUDE()
293048e5ce07Smrg# -----------------
29314940c694Smrg# Check whether make has an 'include' directive that can support all
29324940c694Smrg# the idioms we need for our automatic dependency tracking code.
293348e5ce07SmrgAC_DEFUN([AM_MAKE_INCLUDE],
29344940c694Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
29354940c694Smrgcat > confinc.mk << 'END'
293648e5ce07Smrgam__doit:
29374940c694Smrg	@echo this is the am__doit target >confinc.out
293848e5ce07Smrg.PHONY: am__doit
293948e5ce07SmrgEND
294048e5ce07Smrgam__include="#"
294148e5ce07Smrgam__quote=
29424940c694Smrg# BSD make does it like this.
29434940c694Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
29444940c694Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
29454940c694Smrgecho 'include confinc.mk # ignored' > confmf.GNU
29464940c694Smrg_am_result=no
29474940c694Smrgfor s in GNU BSD; do
29484940c694Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
29494940c694Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
29504940c694Smrg      ['0:this is the am__doit target'],
29514940c694Smrg      [AS_CASE([$s],
29524940c694Smrg          [BSD], [am__include='.include' am__quote='"'],
29534940c694Smrg          [am__include='include' am__quote=''])])
29544940c694Smrg  if test "$am__include" != "#"; then
29554940c694Smrg    _am_result="yes ($s style)"
29564940c694Smrg    break
29574940c694Smrg  fi
29584940c694Smrgdone
29594940c694Smrgrm -f confinc.* confmf.*
29604940c694SmrgAC_MSG_RESULT([${_am_result}])
29614940c694SmrgAC_SUBST([am__include])])
29624940c694SmrgAC_SUBST([am__quote])])
2963b789ec8aSmrg
296448e5ce07Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2965b789ec8aSmrg
29664e8f48c7Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
296744584a44Smrg#
296848e5ce07Smrg# This file is free software; the Free Software Foundation
296948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
297048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
297144584a44Smrg
297248e5ce07Smrg# AM_MISSING_PROG(NAME, PROGRAM)
297348e5ce07Smrg# ------------------------------
297448e5ce07SmrgAC_DEFUN([AM_MISSING_PROG],
297548e5ce07Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
297648e5ce07Smrg$1=${$1-"${am_missing_run}$2"}
297748e5ce07SmrgAC_SUBST($1)])
297844584a44Smrg
297948e5ce07Smrg# AM_MISSING_HAS_RUN
298048e5ce07Smrg# ------------------
298148e5ce07Smrg# Define MISSING if not defined so far and test if it is modern enough.
298248e5ce07Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
298348e5ce07SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
298448e5ce07Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
298548e5ce07SmrgAC_REQUIRE_AUX_FILE([missing])dnl
298648e5ce07Smrgif test x"${MISSING+set}" != xset; then
29874e8f48c7Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
298889069ce9Smrgfi
298948e5ce07Smrg# Use eval to expand $SHELL
299048e5ce07Smrgif eval "$MISSING --is-lightweight"; then
299148e5ce07Smrg  am_missing_run="$MISSING "
299248e5ce07Smrgelse
299348e5ce07Smrg  am_missing_run=
299448e5ce07Smrg  AC_MSG_WARN(['missing' script is too old or missing])
299544584a44Smrgfi
299648e5ce07Smrg])
299744584a44Smrg
299848e5ce07Smrg# Helper functions for option handling.                     -*- Autoconf -*-
299944584a44Smrg
30004e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
300148e5ce07Smrg#
300248e5ce07Smrg# This file is free software; the Free Software Foundation
300348e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
300448e5ce07Smrg# with or without modifications, as long as this notice is preserved.
300544584a44Smrg
300648e5ce07Smrg# _AM_MANGLE_OPTION(NAME)
300748e5ce07Smrg# -----------------------
300848e5ce07SmrgAC_DEFUN([_AM_MANGLE_OPTION],
300948e5ce07Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
301044584a44Smrg
301148e5ce07Smrg# _AM_SET_OPTION(NAME)
301248e5ce07Smrg# --------------------
301348e5ce07Smrg# Set option NAME.  Presently that only means defining a flag for this option.
301448e5ce07SmrgAC_DEFUN([_AM_SET_OPTION],
301548e5ce07Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
301644584a44Smrg
301748e5ce07Smrg# _AM_SET_OPTIONS(OPTIONS)
301848e5ce07Smrg# ------------------------
301948e5ce07Smrg# OPTIONS is a space-separated list of Automake options.
302048e5ce07SmrgAC_DEFUN([_AM_SET_OPTIONS],
302148e5ce07Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
302244584a44Smrg
302348e5ce07Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
302448e5ce07Smrg# -------------------------------------------
302548e5ce07Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
302648e5ce07SmrgAC_DEFUN([_AM_IF_OPTION],
302748e5ce07Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
30283e256790Smrg
30294e8f48c7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
303044584a44Smrg#
303148e5ce07Smrg# This file is free software; the Free Software Foundation
303248e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
303348e5ce07Smrg# with or without modifications, as long as this notice is preserved.
303444584a44Smrg
303548e5ce07Smrg# _AM_PROG_CC_C_O
303648e5ce07Smrg# ---------------
303748e5ce07Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
303848e5ce07Smrg# to automatically call this.
303948e5ce07SmrgAC_DEFUN([_AM_PROG_CC_C_O],
304048e5ce07Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
304148e5ce07SmrgAC_REQUIRE_AUX_FILE([compile])dnl
304248e5ce07SmrgAC_LANG_PUSH([C])dnl
304348e5ce07SmrgAC_CACHE_CHECK(
304448e5ce07Smrg  [whether $CC understands -c and -o together],
304548e5ce07Smrg  [am_cv_prog_cc_c_o],
304648e5ce07Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
304748e5ce07Smrg  # Make sure it works both with $CC and with simple cc.
304848e5ce07Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
304948e5ce07Smrg  # compilers refuse to overwrite an existing .o file with -o,
305048e5ce07Smrg  # though they will create one.
305148e5ce07Smrg  am_cv_prog_cc_c_o=yes
305248e5ce07Smrg  for am_i in 1 2; do
305348e5ce07Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
305448e5ce07Smrg         && test -f conftest2.$ac_objext; then
305548e5ce07Smrg      : OK
305648e5ce07Smrg    else
305748e5ce07Smrg      am_cv_prog_cc_c_o=no
305848e5ce07Smrg      break
305948e5ce07Smrg    fi
306048e5ce07Smrg  done
306148e5ce07Smrg  rm -f core conftest*
306248e5ce07Smrg  unset am_i])
306348e5ce07Smrgif test "$am_cv_prog_cc_c_o" != yes; then
306448e5ce07Smrg   # Losing compiler, so override with the script.
306548e5ce07Smrg   # FIXME: It is wrong to rewrite CC.
306648e5ce07Smrg   # But if we don't then we get into trouble of one sort or another.
306748e5ce07Smrg   # A longer-term fix would be to have automake use am__CC in this case,
306848e5ce07Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
306948e5ce07Smrg   CC="$am_aux_dir/compile $CC"
3070f1ee322dSmrgfi
307148e5ce07SmrgAC_LANG_POP([C])])
3072c43cc173Smrg
307348e5ce07Smrg# For backward compatibility.
307448e5ce07SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
307548e5ce07Smrg
30764e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
307748e5ce07Smrg#
307848e5ce07Smrg# This file is free software; the Free Software Foundation
307948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
308048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
308148e5ce07Smrg
308248e5ce07Smrg# AM_RUN_LOG(COMMAND)
308348e5ce07Smrg# -------------------
308448e5ce07Smrg# Run COMMAND, save the exit status in ac_status, and log it.
308548e5ce07Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
308648e5ce07SmrgAC_DEFUN([AM_RUN_LOG],
308748e5ce07Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
308848e5ce07Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
308948e5ce07Smrg   ac_status=$?
309048e5ce07Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
309148e5ce07Smrg   (exit $ac_status); }])
309206c34b88Smrg
309348e5ce07Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3094c43cc173Smrg
30954e8f48c7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
309648e5ce07Smrg#
309748e5ce07Smrg# This file is free software; the Free Software Foundation
309848e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
309948e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3100dc9477beSmrg
310148e5ce07Smrg# AM_SANITY_CHECK
310248e5ce07Smrg# ---------------
310348e5ce07SmrgAC_DEFUN([AM_SANITY_CHECK],
310448e5ce07Smrg[AC_MSG_CHECKING([whether build environment is sane])
310548e5ce07Smrg# Reject unsafe characters in $srcdir or the absolute working directory
310648e5ce07Smrg# name.  Accept space and tab only in the latter.
310748e5ce07Smrgam_lf='
310848e5ce07Smrg'
310948e5ce07Smrgcase `pwd` in
311048e5ce07Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
311148e5ce07Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
311248e5ce07Smrgesac
311348e5ce07Smrgcase $srcdir in
311448e5ce07Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
311548e5ce07Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
311648e5ce07Smrgesac
3117dc9477beSmrg
311848e5ce07Smrg# Do 'set' in a subshell so we don't clobber the current shell's
311948e5ce07Smrg# arguments.  Must try -L first in case configure is actually a
312048e5ce07Smrg# symlink; some systems play weird games with the mod time of symlinks
312148e5ce07Smrg# (eg FreeBSD returns the mod time of the symlink's containing
312248e5ce07Smrg# directory).
312348e5ce07Smrgif (
312448e5ce07Smrg   am_has_slept=no
312548e5ce07Smrg   for am_try in 1 2; do
312648e5ce07Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
312748e5ce07Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
312848e5ce07Smrg     if test "$[*]" = "X"; then
312948e5ce07Smrg	# -L didn't work.
313048e5ce07Smrg	set X `ls -t "$srcdir/configure" conftest.file`
313148e5ce07Smrg     fi
313248e5ce07Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
313348e5ce07Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
313437eb1ca1Smrg
313548e5ce07Smrg	# If neither matched, then we have a broken ls.  This can happen
313648e5ce07Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
313748e5ce07Smrg	# broken ls alias from the environment.  This has actually
313848e5ce07Smrg	# happened.  Such a system could not be considered "sane".
313948e5ce07Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
314048e5ce07Smrg  alias in your environment])
314148e5ce07Smrg     fi
314248e5ce07Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
314348e5ce07Smrg       break
314448e5ce07Smrg     fi
314548e5ce07Smrg     # Just in case.
314648e5ce07Smrg     sleep 1
314748e5ce07Smrg     am_has_slept=yes
314848e5ce07Smrg   done
314948e5ce07Smrg   test "$[2]" = conftest.file
315048e5ce07Smrg   )
315148e5ce07Smrgthen
315248e5ce07Smrg   # Ok.
315348e5ce07Smrg   :
315444584a44Smrgelse
315548e5ce07Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
315648e5ce07SmrgCheck your system clock])
315744584a44Smrgfi
315848e5ce07SmrgAC_MSG_RESULT([yes])
315948e5ce07Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
316048e5ce07Smrg# generated files are strictly newer.
316148e5ce07Smrgam_sleep_pid=
316248e5ce07Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
316348e5ce07Smrg  ( sleep 1 ) &
316448e5ce07Smrg  am_sleep_pid=$!
316548e5ce07Smrgfi
316648e5ce07SmrgAC_CONFIG_COMMANDS_PRE(
316748e5ce07Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
316848e5ce07Smrg   if test -n "$am_sleep_pid"; then
316948e5ce07Smrg     # Hide warnings about reused PIDs.
317048e5ce07Smrg     wait $am_sleep_pid 2>/dev/null
317148e5ce07Smrg   fi
317248e5ce07Smrg   AC_MSG_RESULT([done])])
317348e5ce07Smrgrm -f conftest.file
317448e5ce07Smrg])
3175dc9477beSmrg
31764e8f48c7Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
3177dc9477beSmrg#
317848e5ce07Smrg# This file is free software; the Free Software Foundation
317948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
318048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3181c27c18e8Smrg
318248e5ce07Smrg# AM_SILENT_RULES([DEFAULT])
318348e5ce07Smrg# --------------------------
318448e5ce07Smrg# Enable less verbose build rules; with the default set to DEFAULT
318548e5ce07Smrg# ("yes" being less verbose, "no" or empty being verbose).
318648e5ce07SmrgAC_DEFUN([AM_SILENT_RULES],
318748e5ce07Smrg[AC_ARG_ENABLE([silent-rules], [dnl
318848e5ce07SmrgAS_HELP_STRING(
318948e5ce07Smrg  [--enable-silent-rules],
319048e5ce07Smrg  [less verbose build output (undo: "make V=1")])
319148e5ce07SmrgAS_HELP_STRING(
319248e5ce07Smrg  [--disable-silent-rules],
319348e5ce07Smrg  [verbose build output (undo: "make V=0")])dnl
319448e5ce07Smrg])
319548e5ce07Smrgcase $enable_silent_rules in @%:@ (((
319648e5ce07Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
319748e5ce07Smrg   no) AM_DEFAULT_VERBOSITY=1;;
319848e5ce07Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
319948e5ce07Smrgesac
320048e5ce07Smrgdnl
320148e5ce07Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
320248e5ce07Smrgdnl do not support nested variable expansions.
320348e5ce07Smrgdnl See automake bug#9928 and bug#10237.
320448e5ce07Smrgam_make=${MAKE-make}
320548e5ce07SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
320648e5ce07Smrg   [am_cv_make_support_nested_variables],
320748e5ce07Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
320848e5ce07SmrgBAR0=false
320948e5ce07SmrgBAR1=true
321048e5ce07SmrgV=1
321148e5ce07Smrgam__doit:
321248e5ce07Smrg	@$(TRUE)
321348e5ce07Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
321448e5ce07Smrg  am_cv_make_support_nested_variables=yes
321548e5ce07Smrgelse
321648e5ce07Smrg  am_cv_make_support_nested_variables=no
321748e5ce07Smrgfi])
321848e5ce07Smrgif test $am_cv_make_support_nested_variables = yes; then
321948e5ce07Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
322048e5ce07Smrg  AM_V='$(V)'
322148e5ce07Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
322248e5ce07Smrgelse
322348e5ce07Smrg  AM_V=$AM_DEFAULT_VERBOSITY
322448e5ce07Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
322548e5ce07Smrgfi
322648e5ce07SmrgAC_SUBST([AM_V])dnl
322748e5ce07SmrgAM_SUBST_NOTMAKE([AM_V])dnl
322848e5ce07SmrgAC_SUBST([AM_DEFAULT_V])dnl
322948e5ce07SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
323048e5ce07SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
323148e5ce07SmrgAM_BACKSLASH='\'
323248e5ce07SmrgAC_SUBST([AM_BACKSLASH])dnl
323348e5ce07Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
323448e5ce07Smrg])
323548e5ce07Smrg
32364e8f48c7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
323744584a44Smrg#
323848e5ce07Smrg# This file is free software; the Free Software Foundation
323948e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
324048e5ce07Smrg# with or without modifications, as long as this notice is preserved.
324148e5ce07Smrg
324248e5ce07Smrg# AM_PROG_INSTALL_STRIP
324348e5ce07Smrg# ---------------------
324448e5ce07Smrg# One issue with vendor 'install' (even GNU) is that you can't
324548e5ce07Smrg# specify the program used to strip binaries.  This is especially
324648e5ce07Smrg# annoying in cross-compiling environments, where the build's strip
324748e5ce07Smrg# is unlikely to handle the host's binaries.
324848e5ce07Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
324948e5ce07Smrg# always use install-sh in "make install-strip", and initialize
325048e5ce07Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
325148e5ce07SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
325248e5ce07Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
325348e5ce07Smrg# Installed binaries are usually stripped using 'strip' when the user
325448e5ce07Smrg# run "make install-strip".  However 'strip' might not be the right
325548e5ce07Smrg# tool to use in cross-compilation environments, therefore Automake
325648e5ce07Smrg# will honor the 'STRIP' environment variable to overrule this program.
325748e5ce07Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
325848e5ce07Smrgif test "$cross_compiling" != no; then
325948e5ce07Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
326048e5ce07Smrgfi
326148e5ce07SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
326248e5ce07SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3263b789ec8aSmrg
32644e8f48c7Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
326548e5ce07Smrg#
326648e5ce07Smrg# This file is free software; the Free Software Foundation
326748e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
326848e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3269b789ec8aSmrg
327048e5ce07Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
327148e5ce07Smrg# ---------------------------
327248e5ce07Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
327348e5ce07Smrg# This macro is traced by Automake.
327448e5ce07SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3275c27c18e8Smrg
327648e5ce07Smrg# AM_SUBST_NOTMAKE(VARIABLE)
327748e5ce07Smrg# --------------------------
327848e5ce07Smrg# Public sister of _AM_SUBST_NOTMAKE.
327948e5ce07SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
328089069ce9Smrg
328148e5ce07Smrg# Check how to create a tarball.                            -*- Autoconf -*-
32823e256790Smrg
32834e8f48c7Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
328448e5ce07Smrg#
328548e5ce07Smrg# This file is free software; the Free Software Foundation
328648e5ce07Smrg# gives unlimited permission to copy and/or distribute it,
328748e5ce07Smrg# with or without modifications, as long as this notice is preserved.
3288c43cc173Smrg
328948e5ce07Smrg# _AM_PROG_TAR(FORMAT)
329044584a44Smrg# --------------------
329148e5ce07Smrg# Check how to create a tarball in format FORMAT.
329248e5ce07Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
329344584a44Smrg#
329448e5ce07Smrg# Substitute a variable $(am__tar) that is a command
329548e5ce07Smrg# writing to stdout a FORMAT-tarball containing the directory
329648e5ce07Smrg# $tardir.
329748e5ce07Smrg#     tardir=directory && $(am__tar) > result.tar
329844584a44Smrg#
329948e5ce07Smrg# Substitute a variable $(am__untar) that extract such
330048e5ce07Smrg# a tarball read from stdin.
330148e5ce07Smrg#     $(am__untar) < result.tar
330244584a44Smrg#
330348e5ce07SmrgAC_DEFUN([_AM_PROG_TAR],
330448e5ce07Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
330548e5ce07Smrg# in the wild :-(  We should find a proper way to deprecate it ...
330648e5ce07SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3307dc9477beSmrg
330848e5ce07Smrg# We'll loop over all known methods to create a tar archive until one works.
330948e5ce07Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3310dc9477beSmrg
331148e5ce07Smrgm4_if([$1], [v7],
331248e5ce07Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3313dc9477beSmrg
331448e5ce07Smrg  [m4_case([$1],
331548e5ce07Smrg    [ustar],
331648e5ce07Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
331748e5ce07Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
331848e5ce07Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
331948e5ce07Smrg      # and bug#13588).
332048e5ce07Smrg      am_max_uid=2097151 # 2^21 - 1
332148e5ce07Smrg      am_max_gid=$am_max_uid
332248e5ce07Smrg      # The $UID and $GID variables are not portable, so we need to resort
332348e5ce07Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
332448e5ce07Smrg      # below are definitely unexpected, so allow the users to see them
332548e5ce07Smrg      # (that is, avoid stderr redirection).
332648e5ce07Smrg      am_uid=`id -u || echo unknown`
332748e5ce07Smrg      am_gid=`id -g || echo unknown`
332848e5ce07Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
332948e5ce07Smrg      if test $am_uid -le $am_max_uid; then
333048e5ce07Smrg         AC_MSG_RESULT([yes])
333148e5ce07Smrg      else
333248e5ce07Smrg         AC_MSG_RESULT([no])
333348e5ce07Smrg         _am_tools=none
333448e5ce07Smrg      fi
333548e5ce07Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
333648e5ce07Smrg      if test $am_gid -le $am_max_gid; then
333748e5ce07Smrg         AC_MSG_RESULT([yes])
333848e5ce07Smrg      else
333948e5ce07Smrg        AC_MSG_RESULT([no])
334048e5ce07Smrg        _am_tools=none
334148e5ce07Smrg      fi],
334248e5ce07Smrg
334348e5ce07Smrg  [pax],
334448e5ce07Smrg    [],
334548e5ce07Smrg
334648e5ce07Smrg  [m4_fatal([Unknown tar format])])
334748e5ce07Smrg
334848e5ce07Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
334948e5ce07Smrg
335048e5ce07Smrg  # Go ahead even if we have the value already cached.  We do so because we
335148e5ce07Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
335248e5ce07Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
335348e5ce07Smrg
335448e5ce07Smrg  for _am_tool in $_am_tools; do
335548e5ce07Smrg    case $_am_tool in
335648e5ce07Smrg    gnutar)
335748e5ce07Smrg      for _am_tar in tar gnutar gtar; do
335848e5ce07Smrg        AM_RUN_LOG([$_am_tar --version]) && break
335948e5ce07Smrg      done
336048e5ce07Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
336148e5ce07Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
336248e5ce07Smrg      am__untar="$_am_tar -xf -"
336348e5ce07Smrg      ;;
336448e5ce07Smrg    plaintar)
336548e5ce07Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
336648e5ce07Smrg      # ustar tarball either.
336748e5ce07Smrg      (tar --version) >/dev/null 2>&1 && continue
336848e5ce07Smrg      am__tar='tar chf - "$$tardir"'
336948e5ce07Smrg      am__tar_='tar chf - "$tardir"'
337048e5ce07Smrg      am__untar='tar xf -'
337148e5ce07Smrg      ;;
337248e5ce07Smrg    pax)
337348e5ce07Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
337448e5ce07Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
337548e5ce07Smrg      am__untar='pax -r'
337648e5ce07Smrg      ;;
337748e5ce07Smrg    cpio)
337848e5ce07Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
337948e5ce07Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
338048e5ce07Smrg      am__untar='cpio -i -H $1 -d'
338148e5ce07Smrg      ;;
338248e5ce07Smrg    none)
338348e5ce07Smrg      am__tar=false
338448e5ce07Smrg      am__tar_=false
338548e5ce07Smrg      am__untar=false
338648e5ce07Smrg      ;;
338748e5ce07Smrg    esac
338848e5ce07Smrg
338948e5ce07Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
339048e5ce07Smrg    # and am__untar set.
339148e5ce07Smrg    test -n "${am_cv_prog_tar_$1}" && break
339248e5ce07Smrg
339348e5ce07Smrg    # tar/untar a dummy directory, and stop if the command works.
339448e5ce07Smrg    rm -rf conftest.dir
339548e5ce07Smrg    mkdir conftest.dir
339648e5ce07Smrg    echo GrepMe > conftest.dir/file
339748e5ce07Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
339848e5ce07Smrg    rm -rf conftest.dir
339948e5ce07Smrg    if test -s conftest.tar; then
340048e5ce07Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
340148e5ce07Smrg      AM_RUN_LOG([cat conftest.dir/file])
340248e5ce07Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
340348e5ce07Smrg    fi
340448e5ce07Smrg  done
340548e5ce07Smrg  rm -rf conftest.dir
340648e5ce07Smrg
340748e5ce07Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
340848e5ce07Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
340948e5ce07Smrg
341048e5ce07SmrgAC_SUBST([am__tar])
341148e5ce07SmrgAC_SUBST([am__untar])
341248e5ce07Smrg]) # _AM_PROG_TAR
3413c43cc173Smrg
34144e8f48c7Smrgm4_include([m4/libtool.m4])
34154e8f48c7Smrgm4_include([m4/ltoptions.m4])
34164e8f48c7Smrgm4_include([m4/ltsugar.m4])
34174e8f48c7Smrgm4_include([m4/ltversion.m4])
34184e8f48c7Smrgm4_include([m4/lt~obsolete.m4])
3419