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