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