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