aclocal.m4 revision 33adc6ac
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
2315dnl Copyright 2005 Red Hat, Inc
2316dnl 
2317dnl Permission to use, copy, modify, distribute, and sell this software and its
2318dnl documentation for any purpose is hereby granted without fee, provided that
2319dnl the above copyright notice appear in all copies and that both that
2320dnl copyright notice and this permission notice appear in supporting
2321dnl documentation.
2322dnl 
2323dnl The above copyright notice and this permission notice shall be included
2324dnl in all copies or substantial portions of the Software.
2325dnl 
2326dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2327dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2328dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2329dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2330dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2331dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2332dnl OTHER DEALINGS IN THE SOFTWARE.
2333dnl 
2334dnl Except as contained in this notice, the name of the copyright holders shall
2335dnl not be used in advertising or otherwise to promote the sale, use or
2336dnl other dealings in this Software without prior written authorization
2337dnl from the copyright holders.
2338dnl 
2339
2340# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2341# --------------------------
2342# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
2343# is defined, then add the given PROTO to $REQUIRED_MODULES.
2344
2345AC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2346	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2347	SAVE_CFLAGS="$CFLAGS"
2348	CFLAGS="$CFLAGS `$PKG_CONFIG --cflags xorg-server`"
2349	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2350#include "xorg-server.h"
2351#if !defined $1
2352#error $1 not defined
2353#endif
2354		]])],
2355		[_EXT_CHECK=yes],
2356		[_EXT_CHECK=no])
2357	CFLAGS="$SAVE_CFLAGS"
2358	AC_MSG_CHECKING([if $1 is defined])
2359	AC_MSG_RESULT([$_EXT_CHECK])
2360	if test "$_EXT_CHECK" != no; then
2361		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2362	fi
2363])
2364
2365# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2366#
2367# This file is free software; the Free Software Foundation
2368# gives unlimited permission to copy and/or distribute it,
2369# with or without modifications, as long as this notice is preserved.
2370
2371# AM_AUTOMAKE_VERSION(VERSION)
2372# ----------------------------
2373# Automake X.Y traces this macro to ensure aclocal.m4 has been
2374# generated from the m4 files accompanying Automake X.Y.
2375# (This private macro should not be called outside this file.)
2376AC_DEFUN([AM_AUTOMAKE_VERSION],
2377[am__api_version='1.16'
2378dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2379dnl require some minimum version.  Point them to the right macro.
2380m4_if([$1], [1.16.5], [],
2381      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2382])
2383
2384# _AM_AUTOCONF_VERSION(VERSION)
2385# -----------------------------
2386# aclocal traces this macro to find the Autoconf version.
2387# This is a private macro too.  Using m4_define simplifies
2388# the logic in aclocal, which can simply ignore this definition.
2389m4_define([_AM_AUTOCONF_VERSION], [])
2390
2391# AM_SET_CURRENT_AUTOMAKE_VERSION
2392# -------------------------------
2393# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2394# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2395AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2396[AM_AUTOMAKE_VERSION([1.16.5])dnl
2397m4_ifndef([AC_AUTOCONF_VERSION],
2398  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2399_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2400
2401# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2402
2403# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2404#
2405# This file is free software; the Free Software Foundation
2406# gives unlimited permission to copy and/or distribute it,
2407# with or without modifications, as long as this notice is preserved.
2408
2409# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2410# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2411# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2412#
2413# Of course, Automake must honor this variable whenever it calls a
2414# tool from the auxiliary directory.  The problem is that $srcdir (and
2415# therefore $ac_aux_dir as well) can be either absolute or relative,
2416# depending on how configure is run.  This is pretty annoying, since
2417# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2418# source directory, any form will work fine, but in subdirectories a
2419# relative path needs to be adjusted first.
2420#
2421# $ac_aux_dir/missing
2422#    fails when called from a subdirectory if $ac_aux_dir is relative
2423# $top_srcdir/$ac_aux_dir/missing
2424#    fails if $ac_aux_dir is absolute,
2425#    fails when called from a subdirectory in a VPATH build with
2426#          a relative $ac_aux_dir
2427#
2428# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2429# are both prefixed by $srcdir.  In an in-source build this is usually
2430# harmless because $srcdir is '.', but things will broke when you
2431# start a VPATH build or use an absolute $srcdir.
2432#
2433# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2434# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2435#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2436# and then we would define $MISSING as
2437#   MISSING="\${SHELL} $am_aux_dir/missing"
2438# This will work as long as MISSING is not called from configure, because
2439# unfortunately $(top_srcdir) has no meaning in configure.
2440# However there are other variables, like CC, which are often used in
2441# configure, and could therefore not use this "fixed" $ac_aux_dir.
2442#
2443# Another solution, used here, is to always expand $ac_aux_dir to an
2444# absolute PATH.  The drawback is that using absolute paths prevent a
2445# configured tree to be moved without reconfiguration.
2446
2447AC_DEFUN([AM_AUX_DIR_EXPAND],
2448[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2449# Expand $ac_aux_dir to an absolute path.
2450am_aux_dir=`cd "$ac_aux_dir" && pwd`
2451])
2452
2453# AM_CONDITIONAL                                            -*- Autoconf -*-
2454
2455# Copyright (C) 1997-2021 Free Software Foundation, Inc.
2456#
2457# This file is free software; the Free Software Foundation
2458# gives unlimited permission to copy and/or distribute it,
2459# with or without modifications, as long as this notice is preserved.
2460
2461# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2462# -------------------------------------
2463# Define a conditional.
2464AC_DEFUN([AM_CONDITIONAL],
2465[AC_PREREQ([2.52])dnl
2466 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2467       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2468AC_SUBST([$1_TRUE])dnl
2469AC_SUBST([$1_FALSE])dnl
2470_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2471_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2472m4_define([_AM_COND_VALUE_$1], [$2])dnl
2473if $2; then
2474  $1_TRUE=
2475  $1_FALSE='#'
2476else
2477  $1_TRUE='#'
2478  $1_FALSE=
2479fi
2480AC_CONFIG_COMMANDS_PRE(
2481[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2482  AC_MSG_ERROR([[conditional "$1" was never defined.
2483Usually this means the macro was only invoked conditionally.]])
2484fi])])
2485
2486# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2487#
2488# This file is free software; the Free Software Foundation
2489# gives unlimited permission to copy and/or distribute it,
2490# with or without modifications, as long as this notice is preserved.
2491
2492
2493# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2494# written in clear, in which case automake, when reading aclocal.m4,
2495# will think it sees a *use*, and therefore will trigger all it's
2496# C support machinery.  Also note that it means that autoscan, seeing
2497# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2498
2499
2500# _AM_DEPENDENCIES(NAME)
2501# ----------------------
2502# See how the compiler implements dependency checking.
2503# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2504# We try a few techniques and use that to set a single cache variable.
2505#
2506# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2507# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2508# dependency, and given that the user is not expected to run this macro,
2509# just rely on AC_PROG_CC.
2510AC_DEFUN([_AM_DEPENDENCIES],
2511[AC_REQUIRE([AM_SET_DEPDIR])dnl
2512AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2513AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2514AC_REQUIRE([AM_DEP_TRACK])dnl
2515
2516m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2517      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2518      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2519      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2520      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2521      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2522                    [depcc="$$1"   am_compiler_list=])
2523
2524AC_CACHE_CHECK([dependency style of $depcc],
2525               [am_cv_$1_dependencies_compiler_type],
2526[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2527  # We make a subdir and do the tests there.  Otherwise we can end up
2528  # making bogus files that we don't know about and never remove.  For
2529  # instance it was reported that on HP-UX the gcc test will end up
2530  # making a dummy file named 'D' -- because '-MD' means "put the output
2531  # in D".
2532  rm -rf conftest.dir
2533  mkdir conftest.dir
2534  # Copy depcomp to subdir because otherwise we won't find it if we're
2535  # using a relative directory.
2536  cp "$am_depcomp" conftest.dir
2537  cd conftest.dir
2538  # We will build objects and dependencies in a subdirectory because
2539  # it helps to detect inapplicable dependency modes.  For instance
2540  # both Tru64's cc and ICC support -MD to output dependencies as a
2541  # side effect of compilation, but ICC will put the dependencies in
2542  # the current directory while Tru64 will put them in the object
2543  # directory.
2544  mkdir sub
2545
2546  am_cv_$1_dependencies_compiler_type=none
2547  if test "$am_compiler_list" = ""; then
2548     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2549  fi
2550  am__universal=false
2551  m4_case([$1], [CC],
2552    [case " $depcc " in #(
2553     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2554     esac],
2555    [CXX],
2556    [case " $depcc " in #(
2557     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2558     esac])
2559
2560  for depmode in $am_compiler_list; do
2561    # Setup a source with many dependencies, because some compilers
2562    # like to wrap large dependency lists on column 80 (with \), and
2563    # we should not choose a depcomp mode which is confused by this.
2564    #
2565    # We need to recreate these files for each test, as the compiler may
2566    # overwrite some of them when testing with obscure command lines.
2567    # This happens at least with the AIX C compiler.
2568    : > sub/conftest.c
2569    for i in 1 2 3 4 5 6; do
2570      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2571      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2572      # Solaris 10 /bin/sh.
2573      echo '/* dummy */' > sub/conftst$i.h
2574    done
2575    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2576
2577    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2578    # mode.  It turns out that the SunPro C++ compiler does not properly
2579    # handle '-M -o', and we need to detect this.  Also, some Intel
2580    # versions had trouble with output in subdirs.
2581    am__obj=sub/conftest.${OBJEXT-o}
2582    am__minus_obj="-o $am__obj"
2583    case $depmode in
2584    gcc)
2585      # This depmode causes a compiler race in universal mode.
2586      test "$am__universal" = false || continue
2587      ;;
2588    nosideeffect)
2589      # After this tag, mechanisms are not by side-effect, so they'll
2590      # only be used when explicitly requested.
2591      if test "x$enable_dependency_tracking" = xyes; then
2592	continue
2593      else
2594	break
2595      fi
2596      ;;
2597    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2598      # This compiler won't grok '-c -o', but also, the minuso test has
2599      # not run yet.  These depmodes are late enough in the game, and
2600      # so weak that their functioning should not be impacted.
2601      am__obj=conftest.${OBJEXT-o}
2602      am__minus_obj=
2603      ;;
2604    none) break ;;
2605    esac
2606    if depmode=$depmode \
2607       source=sub/conftest.c object=$am__obj \
2608       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2609       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2610         >/dev/null 2>conftest.err &&
2611       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2612       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2613       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2614       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2615      # icc doesn't choke on unknown options, it will just issue warnings
2616      # or remarks (even with -Werror).  So we grep stderr for any message
2617      # that says an option was ignored or not supported.
2618      # When given -MP, icc 7.0 and 7.1 complain thusly:
2619      #   icc: Command line warning: ignoring option '-M'; no argument required
2620      # The diagnosis changed in icc 8.0:
2621      #   icc: Command line remark: option '-MP' not supported
2622      if (grep 'ignoring option' conftest.err ||
2623          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2624        am_cv_$1_dependencies_compiler_type=$depmode
2625        break
2626      fi
2627    fi
2628  done
2629
2630  cd ..
2631  rm -rf conftest.dir
2632else
2633  am_cv_$1_dependencies_compiler_type=none
2634fi
2635])
2636AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2637AM_CONDITIONAL([am__fastdep$1], [
2638  test "x$enable_dependency_tracking" != xno \
2639  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2640])
2641
2642
2643# AM_SET_DEPDIR
2644# -------------
2645# Choose a directory name for dependency files.
2646# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2647AC_DEFUN([AM_SET_DEPDIR],
2648[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2649AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2650])
2651
2652
2653# AM_DEP_TRACK
2654# ------------
2655AC_DEFUN([AM_DEP_TRACK],
2656[AC_ARG_ENABLE([dependency-tracking], [dnl
2657AS_HELP_STRING(
2658  [--enable-dependency-tracking],
2659  [do not reject slow dependency extractors])
2660AS_HELP_STRING(
2661  [--disable-dependency-tracking],
2662  [speeds up one-time build])])
2663if test "x$enable_dependency_tracking" != xno; then
2664  am_depcomp="$ac_aux_dir/depcomp"
2665  AMDEPBACKSLASH='\'
2666  am__nodep='_no'
2667fi
2668AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2669AC_SUBST([AMDEPBACKSLASH])dnl
2670_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2671AC_SUBST([am__nodep])dnl
2672_AM_SUBST_NOTMAKE([am__nodep])dnl
2673])
2674
2675# Generate code to set up dependency tracking.              -*- Autoconf -*-
2676
2677# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2678#
2679# This file is free software; the Free Software Foundation
2680# gives unlimited permission to copy and/or distribute it,
2681# with or without modifications, as long as this notice is preserved.
2682
2683# _AM_OUTPUT_DEPENDENCY_COMMANDS
2684# ------------------------------
2685AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2686[{
2687  # Older Autoconf quotes --file arguments for eval, but not when files
2688  # are listed without --file.  Let's play safe and only enable the eval
2689  # if we detect the quoting.
2690  # TODO: see whether this extra hack can be removed once we start
2691  # requiring Autoconf 2.70 or later.
2692  AS_CASE([$CONFIG_FILES],
2693          [*\'*], [eval set x "$CONFIG_FILES"],
2694          [*], [set x $CONFIG_FILES])
2695  shift
2696  # Used to flag and report bootstrapping failures.
2697  am_rc=0
2698  for am_mf
2699  do
2700    # Strip MF so we end up with the name of the file.
2701    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2702    # Check whether this is an Automake generated Makefile which includes
2703    # dependency-tracking related rules and includes.
2704    # Grep'ing the whole file directly is not great: AIX grep has a line
2705    # limit of 2048, but all sed's we know have understand at least 4000.
2706    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2707      || continue
2708    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2709    am_filepart=`AS_BASENAME(["$am_mf"])`
2710    AM_RUN_LOG([cd "$am_dirpart" \
2711      && sed -e '/# am--include-marker/d' "$am_filepart" \
2712        | $MAKE -f - am--depfiles]) || am_rc=$?
2713  done
2714  if test $am_rc -ne 0; then
2715    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
2716    for automatic dependency tracking.  If GNU make was not used, consider
2717    re-running the configure script with MAKE="gmake" (or whatever is
2718    necessary).  You can also try re-running configure with the
2719    '--disable-dependency-tracking' option to at least be able to build
2720    the package (albeit without support for automatic dependency tracking).])
2721  fi
2722  AS_UNSET([am_dirpart])
2723  AS_UNSET([am_filepart])
2724  AS_UNSET([am_mf])
2725  AS_UNSET([am_rc])
2726  rm -f conftest-deps.mk
2727}
2728])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2729
2730
2731# AM_OUTPUT_DEPENDENCY_COMMANDS
2732# -----------------------------
2733# This macro should only be invoked once -- use via AC_REQUIRE.
2734#
2735# This code is only required when automatic dependency tracking is enabled.
2736# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2737# order to bootstrap the dependency handling code.
2738AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2739[AC_CONFIG_COMMANDS([depfiles],
2740     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2741     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2742
2743# Do all the work for Automake.                             -*- Autoconf -*-
2744
2745# Copyright (C) 1996-2021 Free Software Foundation, Inc.
2746#
2747# This file is free software; the Free Software Foundation
2748# gives unlimited permission to copy and/or distribute it,
2749# with or without modifications, as long as this notice is preserved.
2750
2751# This macro actually does too much.  Some checks are only needed if
2752# your package does certain things.  But this isn't really a big deal.
2753
2754dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2755m4_define([AC_PROG_CC],
2756m4_defn([AC_PROG_CC])
2757[_AM_PROG_CC_C_O
2758])
2759
2760# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2761# AM_INIT_AUTOMAKE([OPTIONS])
2762# -----------------------------------------------
2763# The call with PACKAGE and VERSION arguments is the old style
2764# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2765# and VERSION should now be passed to AC_INIT and removed from
2766# the call to AM_INIT_AUTOMAKE.
2767# We support both call styles for the transition.  After
2768# the next Automake release, Autoconf can make the AC_INIT
2769# arguments mandatory, and then we can depend on a new Autoconf
2770# release and drop the old call support.
2771AC_DEFUN([AM_INIT_AUTOMAKE],
2772[AC_PREREQ([2.65])dnl
2773m4_ifdef([_$0_ALREADY_INIT],
2774  [m4_fatal([$0 expanded multiple times
2775]m4_defn([_$0_ALREADY_INIT]))],
2776  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
2777dnl Autoconf wants to disallow AM_ names.  We explicitly allow
2778dnl the ones we care about.
2779m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2780AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2781AC_REQUIRE([AC_PROG_INSTALL])dnl
2782if test "`cd $srcdir && pwd`" != "`pwd`"; then
2783  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2784  # is not polluted with repeated "-I."
2785  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2786  # test to see if srcdir already configured
2787  if test -f $srcdir/config.status; then
2788    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2789  fi
2790fi
2791
2792# test whether we have cygpath
2793if test -z "$CYGPATH_W"; then
2794  if (cygpath --version) >/dev/null 2>/dev/null; then
2795    CYGPATH_W='cygpath -w'
2796  else
2797    CYGPATH_W=echo
2798  fi
2799fi
2800AC_SUBST([CYGPATH_W])
2801
2802# Define the identity of the package.
2803dnl Distinguish between old-style and new-style calls.
2804m4_ifval([$2],
2805[AC_DIAGNOSE([obsolete],
2806             [$0: two- and three-arguments forms are deprecated.])
2807m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2808 AC_SUBST([PACKAGE], [$1])dnl
2809 AC_SUBST([VERSION], [$2])],
2810[_AM_SET_OPTIONS([$1])dnl
2811dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2812m4_if(
2813  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
2814  [ok:ok],,
2815  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2816 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2817 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2818
2819_AM_IF_OPTION([no-define],,
2820[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2821 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2822
2823# Some tools Automake needs.
2824AC_REQUIRE([AM_SANITY_CHECK])dnl
2825AC_REQUIRE([AC_ARG_PROGRAM])dnl
2826AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2827AM_MISSING_PROG([AUTOCONF], [autoconf])
2828AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2829AM_MISSING_PROG([AUTOHEADER], [autoheader])
2830AM_MISSING_PROG([MAKEINFO], [makeinfo])
2831AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2832AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2833AC_REQUIRE([AC_PROG_MKDIR_P])dnl
2834# For better backward compatibility.  To be removed once Automake 1.9.x
2835# dies out for good.  For more background, see:
2836# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2837# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2838AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2839# We need awk for the "check" target (and possibly the TAP driver).  The
2840# system "awk" is bad on some platforms.
2841AC_REQUIRE([AC_PROG_AWK])dnl
2842AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2843AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2844_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2845	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2846			     [_AM_PROG_TAR([v7])])])
2847_AM_IF_OPTION([no-dependencies],,
2848[AC_PROVIDE_IFELSE([AC_PROG_CC],
2849		  [_AM_DEPENDENCIES([CC])],
2850		  [m4_define([AC_PROG_CC],
2851			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2852AC_PROVIDE_IFELSE([AC_PROG_CXX],
2853		  [_AM_DEPENDENCIES([CXX])],
2854		  [m4_define([AC_PROG_CXX],
2855			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2856AC_PROVIDE_IFELSE([AC_PROG_OBJC],
2857		  [_AM_DEPENDENCIES([OBJC])],
2858		  [m4_define([AC_PROG_OBJC],
2859			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2860AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2861		  [_AM_DEPENDENCIES([OBJCXX])],
2862		  [m4_define([AC_PROG_OBJCXX],
2863			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2864])
2865# Variables for tags utilities; see am/tags.am
2866if test -z "$CTAGS"; then
2867  CTAGS=ctags
2868fi
2869AC_SUBST([CTAGS])
2870if test -z "$ETAGS"; then
2871  ETAGS=etags
2872fi
2873AC_SUBST([ETAGS])
2874if test -z "$CSCOPE"; then
2875  CSCOPE=cscope
2876fi
2877AC_SUBST([CSCOPE])
2878
2879AC_REQUIRE([AM_SILENT_RULES])dnl
2880dnl The testsuite driver may need to know about EXEEXT, so add the
2881dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2882dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2883AC_CONFIG_COMMANDS_PRE(dnl
2884[m4_provide_if([_AM_COMPILER_EXEEXT],
2885  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2886
2887# POSIX will say in a future version that running "rm -f" with no argument
2888# is OK; and we want to be able to make that assumption in our Makefile
2889# recipes.  So use an aggressive probe to check that the usage we want is
2890# actually supported "in the wild" to an acceptable degree.
2891# See automake bug#10828.
2892# To make any issue more visible, cause the running configure to be aborted
2893# by default if the 'rm' program in use doesn't match our expectations; the
2894# user can still override this though.
2895if rm -f && rm -fr && rm -rf; then : OK; else
2896  cat >&2 <<'END'
2897Oops!
2898
2899Your 'rm' program seems unable to run without file operands specified
2900on the command line, even when the '-f' option is present.  This is contrary
2901to the behaviour of most rm programs out there, and not conforming with
2902the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2903
2904Please tell bug-automake@gnu.org about your system, including the value
2905of your $PATH and any error possibly output before this message.  This
2906can help us improve future automake versions.
2907
2908END
2909  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2910    echo 'Configuration will proceed anyway, since you have set the' >&2
2911    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2912    echo >&2
2913  else
2914    cat >&2 <<'END'
2915Aborting the configuration process, to ensure you take notice of the issue.
2916
2917You can download and install GNU coreutils to get an 'rm' implementation
2918that behaves properly: <https://www.gnu.org/software/coreutils/>.
2919
2920If you want to complete the configuration process using your problematic
2921'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2922to "yes", and re-run configure.
2923
2924END
2925    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2926  fi
2927fi
2928dnl The trailing newline in this macro's definition is deliberate, for
2929dnl backward compatibility and to allow trailing 'dnl'-style comments
2930dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2931])
2932
2933dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2934dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2935dnl mangled by Autoconf and run in a shell conditional statement.
2936m4_define([_AC_COMPILER_EXEEXT],
2937m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2938
2939# When config.status generates a header, we must update the stamp-h file.
2940# This file resides in the same directory as the config header
2941# that is generated.  The stamp files are numbered to have different names.
2942
2943# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2944# loop where config.status creates the headers, so we can generate
2945# our stamp files there.
2946AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2947[# Compute $1's index in $config_headers.
2948_am_arg=$1
2949_am_stamp_count=1
2950for _am_header in $config_headers :; do
2951  case $_am_header in
2952    $_am_arg | $_am_arg:* )
2953      break ;;
2954    * )
2955      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2956  esac
2957done
2958echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2959
2960# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2961#
2962# This file is free software; the Free Software Foundation
2963# gives unlimited permission to copy and/or distribute it,
2964# with or without modifications, as long as this notice is preserved.
2965
2966# AM_PROG_INSTALL_SH
2967# ------------------
2968# Define $install_sh.
2969AC_DEFUN([AM_PROG_INSTALL_SH],
2970[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2971if test x"${install_sh+set}" != xset; then
2972  case $am_aux_dir in
2973  *\ * | *\	*)
2974    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2975  *)
2976    install_sh="\${SHELL} $am_aux_dir/install-sh"
2977  esac
2978fi
2979AC_SUBST([install_sh])])
2980
2981# Copyright (C) 2003-2021 Free Software Foundation, Inc.
2982#
2983# This file is free software; the Free Software Foundation
2984# gives unlimited permission to copy and/or distribute it,
2985# with or without modifications, as long as this notice is preserved.
2986
2987# Check whether the underlying file-system supports filenames
2988# with a leading dot.  For instance MS-DOS doesn't.
2989AC_DEFUN([AM_SET_LEADING_DOT],
2990[rm -rf .tst 2>/dev/null
2991mkdir .tst 2>/dev/null
2992if test -d .tst; then
2993  am__leading_dot=.
2994else
2995  am__leading_dot=_
2996fi
2997rmdir .tst 2>/dev/null
2998AC_SUBST([am__leading_dot])])
2999
3000# Check to see how 'make' treats includes.	            -*- Autoconf -*-
3001
3002# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3003#
3004# This file is free software; the Free Software Foundation
3005# gives unlimited permission to copy and/or distribute it,
3006# with or without modifications, as long as this notice is preserved.
3007
3008# AM_MAKE_INCLUDE()
3009# -----------------
3010# Check whether make has an 'include' directive that can support all
3011# the idioms we need for our automatic dependency tracking code.
3012AC_DEFUN([AM_MAKE_INCLUDE],
3013[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
3014cat > confinc.mk << 'END'
3015am__doit:
3016	@echo this is the am__doit target >confinc.out
3017.PHONY: am__doit
3018END
3019am__include="#"
3020am__quote=
3021# BSD make does it like this.
3022echo '.include "confinc.mk" # ignored' > confmf.BSD
3023# Other make implementations (GNU, Solaris 10, AIX) do it like this.
3024echo 'include confinc.mk # ignored' > confmf.GNU
3025_am_result=no
3026for s in GNU BSD; do
3027  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
3028  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
3029      ['0:this is the am__doit target'],
3030      [AS_CASE([$s],
3031          [BSD], [am__include='.include' am__quote='"'],
3032          [am__include='include' am__quote=''])])
3033  if test "$am__include" != "#"; then
3034    _am_result="yes ($s style)"
3035    break
3036  fi
3037done
3038rm -f confinc.* confmf.*
3039AC_MSG_RESULT([${_am_result}])
3040AC_SUBST([am__include])])
3041AC_SUBST([am__quote])])
3042
3043# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
3044
3045# Copyright (C) 1997-2021 Free Software Foundation, Inc.
3046#
3047# This file is free software; the Free Software Foundation
3048# gives unlimited permission to copy and/or distribute it,
3049# with or without modifications, as long as this notice is preserved.
3050
3051# AM_MISSING_PROG(NAME, PROGRAM)
3052# ------------------------------
3053AC_DEFUN([AM_MISSING_PROG],
3054[AC_REQUIRE([AM_MISSING_HAS_RUN])
3055$1=${$1-"${am_missing_run}$2"}
3056AC_SUBST($1)])
3057
3058# AM_MISSING_HAS_RUN
3059# ------------------
3060# Define MISSING if not defined so far and test if it is modern enough.
3061# If it is, set am_missing_run to use it, otherwise, to nothing.
3062AC_DEFUN([AM_MISSING_HAS_RUN],
3063[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3064AC_REQUIRE_AUX_FILE([missing])dnl
3065if test x"${MISSING+set}" != xset; then
3066  MISSING="\${SHELL} '$am_aux_dir/missing'"
3067fi
3068# Use eval to expand $SHELL
3069if eval "$MISSING --is-lightweight"; then
3070  am_missing_run="$MISSING "
3071else
3072  am_missing_run=
3073  AC_MSG_WARN(['missing' script is too old or missing])
3074fi
3075])
3076
3077# Helper functions for option handling.                     -*- Autoconf -*-
3078
3079# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3080#
3081# This file is free software; the Free Software Foundation
3082# gives unlimited permission to copy and/or distribute it,
3083# with or without modifications, as long as this notice is preserved.
3084
3085# _AM_MANGLE_OPTION(NAME)
3086# -----------------------
3087AC_DEFUN([_AM_MANGLE_OPTION],
3088[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3089
3090# _AM_SET_OPTION(NAME)
3091# --------------------
3092# Set option NAME.  Presently that only means defining a flag for this option.
3093AC_DEFUN([_AM_SET_OPTION],
3094[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3095
3096# _AM_SET_OPTIONS(OPTIONS)
3097# ------------------------
3098# OPTIONS is a space-separated list of Automake options.
3099AC_DEFUN([_AM_SET_OPTIONS],
3100[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3101
3102# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
3103# -------------------------------------------
3104# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
3105AC_DEFUN([_AM_IF_OPTION],
3106[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3107
3108# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3109#
3110# This file is free software; the Free Software Foundation
3111# gives unlimited permission to copy and/or distribute it,
3112# with or without modifications, as long as this notice is preserved.
3113
3114# _AM_PROG_CC_C_O
3115# ---------------
3116# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
3117# to automatically call this.
3118AC_DEFUN([_AM_PROG_CC_C_O],
3119[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3120AC_REQUIRE_AUX_FILE([compile])dnl
3121AC_LANG_PUSH([C])dnl
3122AC_CACHE_CHECK(
3123  [whether $CC understands -c and -o together],
3124  [am_cv_prog_cc_c_o],
3125  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
3126  # Make sure it works both with $CC and with simple cc.
3127  # Following AC_PROG_CC_C_O, we do the test twice because some
3128  # compilers refuse to overwrite an existing .o file with -o,
3129  # though they will create one.
3130  am_cv_prog_cc_c_o=yes
3131  for am_i in 1 2; do
3132    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
3133         && test -f conftest2.$ac_objext; then
3134      : OK
3135    else
3136      am_cv_prog_cc_c_o=no
3137      break
3138    fi
3139  done
3140  rm -f core conftest*
3141  unset am_i])
3142if test "$am_cv_prog_cc_c_o" != yes; then
3143   # Losing compiler, so override with the script.
3144   # FIXME: It is wrong to rewrite CC.
3145   # But if we don't then we get into trouble of one sort or another.
3146   # A longer-term fix would be to have automake use am__CC in this case,
3147   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
3148   CC="$am_aux_dir/compile $CC"
3149fi
3150AC_LANG_POP([C])])
3151
3152# For backward compatibility.
3153AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3154
3155# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3156#
3157# This file is free software; the Free Software Foundation
3158# gives unlimited permission to copy and/or distribute it,
3159# with or without modifications, as long as this notice is preserved.
3160
3161# AM_RUN_LOG(COMMAND)
3162# -------------------
3163# Run COMMAND, save the exit status in ac_status, and log it.
3164# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3165AC_DEFUN([AM_RUN_LOG],
3166[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3167   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3168   ac_status=$?
3169   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3170   (exit $ac_status); }])
3171
3172# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3173
3174# Copyright (C) 1996-2021 Free Software Foundation, Inc.
3175#
3176# This file is free software; the Free Software Foundation
3177# gives unlimited permission to copy and/or distribute it,
3178# with or without modifications, as long as this notice is preserved.
3179
3180# AM_SANITY_CHECK
3181# ---------------
3182AC_DEFUN([AM_SANITY_CHECK],
3183[AC_MSG_CHECKING([whether build environment is sane])
3184# Reject unsafe characters in $srcdir or the absolute working directory
3185# name.  Accept space and tab only in the latter.
3186am_lf='
3187'
3188case `pwd` in
3189  *[[\\\"\#\$\&\'\`$am_lf]]*)
3190    AC_MSG_ERROR([unsafe absolute working directory name]);;
3191esac
3192case $srcdir in
3193  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3194    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3195esac
3196
3197# Do 'set' in a subshell so we don't clobber the current shell's
3198# arguments.  Must try -L first in case configure is actually a
3199# symlink; some systems play weird games with the mod time of symlinks
3200# (eg FreeBSD returns the mod time of the symlink's containing
3201# directory).
3202if (
3203   am_has_slept=no
3204   for am_try in 1 2; do
3205     echo "timestamp, slept: $am_has_slept" > conftest.file
3206     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3207     if test "$[*]" = "X"; then
3208	# -L didn't work.
3209	set X `ls -t "$srcdir/configure" conftest.file`
3210     fi
3211     if test "$[*]" != "X $srcdir/configure conftest.file" \
3212	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3213
3214	# If neither matched, then we have a broken ls.  This can happen
3215	# if, for instance, CONFIG_SHELL is bash and it inherits a
3216	# broken ls alias from the environment.  This has actually
3217	# happened.  Such a system could not be considered "sane".
3218	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3219  alias in your environment])
3220     fi
3221     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3222       break
3223     fi
3224     # Just in case.
3225     sleep 1
3226     am_has_slept=yes
3227   done
3228   test "$[2]" = conftest.file
3229   )
3230then
3231   # Ok.
3232   :
3233else
3234   AC_MSG_ERROR([newly created file is older than distributed files!
3235Check your system clock])
3236fi
3237AC_MSG_RESULT([yes])
3238# If we didn't sleep, we still need to ensure time stamps of config.status and
3239# generated files are strictly newer.
3240am_sleep_pid=
3241if grep 'slept: no' conftest.file >/dev/null 2>&1; then
3242  ( sleep 1 ) &
3243  am_sleep_pid=$!
3244fi
3245AC_CONFIG_COMMANDS_PRE(
3246  [AC_MSG_CHECKING([that generated files are newer than configure])
3247   if test -n "$am_sleep_pid"; then
3248     # Hide warnings about reused PIDs.
3249     wait $am_sleep_pid 2>/dev/null
3250   fi
3251   AC_MSG_RESULT([done])])
3252rm -f conftest.file
3253])
3254
3255# Copyright (C) 2009-2021 Free Software Foundation, Inc.
3256#
3257# This file is free software; the Free Software Foundation
3258# gives unlimited permission to copy and/or distribute it,
3259# with or without modifications, as long as this notice is preserved.
3260
3261# AM_SILENT_RULES([DEFAULT])
3262# --------------------------
3263# Enable less verbose build rules; with the default set to DEFAULT
3264# ("yes" being less verbose, "no" or empty being verbose).
3265AC_DEFUN([AM_SILENT_RULES],
3266[AC_ARG_ENABLE([silent-rules], [dnl
3267AS_HELP_STRING(
3268  [--enable-silent-rules],
3269  [less verbose build output (undo: "make V=1")])
3270AS_HELP_STRING(
3271  [--disable-silent-rules],
3272  [verbose build output (undo: "make V=0")])dnl
3273])
3274case $enable_silent_rules in @%:@ (((
3275  yes) AM_DEFAULT_VERBOSITY=0;;
3276   no) AM_DEFAULT_VERBOSITY=1;;
3277    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3278esac
3279dnl
3280dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3281dnl do not support nested variable expansions.
3282dnl See automake bug#9928 and bug#10237.
3283am_make=${MAKE-make}
3284AC_CACHE_CHECK([whether $am_make supports nested variables],
3285   [am_cv_make_support_nested_variables],
3286   [if AS_ECHO([['TRUE=$(BAR$(V))
3287BAR0=false
3288BAR1=true
3289V=1
3290am__doit:
3291	@$(TRUE)
3292.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3293  am_cv_make_support_nested_variables=yes
3294else
3295  am_cv_make_support_nested_variables=no
3296fi])
3297if test $am_cv_make_support_nested_variables = yes; then
3298  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3299  AM_V='$(V)'
3300  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3301else
3302  AM_V=$AM_DEFAULT_VERBOSITY
3303  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3304fi
3305AC_SUBST([AM_V])dnl
3306AM_SUBST_NOTMAKE([AM_V])dnl
3307AC_SUBST([AM_DEFAULT_V])dnl
3308AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3309AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3310AM_BACKSLASH='\'
3311AC_SUBST([AM_BACKSLASH])dnl
3312_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3313])
3314
3315# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3316#
3317# This file is free software; the Free Software Foundation
3318# gives unlimited permission to copy and/or distribute it,
3319# with or without modifications, as long as this notice is preserved.
3320
3321# AM_PROG_INSTALL_STRIP
3322# ---------------------
3323# One issue with vendor 'install' (even GNU) is that you can't
3324# specify the program used to strip binaries.  This is especially
3325# annoying in cross-compiling environments, where the build's strip
3326# is unlikely to handle the host's binaries.
3327# Fortunately install-sh will honor a STRIPPROG variable, so we
3328# always use install-sh in "make install-strip", and initialize
3329# STRIPPROG with the value of the STRIP variable (set by the user).
3330AC_DEFUN([AM_PROG_INSTALL_STRIP],
3331[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3332# Installed binaries are usually stripped using 'strip' when the user
3333# run "make install-strip".  However 'strip' might not be the right
3334# tool to use in cross-compilation environments, therefore Automake
3335# will honor the 'STRIP' environment variable to overrule this program.
3336dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3337if test "$cross_compiling" != no; then
3338  AC_CHECK_TOOL([STRIP], [strip], :)
3339fi
3340INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3341AC_SUBST([INSTALL_STRIP_PROGRAM])])
3342
3343# Copyright (C) 2006-2021 Free Software Foundation, Inc.
3344#
3345# This file is free software; the Free Software Foundation
3346# gives unlimited permission to copy and/or distribute it,
3347# with or without modifications, as long as this notice is preserved.
3348
3349# _AM_SUBST_NOTMAKE(VARIABLE)
3350# ---------------------------
3351# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3352# This macro is traced by Automake.
3353AC_DEFUN([_AM_SUBST_NOTMAKE])
3354
3355# AM_SUBST_NOTMAKE(VARIABLE)
3356# --------------------------
3357# Public sister of _AM_SUBST_NOTMAKE.
3358AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3359
3360# Check how to create a tarball.                            -*- Autoconf -*-
3361
3362# Copyright (C) 2004-2021 Free Software Foundation, Inc.
3363#
3364# This file is free software; the Free Software Foundation
3365# gives unlimited permission to copy and/or distribute it,
3366# with or without modifications, as long as this notice is preserved.
3367
3368# _AM_PROG_TAR(FORMAT)
3369# --------------------
3370# Check how to create a tarball in format FORMAT.
3371# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3372#
3373# Substitute a variable $(am__tar) that is a command
3374# writing to stdout a FORMAT-tarball containing the directory
3375# $tardir.
3376#     tardir=directory && $(am__tar) > result.tar
3377#
3378# Substitute a variable $(am__untar) that extract such
3379# a tarball read from stdin.
3380#     $(am__untar) < result.tar
3381#
3382AC_DEFUN([_AM_PROG_TAR],
3383[# Always define AMTAR for backward compatibility.  Yes, it's still used
3384# in the wild :-(  We should find a proper way to deprecate it ...
3385AC_SUBST([AMTAR], ['$${TAR-tar}'])
3386
3387# We'll loop over all known methods to create a tar archive until one works.
3388_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3389
3390m4_if([$1], [v7],
3391  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3392
3393  [m4_case([$1],
3394    [ustar],
3395     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3396      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3397      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3398      # and bug#13588).
3399      am_max_uid=2097151 # 2^21 - 1
3400      am_max_gid=$am_max_uid
3401      # The $UID and $GID variables are not portable, so we need to resort
3402      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3403      # below are definitely unexpected, so allow the users to see them
3404      # (that is, avoid stderr redirection).
3405      am_uid=`id -u || echo unknown`
3406      am_gid=`id -g || echo unknown`
3407      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3408      if test $am_uid -le $am_max_uid; then
3409         AC_MSG_RESULT([yes])
3410      else
3411         AC_MSG_RESULT([no])
3412         _am_tools=none
3413      fi
3414      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3415      if test $am_gid -le $am_max_gid; then
3416         AC_MSG_RESULT([yes])
3417      else
3418        AC_MSG_RESULT([no])
3419        _am_tools=none
3420      fi],
3421
3422  [pax],
3423    [],
3424
3425  [m4_fatal([Unknown tar format])])
3426
3427  AC_MSG_CHECKING([how to create a $1 tar archive])
3428
3429  # Go ahead even if we have the value already cached.  We do so because we
3430  # need to set the values for the 'am__tar' and 'am__untar' variables.
3431  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3432
3433  for _am_tool in $_am_tools; do
3434    case $_am_tool in
3435    gnutar)
3436      for _am_tar in tar gnutar gtar; do
3437        AM_RUN_LOG([$_am_tar --version]) && break
3438      done
3439      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3440      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3441      am__untar="$_am_tar -xf -"
3442      ;;
3443    plaintar)
3444      # Must skip GNU tar: if it does not support --format= it doesn't create
3445      # ustar tarball either.
3446      (tar --version) >/dev/null 2>&1 && continue
3447      am__tar='tar chf - "$$tardir"'
3448      am__tar_='tar chf - "$tardir"'
3449      am__untar='tar xf -'
3450      ;;
3451    pax)
3452      am__tar='pax -L -x $1 -w "$$tardir"'
3453      am__tar_='pax -L -x $1 -w "$tardir"'
3454      am__untar='pax -r'
3455      ;;
3456    cpio)
3457      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3458      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3459      am__untar='cpio -i -H $1 -d'
3460      ;;
3461    none)
3462      am__tar=false
3463      am__tar_=false
3464      am__untar=false
3465      ;;
3466    esac
3467
3468    # If the value was cached, stop now.  We just wanted to have am__tar
3469    # and am__untar set.
3470    test -n "${am_cv_prog_tar_$1}" && break
3471
3472    # tar/untar a dummy directory, and stop if the command works.
3473    rm -rf conftest.dir
3474    mkdir conftest.dir
3475    echo GrepMe > conftest.dir/file
3476    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3477    rm -rf conftest.dir
3478    if test -s conftest.tar; then
3479      AM_RUN_LOG([$am__untar <conftest.tar])
3480      AM_RUN_LOG([cat conftest.dir/file])
3481      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3482    fi
3483  done
3484  rm -rf conftest.dir
3485
3486  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3487  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3488
3489AC_SUBST([am__tar])
3490AC_SUBST([am__untar])
3491]) # _AM_PROG_TAR
3492
3493m4_include([m4/libtool.m4])
3494m4_include([m4/ltoptions.m4])
3495m4_include([m4/ltsugar.m4])
3496m4_include([m4/ltversion.m4])
3497m4_include([m4/lt~obsolete.m4])
3498