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