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