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