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