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