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