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