133adc6acSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2fda9279dSmrg
333adc6acSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4fda9279dSmrg
5fda9279dSmrg# This file is free software; the Free Software Foundation
6fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
7fda9279dSmrg# with or without modifications, as long as this notice is preserved.
8fda9279dSmrg
9fda9279dSmrg# This program is distributed in the hope that it will be useful,
10fda9279dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fda9279dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fda9279dSmrg# PARTICULAR PURPOSE.
13fda9279dSmrg
14fda9279dSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15fda9279dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16fda9279dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1733adc6acSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1833adc6acSmrg[m4_warning([this file was generated for autoconf 2.72.
19fda9279dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20fda9279dSmrgIf you have problems, you may need to regenerate the build system entirely.
21fda9279dSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22fda9279dSmrg
2333adc6acSmrg# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
24dd52494dSmrg# serial 12 (pkg-config-0.29.2)
25fda9279dSmrg
26c2e4ac43Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27c2e4ac43Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
28c2e4ac43Smrgdnl
29c2e4ac43Smrgdnl This program is free software; you can redistribute it and/or modify
30c2e4ac43Smrgdnl it under the terms of the GNU General Public License as published by
31c2e4ac43Smrgdnl the Free Software Foundation; either version 2 of the License, or
32c2e4ac43Smrgdnl (at your option) any later version.
33c2e4ac43Smrgdnl
34c2e4ac43Smrgdnl This program is distributed in the hope that it will be useful, but
35c2e4ac43Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
36c2e4ac43Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37c2e4ac43Smrgdnl General Public License for more details.
38c2e4ac43Smrgdnl
39c2e4ac43Smrgdnl You should have received a copy of the GNU General Public License
40c2e4ac43Smrgdnl along with this program; if not, write to the Free Software
41c2e4ac43Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
42c2e4ac43Smrgdnl 02111-1307, USA.
43c2e4ac43Smrgdnl
44c2e4ac43Smrgdnl As a special exception to the GNU General Public License, if you
45c2e4ac43Smrgdnl distribute this file as part of a program that contains a
46c2e4ac43Smrgdnl configuration script generated by Autoconf, you may include it under
47c2e4ac43Smrgdnl the same distribution terms that you use for the rest of that
48c2e4ac43Smrgdnl program.
49c2e4ac43Smrg
50c2e4ac43Smrgdnl PKG_PREREQ(MIN-VERSION)
51c2e4ac43Smrgdnl -----------------------
52c2e4ac43Smrgdnl Since: 0.29
53c2e4ac43Smrgdnl
54c2e4ac43Smrgdnl Verify that the version of the pkg-config macros are at least
55c2e4ac43Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
56c2e4ac43Smrgdnl installed version of pkg-config, this checks the developer's version
57c2e4ac43Smrgdnl of pkg.m4 when generating configure.
58c2e4ac43Smrgdnl
59c2e4ac43Smrgdnl To ensure that this macro is defined, also add:
60c2e4ac43Smrgdnl m4_ifndef([PKG_PREREQ],
61c2e4ac43Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
62c2e4ac43Smrgdnl
63c2e4ac43Smrgdnl See the "Since" comment for each macro you use to see what version
64c2e4ac43Smrgdnl of the macros you require.
65c2e4ac43Smrgm4_defun([PKG_PREREQ],
66dd52494dSmrg[m4_define([PKG_MACROS_VERSION], [0.29.2])
67c2e4ac43Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
68c2e4ac43Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
69c2e4ac43Smrg])dnl PKG_PREREQ
70c2e4ac43Smrg
7133adc6acSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
7233adc6acSmrgdnl ---------------------------------------------------------
73c2e4ac43Smrgdnl Since: 0.16
74c2e4ac43Smrgdnl
75c2e4ac43Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
76c2e4ac43Smrgdnl first found in the path. Checks that the version of pkg-config found
77c2e4ac43Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
78c2e4ac43Smrgdnl used since that's the first version where most current features of
79c2e4ac43Smrgdnl pkg-config existed.
8033adc6acSmrgdnl
8133adc6acSmrgdnl If pkg-config is not found or older than specified, it will result
8233adc6acSmrgdnl in an empty PKG_CONFIG variable. To avoid widespread issues with
8333adc6acSmrgdnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
8433adc6acSmrgdnl You can specify [PKG_CONFIG=false] as an action instead, which would
8533adc6acSmrgdnl result in pkg-config tests failing, but no bogus error messages.
86fda9279dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
87fda9279dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
88fda9279dSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
89fda9279dSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
90fda9279dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
91fda9279dSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
92fda9279dSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
93fda9279dSmrg
94fda9279dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
95fda9279dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
96fda9279dSmrgfi
97fda9279dSmrgif test -n "$PKG_CONFIG"; then
98fda9279dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
99fda9279dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
100fda9279dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
101fda9279dSmrg		AC_MSG_RESULT([yes])
102fda9279dSmrg	else
103fda9279dSmrg		AC_MSG_RESULT([no])
104fda9279dSmrg		PKG_CONFIG=""
105fda9279dSmrg	fi
10633adc6acSmrgfi
10733adc6acSmrgif test -z "$PKG_CONFIG"; then
10833adc6acSmrg	m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
109fda9279dSmrgfi[]dnl
110c2e4ac43Smrg])dnl PKG_PROG_PKG_CONFIG
111fda9279dSmrg
112c2e4ac43Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
113c2e4ac43Smrgdnl -------------------------------------------------------------------
114c2e4ac43Smrgdnl Since: 0.18
115c2e4ac43Smrgdnl
116c2e4ac43Smrgdnl Check to see whether a particular set of modules exists. Similar to
117c2e4ac43Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
118c2e4ac43Smrgdnl
119c2e4ac43Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12033adc6acSmrgdnl only at the first occurrence in configure.ac, so if the first place
121c2e4ac43Smrgdnl it's called might be skipped (such as if it is within an "if", you
122c2e4ac43Smrgdnl have to call PKG_CHECK_EXISTS manually
123fda9279dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
124fda9279dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
125fda9279dSmrgif test -n "$PKG_CONFIG" && \
126fda9279dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
127fda9279dSmrg  m4_default([$2], [:])
128fda9279dSmrgm4_ifvaln([$3], [else
129fda9279dSmrg  $3])dnl
130fda9279dSmrgfi])
131fda9279dSmrg
132c2e4ac43Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
133c2e4ac43Smrgdnl ---------------------------------------------
134c2e4ac43Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
135c2e4ac43Smrgdnl pkg_failed based on the result.
136fda9279dSmrgm4_define([_PKG_CONFIG],
137fda9279dSmrg[if test -n "$$1"; then
138fda9279dSmrg    pkg_cv_[]$1="$$1"
139fda9279dSmrg elif test -n "$PKG_CONFIG"; then
140fda9279dSmrg    PKG_CHECK_EXISTS([$3],
141fda9279dSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
142fda9279dSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
143fda9279dSmrg		     [pkg_failed=yes])
144fda9279dSmrg else
145fda9279dSmrg    pkg_failed=untried
146fda9279dSmrgfi[]dnl
147c2e4ac43Smrg])dnl _PKG_CONFIG
148fda9279dSmrg
149c2e4ac43Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
150c2e4ac43Smrgdnl ---------------------------
151c2e4ac43Smrgdnl Internal check to see if pkg-config supports short errors.
152fda9279dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
153fda9279dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
154fda9279dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
155fda9279dSmrg        _pkg_short_errors_supported=yes
156fda9279dSmrgelse
157fda9279dSmrg        _pkg_short_errors_supported=no
158fda9279dSmrgfi[]dnl
159c2e4ac43Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
160fda9279dSmrg
161fda9279dSmrg
162c2e4ac43Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
163c2e4ac43Smrgdnl   [ACTION-IF-NOT-FOUND])
164c2e4ac43Smrgdnl --------------------------------------------------------------
165c2e4ac43Smrgdnl Since: 0.4.0
166c2e4ac43Smrgdnl
167c2e4ac43Smrgdnl Note that if there is a possibility the first call to
168c2e4ac43Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
169c2e4ac43Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
170fda9279dSmrgAC_DEFUN([PKG_CHECK_MODULES],
171fda9279dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
172fda9279dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
173fda9279dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
174fda9279dSmrg
175fda9279dSmrgpkg_failed=no
176dd52494dSmrgAC_MSG_CHECKING([for $2])
177fda9279dSmrg
178fda9279dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
179fda9279dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
180fda9279dSmrg
181fda9279dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
182fda9279dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
183fda9279dSmrgSee the pkg-config man page for more details.])
184fda9279dSmrg
185fda9279dSmrgif test $pkg_failed = yes; then
186dd52494dSmrg        AC_MSG_RESULT([no])
187fda9279dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
188fda9279dSmrg        if test $_pkg_short_errors_supported = yes; then
18933adc6acSmrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
190dd52494dSmrg        else
19133adc6acSmrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
192fda9279dSmrg        fi
19333adc6acSmrg        # Put the nasty error message in config.log where it belongs
19433adc6acSmrg        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
195fda9279dSmrg
19633adc6acSmrg        m4_default([$4], [AC_MSG_ERROR(
197fda9279dSmrg[Package requirements ($2) were not met:
198fda9279dSmrg
199fda9279dSmrg$$1_PKG_ERRORS
200fda9279dSmrg
201fda9279dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
202fda9279dSmrginstalled software in a non-standard prefix.
203fda9279dSmrg
204fda9279dSmrg_PKG_TEXT])[]dnl
205fda9279dSmrg        ])
206fda9279dSmrgelif test $pkg_failed = untried; then
207dd52494dSmrg        AC_MSG_RESULT([no])
20833adc6acSmrg        m4_default([$4], [AC_MSG_FAILURE(
209fda9279dSmrg[The pkg-config script could not be found or is too old.  Make sure it
210fda9279dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
211fda9279dSmrgpath to pkg-config.
212fda9279dSmrg
213fda9279dSmrg_PKG_TEXT
214fda9279dSmrg
215fda9279dSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
216fda9279dSmrg        ])
217fda9279dSmrgelse
21833adc6acSmrg        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21933adc6acSmrg        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
220fda9279dSmrg        AC_MSG_RESULT([yes])
22133adc6acSmrg        $3
222fda9279dSmrgfi[]dnl
223c2e4ac43Smrg])dnl PKG_CHECK_MODULES
224fda9279dSmrg
22516ee1e9aSmrg
226c2e4ac43Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
227c2e4ac43Smrgdnl   [ACTION-IF-NOT-FOUND])
228c2e4ac43Smrgdnl ---------------------------------------------------------------------
229c2e4ac43Smrgdnl Since: 0.29
230c2e4ac43Smrgdnl
231c2e4ac43Smrgdnl Checks for existence of MODULES and gathers its build flags with
232c2e4ac43Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
233c2e4ac43Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
234c2e4ac43Smrgdnl
235c2e4ac43Smrgdnl Note that if there is a possibility the first call to
236c2e4ac43Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
237c2e4ac43Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
238c2e4ac43Smrgdnl configure.ac.
239c2e4ac43SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
240c2e4ac43Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
241c2e4ac43Smrg_save_PKG_CONFIG=$PKG_CONFIG
242c2e4ac43SmrgPKG_CONFIG="$PKG_CONFIG --static"
243c2e4ac43SmrgPKG_CHECK_MODULES($@)
244c2e4ac43SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
245c2e4ac43Smrg])dnl PKG_CHECK_MODULES_STATIC
246c2e4ac43Smrg
247c2e4ac43Smrg
248c2e4ac43Smrgdnl PKG_INSTALLDIR([DIRECTORY])
249c2e4ac43Smrgdnl -------------------------
250c2e4ac43Smrgdnl Since: 0.27
251c2e4ac43Smrgdnl
252c2e4ac43Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
253c2e4ac43Smrgdnl should install pkg-config .pc files. By default the directory is
254c2e4ac43Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
255c2e4ac43Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
256c2e4ac43Smrgdnl parameter.
25716ee1e9aSmrgAC_DEFUN([PKG_INSTALLDIR],
25816ee1e9aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25916ee1e9aSmrgm4_pushdef([pkg_description],
26016ee1e9aSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
26116ee1e9aSmrgAC_ARG_WITH([pkgconfigdir],
26216ee1e9aSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
26316ee1e9aSmrg    [with_pkgconfigdir=]pkg_default)
26416ee1e9aSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
26516ee1e9aSmrgm4_popdef([pkg_default])
26616ee1e9aSmrgm4_popdef([pkg_description])
267c2e4ac43Smrg])dnl PKG_INSTALLDIR
26816ee1e9aSmrg
26916ee1e9aSmrg
270c2e4ac43Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
271c2e4ac43Smrgdnl --------------------------------
272c2e4ac43Smrgdnl Since: 0.27
273c2e4ac43Smrgdnl
274c2e4ac43Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
275c2e4ac43Smrgdnl module should install arch-independent pkg-config .pc files. By
276c2e4ac43Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
277c2e4ac43Smrgdnl changed by passing DIRECTORY. The user can override through the
278c2e4ac43Smrgdnl --with-noarch-pkgconfigdir parameter.
27916ee1e9aSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
28016ee1e9aSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
28116ee1e9aSmrgm4_pushdef([pkg_description],
28216ee1e9aSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
28316ee1e9aSmrgAC_ARG_WITH([noarch-pkgconfigdir],
28416ee1e9aSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
28516ee1e9aSmrg    [with_noarch_pkgconfigdir=]pkg_default)
28616ee1e9aSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
28716ee1e9aSmrgm4_popdef([pkg_default])
28816ee1e9aSmrgm4_popdef([pkg_description])
289c2e4ac43Smrg])dnl PKG_NOARCH_INSTALLDIR
29016ee1e9aSmrg
29116ee1e9aSmrg
292c2e4ac43Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
293c2e4ac43Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
294c2e4ac43Smrgdnl -------------------------------------------
295c2e4ac43Smrgdnl Since: 0.28
296c2e4ac43Smrgdnl
297c2e4ac43Smrgdnl Retrieves the value of the pkg-config variable for the given module.
29816ee1e9aSmrgAC_DEFUN([PKG_CHECK_VAR],
29916ee1e9aSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
30016ee1e9aSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
30116ee1e9aSmrg
30216ee1e9aSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
30316ee1e9aSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
30416ee1e9aSmrg
30516ee1e9aSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
306c2e4ac43Smrg])dnl PKG_CHECK_VAR
30716ee1e9aSmrg
30833adc6acSmrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
30933adc6acSmrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
31033adc6acSmrgdnl   [DESCRIPTION], [DEFAULT])
31133adc6acSmrgdnl ------------------------------------------
31233adc6acSmrgdnl
31333adc6acSmrgdnl Prepare a "--with-" configure option using the lowercase
31433adc6acSmrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
31533adc6acSmrgdnl PKG_CHECK_MODULES in a single macro.
31633adc6acSmrgAC_DEFUN([PKG_WITH_MODULES],
31733adc6acSmrg[
31833adc6acSmrgm4_pushdef([with_arg], m4_tolower([$1]))
31933adc6acSmrg
32033adc6acSmrgm4_pushdef([description],
32133adc6acSmrg           [m4_default([$5], [build with ]with_arg[ support])])
32233adc6acSmrg
32333adc6acSmrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
32433adc6acSmrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
32533adc6acSmrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
32633adc6acSmrg
32733adc6acSmrgm4_case(def_arg,
32833adc6acSmrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
32933adc6acSmrg            [m4_pushdef([with_without],[--with-]with_arg)])
33033adc6acSmrg
33133adc6acSmrgAC_ARG_WITH(with_arg,
33233adc6acSmrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
33333adc6acSmrg    [AS_TR_SH([with_]with_arg)=def_arg])
33433adc6acSmrg
33533adc6acSmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
33633adc6acSmrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
33733adc6acSmrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
33833adc6acSmrg                                        [m4_n([def_action_if_found]) $3],
33933adc6acSmrg                                        [m4_n([def_action_if_not_found]) $4])])
34033adc6acSmrg
34133adc6acSmrgm4_popdef([with_arg])
34233adc6acSmrgm4_popdef([description])
34333adc6acSmrgm4_popdef([def_arg])
34433adc6acSmrg
34533adc6acSmrg])dnl PKG_WITH_MODULES
34633adc6acSmrg
34733adc6acSmrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
34833adc6acSmrgdnl   [DESCRIPTION], [DEFAULT])
34933adc6acSmrgdnl -----------------------------------------------
35033adc6acSmrgdnl
35133adc6acSmrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
35233adc6acSmrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
35333adc6acSmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
35433adc6acSmrg[
35533adc6acSmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
35633adc6acSmrg
35733adc6acSmrgAM_CONDITIONAL([HAVE_][$1],
35833adc6acSmrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
35933adc6acSmrg])dnl PKG_HAVE_WITH_MODULES
36033adc6acSmrg
36133adc6acSmrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
36233adc6acSmrgdnl   [DESCRIPTION], [DEFAULT])
36333adc6acSmrgdnl ------------------------------------------------------
36433adc6acSmrgdnl
36533adc6acSmrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
36633adc6acSmrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
36733adc6acSmrgdnl and preprocessor variable.
36833adc6acSmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
36933adc6acSmrg[
37033adc6acSmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
37133adc6acSmrg
37233adc6acSmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
37333adc6acSmrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
37433adc6acSmrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
37533adc6acSmrg
376fda9279dSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
377fda9279dSmrgdnl
37833adc6acSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
37916ee1e9aSmrgdnl
380fda9279dSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
381fda9279dSmrgdnl copy of this software and associated documentation files (the "Software"),
382fda9279dSmrgdnl to deal in the Software without restriction, including without limitation
383fda9279dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
384fda9279dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
385fda9279dSmrgdnl Software is furnished to do so, subject to the following conditions:
386fda9279dSmrgdnl
387fda9279dSmrgdnl The above copyright notice and this permission notice (including the next
388fda9279dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
389fda9279dSmrgdnl Software.
390fda9279dSmrgdnl
391fda9279dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
392fda9279dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
393fda9279dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
394fda9279dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
395fda9279dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
396fda9279dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
397fda9279dSmrgdnl DEALINGS IN THE SOFTWARE.
398fda9279dSmrg
399fda9279dSmrg# XORG_MACROS_VERSION(required-version)
400fda9279dSmrg# -------------------------------------
401fda9279dSmrg# Minimum version: 1.1.0
402fda9279dSmrg#
403fda9279dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
404fda9279dSmrg# your configure.ac with the minimum required version, such as:
405fda9279dSmrg# XORG_MACROS_VERSION(1.1)
406fda9279dSmrg#
407fda9279dSmrg# To ensure that this macro is defined, also add:
408fda9279dSmrg# m4_ifndef([XORG_MACROS_VERSION],
409fda9279dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
410fda9279dSmrg#
411fda9279dSmrg#
41216ee1e9aSmrg# See the "minimum version" comment for each macro you use to see what
413fda9279dSmrg# version you require.
414fda9279dSmrgm4_defun([XORG_MACROS_VERSION],[
41533adc6acSmrgm4_define([vers_have], [1.20.1])
416fda9279dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
417fda9279dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
418fda9279dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
419fda9279dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
420fda9279dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
421fda9279dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
422fda9279dSmrgm4_undefine([vers_have])
423fda9279dSmrgm4_undefine([maj_have])
424fda9279dSmrgm4_undefine([maj_needed])
425fda9279dSmrg]) # XORG_MACROS_VERSION
426fda9279dSmrg
427fda9279dSmrg# XORG_PROG_RAWCPP()
428fda9279dSmrg# ------------------
429fda9279dSmrg# Minimum version: 1.0.0
430fda9279dSmrg#
431fda9279dSmrg# Find cpp program and necessary flags for use in pre-processing text files
432fda9279dSmrg# such as man pages and config files
433fda9279dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
434fda9279dSmrgAC_REQUIRE([AC_PROG_CPP])
43592405695SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
436fda9279dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
437fda9279dSmrg
438fda9279dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
439fda9279dSmrg# which is not the best choice for supporting other OS'es, but covers most
440fda9279dSmrg# of the ones we need for now.
441fda9279dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
442fda9279dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
443fda9279dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
444fda9279dSmrg	AC_MSG_RESULT([no])
445fda9279dSmrgelse
446fda9279dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
447fda9279dSmrg		RAWCPPFLAGS=-undef
448fda9279dSmrg		AC_MSG_RESULT([yes])
449fda9279dSmrg	# under Cygwin unix is still defined even with -undef
450fda9279dSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
451fda9279dSmrg		RAWCPPFLAGS="-undef -ansi"
452fda9279dSmrg		AC_MSG_RESULT([yes, with -ansi])
453fda9279dSmrg	else
454fda9279dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
455fda9279dSmrg	fi
456fda9279dSmrgfi
457fda9279dSmrgrm -f conftest.$ac_ext
458fda9279dSmrg
459fda9279dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
460fda9279dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
46133adc6acSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
462fda9279dSmrg	AC_MSG_RESULT([no])
463fda9279dSmrgelse
46433adc6acSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
46516ee1e9aSmrg		TRADITIONALCPPFLAGS="-traditional"
466fda9279dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
467fda9279dSmrg		AC_MSG_RESULT([yes])
468fda9279dSmrg	else
469fda9279dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
470fda9279dSmrg	fi
471fda9279dSmrgfi
472fda9279dSmrgrm -f conftest.$ac_ext
473fda9279dSmrgAC_SUBST(RAWCPPFLAGS)
47416ee1e9aSmrgAC_SUBST(TRADITIONALCPPFLAGS)
475fda9279dSmrg]) # XORG_PROG_RAWCPP
476fda9279dSmrg
477fda9279dSmrg# XORG_MANPAGE_SECTIONS()
478fda9279dSmrg# -----------------------
479fda9279dSmrg# Minimum version: 1.0.0
480fda9279dSmrg#
481fda9279dSmrg# Determine which sections man pages go in for the different man page types
482fda9279dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
483fda9279dSmrg# Not sure if there's any better way than just hardcoding by OS name.
484fda9279dSmrg# Override default settings by setting environment variables
485fda9279dSmrg# Added MAN_SUBSTS in version 1.8
486fda9279dSmrg# Added AC_PROG_SED in version 1.8
487fda9279dSmrg
488fda9279dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
489fda9279dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
490fda9279dSmrgAC_REQUIRE([AC_PROG_SED])
491fda9279dSmrg
492dd52494dSmrgcase $host_os in
493dd52494dSmrg    solaris*)
494dd52494dSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
495dd52494dSmrg        # check for a man page file found in later versions that use
496dd52494dSmrg        # traditional section numbers instead
497dd52494dSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
498dd52494dSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
499dd52494dSmrg        ;;
500dd52494dSmrg    *) SYSV_MAN_SECTIONS=false ;;
501dd52494dSmrgesac
502dd52494dSmrg
503fda9279dSmrgif test x$APP_MAN_SUFFIX = x    ; then
504fda9279dSmrg    APP_MAN_SUFFIX=1
505fda9279dSmrgfi
506fda9279dSmrgif test x$APP_MAN_DIR = x    ; then
507fda9279dSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
508fda9279dSmrgfi
509fda9279dSmrg
510fda9279dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
511fda9279dSmrg    LIB_MAN_SUFFIX=3
512fda9279dSmrgfi
513fda9279dSmrgif test x$LIB_MAN_DIR = x    ; then
514fda9279dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
515fda9279dSmrgfi
516fda9279dSmrg
517fda9279dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
518dd52494dSmrg    case $SYSV_MAN_SECTIONS in
519dd52494dSmrg	true)				FILE_MAN_SUFFIX=4  ;;
520dd52494dSmrg	*)				FILE_MAN_SUFFIX=5  ;;
521fda9279dSmrg    esac
522fda9279dSmrgfi
523fda9279dSmrgif test x$FILE_MAN_DIR = x    ; then
524fda9279dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
525fda9279dSmrgfi
526fda9279dSmrg
527fda9279dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
528dd52494dSmrg    case $SYSV_MAN_SECTIONS in
529dd52494dSmrg	true)				MISC_MAN_SUFFIX=5  ;;
530dd52494dSmrg	*)				MISC_MAN_SUFFIX=7  ;;
531fda9279dSmrg    esac
532fda9279dSmrgfi
533fda9279dSmrgif test x$MISC_MAN_DIR = x    ; then
534fda9279dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
535fda9279dSmrgfi
536fda9279dSmrg
537fda9279dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
538dd52494dSmrg    case $SYSV_MAN_SECTIONS in
539dd52494dSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
540dd52494dSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
541fda9279dSmrg    esac
542fda9279dSmrgfi
543fda9279dSmrgif test x$DRIVER_MAN_DIR = x    ; then
544fda9279dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
545fda9279dSmrgfi
546fda9279dSmrg
547fda9279dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
548dd52494dSmrg    case $SYSV_MAN_SECTIONS in
549dd52494dSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
550dd52494dSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
551fda9279dSmrg    esac
552fda9279dSmrgfi
553fda9279dSmrgif test x$ADMIN_MAN_DIR = x    ; then
554fda9279dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
555fda9279dSmrgfi
556fda9279dSmrg
557fda9279dSmrg
558fda9279dSmrgAC_SUBST([APP_MAN_SUFFIX])
559fda9279dSmrgAC_SUBST([LIB_MAN_SUFFIX])
560fda9279dSmrgAC_SUBST([FILE_MAN_SUFFIX])
561fda9279dSmrgAC_SUBST([MISC_MAN_SUFFIX])
562fda9279dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
563fda9279dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
564fda9279dSmrgAC_SUBST([APP_MAN_DIR])
565fda9279dSmrgAC_SUBST([LIB_MAN_DIR])
566fda9279dSmrgAC_SUBST([FILE_MAN_DIR])
567fda9279dSmrgAC_SUBST([MISC_MAN_DIR])
568fda9279dSmrgAC_SUBST([DRIVER_MAN_DIR])
569fda9279dSmrgAC_SUBST([ADMIN_MAN_DIR])
570fda9279dSmrg
571fda9279dSmrgXORG_MAN_PAGE="X Version 11"
572fda9279dSmrgAC_SUBST([XORG_MAN_PAGE])
573fda9279dSmrgMAN_SUBSTS="\
574fda9279dSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
575fda9279dSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
576fda9279dSmrg	-e 's|__xservername__|Xorg|g' \
577fda9279dSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
578fda9279dSmrg	-e 's|__projectroot__|\$(prefix)|g' \
579fda9279dSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
580fda9279dSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
581fda9279dSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
582fda9279dSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
583fda9279dSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
584fda9279dSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
585fda9279dSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
586fda9279dSmrgAC_SUBST([MAN_SUBSTS])
587fda9279dSmrg
588fda9279dSmrg]) # XORG_MANPAGE_SECTIONS
589fda9279dSmrg
590fda9279dSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
591fda9279dSmrg# ------------------------
592fda9279dSmrg# Minimum version: 1.7.0
593fda9279dSmrg#
594fda9279dSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
595fda9279dSmrg# provided by xorg-sgml-doctools, if installed.
596fda9279dSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
597fda9279dSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
598fda9279dSmrgXORG_SGML_PATH=
599fda9279dSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
600fda9279dSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
601fda9279dSmrg    [m4_ifval([$1],[:],
602fda9279dSmrg        [if test x"$cross_compiling" != x"yes" ; then
603fda9279dSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
604fda9279dSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
605fda9279dSmrg         fi])
606fda9279dSmrg    ])
607fda9279dSmrg
608fda9279dSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
609fda9279dSmrg# the path and the name of the doc stylesheet
610fda9279dSmrgif test "x$XORG_SGML_PATH" != "x" ; then
611fda9279dSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
612fda9279dSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
613fda9279dSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
614fda9279dSmrgelse
615fda9279dSmrg   AC_MSG_RESULT([no])
616fda9279dSmrgfi
617fda9279dSmrg
618fda9279dSmrgAC_SUBST(XORG_SGML_PATH)
619fda9279dSmrgAC_SUBST(STYLESHEET_SRCDIR)
620fda9279dSmrgAC_SUBST(XSL_STYLESHEET)
621fda9279dSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
622fda9279dSmrg]) # XORG_CHECK_SGML_DOCTOOLS
623fda9279dSmrg
624fda9279dSmrg# XORG_CHECK_LINUXDOC
625fda9279dSmrg# -------------------
626fda9279dSmrg# Minimum version: 1.0.0
627fda9279dSmrg#
628fda9279dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
629fda9279dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
630fda9279dSmrg# Whether or not the necessary tools and files are found can be checked
631fda9279dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
632fda9279dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
633fda9279dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
634fda9279dSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
635fda9279dSmrg
636fda9279dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
637fda9279dSmrg
638fda9279dSmrgAC_MSG_CHECKING([whether to build documentation])
639fda9279dSmrg
640fda9279dSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
641fda9279dSmrg   BUILDDOC=yes
642fda9279dSmrgelse
643fda9279dSmrg   BUILDDOC=no
644fda9279dSmrgfi
645fda9279dSmrg
646fda9279dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
647fda9279dSmrg
648fda9279dSmrgAC_MSG_RESULT([$BUILDDOC])
649fda9279dSmrg
650fda9279dSmrgAC_MSG_CHECKING([whether to build pdf documentation])
651fda9279dSmrg
652fda9279dSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
653fda9279dSmrg   BUILDPDFDOC=yes
654fda9279dSmrgelse
655fda9279dSmrg   BUILDPDFDOC=no
656fda9279dSmrgfi
657fda9279dSmrg
658fda9279dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
659fda9279dSmrg
660fda9279dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
661fda9279dSmrg
662fda9279dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
663fda9279dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
664fda9279dSmrgMAKE_PDF="$PS2PDF"
665fda9279dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
666fda9279dSmrg
667fda9279dSmrgAC_SUBST(MAKE_TEXT)
668fda9279dSmrgAC_SUBST(MAKE_PS)
669fda9279dSmrgAC_SUBST(MAKE_PDF)
670fda9279dSmrgAC_SUBST(MAKE_HTML)
671fda9279dSmrg]) # XORG_CHECK_LINUXDOC
672fda9279dSmrg
673fda9279dSmrg# XORG_CHECK_DOCBOOK
674fda9279dSmrg# -------------------
675fda9279dSmrg# Minimum version: 1.0.0
676fda9279dSmrg#
677fda9279dSmrg# Checks for the ability to build output formats from SGML DocBook source.
678fda9279dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
679fda9279dSmrg# indicates whether the necessary tools and files are found and, if set,
680fda9279dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
681fda9279dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
682fda9279dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
683fda9279dSmrg
684fda9279dSmrgBUILDTXTDOC=no
685fda9279dSmrgBUILDPDFDOC=no
686fda9279dSmrgBUILDPSDOC=no
687fda9279dSmrgBUILDHTMLDOC=no
688fda9279dSmrg
689fda9279dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
690fda9279dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
691fda9279dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
692fda9279dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
693fda9279dSmrg
694fda9279dSmrgAC_MSG_CHECKING([whether to build text documentation])
695fda9279dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
696fda9279dSmrg   test x$BUILD_TXTDOC != xno; then
697fda9279dSmrg	BUILDTXTDOC=yes
698fda9279dSmrgfi
699fda9279dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
700fda9279dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
701fda9279dSmrg
702fda9279dSmrgAC_MSG_CHECKING([whether to build PDF documentation])
703fda9279dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
704fda9279dSmrg   test x$BUILD_PDFDOC != xno; then
705fda9279dSmrg	BUILDPDFDOC=yes
706fda9279dSmrgfi
707fda9279dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
708fda9279dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
709fda9279dSmrg
710fda9279dSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
711fda9279dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
712fda9279dSmrg   test x$BUILD_PSDOC != xno; then
713fda9279dSmrg	BUILDPSDOC=yes
714fda9279dSmrgfi
715fda9279dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
716fda9279dSmrgAC_MSG_RESULT([$BUILDPSDOC])
717fda9279dSmrg
718fda9279dSmrgAC_MSG_CHECKING([whether to build HTML documentation])
719fda9279dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
720fda9279dSmrg   test x$BUILD_HTMLDOC != xno; then
721fda9279dSmrg	BUILDHTMLDOC=yes
722fda9279dSmrgfi
723fda9279dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
724fda9279dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
725fda9279dSmrg
726fda9279dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
727fda9279dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
728fda9279dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
729fda9279dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
730fda9279dSmrg
731fda9279dSmrgAC_SUBST(MAKE_TEXT)
732fda9279dSmrgAC_SUBST(MAKE_PS)
733fda9279dSmrgAC_SUBST(MAKE_PDF)
734fda9279dSmrgAC_SUBST(MAKE_HTML)
735fda9279dSmrg]) # XORG_CHECK_DOCBOOK
736fda9279dSmrg
737fda9279dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
738fda9279dSmrg# ----------------
739fda9279dSmrg# Minimum version: 1.5.0
740fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
741fda9279dSmrg#
742fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
743fda9279dSmrg# not at the appropriate level. This macro enables a module to test for the
744fda9279dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
74533adc6acSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
746fda9279dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
747fda9279dSmrg# --with-xmlto assumes 'auto'.
748fda9279dSmrg#
749fda9279dSmrg# Interface to module:
750fda9279dSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
751fda9279dSmrg# XMLTO:	returns the path of the xmlto program found
752fda9279dSmrg#		returns the path set by the user in the environment
753fda9279dSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
754fda9279dSmrg#		'no' user instructs the module not to use xmlto
755fda9279dSmrg#
756fda9279dSmrg# Added in version 1.10.0
757fda9279dSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
758fda9279dSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
759fda9279dSmrg#
760fda9279dSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
761fda9279dSmrg#
762fda9279dSmrgAC_DEFUN([XORG_WITH_XMLTO],[
763fda9279dSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
764fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
765fda9279dSmrgAC_ARG_WITH(xmlto,
766fda9279dSmrg	AS_HELP_STRING([--with-xmlto],
767fda9279dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
768fda9279dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
769fda9279dSmrgm4_undefine([_defopt])
770fda9279dSmrg
771fda9279dSmrgif test "x$use_xmlto" = x"auto"; then
772fda9279dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
773fda9279dSmrg   if test "x$XMLTO" = "x"; then
774fda9279dSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
775fda9279dSmrg	have_xmlto=no
776fda9279dSmrg   else
777fda9279dSmrg        have_xmlto=yes
778fda9279dSmrg   fi
779fda9279dSmrgelif test "x$use_xmlto" = x"yes" ; then
780fda9279dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
781fda9279dSmrg   if test "x$XMLTO" = "x"; then
782fda9279dSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
783fda9279dSmrg   fi
784fda9279dSmrg   have_xmlto=yes
785fda9279dSmrgelif test "x$use_xmlto" = x"no" ; then
786fda9279dSmrg   if test "x$XMLTO" != "x"; then
787fda9279dSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
788fda9279dSmrg   fi
789fda9279dSmrg   have_xmlto=no
790fda9279dSmrgelse
791fda9279dSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
792fda9279dSmrgfi
793fda9279dSmrg
794fda9279dSmrg# Test for a minimum version of xmlto, if provided.
795fda9279dSmrgm4_ifval([$1],
796fda9279dSmrg[if test "$have_xmlto" = yes; then
797fda9279dSmrg    # scrape the xmlto version
798fda9279dSmrg    AC_MSG_CHECKING([the xmlto version])
799fda9279dSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
800fda9279dSmrg    AC_MSG_RESULT([$xmlto_version])
801fda9279dSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
802fda9279dSmrg        [if test "x$use_xmlto" = xauto; then
803fda9279dSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
804fda9279dSmrg            have_xmlto=no
805fda9279dSmrg        else
806fda9279dSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
807fda9279dSmrg        fi])
808fda9279dSmrgfi])
809fda9279dSmrg
810fda9279dSmrg# Test for the ability of xmlto to generate a text target
811dd52494dSmrg#
812dd52494dSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
813dd52494dSmrg# following test for empty XML docbook files.
814dd52494dSmrg# For compatibility reasons use the following empty XML docbook file and if
815dd52494dSmrg# it fails try it again with a non-empty XML file.
816fda9279dSmrghave_xmlto_text=no
817fda9279dSmrgcat > conftest.xml << "EOF"
818fda9279dSmrgEOF
819fda9279dSmrgAS_IF([test "$have_xmlto" = yes],
820fda9279dSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
821fda9279dSmrg             [have_xmlto_text=yes],
822dd52494dSmrg             [# Try it again with a non-empty XML file.
823dd52494dSmrg              cat > conftest.xml << "EOF"
824dd52494dSmrg<x></x>
825dd52494dSmrgEOF
826dd52494dSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
827dd52494dSmrg                    [have_xmlto_text=yes],
828dd52494dSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
829fda9279dSmrgrm -f conftest.xml
830fda9279dSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
831fda9279dSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
832fda9279dSmrg]) # XORG_WITH_XMLTO
833fda9279dSmrg
834fda9279dSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
835fda9279dSmrg# --------------------------------------------
836fda9279dSmrg# Minimum version: 1.12.0
837fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.12.0
838fda9279dSmrg#
839fda9279dSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
840fda9279dSmrg# XML-based language used for the transformation of XML documents.
841fda9279dSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
842fda9279dSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
843fda9279dSmrg# The XSLT processor is often used as a standalone tool for transformations.
844fda9279dSmrg# It should not be assumed that this tool is used only to work with documnetation.
845fda9279dSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
846fda9279dSmrg#
847fda9279dSmrg# Interface to module:
848fda9279dSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
849fda9279dSmrg# XSLTPROC:	 returns the path of the xsltproc program found
850fda9279dSmrg#		 returns the path set by the user in the environment
851fda9279dSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
852fda9279dSmrg#		  'no' user instructs the module not to use xsltproc
853fda9279dSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
854fda9279dSmrg#
855fda9279dSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
856fda9279dSmrg#
857fda9279dSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
858fda9279dSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
859fda9279dSmrg# Preserves the interface, should it be implemented later
860fda9279dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
861fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
862fda9279dSmrgAC_ARG_WITH(xsltproc,
863fda9279dSmrg	AS_HELP_STRING([--with-xsltproc],
864fda9279dSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
865fda9279dSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
866fda9279dSmrgm4_undefine([_defopt])
867fda9279dSmrg
868fda9279dSmrgif test "x$use_xsltproc" = x"auto"; then
869fda9279dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
870fda9279dSmrg   if test "x$XSLTPROC" = "x"; then
871fda9279dSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
872fda9279dSmrg	have_xsltproc=no
873fda9279dSmrg   else
874fda9279dSmrg        have_xsltproc=yes
875fda9279dSmrg   fi
876fda9279dSmrgelif test "x$use_xsltproc" = x"yes" ; then
877fda9279dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
878fda9279dSmrg   if test "x$XSLTPROC" = "x"; then
879fda9279dSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
880fda9279dSmrg   fi
881fda9279dSmrg   have_xsltproc=yes
882fda9279dSmrgelif test "x$use_xsltproc" = x"no" ; then
883fda9279dSmrg   if test "x$XSLTPROC" != "x"; then
884fda9279dSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
885fda9279dSmrg   fi
886fda9279dSmrg   have_xsltproc=no
887fda9279dSmrgelse
888fda9279dSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
889fda9279dSmrgfi
890fda9279dSmrg
891fda9279dSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
892fda9279dSmrg]) # XORG_WITH_XSLTPROC
893fda9279dSmrg
894fda9279dSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
895fda9279dSmrg# ----------------------------------------
896fda9279dSmrg# Minimum version: 1.15.0
897fda9279dSmrg#
898fda9279dSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
899fda9279dSmrg# scanning arbitrary text files, extracting information from those text files,
900fda9279dSmrg# and printing reports based on that information.
901fda9279dSmrg#
902fda9279dSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
903fda9279dSmrg#
904fda9279dSmrg# Interface to module:
905fda9279dSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
906fda9279dSmrg# PERL:	     returns the path of the perl program found
907fda9279dSmrg#	     returns the path set by the user in the environment
908fda9279dSmrg# --with-perl: 'yes' user instructs the module to use perl
909fda9279dSmrg#	       'no' user instructs the module not to use perl
910fda9279dSmrg# have_perl: returns yes if perl found in PATH or no
911fda9279dSmrg#
912fda9279dSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
913fda9279dSmrg#
914fda9279dSmrgAC_DEFUN([XORG_WITH_PERL],[
915fda9279dSmrgAC_ARG_VAR([PERL], [Path to perl command])
916fda9279dSmrg# Preserves the interface, should it be implemented later
917fda9279dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
918fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
919fda9279dSmrgAC_ARG_WITH(perl,
920fda9279dSmrg	AS_HELP_STRING([--with-perl],
921fda9279dSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
922fda9279dSmrg	   [use_perl=$withval], [use_perl=]_defopt)
923fda9279dSmrgm4_undefine([_defopt])
924fda9279dSmrg
925fda9279dSmrgif test "x$use_perl" = x"auto"; then
926fda9279dSmrg   AC_PATH_PROG([PERL], [perl])
927fda9279dSmrg   if test "x$PERL" = "x"; then
928fda9279dSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
929fda9279dSmrg	have_perl=no
930fda9279dSmrg   else
931fda9279dSmrg        have_perl=yes
932fda9279dSmrg   fi
933fda9279dSmrgelif test "x$use_perl" = x"yes" ; then
934fda9279dSmrg   AC_PATH_PROG([PERL], [perl])
935fda9279dSmrg   if test "x$PERL" = "x"; then
936fda9279dSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
937fda9279dSmrg   fi
938fda9279dSmrg   have_perl=yes
939fda9279dSmrgelif test "x$use_perl" = x"no" ; then
940fda9279dSmrg   if test "x$PERL" != "x"; then
941fda9279dSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
942fda9279dSmrg   fi
943fda9279dSmrg   have_perl=no
944fda9279dSmrgelse
945fda9279dSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
946fda9279dSmrgfi
947fda9279dSmrg
948fda9279dSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
949fda9279dSmrg]) # XORG_WITH_PERL
950fda9279dSmrg
951fda9279dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
952fda9279dSmrg# ----------------
953fda9279dSmrg# Minimum version: 1.5.0
954fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
955fda9279dSmrg#
956fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
957fda9279dSmrg# not at the appropriate level. This macro enables a module to test for the
958fda9279dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
95933adc6acSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
960fda9279dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
961fda9279dSmrg# --with-asciidoc assumes 'auto'.
962fda9279dSmrg#
963fda9279dSmrg# Interface to module:
964fda9279dSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
965fda9279dSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
966fda9279dSmrg#		 returns the path set by the user in the environment
967fda9279dSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
968fda9279dSmrg#		  'no' user instructs the module not to use asciidoc
969fda9279dSmrg#
970fda9279dSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
971fda9279dSmrg#
972fda9279dSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
973fda9279dSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
974fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
975fda9279dSmrgAC_ARG_WITH(asciidoc,
976fda9279dSmrg	AS_HELP_STRING([--with-asciidoc],
977fda9279dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
978fda9279dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
979fda9279dSmrgm4_undefine([_defopt])
980fda9279dSmrg
981fda9279dSmrgif test "x$use_asciidoc" = x"auto"; then
982fda9279dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
983fda9279dSmrg   if test "x$ASCIIDOC" = "x"; then
984fda9279dSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
985fda9279dSmrg	have_asciidoc=no
986fda9279dSmrg   else
987fda9279dSmrg        have_asciidoc=yes
988fda9279dSmrg   fi
989fda9279dSmrgelif test "x$use_asciidoc" = x"yes" ; then
990fda9279dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
991fda9279dSmrg   if test "x$ASCIIDOC" = "x"; then
992fda9279dSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
993fda9279dSmrg   fi
994fda9279dSmrg   have_asciidoc=yes
995fda9279dSmrgelif test "x$use_asciidoc" = x"no" ; then
996fda9279dSmrg   if test "x$ASCIIDOC" != "x"; then
997fda9279dSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
998fda9279dSmrg   fi
999fda9279dSmrg   have_asciidoc=no
1000fda9279dSmrgelse
1001fda9279dSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1002fda9279dSmrgfi
1003fda9279dSmrgm4_ifval([$1],
1004fda9279dSmrg[if test "$have_asciidoc" = yes; then
1005fda9279dSmrg    # scrape the asciidoc version
1006fda9279dSmrg    AC_MSG_CHECKING([the asciidoc version])
1007fda9279dSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1008fda9279dSmrg    AC_MSG_RESULT([$asciidoc_version])
1009fda9279dSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1010fda9279dSmrg        [if test "x$use_asciidoc" = xauto; then
1011fda9279dSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1012fda9279dSmrg            have_asciidoc=no
1013fda9279dSmrg        else
1014fda9279dSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1015fda9279dSmrg        fi])
1016fda9279dSmrgfi])
1017fda9279dSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1018fda9279dSmrg]) # XORG_WITH_ASCIIDOC
1019fda9279dSmrg
1020fda9279dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
102116ee1e9aSmrg# -------------------------------------------
1022fda9279dSmrg# Minimum version: 1.5.0
1023fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
102416ee1e9aSmrg# Minimum version for optional DOT checking: 1.18.0
1025fda9279dSmrg#
1026fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
1027fda9279dSmrg# not at the appropriate level. This macro enables a module to test for the
1028fda9279dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
102933adc6acSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
1030fda9279dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1031fda9279dSmrg# --with-doxygen assumes 'auto'.
1032fda9279dSmrg#
1033fda9279dSmrg# Interface to module:
1034fda9279dSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1035fda9279dSmrg# DOXYGEN:	 returns the path of the doxygen program found
1036fda9279dSmrg#		 returns the path set by the user in the environment
1037fda9279dSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1038fda9279dSmrg#		  'no' user instructs the module not to use doxygen
1039fda9279dSmrg#
1040fda9279dSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1041fda9279dSmrg#
1042fda9279dSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1043fda9279dSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
104416ee1e9aSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1045fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1046fda9279dSmrgAC_ARG_WITH(doxygen,
1047fda9279dSmrg	AS_HELP_STRING([--with-doxygen],
1048fda9279dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1049fda9279dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1050fda9279dSmrgm4_undefine([_defopt])
1051fda9279dSmrg
1052fda9279dSmrgif test "x$use_doxygen" = x"auto"; then
1053fda9279dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1054fda9279dSmrg   if test "x$DOXYGEN" = "x"; then
1055fda9279dSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1056fda9279dSmrg	have_doxygen=no
1057fda9279dSmrg   else
1058fda9279dSmrg        have_doxygen=yes
1059fda9279dSmrg   fi
1060fda9279dSmrgelif test "x$use_doxygen" = x"yes" ; then
1061fda9279dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1062fda9279dSmrg   if test "x$DOXYGEN" = "x"; then
1063fda9279dSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1064fda9279dSmrg   fi
1065fda9279dSmrg   have_doxygen=yes
1066fda9279dSmrgelif test "x$use_doxygen" = x"no" ; then
1067fda9279dSmrg   if test "x$DOXYGEN" != "x"; then
1068fda9279dSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1069fda9279dSmrg   fi
1070fda9279dSmrg   have_doxygen=no
1071fda9279dSmrgelse
1072fda9279dSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1073fda9279dSmrgfi
1074fda9279dSmrgm4_ifval([$1],
1075fda9279dSmrg[if test "$have_doxygen" = yes; then
1076fda9279dSmrg    # scrape the doxygen version
1077fda9279dSmrg    AC_MSG_CHECKING([the doxygen version])
1078fda9279dSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1079fda9279dSmrg    AC_MSG_RESULT([$doxygen_version])
1080fda9279dSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1081fda9279dSmrg        [if test "x$use_doxygen" = xauto; then
1082fda9279dSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1083fda9279dSmrg            have_doxygen=no
1084fda9279dSmrg        else
1085fda9279dSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1086fda9279dSmrg        fi])
1087fda9279dSmrgfi])
108816ee1e9aSmrg
108916ee1e9aSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
109016ee1e9aSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
109116ee1e9aSmrgdnl 	HAVE_DOT = @HAVE_DOT@
109216ee1e9aSmrgHAVE_DOT=no
109316ee1e9aSmrgif test "x$have_doxygen" = "xyes"; then
109416ee1e9aSmrg  AC_PATH_PROG([DOT], [dot])
109516ee1e9aSmrg    if test "x$DOT" != "x"; then
109616ee1e9aSmrg      HAVE_DOT=yes
109716ee1e9aSmrg    fi
109816ee1e9aSmrgfi
109916ee1e9aSmrg
110016ee1e9aSmrgAC_SUBST([HAVE_DOT])
110116ee1e9aSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
1102fda9279dSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1103fda9279dSmrg]) # XORG_WITH_DOXYGEN
1104fda9279dSmrg
1105fda9279dSmrg# XORG_WITH_GROFF([DEFAULT])
1106fda9279dSmrg# ----------------
1107fda9279dSmrg# Minimum version: 1.6.0
1108fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1109fda9279dSmrg#
1110fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
1111fda9279dSmrg# not at the appropriate level. This macro enables a module to test for the
1112fda9279dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
111333adc6acSmrg# the --with-groff option, it allows maximum flexibility in making decisions
1114fda9279dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1115fda9279dSmrg# --with-groff assumes 'auto'.
1116fda9279dSmrg#
1117fda9279dSmrg# Interface to module:
1118fda9279dSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1119fda9279dSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1120fda9279dSmrg# HAVE_GROFF_MS: the -ms macros package
1121fda9279dSmrg# GROFF:	 returns the path of the groff program found
1122fda9279dSmrg#		 returns the path set by the user in the environment
1123fda9279dSmrg# --with-groff:	 'yes' user instructs the module to use groff
1124fda9279dSmrg#		 'no' user instructs the module not to use groff
1125fda9279dSmrg#
1126fda9279dSmrg# Added in version 1.9.0:
1127fda9279dSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1128fda9279dSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1129fda9279dSmrg#		   psselect from the psutils package.
1130fda9279dSmrg#		   the ghostcript package. Refer to the grohtml man pages
1131fda9279dSmrg#
1132fda9279dSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1133fda9279dSmrg#
1134fda9279dSmrg# OS and distros often splits groff in a basic and full package, the former
1135fda9279dSmrg# having the groff program and the later having devices, fonts and macros
1136fda9279dSmrg# Checking for the groff executable is not enough.
1137fda9279dSmrg#
1138fda9279dSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1139fda9279dSmrg# unset HAVE_GROFF or GROFF env variables.
1140fda9279dSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1141fda9279dSmrg#
1142fda9279dSmrgAC_DEFUN([XORG_WITH_GROFF],[
1143fda9279dSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1144fda9279dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1145fda9279dSmrgAC_ARG_WITH(groff,
1146fda9279dSmrg	AS_HELP_STRING([--with-groff],
1147fda9279dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1148fda9279dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1149fda9279dSmrgm4_undefine([_defopt])
1150fda9279dSmrg
1151fda9279dSmrgif test "x$use_groff" = x"auto"; then
1152fda9279dSmrg   AC_PATH_PROG([GROFF], [groff])
1153fda9279dSmrg   if test "x$GROFF" = "x"; then
1154fda9279dSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1155fda9279dSmrg	have_groff=no
1156fda9279dSmrg   else
1157fda9279dSmrg        have_groff=yes
1158fda9279dSmrg   fi
1159fda9279dSmrgelif test "x$use_groff" = x"yes" ; then
1160fda9279dSmrg   AC_PATH_PROG([GROFF], [groff])
1161fda9279dSmrg   if test "x$GROFF" = "x"; then
1162fda9279dSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1163fda9279dSmrg   fi
1164fda9279dSmrg   have_groff=yes
1165fda9279dSmrgelif test "x$use_groff" = x"no" ; then
1166fda9279dSmrg   if test "x$GROFF" != "x"; then
1167fda9279dSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1168fda9279dSmrg   fi
1169fda9279dSmrg   have_groff=no
1170fda9279dSmrgelse
1171fda9279dSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1172fda9279dSmrgfi
1173fda9279dSmrg
1174fda9279dSmrg# We have groff, test for the presence of the macro packages
1175fda9279dSmrgif test "x$have_groff" = x"yes"; then
1176fda9279dSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1177fda9279dSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1178fda9279dSmrg        groff_ms_works=yes
1179fda9279dSmrg    else
1180fda9279dSmrg        groff_ms_works=no
1181fda9279dSmrg    fi
1182fda9279dSmrg    AC_MSG_RESULT([$groff_ms_works])
1183fda9279dSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1184fda9279dSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1185fda9279dSmrg        groff_mm_works=yes
1186fda9279dSmrg    else
1187fda9279dSmrg        groff_mm_works=no
1188fda9279dSmrg    fi
1189fda9279dSmrg    AC_MSG_RESULT([$groff_mm_works])
1190fda9279dSmrgfi
1191fda9279dSmrg
1192fda9279dSmrg# We have groff, test for HTML dependencies, one command per package
1193fda9279dSmrgif test "x$have_groff" = x"yes"; then
1194fda9279dSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1195fda9279dSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1196fda9279dSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1197fda9279dSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1198fda9279dSmrg      have_groff_html=yes
1199fda9279dSmrg   else
1200fda9279dSmrg      have_groff_html=no
1201fda9279dSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1202fda9279dSmrg   fi
1203fda9279dSmrgfi
1204fda9279dSmrg
1205fda9279dSmrg# Set Automake conditionals for Makefiles
1206fda9279dSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1207fda9279dSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1208fda9279dSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1209fda9279dSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1210fda9279dSmrg]) # XORG_WITH_GROFF
1211fda9279dSmrg
1212fda9279dSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1213fda9279dSmrg# ---------------------------------------
1214fda9279dSmrg# Minimum version: 1.6.0
1215fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1216fda9279dSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1217fda9279dSmrg#
1218fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
1219fda9279dSmrg# not at the appropriate level. This macro enables a module to test for the
1220fda9279dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
122133adc6acSmrg# the --with-fop option, it allows maximum flexibility in making decisions
1222fda9279dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1223fda9279dSmrg# --with-fop assumes 'auto'.
1224fda9279dSmrg#
1225fda9279dSmrg# Interface to module:
1226fda9279dSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1227fda9279dSmrg# FOP:	 	returns the path of the fop program found
1228fda9279dSmrg#		returns the path set by the user in the environment
1229fda9279dSmrg# --with-fop: 	'yes' user instructs the module to use fop
1230fda9279dSmrg#		'no' user instructs the module not to use fop
1231fda9279dSmrg#
1232fda9279dSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1233fda9279dSmrg#
1234fda9279dSmrgAC_DEFUN([XORG_WITH_FOP],[
1235fda9279dSmrgAC_ARG_VAR([FOP], [Path to fop command])
1236fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1237fda9279dSmrgAC_ARG_WITH(fop,
1238fda9279dSmrg	AS_HELP_STRING([--with-fop],
1239fda9279dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1240fda9279dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1241fda9279dSmrgm4_undefine([_defopt])
1242fda9279dSmrg
1243fda9279dSmrgif test "x$use_fop" = x"auto"; then
1244fda9279dSmrg   AC_PATH_PROG([FOP], [fop])
1245fda9279dSmrg   if test "x$FOP" = "x"; then
1246fda9279dSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1247fda9279dSmrg	have_fop=no
1248fda9279dSmrg   else
1249fda9279dSmrg        have_fop=yes
1250fda9279dSmrg   fi
1251fda9279dSmrgelif test "x$use_fop" = x"yes" ; then
1252fda9279dSmrg   AC_PATH_PROG([FOP], [fop])
1253fda9279dSmrg   if test "x$FOP" = "x"; then
1254fda9279dSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1255fda9279dSmrg   fi
1256fda9279dSmrg   have_fop=yes
1257fda9279dSmrgelif test "x$use_fop" = x"no" ; then
1258fda9279dSmrg   if test "x$FOP" != "x"; then
1259fda9279dSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1260fda9279dSmrg   fi
1261fda9279dSmrg   have_fop=no
1262fda9279dSmrgelse
1263fda9279dSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1264fda9279dSmrgfi
1265fda9279dSmrg
1266fda9279dSmrg# Test for a minimum version of fop, if provided.
1267fda9279dSmrgm4_ifval([$1],
1268fda9279dSmrg[if test "$have_fop" = yes; then
1269fda9279dSmrg    # scrape the fop version
1270fda9279dSmrg    AC_MSG_CHECKING([for fop minimum version])
1271fda9279dSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1272fda9279dSmrg    AC_MSG_RESULT([$fop_version])
1273fda9279dSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1274fda9279dSmrg        [if test "x$use_fop" = xauto; then
1275fda9279dSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1276fda9279dSmrg            have_fop=no
1277fda9279dSmrg        else
1278fda9279dSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1279fda9279dSmrg        fi])
1280fda9279dSmrgfi])
1281fda9279dSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1282fda9279dSmrg]) # XORG_WITH_FOP
1283fda9279dSmrg
128416ee1e9aSmrg# XORG_WITH_M4([MIN-VERSION])
128516ee1e9aSmrg# ---------------------------
128616ee1e9aSmrg# Minimum version: 1.19.0
128716ee1e9aSmrg#
128816ee1e9aSmrg# This macro attempts to locate an m4 macro processor which supports
128916ee1e9aSmrg# -I option and is only useful for modules relying on M4 in order to
129016ee1e9aSmrg# expand macros in source code files.
129116ee1e9aSmrg#
129216ee1e9aSmrg# Interface to module:
129316ee1e9aSmrg# M4:	 	returns the path of the m4 program found
129416ee1e9aSmrg#		returns the path set by the user in the environment
129516ee1e9aSmrg#
129616ee1e9aSmrgAC_DEFUN([XORG_WITH_M4], [
129716ee1e9aSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
129816ee1e9aSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
129916ee1e9aSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
130016ee1e9aSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
130116ee1e9aSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
130216ee1e9aSmrg   [$PATH:/usr/gnu/bin])])
130316ee1e9aSmrg
130416ee1e9aSmrgAC_SUBST([M4], [$ac_cv_path_M4])
130516ee1e9aSmrg]) # XORG_WITH_M4
130616ee1e9aSmrg
1307fda9279dSmrg# XORG_WITH_PS2PDF([DEFAULT])
1308fda9279dSmrg# ----------------
1309fda9279dSmrg# Minimum version: 1.6.0
1310fda9279dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1311fda9279dSmrg#
1312fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
1313fda9279dSmrg# not at the appropriate level. This macro enables a module to test for the
1314fda9279dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
131533adc6acSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
1316fda9279dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1317fda9279dSmrg# --with-ps2pdf assumes 'auto'.
1318fda9279dSmrg#
1319fda9279dSmrg# Interface to module:
1320fda9279dSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1321fda9279dSmrg# PS2PDF:	returns the path of the ps2pdf program found
1322fda9279dSmrg#		returns the path set by the user in the environment
1323fda9279dSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1324fda9279dSmrg#		 'no' user instructs the module not to use ps2pdf
1325fda9279dSmrg#
1326fda9279dSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1327fda9279dSmrg#
1328fda9279dSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1329fda9279dSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1330fda9279dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1331fda9279dSmrgAC_ARG_WITH(ps2pdf,
1332fda9279dSmrg	AS_HELP_STRING([--with-ps2pdf],
1333fda9279dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1334fda9279dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1335fda9279dSmrgm4_undefine([_defopt])
1336fda9279dSmrg
1337fda9279dSmrgif test "x$use_ps2pdf" = x"auto"; then
1338fda9279dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1339fda9279dSmrg   if test "x$PS2PDF" = "x"; then
1340fda9279dSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1341fda9279dSmrg	have_ps2pdf=no
1342fda9279dSmrg   else
1343fda9279dSmrg        have_ps2pdf=yes
1344fda9279dSmrg   fi
1345fda9279dSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1346fda9279dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1347fda9279dSmrg   if test "x$PS2PDF" = "x"; then
1348fda9279dSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1349fda9279dSmrg   fi
1350fda9279dSmrg   have_ps2pdf=yes
1351fda9279dSmrgelif test "x$use_ps2pdf" = x"no" ; then
1352fda9279dSmrg   if test "x$PS2PDF" != "x"; then
1353fda9279dSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1354fda9279dSmrg   fi
1355fda9279dSmrg   have_ps2pdf=no
1356fda9279dSmrgelse
1357fda9279dSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1358fda9279dSmrgfi
1359fda9279dSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1360fda9279dSmrg]) # XORG_WITH_PS2PDF
1361fda9279dSmrg
1362fda9279dSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1363fda9279dSmrg# ----------------
1364fda9279dSmrg# Minimum version: 1.6.0
1365fda9279dSmrg#
1366fda9279dSmrg# Documentation tools are not always available on all platforms and sometimes
1367fda9279dSmrg# not at the appropriate level. This macro enables a builder to skip all
1368fda9279dSmrg# documentation targets except traditional man pages.
1369fda9279dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
137033adc6acSmrg# maximum flexibility in controlling documentation building.
1371fda9279dSmrg# Refer to:
1372fda9279dSmrg# XORG_WITH_XMLTO         --with-xmlto
1373fda9279dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1374fda9279dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1375fda9279dSmrg# XORG_WITH_FOP           --with-fop
1376fda9279dSmrg# XORG_WITH_GROFF         --with-groff
1377fda9279dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1378fda9279dSmrg#
1379fda9279dSmrg# Interface to module:
1380fda9279dSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1381fda9279dSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1382fda9279dSmrg#		 'no' user instructs the module not to generate docs
1383fda9279dSmrg# parm1:	specify the default value, yes or no.
1384fda9279dSmrg#
1385fda9279dSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1386fda9279dSmrgm4_define([docs_default], m4_default([$1], [yes]))
1387fda9279dSmrgAC_ARG_ENABLE(docs,
1388fda9279dSmrg	AS_HELP_STRING([--enable-docs],
1389fda9279dSmrg	   [Enable building the documentation (default: ]docs_default[)]),
1390fda9279dSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
1391fda9279dSmrgm4_undefine([docs_default])
1392fda9279dSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1393fda9279dSmrgAC_MSG_CHECKING([whether to build documentation])
1394fda9279dSmrgAC_MSG_RESULT([$build_docs])
1395fda9279dSmrg]) # XORG_ENABLE_DOCS
1396fda9279dSmrg
1397fda9279dSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1398fda9279dSmrg# ----------------
1399fda9279dSmrg# Minimum version: 1.6.0
1400fda9279dSmrg#
1401fda9279dSmrg# This macro enables a builder to skip all developer documentation.
1402fda9279dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
140333adc6acSmrg# maximum flexibility in controlling documentation building.
1404fda9279dSmrg# Refer to:
1405fda9279dSmrg# XORG_WITH_XMLTO         --with-xmlto
1406fda9279dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1407fda9279dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1408fda9279dSmrg# XORG_WITH_FOP           --with-fop
1409fda9279dSmrg# XORG_WITH_GROFF         --with-groff
1410fda9279dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1411fda9279dSmrg#
1412fda9279dSmrg# Interface to module:
1413fda9279dSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1414fda9279dSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1415fda9279dSmrg#			'no' user instructs the module not to generate developer docs
1416fda9279dSmrg# parm1:		specify the default value, yes or no.
1417fda9279dSmrg#
1418fda9279dSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1419fda9279dSmrgm4_define([devel_default], m4_default([$1], [yes]))
1420fda9279dSmrgAC_ARG_ENABLE(devel-docs,
1421fda9279dSmrg	AS_HELP_STRING([--enable-devel-docs],
1422fda9279dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1423fda9279dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1424fda9279dSmrgm4_undefine([devel_default])
1425fda9279dSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1426fda9279dSmrgAC_MSG_CHECKING([whether to build developer documentation])
1427fda9279dSmrgAC_MSG_RESULT([$build_devel_docs])
1428fda9279dSmrg]) # XORG_ENABLE_DEVEL_DOCS
1429fda9279dSmrg
1430fda9279dSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1431fda9279dSmrg# ----------------
1432fda9279dSmrg# Minimum version: 1.6.0
1433fda9279dSmrg#
1434fda9279dSmrg# This macro enables a builder to skip all functional specification targets.
1435fda9279dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
143633adc6acSmrg# maximum flexibility in controlling documentation building.
1437fda9279dSmrg# Refer to:
1438fda9279dSmrg# XORG_WITH_XMLTO         --with-xmlto
1439fda9279dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1440fda9279dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1441fda9279dSmrg# XORG_WITH_FOP           --with-fop
1442fda9279dSmrg# XORG_WITH_GROFF         --with-groff
1443fda9279dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1444fda9279dSmrg#
1445fda9279dSmrg# Interface to module:
1446fda9279dSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1447fda9279dSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1448fda9279dSmrg#			'no' user instructs the module not to generate specs
1449fda9279dSmrg# parm1:		specify the default value, yes or no.
1450fda9279dSmrg#
1451fda9279dSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1452fda9279dSmrgm4_define([spec_default], m4_default([$1], [yes]))
1453fda9279dSmrgAC_ARG_ENABLE(specs,
1454fda9279dSmrg	AS_HELP_STRING([--enable-specs],
1455fda9279dSmrg	   [Enable building the specs (default: ]spec_default[)]),
1456fda9279dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1457fda9279dSmrgm4_undefine([spec_default])
1458fda9279dSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1459fda9279dSmrgAC_MSG_CHECKING([whether to build functional specifications])
1460fda9279dSmrgAC_MSG_RESULT([$build_specs])
1461fda9279dSmrg]) # XORG_ENABLE_SPECS
1462fda9279dSmrg
1463fda9279dSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
1464fda9279dSmrg# ----------------------------------------------
1465fda9279dSmrg# Minimum version: 1.13.0
1466fda9279dSmrg#
1467fda9279dSmrg# This macro enables a builder to enable/disable unit testing
1468fda9279dSmrg# It makes no assumption about the test cases implementation
1469fda9279dSmrg# Test cases may or may not use Automake "Support for test suites"
1470fda9279dSmrg# They may or may not use the software utility library GLib
1471fda9279dSmrg#
1472fda9279dSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
1473fda9279dSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
1474fda9279dSmrg# The variable enable_unit_tests is used by other macros in this file.
1475fda9279dSmrg#
1476fda9279dSmrg# Interface to module:
1477fda9279dSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
1478fda9279dSmrg# enable_unit_tests:    used in configure.ac for additional configuration
1479fda9279dSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
1480fda9279dSmrg#			'no' user instructs the module not to build tests
1481fda9279dSmrg# parm1:		specify the default value, yes or no.
1482fda9279dSmrg#
1483fda9279dSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
1484fda9279dSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
1485fda9279dSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1486fda9279dSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1487fda9279dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1488fda9279dSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
1489fda9279dSmrg	[Enable building unit test cases (default: ]_defopt[)]),
1490fda9279dSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
1491fda9279dSmrgm4_undefine([_defopt])
1492fda9279dSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
1493fda9279dSmrgAC_MSG_CHECKING([whether to build unit test cases])
1494fda9279dSmrgAC_MSG_RESULT([$enable_unit_tests])
1495fda9279dSmrg]) # XORG_ENABLE_UNIT_TESTS
1496fda9279dSmrg
1497fda9279dSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
1498fda9279dSmrg# ------------------------------------------------------
1499fda9279dSmrg# Minimum version: 1.17.0
1500fda9279dSmrg#
1501fda9279dSmrg# This macro enables a builder to enable/disable integration testing
1502fda9279dSmrg# It makes no assumption about the test cases' implementation
1503fda9279dSmrg# Test cases may or may not use Automake "Support for test suites"
1504fda9279dSmrg#
1505fda9279dSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
1506fda9279dSmrg# usually requires less dependencies and may be built and run under less
1507fda9279dSmrg# stringent environments than integration tests.
1508fda9279dSmrg#
1509fda9279dSmrg# Interface to module:
1510fda9279dSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
1511fda9279dSmrg# enable_integration_tests:   used in configure.ac for additional configuration
1512fda9279dSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
1513fda9279dSmrg#                             'no' user instructs the module not to build tests
1514fda9279dSmrg# parm1:                      specify the default value, yes or no.
1515fda9279dSmrg#
1516fda9279dSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
1517fda9279dSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1518fda9279dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1519fda9279dSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
1520fda9279dSmrg	[Enable building integration test cases (default: ]_defopt[)]),
1521fda9279dSmrg	[enable_integration_tests=$enableval],
1522fda9279dSmrg	[enable_integration_tests=]_defopt)
1523fda9279dSmrgm4_undefine([_defopt])
1524fda9279dSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
1525fda9279dSmrg	[test "x$enable_integration_tests" != xno])
1526fda9279dSmrgAC_MSG_CHECKING([whether to build unit test cases])
1527fda9279dSmrgAC_MSG_RESULT([$enable_integration_tests])
1528fda9279dSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1529fda9279dSmrg
1530fda9279dSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
1531fda9279dSmrg# ----------------------------------------
1532fda9279dSmrg# Minimum version: 1.13.0
1533fda9279dSmrg#
1534fda9279dSmrg# GLib is a library which provides advanced data structures and functions.
1535fda9279dSmrg# This macro enables a module to test for the presence of Glib.
1536fda9279dSmrg#
1537fda9279dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
1538fda9279dSmrg# Otherwise the value of $enable_unit_tests is blank.
1539fda9279dSmrg#
1540fda9279dSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
1541fda9279dSmrg# test support usually requires less dependencies and may be built and run under
1542fda9279dSmrg# less stringent environments than integration tests.
1543fda9279dSmrg#
1544fda9279dSmrg# Interface to module:
1545fda9279dSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
1546fda9279dSmrg# with_glib: used in configure.ac to know if GLib has been found
1547fda9279dSmrg# --with-glib:	'yes' user instructs the module to use glib
1548fda9279dSmrg#		'no' user instructs the module not to use glib
1549fda9279dSmrg#
1550fda9279dSmrgAC_DEFUN([XORG_WITH_GLIB],[
1551fda9279dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1552fda9279dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1553fda9279dSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
1554fda9279dSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
1555fda9279dSmrg	[with_glib=$withval], [with_glib=]_defopt)
1556fda9279dSmrgm4_undefine([_defopt])
1557fda9279dSmrg
1558fda9279dSmrghave_glib=no
1559fda9279dSmrg# Do not probe GLib if user explicitly disabled unit testing
1560fda9279dSmrgif test "x$enable_unit_tests" != x"no"; then
1561fda9279dSmrg  # Do not probe GLib if user explicitly disabled it
1562fda9279dSmrg  if test "x$with_glib" != x"no"; then
1563fda9279dSmrg    m4_ifval(
1564fda9279dSmrg      [$1],
1565fda9279dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
1566fda9279dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
1567fda9279dSmrg    )
1568fda9279dSmrg  fi
1569fda9279dSmrgfi
1570fda9279dSmrg
1571fda9279dSmrg# Not having GLib when unit testing has been explicitly requested is an error
1572fda9279dSmrgif test "x$enable_unit_tests" = x"yes"; then
1573fda9279dSmrg  if test "x$have_glib" = x"no"; then
1574fda9279dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1575fda9279dSmrg  fi
1576fda9279dSmrgfi
1577fda9279dSmrg
1578fda9279dSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
1579fda9279dSmrgif test "x$enable_unit_tests" = x"no"; then
1580fda9279dSmrg  if test "x$with_glib" = x"yes"; then
1581fda9279dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1582fda9279dSmrg  fi
1583fda9279dSmrgfi
1584fda9279dSmrg
1585fda9279dSmrg# Not having GLib when it has been explicitly requested is an error
1586fda9279dSmrgif test "x$with_glib" = x"yes"; then
1587fda9279dSmrg  if test "x$have_glib" = x"no"; then
1588fda9279dSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
1589fda9279dSmrg  fi
1590fda9279dSmrgfi
1591fda9279dSmrg
1592fda9279dSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
1593fda9279dSmrg]) # XORG_WITH_GLIB
1594fda9279dSmrg
1595fda9279dSmrg# XORG_LD_WRAP([required|optional])
1596fda9279dSmrg# ---------------------------------
1597fda9279dSmrg# Minimum version: 1.13.0
1598fda9279dSmrg#
1599fda9279dSmrg# Check if linker supports -wrap, passed via compiler flags
1600fda9279dSmrg#
1601fda9279dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
1602fda9279dSmrg# Otherwise the value of $enable_unit_tests is blank.
1603fda9279dSmrg#
1604fda9279dSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
1605fda9279dSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
1606fda9279dSmrg# available, an argument of "optional" allows use when some unit tests require
1607fda9279dSmrg# ld -wrap and others do not.
1608fda9279dSmrg#
1609fda9279dSmrgAC_DEFUN([XORG_LD_WRAP],[
1610fda9279dSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
1611fda9279dSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
1612fda9279dSmrg                      void __wrap_exit(int status) { return; }],
1613fda9279dSmrg                     [exit(0);])])
1614fda9279dSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
1615fda9279dSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
1616fda9279dSmrg  if test "x$have_ld_wrap" = x"no"; then
1617fda9279dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
1618fda9279dSmrg  fi
1619fda9279dSmrgfi
1620fda9279dSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1621fda9279dSmrg#
1622fda9279dSmrg]) # XORG_LD_WRAP
1623fda9279dSmrg
1624fda9279dSmrg# XORG_CHECK_LINKER_FLAGS
1625fda9279dSmrg# -----------------------
1626fda9279dSmrg# SYNOPSIS
1627fda9279dSmrg#
1628fda9279dSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
1629fda9279dSmrg#
1630fda9279dSmrg# DESCRIPTION
1631fda9279dSmrg#
1632fda9279dSmrg#   Check whether the given linker FLAGS work with the current language's
1633fda9279dSmrg#   linker, or whether they give an error.
1634fda9279dSmrg#
1635fda9279dSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
1636fda9279dSmrg#   success/failure.
1637fda9279dSmrg#
1638fda9279dSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
1639fda9279dSmrg#
1640fda9279dSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
1641fda9279dSmrg#
1642fda9279dSmrg# LICENSE
1643fda9279dSmrg#
1644fda9279dSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
1645fda9279dSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
1646fda9279dSmrg#   Copyright (c) 2009 Matteo Frigo
1647fda9279dSmrg#
1648fda9279dSmrg#   This program is free software: you can redistribute it and/or modify it
1649fda9279dSmrg#   under the terms of the GNU General Public License as published by the
1650fda9279dSmrg#   Free Software Foundation, either version 3 of the License, or (at your
1651fda9279dSmrg#   option) any later version.
1652fda9279dSmrg#
1653fda9279dSmrg#   This program is distributed in the hope that it will be useful, but
1654fda9279dSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
1655fda9279dSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1656fda9279dSmrg#   Public License for more details.
1657fda9279dSmrg#
1658fda9279dSmrg#   You should have received a copy of the GNU General Public License along
1659fda9279dSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
1660fda9279dSmrg#
1661fda9279dSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
1662fda9279dSmrg#   gives unlimited permission to copy, distribute and modify the configure
1663fda9279dSmrg#   scripts that are the output of Autoconf when processing the Macro. You
1664fda9279dSmrg#   need not follow the terms of the GNU General Public License when using
1665fda9279dSmrg#   or distributing such scripts, even though portions of the text of the
1666fda9279dSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
1667fda9279dSmrg#   all other use of the material that constitutes the Autoconf Macro.
1668fda9279dSmrg#
1669fda9279dSmrg#   This special exception to the GPL applies to versions of the Autoconf
1670fda9279dSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
1671fda9279dSmrg#   modified version of the Autoconf Macro, you may extend this special
1672fda9279dSmrg#   exception to the GPL to apply to your modified version as well.#
1673fda9279dSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
1674fda9279dSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
1675fda9279dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
1676fda9279dSmrgAS_LITERAL_IF([$1],
1677fda9279dSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
1678fda9279dSmrg      ax_save_FLAGS=$LDFLAGS
1679fda9279dSmrg      LDFLAGS="$1"
1680fda9279dSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
1681fda9279dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1682fda9279dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1683fda9279dSmrg      LDFLAGS=$ax_save_FLAGS])],
1684fda9279dSmrg  [ax_save_FLAGS=$LDFLAGS
1685fda9279dSmrg   LDFLAGS="$1"
1686fda9279dSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1687fda9279dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1688fda9279dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1689fda9279dSmrg   LDFLAGS=$ax_save_FLAGS])
1690fda9279dSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
1691fda9279dSmrgAC_MSG_RESULT($xorg_check_linker_flags)
1692fda9279dSmrgif test "x$xorg_check_linker_flags" = xyes; then
1693fda9279dSmrg	m4_default([$2], :)
1694fda9279dSmrgelse
1695fda9279dSmrg	m4_default([$3], :)
1696fda9279dSmrgfi
1697fda9279dSmrg]) # XORG_CHECK_LINKER_FLAGS
1698fda9279dSmrg
1699fda9279dSmrg# XORG_MEMORY_CHECK_FLAGS
1700fda9279dSmrg# -----------------------
1701fda9279dSmrg# Minimum version: 1.16.0
1702fda9279dSmrg#
1703fda9279dSmrg# This macro attempts to find appropriate memory checking functionality
1704fda9279dSmrg# for various platforms which unit testing code may use to catch various
1705fda9279dSmrg# forms of memory allocation and access errors in testing.
1706fda9279dSmrg#
1707fda9279dSmrg# Interface to module:
1708fda9279dSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
1709fda9279dSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
1710fda9279dSmrg#
1711fda9279dSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
1712fda9279dSmrg#
1713fda9279dSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1714fda9279dSmrg
1715fda9279dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1716fda9279dSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
1717fda9279dSmrg           [Environment variables to enable memory checking in tests])
1718fda9279dSmrg
1719fda9279dSmrg# Check for different types of support on different platforms
1720fda9279dSmrgcase $host_os in
1721fda9279dSmrg    solaris*)
1722fda9279dSmrg        AC_CHECK_LIB([umem], [umem_alloc],
1723fda9279dSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
1724fda9279dSmrg        ;;
1725fda9279dSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
1726fda9279dSmrg        # both directly and inverted, so should not be 0 or 255.
1727fda9279dSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
1728fda9279dSmrg        ;;
1729fda9279dSmrg    darwin*)
1730fda9279dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
1731fda9279dSmrg        ;;
1732fda9279dSmrg    *bsd*)
1733fda9279dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
1734fda9279dSmrg        ;;
1735fda9279dSmrgesac
1736fda9279dSmrg
1737fda9279dSmrg# User supplied flags override default flags
1738fda9279dSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
1739fda9279dSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1740fda9279dSmrgfi
1741fda9279dSmrg
1742fda9279dSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
1743fda9279dSmrg]) # XORG_WITH_LINT
1744fda9279dSmrg
1745fda9279dSmrg# XORG_CHECK_MALLOC_ZERO
1746fda9279dSmrg# ----------------------
1747fda9279dSmrg# Minimum version: 1.0.0
1748fda9279dSmrg#
1749fda9279dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1750fda9279dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1751fda9279dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1752fda9279dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1753fda9279dSmrgAC_ARG_ENABLE(malloc0returnsnull,
1754fda9279dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1755fda9279dSmrg		       [malloc(0) returns NULL (default: auto)]),
1756fda9279dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1757fda9279dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1758fda9279dSmrg
1759fda9279dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1760fda9279dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
176116ee1e9aSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
176216ee1e9aSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
1763fda9279dSmrg#include <stdlib.h>
1764fda9279dSmrg],[
1765fda9279dSmrg    char *m0, *r0, *c0, *p;
1766fda9279dSmrg    m0 = malloc(0);
1767fda9279dSmrg    p = malloc(10);
1768fda9279dSmrg    r0 = realloc(p,0);
1769fda9279dSmrg    c0 = calloc(0,10);
1770fda9279dSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
1771fda9279dSmrg])],
177216ee1e9aSmrg		[xorg_cv_malloc0_returns_null=yes],
177316ee1e9aSmrg		[xorg_cv_malloc0_returns_null=no])])
177416ee1e9aSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1775fda9279dSmrgfi
1776fda9279dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1777fda9279dSmrg
1778fda9279dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1779fda9279dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1780fda9279dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1781fda9279dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1782fda9279dSmrgelse
1783fda9279dSmrg	MALLOC_ZERO_CFLAGS=""
1784fda9279dSmrg	XMALLOC_ZERO_CFLAGS=""
1785fda9279dSmrg	XTMALLOC_ZERO_CFLAGS=""
1786fda9279dSmrgfi
1787fda9279dSmrg
1788fda9279dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1789fda9279dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1790fda9279dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1791fda9279dSmrg]) # XORG_CHECK_MALLOC_ZERO
1792fda9279dSmrg
1793fda9279dSmrg# XORG_WITH_LINT()
1794fda9279dSmrg# ----------------
1795fda9279dSmrg# Minimum version: 1.1.0
1796fda9279dSmrg#
1797fda9279dSmrg# This macro enables the use of a tool that flags some suspicious and
1798fda9279dSmrg# non-portable constructs (likely to be bugs) in C language source code.
1799fda9279dSmrg# It will attempt to locate the tool and use appropriate options.
1800fda9279dSmrg# There are various lint type tools on different platforms.
1801fda9279dSmrg#
1802fda9279dSmrg# Interface to module:
1803fda9279dSmrg# LINT:		returns the path to the tool found on the platform
1804fda9279dSmrg#		or the value set to LINT on the configure cmd line
1805fda9279dSmrg#		also an Automake conditional
1806fda9279dSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1807fda9279dSmrg#
1808fda9279dSmrg# --with-lint:	'yes' user instructs the module to use lint
1809fda9279dSmrg#		'no' user instructs the module not to use lint (default)
1810fda9279dSmrg#
1811fda9279dSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1812fda9279dSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1813fda9279dSmrg#
1814fda9279dSmrgAC_DEFUN([XORG_WITH_LINT],[
1815fda9279dSmrg
1816fda9279dSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1817fda9279dSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1818fda9279dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1819fda9279dSmrg		[Use a lint-style source code checker (default: disabled)])],
1820fda9279dSmrg		[use_lint=$withval], [use_lint=no])
1821fda9279dSmrg
1822fda9279dSmrg# Obtain platform specific info like program name and options
1823fda9279dSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1824fda9279dSmrgcase $host_os in
1825fda9279dSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1826fda9279dSmrg	lint_name=splint
1827fda9279dSmrg	lint_options="-badflag"
1828fda9279dSmrg	;;
1829fda9279dSmrg  *freebsd* | *netbsd*)
1830fda9279dSmrg	lint_name=lint
1831fda9279dSmrg	lint_options="-u -b"
1832fda9279dSmrg	;;
1833fda9279dSmrg  *solaris*)
1834fda9279dSmrg	lint_name=lint
1835fda9279dSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1836fda9279dSmrg	;;
1837fda9279dSmrgesac
1838fda9279dSmrg
1839fda9279dSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1840fda9279dSmrgif test "x$use_lint" = x"yes" ; then
1841fda9279dSmrg   AC_PATH_PROG([LINT], [$lint_name])
1842fda9279dSmrg   if test "x$LINT" = "x"; then
1843fda9279dSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1844fda9279dSmrg   fi
1845fda9279dSmrgelif test "x$use_lint" = x"no" ; then
1846fda9279dSmrg   if test "x$LINT" != "x"; then
1847fda9279dSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1848fda9279dSmrg   fi
1849fda9279dSmrgelse
1850fda9279dSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1851fda9279dSmrgfi
1852fda9279dSmrg
1853fda9279dSmrg# User supplied flags override default flags
1854fda9279dSmrgif test "x$LINT_FLAGS" != "x"; then
1855fda9279dSmrg   lint_options=$LINT_FLAGS
1856fda9279dSmrgfi
1857fda9279dSmrg
1858fda9279dSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1859fda9279dSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1860fda9279dSmrg
1861fda9279dSmrg]) # XORG_WITH_LINT
1862fda9279dSmrg
1863fda9279dSmrg# XORG_LINT_LIBRARY(LIBNAME)
1864fda9279dSmrg# --------------------------
1865fda9279dSmrg# Minimum version: 1.1.0
1866fda9279dSmrg#
1867fda9279dSmrg# Sets up flags for building lint libraries for checking programs that call
1868fda9279dSmrg# functions in the library.
1869fda9279dSmrg#
1870fda9279dSmrg# Interface to module:
1871fda9279dSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1872fda9279dSmrg# MAKE_LINT_LIB		- Automake conditional
1873fda9279dSmrg#
1874fda9279dSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1875fda9279dSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1876fda9279dSmrg
1877fda9279dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1878fda9279dSmrgAC_REQUIRE([XORG_WITH_LINT])
1879fda9279dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1880fda9279dSmrg	[Create lint library (default: disabled)])],
1881fda9279dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1882fda9279dSmrg
1883fda9279dSmrgif test "x$make_lint_lib" = x"yes" ; then
1884fda9279dSmrg   LINTLIB=llib-l$1.ln
1885fda9279dSmrg   if test "x$LINT" = "x"; then
1886fda9279dSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1887fda9279dSmrg   fi
1888fda9279dSmrgelif test "x$make_lint_lib" != x"no" ; then
1889fda9279dSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1890fda9279dSmrgfi
1891fda9279dSmrg
1892fda9279dSmrgAC_SUBST(LINTLIB)
1893fda9279dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1894fda9279dSmrg
1895fda9279dSmrg]) # XORG_LINT_LIBRARY
1896fda9279dSmrg
1897fda9279dSmrg# XORG_COMPILER_BRAND
1898fda9279dSmrg# -------------------
1899fda9279dSmrg# Minimum version: 1.14.0
1900fda9279dSmrg#
1901fda9279dSmrg# Checks for various brands of compilers and sets flags as appropriate:
1902fda9279dSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
1903fda9279dSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
1904fda9279dSmrg#   clang compiler - sets CLANGCC to "yes"
1905fda9279dSmrg#   Intel compiler - sets INTELCC to "yes"
1906fda9279dSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1907fda9279dSmrg#
1908fda9279dSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
1909fda9279dSmrgAC_LANG_CASE(
1910fda9279dSmrg	[C], [
191133adc6acSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
191233adc6acSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
191333adc6acSmrg		m4_version_prereq([2.70],
191433adc6acSmrg			[AC_REQUIRE([AC_PROG_CC])],
191533adc6acSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
1916fda9279dSmrg	],
1917fda9279dSmrg	[C++], [
1918fda9279dSmrg		AC_REQUIRE([AC_PROG_CXX])
1919fda9279dSmrg	]
1920fda9279dSmrg)
1921fda9279dSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
1922fda9279dSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1923fda9279dSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1924fda9279dSmrg]) # XORG_COMPILER_BRAND
1925fda9279dSmrg
1926fda9279dSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
1927fda9279dSmrg# ---------------
1928fda9279dSmrg# Minimum version: 1.16.0
1929fda9279dSmrg#
1930fda9279dSmrg# Test if the compiler works when passed the given flag as a command line argument.
193133adc6acSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
1932fda9279dSmrg# next flag in the list until there are no more options.
1933fda9279dSmrg#
1934fda9279dSmrg# Note that this does not guarantee that the compiler supports the flag as some
1935fda9279dSmrg# compilers will simply ignore arguments that they do not understand, but we do
1936fda9279dSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
1937fda9279dSmrg# -Werror=unused-command-line-argument
1938fda9279dSmrg#
1939fda9279dSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
1940fda9279dSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1941fda9279dSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1942fda9279dSmrg
1943fda9279dSmrgAC_LANG_COMPILER_REQUIRE
1944fda9279dSmrg
1945fda9279dSmrgAC_LANG_CASE(
1946fda9279dSmrg	[C], [
194733adc6acSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
194833adc6acSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
194933adc6acSmrg		m4_version_prereq([2.70],
195033adc6acSmrg			[AC_REQUIRE([AC_PROG_CC])],
195133adc6acSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
1952fda9279dSmrg		define([PREFIX], [C])
1953fda9279dSmrg		define([CACHE_PREFIX], [cc])
1954fda9279dSmrg		define([COMPILER], [$CC])
1955fda9279dSmrg	],
1956fda9279dSmrg	[C++], [
1957fda9279dSmrg		define([PREFIX], [CXX])
1958fda9279dSmrg		define([CACHE_PREFIX], [cxx])
1959fda9279dSmrg		define([COMPILER], [$CXX])
1960fda9279dSmrg	]
1961fda9279dSmrg)
1962fda9279dSmrg
1963fda9279dSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1964fda9279dSmrg
1965fda9279dSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
1966fda9279dSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1967fda9279dSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
1968fda9279dSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
1969fda9279dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1970fda9279dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
1971fda9279dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
1972fda9279dSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
1973fda9279dSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1974fda9279dSmrgfi
1975fda9279dSmrg
1976fda9279dSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
1977fda9279dSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
1978fda9279dSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1979fda9279dSmrg	fi
1980fda9279dSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1981fda9279dSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
1982fda9279dSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
1983fda9279dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1984fda9279dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
1985fda9279dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
1986fda9279dSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
1987fda9279dSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1988fda9279dSmrgfi
1989fda9279dSmrg
1990fda9279dSmrgfound="no"
1991fda9279dSmrgm4_foreach([flag], m4_cdr($@), [
1992fda9279dSmrg	if test $found = "no" ; then
199316ee1e9aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
1994fda9279dSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1995fda9279dSmrg		fi
1996fda9279dSmrg
199716ee1e9aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
1998fda9279dSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1999fda9279dSmrg		fi
2000fda9279dSmrg
2001fda9279dSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2002fda9279dSmrg
2003fda9279dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
200416ee1e9aSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2005fda9279dSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2006fda9279dSmrg		AC_CACHE_VAL($cacheid,
2007fda9279dSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2008fda9279dSmrg					     [eval $cacheid=yes],
2009fda9279dSmrg					     [eval $cacheid=no])])
2010fda9279dSmrg
2011fda9279dSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2012fda9279dSmrg
2013fda9279dSmrg		eval supported=\$$cacheid
2014fda9279dSmrg		AC_MSG_RESULT([$supported])
2015fda9279dSmrg		if test "$supported" = "yes" ; then
2016fda9279dSmrg			$1="$$1 ]flag["
2017fda9279dSmrg			found="yes"
2018fda9279dSmrg		fi
2019fda9279dSmrg	fi
2020fda9279dSmrg])
2021fda9279dSmrg]) # XORG_TESTSET_CFLAG
2022fda9279dSmrg
2023fda9279dSmrg# XORG_COMPILER_FLAGS
2024fda9279dSmrg# ---------------
2025fda9279dSmrg# Minimum version: 1.16.0
2026fda9279dSmrg#
2027fda9279dSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2028fda9279dSmrg# arguments supported by the selected compiler which do NOT alter the generated
2029fda9279dSmrg# code.  These arguments will cause the compiler to print various warnings
2030fda9279dSmrg# during compilation AND turn a conservative set of warnings into errors.
2031fda9279dSmrg#
2032fda9279dSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2033fda9279dSmrg# future versions of util-macros as options are added to new compilers.
2034fda9279dSmrg#
2035fda9279dSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2036fda9279dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2037fda9279dSmrg
2038fda9279dSmrgAC_ARG_ENABLE(selective-werror,
2039fda9279dSmrg              AS_HELP_STRING([--disable-selective-werror],
2040fda9279dSmrg                             [Turn off selective compiler errors. (default: enabled)]),
2041fda9279dSmrg              [SELECTIVE_WERROR=$enableval],
2042fda9279dSmrg              [SELECTIVE_WERROR=yes])
2043fda9279dSmrg
2044fda9279dSmrgAC_LANG_CASE(
2045fda9279dSmrg        [C], [
2046fda9279dSmrg                define([PREFIX], [C])
2047fda9279dSmrg        ],
2048fda9279dSmrg        [C++], [
2049fda9279dSmrg                define([PREFIX], [CXX])
2050fda9279dSmrg        ]
2051fda9279dSmrg)
2052fda9279dSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2053fda9279dSmrgif test "x$SUNCC" = "xyes"; then
2054fda9279dSmrg    [BASE_]PREFIX[FLAGS]="-v"
2055fda9279dSmrgelse
2056fda9279dSmrg    [BASE_]PREFIX[FLAGS]=""
2057fda9279dSmrgfi
2058fda9279dSmrg
2059fda9279dSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2060fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2061fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2062fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2063fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2064fda9279dSmrg
2065fda9279dSmrgAC_LANG_CASE(
2066fda9279dSmrg	[C], [
2067fda9279dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2068fda9279dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2069fda9279dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2070fda9279dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
207116ee1e9aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2072fda9279dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2073fda9279dSmrg	]
2074fda9279dSmrg)
2075fda9279dSmrg
2076fda9279dSmrg# This chunk adds additional warnings that could catch undesired effects.
2077fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2078fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2079fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2080fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2081fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2082fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
208316ee1e9aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2084fda9279dSmrg
2085fda9279dSmrg# These are currently disabled because they are noisy.  They will be enabled
2086fda9279dSmrg# in the future once the codebase is sufficiently modernized to silence
2087fda9279dSmrg# them.  For now, I don't want them to drown out the other warnings.
2088fda9279dSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2089fda9279dSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
209016ee1e9aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2091fda9279dSmrg
209233adc6acSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
2093fda9279dSmrg# when there are problems that should be fixed.
2094fda9279dSmrg
2095fda9279dSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2096fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2097fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2098fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2099fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2100fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2101fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2102fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2103fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2104fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2105fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2106fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2107fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2108fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2109fda9279dSmrgelse
2110fda9279dSmrgAC_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])
2111fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2112fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2113fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2114fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2115fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2116fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2117fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2118fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2119fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2120fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2121fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2122fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2123fda9279dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2124fda9279dSmrgfi
2125fda9279dSmrg
2126fda9279dSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2127fda9279dSmrg]) # XORG_COMPILER_FLAGS
2128fda9279dSmrg
2129fda9279dSmrg# XORG_CWARNFLAGS
2130fda9279dSmrg# ---------------
2131fda9279dSmrg# Minimum version: 1.2.0
2132fda9279dSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2133fda9279dSmrg#
2134fda9279dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2135fda9279dSmrg#
2136fda9279dSmrg# This function is deprecated because it defines -fno-strict-aliasing
2137fda9279dSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2138fda9279dSmrg# is needed, then it should be added explicitly in the module when
2139fda9279dSmrg# it is updated to use BASE_CFLAGS.
2140fda9279dSmrg#
2141fda9279dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2142fda9279dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2143fda9279dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2144fda9279dSmrgAC_LANG_CASE(
2145fda9279dSmrg	[C], [
2146fda9279dSmrg		CWARNFLAGS="$BASE_CFLAGS"
2147fda9279dSmrg		if  test "x$GCC" = xyes ; then
2148fda9279dSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2149fda9279dSmrg		fi
2150fda9279dSmrg		AC_SUBST(CWARNFLAGS)
2151fda9279dSmrg	]
2152fda9279dSmrg)
2153fda9279dSmrg]) # XORG_CWARNFLAGS
2154fda9279dSmrg
2155fda9279dSmrg# XORG_STRICT_OPTION
2156fda9279dSmrg# -----------------------
2157fda9279dSmrg# Minimum version: 1.3.0
2158fda9279dSmrg#
2159fda9279dSmrg# Add configure option to enable strict compilation flags, such as treating
2160fda9279dSmrg# warnings as fatal errors.
2161fda9279dSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2162fda9279dSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2163fda9279dSmrg#
2164fda9279dSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2165fda9279dSmrg# when strict compilation is unconditionally desired.
2166fda9279dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2167fda9279dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2168fda9279dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2169fda9279dSmrg
2170fda9279dSmrgAC_ARG_ENABLE(strict-compilation,
2171fda9279dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2172fda9279dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2173fda9279dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2174fda9279dSmrg
2175fda9279dSmrgAC_LANG_CASE(
2176fda9279dSmrg        [C], [
2177fda9279dSmrg                define([PREFIX], [C])
2178fda9279dSmrg        ],
2179fda9279dSmrg        [C++], [
2180fda9279dSmrg                define([PREFIX], [CXX])
2181fda9279dSmrg        ]
2182fda9279dSmrg)
2183fda9279dSmrg
2184fda9279dSmrg[STRICT_]PREFIX[FLAGS]=""
2185fda9279dSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2186fda9279dSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2187fda9279dSmrg
2188fda9279dSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2189fda9279dSmrg# activate it with -Werror, so we add it here explicitly.
2190fda9279dSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2191fda9279dSmrg
2192fda9279dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2193fda9279dSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2194fda9279dSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2195fda9279dSmrgfi
2196fda9279dSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2197fda9279dSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2198fda9279dSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2199fda9279dSmrg]) # XORG_STRICT_OPTION
2200fda9279dSmrg
220133adc6acSmrg# XORG_DEFAULT_NOCODE_OPTIONS
220233adc6acSmrg# ---------------------------
220333adc6acSmrg# Minimum version: 1.20.0
220433adc6acSmrg#
220533adc6acSmrg# Defines default options for X.Org modules which don't compile code,
220633adc6acSmrg# such as fonts, bitmaps, cursors, and docs.
220733adc6acSmrg#
220833adc6acSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
220933adc6acSmrgAC_REQUIRE([AC_PROG_INSTALL])
221033adc6acSmrgXORG_RELEASE_VERSION
221133adc6acSmrgXORG_CHANGELOG
221233adc6acSmrgXORG_INSTALL
221333adc6acSmrgXORG_MANPAGE_SECTIONS
221433adc6acSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
221533adc6acSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
221633adc6acSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
221733adc6acSmrg
2218fda9279dSmrg# XORG_DEFAULT_OPTIONS
2219fda9279dSmrg# --------------------
2220fda9279dSmrg# Minimum version: 1.3.0
2221fda9279dSmrg#
222233adc6acSmrg# Defines default options for X.Org modules which compile code.
2223fda9279dSmrg#
2224fda9279dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2225fda9279dSmrgAC_REQUIRE([AC_PROG_INSTALL])
2226fda9279dSmrgXORG_COMPILER_FLAGS
2227fda9279dSmrgXORG_CWARNFLAGS
2228fda9279dSmrgXORG_STRICT_OPTION
222933adc6acSmrgXORG_DEFAULT_NOCODE_OPTIONS
2230fda9279dSmrg]) # XORG_DEFAULT_OPTIONS
2231fda9279dSmrg
2232fda9279dSmrg# XORG_INSTALL()
2233fda9279dSmrg# ----------------
2234fda9279dSmrg# Minimum version: 1.4.0
2235fda9279dSmrg#
2236fda9279dSmrg# Defines the variable INSTALL_CMD as the command to copy
2237fda9279dSmrg# INSTALL from $prefix/share/util-macros.
2238fda9279dSmrg#
2239fda9279dSmrgAC_DEFUN([XORG_INSTALL], [
2240fda9279dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2241fda9279dSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2242fda9279dSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2243fda9279dSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2244dd52494dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
2245dd52494dSmrgtouch \$(top_srcdir)/INSTALL; \
2246dd52494dSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
2247fda9279dSmrgAC_SUBST([INSTALL_CMD])
2248fda9279dSmrg]) # XORG_INSTALL
2249fda9279dSmrgdnl Copyright 2005 Red Hat, Inc
2250fda9279dSmrgdnl
2251fda9279dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2252fda9279dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2253fda9279dSmrgdnl the above copyright notice appear in all copies and that both that
2254fda9279dSmrgdnl copyright notice and this permission notice appear in supporting
2255fda9279dSmrgdnl documentation.
2256fda9279dSmrgdnl
2257fda9279dSmrgdnl The above copyright notice and this permission notice shall be included
2258fda9279dSmrgdnl in all copies or substantial portions of the Software.
2259fda9279dSmrgdnl
2260fda9279dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2261fda9279dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2262fda9279dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2263fda9279dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2264fda9279dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2265fda9279dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2266fda9279dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2267fda9279dSmrgdnl
2268fda9279dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2269fda9279dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2270fda9279dSmrgdnl other dealings in this Software without prior written authorization
2271fda9279dSmrgdnl from the copyright holders.
2272fda9279dSmrgdnl
2273fda9279dSmrg
2274fda9279dSmrg# XORG_RELEASE_VERSION
2275fda9279dSmrg# --------------------
2276fda9279dSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
227716ee1e9aSmrg
2278fda9279dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2279fda9279dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2280fda9279dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2281fda9279dSmrg		[Major version of this package])
2282fda9279dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2283fda9279dSmrg	if test "x$PVM" = "x"; then
2284fda9279dSmrg		PVM="0"
2285fda9279dSmrg	fi
2286fda9279dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2287fda9279dSmrg		[$PVM],
2288fda9279dSmrg		[Minor version of this package])
2289fda9279dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2290fda9279dSmrg	if test "x$PVP" = "x"; then
2291fda9279dSmrg		PVP="0"
2292fda9279dSmrg	fi
2293fda9279dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2294fda9279dSmrg		[$PVP],
2295fda9279dSmrg		[Patch version of this package])
2296fda9279dSmrg])
2297fda9279dSmrg
2298fda9279dSmrg# XORG_CHANGELOG()
2299fda9279dSmrg# ----------------
2300fda9279dSmrg# Minimum version: 1.2.0
2301fda9279dSmrg#
2302fda9279dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2303fda9279dSmrg# ChangeLog from git.
2304fda9279dSmrg#
2305fda9279dSmrg#
2306fda9279dSmrgAC_DEFUN([XORG_CHANGELOG], [
2307dd52494dSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
2308fda9279dSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2309dd52494dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
2310dd52494dSmrgtouch \$(top_srcdir)/ChangeLog; \
2311dd52494dSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
2312fda9279dSmrgAC_SUBST([CHANGELOG_CMD])
2313fda9279dSmrg]) # XORG_CHANGELOG
2314fda9279dSmrg
2315fda9279dSmrgdnl Copyright 2005 Red Hat, Inc
2316fda9279dSmrgdnl 
2317fda9279dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2318fda9279dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2319fda9279dSmrgdnl the above copyright notice appear in all copies and that both that
2320fda9279dSmrgdnl copyright notice and this permission notice appear in supporting
2321fda9279dSmrgdnl documentation.
2322fda9279dSmrgdnl 
2323fda9279dSmrgdnl The above copyright notice and this permission notice shall be included
2324fda9279dSmrgdnl in all copies or substantial portions of the Software.
2325fda9279dSmrgdnl 
2326fda9279dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2327fda9279dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2328fda9279dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2329fda9279dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2330fda9279dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2331fda9279dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2332fda9279dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2333fda9279dSmrgdnl 
2334fda9279dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2335fda9279dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2336fda9279dSmrgdnl other dealings in this Software without prior written authorization
2337fda9279dSmrgdnl from the copyright holders.
2338fda9279dSmrgdnl 
2339fda9279dSmrg
2340fda9279dSmrg# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2341fda9279dSmrg# --------------------------
2342fda9279dSmrg# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
2343fda9279dSmrg# is defined, then add the given PROTO to $REQUIRED_MODULES.
2344fda9279dSmrg
2345fda9279dSmrgAC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2346fda9279dSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2347fda9279dSmrg	SAVE_CFLAGS="$CFLAGS"
234833adc6acSmrg	CFLAGS="$CFLAGS `$PKG_CONFIG --cflags xorg-server`"
2349fda9279dSmrg	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2350fda9279dSmrg#include "xorg-server.h"
2351fda9279dSmrg#if !defined $1
2352fda9279dSmrg#error $1 not defined
2353fda9279dSmrg#endif
2354fda9279dSmrg		]])],
2355fda9279dSmrg		[_EXT_CHECK=yes],
2356fda9279dSmrg		[_EXT_CHECK=no])
2357fda9279dSmrg	CFLAGS="$SAVE_CFLAGS"
2358fda9279dSmrg	AC_MSG_CHECKING([if $1 is defined])
2359fda9279dSmrg	AC_MSG_RESULT([$_EXT_CHECK])
2360fda9279dSmrg	if test "$_EXT_CHECK" != no; then
2361fda9279dSmrg		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2362fda9279dSmrg	fi
2363fda9279dSmrg])
2364fda9279dSmrg
236533adc6acSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2366fda9279dSmrg#
2367fda9279dSmrg# This file is free software; the Free Software Foundation
2368fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2369fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2370fda9279dSmrg
2371fda9279dSmrg# AM_AUTOMAKE_VERSION(VERSION)
2372fda9279dSmrg# ----------------------------
2373fda9279dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2374fda9279dSmrg# generated from the m4 files accompanying Automake X.Y.
2375fda9279dSmrg# (This private macro should not be called outside this file.)
2376fda9279dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2377dd52494dSmrg[am__api_version='1.16'
2378fda9279dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2379fda9279dSmrgdnl require some minimum version.  Point them to the right macro.
238033adc6acSmrgm4_if([$1], [1.16.5], [],
2381fda9279dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2382fda9279dSmrg])
2383fda9279dSmrg
2384fda9279dSmrg# _AM_AUTOCONF_VERSION(VERSION)
2385fda9279dSmrg# -----------------------------
2386fda9279dSmrg# aclocal traces this macro to find the Autoconf version.
2387fda9279dSmrg# This is a private macro too.  Using m4_define simplifies
2388fda9279dSmrg# the logic in aclocal, which can simply ignore this definition.
2389fda9279dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
2390fda9279dSmrg
2391fda9279dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2392fda9279dSmrg# -------------------------------
2393fda9279dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2394fda9279dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2395fda9279dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
239633adc6acSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
2397fda9279dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
2398fda9279dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2399fda9279dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2400fda9279dSmrg
2401fda9279dSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2402fda9279dSmrg
240333adc6acSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2404fda9279dSmrg#
2405fda9279dSmrg# This file is free software; the Free Software Foundation
2406fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2407fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2408fda9279dSmrg
2409fda9279dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2410fda9279dSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2411fda9279dSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2412fda9279dSmrg#
2413fda9279dSmrg# Of course, Automake must honor this variable whenever it calls a
2414fda9279dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2415fda9279dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2416fda9279dSmrg# depending on how configure is run.  This is pretty annoying, since
2417fda9279dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2418fda9279dSmrg# source directory, any form will work fine, but in subdirectories a
2419fda9279dSmrg# relative path needs to be adjusted first.
2420fda9279dSmrg#
2421fda9279dSmrg# $ac_aux_dir/missing
2422fda9279dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2423fda9279dSmrg# $top_srcdir/$ac_aux_dir/missing
2424fda9279dSmrg#    fails if $ac_aux_dir is absolute,
2425fda9279dSmrg#    fails when called from a subdirectory in a VPATH build with
2426fda9279dSmrg#          a relative $ac_aux_dir
2427fda9279dSmrg#
2428fda9279dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2429fda9279dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
2430fda9279dSmrg# harmless because $srcdir is '.', but things will broke when you
2431fda9279dSmrg# start a VPATH build or use an absolute $srcdir.
2432fda9279dSmrg#
2433fda9279dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2434fda9279dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2435fda9279dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2436fda9279dSmrg# and then we would define $MISSING as
2437fda9279dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2438fda9279dSmrg# This will work as long as MISSING is not called from configure, because
2439fda9279dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
2440fda9279dSmrg# However there are other variables, like CC, which are often used in
2441fda9279dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2442fda9279dSmrg#
2443fda9279dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
2444fda9279dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
2445fda9279dSmrg# configured tree to be moved without reconfiguration.
2446fda9279dSmrg
2447fda9279dSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
244816ee1e9aSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
244916ee1e9aSmrg# Expand $ac_aux_dir to an absolute path.
245016ee1e9aSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
2451fda9279dSmrg])
2452fda9279dSmrg
2453fda9279dSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2454fda9279dSmrg
245533adc6acSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
2456fda9279dSmrg#
2457fda9279dSmrg# This file is free software; the Free Software Foundation
2458fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2459fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2460fda9279dSmrg
2461fda9279dSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2462fda9279dSmrg# -------------------------------------
2463fda9279dSmrg# Define a conditional.
2464fda9279dSmrgAC_DEFUN([AM_CONDITIONAL],
2465fda9279dSmrg[AC_PREREQ([2.52])dnl
2466fda9279dSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2467fda9279dSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2468fda9279dSmrgAC_SUBST([$1_TRUE])dnl
2469fda9279dSmrgAC_SUBST([$1_FALSE])dnl
2470fda9279dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2471fda9279dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2472fda9279dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2473fda9279dSmrgif $2; then
2474fda9279dSmrg  $1_TRUE=
2475fda9279dSmrg  $1_FALSE='#'
2476fda9279dSmrgelse
2477fda9279dSmrg  $1_TRUE='#'
2478fda9279dSmrg  $1_FALSE=
2479fda9279dSmrgfi
2480fda9279dSmrgAC_CONFIG_COMMANDS_PRE(
2481fda9279dSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2482fda9279dSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2483fda9279dSmrgUsually this means the macro was only invoked conditionally.]])
2484fda9279dSmrgfi])])
2485fda9279dSmrg
248633adc6acSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2487fda9279dSmrg#
2488fda9279dSmrg# This file is free software; the Free Software Foundation
2489fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2490fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2491fda9279dSmrg
2492fda9279dSmrg
2493fda9279dSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2494fda9279dSmrg# written in clear, in which case automake, when reading aclocal.m4,
2495fda9279dSmrg# will think it sees a *use*, and therefore will trigger all it's
2496fda9279dSmrg# C support machinery.  Also note that it means that autoscan, seeing
2497fda9279dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2498fda9279dSmrg
2499fda9279dSmrg
2500fda9279dSmrg# _AM_DEPENDENCIES(NAME)
2501fda9279dSmrg# ----------------------
2502fda9279dSmrg# See how the compiler implements dependency checking.
2503fda9279dSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2504fda9279dSmrg# We try a few techniques and use that to set a single cache variable.
2505fda9279dSmrg#
2506fda9279dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2507fda9279dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2508fda9279dSmrg# dependency, and given that the user is not expected to run this macro,
2509fda9279dSmrg# just rely on AC_PROG_CC.
2510fda9279dSmrgAC_DEFUN([_AM_DEPENDENCIES],
2511fda9279dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2512fda9279dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2513fda9279dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2514fda9279dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2515fda9279dSmrg
2516fda9279dSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2517fda9279dSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2518fda9279dSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2519fda9279dSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2520fda9279dSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2521fda9279dSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2522fda9279dSmrg                    [depcc="$$1"   am_compiler_list=])
2523fda9279dSmrg
2524fda9279dSmrgAC_CACHE_CHECK([dependency style of $depcc],
2525fda9279dSmrg               [am_cv_$1_dependencies_compiler_type],
2526fda9279dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2527fda9279dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
2528fda9279dSmrg  # making bogus files that we don't know about and never remove.  For
2529fda9279dSmrg  # instance it was reported that on HP-UX the gcc test will end up
2530fda9279dSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
2531fda9279dSmrg  # in D".
2532fda9279dSmrg  rm -rf conftest.dir
2533fda9279dSmrg  mkdir conftest.dir
2534fda9279dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2535fda9279dSmrg  # using a relative directory.
2536fda9279dSmrg  cp "$am_depcomp" conftest.dir
2537fda9279dSmrg  cd conftest.dir
2538fda9279dSmrg  # We will build objects and dependencies in a subdirectory because
2539fda9279dSmrg  # it helps to detect inapplicable dependency modes.  For instance
2540fda9279dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2541fda9279dSmrg  # side effect of compilation, but ICC will put the dependencies in
2542fda9279dSmrg  # the current directory while Tru64 will put them in the object
2543fda9279dSmrg  # directory.
2544fda9279dSmrg  mkdir sub
2545fda9279dSmrg
2546fda9279dSmrg  am_cv_$1_dependencies_compiler_type=none
2547fda9279dSmrg  if test "$am_compiler_list" = ""; then
2548fda9279dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2549fda9279dSmrg  fi
2550fda9279dSmrg  am__universal=false
2551fda9279dSmrg  m4_case([$1], [CC],
2552fda9279dSmrg    [case " $depcc " in #(
2553fda9279dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2554fda9279dSmrg     esac],
2555fda9279dSmrg    [CXX],
2556fda9279dSmrg    [case " $depcc " in #(
2557fda9279dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2558fda9279dSmrg     esac])
2559fda9279dSmrg
2560fda9279dSmrg  for depmode in $am_compiler_list; do
2561fda9279dSmrg    # Setup a source with many dependencies, because some compilers
2562fda9279dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2563fda9279dSmrg    # we should not choose a depcomp mode which is confused by this.
2564fda9279dSmrg    #
2565fda9279dSmrg    # We need to recreate these files for each test, as the compiler may
2566fda9279dSmrg    # overwrite some of them when testing with obscure command lines.
2567fda9279dSmrg    # This happens at least with the AIX C compiler.
2568fda9279dSmrg    : > sub/conftest.c
2569fda9279dSmrg    for i in 1 2 3 4 5 6; do
2570fda9279dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2571fda9279dSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2572fda9279dSmrg      # Solaris 10 /bin/sh.
2573fda9279dSmrg      echo '/* dummy */' > sub/conftst$i.h
2574fda9279dSmrg    done
2575fda9279dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2576fda9279dSmrg
2577fda9279dSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2578fda9279dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2579fda9279dSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2580fda9279dSmrg    # versions had trouble with output in subdirs.
2581fda9279dSmrg    am__obj=sub/conftest.${OBJEXT-o}
2582fda9279dSmrg    am__minus_obj="-o $am__obj"
2583fda9279dSmrg    case $depmode in
2584fda9279dSmrg    gcc)
2585fda9279dSmrg      # This depmode causes a compiler race in universal mode.
2586fda9279dSmrg      test "$am__universal" = false || continue
2587fda9279dSmrg      ;;
2588fda9279dSmrg    nosideeffect)
2589fda9279dSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2590fda9279dSmrg      # only be used when explicitly requested.
2591fda9279dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2592fda9279dSmrg	continue
2593fda9279dSmrg      else
2594fda9279dSmrg	break
2595fda9279dSmrg      fi
2596fda9279dSmrg      ;;
2597fda9279dSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2598fda9279dSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2599fda9279dSmrg      # not run yet.  These depmodes are late enough in the game, and
2600fda9279dSmrg      # so weak that their functioning should not be impacted.
2601fda9279dSmrg      am__obj=conftest.${OBJEXT-o}
2602fda9279dSmrg      am__minus_obj=
2603fda9279dSmrg      ;;
2604fda9279dSmrg    none) break ;;
2605fda9279dSmrg    esac
2606fda9279dSmrg    if depmode=$depmode \
2607fda9279dSmrg       source=sub/conftest.c object=$am__obj \
2608fda9279dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2609fda9279dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2610fda9279dSmrg         >/dev/null 2>conftest.err &&
2611fda9279dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2612fda9279dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2613fda9279dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2614fda9279dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2615fda9279dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2616fda9279dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2617fda9279dSmrg      # that says an option was ignored or not supported.
2618fda9279dSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2619fda9279dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2620fda9279dSmrg      # The diagnosis changed in icc 8.0:
2621fda9279dSmrg      #   icc: Command line remark: option '-MP' not supported
2622fda9279dSmrg      if (grep 'ignoring option' conftest.err ||
2623fda9279dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2624fda9279dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2625fda9279dSmrg        break
2626fda9279dSmrg      fi
2627fda9279dSmrg    fi
2628fda9279dSmrg  done
2629fda9279dSmrg
2630fda9279dSmrg  cd ..
2631fda9279dSmrg  rm -rf conftest.dir
2632fda9279dSmrgelse
2633fda9279dSmrg  am_cv_$1_dependencies_compiler_type=none
2634fda9279dSmrgfi
2635fda9279dSmrg])
2636fda9279dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2637fda9279dSmrgAM_CONDITIONAL([am__fastdep$1], [
2638fda9279dSmrg  test "x$enable_dependency_tracking" != xno \
2639fda9279dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2640fda9279dSmrg])
2641fda9279dSmrg
2642fda9279dSmrg
2643fda9279dSmrg# AM_SET_DEPDIR
2644fda9279dSmrg# -------------
2645fda9279dSmrg# Choose a directory name for dependency files.
2646fda9279dSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2647fda9279dSmrgAC_DEFUN([AM_SET_DEPDIR],
2648fda9279dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2649fda9279dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2650fda9279dSmrg])
2651fda9279dSmrg
2652fda9279dSmrg
2653fda9279dSmrg# AM_DEP_TRACK
2654fda9279dSmrg# ------------
2655fda9279dSmrgAC_DEFUN([AM_DEP_TRACK],
2656fda9279dSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
2657fda9279dSmrgAS_HELP_STRING(
2658fda9279dSmrg  [--enable-dependency-tracking],
2659fda9279dSmrg  [do not reject slow dependency extractors])
2660fda9279dSmrgAS_HELP_STRING(
2661fda9279dSmrg  [--disable-dependency-tracking],
2662fda9279dSmrg  [speeds up one-time build])])
2663fda9279dSmrgif test "x$enable_dependency_tracking" != xno; then
2664fda9279dSmrg  am_depcomp="$ac_aux_dir/depcomp"
2665fda9279dSmrg  AMDEPBACKSLASH='\'
2666fda9279dSmrg  am__nodep='_no'
2667fda9279dSmrgfi
2668fda9279dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2669fda9279dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
2670fda9279dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2671fda9279dSmrgAC_SUBST([am__nodep])dnl
2672fda9279dSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2673fda9279dSmrg])
2674fda9279dSmrg
2675fda9279dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2676fda9279dSmrg
267733adc6acSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2678fda9279dSmrg#
2679fda9279dSmrg# This file is free software; the Free Software Foundation
2680fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2681fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2682fda9279dSmrg
2683fda9279dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2684fda9279dSmrg# ------------------------------
2685fda9279dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2686fda9279dSmrg[{
2687fda9279dSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
2688fda9279dSmrg  # are listed without --file.  Let's play safe and only enable the eval
2689fda9279dSmrg  # if we detect the quoting.
2690dd52494dSmrg  # TODO: see whether this extra hack can be removed once we start
2691dd52494dSmrg  # requiring Autoconf 2.70 or later.
2692dd52494dSmrg  AS_CASE([$CONFIG_FILES],
2693dd52494dSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
2694dd52494dSmrg          [*], [set x $CONFIG_FILES])
2695fda9279dSmrg  shift
2696dd52494dSmrg  # Used to flag and report bootstrapping failures.
2697dd52494dSmrg  am_rc=0
2698dd52494dSmrg  for am_mf
2699fda9279dSmrg  do
2700fda9279dSmrg    # Strip MF so we end up with the name of the file.
2701dd52494dSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2702dd52494dSmrg    # Check whether this is an Automake generated Makefile which includes
2703dd52494dSmrg    # dependency-tracking related rules and includes.
2704dd52494dSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
2705fda9279dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
2706dd52494dSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2707dd52494dSmrg      || continue
2708dd52494dSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2709dd52494dSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
2710dd52494dSmrg    AM_RUN_LOG([cd "$am_dirpart" \
2711dd52494dSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
2712dd52494dSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
2713fda9279dSmrg  done
2714dd52494dSmrg  if test $am_rc -ne 0; then
2715dd52494dSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
271692405695Smrg    for automatic dependency tracking.  If GNU make was not used, consider
271792405695Smrg    re-running the configure script with MAKE="gmake" (or whatever is
271892405695Smrg    necessary).  You can also try re-running configure with the
2719dd52494dSmrg    '--disable-dependency-tracking' option to at least be able to build
2720dd52494dSmrg    the package (albeit without support for automatic dependency tracking).])
2721dd52494dSmrg  fi
2722dd52494dSmrg  AS_UNSET([am_dirpart])
2723dd52494dSmrg  AS_UNSET([am_filepart])
2724dd52494dSmrg  AS_UNSET([am_mf])
2725dd52494dSmrg  AS_UNSET([am_rc])
2726dd52494dSmrg  rm -f conftest-deps.mk
2727fda9279dSmrg}
2728fda9279dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2729fda9279dSmrg
2730fda9279dSmrg
2731fda9279dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2732fda9279dSmrg# -----------------------------
2733fda9279dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2734fda9279dSmrg#
2735dd52494dSmrg# This code is only required when automatic dependency tracking is enabled.
2736dd52494dSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2737dd52494dSmrg# order to bootstrap the dependency handling code.
2738fda9279dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2739fda9279dSmrg[AC_CONFIG_COMMANDS([depfiles],
2740fda9279dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2741dd52494dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2742fda9279dSmrg
2743fda9279dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
2744fda9279dSmrg
274533adc6acSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
2746fda9279dSmrg#
2747fda9279dSmrg# This file is free software; the Free Software Foundation
2748fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2749fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2750fda9279dSmrg
2751fda9279dSmrg# This macro actually does too much.  Some checks are only needed if
2752fda9279dSmrg# your package does certain things.  But this isn't really a big deal.
2753fda9279dSmrg
2754fda9279dSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2755fda9279dSmrgm4_define([AC_PROG_CC],
2756fda9279dSmrgm4_defn([AC_PROG_CC])
2757fda9279dSmrg[_AM_PROG_CC_C_O
2758fda9279dSmrg])
2759fda9279dSmrg
2760fda9279dSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2761fda9279dSmrg# AM_INIT_AUTOMAKE([OPTIONS])
2762fda9279dSmrg# -----------------------------------------------
2763fda9279dSmrg# The call with PACKAGE and VERSION arguments is the old style
2764fda9279dSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2765fda9279dSmrg# and VERSION should now be passed to AC_INIT and removed from
2766fda9279dSmrg# the call to AM_INIT_AUTOMAKE.
2767fda9279dSmrg# We support both call styles for the transition.  After
2768fda9279dSmrg# the next Automake release, Autoconf can make the AC_INIT
2769fda9279dSmrg# arguments mandatory, and then we can depend on a new Autoconf
2770fda9279dSmrg# release and drop the old call support.
2771fda9279dSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
2772fda9279dSmrg[AC_PREREQ([2.65])dnl
277333adc6acSmrgm4_ifdef([_$0_ALREADY_INIT],
277433adc6acSmrg  [m4_fatal([$0 expanded multiple times
277533adc6acSmrg]m4_defn([_$0_ALREADY_INIT]))],
277633adc6acSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
2777fda9279dSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2778fda9279dSmrgdnl the ones we care about.
2779fda9279dSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2780fda9279dSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2781fda9279dSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2782fda9279dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2783fda9279dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2784fda9279dSmrg  # is not polluted with repeated "-I."
2785fda9279dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2786fda9279dSmrg  # test to see if srcdir already configured
2787fda9279dSmrg  if test -f $srcdir/config.status; then
2788fda9279dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2789fda9279dSmrg  fi
2790fda9279dSmrgfi
2791fda9279dSmrg
2792fda9279dSmrg# test whether we have cygpath
2793fda9279dSmrgif test -z "$CYGPATH_W"; then
2794fda9279dSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2795fda9279dSmrg    CYGPATH_W='cygpath -w'
2796fda9279dSmrg  else
2797fda9279dSmrg    CYGPATH_W=echo
2798fda9279dSmrg  fi
2799fda9279dSmrgfi
2800fda9279dSmrgAC_SUBST([CYGPATH_W])
2801fda9279dSmrg
2802fda9279dSmrg# Define the identity of the package.
2803fda9279dSmrgdnl Distinguish between old-style and new-style calls.
2804fda9279dSmrgm4_ifval([$2],
2805fda9279dSmrg[AC_DIAGNOSE([obsolete],
2806fda9279dSmrg             [$0: two- and three-arguments forms are deprecated.])
2807fda9279dSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2808fda9279dSmrg AC_SUBST([PACKAGE], [$1])dnl
2809fda9279dSmrg AC_SUBST([VERSION], [$2])],
2810fda9279dSmrg[_AM_SET_OPTIONS([$1])dnl
2811fda9279dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2812fda9279dSmrgm4_if(
281333adc6acSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
2814fda9279dSmrg  [ok:ok],,
2815fda9279dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2816fda9279dSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2817fda9279dSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2818fda9279dSmrg
2819fda9279dSmrg_AM_IF_OPTION([no-define],,
2820fda9279dSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2821fda9279dSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2822fda9279dSmrg
2823fda9279dSmrg# Some tools Automake needs.
2824fda9279dSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2825fda9279dSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2826fda9279dSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2827fda9279dSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2828fda9279dSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2829fda9279dSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2830fda9279dSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2831fda9279dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2832fda9279dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2833fda9279dSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2834fda9279dSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
2835fda9279dSmrg# dies out for good.  For more background, see:
2836dd52494dSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2837dd52494dSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2838fda9279dSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
283916ee1e9aSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
284016ee1e9aSmrg# system "awk" is bad on some platforms.
2841fda9279dSmrgAC_REQUIRE([AC_PROG_AWK])dnl
2842fda9279dSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2843fda9279dSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2844fda9279dSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2845fda9279dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2846fda9279dSmrg			     [_AM_PROG_TAR([v7])])])
2847fda9279dSmrg_AM_IF_OPTION([no-dependencies],,
2848fda9279dSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2849fda9279dSmrg		  [_AM_DEPENDENCIES([CC])],
2850fda9279dSmrg		  [m4_define([AC_PROG_CC],
2851fda9279dSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2852fda9279dSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2853fda9279dSmrg		  [_AM_DEPENDENCIES([CXX])],
2854fda9279dSmrg		  [m4_define([AC_PROG_CXX],
2855fda9279dSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2856fda9279dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2857fda9279dSmrg		  [_AM_DEPENDENCIES([OBJC])],
2858fda9279dSmrg		  [m4_define([AC_PROG_OBJC],
2859fda9279dSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2860fda9279dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2861fda9279dSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
2862fda9279dSmrg		  [m4_define([AC_PROG_OBJCXX],
2863fda9279dSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2864fda9279dSmrg])
286533adc6acSmrg# Variables for tags utilities; see am/tags.am
286633adc6acSmrgif test -z "$CTAGS"; then
286733adc6acSmrg  CTAGS=ctags
286833adc6acSmrgfi
286933adc6acSmrgAC_SUBST([CTAGS])
287033adc6acSmrgif test -z "$ETAGS"; then
287133adc6acSmrg  ETAGS=etags
287233adc6acSmrgfi
287333adc6acSmrgAC_SUBST([ETAGS])
287433adc6acSmrgif test -z "$CSCOPE"; then
287533adc6acSmrg  CSCOPE=cscope
287633adc6acSmrgfi
287733adc6acSmrgAC_SUBST([CSCOPE])
287833adc6acSmrg
2879fda9279dSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2880fda9279dSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
2881fda9279dSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2882fda9279dSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2883fda9279dSmrgAC_CONFIG_COMMANDS_PRE(dnl
2884fda9279dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2885fda9279dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2886fda9279dSmrg
2887fda9279dSmrg# POSIX will say in a future version that running "rm -f" with no argument
2888fda9279dSmrg# is OK; and we want to be able to make that assumption in our Makefile
2889fda9279dSmrg# recipes.  So use an aggressive probe to check that the usage we want is
2890fda9279dSmrg# actually supported "in the wild" to an acceptable degree.
2891fda9279dSmrg# See automake bug#10828.
2892fda9279dSmrg# To make any issue more visible, cause the running configure to be aborted
2893fda9279dSmrg# by default if the 'rm' program in use doesn't match our expectations; the
2894fda9279dSmrg# user can still override this though.
2895fda9279dSmrgif rm -f && rm -fr && rm -rf; then : OK; else
2896fda9279dSmrg  cat >&2 <<'END'
2897fda9279dSmrgOops!
2898fda9279dSmrg
2899fda9279dSmrgYour 'rm' program seems unable to run without file operands specified
2900fda9279dSmrgon the command line, even when the '-f' option is present.  This is contrary
2901fda9279dSmrgto the behaviour of most rm programs out there, and not conforming with
2902fda9279dSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2903fda9279dSmrg
2904fda9279dSmrgPlease tell bug-automake@gnu.org about your system, including the value
2905fda9279dSmrgof your $PATH and any error possibly output before this message.  This
2906fda9279dSmrgcan help us improve future automake versions.
2907fda9279dSmrg
2908fda9279dSmrgEND
2909fda9279dSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2910fda9279dSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2911fda9279dSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2912fda9279dSmrg    echo >&2
2913fda9279dSmrg  else
2914fda9279dSmrg    cat >&2 <<'END'
2915fda9279dSmrgAborting the configuration process, to ensure you take notice of the issue.
2916fda9279dSmrg
2917fda9279dSmrgYou can download and install GNU coreutils to get an 'rm' implementation
2918dd52494dSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2919fda9279dSmrg
2920fda9279dSmrgIf you want to complete the configuration process using your problematic
2921fda9279dSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2922fda9279dSmrgto "yes", and re-run configure.
2923fda9279dSmrg
2924fda9279dSmrgEND
2925fda9279dSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2926fda9279dSmrg  fi
292716ee1e9aSmrgfi
292816ee1e9aSmrgdnl The trailing newline in this macro's definition is deliberate, for
292916ee1e9aSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
293016ee1e9aSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
293116ee1e9aSmrg])
2932fda9279dSmrg
2933fda9279dSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2934fda9279dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2935fda9279dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
2936fda9279dSmrgm4_define([_AC_COMPILER_EXEEXT],
2937fda9279dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2938fda9279dSmrg
2939fda9279dSmrg# When config.status generates a header, we must update the stamp-h file.
2940fda9279dSmrg# This file resides in the same directory as the config header
2941fda9279dSmrg# that is generated.  The stamp files are numbered to have different names.
2942fda9279dSmrg
2943fda9279dSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2944fda9279dSmrg# loop where config.status creates the headers, so we can generate
2945fda9279dSmrg# our stamp files there.
2946fda9279dSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2947fda9279dSmrg[# Compute $1's index in $config_headers.
2948fda9279dSmrg_am_arg=$1
2949fda9279dSmrg_am_stamp_count=1
2950fda9279dSmrgfor _am_header in $config_headers :; do
2951fda9279dSmrg  case $_am_header in
2952fda9279dSmrg    $_am_arg | $_am_arg:* )
2953fda9279dSmrg      break ;;
2954fda9279dSmrg    * )
2955fda9279dSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2956fda9279dSmrg  esac
2957fda9279dSmrgdone
2958fda9279dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2959fda9279dSmrg
296033adc6acSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2961fda9279dSmrg#
2962fda9279dSmrg# This file is free software; the Free Software Foundation
2963fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2964fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2965fda9279dSmrg
2966fda9279dSmrg# AM_PROG_INSTALL_SH
2967fda9279dSmrg# ------------------
2968fda9279dSmrg# Define $install_sh.
2969fda9279dSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2970fda9279dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
297116ee1e9aSmrgif test x"${install_sh+set}" != xset; then
2972fda9279dSmrg  case $am_aux_dir in
2973fda9279dSmrg  *\ * | *\	*)
2974fda9279dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2975fda9279dSmrg  *)
2976fda9279dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2977fda9279dSmrg  esac
2978fda9279dSmrgfi
2979fda9279dSmrgAC_SUBST([install_sh])])
2980fda9279dSmrg
298133adc6acSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
2982fda9279dSmrg#
2983fda9279dSmrg# This file is free software; the Free Software Foundation
2984fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
2985fda9279dSmrg# with or without modifications, as long as this notice is preserved.
2986fda9279dSmrg
2987fda9279dSmrg# Check whether the underlying file-system supports filenames
2988fda9279dSmrg# with a leading dot.  For instance MS-DOS doesn't.
2989fda9279dSmrgAC_DEFUN([AM_SET_LEADING_DOT],
2990fda9279dSmrg[rm -rf .tst 2>/dev/null
2991fda9279dSmrgmkdir .tst 2>/dev/null
2992fda9279dSmrgif test -d .tst; then
2993fda9279dSmrg  am__leading_dot=.
2994fda9279dSmrgelse
2995fda9279dSmrg  am__leading_dot=_
2996fda9279dSmrgfi
2997fda9279dSmrgrmdir .tst 2>/dev/null
2998fda9279dSmrgAC_SUBST([am__leading_dot])])
2999fda9279dSmrg
3000fda9279dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
3001fda9279dSmrg
300233adc6acSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3003fda9279dSmrg#
3004fda9279dSmrg# This file is free software; the Free Software Foundation
3005fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3006fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3007fda9279dSmrg
3008fda9279dSmrg# AM_MAKE_INCLUDE()
3009fda9279dSmrg# -----------------
3010dd52494dSmrg# Check whether make has an 'include' directive that can support all
3011dd52494dSmrg# the idioms we need for our automatic dependency tracking code.
3012fda9279dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
3013dd52494dSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
3014dd52494dSmrgcat > confinc.mk << 'END'
3015fda9279dSmrgam__doit:
3016dd52494dSmrg	@echo this is the am__doit target >confinc.out
3017fda9279dSmrg.PHONY: am__doit
3018fda9279dSmrgEND
3019fda9279dSmrgam__include="#"
3020fda9279dSmrgam__quote=
3021dd52494dSmrg# BSD make does it like this.
3022dd52494dSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
3023dd52494dSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
3024dd52494dSmrgecho 'include confinc.mk # ignored' > confmf.GNU
3025dd52494dSmrg_am_result=no
3026dd52494dSmrgfor s in GNU BSD; do
3027dd52494dSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
3028dd52494dSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
3029dd52494dSmrg      ['0:this is the am__doit target'],
3030dd52494dSmrg      [AS_CASE([$s],
3031dd52494dSmrg          [BSD], [am__include='.include' am__quote='"'],
3032dd52494dSmrg          [am__include='include' am__quote=''])])
3033dd52494dSmrg  if test "$am__include" != "#"; then
3034dd52494dSmrg    _am_result="yes ($s style)"
3035dd52494dSmrg    break
3036dd52494dSmrg  fi
3037dd52494dSmrgdone
3038dd52494dSmrgrm -f confinc.* confmf.*
3039dd52494dSmrgAC_MSG_RESULT([${_am_result}])
3040dd52494dSmrgAC_SUBST([am__include])])
3041dd52494dSmrgAC_SUBST([am__quote])])
3042fda9279dSmrg
3043fda9279dSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
3044fda9279dSmrg
304533adc6acSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
3046fda9279dSmrg#
3047fda9279dSmrg# This file is free software; the Free Software Foundation
3048fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3049fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3050fda9279dSmrg
3051fda9279dSmrg# AM_MISSING_PROG(NAME, PROGRAM)
3052fda9279dSmrg# ------------------------------
3053fda9279dSmrgAC_DEFUN([AM_MISSING_PROG],
3054fda9279dSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
3055fda9279dSmrg$1=${$1-"${am_missing_run}$2"}
3056fda9279dSmrgAC_SUBST($1)])
3057fda9279dSmrg
3058fda9279dSmrg# AM_MISSING_HAS_RUN
3059fda9279dSmrg# ------------------
3060fda9279dSmrg# Define MISSING if not defined so far and test if it is modern enough.
3061fda9279dSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
3062fda9279dSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
3063fda9279dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3064fda9279dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
3065fda9279dSmrgif test x"${MISSING+set}" != xset; then
306633adc6acSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
3067fda9279dSmrgfi
3068fda9279dSmrg# Use eval to expand $SHELL
3069fda9279dSmrgif eval "$MISSING --is-lightweight"; then
3070fda9279dSmrg  am_missing_run="$MISSING "
3071fda9279dSmrgelse
3072fda9279dSmrg  am_missing_run=
3073fda9279dSmrg  AC_MSG_WARN(['missing' script is too old or missing])
3074fda9279dSmrgfi
3075fda9279dSmrg])
3076fda9279dSmrg
3077fda9279dSmrg# Helper functions for option handling.                     -*- Autoconf -*-
3078fda9279dSmrg
307933adc6acSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3080fda9279dSmrg#
3081fda9279dSmrg# This file is free software; the Free Software Foundation
3082fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3083fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3084fda9279dSmrg
3085fda9279dSmrg# _AM_MANGLE_OPTION(NAME)
3086fda9279dSmrg# -----------------------
3087fda9279dSmrgAC_DEFUN([_AM_MANGLE_OPTION],
3088fda9279dSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3089fda9279dSmrg
3090fda9279dSmrg# _AM_SET_OPTION(NAME)
3091fda9279dSmrg# --------------------
3092fda9279dSmrg# Set option NAME.  Presently that only means defining a flag for this option.
3093fda9279dSmrgAC_DEFUN([_AM_SET_OPTION],
3094fda9279dSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3095fda9279dSmrg
3096fda9279dSmrg# _AM_SET_OPTIONS(OPTIONS)
3097fda9279dSmrg# ------------------------
3098fda9279dSmrg# OPTIONS is a space-separated list of Automake options.
3099fda9279dSmrgAC_DEFUN([_AM_SET_OPTIONS],
3100fda9279dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3101fda9279dSmrg
3102fda9279dSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
3103fda9279dSmrg# -------------------------------------------
3104fda9279dSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
3105fda9279dSmrgAC_DEFUN([_AM_IF_OPTION],
3106fda9279dSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3107fda9279dSmrg
310833adc6acSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3109fda9279dSmrg#
3110fda9279dSmrg# This file is free software; the Free Software Foundation
3111fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3112fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3113fda9279dSmrg
3114fda9279dSmrg# _AM_PROG_CC_C_O
3115fda9279dSmrg# ---------------
3116fda9279dSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
3117fda9279dSmrg# to automatically call this.
3118fda9279dSmrgAC_DEFUN([_AM_PROG_CC_C_O],
3119fda9279dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3120fda9279dSmrgAC_REQUIRE_AUX_FILE([compile])dnl
3121fda9279dSmrgAC_LANG_PUSH([C])dnl
3122fda9279dSmrgAC_CACHE_CHECK(
3123fda9279dSmrg  [whether $CC understands -c and -o together],
3124fda9279dSmrg  [am_cv_prog_cc_c_o],
3125fda9279dSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
3126fda9279dSmrg  # Make sure it works both with $CC and with simple cc.
3127fda9279dSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
3128fda9279dSmrg  # compilers refuse to overwrite an existing .o file with -o,
3129fda9279dSmrg  # though they will create one.
3130fda9279dSmrg  am_cv_prog_cc_c_o=yes
3131fda9279dSmrg  for am_i in 1 2; do
3132fda9279dSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
3133fda9279dSmrg         && test -f conftest2.$ac_objext; then
3134fda9279dSmrg      : OK
3135fda9279dSmrg    else
3136fda9279dSmrg      am_cv_prog_cc_c_o=no
3137fda9279dSmrg      break
3138fda9279dSmrg    fi
3139fda9279dSmrg  done
3140fda9279dSmrg  rm -f core conftest*
3141fda9279dSmrg  unset am_i])
3142fda9279dSmrgif test "$am_cv_prog_cc_c_o" != yes; then
3143fda9279dSmrg   # Losing compiler, so override with the script.
3144fda9279dSmrg   # FIXME: It is wrong to rewrite CC.
3145fda9279dSmrg   # But if we don't then we get into trouble of one sort or another.
3146fda9279dSmrg   # A longer-term fix would be to have automake use am__CC in this case,
3147fda9279dSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
3148fda9279dSmrg   CC="$am_aux_dir/compile $CC"
3149fda9279dSmrgfi
3150fda9279dSmrgAC_LANG_POP([C])])
3151fda9279dSmrg
3152fda9279dSmrg# For backward compatibility.
3153fda9279dSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3154fda9279dSmrg
315533adc6acSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3156fda9279dSmrg#
3157fda9279dSmrg# This file is free software; the Free Software Foundation
3158fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3159fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3160fda9279dSmrg
3161fda9279dSmrg# AM_RUN_LOG(COMMAND)
3162fda9279dSmrg# -------------------
3163fda9279dSmrg# Run COMMAND, save the exit status in ac_status, and log it.
3164fda9279dSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3165fda9279dSmrgAC_DEFUN([AM_RUN_LOG],
3166fda9279dSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3167fda9279dSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3168fda9279dSmrg   ac_status=$?
3169fda9279dSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3170fda9279dSmrg   (exit $ac_status); }])
3171fda9279dSmrg
3172fda9279dSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3173fda9279dSmrg
317433adc6acSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
3175fda9279dSmrg#
3176fda9279dSmrg# This file is free software; the Free Software Foundation
3177fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3178fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3179fda9279dSmrg
3180fda9279dSmrg# AM_SANITY_CHECK
3181fda9279dSmrg# ---------------
3182fda9279dSmrgAC_DEFUN([AM_SANITY_CHECK],
3183fda9279dSmrg[AC_MSG_CHECKING([whether build environment is sane])
3184fda9279dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
3185fda9279dSmrg# name.  Accept space and tab only in the latter.
3186fda9279dSmrgam_lf='
3187fda9279dSmrg'
3188fda9279dSmrgcase `pwd` in
3189fda9279dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
3190fda9279dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
3191fda9279dSmrgesac
3192fda9279dSmrgcase $srcdir in
3193fda9279dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3194fda9279dSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3195fda9279dSmrgesac
3196fda9279dSmrg
3197fda9279dSmrg# Do 'set' in a subshell so we don't clobber the current shell's
3198fda9279dSmrg# arguments.  Must try -L first in case configure is actually a
3199fda9279dSmrg# symlink; some systems play weird games with the mod time of symlinks
3200fda9279dSmrg# (eg FreeBSD returns the mod time of the symlink's containing
3201fda9279dSmrg# directory).
3202fda9279dSmrgif (
3203fda9279dSmrg   am_has_slept=no
3204fda9279dSmrg   for am_try in 1 2; do
3205fda9279dSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
3206fda9279dSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3207fda9279dSmrg     if test "$[*]" = "X"; then
3208fda9279dSmrg	# -L didn't work.
3209fda9279dSmrg	set X `ls -t "$srcdir/configure" conftest.file`
3210fda9279dSmrg     fi
3211fda9279dSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
3212fda9279dSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3213fda9279dSmrg
3214fda9279dSmrg	# If neither matched, then we have a broken ls.  This can happen
3215fda9279dSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
3216fda9279dSmrg	# broken ls alias from the environment.  This has actually
3217fda9279dSmrg	# happened.  Such a system could not be considered "sane".
3218fda9279dSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3219fda9279dSmrg  alias in your environment])
3220fda9279dSmrg     fi
3221fda9279dSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3222fda9279dSmrg       break
3223fda9279dSmrg     fi
3224fda9279dSmrg     # Just in case.
3225fda9279dSmrg     sleep 1
3226fda9279dSmrg     am_has_slept=yes
3227fda9279dSmrg   done
3228fda9279dSmrg   test "$[2]" = conftest.file
3229fda9279dSmrg   )
3230fda9279dSmrgthen
3231fda9279dSmrg   # Ok.
3232fda9279dSmrg   :
3233fda9279dSmrgelse
3234fda9279dSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
3235fda9279dSmrgCheck your system clock])
3236fda9279dSmrgfi
3237fda9279dSmrgAC_MSG_RESULT([yes])
3238fda9279dSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
3239fda9279dSmrg# generated files are strictly newer.
3240fda9279dSmrgam_sleep_pid=
3241fda9279dSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
3242fda9279dSmrg  ( sleep 1 ) &
3243fda9279dSmrg  am_sleep_pid=$!
3244fda9279dSmrgfi
3245fda9279dSmrgAC_CONFIG_COMMANDS_PRE(
3246fda9279dSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
3247fda9279dSmrg   if test -n "$am_sleep_pid"; then
3248fda9279dSmrg     # Hide warnings about reused PIDs.
3249fda9279dSmrg     wait $am_sleep_pid 2>/dev/null
3250fda9279dSmrg   fi
3251fda9279dSmrg   AC_MSG_RESULT([done])])
3252fda9279dSmrgrm -f conftest.file
3253fda9279dSmrg])
3254fda9279dSmrg
325533adc6acSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
3256fda9279dSmrg#
3257fda9279dSmrg# This file is free software; the Free Software Foundation
3258fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3259fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3260fda9279dSmrg
3261fda9279dSmrg# AM_SILENT_RULES([DEFAULT])
3262fda9279dSmrg# --------------------------
3263fda9279dSmrg# Enable less verbose build rules; with the default set to DEFAULT
3264fda9279dSmrg# ("yes" being less verbose, "no" or empty being verbose).
3265fda9279dSmrgAC_DEFUN([AM_SILENT_RULES],
3266fda9279dSmrg[AC_ARG_ENABLE([silent-rules], [dnl
3267fda9279dSmrgAS_HELP_STRING(
3268fda9279dSmrg  [--enable-silent-rules],
3269fda9279dSmrg  [less verbose build output (undo: "make V=1")])
3270fda9279dSmrgAS_HELP_STRING(
3271fda9279dSmrg  [--disable-silent-rules],
3272fda9279dSmrg  [verbose build output (undo: "make V=0")])dnl
3273fda9279dSmrg])
3274fda9279dSmrgcase $enable_silent_rules in @%:@ (((
3275fda9279dSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
3276fda9279dSmrg   no) AM_DEFAULT_VERBOSITY=1;;
3277fda9279dSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3278fda9279dSmrgesac
3279fda9279dSmrgdnl
3280fda9279dSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3281fda9279dSmrgdnl do not support nested variable expansions.
3282fda9279dSmrgdnl See automake bug#9928 and bug#10237.
3283fda9279dSmrgam_make=${MAKE-make}
3284fda9279dSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
3285fda9279dSmrg   [am_cv_make_support_nested_variables],
3286fda9279dSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
3287fda9279dSmrgBAR0=false
3288fda9279dSmrgBAR1=true
3289fda9279dSmrgV=1
3290fda9279dSmrgam__doit:
3291fda9279dSmrg	@$(TRUE)
3292fda9279dSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3293fda9279dSmrg  am_cv_make_support_nested_variables=yes
3294fda9279dSmrgelse
3295fda9279dSmrg  am_cv_make_support_nested_variables=no
3296fda9279dSmrgfi])
3297fda9279dSmrgif test $am_cv_make_support_nested_variables = yes; then
3298fda9279dSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3299fda9279dSmrg  AM_V='$(V)'
3300fda9279dSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3301fda9279dSmrgelse
3302fda9279dSmrg  AM_V=$AM_DEFAULT_VERBOSITY
3303fda9279dSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3304fda9279dSmrgfi
3305fda9279dSmrgAC_SUBST([AM_V])dnl
3306fda9279dSmrgAM_SUBST_NOTMAKE([AM_V])dnl
3307fda9279dSmrgAC_SUBST([AM_DEFAULT_V])dnl
3308fda9279dSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3309fda9279dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3310fda9279dSmrgAM_BACKSLASH='\'
3311fda9279dSmrgAC_SUBST([AM_BACKSLASH])dnl
3312fda9279dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3313fda9279dSmrg])
3314fda9279dSmrg
331533adc6acSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3316fda9279dSmrg#
3317fda9279dSmrg# This file is free software; the Free Software Foundation
3318fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3319fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3320fda9279dSmrg
3321fda9279dSmrg# AM_PROG_INSTALL_STRIP
3322fda9279dSmrg# ---------------------
3323fda9279dSmrg# One issue with vendor 'install' (even GNU) is that you can't
3324fda9279dSmrg# specify the program used to strip binaries.  This is especially
3325fda9279dSmrg# annoying in cross-compiling environments, where the build's strip
3326fda9279dSmrg# is unlikely to handle the host's binaries.
3327fda9279dSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
3328fda9279dSmrg# always use install-sh in "make install-strip", and initialize
3329fda9279dSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
3330fda9279dSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3331fda9279dSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3332fda9279dSmrg# Installed binaries are usually stripped using 'strip' when the user
3333fda9279dSmrg# run "make install-strip".  However 'strip' might not be the right
3334fda9279dSmrg# tool to use in cross-compilation environments, therefore Automake
3335fda9279dSmrg# will honor the 'STRIP' environment variable to overrule this program.
3336fda9279dSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3337fda9279dSmrgif test "$cross_compiling" != no; then
3338fda9279dSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
3339fda9279dSmrgfi
3340fda9279dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3341fda9279dSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3342fda9279dSmrg
334333adc6acSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
3344fda9279dSmrg#
3345fda9279dSmrg# This file is free software; the Free Software Foundation
3346fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3347fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3348fda9279dSmrg
3349fda9279dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
3350fda9279dSmrg# ---------------------------
3351fda9279dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3352fda9279dSmrg# This macro is traced by Automake.
3353fda9279dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3354fda9279dSmrg
3355fda9279dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
3356fda9279dSmrg# --------------------------
3357fda9279dSmrg# Public sister of _AM_SUBST_NOTMAKE.
3358fda9279dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3359fda9279dSmrg
3360fda9279dSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3361fda9279dSmrg
336233adc6acSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
3363fda9279dSmrg#
3364fda9279dSmrg# This file is free software; the Free Software Foundation
3365fda9279dSmrg# gives unlimited permission to copy and/or distribute it,
3366fda9279dSmrg# with or without modifications, as long as this notice is preserved.
3367fda9279dSmrg
3368fda9279dSmrg# _AM_PROG_TAR(FORMAT)
3369fda9279dSmrg# --------------------
3370fda9279dSmrg# Check how to create a tarball in format FORMAT.
3371fda9279dSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3372fda9279dSmrg#
3373fda9279dSmrg# Substitute a variable $(am__tar) that is a command
3374fda9279dSmrg# writing to stdout a FORMAT-tarball containing the directory
3375fda9279dSmrg# $tardir.
3376fda9279dSmrg#     tardir=directory && $(am__tar) > result.tar
3377fda9279dSmrg#
3378fda9279dSmrg# Substitute a variable $(am__untar) that extract such
3379fda9279dSmrg# a tarball read from stdin.
3380fda9279dSmrg#     $(am__untar) < result.tar
3381fda9279dSmrg#
3382fda9279dSmrgAC_DEFUN([_AM_PROG_TAR],
3383fda9279dSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
3384fda9279dSmrg# in the wild :-(  We should find a proper way to deprecate it ...
3385fda9279dSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3386fda9279dSmrg
3387fda9279dSmrg# We'll loop over all known methods to create a tar archive until one works.
3388fda9279dSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3389fda9279dSmrg
3390fda9279dSmrgm4_if([$1], [v7],
3391fda9279dSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3392fda9279dSmrg
3393fda9279dSmrg  [m4_case([$1],
3394fda9279dSmrg    [ustar],
3395fda9279dSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3396fda9279dSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3397fda9279dSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3398fda9279dSmrg      # and bug#13588).
3399fda9279dSmrg      am_max_uid=2097151 # 2^21 - 1
3400fda9279dSmrg      am_max_gid=$am_max_uid
3401fda9279dSmrg      # The $UID and $GID variables are not portable, so we need to resort
3402fda9279dSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3403fda9279dSmrg      # below are definitely unexpected, so allow the users to see them
3404fda9279dSmrg      # (that is, avoid stderr redirection).
3405fda9279dSmrg      am_uid=`id -u || echo unknown`
3406fda9279dSmrg      am_gid=`id -g || echo unknown`
3407fda9279dSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3408fda9279dSmrg      if test $am_uid -le $am_max_uid; then
3409fda9279dSmrg         AC_MSG_RESULT([yes])
3410fda9279dSmrg      else
3411fda9279dSmrg         AC_MSG_RESULT([no])
3412fda9279dSmrg         _am_tools=none
3413fda9279dSmrg      fi
3414fda9279dSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3415fda9279dSmrg      if test $am_gid -le $am_max_gid; then
3416fda9279dSmrg         AC_MSG_RESULT([yes])
3417fda9279dSmrg      else
3418fda9279dSmrg        AC_MSG_RESULT([no])
3419fda9279dSmrg        _am_tools=none
3420fda9279dSmrg      fi],
3421fda9279dSmrg
3422fda9279dSmrg  [pax],
3423fda9279dSmrg    [],
3424fda9279dSmrg
3425fda9279dSmrg  [m4_fatal([Unknown tar format])])
3426fda9279dSmrg
3427fda9279dSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3428fda9279dSmrg
3429fda9279dSmrg  # Go ahead even if we have the value already cached.  We do so because we
3430fda9279dSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
3431fda9279dSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3432fda9279dSmrg
3433fda9279dSmrg  for _am_tool in $_am_tools; do
3434fda9279dSmrg    case $_am_tool in
3435fda9279dSmrg    gnutar)
3436fda9279dSmrg      for _am_tar in tar gnutar gtar; do
3437fda9279dSmrg        AM_RUN_LOG([$_am_tar --version]) && break
3438fda9279dSmrg      done
3439fda9279dSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3440fda9279dSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3441fda9279dSmrg      am__untar="$_am_tar -xf -"
3442fda9279dSmrg      ;;
3443fda9279dSmrg    plaintar)
3444fda9279dSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
3445fda9279dSmrg      # ustar tarball either.
3446fda9279dSmrg      (tar --version) >/dev/null 2>&1 && continue
3447fda9279dSmrg      am__tar='tar chf - "$$tardir"'
3448fda9279dSmrg      am__tar_='tar chf - "$tardir"'
3449fda9279dSmrg      am__untar='tar xf -'
3450fda9279dSmrg      ;;
3451fda9279dSmrg    pax)
3452fda9279dSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
3453fda9279dSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
3454fda9279dSmrg      am__untar='pax -r'
3455fda9279dSmrg      ;;
3456fda9279dSmrg    cpio)
3457fda9279dSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3458fda9279dSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3459fda9279dSmrg      am__untar='cpio -i -H $1 -d'
3460fda9279dSmrg      ;;
3461fda9279dSmrg    none)
3462fda9279dSmrg      am__tar=false
3463fda9279dSmrg      am__tar_=false
3464fda9279dSmrg      am__untar=false
3465fda9279dSmrg      ;;
3466fda9279dSmrg    esac
3467fda9279dSmrg
3468fda9279dSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
3469fda9279dSmrg    # and am__untar set.
3470fda9279dSmrg    test -n "${am_cv_prog_tar_$1}" && break
3471fda9279dSmrg
3472fda9279dSmrg    # tar/untar a dummy directory, and stop if the command works.
3473fda9279dSmrg    rm -rf conftest.dir
3474fda9279dSmrg    mkdir conftest.dir
3475fda9279dSmrg    echo GrepMe > conftest.dir/file
3476fda9279dSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3477fda9279dSmrg    rm -rf conftest.dir
3478fda9279dSmrg    if test -s conftest.tar; then
3479fda9279dSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
3480fda9279dSmrg      AM_RUN_LOG([cat conftest.dir/file])
3481fda9279dSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3482fda9279dSmrg    fi
3483fda9279dSmrg  done
3484fda9279dSmrg  rm -rf conftest.dir
3485fda9279dSmrg
3486fda9279dSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3487fda9279dSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3488fda9279dSmrg
3489fda9279dSmrgAC_SUBST([am__tar])
3490fda9279dSmrgAC_SUBST([am__untar])
3491fda9279dSmrg]) # _AM_PROG_TAR
3492fda9279dSmrg
3493dd52494dSmrgm4_include([m4/libtool.m4])
3494dd52494dSmrgm4_include([m4/ltoptions.m4])
3495dd52494dSmrgm4_include([m4/ltsugar.m4])
3496dd52494dSmrgm4_include([m4/ltversion.m4])
3497dd52494dSmrgm4_include([m4/lt~obsolete.m4])
3498