aclocal.m4 revision c41d98af
1c41d98afSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
23294c433Smrg
39bc46bd4Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
49bc46bd4Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
53294c433Smrg# This file is free software; the Free Software Foundation
63294c433Smrg# gives unlimited permission to copy and/or distribute it,
73294c433Smrg# with or without modifications, as long as this notice is preserved.
83294c433Smrg
93294c433Smrg# This program is distributed in the hope that it will be useful,
103294c433Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
113294c433Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
123294c433Smrg# PARTICULAR PURPOSE.
133294c433Smrg
149bc46bd4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
159bc46bd4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16c41d98afSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17c41d98afSmrg[m4_warning([this file was generated for autoconf 2.68.
189bc46bd4SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
199bc46bd4SmrgIf you have problems, you may need to regenerate the build system entirely.
209bc46bd4SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
213294c433Smrg
22c41d98afSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
23c41d98afSmrgdnl
24c41d98afSmrgdnl This file comes from X.Org's font-util 1.2.0
25c41d98afSmrgdnl
26c41d98afSmrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
27c41d98afSmrgdnl
28c41d98afSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
29c41d98afSmrgdnl copy of this software and associated documentation files (the "Software"),
30c41d98afSmrgdnl to deal in the Software without restriction, including without limitation
31c41d98afSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
32c41d98afSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
33c41d98afSmrgdnl Software is furnished to do so, subject to the following conditions:
34c41d98afSmrgdnl
35c41d98afSmrgdnl The above copyright notice and this permission notice (including the next
36c41d98afSmrgdnl paragraph) shall be included in all copies or substantial portions of the
37c41d98afSmrgdnl Software.
38c41d98afSmrgdnl
39c41d98afSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40c41d98afSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41c41d98afSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
42c41d98afSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43c41d98afSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44c41d98afSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
45c41d98afSmrgdnl DEALINGS IN THE SOFTWARE.
46c41d98afSmrgdnl
47c41d98afSmrgdnl --------------------------------------------------------------------
48c41d98afSmrgdnl
49c41d98afSmrgdnl Copyright 2005 Red Hat, Inc
50c41d98afSmrgdnl
51c41d98afSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
52c41d98afSmrgdnl documentation for any purpose is hereby granted without fee, provided that
53c41d98afSmrgdnl the above copyright notice appear in all copies and that both that
54c41d98afSmrgdnl copyright notice and this permission notice appear in supporting
55c41d98afSmrgdnl documentation.
56c41d98afSmrgdnl
57c41d98afSmrgdnl The above copyright notice and this permission notice shall be included
58c41d98afSmrgdnl in all copies or substantial portions of the Software.
59c41d98afSmrgdnl
60c41d98afSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
61c41d98afSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
62c41d98afSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
63c41d98afSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
64c41d98afSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
65c41d98afSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
66c41d98afSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
67c41d98afSmrgdnl
68c41d98afSmrgdnl Except as contained in this notice, the name of the copyright holders shall
69c41d98afSmrgdnl not be used in advertising or otherwise to promote the sale, use or
70c41d98afSmrgdnl other dealings in this Software without prior written authorization
71c41d98afSmrgdnl from the copyright holders.
72c41d98afSmrg
73c41d98afSmrg# XORG_FONT_MACROS_VERSION(required-version)
74c41d98afSmrg# ------------------------------------------
75c41d98afSmrg# Minimum version: 1.1.0
769bc46bd4Smrg#
77c41d98afSmrg# If you're using a macro added in Version 1.1 or newer, include this in
78c41d98afSmrg# your configure.ac with the minimum required version, such as:
79c41d98afSmrg# XORG_FONT_MACROS_VERSION(1.1)
80c41d98afSmrg#
81c41d98afSmrg# To ensure that this macro is defined, also add:
82c41d98afSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
83c41d98afSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
84c41d98afSmrg#
85c41d98afSmrg#
86c41d98afSmrg# See the "minimum version" comment for each macro you use to see what
87c41d98afSmrg# version you require.
88c41d98afSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
89c41d98afSmrgm4_define([vers_have], [1.2.0])
90c41d98afSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
91c41d98afSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
92c41d98afSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
93c41d98afSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
94c41d98afSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
95c41d98afSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
96c41d98afSmrgm4_undefine([vers_have])
97c41d98afSmrgm4_undefine([maj_have])
98c41d98afSmrgm4_undefine([maj_needed])
99c41d98afSmrg]) # XORG_FONT_MACROS_VERSION
1003294c433Smrg
101c41d98afSmrg# XORG_FONT_CHECK_{maps}()
102c41d98afSmrg# ------------------------
103c41d98afSmrg# Minimum version: 1.0.0
104c41d98afSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
105c41d98afSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
1069bc46bd4Smrg
107c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
108c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
109c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
110c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
111c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
112c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
113c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
114c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
115c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
116c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
117c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
118c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
119c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
120c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
121c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
122c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
123c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
124c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1253294c433Smrg
126c41d98afSmrg# XORG_FONT_CHECK_ENCODING(encoding)
127c41d98afSmrg# ----------------------------------
128c41d98afSmrg# Minimum version: 1.1.0
129c41d98afSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
130c41d98afSmrg# It replaced individual copies of this code in the above macros in 1.1.
131c41d98afSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
132c41d98afSmrg# calls if this is not true in the future.
1333294c433Smrg
134c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
135c41d98afSmrg	AC_ARG_ENABLE(m4_tolower($1),
136c41d98afSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
137c41d98afSmrg				[Build $1 fonts (default: yes)]),
138c41d98afSmrg		[AS_TR_SH($1)=$enableval])
139c41d98afSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
140c41d98afSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
141c41d98afSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
142c41d98afSmrg]) # XORG_FONT_CHECK_ENCODING
1433294c433Smrg
144c41d98afSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
145c41d98afSmrg# -----------------------------------------------------
146c41d98afSmrg# Minimum version: 1.1.0
147c41d98afSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
148c41d98afSmrg# Add a shorthand --enable/disable-all-encodings option.
1493294c433Smrg
150c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
151c41d98afSmrg	AC_ARG_ENABLE([all-encodings],
152c41d98afSmrg		AS_HELP_STRING([--disable-all-encodings],
153c41d98afSmrg				[Disable building of all font encodings]),
154c41d98afSmrg		[m4_foreach_w([enc], [$1], [
155c41d98afSmrg			AS_TR_SH(enc)=$enableval
156c41d98afSmrg		])],
157c41d98afSmrg		[m4_foreach_w([enc], [$1], [
158c41d98afSmrg			AS_TR_SH(enc)=yes
159c41d98afSmrg		])])
160c41d98afSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
161c41d98afSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
162c41d98afSmrg
163c41d98afSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
164c41d98afSmrg# ------------------------------------------
165c41d98afSmrg# Minimum version: 1.1.0
1663294c433Smrg#
167c41d98afSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1683294c433Smrg#
1693294c433Smrg
170c41d98afSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
171c41d98afSmrg	AC_PATH_PROG($1, $2)
172c41d98afSmrg	if test x"$$1" = x; then
173c41d98afSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
174c41d98afSmrg	fi
1753294c433Smrg])
1763294c433Smrg
1773294c433Smrg
178c41d98afSmrg# XORG_FONT_FCCACHE()
179c41d98afSmrg# -------------------
180c41d98afSmrg# Minimum version: 1.1.0
1819bc46bd4Smrg#
182c41d98afSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
183c41d98afSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
184c41d98afSmrg# to run fc-cache if found and not installing to $DESTDIR
185c41d98afSmrg#
186c41d98afSmrg# fc-cache is optional, not required, and should be skipped when making
187c41d98afSmrg# packages (installing to $DESTDIR).
188c41d98afSmrg#
189c41d98afSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
190c41d98afSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
191c41d98afSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
192c41d98afSmrg	if test x"$FCCACHE" = x ; then
193c41d98afSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
194c41d98afSmrg	else
195c41d98afSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
196c41d98afSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
197c41d98afSmrg	fi
198c41d98afSmrg	AC_SUBST([RUN_FCCACHE])
199c41d98afSmrg])
2003294c433Smrg
2013294c433Smrg
202c41d98afSmrg# XORG_FONT_COMMON_UTILS()
203c41d98afSmrg# ------------------------
204c41d98afSmrg# Minimum version: 1.1.0
2059bc46bd4Smrg#
206c41d98afSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
2073294c433Smrg
208c41d98afSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
209c41d98afSmrg	XORG_FONT_FCCACHE
210c41d98afSmrg	XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
211c41d98afSmrg])
2123294c433Smrg
213c41d98afSmrg# XORG_FONT_SCALED_UTILS()
214c41d98afSmrg# ------------------------
215c41d98afSmrg# Minimum version: 1.1.0
216c41d98afSmrg#
217c41d98afSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
218c41d98afSmrg# (TrueType, OpenType, Type1)
2193294c433Smrg
220c41d98afSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
221c41d98afSmrg	XORG_FONT_COMMON_UTILS
222c41d98afSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
223c41d98afSmrg])
2243294c433Smrg
225c41d98afSmrg# XORG_FONT_BDF_UTILS()
226c41d98afSmrg# ---------------------
227c41d98afSmrg# Minimum version: 1.1.0
2283294c433Smrg#
229c41d98afSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
230c41d98afSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
231c41d98afSmrg# PCF output files created by bdftopcf
2323294c433Smrg
233c41d98afSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
234c41d98afSmrg	XORG_FONT_COMMON_UTILS
235c41d98afSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
236c41d98afSmrg	XORG_FONT_CHECK_COMPRESSION
237c41d98afSmrg])
2383294c433Smrg
239c41d98afSmrg# XORG_FONT_CHECK_COMPRESSION()
240c41d98afSmrg# -----------------------------
241c41d98afSmrg# Minimum version: 1.1.0
242c41d98afSmrg#
243c41d98afSmrg# Offer a --with-compression flag to control what compression method is
244c41d98afSmrg# used for pcf font files.   Offers all the methods currently supported
245c41d98afSmrg# by libXfont, including no compression.
2469bc46bd4Smrg
247c41d98afSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
248c41d98afSmrg	AC_MSG_CHECKING([font compression method])
249c41d98afSmrg	AC_ARG_WITH(compression,
250c41d98afSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
251c41d98afSmrg			 [compression method to use on pcf fonts])],
252c41d98afSmrg         [compression="$withval"], [compression="yes"])
253c41d98afSmrg	if test x"$compression" = "xyes" ; then
254c41d98afSmrg		compression="gzip"
255c41d98afSmrg	fi
256c41d98afSmrg	AC_MSG_RESULT([${compression}])
257c41d98afSmrg	case ${compression} in
258c41d98afSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
259c41d98afSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
260c41d98afSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
261c41d98afSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
262c41d98afSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
263c41d98afSmrg	esac
264c41d98afSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
265c41d98afSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
266c41d98afSmrg	fi
267c41d98afSmrg	AC_SUBST([COMPRESS_SUFFIX])
268c41d98afSmrg])
2693294c433Smrg
270c41d98afSmrg# XORG_FONT_UCS2ANY()
271c41d98afSmrg# -------------------
272c41d98afSmrg# Minimum version: 1.1.0
273c41d98afSmrg#
274c41d98afSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
275c41d98afSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
276c41d98afSmrg# Also call pkg-config to find the directory with the encoding files needed
277c41d98afSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
2783294c433Smrg
279c41d98afSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
280c41d98afSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
281c41d98afSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
282c41d98afSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
283c41d98afSmrg	MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
284c41d98afSmrg	AC_SUBST(MAPFILES_PATH)
285c41d98afSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
2863294c433Smrg])
2873294c433Smrg
2883294c433Smrg
2893294c433Smrg
290c41d98afSmrg# XORG_FONT_FC_CONFDIR()
291c41d98afSmrg# --------------------
292c41d98afSmrg# Minimum version: 1.2.0
293c41d98afSmrg#
294c41d98afSmrg# Sets FC_CONFDIR to the fontconfig config directory
295c41d98afSmrg# (which should be --with-confdir=... when building fontconfig)
296c41d98afSmrg# found from:
297c41d98afSmrg#	--with-fc-confdir=...
298c41d98afSmrg#	pkg-config --variable=confdir fontconfig
299c41d98afSmrg#	${sysconfdir}/fonts
3003294c433Smrg
301c41d98afSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
302c41d98afSmrg	dnl Ensure $PKG_CONFIG is set first
303c41d98afSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
304c41d98afSmrg
305c41d98afSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
306c41d98afSmrg	AC_ARG_WITH(fc-confdir,
307c41d98afSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
308c41d98afSmrg			   [Path to fontconfig's configuration directory]),
309c41d98afSmrg		    [FC_CONFDIR="$withval"])
310c41d98afSmrg	# if --with-fc-confdir was not specified
311c41d98afSmrg	if test "x${FC_CONFDIR}" = "x"; then
312c41d98afSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
313c41d98afSmrg	fi
314c41d98afSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
315c41d98afSmrg	if test "x${FC_CONFDIR}" = "x"; then
316c41d98afSmrg		FC_CONFDIR="${sysconfdir}/fonts"
317c41d98afSmrg	fi
318c41d98afSmrg	AC_SUBST(FC_CONFDIR)
319c41d98afSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
3203294c433Smrg])
3213294c433Smrg
3223294c433Smrg
323c41d98afSmrg
324c41d98afSmrg# XORG_FONTROOTDIR()
325c41d98afSmrg# --------------------
326c41d98afSmrg# Minimum version: 1.1.0
3279bc46bd4Smrg#
328c41d98afSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
329c41d98afSmrg# found from:
330c41d98afSmrg#	--with-fontrootdir
331c41d98afSmrg#	pkg-config --variable=fontrootdir fontutil
332c41d98afSmrg#	${datadir}/fonts/X11
3333294c433Smrg
334c41d98afSmrgAC_DEFUN([XORG_FONTROOTDIR],[
335c41d98afSmrg	dnl Ensure $PKG_CONFIG is set first
336c41d98afSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3373294c433Smrg
338c41d98afSmrg	AC_MSG_CHECKING([for root directory for font files])
339c41d98afSmrg	AC_ARG_WITH(fontrootdir,
340c41d98afSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
341c41d98afSmrg			   [Path to root directory for font files]),
342c41d98afSmrg		    [FONTROOTDIR="$withval"])
343c41d98afSmrg	# if --with-fontrootdir not specified...
344c41d98afSmrg	if test "x${FONTROOTDIR}" = "x"; then
345c41d98afSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
346c41d98afSmrg	fi
347c41d98afSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
348c41d98afSmrg	if test "x${FONTROOTDIR}" = "x"; then
349c41d98afSmrg		FONTROOTDIR="${datadir}/fonts/X11"
350c41d98afSmrg	fi
351c41d98afSmrg	AC_SUBST(FONTROOTDIR)
352c41d98afSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
353c41d98afSmrg])
3543294c433Smrg
355c41d98afSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
356c41d98afSmrg# ---------------------------------------
357c41d98afSmrg# Minimum version: 1.1.0
3583294c433Smrg#
359c41d98afSmrg# Offer a --with-<flag> flag to control directory for font installation
360c41d98afSmrg# Default is the specified <subdir> of the font root directory.
361c41d98afSmrg# Sets <variable> to the selected directory
3623294c433Smrg
363c41d98afSmrgAC_DEFUN([XORG_FONTSUBDIR],[
364c41d98afSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
3659bc46bd4Smrg
366c41d98afSmrg	AC_MSG_CHECKING([for directory for $3 files])
367c41d98afSmrg	AC_ARG_WITH($2,
368c41d98afSmrg		    [AS_HELP_STRING([--with-$2=DIR],
369c41d98afSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
370c41d98afSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
371c41d98afSmrg	AC_SUBST($1)
372c41d98afSmrg	AC_MSG_RESULT([${$1}])
373c41d98afSmrg]) # XORG_FONTSUBDIR
374c41d98afSmrg
375c41d98afSmrg# XORG_FONTDIR(subdir)
376c41d98afSmrg# --------------------
377c41d98afSmrg# Minimum version: 1.1.0
3789bc46bd4Smrg#
379c41d98afSmrg# Offer a --with-fontdir flag to control directory for font installation
380c41d98afSmrg# Default is the specified subdir of the font root directory.
381c41d98afSmrg# Sets FONTDIR to the selected directory
3829bc46bd4Smrg
383c41d98afSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
3849bc46bd4Smrg
385c41d98afSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
386c41d98afSmrg# serial 1 (pkg-config-0.24)
387c41d98afSmrg# 
388c41d98afSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
389c41d98afSmrg#
390c41d98afSmrg# This program is free software; you can redistribute it and/or modify
391c41d98afSmrg# it under the terms of the GNU General Public License as published by
392c41d98afSmrg# the Free Software Foundation; either version 2 of the License, or
393c41d98afSmrg# (at your option) any later version.
394c41d98afSmrg#
395c41d98afSmrg# This program is distributed in the hope that it will be useful, but
396c41d98afSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
397c41d98afSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
398c41d98afSmrg# General Public License for more details.
399c41d98afSmrg#
400c41d98afSmrg# You should have received a copy of the GNU General Public License
401c41d98afSmrg# along with this program; if not, write to the Free Software
402c41d98afSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
403c41d98afSmrg#
404c41d98afSmrg# As a special exception to the GNU General Public License, if you
405c41d98afSmrg# distribute this file as part of a program that contains a
406c41d98afSmrg# configuration script generated by Autoconf, you may include it under
407c41d98afSmrg# the same distribution terms that you use for the rest of that program.
4089bc46bd4Smrg
409c41d98afSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
410c41d98afSmrg# ----------------------------------
411c41d98afSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
412c41d98afSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
413c41d98afSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
414c41d98afSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
415c41d98afSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
416c41d98afSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
4179bc46bd4Smrg
418c41d98afSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
419c41d98afSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
4209bc46bd4Smrgfi
421c41d98afSmrgif test -n "$PKG_CONFIG"; then
422c41d98afSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
423c41d98afSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
424c41d98afSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
425c41d98afSmrg		AC_MSG_RESULT([yes])
426c41d98afSmrg	else
427c41d98afSmrg		AC_MSG_RESULT([no])
428c41d98afSmrg		PKG_CONFIG=""
429c41d98afSmrg	fi
430c41d98afSmrgfi[]dnl
431c41d98afSmrg])# PKG_PROG_PKG_CONFIG
4329bc46bd4Smrg
433c41d98afSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
434c41d98afSmrg#
435c41d98afSmrg# Check to see whether a particular set of modules exists.  Similar
436c41d98afSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
437c41d98afSmrg#
438c41d98afSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
439c41d98afSmrg# only at the first occurence in configure.ac, so if the first place
440c41d98afSmrg# it's called might be skipped (such as if it is within an "if", you
441c41d98afSmrg# have to call PKG_CHECK_EXISTS manually
442c41d98afSmrg# --------------------------------------------------------------
443c41d98afSmrgAC_DEFUN([PKG_CHECK_EXISTS],
444c41d98afSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
445c41d98afSmrgif test -n "$PKG_CONFIG" && \
446c41d98afSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
447c41d98afSmrg  m4_default([$2], [:])
448c41d98afSmrgm4_ifvaln([$3], [else
449c41d98afSmrg  $3])dnl
450c41d98afSmrgfi])
4519bc46bd4Smrg
452c41d98afSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
453c41d98afSmrg# ---------------------------------------------
454c41d98afSmrgm4_define([_PKG_CONFIG],
455c41d98afSmrg[if test -n "$$1"; then
456c41d98afSmrg    pkg_cv_[]$1="$$1"
457c41d98afSmrg elif test -n "$PKG_CONFIG"; then
458c41d98afSmrg    PKG_CHECK_EXISTS([$3],
459c41d98afSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
460c41d98afSmrg		     [pkg_failed=yes])
461c41d98afSmrg else
462c41d98afSmrg    pkg_failed=untried
463c41d98afSmrgfi[]dnl
464c41d98afSmrg])# _PKG_CONFIG
4659bc46bd4Smrg
466c41d98afSmrg# _PKG_SHORT_ERRORS_SUPPORTED
467c41d98afSmrg# -----------------------------
468c41d98afSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
469c41d98afSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
470c41d98afSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
471c41d98afSmrg        _pkg_short_errors_supported=yes
472c41d98afSmrgelse
473c41d98afSmrg        _pkg_short_errors_supported=no
474c41d98afSmrgfi[]dnl
475c41d98afSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
4769bc46bd4Smrg
4779bc46bd4Smrg
478c41d98afSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
479c41d98afSmrg# [ACTION-IF-NOT-FOUND])
480c41d98afSmrg#
481c41d98afSmrg#
482c41d98afSmrg# Note that if there is a possibility the first call to
483c41d98afSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
484c41d98afSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
485c41d98afSmrg#
486c41d98afSmrg#
487c41d98afSmrg# --------------------------------------------------------------
488c41d98afSmrgAC_DEFUN([PKG_CHECK_MODULES],
489c41d98afSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
490c41d98afSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
491c41d98afSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
4929bc46bd4Smrg
493c41d98afSmrgpkg_failed=no
494c41d98afSmrgAC_MSG_CHECKING([for $1])
495c41d98afSmrg
496c41d98afSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
497c41d98afSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
498c41d98afSmrg
499c41d98afSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
500c41d98afSmrgand $1[]_LIBS to avoid the need to call pkg-config.
501c41d98afSmrgSee the pkg-config man page for more details.])
502c41d98afSmrg
503c41d98afSmrgif test $pkg_failed = yes; then
504c41d98afSmrg   	AC_MSG_RESULT([no])
505c41d98afSmrg        _PKG_SHORT_ERRORS_SUPPORTED
506c41d98afSmrg        if test $_pkg_short_errors_supported = yes; then
507c41d98afSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
508c41d98afSmrg        else 
509c41d98afSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
510c41d98afSmrg        fi
511c41d98afSmrg	# Put the nasty error message in config.log where it belongs
512c41d98afSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
513c41d98afSmrg
514c41d98afSmrg	m4_default([$4], [AC_MSG_ERROR(
515c41d98afSmrg[Package requirements ($2) were not met:
516c41d98afSmrg
517c41d98afSmrg$$1_PKG_ERRORS
518c41d98afSmrg
519c41d98afSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
520c41d98afSmrginstalled software in a non-standard prefix.
521c41d98afSmrg
522c41d98afSmrg_PKG_TEXT])[]dnl
523c41d98afSmrg        ])
524c41d98afSmrgelif test $pkg_failed = untried; then
525c41d98afSmrg     	AC_MSG_RESULT([no])
526c41d98afSmrg	m4_default([$4], [AC_MSG_FAILURE(
527c41d98afSmrg[The pkg-config script could not be found or is too old.  Make sure it
528c41d98afSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
529c41d98afSmrgpath to pkg-config.
530c41d98afSmrg
531c41d98afSmrg_PKG_TEXT
532c41d98afSmrg
533c41d98afSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
534c41d98afSmrg        ])
535c41d98afSmrgelse
536c41d98afSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
537c41d98afSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
538c41d98afSmrg        AC_MSG_RESULT([yes])
539c41d98afSmrg	$3
540c41d98afSmrgfi[]dnl
541c41d98afSmrg])# PKG_CHECK_MODULES
5429bc46bd4Smrg
543c41d98afSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
544c41d98afSmrgdnl
545c41d98afSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
546c41d98afSmrgdnl 
547c41d98afSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
548c41d98afSmrgdnl copy of this software and associated documentation files (the "Software"),
549c41d98afSmrgdnl to deal in the Software without restriction, including without limitation
550c41d98afSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
551c41d98afSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
552c41d98afSmrgdnl Software is furnished to do so, subject to the following conditions:
553c41d98afSmrgdnl
554c41d98afSmrgdnl The above copyright notice and this permission notice (including the next
555c41d98afSmrgdnl paragraph) shall be included in all copies or substantial portions of the
556c41d98afSmrgdnl Software.
557c41d98afSmrgdnl
558c41d98afSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
559c41d98afSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
560c41d98afSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
561c41d98afSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
562c41d98afSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
563c41d98afSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
564c41d98afSmrgdnl DEALINGS IN THE SOFTWARE.
5659bc46bd4Smrg
566c41d98afSmrg# XORG_MACROS_VERSION(required-version)
567c41d98afSmrg# -------------------------------------
568c41d98afSmrg# Minimum version: 1.1.0
5699bc46bd4Smrg#
570c41d98afSmrg# If you're using a macro added in Version 1.1 or newer, include this in
571c41d98afSmrg# your configure.ac with the minimum required version, such as:
572c41d98afSmrg# XORG_MACROS_VERSION(1.1)
573c41d98afSmrg#
574c41d98afSmrg# To ensure that this macro is defined, also add:
575c41d98afSmrg# m4_ifndef([XORG_MACROS_VERSION],
576c41d98afSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
577c41d98afSmrg#
578c41d98afSmrg#
579c41d98afSmrg# See the "minimum version" comment for each macro you use to see what 
580c41d98afSmrg# version you require.
581c41d98afSmrgm4_defun([XORG_MACROS_VERSION],[
582c41d98afSmrgm4_define([vers_have], [1.11.0])
583c41d98afSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
584c41d98afSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
585c41d98afSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
586c41d98afSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
587c41d98afSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
588c41d98afSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
589c41d98afSmrgm4_undefine([vers_have])
590c41d98afSmrgm4_undefine([maj_have])
591c41d98afSmrgm4_undefine([maj_needed])
592c41d98afSmrg]) # XORG_MACROS_VERSION
5939bc46bd4Smrg
594c41d98afSmrg# XORG_PROG_RAWCPP()
5959bc46bd4Smrg# ------------------
596c41d98afSmrg# Minimum version: 1.0.0
5979bc46bd4Smrg#
598c41d98afSmrg# Find cpp program and necessary flags for use in pre-processing text files
599c41d98afSmrg# such as man pages and config files
600c41d98afSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
601c41d98afSmrgAC_REQUIRE([AC_PROG_CPP])
602c41d98afSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
603c41d98afSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
6049bc46bd4Smrg
605c41d98afSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
606c41d98afSmrg# which is not the best choice for supporting other OS'es, but covers most
607c41d98afSmrg# of the ones we need for now.
608c41d98afSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
609c41d98afSmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
610c41d98afSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
611c41d98afSmrg	AC_MSG_RESULT([no])
6129bc46bd4Smrgelse
613c41d98afSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
614c41d98afSmrg		RAWCPPFLAGS=-undef
615c41d98afSmrg		AC_MSG_RESULT([yes])
616c41d98afSmrg	# under Cygwin unix is still defined even with -undef
617c41d98afSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
618c41d98afSmrg		RAWCPPFLAGS="-undef -ansi"
619c41d98afSmrg		AC_MSG_RESULT([yes, with -ansi])
620c41d98afSmrg	else
621c41d98afSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
622c41d98afSmrg	fi
6239bc46bd4Smrgfi
624c41d98afSmrgrm -f conftest.$ac_ext
6259bc46bd4Smrg
626c41d98afSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
627c41d98afSmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
628c41d98afSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
629c41d98afSmrg	AC_MSG_RESULT([no])
630c41d98afSmrgelse
631c41d98afSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
632c41d98afSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
633c41d98afSmrg		AC_MSG_RESULT([yes])
634c41d98afSmrg	else
635c41d98afSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
636c41d98afSmrg	fi
637c41d98afSmrgfi
638c41d98afSmrgrm -f conftest.$ac_ext
639c41d98afSmrgAC_SUBST(RAWCPPFLAGS)
640c41d98afSmrg]) # XORG_PROG_RAWCPP
6419bc46bd4Smrg
642c41d98afSmrg# XORG_MANPAGE_SECTIONS()
643c41d98afSmrg# -----------------------
644c41d98afSmrg# Minimum version: 1.0.0
6459bc46bd4Smrg#
646c41d98afSmrg# Determine which sections man pages go in for the different man page types
647c41d98afSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
648c41d98afSmrg# Not sure if there's any better way than just hardcoding by OS name.
649c41d98afSmrg# Override default settings by setting environment variables
650c41d98afSmrg# Added MAN_SUBSTS in version 1.8
651c41d98afSmrg# Added AC_PROG_SED in version 1.8
6529bc46bd4Smrg
653c41d98afSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
654c41d98afSmrgAC_REQUIRE([AC_CANONICAL_HOST])
655c41d98afSmrgAC_REQUIRE([AC_PROG_SED])
6569bc46bd4Smrg
657c41d98afSmrgif test x$APP_MAN_SUFFIX = x    ; then
658c41d98afSmrg    APP_MAN_SUFFIX=1
659c41d98afSmrgfi
660c41d98afSmrgif test x$APP_MAN_DIR = x    ; then
661c41d98afSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
662c41d98afSmrgfi
6639bc46bd4Smrg
664c41d98afSmrgif test x$LIB_MAN_SUFFIX = x    ; then
665c41d98afSmrg    LIB_MAN_SUFFIX=3
666c41d98afSmrgfi
667c41d98afSmrgif test x$LIB_MAN_DIR = x    ; then
668c41d98afSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
669c41d98afSmrgfi
6709bc46bd4Smrg
671c41d98afSmrgif test x$FILE_MAN_SUFFIX = x    ; then
672c41d98afSmrg    case $host_os in
673c41d98afSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
674c41d98afSmrg	*)		FILE_MAN_SUFFIX=5  ;;
675c41d98afSmrg    esac
676c41d98afSmrgfi
677c41d98afSmrgif test x$FILE_MAN_DIR = x    ; then
678c41d98afSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
679c41d98afSmrgfi
6803294c433Smrg
681c41d98afSmrgif test x$MISC_MAN_SUFFIX = x    ; then
682c41d98afSmrg    case $host_os in
683c41d98afSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
684c41d98afSmrg	*)		MISC_MAN_SUFFIX=7  ;;
685c41d98afSmrg    esac
686c41d98afSmrgfi
687c41d98afSmrgif test x$MISC_MAN_DIR = x    ; then
688c41d98afSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
689c41d98afSmrgfi
6909bc46bd4Smrg
691c41d98afSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
692c41d98afSmrg    case $host_os in
693c41d98afSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
694c41d98afSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
695c41d98afSmrg    esac
696c41d98afSmrgfi
697c41d98afSmrgif test x$DRIVER_MAN_DIR = x    ; then
698c41d98afSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
699c41d98afSmrgfi
7009bc46bd4Smrg
701c41d98afSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
702c41d98afSmrg    case $host_os in
703c41d98afSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
704c41d98afSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
705c41d98afSmrg    esac
706c41d98afSmrgfi
707c41d98afSmrgif test x$ADMIN_MAN_DIR = x    ; then
708c41d98afSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
7099bc46bd4Smrgfi
7109bc46bd4Smrg
7119bc46bd4Smrg
712c41d98afSmrgAC_SUBST([APP_MAN_SUFFIX])
713c41d98afSmrgAC_SUBST([LIB_MAN_SUFFIX])
714c41d98afSmrgAC_SUBST([FILE_MAN_SUFFIX])
715c41d98afSmrgAC_SUBST([MISC_MAN_SUFFIX])
716c41d98afSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
717c41d98afSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
718c41d98afSmrgAC_SUBST([APP_MAN_DIR])
719c41d98afSmrgAC_SUBST([LIB_MAN_DIR])
720c41d98afSmrgAC_SUBST([FILE_MAN_DIR])
721c41d98afSmrgAC_SUBST([MISC_MAN_DIR])
722c41d98afSmrgAC_SUBST([DRIVER_MAN_DIR])
723c41d98afSmrgAC_SUBST([ADMIN_MAN_DIR])
7249bc46bd4Smrg
725c41d98afSmrgXORG_MAN_PAGE="X Version 11"
726c41d98afSmrgAC_SUBST([XORG_MAN_PAGE])
727c41d98afSmrgMAN_SUBSTS="\
728c41d98afSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
729c41d98afSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
730c41d98afSmrg	-e 's|__xservername__|Xorg|g' \
731c41d98afSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
732c41d98afSmrg	-e 's|__projectroot__|\$(prefix)|g' \
733c41d98afSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
734c41d98afSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
735c41d98afSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
736c41d98afSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
737c41d98afSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
738c41d98afSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
739c41d98afSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
740c41d98afSmrgAC_SUBST([MAN_SUBSTS])
7419bc46bd4Smrg
742c41d98afSmrg]) # XORG_MANPAGE_SECTIONS
7439bc46bd4Smrg
744c41d98afSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
745c41d98afSmrg# ------------------------
746c41d98afSmrg# Minimum version: 1.7.0
747c41d98afSmrg#
748c41d98afSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
749c41d98afSmrg# provided by xorg-sgml-doctools, if installed.
750c41d98afSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
751c41d98afSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
752c41d98afSmrgXORG_SGML_PATH=
753c41d98afSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
754c41d98afSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
755c41d98afSmrg    [m4_ifval([$1],[:],
756c41d98afSmrg        [if test x"$cross_compiling" != x"yes" ; then
757c41d98afSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
758c41d98afSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
759c41d98afSmrg         fi])
760c41d98afSmrg    ])
761c41d98afSmrg
762c41d98afSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
763c41d98afSmrg# the path and the name of the doc stylesheet
764c41d98afSmrgif test "x$XORG_SGML_PATH" != "x" ; then
765c41d98afSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
766c41d98afSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
767c41d98afSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
7689bc46bd4Smrgelse
769c41d98afSmrg   AC_MSG_RESULT([no])
7709bc46bd4Smrgfi
7719bc46bd4Smrg
772c41d98afSmrgAC_SUBST(XORG_SGML_PATH)
773c41d98afSmrgAC_SUBST(STYLESHEET_SRCDIR)
774c41d98afSmrgAC_SUBST(XSL_STYLESHEET)
775c41d98afSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
776c41d98afSmrg]) # XORG_CHECK_SGML_DOCTOOLS
777c41d98afSmrg
778c41d98afSmrg# XORG_CHECK_LINUXDOC
779c41d98afSmrg# -------------------
780c41d98afSmrg# Minimum version: 1.0.0
7819bc46bd4Smrg#
782c41d98afSmrg# Defines the variable MAKE_TEXT if the necessary tools and
783c41d98afSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
784c41d98afSmrg# Whether or not the necessary tools and files are found can be checked
785c41d98afSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
786c41d98afSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
787c41d98afSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
788c41d98afSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
7899bc46bd4Smrg
790c41d98afSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
7919bc46bd4Smrg
792c41d98afSmrgAC_MSG_CHECKING([whether to build documentation])
7939bc46bd4Smrg
794c41d98afSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
795c41d98afSmrg   BUILDDOC=yes
796c41d98afSmrgelse
797c41d98afSmrg   BUILDDOC=no
798c41d98afSmrgfi
7999bc46bd4Smrg
800c41d98afSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
8019bc46bd4Smrg
802c41d98afSmrgAC_MSG_RESULT([$BUILDDOC])
8039bc46bd4Smrg
804c41d98afSmrgAC_MSG_CHECKING([whether to build pdf documentation])
8059bc46bd4Smrg
806c41d98afSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
807c41d98afSmrg   BUILDPDFDOC=yes
808c41d98afSmrgelse
809c41d98afSmrg   BUILDPDFDOC=no
810c41d98afSmrgfi
8119bc46bd4Smrg
812c41d98afSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
8139bc46bd4Smrg
814c41d98afSmrgAC_MSG_RESULT([$BUILDPDFDOC])
8159bc46bd4Smrg
816c41d98afSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
817c41d98afSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
818c41d98afSmrgMAKE_PDF="$PS2PDF"
819c41d98afSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
8209bc46bd4Smrg
821c41d98afSmrgAC_SUBST(MAKE_TEXT)
822c41d98afSmrgAC_SUBST(MAKE_PS)
823c41d98afSmrgAC_SUBST(MAKE_PDF)
824c41d98afSmrgAC_SUBST(MAKE_HTML)
825c41d98afSmrg]) # XORG_CHECK_LINUXDOC
8269bc46bd4Smrg
827c41d98afSmrg# XORG_CHECK_DOCBOOK
828c41d98afSmrg# -------------------
829c41d98afSmrg# Minimum version: 1.0.0
830c41d98afSmrg#
831c41d98afSmrg# Checks for the ability to build output formats from SGML DocBook source.
832c41d98afSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
833c41d98afSmrg# indicates whether the necessary tools and files are found and, if set,
834c41d98afSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
835c41d98afSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
836c41d98afSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
8379bc46bd4Smrg
838c41d98afSmrgBUILDTXTDOC=no
839c41d98afSmrgBUILDPDFDOC=no
840c41d98afSmrgBUILDPSDOC=no
841c41d98afSmrgBUILDHTMLDOC=no
8429bc46bd4Smrg
843c41d98afSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
844c41d98afSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
845c41d98afSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
846c41d98afSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
8479bc46bd4Smrg
848c41d98afSmrgAC_MSG_CHECKING([whether to build text documentation])
849c41d98afSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
850c41d98afSmrg   test x$BUILD_TXTDOC != xno; then
851c41d98afSmrg	BUILDTXTDOC=yes
8529bc46bd4Smrgfi
853c41d98afSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
854c41d98afSmrgAC_MSG_RESULT([$BUILDTXTDOC])
8559bc46bd4Smrg
856c41d98afSmrgAC_MSG_CHECKING([whether to build PDF documentation])
857c41d98afSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
858c41d98afSmrg   test x$BUILD_PDFDOC != xno; then
859c41d98afSmrg	BUILDPDFDOC=yes
860c41d98afSmrgfi
861c41d98afSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
862c41d98afSmrgAC_MSG_RESULT([$BUILDPDFDOC])
8639bc46bd4Smrg
864c41d98afSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
865c41d98afSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
866c41d98afSmrg   test x$BUILD_PSDOC != xno; then
867c41d98afSmrg	BUILDPSDOC=yes
868c41d98afSmrgfi
869c41d98afSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
870c41d98afSmrgAC_MSG_RESULT([$BUILDPSDOC])
8719bc46bd4Smrg
872c41d98afSmrgAC_MSG_CHECKING([whether to build HTML documentation])
873c41d98afSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
874c41d98afSmrg   test x$BUILD_HTMLDOC != xno; then
875c41d98afSmrg	BUILDHTMLDOC=yes
876c41d98afSmrgfi
877c41d98afSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
878c41d98afSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
879c41d98afSmrg
880c41d98afSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
881c41d98afSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
882c41d98afSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
883c41d98afSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
8849bc46bd4Smrg
885c41d98afSmrgAC_SUBST(MAKE_TEXT)
886c41d98afSmrgAC_SUBST(MAKE_PS)
887c41d98afSmrgAC_SUBST(MAKE_PDF)
888c41d98afSmrgAC_SUBST(MAKE_HTML)
889c41d98afSmrg]) # XORG_CHECK_DOCBOOK
8909bc46bd4Smrg
891c41d98afSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
892c41d98afSmrg# ----------------
893c41d98afSmrg# Minimum version: 1.5.0
894c41d98afSmrg# Minimum version for optional DEFAULT argument: 1.11.0
895c41d98afSmrg#
896c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
897c41d98afSmrg# not at the appropriate level. This macro enables a module to test for the
898c41d98afSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
899c41d98afSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
900c41d98afSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
901c41d98afSmrg# --with-xmlto assumes 'auto'.
902c41d98afSmrg#
903c41d98afSmrg# Interface to module:
904c41d98afSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
905c41d98afSmrg# XMLTO:	returns the path of the xmlto program found
906c41d98afSmrg#		returns the path set by the user in the environment
907c41d98afSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
908c41d98afSmrg#		'no' user instructs the module not to use xmlto
909c41d98afSmrg#
910c41d98afSmrg# Added in version 1.10.0
911c41d98afSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
912c41d98afSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
913c41d98afSmrg#
914c41d98afSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
915c41d98afSmrg#
916c41d98afSmrgAC_DEFUN([XORG_WITH_XMLTO],[
917c41d98afSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
918c41d98afSmrgm4_define([_defopt], m4_default([$2], [auto]))
919c41d98afSmrgAC_ARG_WITH(xmlto,
920c41d98afSmrg	AS_HELP_STRING([--with-xmlto],
921c41d98afSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
922c41d98afSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
923c41d98afSmrgm4_undefine([_defopt])
924c41d98afSmrg
925c41d98afSmrgif test "x$use_xmlto" = x"auto"; then
926c41d98afSmrg   AC_PATH_PROG([XMLTO], [xmlto])
927c41d98afSmrg   if test "x$XMLTO" = "x"; then
928c41d98afSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
929c41d98afSmrg	have_xmlto=no
930c41d98afSmrg   else
931c41d98afSmrg        have_xmlto=yes
932c41d98afSmrg   fi
933c41d98afSmrgelif test "x$use_xmlto" = x"yes" ; then
934c41d98afSmrg   AC_PATH_PROG([XMLTO], [xmlto])
935c41d98afSmrg   if test "x$XMLTO" = "x"; then
936c41d98afSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
937c41d98afSmrg   fi
938c41d98afSmrg   have_xmlto=yes
939c41d98afSmrgelif test "x$use_xmlto" = x"no" ; then
940c41d98afSmrg   if test "x$XMLTO" != "x"; then
941c41d98afSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
942c41d98afSmrg   fi
943c41d98afSmrg   have_xmlto=no
944c41d98afSmrgelse
945c41d98afSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
9469bc46bd4Smrgfi
9479bc46bd4Smrg
948c41d98afSmrg# Test for a minimum version of xmlto, if provided.
949c41d98afSmrgm4_ifval([$1],
950c41d98afSmrg[if test "$have_xmlto" = yes; then
951c41d98afSmrg    # scrape the xmlto version
952c41d98afSmrg    AC_MSG_CHECKING([the xmlto version])
953c41d98afSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
954c41d98afSmrg    AC_MSG_RESULT([$xmlto_version])
955c41d98afSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
956c41d98afSmrg        [if test "x$use_xmlto" = xauto; then
957c41d98afSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
958c41d98afSmrg            have_xmlto=no
959c41d98afSmrg        else
960c41d98afSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
961c41d98afSmrg        fi])
962c41d98afSmrgfi])
9639bc46bd4Smrg
964c41d98afSmrg# Test for the ability of xmlto to generate a text target
965c41d98afSmrghave_xmlto_text=no
966c41d98afSmrgcat > conftest.xml << "EOF"
967c41d98afSmrgEOF
968c41d98afSmrgAS_IF([test "$have_xmlto" = yes],
969c41d98afSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
970c41d98afSmrg             [have_xmlto_text=yes],
971c41d98afSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
972c41d98afSmrgrm -f conftest.xml
973c41d98afSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
974c41d98afSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
975c41d98afSmrg]) # XORG_WITH_XMLTO
976c41d98afSmrg
977c41d98afSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
978c41d98afSmrg# ----------------
979c41d98afSmrg# Minimum version: 1.5.0
980c41d98afSmrg# Minimum version for optional DEFAULT argument: 1.11.0
981c41d98afSmrg#
982c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
983c41d98afSmrg# not at the appropriate level. This macro enables a module to test for the
984c41d98afSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
985c41d98afSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
986c41d98afSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
987c41d98afSmrg# --with-asciidoc assumes 'auto'.
988c41d98afSmrg#
989c41d98afSmrg# Interface to module:
990c41d98afSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
991c41d98afSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
992c41d98afSmrg#		 returns the path set by the user in the environment
993c41d98afSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
994c41d98afSmrg#		  'no' user instructs the module not to use asciidoc
995c41d98afSmrg#
996c41d98afSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
997c41d98afSmrg#
998c41d98afSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
999c41d98afSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1000c41d98afSmrgm4_define([_defopt], m4_default([$2], [auto]))
1001c41d98afSmrgAC_ARG_WITH(asciidoc,
1002c41d98afSmrg	AS_HELP_STRING([--with-asciidoc],
1003c41d98afSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1004c41d98afSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1005c41d98afSmrgm4_undefine([_defopt])
1006c41d98afSmrg
1007c41d98afSmrgif test "x$use_asciidoc" = x"auto"; then
1008c41d98afSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1009c41d98afSmrg   if test "x$ASCIIDOC" = "x"; then
1010c41d98afSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1011c41d98afSmrg	have_asciidoc=no
1012c41d98afSmrg   else
1013c41d98afSmrg        have_asciidoc=yes
1014c41d98afSmrg   fi
1015c41d98afSmrgelif test "x$use_asciidoc" = x"yes" ; then
1016c41d98afSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1017c41d98afSmrg   if test "x$ASCIIDOC" = "x"; then
1018c41d98afSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1019c41d98afSmrg   fi
1020c41d98afSmrg   have_asciidoc=yes
1021c41d98afSmrgelif test "x$use_asciidoc" = x"no" ; then
1022c41d98afSmrg   if test "x$ASCIIDOC" != "x"; then
1023c41d98afSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1024c41d98afSmrg   fi
1025c41d98afSmrg   have_asciidoc=no
1026c41d98afSmrgelse
1027c41d98afSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1028c41d98afSmrgfi
1029c41d98afSmrgm4_ifval([$1],
1030c41d98afSmrg[if test "$have_asciidoc" = yes; then
1031c41d98afSmrg    # scrape the asciidoc version
1032c41d98afSmrg    AC_MSG_CHECKING([the asciidoc version])
1033c41d98afSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1034c41d98afSmrg    AC_MSG_RESULT([$asciidoc_version])
1035c41d98afSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1036c41d98afSmrg        [if test "x$use_asciidoc" = xauto; then
1037c41d98afSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1038c41d98afSmrg            have_asciidoc=no
1039c41d98afSmrg        else
1040c41d98afSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1041c41d98afSmrg        fi])
1042c41d98afSmrgfi])
1043c41d98afSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1044c41d98afSmrg]) # XORG_WITH_ASCIIDOC
1045c41d98afSmrg
1046c41d98afSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1047c41d98afSmrg# --------------------------------
1048c41d98afSmrg# Minimum version: 1.5.0
1049c41d98afSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1050c41d98afSmrg#
1051c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
1052c41d98afSmrg# not at the appropriate level. This macro enables a module to test for the
1053c41d98afSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1054c41d98afSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1055c41d98afSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1056c41d98afSmrg# --with-doxygen assumes 'auto'.
1057c41d98afSmrg#
1058c41d98afSmrg# Interface to module:
1059c41d98afSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1060c41d98afSmrg# DOXYGEN:	 returns the path of the doxygen program found
1061c41d98afSmrg#		 returns the path set by the user in the environment
1062c41d98afSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1063c41d98afSmrg#		  'no' user instructs the module not to use doxygen
1064c41d98afSmrg#
1065c41d98afSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1066c41d98afSmrg#
1067c41d98afSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1068c41d98afSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1069c41d98afSmrgm4_define([_defopt], m4_default([$2], [auto]))
1070c41d98afSmrgAC_ARG_WITH(doxygen,
1071c41d98afSmrg	AS_HELP_STRING([--with-doxygen],
1072c41d98afSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1073c41d98afSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1074c41d98afSmrgm4_undefine([_defopt])
1075c41d98afSmrg
1076c41d98afSmrgif test "x$use_doxygen" = x"auto"; then
1077c41d98afSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1078c41d98afSmrg   if test "x$DOXYGEN" = "x"; then
1079c41d98afSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1080c41d98afSmrg	have_doxygen=no
1081c41d98afSmrg   else
1082c41d98afSmrg        have_doxygen=yes
1083c41d98afSmrg   fi
1084c41d98afSmrgelif test "x$use_doxygen" = x"yes" ; then
1085c41d98afSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1086c41d98afSmrg   if test "x$DOXYGEN" = "x"; then
1087c41d98afSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1088c41d98afSmrg   fi
1089c41d98afSmrg   have_doxygen=yes
1090c41d98afSmrgelif test "x$use_doxygen" = x"no" ; then
1091c41d98afSmrg   if test "x$DOXYGEN" != "x"; then
1092c41d98afSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1093c41d98afSmrg   fi
1094c41d98afSmrg   have_doxygen=no
1095c41d98afSmrgelse
1096c41d98afSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1097c41d98afSmrgfi
1098c41d98afSmrgm4_ifval([$1],
1099c41d98afSmrg[if test "$have_doxygen" = yes; then
1100c41d98afSmrg    # scrape the doxygen version
1101c41d98afSmrg    AC_MSG_CHECKING([the doxygen version])
1102c41d98afSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1103c41d98afSmrg    AC_MSG_RESULT([$doxygen_version])
1104c41d98afSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1105c41d98afSmrg        [if test "x$use_doxygen" = xauto; then
1106c41d98afSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1107c41d98afSmrg            have_doxygen=no
1108c41d98afSmrg        else
1109c41d98afSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1110c41d98afSmrg        fi])
1111c41d98afSmrgfi])
1112c41d98afSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1113c41d98afSmrg]) # XORG_WITH_DOXYGEN
11149bc46bd4Smrg
1115c41d98afSmrg# XORG_WITH_GROFF([DEFAULT])
1116c41d98afSmrg# ----------------
1117c41d98afSmrg# Minimum version: 1.6.0
1118c41d98afSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1119c41d98afSmrg#
1120c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
1121c41d98afSmrg# not at the appropriate level. This macro enables a module to test for the
1122c41d98afSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1123c41d98afSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1124c41d98afSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1125c41d98afSmrg# --with-groff assumes 'auto'.
1126c41d98afSmrg#
1127c41d98afSmrg# Interface to module:
1128c41d98afSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1129c41d98afSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1130c41d98afSmrg# HAVE_GROFF_MS: the -ms macros package
1131c41d98afSmrg# GROFF:	 returns the path of the groff program found
1132c41d98afSmrg#		 returns the path set by the user in the environment
1133c41d98afSmrg# --with-groff:	 'yes' user instructs the module to use groff
1134c41d98afSmrg#		 'no' user instructs the module not to use groff
1135c41d98afSmrg#
1136c41d98afSmrg# Added in version 1.9.0:
1137c41d98afSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1138c41d98afSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1139c41d98afSmrg#		   psselect from the psutils package.
1140c41d98afSmrg#		   the ghostcript package. Refer to the grohtml man pages
1141c41d98afSmrg#
1142c41d98afSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1143c41d98afSmrg#
1144c41d98afSmrg# OS and distros often splits groff in a basic and full package, the former
1145c41d98afSmrg# having the groff program and the later having devices, fonts and macros
1146c41d98afSmrg# Checking for the groff executable is not enough.
1147c41d98afSmrg#
1148c41d98afSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1149c41d98afSmrg# unset HAVE_GROFF or GROFF env variables.
1150c41d98afSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1151c41d98afSmrg#
1152c41d98afSmrgAC_DEFUN([XORG_WITH_GROFF],[
1153c41d98afSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1154c41d98afSmrgm4_define([_defopt], m4_default([$1], [auto]))
1155c41d98afSmrgAC_ARG_WITH(groff,
1156c41d98afSmrg	AS_HELP_STRING([--with-groff],
1157c41d98afSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1158c41d98afSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1159c41d98afSmrgm4_undefine([_defopt])
1160c41d98afSmrg
1161c41d98afSmrgif test "x$use_groff" = x"auto"; then
1162c41d98afSmrg   AC_PATH_PROG([GROFF], [groff])
1163c41d98afSmrg   if test "x$GROFF" = "x"; then
1164c41d98afSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1165c41d98afSmrg	have_groff=no
1166c41d98afSmrg   else
1167c41d98afSmrg        have_groff=yes
1168c41d98afSmrg   fi
1169c41d98afSmrgelif test "x$use_groff" = x"yes" ; then
1170c41d98afSmrg   AC_PATH_PROG([GROFF], [groff])
1171c41d98afSmrg   if test "x$GROFF" = "x"; then
1172c41d98afSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1173c41d98afSmrg   fi
1174c41d98afSmrg   have_groff=yes
1175c41d98afSmrgelif test "x$use_groff" = x"no" ; then
1176c41d98afSmrg   if test "x$GROFF" != "x"; then
1177c41d98afSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1178c41d98afSmrg   fi
1179c41d98afSmrg   have_groff=no
1180c41d98afSmrgelse
1181c41d98afSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1182c41d98afSmrgfi
11839bc46bd4Smrg
1184c41d98afSmrg# We have groff, test for the presence of the macro packages
1185c41d98afSmrgif test "x$have_groff" = x"yes"; then
1186c41d98afSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1187c41d98afSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1188c41d98afSmrg        groff_ms_works=yes
1189c41d98afSmrg    else
1190c41d98afSmrg        groff_ms_works=no
1191c41d98afSmrg    fi
1192c41d98afSmrg    AC_MSG_RESULT([$groff_ms_works])
1193c41d98afSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1194c41d98afSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1195c41d98afSmrg        groff_mm_works=yes
1196c41d98afSmrg    else
1197c41d98afSmrg        groff_mm_works=no
1198c41d98afSmrg    fi
1199c41d98afSmrg    AC_MSG_RESULT([$groff_mm_works])
1200c41d98afSmrgfi
12019bc46bd4Smrg
1202c41d98afSmrg# We have groff, test for HTML dependencies, one command per package
1203c41d98afSmrgif test "x$have_groff" = x"yes"; then
1204c41d98afSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1205c41d98afSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1206c41d98afSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1207c41d98afSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1208c41d98afSmrg      have_groff_html=yes
1209c41d98afSmrg   else
1210c41d98afSmrg      have_groff_html=no
1211c41d98afSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1212c41d98afSmrg   fi
1213c41d98afSmrgfi
12149bc46bd4Smrg
1215c41d98afSmrg# Set Automake conditionals for Makefiles
1216c41d98afSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1217c41d98afSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1218c41d98afSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1219c41d98afSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1220c41d98afSmrg]) # XORG_WITH_GROFF
12219bc46bd4Smrg
1222c41d98afSmrg# XORG_WITH_FOP([DEFAULT])
1223c41d98afSmrg# ----------------
1224c41d98afSmrg# Minimum version: 1.6.0
1225c41d98afSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1226c41d98afSmrg#
1227c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
1228c41d98afSmrg# not at the appropriate level. This macro enables a module to test for the
1229c41d98afSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1230c41d98afSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1231c41d98afSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1232c41d98afSmrg# --with-fop assumes 'auto'.
1233c41d98afSmrg#
1234c41d98afSmrg# Interface to module:
1235c41d98afSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1236c41d98afSmrg# FOP:	 	returns the path of the fop program found
1237c41d98afSmrg#		returns the path set by the user in the environment
1238c41d98afSmrg# --with-fop: 	'yes' user instructs the module to use fop
1239c41d98afSmrg#		'no' user instructs the module not to use fop
1240c41d98afSmrg#
1241c41d98afSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1242c41d98afSmrg#
1243c41d98afSmrgAC_DEFUN([XORG_WITH_FOP],[
1244c41d98afSmrgAC_ARG_VAR([FOP], [Path to fop command])
1245c41d98afSmrgm4_define([_defopt], m4_default([$1], [auto]))
1246c41d98afSmrgAC_ARG_WITH(fop,
1247c41d98afSmrg	AS_HELP_STRING([--with-fop],
1248c41d98afSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1249c41d98afSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1250c41d98afSmrgm4_undefine([_defopt])
1251c41d98afSmrg
1252c41d98afSmrgif test "x$use_fop" = x"auto"; then
1253c41d98afSmrg   AC_PATH_PROG([FOP], [fop])
1254c41d98afSmrg   if test "x$FOP" = "x"; then
1255c41d98afSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1256c41d98afSmrg	have_fop=no
1257c41d98afSmrg   else
1258c41d98afSmrg        have_fop=yes
1259c41d98afSmrg   fi
1260c41d98afSmrgelif test "x$use_fop" = x"yes" ; then
1261c41d98afSmrg   AC_PATH_PROG([FOP], [fop])
1262c41d98afSmrg   if test "x$FOP" = "x"; then
1263c41d98afSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1264c41d98afSmrg   fi
1265c41d98afSmrg   have_fop=yes
1266c41d98afSmrgelif test "x$use_fop" = x"no" ; then
1267c41d98afSmrg   if test "x$FOP" != "x"; then
1268c41d98afSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1269c41d98afSmrg   fi
1270c41d98afSmrg   have_fop=no
1271c41d98afSmrgelse
1272c41d98afSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1273c41d98afSmrgfi
1274c41d98afSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1275c41d98afSmrg]) # XORG_WITH_FOP
12769bc46bd4Smrg
1277c41d98afSmrg# XORG_WITH_PS2PDF([DEFAULT])
1278c41d98afSmrg# ----------------
1279c41d98afSmrg# Minimum version: 1.6.0
1280c41d98afSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1281c41d98afSmrg#
1282c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
1283c41d98afSmrg# not at the appropriate level. This macro enables a module to test for the
1284c41d98afSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1285c41d98afSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1286c41d98afSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1287c41d98afSmrg# --with-ps2pdf assumes 'auto'.
1288c41d98afSmrg#
1289c41d98afSmrg# Interface to module:
1290c41d98afSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1291c41d98afSmrg# PS2PDF:	returns the path of the ps2pdf program found
1292c41d98afSmrg#		returns the path set by the user in the environment
1293c41d98afSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1294c41d98afSmrg#		 'no' user instructs the module not to use ps2pdf
1295c41d98afSmrg#
1296c41d98afSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1297c41d98afSmrg#
1298c41d98afSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1299c41d98afSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1300c41d98afSmrgm4_define([_defopt], m4_default([$1], [auto]))
1301c41d98afSmrgAC_ARG_WITH(ps2pdf,
1302c41d98afSmrg	AS_HELP_STRING([--with-ps2pdf],
1303c41d98afSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1304c41d98afSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1305c41d98afSmrgm4_undefine([_defopt])
1306c41d98afSmrg
1307c41d98afSmrgif test "x$use_ps2pdf" = x"auto"; then
1308c41d98afSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1309c41d98afSmrg   if test "x$PS2PDF" = "x"; then
1310c41d98afSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1311c41d98afSmrg	have_ps2pdf=no
1312c41d98afSmrg   else
1313c41d98afSmrg        have_ps2pdf=yes
1314c41d98afSmrg   fi
1315c41d98afSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1316c41d98afSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1317c41d98afSmrg   if test "x$PS2PDF" = "x"; then
1318c41d98afSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1319c41d98afSmrg   fi
1320c41d98afSmrg   have_ps2pdf=yes
1321c41d98afSmrgelif test "x$use_ps2pdf" = x"no" ; then
1322c41d98afSmrg   if test "x$PS2PDF" != "x"; then
1323c41d98afSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1324c41d98afSmrg   fi
1325c41d98afSmrg   have_ps2pdf=no
1326c41d98afSmrgelse
1327c41d98afSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1328c41d98afSmrgfi
1329c41d98afSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1330c41d98afSmrg]) # XORG_WITH_PS2PDF
13319bc46bd4Smrg
1332c41d98afSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1333c41d98afSmrg# ----------------
1334c41d98afSmrg# Minimum version: 1.6.0
1335c41d98afSmrg#
1336c41d98afSmrg# Documentation tools are not always available on all platforms and sometimes
1337c41d98afSmrg# not at the appropriate level. This macro enables a builder to skip all
1338c41d98afSmrg# documentation targets except traditional man pages.
1339c41d98afSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1340c41d98afSmrg# maximum flexibilty in controlling documentation building.
1341c41d98afSmrg# Refer to:
1342c41d98afSmrg# XORG_WITH_XMLTO         --with-xmlto
1343c41d98afSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1344c41d98afSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1345c41d98afSmrg# XORG_WITH_FOP           --with-fop
1346c41d98afSmrg# XORG_WITH_GROFF         --with-groff
1347c41d98afSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1348c41d98afSmrg#
1349c41d98afSmrg# Interface to module:
1350c41d98afSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1351c41d98afSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1352c41d98afSmrg#		 'no' user instructs the module not to generate docs
1353c41d98afSmrg# parm1:	specify the default value, yes or no.
1354c41d98afSmrg#
1355c41d98afSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1356c41d98afSmrgm4_define([default], m4_default([$1], [yes]))
1357c41d98afSmrgAC_ARG_ENABLE(docs,
1358c41d98afSmrg	AS_HELP_STRING([--enable-docs],
1359c41d98afSmrg	   [Enable building the documentation (default: ]default[)]),
1360c41d98afSmrg	   [build_docs=$enableval], [build_docs=]default)
1361c41d98afSmrgm4_undefine([default])
1362c41d98afSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1363c41d98afSmrgAC_MSG_CHECKING([whether to build documentation])
1364c41d98afSmrgAC_MSG_RESULT([$build_docs])
1365c41d98afSmrg]) # XORG_ENABLE_DOCS
1366c41d98afSmrg
1367c41d98afSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1368c41d98afSmrg# ----------------
1369c41d98afSmrg# Minimum version: 1.6.0
1370c41d98afSmrg#
1371c41d98afSmrg# This macro enables a builder to skip all developer documentation.
1372c41d98afSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1373c41d98afSmrg# maximum flexibilty in controlling documentation building.
1374c41d98afSmrg# Refer to:
1375c41d98afSmrg# XORG_WITH_XMLTO         --with-xmlto
1376c41d98afSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1377c41d98afSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1378c41d98afSmrg# XORG_WITH_FOP           --with-fop
1379c41d98afSmrg# XORG_WITH_GROFF         --with-groff
1380c41d98afSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1381c41d98afSmrg#
1382c41d98afSmrg# Interface to module:
1383c41d98afSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1384c41d98afSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1385c41d98afSmrg#			'no' user instructs the module not to generate developer docs
1386c41d98afSmrg# parm1:		specify the default value, yes or no.
1387c41d98afSmrg#
1388c41d98afSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1389c41d98afSmrgm4_define([devel_default], m4_default([$1], [yes]))
1390c41d98afSmrgAC_ARG_ENABLE(devel-docs,
1391c41d98afSmrg	AS_HELP_STRING([--enable-devel-docs],
1392c41d98afSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1393c41d98afSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1394c41d98afSmrgm4_undefine([devel_default])
1395c41d98afSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1396c41d98afSmrgAC_MSG_CHECKING([whether to build developer documentation])
1397c41d98afSmrgAC_MSG_RESULT([$build_devel_docs])
1398c41d98afSmrg]) # XORG_ENABLE_DEVEL_DOCS
1399c41d98afSmrg
1400c41d98afSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1401c41d98afSmrg# ----------------
1402c41d98afSmrg# Minimum version: 1.6.0
1403c41d98afSmrg#
1404c41d98afSmrg# This macro enables a builder to skip all functional specification targets.
1405c41d98afSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1406c41d98afSmrg# maximum flexibilty in controlling documentation building.
1407c41d98afSmrg# Refer to:
1408c41d98afSmrg# XORG_WITH_XMLTO         --with-xmlto
1409c41d98afSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1410c41d98afSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1411c41d98afSmrg# XORG_WITH_FOP           --with-fop
1412c41d98afSmrg# XORG_WITH_GROFF         --with-groff
1413c41d98afSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1414c41d98afSmrg#
1415c41d98afSmrg# Interface to module:
1416c41d98afSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1417c41d98afSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1418c41d98afSmrg#			'no' user instructs the module not to generate specs
1419c41d98afSmrg# parm1:		specify the default value, yes or no.
1420c41d98afSmrg#
1421c41d98afSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1422c41d98afSmrgm4_define([spec_default], m4_default([$1], [yes]))
1423c41d98afSmrgAC_ARG_ENABLE(specs,
1424c41d98afSmrg	AS_HELP_STRING([--enable-specs],
1425c41d98afSmrg	   [Enable building the specs (default: ]spec_default[)]),
1426c41d98afSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1427c41d98afSmrgm4_undefine([spec_default])
1428c41d98afSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1429c41d98afSmrgAC_MSG_CHECKING([whether to build functional specifications])
1430c41d98afSmrgAC_MSG_RESULT([$build_specs])
1431c41d98afSmrg]) # XORG_ENABLE_SPECS
14329bc46bd4Smrg
1433c41d98afSmrg# XORG_CHECK_MALLOC_ZERO
1434c41d98afSmrg# ----------------------
1435c41d98afSmrg# Minimum version: 1.0.0
1436c41d98afSmrg#
1437c41d98afSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1438c41d98afSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1439c41d98afSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1440c41d98afSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1441c41d98afSmrgAC_ARG_ENABLE(malloc0returnsnull,
1442c41d98afSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1443c41d98afSmrg		       [malloc(0) returns NULL (default: auto)]),
1444c41d98afSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1445c41d98afSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
14469bc46bd4Smrg
1447c41d98afSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1448c41d98afSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1449c41d98afSmrg	AC_RUN_IFELSE([
1450c41d98afSmrgchar *malloc();
1451c41d98afSmrgchar *realloc();
1452c41d98afSmrgchar *calloc();
1453c41d98afSmrgmain() {
1454c41d98afSmrg    char *m0, *r0, *c0, *p;
1455c41d98afSmrg    m0 = malloc(0);
1456c41d98afSmrg    p = malloc(10);
1457c41d98afSmrg    r0 = realloc(p,0);
1458c41d98afSmrg    c0 = calloc(0);
1459c41d98afSmrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1460c41d98afSmrg}],
1461c41d98afSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1462c41d98afSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
1463c41d98afSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1464c41d98afSmrgfi
1465c41d98afSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
14669bc46bd4Smrg
1467c41d98afSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1468c41d98afSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1469c41d98afSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1470c41d98afSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1471c41d98afSmrgelse
1472c41d98afSmrg	MALLOC_ZERO_CFLAGS=""
1473c41d98afSmrg	XMALLOC_ZERO_CFLAGS=""
1474c41d98afSmrg	XTMALLOC_ZERO_CFLAGS=""
1475c41d98afSmrgfi
1476c41d98afSmrg
1477c41d98afSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1478c41d98afSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1479c41d98afSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1480c41d98afSmrg]) # XORG_CHECK_MALLOC_ZERO
14819bc46bd4Smrg
1482c41d98afSmrg# XORG_WITH_LINT()
1483c41d98afSmrg# ----------------
14849bc46bd4Smrg# Minimum version: 1.1.0
14859bc46bd4Smrg#
1486c41d98afSmrg# This macro enables the use of a tool that flags some suspicious and
1487c41d98afSmrg# non-portable constructs (likely to be bugs) in C language source code.
1488c41d98afSmrg# It will attempt to locate the tool and use appropriate options.
1489c41d98afSmrg# There are various lint type tools on different platforms.
14909bc46bd4Smrg#
1491c41d98afSmrg# Interface to module:
1492c41d98afSmrg# LINT:		returns the path to the tool found on the platform
1493c41d98afSmrg#		or the value set to LINT on the configure cmd line
1494c41d98afSmrg#		also an Automake conditional
1495c41d98afSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
14969bc46bd4Smrg#
1497c41d98afSmrg# --with-lint:	'yes' user instructs the module to use lint
1498c41d98afSmrg#		'no' user instructs the module not to use lint (default)
14999bc46bd4Smrg#
1500c41d98afSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1501c41d98afSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1502c41d98afSmrg#
1503c41d98afSmrgAC_DEFUN([XORG_WITH_LINT],[
15049bc46bd4Smrg
1505c41d98afSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1506c41d98afSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1507c41d98afSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1508c41d98afSmrg		[Use a lint-style source code checker (default: disabled)])],
1509c41d98afSmrg		[use_lint=$withval], [use_lint=no])
15109bc46bd4Smrg
1511c41d98afSmrg# Obtain platform specific info like program name and options
1512c41d98afSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1513c41d98afSmrgcase $host_os in
1514c41d98afSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1515c41d98afSmrg	lint_name=splint
1516c41d98afSmrg	lint_options="-badflag"
1517c41d98afSmrg	;;
1518c41d98afSmrg  *freebsd* | *netbsd*)
1519c41d98afSmrg	lint_name=lint
1520c41d98afSmrg	lint_options="-u -b"
1521c41d98afSmrg	;;
1522c41d98afSmrg  *solaris*)
1523c41d98afSmrg	lint_name=lint
1524c41d98afSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1525c41d98afSmrg	;;
1526c41d98afSmrgesac
15279bc46bd4Smrg
1528c41d98afSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1529c41d98afSmrgif test "x$use_lint" = x"yes" ; then
1530c41d98afSmrg   AC_PATH_PROG([LINT], [$lint_name])
1531c41d98afSmrg   if test "x$LINT" = "x"; then
1532c41d98afSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1533c41d98afSmrg   fi
1534c41d98afSmrgelif test "x$use_lint" = x"no" ; then
1535c41d98afSmrg   if test "x$LINT" != "x"; then
1536c41d98afSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1537c41d98afSmrg   fi
1538c41d98afSmrgelse
1539c41d98afSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1540c41d98afSmrgfi
15419bc46bd4Smrg
1542c41d98afSmrg# User supplied flags override default flags
1543c41d98afSmrgif test "x$LINT_FLAGS" != "x"; then
1544c41d98afSmrg   lint_options=$LINT_FLAGS
1545c41d98afSmrgfi
15469bc46bd4Smrg
1547c41d98afSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1548c41d98afSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
15499bc46bd4Smrg
1550c41d98afSmrg]) # XORG_WITH_LINT
15519bc46bd4Smrg
1552c41d98afSmrg# XORG_LINT_LIBRARY(LIBNAME)
1553c41d98afSmrg# --------------------------
15549bc46bd4Smrg# Minimum version: 1.1.0
15559bc46bd4Smrg#
1556c41d98afSmrg# Sets up flags for building lint libraries for checking programs that call
1557c41d98afSmrg# functions in the library.
15589bc46bd4Smrg#
1559c41d98afSmrg# Interface to module:
1560c41d98afSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1561c41d98afSmrg# MAKE_LINT_LIB		- Automake conditional
15629bc46bd4Smrg#
1563c41d98afSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1564c41d98afSmrg#			  - 'no' user instructs the module not to create a lint library (default)
15659bc46bd4Smrg
1566c41d98afSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1567c41d98afSmrgAC_REQUIRE([XORG_WITH_LINT])
1568c41d98afSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1569c41d98afSmrg	[Create lint library (default: disabled)])],
1570c41d98afSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
15719bc46bd4Smrg
1572c41d98afSmrgif test "x$make_lint_lib" = x"yes" ; then
1573c41d98afSmrg   LINTLIB=llib-l$1.ln
1574c41d98afSmrg   if test "x$LINT" = "x"; then
1575c41d98afSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1576c41d98afSmrg   fi
1577c41d98afSmrgelif test "x$make_lint_lib" != x"no" ; then
1578c41d98afSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1579c41d98afSmrgfi
15809bc46bd4Smrg
1581c41d98afSmrgAC_SUBST(LINTLIB)
1582c41d98afSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
15839bc46bd4Smrg
1584c41d98afSmrg]) # XORG_LINT_LIBRARY
15859bc46bd4Smrg
1586c41d98afSmrg# XORG_CWARNFLAGS
1587c41d98afSmrg# ---------------
1588c41d98afSmrg# Minimum version: 1.2.0
15899bc46bd4Smrg#
1590c41d98afSmrg# Defines CWARNFLAGS to enable C compiler warnings.
15919bc46bd4Smrg#
1592c41d98afSmrgAC_DEFUN([XORG_CWARNFLAGS], [
1593c41d98afSmrgAC_REQUIRE([AC_PROG_CC_C99])
1594c41d98afSmrgif  test "x$GCC" = xyes ; then
1595c41d98afSmrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
1596c41d98afSmrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
1597c41d98afSmrg-Wbad-function-cast -Wformat=2"
1598c41d98afSmrg    case `$CC -dumpversion` in
1599c41d98afSmrg    3.4.* | 4.*)
1600c41d98afSmrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
1601c41d98afSmrg	;;
1602c41d98afSmrg    esac
1603c41d98afSmrgelse
1604c41d98afSmrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1605c41d98afSmrg    if test "x$SUNCC" = "xyes"; then
1606c41d98afSmrg	CWARNFLAGS="-v"
1607c41d98afSmrg    fi
1608c41d98afSmrgfi
1609c41d98afSmrgAC_SUBST(CWARNFLAGS)
1610c41d98afSmrg]) # XORG_CWARNFLAGS
16119bc46bd4Smrg
1612c41d98afSmrg# XORG_STRICT_OPTION
1613c41d98afSmrg# -----------------------
1614c41d98afSmrg# Minimum version: 1.3.0
16159bc46bd4Smrg#
1616c41d98afSmrg# Add configure option to enable strict compilation
1617c41d98afSmrgAC_DEFUN([XORG_STRICT_OPTION], [
1618c41d98afSmrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
1619c41d98afSmrgAC_REQUIRE([AC_PROG_CC_C99])
1620c41d98afSmrgAC_REQUIRE([XORG_CWARNFLAGS])
16219bc46bd4Smrg
1622c41d98afSmrgAC_ARG_ENABLE(strict-compilation,
1623c41d98afSmrg			  AS_HELP_STRING([--enable-strict-compilation],
1624c41d98afSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
1625c41d98afSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
1626c41d98afSmrgif test "x$STRICT_COMPILE" = "xyes"; then
1627c41d98afSmrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1628c41d98afSmrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1629c41d98afSmrg	if test "x$GCC" = xyes ; then
1630c41d98afSmrg		STRICT_CFLAGS="-pedantic -Werror"
1631c41d98afSmrg	elif test "x$SUNCC" = "xyes"; then
1632c41d98afSmrg		STRICT_CFLAGS="-errwarn"
1633c41d98afSmrg    elif test "x$INTELCC" = "xyes"; then
1634c41d98afSmrg		STRICT_CFLAGS="-Werror"
1635c41d98afSmrg	fi
1636c41d98afSmrgfi
1637c41d98afSmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
1638c41d98afSmrgAC_SUBST([CWARNFLAGS])
1639c41d98afSmrg]) # XORG_STRICT_OPTION
16409bc46bd4Smrg
1641c41d98afSmrg# XORG_DEFAULT_OPTIONS
16429bc46bd4Smrg# --------------------
1643c41d98afSmrg# Minimum version: 1.3.0
16449bc46bd4Smrg#
1645c41d98afSmrg# Defines default options for X.Org modules.
1646c41d98afSmrg#
1647c41d98afSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
1648c41d98afSmrgAC_REQUIRE([AC_PROG_INSTALL])
1649c41d98afSmrgXORG_CWARNFLAGS
1650c41d98afSmrgXORG_STRICT_OPTION
1651c41d98afSmrgXORG_RELEASE_VERSION
1652c41d98afSmrgXORG_CHANGELOG
1653c41d98afSmrgXORG_INSTALL
1654c41d98afSmrgXORG_MANPAGE_SECTIONS
1655c41d98afSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
1656c41d98afSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
1657c41d98afSmrg]) # XORG_DEFAULT_OPTIONS
16589bc46bd4Smrg
1659c41d98afSmrg# XORG_INSTALL()
1660c41d98afSmrg# ----------------
1661c41d98afSmrg# Minimum version: 1.4.0
1662c41d98afSmrg#
1663c41d98afSmrg# Defines the variable INSTALL_CMD as the command to copy
1664c41d98afSmrg# INSTALL from $prefix/share/util-macros.
1665c41d98afSmrg#
1666c41d98afSmrgAC_DEFUN([XORG_INSTALL], [
1667c41d98afSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1668c41d98afSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
1669c41d98afSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
1670c41d98afSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
1671c41d98afSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
1672c41d98afSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
1673c41d98afSmrgAC_SUBST([INSTALL_CMD])
1674c41d98afSmrg]) # XORG_INSTALL
1675c41d98afSmrgdnl Copyright 2005 Red Hat, Inc
1676c41d98afSmrgdnl
1677c41d98afSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1678c41d98afSmrgdnl documentation for any purpose is hereby granted without fee, provided that
1679c41d98afSmrgdnl the above copyright notice appear in all copies and that both that
1680c41d98afSmrgdnl copyright notice and this permission notice appear in supporting
1681c41d98afSmrgdnl documentation.
1682c41d98afSmrgdnl
1683c41d98afSmrgdnl The above copyright notice and this permission notice shall be included
1684c41d98afSmrgdnl in all copies or substantial portions of the Software.
1685c41d98afSmrgdnl
1686c41d98afSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1687c41d98afSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1688c41d98afSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1689c41d98afSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1690c41d98afSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1691c41d98afSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1692c41d98afSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
1693c41d98afSmrgdnl
1694c41d98afSmrgdnl Except as contained in this notice, the name of the copyright holders shall
1695c41d98afSmrgdnl not be used in advertising or otherwise to promote the sale, use or
1696c41d98afSmrgdnl other dealings in this Software without prior written authorization
1697c41d98afSmrgdnl from the copyright holders.
1698c41d98afSmrgdnl
16999bc46bd4Smrg
1700c41d98afSmrg# XORG_RELEASE_VERSION
1701c41d98afSmrg# --------------------
1702c41d98afSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
1703c41d98afSmrg 
1704c41d98afSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
1705c41d98afSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
1706c41d98afSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
1707c41d98afSmrg		[Major version of this package])
1708c41d98afSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
1709c41d98afSmrg	if test "x$PVM" = "x"; then
1710c41d98afSmrg		PVM="0"
17119bc46bd4Smrg	fi
1712c41d98afSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
1713c41d98afSmrg		[$PVM],
1714c41d98afSmrg		[Minor version of this package])
1715c41d98afSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
1716c41d98afSmrg	if test "x$PVP" = "x"; then
1717c41d98afSmrg		PVP="0"
17189bc46bd4Smrg	fi
1719c41d98afSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
1720c41d98afSmrg		[$PVP],
1721c41d98afSmrg		[Patch version of this package])
17229bc46bd4Smrg])
17239bc46bd4Smrg
1724c41d98afSmrg# XORG_CHANGELOG()
1725c41d98afSmrg# ----------------
1726c41d98afSmrg# Minimum version: 1.2.0
17279bc46bd4Smrg#
1728c41d98afSmrg# Defines the variable CHANGELOG_CMD as the command to generate
1729c41d98afSmrg# ChangeLog from git.
1730c41d98afSmrg#
1731c41d98afSmrg#
1732c41d98afSmrgAC_DEFUN([XORG_CHANGELOG], [
1733c41d98afSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
1734c41d98afSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
1735c41d98afSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
1736c41d98afSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
1737c41d98afSmrgAC_SUBST([CHANGELOG_CMD])
1738c41d98afSmrg]) # XORG_CHANGELOG
17399bc46bd4Smrg
1740c41d98afSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
1741c41d98afSmrg#
1742c41d98afSmrg# This file is free software; the Free Software Foundation
1743c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
1744c41d98afSmrg# with or without modifications, as long as this notice is preserved.
17459bc46bd4Smrg
1746c41d98afSmrg# AM_AUTOMAKE_VERSION(VERSION)
1747c41d98afSmrg# ----------------------------
1748c41d98afSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
1749c41d98afSmrg# generated from the m4 files accompanying Automake X.Y.
1750c41d98afSmrg# (This private macro should not be called outside this file.)
1751c41d98afSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
1752c41d98afSmrg[am__api_version='1.11'
1753c41d98afSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
1754c41d98afSmrgdnl require some minimum version.  Point them to the right macro.
1755c41d98afSmrgm4_if([$1], [1.11.1], [],
1756c41d98afSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
1757c41d98afSmrg])
17589bc46bd4Smrg
1759c41d98afSmrg# _AM_AUTOCONF_VERSION(VERSION)
1760c41d98afSmrg# -----------------------------
1761c41d98afSmrg# aclocal traces this macro to find the Autoconf version.
1762c41d98afSmrg# This is a private macro too.  Using m4_define simplifies
1763c41d98afSmrg# the logic in aclocal, which can simply ignore this definition.
1764c41d98afSmrgm4_define([_AM_AUTOCONF_VERSION], [])
17659bc46bd4Smrg
1766c41d98afSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
1767c41d98afSmrg# -------------------------------
1768c41d98afSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
1769c41d98afSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
1770c41d98afSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1771c41d98afSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
1772c41d98afSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1773c41d98afSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1774c41d98afSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
17759bc46bd4Smrg
1776c41d98afSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
17779bc46bd4Smrg
1778c41d98afSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
17799bc46bd4Smrg#
1780c41d98afSmrg# This file is free software; the Free Software Foundation
1781c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
1782c41d98afSmrg# with or without modifications, as long as this notice is preserved.
1783c41d98afSmrg
1784c41d98afSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
1785c41d98afSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
1786c41d98afSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
17879bc46bd4Smrg#
1788c41d98afSmrg# Of course, Automake must honor this variable whenever it calls a
1789c41d98afSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
1790c41d98afSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
1791c41d98afSmrg# depending on how configure is run.  This is pretty annoying, since
1792c41d98afSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
1793c41d98afSmrg# source directory, any form will work fine, but in subdirectories a
1794c41d98afSmrg# relative path needs to be adjusted first.
17959bc46bd4Smrg#
1796c41d98afSmrg# $ac_aux_dir/missing
1797c41d98afSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
1798c41d98afSmrg# $top_srcdir/$ac_aux_dir/missing
1799c41d98afSmrg#    fails if $ac_aux_dir is absolute,
1800c41d98afSmrg#    fails when called from a subdirectory in a VPATH build with
1801c41d98afSmrg#          a relative $ac_aux_dir
18029bc46bd4Smrg#
1803c41d98afSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
1804c41d98afSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
1805c41d98afSmrg# harmless because $srcdir is `.', but things will broke when you
1806c41d98afSmrg# start a VPATH build or use an absolute $srcdir.
18079bc46bd4Smrg#
1808c41d98afSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
1809c41d98afSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
1810c41d98afSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
1811c41d98afSmrg# and then we would define $MISSING as
1812c41d98afSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
1813c41d98afSmrg# This will work as long as MISSING is not called from configure, because
1814c41d98afSmrg# unfortunately $(top_srcdir) has no meaning in configure.
1815c41d98afSmrg# However there are other variables, like CC, which are often used in
1816c41d98afSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1817c41d98afSmrg#
1818c41d98afSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1819c41d98afSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1820c41d98afSmrg# configured tree to be moved without reconfiguration.
18219bc46bd4Smrg
1822c41d98afSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1823c41d98afSmrg[dnl Rely on autoconf to set up CDPATH properly.
1824c41d98afSmrgAC_PREREQ([2.50])dnl
1825c41d98afSmrg# expand $ac_aux_dir to an absolute path
1826c41d98afSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
1827c41d98afSmrg])
1828c41d98afSmrg
1829c41d98afSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1830c41d98afSmrg
1831c41d98afSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
1832c41d98afSmrg# Free Software Foundation, Inc.
1833c41d98afSmrg#
1834c41d98afSmrg# This file is free software; the Free Software Foundation
1835c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
1836c41d98afSmrg# with or without modifications, as long as this notice is preserved.
18379bc46bd4Smrg
1838c41d98afSmrg# serial 9
1839c41d98afSmrg
1840c41d98afSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1841c41d98afSmrg# -------------------------------------
1842c41d98afSmrg# Define a conditional.
1843c41d98afSmrgAC_DEFUN([AM_CONDITIONAL],
1844c41d98afSmrg[AC_PREREQ(2.52)dnl
1845c41d98afSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1846c41d98afSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1847c41d98afSmrgAC_SUBST([$1_TRUE])dnl
1848c41d98afSmrgAC_SUBST([$1_FALSE])dnl
1849c41d98afSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1850c41d98afSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1851c41d98afSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1852c41d98afSmrgif $2; then
1853c41d98afSmrg  $1_TRUE=
1854c41d98afSmrg  $1_FALSE='#'
18559bc46bd4Smrgelse
1856c41d98afSmrg  $1_TRUE='#'
1857c41d98afSmrg  $1_FALSE=
18589bc46bd4Smrgfi
1859c41d98afSmrgAC_CONFIG_COMMANDS_PRE(
1860c41d98afSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1861c41d98afSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1862c41d98afSmrgUsually this means the macro was only invoked conditionally.]])
1863c41d98afSmrgfi])])
18649bc46bd4Smrg
1865c41d98afSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
1866c41d98afSmrg# Free Software Foundation, Inc.
18679bc46bd4Smrg#
1868c41d98afSmrg# This file is free software; the Free Software Foundation
1869c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
1870c41d98afSmrg# with or without modifications, as long as this notice is preserved.
18719bc46bd4Smrg
1872c41d98afSmrg# serial 10
18739bc46bd4Smrg
1874c41d98afSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1875c41d98afSmrg# written in clear, in which case automake, when reading aclocal.m4,
1876c41d98afSmrg# will think it sees a *use*, and therefore will trigger all it's
1877c41d98afSmrg# C support machinery.  Also note that it means that autoscan, seeing
1878c41d98afSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
18799bc46bd4Smrg
18809bc46bd4Smrg
1881c41d98afSmrg# _AM_DEPENDENCIES(NAME)
1882c41d98afSmrg# ----------------------
1883c41d98afSmrg# See how the compiler implements dependency checking.
1884c41d98afSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
1885c41d98afSmrg# We try a few techniques and use that to set a single cache variable.
1886c41d98afSmrg#
1887c41d98afSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1888c41d98afSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1889c41d98afSmrg# dependency, and given that the user is not expected to run this macro,
1890c41d98afSmrg# just rely on AC_PROG_CC.
1891c41d98afSmrgAC_DEFUN([_AM_DEPENDENCIES],
1892c41d98afSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1893c41d98afSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1894c41d98afSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1895c41d98afSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
18969bc46bd4Smrg
1897c41d98afSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1898c41d98afSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1899c41d98afSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1900c41d98afSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
1901c41d98afSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1902c41d98afSmrg                   [depcc="$$1"   am_compiler_list=])
19039bc46bd4Smrg
1904c41d98afSmrgAC_CACHE_CHECK([dependency style of $depcc],
1905c41d98afSmrg               [am_cv_$1_dependencies_compiler_type],
1906c41d98afSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1907c41d98afSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1908c41d98afSmrg  # making bogus files that we don't know about and never remove.  For
1909c41d98afSmrg  # instance it was reported that on HP-UX the gcc test will end up
1910c41d98afSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
1911c41d98afSmrg  # in D'.
1912c41d98afSmrg  mkdir conftest.dir
1913c41d98afSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1914c41d98afSmrg  # using a relative directory.
1915c41d98afSmrg  cp "$am_depcomp" conftest.dir
1916c41d98afSmrg  cd conftest.dir
1917c41d98afSmrg  # We will build objects and dependencies in a subdirectory because
1918c41d98afSmrg  # it helps to detect inapplicable dependency modes.  For instance
1919c41d98afSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1920c41d98afSmrg  # side effect of compilation, but ICC will put the dependencies in
1921c41d98afSmrg  # the current directory while Tru64 will put them in the object
1922c41d98afSmrg  # directory.
1923c41d98afSmrg  mkdir sub
19249bc46bd4Smrg
1925c41d98afSmrg  am_cv_$1_dependencies_compiler_type=none
1926c41d98afSmrg  if test "$am_compiler_list" = ""; then
1927c41d98afSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
1928c41d98afSmrg  fi
1929c41d98afSmrg  am__universal=false
1930c41d98afSmrg  m4_case([$1], [CC],
1931c41d98afSmrg    [case " $depcc " in #(
1932c41d98afSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
1933c41d98afSmrg     esac],
1934c41d98afSmrg    [CXX],
1935c41d98afSmrg    [case " $depcc " in #(
1936c41d98afSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
1937c41d98afSmrg     esac])
1938c41d98afSmrg
1939c41d98afSmrg  for depmode in $am_compiler_list; do
1940c41d98afSmrg    # Setup a source with many dependencies, because some compilers
1941c41d98afSmrg    # like to wrap large dependency lists on column 80 (with \), and
1942c41d98afSmrg    # we should not choose a depcomp mode which is confused by this.
1943c41d98afSmrg    #
1944c41d98afSmrg    # We need to recreate these files for each test, as the compiler may
1945c41d98afSmrg    # overwrite some of them when testing with obscure command lines.
1946c41d98afSmrg    # This happens at least with the AIX C compiler.
1947c41d98afSmrg    : > sub/conftest.c
1948c41d98afSmrg    for i in 1 2 3 4 5 6; do
1949c41d98afSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
1950c41d98afSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
1951c41d98afSmrg      # Solaris 8's {/usr,}/bin/sh.
1952c41d98afSmrg      touch sub/conftst$i.h
1953c41d98afSmrg    done
1954c41d98afSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
1955c41d98afSmrg
1956c41d98afSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
1957c41d98afSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
1958c41d98afSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
1959c41d98afSmrg    # versions had trouble with output in subdirs
1960c41d98afSmrg    am__obj=sub/conftest.${OBJEXT-o}
1961c41d98afSmrg    am__minus_obj="-o $am__obj"
1962c41d98afSmrg    case $depmode in
1963c41d98afSmrg    gcc)
1964c41d98afSmrg      # This depmode causes a compiler race in universal mode.
1965c41d98afSmrg      test "$am__universal" = false || continue
1966c41d98afSmrg      ;;
1967c41d98afSmrg    nosideeffect)
1968c41d98afSmrg      # after this tag, mechanisms are not by side-effect, so they'll
1969c41d98afSmrg      # only be used when explicitly requested
1970c41d98afSmrg      if test "x$enable_dependency_tracking" = xyes; then
1971c41d98afSmrg	continue
1972c41d98afSmrg      else
1973c41d98afSmrg	break
1974c41d98afSmrg      fi
1975c41d98afSmrg      ;;
1976c41d98afSmrg    msvisualcpp | msvcmsys)
1977c41d98afSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
1978c41d98afSmrg      # not run yet.  These depmodes are late enough in the game, and
1979c41d98afSmrg      # so weak that their functioning should not be impacted.
1980c41d98afSmrg      am__obj=conftest.${OBJEXT-o}
1981c41d98afSmrg      am__minus_obj=
1982c41d98afSmrg      ;;
1983c41d98afSmrg    none) break ;;
19849bc46bd4Smrg    esac
1985c41d98afSmrg    if depmode=$depmode \
1986c41d98afSmrg       source=sub/conftest.c object=$am__obj \
1987c41d98afSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
1988c41d98afSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
1989c41d98afSmrg         >/dev/null 2>conftest.err &&
1990c41d98afSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
1991c41d98afSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
1992c41d98afSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
1993c41d98afSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
1994c41d98afSmrg      # icc doesn't choke on unknown options, it will just issue warnings
1995c41d98afSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
1996c41d98afSmrg      # that says an option was ignored or not supported.
1997c41d98afSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
1998c41d98afSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
1999c41d98afSmrg      # The diagnosis changed in icc 8.0:
2000c41d98afSmrg      #   icc: Command line remark: option '-MP' not supported
2001c41d98afSmrg      if (grep 'ignoring option' conftest.err ||
2002c41d98afSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2003c41d98afSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2004c41d98afSmrg        break
2005c41d98afSmrg      fi
2006c41d98afSmrg    fi
2007c41d98afSmrg  done
2008c41d98afSmrg
2009c41d98afSmrg  cd ..
2010c41d98afSmrg  rm -rf conftest.dir
2011c41d98afSmrgelse
2012c41d98afSmrg  am_cv_$1_dependencies_compiler_type=none
20139bc46bd4Smrgfi
2014c41d98afSmrg])
2015c41d98afSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2016c41d98afSmrgAM_CONDITIONAL([am__fastdep$1], [
2017c41d98afSmrg  test "x$enable_dependency_tracking" != xno \
2018c41d98afSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2019c41d98afSmrg])
2020c41d98afSmrg
2021c41d98afSmrg
2022c41d98afSmrg# AM_SET_DEPDIR
2023c41d98afSmrg# -------------
2024c41d98afSmrg# Choose a directory name for dependency files.
2025c41d98afSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
2026c41d98afSmrgAC_DEFUN([AM_SET_DEPDIR],
2027c41d98afSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2028c41d98afSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2029c41d98afSmrg])
2030c41d98afSmrg
2031c41d98afSmrg
2032c41d98afSmrg# AM_DEP_TRACK
2033c41d98afSmrg# ------------
2034c41d98afSmrgAC_DEFUN([AM_DEP_TRACK],
2035c41d98afSmrg[AC_ARG_ENABLE(dependency-tracking,
2036c41d98afSmrg[  --disable-dependency-tracking  speeds up one-time build
2037c41d98afSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
2038c41d98afSmrgif test "x$enable_dependency_tracking" != xno; then
2039c41d98afSmrg  am_depcomp="$ac_aux_dir/depcomp"
2040c41d98afSmrg  AMDEPBACKSLASH='\'
20419bc46bd4Smrgfi
2042c41d98afSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2043c41d98afSmrgAC_SUBST([AMDEPBACKSLASH])dnl
2044c41d98afSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2045c41d98afSmrg])
20469bc46bd4Smrg
2047c41d98afSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
20489bc46bd4Smrg
2049c41d98afSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
2050c41d98afSmrg# Free Software Foundation, Inc.
20519bc46bd4Smrg#
2052c41d98afSmrg# This file is free software; the Free Software Foundation
2053c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2054c41d98afSmrg# with or without modifications, as long as this notice is preserved.
20559bc46bd4Smrg
2056c41d98afSmrg#serial 5
20579bc46bd4Smrg
2058c41d98afSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2059c41d98afSmrg# ------------------------------
2060c41d98afSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2061c41d98afSmrg[{
2062c41d98afSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
2063c41d98afSmrg  # are listed without --file.  Let's play safe and only enable the eval
2064c41d98afSmrg  # if we detect the quoting.
2065c41d98afSmrg  case $CONFIG_FILES in
2066c41d98afSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
2067c41d98afSmrg  *)   set x $CONFIG_FILES ;;
2068c41d98afSmrg  esac
2069c41d98afSmrg  shift
2070c41d98afSmrg  for mf
2071c41d98afSmrg  do
2072c41d98afSmrg    # Strip MF so we end up with the name of the file.
2073c41d98afSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
2074c41d98afSmrg    # Check whether this is an Automake generated Makefile or not.
2075c41d98afSmrg    # We used to match only the files named `Makefile.in', but
2076c41d98afSmrg    # some people rename them; so instead we look at the file content.
2077c41d98afSmrg    # Grep'ing the first line is not enough: some people post-process
2078c41d98afSmrg    # each Makefile.in and add a new line on top of each file to say so.
2079c41d98afSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
2080c41d98afSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
2081c41d98afSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2082c41d98afSmrg      dirpart=`AS_DIRNAME("$mf")`
2083c41d98afSmrg    else
2084c41d98afSmrg      continue
2085c41d98afSmrg    fi
2086c41d98afSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
2087c41d98afSmrg    # from the Makefile without running `make'.
2088c41d98afSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2089c41d98afSmrg    test -z "$DEPDIR" && continue
2090c41d98afSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2091c41d98afSmrg    test -z "am__include" && continue
2092c41d98afSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2093c41d98afSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
2094c41d98afSmrg    U=`sed -n 's/^U = //p' < "$mf"`
2095c41d98afSmrg    # Find all dependency output files, they are included files with
2096c41d98afSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2097c41d98afSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
2098c41d98afSmrg    # expansion.
2099c41d98afSmrg    for file in `sed -n "
2100c41d98afSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2101c41d98afSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
2102c41d98afSmrg      # Make sure the directory exists.
2103c41d98afSmrg      test -f "$dirpart/$file" && continue
2104c41d98afSmrg      fdir=`AS_DIRNAME(["$file"])`
2105c41d98afSmrg      AS_MKDIR_P([$dirpart/$fdir])
2106c41d98afSmrg      # echo "creating $dirpart/$file"
2107c41d98afSmrg      echo '# dummy' > "$dirpart/$file"
2108c41d98afSmrg    done
2109c41d98afSmrg  done
2110c41d98afSmrg}
2111c41d98afSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
21129bc46bd4Smrg
21139bc46bd4Smrg
2114c41d98afSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2115c41d98afSmrg# -----------------------------
2116c41d98afSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2117c41d98afSmrg#
2118c41d98afSmrg# This code is only required when automatic dependency tracking
2119c41d98afSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
2120c41d98afSmrg# need in order to bootstrap the dependency handling code.
2121c41d98afSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2122c41d98afSmrg[AC_CONFIG_COMMANDS([depfiles],
2123c41d98afSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2124c41d98afSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2125c41d98afSmrg])
21269bc46bd4Smrg
2127c41d98afSmrg# Do all the work for Automake.                             -*- Autoconf -*-
21289bc46bd4Smrg
2129c41d98afSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2130c41d98afSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
2131c41d98afSmrg#
2132c41d98afSmrg# This file is free software; the Free Software Foundation
2133c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2134c41d98afSmrg# with or without modifications, as long as this notice is preserved.
2135c41d98afSmrg
2136c41d98afSmrg# serial 16
21379bc46bd4Smrg
2138c41d98afSmrg# This macro actually does too much.  Some checks are only needed if
2139c41d98afSmrg# your package does certain things.  But this isn't really a big deal.
21409bc46bd4Smrg
2141c41d98afSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2142c41d98afSmrg# AM_INIT_AUTOMAKE([OPTIONS])
2143c41d98afSmrg# -----------------------------------------------
2144c41d98afSmrg# The call with PACKAGE and VERSION arguments is the old style
2145c41d98afSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2146c41d98afSmrg# and VERSION should now be passed to AC_INIT and removed from
2147c41d98afSmrg# the call to AM_INIT_AUTOMAKE.
2148c41d98afSmrg# We support both call styles for the transition.  After
2149c41d98afSmrg# the next Automake release, Autoconf can make the AC_INIT
2150c41d98afSmrg# arguments mandatory, and then we can depend on a new Autoconf
2151c41d98afSmrg# release and drop the old call support.
2152c41d98afSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
2153c41d98afSmrg[AC_PREREQ([2.62])dnl
2154c41d98afSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2155c41d98afSmrgdnl the ones we care about.
2156c41d98afSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2157c41d98afSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2158c41d98afSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2159c41d98afSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2160c41d98afSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2161c41d98afSmrg  # is not polluted with repeated "-I."
2162c41d98afSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2163c41d98afSmrg  # test to see if srcdir already configured
2164c41d98afSmrg  if test -f $srcdir/config.status; then
2165c41d98afSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2166c41d98afSmrg  fi
21679bc46bd4Smrgfi
21683294c433Smrg
2169c41d98afSmrg# test whether we have cygpath
2170c41d98afSmrgif test -z "$CYGPATH_W"; then
2171c41d98afSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2172c41d98afSmrg    CYGPATH_W='cygpath -w'
2173c41d98afSmrg  else
2174c41d98afSmrg    CYGPATH_W=echo
2175c41d98afSmrg  fi
2176c41d98afSmrgfi
2177c41d98afSmrgAC_SUBST([CYGPATH_W])
21783294c433Smrg
2179c41d98afSmrg# Define the identity of the package.
2180c41d98afSmrgdnl Distinguish between old-style and new-style calls.
2181c41d98afSmrgm4_ifval([$2],
2182c41d98afSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2183c41d98afSmrg AC_SUBST([PACKAGE], [$1])dnl
2184c41d98afSmrg AC_SUBST([VERSION], [$2])],
2185c41d98afSmrg[_AM_SET_OPTIONS([$1])dnl
2186c41d98afSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2187c41d98afSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
2188c41d98afSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2189c41d98afSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2190c41d98afSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
21913294c433Smrg
2192c41d98afSmrg_AM_IF_OPTION([no-define],,
2193c41d98afSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
2194c41d98afSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
21953294c433Smrg
2196c41d98afSmrg# Some tools Automake needs.
2197c41d98afSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2198c41d98afSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2199c41d98afSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
2200c41d98afSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
2201c41d98afSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
2202c41d98afSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
2203c41d98afSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
2204c41d98afSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2205c41d98afSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2206c41d98afSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
2207c41d98afSmrg# We need awk for the "check" target.  The system "awk" is bad on
2208c41d98afSmrg# some platforms.
2209c41d98afSmrgAC_REQUIRE([AC_PROG_AWK])dnl
2210c41d98afSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2211c41d98afSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2212c41d98afSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2213c41d98afSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2214c41d98afSmrg			     [_AM_PROG_TAR([v7])])])
2215c41d98afSmrg_AM_IF_OPTION([no-dependencies],,
2216c41d98afSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2217c41d98afSmrg		  [_AM_DEPENDENCIES(CC)],
2218c41d98afSmrg		  [define([AC_PROG_CC],
2219c41d98afSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
2220c41d98afSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2221c41d98afSmrg		  [_AM_DEPENDENCIES(CXX)],
2222c41d98afSmrg		  [define([AC_PROG_CXX],
2223c41d98afSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
2224c41d98afSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2225c41d98afSmrg		  [_AM_DEPENDENCIES(OBJC)],
2226c41d98afSmrg		  [define([AC_PROG_OBJC],
2227c41d98afSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
2228c41d98afSmrg])
2229c41d98afSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
2230c41d98afSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
2231c41d98afSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
2232c41d98afSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
2233c41d98afSmrgAC_CONFIG_COMMANDS_PRE(dnl
2234c41d98afSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2235c41d98afSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2236c41d98afSmrg])
22373294c433Smrg
2238c41d98afSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2239c41d98afSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2240c41d98afSmrgdnl mangled by Autoconf and run in a shell conditional statement.
2241c41d98afSmrgm4_define([_AC_COMPILER_EXEEXT],
2242c41d98afSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2243c41d98afSmrg
2244c41d98afSmrg
2245c41d98afSmrg# When config.status generates a header, we must update the stamp-h file.
2246c41d98afSmrg# This file resides in the same directory as the config header
2247c41d98afSmrg# that is generated.  The stamp files are numbered to have different names.
2248c41d98afSmrg
2249c41d98afSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2250c41d98afSmrg# loop where config.status creates the headers, so we can generate
2251c41d98afSmrg# our stamp files there.
2252c41d98afSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2253c41d98afSmrg[# Compute $1's index in $config_headers.
2254c41d98afSmrg_am_arg=$1
2255c41d98afSmrg_am_stamp_count=1
2256c41d98afSmrgfor _am_header in $config_headers :; do
2257c41d98afSmrg  case $_am_header in
2258c41d98afSmrg    $_am_arg | $_am_arg:* )
2259c41d98afSmrg      break ;;
2260c41d98afSmrg    * )
2261c41d98afSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2262c41d98afSmrg  esac
2263c41d98afSmrgdone
2264c41d98afSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2265c41d98afSmrg
2266c41d98afSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
22679bc46bd4Smrg#
2268c41d98afSmrg# This file is free software; the Free Software Foundation
2269c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2270c41d98afSmrg# with or without modifications, as long as this notice is preserved.
2271c41d98afSmrg
2272c41d98afSmrg# AM_PROG_INSTALL_SH
2273c41d98afSmrg# ------------------
2274c41d98afSmrg# Define $install_sh.
2275c41d98afSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2276c41d98afSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2277c41d98afSmrgif test x"${install_sh}" != xset; then
2278c41d98afSmrg  case $am_aux_dir in
2279c41d98afSmrg  *\ * | *\	*)
2280c41d98afSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2281c41d98afSmrg  *)
2282c41d98afSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2283c41d98afSmrg  esac
22843294c433Smrgfi
2285c41d98afSmrgAC_SUBST(install_sh)])
22869bc46bd4Smrg
2287c41d98afSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
2288c41d98afSmrg#
2289c41d98afSmrg# This file is free software; the Free Software Foundation
2290c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2291c41d98afSmrg# with or without modifications, as long as this notice is preserved.
22929bc46bd4Smrg
2293c41d98afSmrg# serial 2
22949bc46bd4Smrg
2295c41d98afSmrg# Check whether the underlying file-system supports filenames
2296c41d98afSmrg# with a leading dot.  For instance MS-DOS doesn't.
2297c41d98afSmrgAC_DEFUN([AM_SET_LEADING_DOT],
2298c41d98afSmrg[rm -rf .tst 2>/dev/null
2299c41d98afSmrgmkdir .tst 2>/dev/null
2300c41d98afSmrgif test -d .tst; then
2301c41d98afSmrg  am__leading_dot=.
2302c41d98afSmrgelse
2303c41d98afSmrg  am__leading_dot=_
23043294c433Smrgfi
2305c41d98afSmrgrmdir .tst 2>/dev/null
2306c41d98afSmrgAC_SUBST([am__leading_dot])])
23073294c433Smrg
2308c41d98afSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
2309c41d98afSmrg# From Jim Meyering
23103294c433Smrg
2311c41d98afSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
2312c41d98afSmrg# Free Software Foundation, Inc.
2313c41d98afSmrg#
2314c41d98afSmrg# This file is free software; the Free Software Foundation
2315c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2316c41d98afSmrg# with or without modifications, as long as this notice is preserved.
23173294c433Smrg
2318c41d98afSmrg# serial 5
23193294c433Smrg
2320c41d98afSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
2321c41d98afSmrg# ----------------------------------
2322c41d98afSmrg# Control maintainer-specific portions of Makefiles.
2323c41d98afSmrg# Default is to disable them, unless `enable' is passed literally.
2324c41d98afSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
2325c41d98afSmrg# can override the default with the --enable/--disable switch.
2326c41d98afSmrgAC_DEFUN([AM_MAINTAINER_MODE],
2327c41d98afSmrg[m4_case(m4_default([$1], [disable]),
2328c41d98afSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
2329c41d98afSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
2330c41d98afSmrg       [m4_define([am_maintainer_other], [enable])
2331c41d98afSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
2332c41d98afSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
2333c41d98afSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
2334c41d98afSmrg  AC_ARG_ENABLE([maintainer-mode],
2335c41d98afSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
2336c41d98afSmrg			  (and sometimes confusing) to the casual installer],
2337c41d98afSmrg      [USE_MAINTAINER_MODE=$enableval],
2338c41d98afSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
2339c41d98afSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
2340c41d98afSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
2341c41d98afSmrg  MAINT=$MAINTAINER_MODE_TRUE
2342c41d98afSmrg  AC_SUBST([MAINT])dnl
2343c41d98afSmrg]
2344c41d98afSmrg)
23453294c433Smrg
2346c41d98afSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
23473294c433Smrg
2348c41d98afSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2349c41d98afSmrg
2350c41d98afSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
23519bc46bd4Smrg#
2352c41d98afSmrg# This file is free software; the Free Software Foundation
2353c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2354c41d98afSmrg# with or without modifications, as long as this notice is preserved.
23559bc46bd4Smrg
2356c41d98afSmrg# serial 4
23573294c433Smrg
2358c41d98afSmrg# AM_MAKE_INCLUDE()
2359c41d98afSmrg# -----------------
2360c41d98afSmrg# Check to see how make treats includes.
2361c41d98afSmrgAC_DEFUN([AM_MAKE_INCLUDE],
2362c41d98afSmrg[am_make=${MAKE-make}
2363c41d98afSmrgcat > confinc << 'END'
2364c41d98afSmrgam__doit:
2365c41d98afSmrg	@echo this is the am__doit target
2366c41d98afSmrg.PHONY: am__doit
2367c41d98afSmrgEND
2368c41d98afSmrg# If we don't find an include directive, just comment out the code.
2369c41d98afSmrgAC_MSG_CHECKING([for style of include used by $am_make])
2370c41d98afSmrgam__include="#"
2371c41d98afSmrgam__quote=
2372c41d98afSmrg_am_result=none
2373c41d98afSmrg# First try GNU make style include.
2374c41d98afSmrgecho "include confinc" > confmf
2375c41d98afSmrg# Ignore all kinds of additional output from `make'.
2376c41d98afSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
2377c41d98afSmrg*the\ am__doit\ target*)
2378c41d98afSmrg  am__include=include
2379c41d98afSmrg  am__quote=
2380c41d98afSmrg  _am_result=GNU
2381c41d98afSmrg  ;;
2382c41d98afSmrgesac
2383c41d98afSmrg# Now try BSD make style include.
2384c41d98afSmrgif test "$am__include" = "#"; then
2385c41d98afSmrg   echo '.include "confinc"' > confmf
2386c41d98afSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
2387c41d98afSmrg   *the\ am__doit\ target*)
2388c41d98afSmrg     am__include=.include
2389c41d98afSmrg     am__quote="\""
2390c41d98afSmrg     _am_result=BSD
2391c41d98afSmrg     ;;
2392c41d98afSmrg   esac
23939bc46bd4Smrgfi
2394c41d98afSmrgAC_SUBST([am__include])
2395c41d98afSmrgAC_SUBST([am__quote])
2396c41d98afSmrgAC_MSG_RESULT([$_am_result])
2397c41d98afSmrgrm -f confinc confmf
2398c41d98afSmrg])
23993294c433Smrg
2400c41d98afSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
24019bc46bd4Smrg
2402c41d98afSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
2403c41d98afSmrg# Free Software Foundation, Inc.
24049bc46bd4Smrg#
2405c41d98afSmrg# This file is free software; the Free Software Foundation
2406c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2407c41d98afSmrg# with or without modifications, as long as this notice is preserved.
24083294c433Smrg
2409c41d98afSmrg# serial 6
24103294c433Smrg
2411c41d98afSmrg# AM_MISSING_PROG(NAME, PROGRAM)
2412c41d98afSmrg# ------------------------------
2413c41d98afSmrgAC_DEFUN([AM_MISSING_PROG],
2414c41d98afSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2415c41d98afSmrg$1=${$1-"${am_missing_run}$2"}
2416c41d98afSmrgAC_SUBST($1)])
24173294c433Smrg
24183294c433Smrg
2419c41d98afSmrg# AM_MISSING_HAS_RUN
2420c41d98afSmrg# ------------------
2421c41d98afSmrg# Define MISSING if not defined so far and test if it supports --run.
2422c41d98afSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
2423c41d98afSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2424c41d98afSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2425c41d98afSmrgAC_REQUIRE_AUX_FILE([missing])dnl
2426c41d98afSmrgif test x"${MISSING+set}" != xset; then
2427c41d98afSmrg  case $am_aux_dir in
2428c41d98afSmrg  *\ * | *\	*)
2429c41d98afSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2430c41d98afSmrg  *)
2431c41d98afSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2432c41d98afSmrg  esac
24339bc46bd4Smrgfi
2434c41d98afSmrg# Use eval to expand $SHELL
2435c41d98afSmrgif eval "$MISSING --run true"; then
2436c41d98afSmrg  am_missing_run="$MISSING --run "
2437c41d98afSmrgelse
2438c41d98afSmrg  am_missing_run=
2439c41d98afSmrg  AC_MSG_WARN([`missing' script is too old or missing])
2440c41d98afSmrgfi
2441c41d98afSmrg])
24423294c433Smrg
2443c41d98afSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
2444c41d98afSmrg#
2445c41d98afSmrg# This file is free software; the Free Software Foundation
2446c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2447c41d98afSmrg# with or without modifications, as long as this notice is preserved.
24483294c433Smrg
2449c41d98afSmrg# AM_PROG_MKDIR_P
24509bc46bd4Smrg# ---------------
2451c41d98afSmrg# Check for `mkdir -p'.
2452c41d98afSmrgAC_DEFUN([AM_PROG_MKDIR_P],
2453c41d98afSmrg[AC_PREREQ([2.60])dnl
2454c41d98afSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2455c41d98afSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
2456c41d98afSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
2457c41d98afSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
2458c41d98afSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
2459c41d98afSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
2460c41d98afSmrgdnl adjustment using top_builddir (which is defined more often than
2461c41d98afSmrgdnl MKDIR_P).
2462c41d98afSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
2463c41d98afSmrgcase $mkdir_p in
2464c41d98afSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
2465c41d98afSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
2466c41d98afSmrgesac
2467c41d98afSmrg])
2468c41d98afSmrg
2469c41d98afSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2470c41d98afSmrg
2471c41d98afSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
24729bc46bd4Smrg#
2473c41d98afSmrg# This file is free software; the Free Software Foundation
2474c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2475c41d98afSmrg# with or without modifications, as long as this notice is preserved.
24763294c433Smrg
2477c41d98afSmrg# serial 4
2478c41d98afSmrg
2479c41d98afSmrg# _AM_MANGLE_OPTION(NAME)
24809bc46bd4Smrg# -----------------------
2481c41d98afSmrgAC_DEFUN([_AM_MANGLE_OPTION],
2482c41d98afSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
24839bc46bd4Smrg
2484c41d98afSmrg# _AM_SET_OPTION(NAME)
2485c41d98afSmrg# ------------------------------
2486c41d98afSmrg# Set option NAME.  Presently that only means defining a flag for this option.
2487c41d98afSmrgAC_DEFUN([_AM_SET_OPTION],
2488c41d98afSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
24893294c433Smrg
2490c41d98afSmrg# _AM_SET_OPTIONS(OPTIONS)
2491c41d98afSmrg# ----------------------------------
2492c41d98afSmrg# OPTIONS is a space-separated list of Automake options.
2493c41d98afSmrgAC_DEFUN([_AM_SET_OPTIONS],
2494c41d98afSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
24959bc46bd4Smrg
2496c41d98afSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2497c41d98afSmrg# -------------------------------------------
2498c41d98afSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2499c41d98afSmrgAC_DEFUN([_AM_IF_OPTION],
2500c41d98afSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
25019bc46bd4Smrg
2502c41d98afSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
25033294c433Smrg
2504c41d98afSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
2505c41d98afSmrg# Free Software Foundation, Inc.
25063294c433Smrg#
2507c41d98afSmrg# This file is free software; the Free Software Foundation
2508c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2509c41d98afSmrg# with or without modifications, as long as this notice is preserved.
25103294c433Smrg
2511c41d98afSmrg# serial 5
2512c41d98afSmrg
2513c41d98afSmrg# AM_SANITY_CHECK
2514c41d98afSmrg# ---------------
2515c41d98afSmrgAC_DEFUN([AM_SANITY_CHECK],
2516c41d98afSmrg[AC_MSG_CHECKING([whether build environment is sane])
2517c41d98afSmrg# Just in case
2518c41d98afSmrgsleep 1
2519c41d98afSmrgecho timestamp > conftest.file
2520c41d98afSmrg# Reject unsafe characters in $srcdir or the absolute working directory
2521c41d98afSmrg# name.  Accept space and tab only in the latter.
2522c41d98afSmrgam_lf='
2523c41d98afSmrg'
2524c41d98afSmrgcase `pwd` in
2525c41d98afSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
2526c41d98afSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
2527c41d98afSmrgesac
2528c41d98afSmrgcase $srcdir in
2529c41d98afSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
2530c41d98afSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
2531c41d98afSmrgesac
2532c41d98afSmrg
2533c41d98afSmrg# Do `set' in a subshell so we don't clobber the current shell's
2534c41d98afSmrg# arguments.  Must try -L first in case configure is actually a
2535c41d98afSmrg# symlink; some systems play weird games with the mod time of symlinks
2536c41d98afSmrg# (eg FreeBSD returns the mod time of the symlink's containing
2537c41d98afSmrg# directory).
2538c41d98afSmrgif (
2539c41d98afSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
2540c41d98afSmrg   if test "$[*]" = "X"; then
2541c41d98afSmrg      # -L didn't work.
2542c41d98afSmrg      set X `ls -t "$srcdir/configure" conftest.file`
2543c41d98afSmrg   fi
2544c41d98afSmrg   rm -f conftest.file
2545c41d98afSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
2546c41d98afSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
2547c41d98afSmrg
2548c41d98afSmrg      # If neither matched, then we have a broken ls.  This can happen
2549c41d98afSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
2550c41d98afSmrg      # broken ls alias from the environment.  This has actually
2551c41d98afSmrg      # happened.  Such a system could not be considered "sane".
2552c41d98afSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2553c41d98afSmrgalias in your environment])
2554c41d98afSmrg   fi
2555c41d98afSmrg
2556c41d98afSmrg   test "$[2]" = conftest.file
2557c41d98afSmrg   )
2558c41d98afSmrgthen
2559c41d98afSmrg   # Ok.
2560c41d98afSmrg   :
2561c41d98afSmrgelse
2562c41d98afSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
2563c41d98afSmrgCheck your system clock])
25643294c433Smrgfi
2565c41d98afSmrgAC_MSG_RESULT(yes)])
25663294c433Smrg
2567c41d98afSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
25683294c433Smrg#
2569c41d98afSmrg# This file is free software; the Free Software Foundation
2570c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2571c41d98afSmrg# with or without modifications, as long as this notice is preserved.
25723294c433Smrg
2573c41d98afSmrg# serial 1
25743294c433Smrg
2575c41d98afSmrg# AM_SILENT_RULES([DEFAULT])
2576c41d98afSmrg# --------------------------
2577c41d98afSmrg# Enable less verbose build rules; with the default set to DEFAULT
2578c41d98afSmrg# (`yes' being less verbose, `no' or empty being verbose).
2579c41d98afSmrgAC_DEFUN([AM_SILENT_RULES],
2580c41d98afSmrg[AC_ARG_ENABLE([silent-rules],
2581c41d98afSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
2582c41d98afSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
2583c41d98afSmrgcase $enable_silent_rules in
2584c41d98afSmrgyes) AM_DEFAULT_VERBOSITY=0;;
2585c41d98afSmrgno)  AM_DEFAULT_VERBOSITY=1;;
2586c41d98afSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
2587c41d98afSmrgesac
2588c41d98afSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
2589c41d98afSmrgAM_BACKSLASH='\'
2590c41d98afSmrgAC_SUBST([AM_BACKSLASH])dnl
2591c41d98afSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
2592c41d98afSmrg])
25933294c433Smrg
2594c41d98afSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
2595c41d98afSmrg#
2596c41d98afSmrg# This file is free software; the Free Software Foundation
2597c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2598c41d98afSmrg# with or without modifications, as long as this notice is preserved.
25993294c433Smrg
2600c41d98afSmrg# AM_PROG_INSTALL_STRIP
2601c41d98afSmrg# ---------------------
2602c41d98afSmrg# One issue with vendor `install' (even GNU) is that you can't
2603c41d98afSmrg# specify the program used to strip binaries.  This is especially
2604c41d98afSmrg# annoying in cross-compiling environments, where the build's strip
2605c41d98afSmrg# is unlikely to handle the host's binaries.
2606c41d98afSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
2607c41d98afSmrg# always use install-sh in `make install-strip', and initialize
2608c41d98afSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
2609c41d98afSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
2610c41d98afSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2611c41d98afSmrg# Installed binaries are usually stripped using `strip' when the user
2612c41d98afSmrg# run `make install-strip'.  However `strip' might not be the right
2613c41d98afSmrg# tool to use in cross-compilation environments, therefore Automake
2614c41d98afSmrg# will honor the `STRIP' environment variable to overrule this program.
2615c41d98afSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
2616c41d98afSmrgif test "$cross_compiling" != no; then
2617c41d98afSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
2618c41d98afSmrgfi
2619c41d98afSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
2620c41d98afSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
26213294c433Smrg
2622c41d98afSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
26233294c433Smrg#
2624c41d98afSmrg# This file is free software; the Free Software Foundation
2625c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2626c41d98afSmrg# with or without modifications, as long as this notice is preserved.
26273294c433Smrg
2628c41d98afSmrg# serial 2
26293294c433Smrg
2630c41d98afSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
2631c41d98afSmrg# ---------------------------
2632c41d98afSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
2633c41d98afSmrg# This macro is traced by Automake.
2634c41d98afSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
26353294c433Smrg
2636c41d98afSmrg# AM_SUBST_NOTMAKE(VARIABLE)
2637c41d98afSmrg# ---------------------------
2638c41d98afSmrg# Public sister of _AM_SUBST_NOTMAKE.
2639c41d98afSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
26403294c433Smrg
2641c41d98afSmrg# Check how to create a tarball.                            -*- Autoconf -*-
26423294c433Smrg
2643c41d98afSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
2644c41d98afSmrg#
2645c41d98afSmrg# This file is free software; the Free Software Foundation
2646c41d98afSmrg# gives unlimited permission to copy and/or distribute it,
2647c41d98afSmrg# with or without modifications, as long as this notice is preserved.
26483294c433Smrg
2649c41d98afSmrg# serial 2
26503294c433Smrg
2651c41d98afSmrg# _AM_PROG_TAR(FORMAT)
2652c41d98afSmrg# --------------------
2653c41d98afSmrg# Check how to create a tarball in format FORMAT.
2654c41d98afSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
2655c41d98afSmrg#
2656c41d98afSmrg# Substitute a variable $(am__tar) that is a command
2657c41d98afSmrg# writing to stdout a FORMAT-tarball containing the directory
2658c41d98afSmrg# $tardir.
2659c41d98afSmrg#     tardir=directory && $(am__tar) > result.tar
2660c41d98afSmrg#
2661c41d98afSmrg# Substitute a variable $(am__untar) that extract such
2662c41d98afSmrg# a tarball read from stdin.
2663c41d98afSmrg#     $(am__untar) < result.tar
2664c41d98afSmrgAC_DEFUN([_AM_PROG_TAR],
2665c41d98afSmrg[# Always define AMTAR for backward compatibility.
2666c41d98afSmrgAM_MISSING_PROG([AMTAR], [tar])
2667c41d98afSmrgm4_if([$1], [v7],
2668c41d98afSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
2669c41d98afSmrg     [m4_case([$1], [ustar],, [pax],,
2670c41d98afSmrg              [m4_fatal([Unknown tar format])])
2671c41d98afSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
2672c41d98afSmrg# Loop over all known methods to create a tar archive until one works.
2673c41d98afSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
2674c41d98afSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
2675c41d98afSmrg# Do not fold the above two line into one, because Tru64 sh and
2676c41d98afSmrg# Solaris sh will not grok spaces in the rhs of `-'.
2677c41d98afSmrgfor _am_tool in $_am_tools
2678c41d98afSmrgdo
2679c41d98afSmrg  case $_am_tool in
2680c41d98afSmrg  gnutar)
2681c41d98afSmrg    for _am_tar in tar gnutar gtar;
2682c41d98afSmrg    do
2683c41d98afSmrg      AM_RUN_LOG([$_am_tar --version]) && break
2684c41d98afSmrg    done
2685c41d98afSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
2686c41d98afSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
2687c41d98afSmrg    am__untar="$_am_tar -xf -"
2688c41d98afSmrg    ;;
2689c41d98afSmrg  plaintar)
2690c41d98afSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
2691c41d98afSmrg    # ustar tarball either.
2692c41d98afSmrg    (tar --version) >/dev/null 2>&1 && continue
2693c41d98afSmrg    am__tar='tar chf - "$$tardir"'
2694c41d98afSmrg    am__tar_='tar chf - "$tardir"'
2695c41d98afSmrg    am__untar='tar xf -'
2696c41d98afSmrg    ;;
2697c41d98afSmrg  pax)
2698c41d98afSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
2699c41d98afSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
2700c41d98afSmrg    am__untar='pax -r'
2701c41d98afSmrg    ;;
2702c41d98afSmrg  cpio)
2703c41d98afSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
2704c41d98afSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
2705c41d98afSmrg    am__untar='cpio -i -H $1 -d'
2706c41d98afSmrg    ;;
2707c41d98afSmrg  none)
2708c41d98afSmrg    am__tar=false
2709c41d98afSmrg    am__tar_=false
2710c41d98afSmrg    am__untar=false
2711c41d98afSmrg    ;;
2712c41d98afSmrg  esac
27133294c433Smrg
2714c41d98afSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
2715c41d98afSmrg  # and am__untar set.
2716c41d98afSmrg  test -n "${am_cv_prog_tar_$1}" && break
27173294c433Smrg
2718c41d98afSmrg  # tar/untar a dummy directory, and stop if the command works
2719c41d98afSmrg  rm -rf conftest.dir
2720c41d98afSmrg  mkdir conftest.dir
2721c41d98afSmrg  echo GrepMe > conftest.dir/file
2722c41d98afSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
2723c41d98afSmrg  rm -rf conftest.dir
2724c41d98afSmrg  if test -s conftest.tar; then
2725c41d98afSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
2726c41d98afSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
2727c41d98afSmrg  fi
2728c41d98afSmrgdone
2729c41d98afSmrgrm -rf conftest.dir
27303294c433Smrg
2731c41d98afSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
2732c41d98afSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
2733c41d98afSmrgAC_SUBST([am__tar])
2734c41d98afSmrgAC_SUBST([am__untar])
2735c41d98afSmrg]) # _AM_PROG_TAR
27363294c433Smrg
2737