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