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