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