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