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