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