aclocal.m4 revision 46845023
1# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
2
3# Copyright (C) 1996-2020 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.69],,
18[m4_warning([this file was generated for autoconf 2.69.
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, 2015, Oracle and/or its affiliates. All rights reserved.
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.19.2])
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_PROGS(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 flexibilty 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 flexibilty 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 flexibilty 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 flexibilty 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 flexibilty 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 flexibilty 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 flexibilty 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 flexibilty 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 flexibilty 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		AC_REQUIRE([AC_PROG_CC_C99])
1903	],
1904	[C++], [
1905		AC_REQUIRE([AC_PROG_CXX])
1906	]
1907)
1908AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
1909AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1910AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1911]) # XORG_COMPILER_BRAND
1912
1913# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
1914# ---------------
1915# Minimum version: 1.16.0
1916#
1917# Test if the compiler works when passed the given flag as a command line argument.
1918# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
1919# next flag in the list until there are no more options.
1920#
1921# Note that this does not guarantee that the compiler supports the flag as some
1922# compilers will simply ignore arguments that they do not understand, but we do
1923# attempt to weed out false positives by using -Werror=unknown-warning-option and
1924# -Werror=unused-command-line-argument
1925#
1926AC_DEFUN([XORG_TESTSET_CFLAG], [
1927m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1928m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1929
1930AC_LANG_COMPILER_REQUIRE
1931
1932AC_LANG_CASE(
1933	[C], [
1934		AC_REQUIRE([AC_PROG_CC_C99])
1935		define([PREFIX], [C])
1936		define([CACHE_PREFIX], [cc])
1937		define([COMPILER], [$CC])
1938	],
1939	[C++], [
1940		define([PREFIX], [CXX])
1941		define([CACHE_PREFIX], [cxx])
1942		define([COMPILER], [$CXX])
1943	]
1944)
1945
1946[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1947
1948if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
1949	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1950	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
1951			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
1952			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1953					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
1954					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
1955	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
1956	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1957fi
1958
1959if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
1960	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
1961		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1962	fi
1963	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1964	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
1965			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
1966			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1967					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
1968					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
1969	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
1970	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1971fi
1972
1973found="no"
1974m4_foreach([flag], m4_cdr($@), [
1975	if test $found = "no" ; then
1976		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
1977			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1978		fi
1979
1980		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
1981			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1982		fi
1983
1984		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1985
1986dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
1987		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
1988		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
1989		AC_CACHE_VAL($cacheid,
1990			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
1991					     [eval $cacheid=yes],
1992					     [eval $cacheid=no])])
1993
1994		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1995
1996		eval supported=\$$cacheid
1997		AC_MSG_RESULT([$supported])
1998		if test "$supported" = "yes" ; then
1999			$1="$$1 ]flag["
2000			found="yes"
2001		fi
2002	fi
2003])
2004]) # XORG_TESTSET_CFLAG
2005
2006# XORG_COMPILER_FLAGS
2007# ---------------
2008# Minimum version: 1.16.0
2009#
2010# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2011# arguments supported by the selected compiler which do NOT alter the generated
2012# code.  These arguments will cause the compiler to print various warnings
2013# during compilation AND turn a conservative set of warnings into errors.
2014#
2015# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2016# future versions of util-macros as options are added to new compilers.
2017#
2018AC_DEFUN([XORG_COMPILER_FLAGS], [
2019AC_REQUIRE([XORG_COMPILER_BRAND])
2020
2021AC_ARG_ENABLE(selective-werror,
2022              AS_HELP_STRING([--disable-selective-werror],
2023                             [Turn off selective compiler errors. (default: enabled)]),
2024              [SELECTIVE_WERROR=$enableval],
2025              [SELECTIVE_WERROR=yes])
2026
2027AC_LANG_CASE(
2028        [C], [
2029                define([PREFIX], [C])
2030        ],
2031        [C++], [
2032                define([PREFIX], [CXX])
2033        ]
2034)
2035# -v is too short to test reliably with XORG_TESTSET_CFLAG
2036if test "x$SUNCC" = "xyes"; then
2037    [BASE_]PREFIX[FLAGS]="-v"
2038else
2039    [BASE_]PREFIX[FLAGS]=""
2040fi
2041
2042# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2043XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2044XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2045XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2046XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2047
2048AC_LANG_CASE(
2049	[C], [
2050		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2051		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2052		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2053		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2054		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2055		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2056	]
2057)
2058
2059# This chunk adds additional warnings that could catch undesired effects.
2060XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2061XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2062XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2063XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2064XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2065XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2066XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2067
2068# These are currently disabled because they are noisy.  They will be enabled
2069# in the future once the codebase is sufficiently modernized to silence
2070# them.  For now, I don't want them to drown out the other warnings.
2071# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2072# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2073# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2074
2075# Turn some warnings into errors, so we don't accidently get successful builds
2076# when there are problems that should be fixed.
2077
2078if test "x$SELECTIVE_WERROR" = "xyes" ; then
2079XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2080XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2081XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2082XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2083XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2084XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2085XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2086XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2087XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2088XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2089XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2090XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2091XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2092else
2093AC_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])
2094XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2095XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2096XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2097XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2098XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2099XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2100XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2101XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2102XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2103XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2104XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2105XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2106XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2107fi
2108
2109AC_SUBST([BASE_]PREFIX[FLAGS])
2110]) # XORG_COMPILER_FLAGS
2111
2112# XORG_CWARNFLAGS
2113# ---------------
2114# Minimum version: 1.2.0
2115# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2116#
2117# Defines CWARNFLAGS to enable C compiler warnings.
2118#
2119# This function is deprecated because it defines -fno-strict-aliasing
2120# which alters the code generated by the compiler.  If -fno-strict-aliasing
2121# is needed, then it should be added explicitly in the module when
2122# it is updated to use BASE_CFLAGS.
2123#
2124AC_DEFUN([XORG_CWARNFLAGS], [
2125AC_REQUIRE([XORG_COMPILER_FLAGS])
2126AC_REQUIRE([XORG_COMPILER_BRAND])
2127AC_LANG_CASE(
2128	[C], [
2129		CWARNFLAGS="$BASE_CFLAGS"
2130		if  test "x$GCC" = xyes ; then
2131		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2132		fi
2133		AC_SUBST(CWARNFLAGS)
2134	]
2135)
2136]) # XORG_CWARNFLAGS
2137
2138# XORG_STRICT_OPTION
2139# -----------------------
2140# Minimum version: 1.3.0
2141#
2142# Add configure option to enable strict compilation flags, such as treating
2143# warnings as fatal errors.
2144# If --enable-strict-compilation is passed to configure, adds strict flags to
2145# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2146#
2147# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2148# when strict compilation is unconditionally desired.
2149AC_DEFUN([XORG_STRICT_OPTION], [
2150AC_REQUIRE([XORG_CWARNFLAGS])
2151AC_REQUIRE([XORG_COMPILER_FLAGS])
2152
2153AC_ARG_ENABLE(strict-compilation,
2154			  AS_HELP_STRING([--enable-strict-compilation],
2155			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2156			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2157
2158AC_LANG_CASE(
2159        [C], [
2160                define([PREFIX], [C])
2161        ],
2162        [C++], [
2163                define([PREFIX], [CXX])
2164        ]
2165)
2166
2167[STRICT_]PREFIX[FLAGS]=""
2168XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2169XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2170
2171# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2172# activate it with -Werror, so we add it here explicitly.
2173XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2174
2175if test "x$STRICT_COMPILE" = "xyes"; then
2176    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2177    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2178fi
2179AC_SUBST([STRICT_]PREFIX[FLAGS])
2180AC_SUBST([BASE_]PREFIX[FLAGS])
2181AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2182]) # XORG_STRICT_OPTION
2183
2184# XORG_DEFAULT_OPTIONS
2185# --------------------
2186# Minimum version: 1.3.0
2187#
2188# Defines default options for X.Org modules.
2189#
2190AC_DEFUN([XORG_DEFAULT_OPTIONS], [
2191AC_REQUIRE([AC_PROG_INSTALL])
2192XORG_COMPILER_FLAGS
2193XORG_CWARNFLAGS
2194XORG_STRICT_OPTION
2195XORG_RELEASE_VERSION
2196XORG_CHANGELOG
2197XORG_INSTALL
2198XORG_MANPAGE_SECTIONS
2199m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2200    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2201]) # XORG_DEFAULT_OPTIONS
2202
2203# XORG_INSTALL()
2204# ----------------
2205# Minimum version: 1.4.0
2206#
2207# Defines the variable INSTALL_CMD as the command to copy
2208# INSTALL from $prefix/share/util-macros.
2209#
2210AC_DEFUN([XORG_INSTALL], [
2211AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2212macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2213INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2214mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2215|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
2216touch \$(top_srcdir)/INSTALL; \
2217echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
2218AC_SUBST([INSTALL_CMD])
2219]) # XORG_INSTALL
2220dnl Copyright 2005 Red Hat, Inc
2221dnl
2222dnl Permission to use, copy, modify, distribute, and sell this software and its
2223dnl documentation for any purpose is hereby granted without fee, provided that
2224dnl the above copyright notice appear in all copies and that both that
2225dnl copyright notice and this permission notice appear in supporting
2226dnl documentation.
2227dnl
2228dnl The above copyright notice and this permission notice shall be included
2229dnl in all copies or substantial portions of the Software.
2230dnl
2231dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2232dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2233dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2234dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2235dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2236dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2237dnl OTHER DEALINGS IN THE SOFTWARE.
2238dnl
2239dnl Except as contained in this notice, the name of the copyright holders shall
2240dnl not be used in advertising or otherwise to promote the sale, use or
2241dnl other dealings in this Software without prior written authorization
2242dnl from the copyright holders.
2243dnl
2244
2245# XORG_RELEASE_VERSION
2246# --------------------
2247# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2248
2249AC_DEFUN([XORG_RELEASE_VERSION],[
2250	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2251		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2252		[Major version of this package])
2253	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2254	if test "x$PVM" = "x"; then
2255		PVM="0"
2256	fi
2257	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2258		[$PVM],
2259		[Minor version of this package])
2260	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2261	if test "x$PVP" = "x"; then
2262		PVP="0"
2263	fi
2264	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2265		[$PVP],
2266		[Patch version of this package])
2267])
2268
2269# XORG_CHANGELOG()
2270# ----------------
2271# Minimum version: 1.2.0
2272#
2273# Defines the variable CHANGELOG_CMD as the command to generate
2274# ChangeLog from git.
2275#
2276#
2277AC_DEFUN([XORG_CHANGELOG], [
2278CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
2279mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2280|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
2281touch \$(top_srcdir)/ChangeLog; \
2282echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
2283AC_SUBST([CHANGELOG_CMD])
2284]) # XORG_CHANGELOG
2285
2286dnl Copyright 2005 Red Hat, Inc
2287dnl 
2288dnl Permission to use, copy, modify, distribute, and sell this software and its
2289dnl documentation for any purpose is hereby granted without fee, provided that
2290dnl the above copyright notice appear in all copies and that both that
2291dnl copyright notice and this permission notice appear in supporting
2292dnl documentation.
2293dnl 
2294dnl The above copyright notice and this permission notice shall be included
2295dnl in all copies or substantial portions of the Software.
2296dnl 
2297dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2298dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2299dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2300dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2301dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2302dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2303dnl OTHER DEALINGS IN THE SOFTWARE.
2304dnl 
2305dnl Except as contained in this notice, the name of the copyright holders shall
2306dnl not be used in advertising or otherwise to promote the sale, use or
2307dnl other dealings in this Software without prior written authorization
2308dnl from the copyright holders.
2309dnl 
2310
2311# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2312# --------------------------
2313# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
2314# is defined, then add the given PROTO to $REQUIRED_MODULES.
2315
2316AC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2317	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2318	SAVE_CFLAGS="$CFLAGS"
2319	CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`"
2320	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2321#include "xorg-server.h"
2322#if !defined $1
2323#error $1 not defined
2324#endif
2325		]])],
2326		[_EXT_CHECK=yes],
2327		[_EXT_CHECK=no])
2328	CFLAGS="$SAVE_CFLAGS"
2329	AC_MSG_CHECKING([if $1 is defined])
2330	AC_MSG_RESULT([$_EXT_CHECK])
2331	if test "$_EXT_CHECK" != no; then
2332		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2333	fi
2334])
2335
2336# Copyright (C) 2002-2020 Free Software Foundation, Inc.
2337#
2338# This file is free software; the Free Software Foundation
2339# gives unlimited permission to copy and/or distribute it,
2340# with or without modifications, as long as this notice is preserved.
2341
2342# AM_AUTOMAKE_VERSION(VERSION)
2343# ----------------------------
2344# Automake X.Y traces this macro to ensure aclocal.m4 has been
2345# generated from the m4 files accompanying Automake X.Y.
2346# (This private macro should not be called outside this file.)
2347AC_DEFUN([AM_AUTOMAKE_VERSION],
2348[am__api_version='1.16'
2349dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2350dnl require some minimum version.  Point them to the right macro.
2351m4_if([$1], [1.16.2], [],
2352      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2353])
2354
2355# _AM_AUTOCONF_VERSION(VERSION)
2356# -----------------------------
2357# aclocal traces this macro to find the Autoconf version.
2358# This is a private macro too.  Using m4_define simplifies
2359# the logic in aclocal, which can simply ignore this definition.
2360m4_define([_AM_AUTOCONF_VERSION], [])
2361
2362# AM_SET_CURRENT_AUTOMAKE_VERSION
2363# -------------------------------
2364# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2365# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2366AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2367[AM_AUTOMAKE_VERSION([1.16.2])dnl
2368m4_ifndef([AC_AUTOCONF_VERSION],
2369  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2370_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2371
2372# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2373
2374# Copyright (C) 2001-2020 Free Software Foundation, Inc.
2375#
2376# This file is free software; the Free Software Foundation
2377# gives unlimited permission to copy and/or distribute it,
2378# with or without modifications, as long as this notice is preserved.
2379
2380# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2381# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2382# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2383#
2384# Of course, Automake must honor this variable whenever it calls a
2385# tool from the auxiliary directory.  The problem is that $srcdir (and
2386# therefore $ac_aux_dir as well) can be either absolute or relative,
2387# depending on how configure is run.  This is pretty annoying, since
2388# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2389# source directory, any form will work fine, but in subdirectories a
2390# relative path needs to be adjusted first.
2391#
2392# $ac_aux_dir/missing
2393#    fails when called from a subdirectory if $ac_aux_dir is relative
2394# $top_srcdir/$ac_aux_dir/missing
2395#    fails if $ac_aux_dir is absolute,
2396#    fails when called from a subdirectory in a VPATH build with
2397#          a relative $ac_aux_dir
2398#
2399# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2400# are both prefixed by $srcdir.  In an in-source build this is usually
2401# harmless because $srcdir is '.', but things will broke when you
2402# start a VPATH build or use an absolute $srcdir.
2403#
2404# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2405# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2406#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2407# and then we would define $MISSING as
2408#   MISSING="\${SHELL} $am_aux_dir/missing"
2409# This will work as long as MISSING is not called from configure, because
2410# unfortunately $(top_srcdir) has no meaning in configure.
2411# However there are other variables, like CC, which are often used in
2412# configure, and could therefore not use this "fixed" $ac_aux_dir.
2413#
2414# Another solution, used here, is to always expand $ac_aux_dir to an
2415# absolute PATH.  The drawback is that using absolute paths prevent a
2416# configured tree to be moved without reconfiguration.
2417
2418AC_DEFUN([AM_AUX_DIR_EXPAND],
2419[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2420# Expand $ac_aux_dir to an absolute path.
2421am_aux_dir=`cd "$ac_aux_dir" && pwd`
2422])
2423
2424# AM_CONDITIONAL                                            -*- Autoconf -*-
2425
2426# Copyright (C) 1997-2020 Free Software Foundation, Inc.
2427#
2428# This file is free software; the Free Software Foundation
2429# gives unlimited permission to copy and/or distribute it,
2430# with or without modifications, as long as this notice is preserved.
2431
2432# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2433# -------------------------------------
2434# Define a conditional.
2435AC_DEFUN([AM_CONDITIONAL],
2436[AC_PREREQ([2.52])dnl
2437 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2438       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2439AC_SUBST([$1_TRUE])dnl
2440AC_SUBST([$1_FALSE])dnl
2441_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2442_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2443m4_define([_AM_COND_VALUE_$1], [$2])dnl
2444if $2; then
2445  $1_TRUE=
2446  $1_FALSE='#'
2447else
2448  $1_TRUE='#'
2449  $1_FALSE=
2450fi
2451AC_CONFIG_COMMANDS_PRE(
2452[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2453  AC_MSG_ERROR([[conditional "$1" was never defined.
2454Usually this means the macro was only invoked conditionally.]])
2455fi])])
2456
2457# Copyright (C) 1999-2020 Free Software Foundation, Inc.
2458#
2459# This file is free software; the Free Software Foundation
2460# gives unlimited permission to copy and/or distribute it,
2461# with or without modifications, as long as this notice is preserved.
2462
2463
2464# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2465# written in clear, in which case automake, when reading aclocal.m4,
2466# will think it sees a *use*, and therefore will trigger all it's
2467# C support machinery.  Also note that it means that autoscan, seeing
2468# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2469
2470
2471# _AM_DEPENDENCIES(NAME)
2472# ----------------------
2473# See how the compiler implements dependency checking.
2474# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2475# We try a few techniques and use that to set a single cache variable.
2476#
2477# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2478# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2479# dependency, and given that the user is not expected to run this macro,
2480# just rely on AC_PROG_CC.
2481AC_DEFUN([_AM_DEPENDENCIES],
2482[AC_REQUIRE([AM_SET_DEPDIR])dnl
2483AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2484AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2485AC_REQUIRE([AM_DEP_TRACK])dnl
2486
2487m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2488      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2489      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2490      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2491      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2492      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2493                    [depcc="$$1"   am_compiler_list=])
2494
2495AC_CACHE_CHECK([dependency style of $depcc],
2496               [am_cv_$1_dependencies_compiler_type],
2497[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2498  # We make a subdir and do the tests there.  Otherwise we can end up
2499  # making bogus files that we don't know about and never remove.  For
2500  # instance it was reported that on HP-UX the gcc test will end up
2501  # making a dummy file named 'D' -- because '-MD' means "put the output
2502  # in D".
2503  rm -rf conftest.dir
2504  mkdir conftest.dir
2505  # Copy depcomp to subdir because otherwise we won't find it if we're
2506  # using a relative directory.
2507  cp "$am_depcomp" conftest.dir
2508  cd conftest.dir
2509  # We will build objects and dependencies in a subdirectory because
2510  # it helps to detect inapplicable dependency modes.  For instance
2511  # both Tru64's cc and ICC support -MD to output dependencies as a
2512  # side effect of compilation, but ICC will put the dependencies in
2513  # the current directory while Tru64 will put them in the object
2514  # directory.
2515  mkdir sub
2516
2517  am_cv_$1_dependencies_compiler_type=none
2518  if test "$am_compiler_list" = ""; then
2519     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2520  fi
2521  am__universal=false
2522  m4_case([$1], [CC],
2523    [case " $depcc " in #(
2524     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2525     esac],
2526    [CXX],
2527    [case " $depcc " in #(
2528     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2529     esac])
2530
2531  for depmode in $am_compiler_list; do
2532    # Setup a source with many dependencies, because some compilers
2533    # like to wrap large dependency lists on column 80 (with \), and
2534    # we should not choose a depcomp mode which is confused by this.
2535    #
2536    # We need to recreate these files for each test, as the compiler may
2537    # overwrite some of them when testing with obscure command lines.
2538    # This happens at least with the AIX C compiler.
2539    : > sub/conftest.c
2540    for i in 1 2 3 4 5 6; do
2541      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2542      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2543      # Solaris 10 /bin/sh.
2544      echo '/* dummy */' > sub/conftst$i.h
2545    done
2546    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2547
2548    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2549    # mode.  It turns out that the SunPro C++ compiler does not properly
2550    # handle '-M -o', and we need to detect this.  Also, some Intel
2551    # versions had trouble with output in subdirs.
2552    am__obj=sub/conftest.${OBJEXT-o}
2553    am__minus_obj="-o $am__obj"
2554    case $depmode in
2555    gcc)
2556      # This depmode causes a compiler race in universal mode.
2557      test "$am__universal" = false || continue
2558      ;;
2559    nosideeffect)
2560      # After this tag, mechanisms are not by side-effect, so they'll
2561      # only be used when explicitly requested.
2562      if test "x$enable_dependency_tracking" = xyes; then
2563	continue
2564      else
2565	break
2566      fi
2567      ;;
2568    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2569      # This compiler won't grok '-c -o', but also, the minuso test has
2570      # not run yet.  These depmodes are late enough in the game, and
2571      # so weak that their functioning should not be impacted.
2572      am__obj=conftest.${OBJEXT-o}
2573      am__minus_obj=
2574      ;;
2575    none) break ;;
2576    esac
2577    if depmode=$depmode \
2578       source=sub/conftest.c object=$am__obj \
2579       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2580       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2581         >/dev/null 2>conftest.err &&
2582       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2583       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2584       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2585       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2586      # icc doesn't choke on unknown options, it will just issue warnings
2587      # or remarks (even with -Werror).  So we grep stderr for any message
2588      # that says an option was ignored or not supported.
2589      # When given -MP, icc 7.0 and 7.1 complain thusly:
2590      #   icc: Command line warning: ignoring option '-M'; no argument required
2591      # The diagnosis changed in icc 8.0:
2592      #   icc: Command line remark: option '-MP' not supported
2593      if (grep 'ignoring option' conftest.err ||
2594          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2595        am_cv_$1_dependencies_compiler_type=$depmode
2596        break
2597      fi
2598    fi
2599  done
2600
2601  cd ..
2602  rm -rf conftest.dir
2603else
2604  am_cv_$1_dependencies_compiler_type=none
2605fi
2606])
2607AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2608AM_CONDITIONAL([am__fastdep$1], [
2609  test "x$enable_dependency_tracking" != xno \
2610  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2611])
2612
2613
2614# AM_SET_DEPDIR
2615# -------------
2616# Choose a directory name for dependency files.
2617# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2618AC_DEFUN([AM_SET_DEPDIR],
2619[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2620AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2621])
2622
2623
2624# AM_DEP_TRACK
2625# ------------
2626AC_DEFUN([AM_DEP_TRACK],
2627[AC_ARG_ENABLE([dependency-tracking], [dnl
2628AS_HELP_STRING(
2629  [--enable-dependency-tracking],
2630  [do not reject slow dependency extractors])
2631AS_HELP_STRING(
2632  [--disable-dependency-tracking],
2633  [speeds up one-time build])])
2634if test "x$enable_dependency_tracking" != xno; then
2635  am_depcomp="$ac_aux_dir/depcomp"
2636  AMDEPBACKSLASH='\'
2637  am__nodep='_no'
2638fi
2639AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2640AC_SUBST([AMDEPBACKSLASH])dnl
2641_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2642AC_SUBST([am__nodep])dnl
2643_AM_SUBST_NOTMAKE([am__nodep])dnl
2644])
2645
2646# Generate code to set up dependency tracking.              -*- Autoconf -*-
2647
2648# Copyright (C) 1999-2020 Free Software Foundation, Inc.
2649#
2650# This file is free software; the Free Software Foundation
2651# gives unlimited permission to copy and/or distribute it,
2652# with or without modifications, as long as this notice is preserved.
2653
2654# _AM_OUTPUT_DEPENDENCY_COMMANDS
2655# ------------------------------
2656AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2657[{
2658  # Older Autoconf quotes --file arguments for eval, but not when files
2659  # are listed without --file.  Let's play safe and only enable the eval
2660  # if we detect the quoting.
2661  # TODO: see whether this extra hack can be removed once we start
2662  # requiring Autoconf 2.70 or later.
2663  AS_CASE([$CONFIG_FILES],
2664          [*\'*], [eval set x "$CONFIG_FILES"],
2665          [*], [set x $CONFIG_FILES])
2666  shift
2667  # Used to flag and report bootstrapping failures.
2668  am_rc=0
2669  for am_mf
2670  do
2671    # Strip MF so we end up with the name of the file.
2672    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2673    # Check whether this is an Automake generated Makefile which includes
2674    # dependency-tracking related rules and includes.
2675    # Grep'ing the whole file directly is not great: AIX grep has a line
2676    # limit of 2048, but all sed's we know have understand at least 4000.
2677    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2678      || continue
2679    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2680    am_filepart=`AS_BASENAME(["$am_mf"])`
2681    AM_RUN_LOG([cd "$am_dirpart" \
2682      && sed -e '/# am--include-marker/d' "$am_filepart" \
2683        | $MAKE -f - am--depfiles]) || am_rc=$?
2684  done
2685  if test $am_rc -ne 0; then
2686    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
2687    for automatic dependency tracking.  If GNU make was not used, consider
2688    re-running the configure script with MAKE="gmake" (or whatever is
2689    necessary).  You can also try re-running configure with the
2690    '--disable-dependency-tracking' option to at least be able to build
2691    the package (albeit without support for automatic dependency tracking).])
2692  fi
2693  AS_UNSET([am_dirpart])
2694  AS_UNSET([am_filepart])
2695  AS_UNSET([am_mf])
2696  AS_UNSET([am_rc])
2697  rm -f conftest-deps.mk
2698}
2699])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2700
2701
2702# AM_OUTPUT_DEPENDENCY_COMMANDS
2703# -----------------------------
2704# This macro should only be invoked once -- use via AC_REQUIRE.
2705#
2706# This code is only required when automatic dependency tracking is enabled.
2707# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2708# order to bootstrap the dependency handling code.
2709AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2710[AC_CONFIG_COMMANDS([depfiles],
2711     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2712     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2713
2714# Do all the work for Automake.                             -*- Autoconf -*-
2715
2716# Copyright (C) 1996-2020 Free Software Foundation, Inc.
2717#
2718# This file is free software; the Free Software Foundation
2719# gives unlimited permission to copy and/or distribute it,
2720# with or without modifications, as long as this notice is preserved.
2721
2722# This macro actually does too much.  Some checks are only needed if
2723# your package does certain things.  But this isn't really a big deal.
2724
2725dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2726m4_define([AC_PROG_CC],
2727m4_defn([AC_PROG_CC])
2728[_AM_PROG_CC_C_O
2729])
2730
2731# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2732# AM_INIT_AUTOMAKE([OPTIONS])
2733# -----------------------------------------------
2734# The call with PACKAGE and VERSION arguments is the old style
2735# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2736# and VERSION should now be passed to AC_INIT and removed from
2737# the call to AM_INIT_AUTOMAKE.
2738# We support both call styles for the transition.  After
2739# the next Automake release, Autoconf can make the AC_INIT
2740# arguments mandatory, and then we can depend on a new Autoconf
2741# release and drop the old call support.
2742AC_DEFUN([AM_INIT_AUTOMAKE],
2743[AC_PREREQ([2.65])dnl
2744dnl Autoconf wants to disallow AM_ names.  We explicitly allow
2745dnl the ones we care about.
2746m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2747AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2748AC_REQUIRE([AC_PROG_INSTALL])dnl
2749if test "`cd $srcdir && pwd`" != "`pwd`"; then
2750  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2751  # is not polluted with repeated "-I."
2752  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2753  # test to see if srcdir already configured
2754  if test -f $srcdir/config.status; then
2755    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2756  fi
2757fi
2758
2759# test whether we have cygpath
2760if test -z "$CYGPATH_W"; then
2761  if (cygpath --version) >/dev/null 2>/dev/null; then
2762    CYGPATH_W='cygpath -w'
2763  else
2764    CYGPATH_W=echo
2765  fi
2766fi
2767AC_SUBST([CYGPATH_W])
2768
2769# Define the identity of the package.
2770dnl Distinguish between old-style and new-style calls.
2771m4_ifval([$2],
2772[AC_DIAGNOSE([obsolete],
2773             [$0: two- and three-arguments forms are deprecated.])
2774m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2775 AC_SUBST([PACKAGE], [$1])dnl
2776 AC_SUBST([VERSION], [$2])],
2777[_AM_SET_OPTIONS([$1])dnl
2778dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2779m4_if(
2780  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2781  [ok:ok],,
2782  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2783 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2784 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2785
2786_AM_IF_OPTION([no-define],,
2787[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2788 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2789
2790# Some tools Automake needs.
2791AC_REQUIRE([AM_SANITY_CHECK])dnl
2792AC_REQUIRE([AC_ARG_PROGRAM])dnl
2793AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2794AM_MISSING_PROG([AUTOCONF], [autoconf])
2795AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2796AM_MISSING_PROG([AUTOHEADER], [autoheader])
2797AM_MISSING_PROG([MAKEINFO], [makeinfo])
2798AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2799AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2800AC_REQUIRE([AC_PROG_MKDIR_P])dnl
2801# For better backward compatibility.  To be removed once Automake 1.9.x
2802# dies out for good.  For more background, see:
2803# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2804# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2805AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2806# We need awk for the "check" target (and possibly the TAP driver).  The
2807# system "awk" is bad on some platforms.
2808AC_REQUIRE([AC_PROG_AWK])dnl
2809AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2810AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2811_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2812	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2813			     [_AM_PROG_TAR([v7])])])
2814_AM_IF_OPTION([no-dependencies],,
2815[AC_PROVIDE_IFELSE([AC_PROG_CC],
2816		  [_AM_DEPENDENCIES([CC])],
2817		  [m4_define([AC_PROG_CC],
2818			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2819AC_PROVIDE_IFELSE([AC_PROG_CXX],
2820		  [_AM_DEPENDENCIES([CXX])],
2821		  [m4_define([AC_PROG_CXX],
2822			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2823AC_PROVIDE_IFELSE([AC_PROG_OBJC],
2824		  [_AM_DEPENDENCIES([OBJC])],
2825		  [m4_define([AC_PROG_OBJC],
2826			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2827AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2828		  [_AM_DEPENDENCIES([OBJCXX])],
2829		  [m4_define([AC_PROG_OBJCXX],
2830			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2831])
2832AC_REQUIRE([AM_SILENT_RULES])dnl
2833dnl The testsuite driver may need to know about EXEEXT, so add the
2834dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2835dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2836AC_CONFIG_COMMANDS_PRE(dnl
2837[m4_provide_if([_AM_COMPILER_EXEEXT],
2838  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2839
2840# POSIX will say in a future version that running "rm -f" with no argument
2841# is OK; and we want to be able to make that assumption in our Makefile
2842# recipes.  So use an aggressive probe to check that the usage we want is
2843# actually supported "in the wild" to an acceptable degree.
2844# See automake bug#10828.
2845# To make any issue more visible, cause the running configure to be aborted
2846# by default if the 'rm' program in use doesn't match our expectations; the
2847# user can still override this though.
2848if rm -f && rm -fr && rm -rf; then : OK; else
2849  cat >&2 <<'END'
2850Oops!
2851
2852Your 'rm' program seems unable to run without file operands specified
2853on the command line, even when the '-f' option is present.  This is contrary
2854to the behaviour of most rm programs out there, and not conforming with
2855the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2856
2857Please tell bug-automake@gnu.org about your system, including the value
2858of your $PATH and any error possibly output before this message.  This
2859can help us improve future automake versions.
2860
2861END
2862  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2863    echo 'Configuration will proceed anyway, since you have set the' >&2
2864    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2865    echo >&2
2866  else
2867    cat >&2 <<'END'
2868Aborting the configuration process, to ensure you take notice of the issue.
2869
2870You can download and install GNU coreutils to get an 'rm' implementation
2871that behaves properly: <https://www.gnu.org/software/coreutils/>.
2872
2873If you want to complete the configuration process using your problematic
2874'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2875to "yes", and re-run configure.
2876
2877END
2878    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2879  fi
2880fi
2881dnl The trailing newline in this macro's definition is deliberate, for
2882dnl backward compatibility and to allow trailing 'dnl'-style comments
2883dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2884])
2885
2886dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2887dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2888dnl mangled by Autoconf and run in a shell conditional statement.
2889m4_define([_AC_COMPILER_EXEEXT],
2890m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2891
2892# When config.status generates a header, we must update the stamp-h file.
2893# This file resides in the same directory as the config header
2894# that is generated.  The stamp files are numbered to have different names.
2895
2896# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2897# loop where config.status creates the headers, so we can generate
2898# our stamp files there.
2899AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2900[# Compute $1's index in $config_headers.
2901_am_arg=$1
2902_am_stamp_count=1
2903for _am_header in $config_headers :; do
2904  case $_am_header in
2905    $_am_arg | $_am_arg:* )
2906      break ;;
2907    * )
2908      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2909  esac
2910done
2911echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2912
2913# Copyright (C) 2001-2020 Free Software Foundation, Inc.
2914#
2915# This file is free software; the Free Software Foundation
2916# gives unlimited permission to copy and/or distribute it,
2917# with or without modifications, as long as this notice is preserved.
2918
2919# AM_PROG_INSTALL_SH
2920# ------------------
2921# Define $install_sh.
2922AC_DEFUN([AM_PROG_INSTALL_SH],
2923[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2924if test x"${install_sh+set}" != xset; then
2925  case $am_aux_dir in
2926  *\ * | *\	*)
2927    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2928  *)
2929    install_sh="\${SHELL} $am_aux_dir/install-sh"
2930  esac
2931fi
2932AC_SUBST([install_sh])])
2933
2934# Copyright (C) 2003-2020 Free Software Foundation, Inc.
2935#
2936# This file is free software; the Free Software Foundation
2937# gives unlimited permission to copy and/or distribute it,
2938# with or without modifications, as long as this notice is preserved.
2939
2940# Check whether the underlying file-system supports filenames
2941# with a leading dot.  For instance MS-DOS doesn't.
2942AC_DEFUN([AM_SET_LEADING_DOT],
2943[rm -rf .tst 2>/dev/null
2944mkdir .tst 2>/dev/null
2945if test -d .tst; then
2946  am__leading_dot=.
2947else
2948  am__leading_dot=_
2949fi
2950rmdir .tst 2>/dev/null
2951AC_SUBST([am__leading_dot])])
2952
2953# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2954
2955# Copyright (C) 2001-2020 Free Software Foundation, Inc.
2956#
2957# This file is free software; the Free Software Foundation
2958# gives unlimited permission to copy and/or distribute it,
2959# with or without modifications, as long as this notice is preserved.
2960
2961# AM_MAKE_INCLUDE()
2962# -----------------
2963# Check whether make has an 'include' directive that can support all
2964# the idioms we need for our automatic dependency tracking code.
2965AC_DEFUN([AM_MAKE_INCLUDE],
2966[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
2967cat > confinc.mk << 'END'
2968am__doit:
2969	@echo this is the am__doit target >confinc.out
2970.PHONY: am__doit
2971END
2972am__include="#"
2973am__quote=
2974# BSD make does it like this.
2975echo '.include "confinc.mk" # ignored' > confmf.BSD
2976# Other make implementations (GNU, Solaris 10, AIX) do it like this.
2977echo 'include confinc.mk # ignored' > confmf.GNU
2978_am_result=no
2979for s in GNU BSD; do
2980  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
2981  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
2982      ['0:this is the am__doit target'],
2983      [AS_CASE([$s],
2984          [BSD], [am__include='.include' am__quote='"'],
2985          [am__include='include' am__quote=''])])
2986  if test "$am__include" != "#"; then
2987    _am_result="yes ($s style)"
2988    break
2989  fi
2990done
2991rm -f confinc.* confmf.*
2992AC_MSG_RESULT([${_am_result}])
2993AC_SUBST([am__include])])
2994AC_SUBST([am__quote])])
2995
2996# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2997
2998# Copyright (C) 1997-2020 Free Software Foundation, Inc.
2999#
3000# This file is free software; the Free Software Foundation
3001# gives unlimited permission to copy and/or distribute it,
3002# with or without modifications, as long as this notice is preserved.
3003
3004# AM_MISSING_PROG(NAME, PROGRAM)
3005# ------------------------------
3006AC_DEFUN([AM_MISSING_PROG],
3007[AC_REQUIRE([AM_MISSING_HAS_RUN])
3008$1=${$1-"${am_missing_run}$2"}
3009AC_SUBST($1)])
3010
3011# AM_MISSING_HAS_RUN
3012# ------------------
3013# Define MISSING if not defined so far and test if it is modern enough.
3014# If it is, set am_missing_run to use it, otherwise, to nothing.
3015AC_DEFUN([AM_MISSING_HAS_RUN],
3016[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3017AC_REQUIRE_AUX_FILE([missing])dnl
3018if test x"${MISSING+set}" != xset; then
3019  case $am_aux_dir in
3020  *\ * | *\	*)
3021    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
3022  *)
3023    MISSING="\${SHELL} $am_aux_dir/missing" ;;
3024  esac
3025fi
3026# Use eval to expand $SHELL
3027if eval "$MISSING --is-lightweight"; then
3028  am_missing_run="$MISSING "
3029else
3030  am_missing_run=
3031  AC_MSG_WARN(['missing' script is too old or missing])
3032fi
3033])
3034
3035# Helper functions for option handling.                     -*- Autoconf -*-
3036
3037# Copyright (C) 2001-2020 Free Software Foundation, Inc.
3038#
3039# This file is free software; the Free Software Foundation
3040# gives unlimited permission to copy and/or distribute it,
3041# with or without modifications, as long as this notice is preserved.
3042
3043# _AM_MANGLE_OPTION(NAME)
3044# -----------------------
3045AC_DEFUN([_AM_MANGLE_OPTION],
3046[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3047
3048# _AM_SET_OPTION(NAME)
3049# --------------------
3050# Set option NAME.  Presently that only means defining a flag for this option.
3051AC_DEFUN([_AM_SET_OPTION],
3052[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3053
3054# _AM_SET_OPTIONS(OPTIONS)
3055# ------------------------
3056# OPTIONS is a space-separated list of Automake options.
3057AC_DEFUN([_AM_SET_OPTIONS],
3058[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3059
3060# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
3061# -------------------------------------------
3062# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
3063AC_DEFUN([_AM_IF_OPTION],
3064[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3065
3066# Copyright (C) 1999-2020 Free Software Foundation, Inc.
3067#
3068# This file is free software; the Free Software Foundation
3069# gives unlimited permission to copy and/or distribute it,
3070# with or without modifications, as long as this notice is preserved.
3071
3072# _AM_PROG_CC_C_O
3073# ---------------
3074# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
3075# to automatically call this.
3076AC_DEFUN([_AM_PROG_CC_C_O],
3077[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3078AC_REQUIRE_AUX_FILE([compile])dnl
3079AC_LANG_PUSH([C])dnl
3080AC_CACHE_CHECK(
3081  [whether $CC understands -c and -o together],
3082  [am_cv_prog_cc_c_o],
3083  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
3084  # Make sure it works both with $CC and with simple cc.
3085  # Following AC_PROG_CC_C_O, we do the test twice because some
3086  # compilers refuse to overwrite an existing .o file with -o,
3087  # though they will create one.
3088  am_cv_prog_cc_c_o=yes
3089  for am_i in 1 2; do
3090    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
3091         && test -f conftest2.$ac_objext; then
3092      : OK
3093    else
3094      am_cv_prog_cc_c_o=no
3095      break
3096    fi
3097  done
3098  rm -f core conftest*
3099  unset am_i])
3100if test "$am_cv_prog_cc_c_o" != yes; then
3101   # Losing compiler, so override with the script.
3102   # FIXME: It is wrong to rewrite CC.
3103   # But if we don't then we get into trouble of one sort or another.
3104   # A longer-term fix would be to have automake use am__CC in this case,
3105   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
3106   CC="$am_aux_dir/compile $CC"
3107fi
3108AC_LANG_POP([C])])
3109
3110# For backward compatibility.
3111AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3112
3113# Copyright (C) 2001-2020 Free Software Foundation, Inc.
3114#
3115# This file is free software; the Free Software Foundation
3116# gives unlimited permission to copy and/or distribute it,
3117# with or without modifications, as long as this notice is preserved.
3118
3119# AM_RUN_LOG(COMMAND)
3120# -------------------
3121# Run COMMAND, save the exit status in ac_status, and log it.
3122# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3123AC_DEFUN([AM_RUN_LOG],
3124[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3125   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3126   ac_status=$?
3127   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3128   (exit $ac_status); }])
3129
3130# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3131
3132# Copyright (C) 1996-2020 Free Software Foundation, Inc.
3133#
3134# This file is free software; the Free Software Foundation
3135# gives unlimited permission to copy and/or distribute it,
3136# with or without modifications, as long as this notice is preserved.
3137
3138# AM_SANITY_CHECK
3139# ---------------
3140AC_DEFUN([AM_SANITY_CHECK],
3141[AC_MSG_CHECKING([whether build environment is sane])
3142# Reject unsafe characters in $srcdir or the absolute working directory
3143# name.  Accept space and tab only in the latter.
3144am_lf='
3145'
3146case `pwd` in
3147  *[[\\\"\#\$\&\'\`$am_lf]]*)
3148    AC_MSG_ERROR([unsafe absolute working directory name]);;
3149esac
3150case $srcdir in
3151  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3152    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3153esac
3154
3155# Do 'set' in a subshell so we don't clobber the current shell's
3156# arguments.  Must try -L first in case configure is actually a
3157# symlink; some systems play weird games with the mod time of symlinks
3158# (eg FreeBSD returns the mod time of the symlink's containing
3159# directory).
3160if (
3161   am_has_slept=no
3162   for am_try in 1 2; do
3163     echo "timestamp, slept: $am_has_slept" > conftest.file
3164     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3165     if test "$[*]" = "X"; then
3166	# -L didn't work.
3167	set X `ls -t "$srcdir/configure" conftest.file`
3168     fi
3169     if test "$[*]" != "X $srcdir/configure conftest.file" \
3170	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3171
3172	# If neither matched, then we have a broken ls.  This can happen
3173	# if, for instance, CONFIG_SHELL is bash and it inherits a
3174	# broken ls alias from the environment.  This has actually
3175	# happened.  Such a system could not be considered "sane".
3176	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3177  alias in your environment])
3178     fi
3179     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3180       break
3181     fi
3182     # Just in case.
3183     sleep 1
3184     am_has_slept=yes
3185   done
3186   test "$[2]" = conftest.file
3187   )
3188then
3189   # Ok.
3190   :
3191else
3192   AC_MSG_ERROR([newly created file is older than distributed files!
3193Check your system clock])
3194fi
3195AC_MSG_RESULT([yes])
3196# If we didn't sleep, we still need to ensure time stamps of config.status and
3197# generated files are strictly newer.
3198am_sleep_pid=
3199if grep 'slept: no' conftest.file >/dev/null 2>&1; then
3200  ( sleep 1 ) &
3201  am_sleep_pid=$!
3202fi
3203AC_CONFIG_COMMANDS_PRE(
3204  [AC_MSG_CHECKING([that generated files are newer than configure])
3205   if test -n "$am_sleep_pid"; then
3206     # Hide warnings about reused PIDs.
3207     wait $am_sleep_pid 2>/dev/null
3208   fi
3209   AC_MSG_RESULT([done])])
3210rm -f conftest.file
3211])
3212
3213# Copyright (C) 2009-2020 Free Software Foundation, Inc.
3214#
3215# This file is free software; the Free Software Foundation
3216# gives unlimited permission to copy and/or distribute it,
3217# with or without modifications, as long as this notice is preserved.
3218
3219# AM_SILENT_RULES([DEFAULT])
3220# --------------------------
3221# Enable less verbose build rules; with the default set to DEFAULT
3222# ("yes" being less verbose, "no" or empty being verbose).
3223AC_DEFUN([AM_SILENT_RULES],
3224[AC_ARG_ENABLE([silent-rules], [dnl
3225AS_HELP_STRING(
3226  [--enable-silent-rules],
3227  [less verbose build output (undo: "make V=1")])
3228AS_HELP_STRING(
3229  [--disable-silent-rules],
3230  [verbose build output (undo: "make V=0")])dnl
3231])
3232case $enable_silent_rules in @%:@ (((
3233  yes) AM_DEFAULT_VERBOSITY=0;;
3234   no) AM_DEFAULT_VERBOSITY=1;;
3235    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3236esac
3237dnl
3238dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3239dnl do not support nested variable expansions.
3240dnl See automake bug#9928 and bug#10237.
3241am_make=${MAKE-make}
3242AC_CACHE_CHECK([whether $am_make supports nested variables],
3243   [am_cv_make_support_nested_variables],
3244   [if AS_ECHO([['TRUE=$(BAR$(V))
3245BAR0=false
3246BAR1=true
3247V=1
3248am__doit:
3249	@$(TRUE)
3250.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3251  am_cv_make_support_nested_variables=yes
3252else
3253  am_cv_make_support_nested_variables=no
3254fi])
3255if test $am_cv_make_support_nested_variables = yes; then
3256  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3257  AM_V='$(V)'
3258  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3259else
3260  AM_V=$AM_DEFAULT_VERBOSITY
3261  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3262fi
3263AC_SUBST([AM_V])dnl
3264AM_SUBST_NOTMAKE([AM_V])dnl
3265AC_SUBST([AM_DEFAULT_V])dnl
3266AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3267AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3268AM_BACKSLASH='\'
3269AC_SUBST([AM_BACKSLASH])dnl
3270_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3271])
3272
3273# Copyright (C) 2001-2020 Free Software Foundation, Inc.
3274#
3275# This file is free software; the Free Software Foundation
3276# gives unlimited permission to copy and/or distribute it,
3277# with or without modifications, as long as this notice is preserved.
3278
3279# AM_PROG_INSTALL_STRIP
3280# ---------------------
3281# One issue with vendor 'install' (even GNU) is that you can't
3282# specify the program used to strip binaries.  This is especially
3283# annoying in cross-compiling environments, where the build's strip
3284# is unlikely to handle the host's binaries.
3285# Fortunately install-sh will honor a STRIPPROG variable, so we
3286# always use install-sh in "make install-strip", and initialize
3287# STRIPPROG with the value of the STRIP variable (set by the user).
3288AC_DEFUN([AM_PROG_INSTALL_STRIP],
3289[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3290# Installed binaries are usually stripped using 'strip' when the user
3291# run "make install-strip".  However 'strip' might not be the right
3292# tool to use in cross-compilation environments, therefore Automake
3293# will honor the 'STRIP' environment variable to overrule this program.
3294dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3295if test "$cross_compiling" != no; then
3296  AC_CHECK_TOOL([STRIP], [strip], :)
3297fi
3298INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3299AC_SUBST([INSTALL_STRIP_PROGRAM])])
3300
3301# Copyright (C) 2006-2020 Free Software Foundation, Inc.
3302#
3303# This file is free software; the Free Software Foundation
3304# gives unlimited permission to copy and/or distribute it,
3305# with or without modifications, as long as this notice is preserved.
3306
3307# _AM_SUBST_NOTMAKE(VARIABLE)
3308# ---------------------------
3309# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3310# This macro is traced by Automake.
3311AC_DEFUN([_AM_SUBST_NOTMAKE])
3312
3313# AM_SUBST_NOTMAKE(VARIABLE)
3314# --------------------------
3315# Public sister of _AM_SUBST_NOTMAKE.
3316AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3317
3318# Check how to create a tarball.                            -*- Autoconf -*-
3319
3320# Copyright (C) 2004-2020 Free Software Foundation, Inc.
3321#
3322# This file is free software; the Free Software Foundation
3323# gives unlimited permission to copy and/or distribute it,
3324# with or without modifications, as long as this notice is preserved.
3325
3326# _AM_PROG_TAR(FORMAT)
3327# --------------------
3328# Check how to create a tarball in format FORMAT.
3329# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3330#
3331# Substitute a variable $(am__tar) that is a command
3332# writing to stdout a FORMAT-tarball containing the directory
3333# $tardir.
3334#     tardir=directory && $(am__tar) > result.tar
3335#
3336# Substitute a variable $(am__untar) that extract such
3337# a tarball read from stdin.
3338#     $(am__untar) < result.tar
3339#
3340AC_DEFUN([_AM_PROG_TAR],
3341[# Always define AMTAR for backward compatibility.  Yes, it's still used
3342# in the wild :-(  We should find a proper way to deprecate it ...
3343AC_SUBST([AMTAR], ['$${TAR-tar}'])
3344
3345# We'll loop over all known methods to create a tar archive until one works.
3346_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3347
3348m4_if([$1], [v7],
3349  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3350
3351  [m4_case([$1],
3352    [ustar],
3353     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3354      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3355      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3356      # and bug#13588).
3357      am_max_uid=2097151 # 2^21 - 1
3358      am_max_gid=$am_max_uid
3359      # The $UID and $GID variables are not portable, so we need to resort
3360      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3361      # below are definitely unexpected, so allow the users to see them
3362      # (that is, avoid stderr redirection).
3363      am_uid=`id -u || echo unknown`
3364      am_gid=`id -g || echo unknown`
3365      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3366      if test $am_uid -le $am_max_uid; then
3367         AC_MSG_RESULT([yes])
3368      else
3369         AC_MSG_RESULT([no])
3370         _am_tools=none
3371      fi
3372      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3373      if test $am_gid -le $am_max_gid; then
3374         AC_MSG_RESULT([yes])
3375      else
3376        AC_MSG_RESULT([no])
3377        _am_tools=none
3378      fi],
3379
3380  [pax],
3381    [],
3382
3383  [m4_fatal([Unknown tar format])])
3384
3385  AC_MSG_CHECKING([how to create a $1 tar archive])
3386
3387  # Go ahead even if we have the value already cached.  We do so because we
3388  # need to set the values for the 'am__tar' and 'am__untar' variables.
3389  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3390
3391  for _am_tool in $_am_tools; do
3392    case $_am_tool in
3393    gnutar)
3394      for _am_tar in tar gnutar gtar; do
3395        AM_RUN_LOG([$_am_tar --version]) && break
3396      done
3397      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3398      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3399      am__untar="$_am_tar -xf -"
3400      ;;
3401    plaintar)
3402      # Must skip GNU tar: if it does not support --format= it doesn't create
3403      # ustar tarball either.
3404      (tar --version) >/dev/null 2>&1 && continue
3405      am__tar='tar chf - "$$tardir"'
3406      am__tar_='tar chf - "$tardir"'
3407      am__untar='tar xf -'
3408      ;;
3409    pax)
3410      am__tar='pax -L -x $1 -w "$$tardir"'
3411      am__tar_='pax -L -x $1 -w "$tardir"'
3412      am__untar='pax -r'
3413      ;;
3414    cpio)
3415      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3416      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3417      am__untar='cpio -i -H $1 -d'
3418      ;;
3419    none)
3420      am__tar=false
3421      am__tar_=false
3422      am__untar=false
3423      ;;
3424    esac
3425
3426    # If the value was cached, stop now.  We just wanted to have am__tar
3427    # and am__untar set.
3428    test -n "${am_cv_prog_tar_$1}" && break
3429
3430    # tar/untar a dummy directory, and stop if the command works.
3431    rm -rf conftest.dir
3432    mkdir conftest.dir
3433    echo GrepMe > conftest.dir/file
3434    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3435    rm -rf conftest.dir
3436    if test -s conftest.tar; then
3437      AM_RUN_LOG([$am__untar <conftest.tar])
3438      AM_RUN_LOG([cat conftest.dir/file])
3439      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3440    fi
3441  done
3442  rm -rf conftest.dir
3443
3444  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3445  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3446
3447AC_SUBST([am__tar])
3448AC_SUBST([am__untar])
3449]) # _AM_PROG_TAR
3450
3451m4_include([m4/libtool.m4])
3452m4_include([m4/ltoptions.m4])
3453m4_include([m4/ltsugar.m4])
3454m4_include([m4/ltversion.m4])
3455m4_include([m4/lt~obsolete.m4])
3456