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