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