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