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