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