aclocal.m4 revision 054b3d00
1054b3d00Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2054b3d00Smrg
3054b3d00Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4a1d141d5Smrg
5a1d141d5Smrg# This file is free software; the Free Software Foundation
6a1d141d5Smrg# gives unlimited permission to copy and/or distribute it,
7a1d141d5Smrg# with or without modifications, as long as this notice is preserved.
8a1d141d5Smrg
9a1d141d5Smrg# This program is distributed in the hope that it will be useful,
10a1d141d5Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a1d141d5Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a1d141d5Smrg# PARTICULAR PURPOSE.
13a1d141d5Smrg
14054b3d00Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152ddb6cf1Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162ddb6cf1Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17054b3d00Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18054b3d00Smrg[m4_warning([this file was generated for autoconf 2.69.
192ddb6cf1SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202ddb6cf1SmrgIf you have problems, you may need to regenerate the build system entirely.
21054b3d00SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a1d141d5Smrg
23054b3d00Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
24054b3d00Smrgdnl serial 11 (pkg-config-0.29)
25054b3d00Smrgdnl
26054b3d00Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27054b3d00Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
28054b3d00Smrgdnl
29054b3d00Smrgdnl This program is free software; you can redistribute it and/or modify
30054b3d00Smrgdnl it under the terms of the GNU General Public License as published by
31054b3d00Smrgdnl the Free Software Foundation; either version 2 of the License, or
32054b3d00Smrgdnl (at your option) any later version.
33054b3d00Smrgdnl
34054b3d00Smrgdnl This program is distributed in the hope that it will be useful, but
35054b3d00Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
36054b3d00Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37054b3d00Smrgdnl General Public License for more details.
38054b3d00Smrgdnl
39054b3d00Smrgdnl You should have received a copy of the GNU General Public License
40054b3d00Smrgdnl along with this program; if not, write to the Free Software
41054b3d00Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
42054b3d00Smrgdnl 02111-1307, USA.
43054b3d00Smrgdnl
44054b3d00Smrgdnl As a special exception to the GNU General Public License, if you
45054b3d00Smrgdnl distribute this file as part of a program that contains a
46054b3d00Smrgdnl configuration script generated by Autoconf, you may include it under
47054b3d00Smrgdnl the same distribution terms that you use for the rest of that
48054b3d00Smrgdnl program.
49054b3d00Smrg
50054b3d00Smrgdnl PKG_PREREQ(MIN-VERSION)
51054b3d00Smrgdnl -----------------------
52054b3d00Smrgdnl Since: 0.29
53054b3d00Smrgdnl
54054b3d00Smrgdnl Verify that the version of the pkg-config macros are at least
55054b3d00Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
56054b3d00Smrgdnl installed version of pkg-config, this checks the developer's version
57054b3d00Smrgdnl of pkg.m4 when generating configure.
58054b3d00Smrgdnl
59054b3d00Smrgdnl To ensure that this macro is defined, also add:
60054b3d00Smrgdnl m4_ifndef([PKG_PREREQ],
61054b3d00Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
62054b3d00Smrgdnl
63054b3d00Smrgdnl See the "Since" comment for each macro you use to see what version
64054b3d00Smrgdnl of the macros you require.
65054b3d00Smrgm4_defun([PKG_PREREQ],
66054b3d00Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
67054b3d00Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
68054b3d00Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
69054b3d00Smrg])dnl PKG_PREREQ
70054b3d00Smrg
71054b3d00Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
72054b3d00Smrgdnl ----------------------------------
73054b3d00Smrgdnl Since: 0.16
74054b3d00Smrgdnl
75054b3d00Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
76054b3d00Smrgdnl first found in the path. Checks that the version of pkg-config found
77054b3d00Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
78054b3d00Smrgdnl used since that's the first version where most current features of
79054b3d00Smrgdnl pkg-config existed.
80054b3d00SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
81054b3d00Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
82054b3d00Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
83054b3d00Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
84054b3d00SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
85054b3d00SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
86054b3d00SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87a1d141d5Smrg
88054b3d00Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
89054b3d00Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
90054b3d00Smrgfi
91054b3d00Smrgif test -n "$PKG_CONFIG"; then
92054b3d00Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
93054b3d00Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
94054b3d00Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
95054b3d00Smrg		AC_MSG_RESULT([yes])
96054b3d00Smrg	else
97054b3d00Smrg		AC_MSG_RESULT([no])
98054b3d00Smrg		PKG_CONFIG=""
99054b3d00Smrg	fi
100054b3d00Smrgfi[]dnl
101054b3d00Smrg])dnl PKG_PROG_PKG_CONFIG
102a1d141d5Smrg
103054b3d00Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
104054b3d00Smrgdnl -------------------------------------------------------------------
105054b3d00Smrgdnl Since: 0.18
106054b3d00Smrgdnl
107054b3d00Smrgdnl Check to see whether a particular set of modules exists. Similar to
108054b3d00Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
109054b3d00Smrgdnl
110054b3d00Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
111054b3d00Smrgdnl only at the first occurence in configure.ac, so if the first place
112054b3d00Smrgdnl it's called might be skipped (such as if it is within an "if", you
113054b3d00Smrgdnl have to call PKG_CHECK_EXISTS manually
114054b3d00SmrgAC_DEFUN([PKG_CHECK_EXISTS],
115054b3d00Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
116054b3d00Smrgif test -n "$PKG_CONFIG" && \
117054b3d00Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
118054b3d00Smrg  m4_default([$2], [:])
119054b3d00Smrgm4_ifvaln([$3], [else
120054b3d00Smrg  $3])dnl
121054b3d00Smrgfi])
122a1d141d5Smrg
123054b3d00Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
124054b3d00Smrgdnl ---------------------------------------------
125054b3d00Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
126054b3d00Smrgdnl pkg_failed based on the result.
127054b3d00Smrgm4_define([_PKG_CONFIG],
128054b3d00Smrg[if test -n "$$1"; then
129054b3d00Smrg    pkg_cv_[]$1="$$1"
130054b3d00Smrg elif test -n "$PKG_CONFIG"; then
131054b3d00Smrg    PKG_CHECK_EXISTS([$3],
132054b3d00Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
133054b3d00Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
134054b3d00Smrg		     [pkg_failed=yes])
135054b3d00Smrg else
136054b3d00Smrg    pkg_failed=untried
137054b3d00Smrgfi[]dnl
138054b3d00Smrg])dnl _PKG_CONFIG
139a1d141d5Smrg
140054b3d00Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
141054b3d00Smrgdnl ---------------------------
142054b3d00Smrgdnl Internal check to see if pkg-config supports short errors.
143054b3d00SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
144054b3d00Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
145054b3d00Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
146054b3d00Smrg        _pkg_short_errors_supported=yes
147054b3d00Smrgelse
148054b3d00Smrg        _pkg_short_errors_supported=no
149054b3d00Smrgfi[]dnl
150054b3d00Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151a1d141d5Smrg
152a1d141d5Smrg
153054b3d00Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
154054b3d00Smrgdnl   [ACTION-IF-NOT-FOUND])
155054b3d00Smrgdnl --------------------------------------------------------------
156054b3d00Smrgdnl Since: 0.4.0
157054b3d00Smrgdnl
158054b3d00Smrgdnl Note that if there is a possibility the first call to
159054b3d00Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
160054b3d00Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
161054b3d00SmrgAC_DEFUN([PKG_CHECK_MODULES],
162054b3d00Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
163054b3d00SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
164054b3d00SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165a1d141d5Smrg
166054b3d00Smrgpkg_failed=no
167054b3d00SmrgAC_MSG_CHECKING([for $1])
168a1d141d5Smrg
169054b3d00Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
170054b3d00Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171a1d141d5Smrg
172054b3d00Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
173054b3d00Smrgand $1[]_LIBS to avoid the need to call pkg-config.
174054b3d00SmrgSee the pkg-config man page for more details.])
175a1d141d5Smrg
176054b3d00Smrgif test $pkg_failed = yes; then
177054b3d00Smrg   	AC_MSG_RESULT([no])
178054b3d00Smrg        _PKG_SHORT_ERRORS_SUPPORTED
179054b3d00Smrg        if test $_pkg_short_errors_supported = yes; then
180054b3d00Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
181054b3d00Smrg        else 
182054b3d00Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
183054b3d00Smrg        fi
184054b3d00Smrg	# Put the nasty error message in config.log where it belongs
185054b3d00Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186a1d141d5Smrg
187054b3d00Smrg	m4_default([$4], [AC_MSG_ERROR(
188054b3d00Smrg[Package requirements ($2) were not met:
189a1d141d5Smrg
190054b3d00Smrg$$1_PKG_ERRORS
191a1d141d5Smrg
192054b3d00SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
193054b3d00Smrginstalled software in a non-standard prefix.
194a1d141d5Smrg
195054b3d00Smrg_PKG_TEXT])[]dnl
196054b3d00Smrg        ])
197054b3d00Smrgelif test $pkg_failed = untried; then
198054b3d00Smrg     	AC_MSG_RESULT([no])
199054b3d00Smrg	m4_default([$4], [AC_MSG_FAILURE(
200054b3d00Smrg[The pkg-config script could not be found or is too old.  Make sure it
201054b3d00Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
202054b3d00Smrgpath to pkg-config.
203a1d141d5Smrg
204054b3d00Smrg_PKG_TEXT
205a1d141d5Smrg
206054b3d00SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
207054b3d00Smrg        ])
208054b3d00Smrgelse
209054b3d00Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
210054b3d00Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
211054b3d00Smrg        AC_MSG_RESULT([yes])
212054b3d00Smrg	$3
213054b3d00Smrgfi[]dnl
214054b3d00Smrg])dnl PKG_CHECK_MODULES
21555074dd0Smrg
21655074dd0Smrg
217054b3d00Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
218054b3d00Smrgdnl   [ACTION-IF-NOT-FOUND])
219054b3d00Smrgdnl ---------------------------------------------------------------------
220054b3d00Smrgdnl Since: 0.29
221054b3d00Smrgdnl
222054b3d00Smrgdnl Checks for existence of MODULES and gathers its build flags with
223054b3d00Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
224054b3d00Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
225054b3d00Smrgdnl
226054b3d00Smrgdnl Note that if there is a possibility the first call to
227054b3d00Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
228054b3d00Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
229054b3d00Smrgdnl configure.ac.
230054b3d00SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
231054b3d00Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
232054b3d00Smrg_save_PKG_CONFIG=$PKG_CONFIG
233054b3d00SmrgPKG_CONFIG="$PKG_CONFIG --static"
234054b3d00SmrgPKG_CHECK_MODULES($@)
235054b3d00SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
236054b3d00Smrg])dnl PKG_CHECK_MODULES_STATIC
23755074dd0Smrg
23855074dd0Smrg
239054b3d00Smrgdnl PKG_INSTALLDIR([DIRECTORY])
240054b3d00Smrgdnl -------------------------
241054b3d00Smrgdnl Since: 0.27
242054b3d00Smrgdnl
243054b3d00Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
244054b3d00Smrgdnl should install pkg-config .pc files. By default the directory is
245054b3d00Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
246054b3d00Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
247054b3d00Smrgdnl parameter.
248054b3d00SmrgAC_DEFUN([PKG_INSTALLDIR],
249054b3d00Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
250054b3d00Smrgm4_pushdef([pkg_description],
251054b3d00Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
252054b3d00SmrgAC_ARG_WITH([pkgconfigdir],
253054b3d00Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
254054b3d00Smrg    [with_pkgconfigdir=]pkg_default)
255054b3d00SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
256054b3d00Smrgm4_popdef([pkg_default])
257054b3d00Smrgm4_popdef([pkg_description])
258054b3d00Smrg])dnl PKG_INSTALLDIR
259054b3d00Smrg
260054b3d00Smrg
261054b3d00Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
262054b3d00Smrgdnl --------------------------------
263054b3d00Smrgdnl Since: 0.27
264054b3d00Smrgdnl
265054b3d00Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
266054b3d00Smrgdnl module should install arch-independent pkg-config .pc files. By
267054b3d00Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
268054b3d00Smrgdnl changed by passing DIRECTORY. The user can override through the
269054b3d00Smrgdnl --with-noarch-pkgconfigdir parameter.
270054b3d00SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
271054b3d00Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
272054b3d00Smrgm4_pushdef([pkg_description],
273054b3d00Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
274054b3d00SmrgAC_ARG_WITH([noarch-pkgconfigdir],
275054b3d00Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
276054b3d00Smrg    [with_noarch_pkgconfigdir=]pkg_default)
277054b3d00SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
278054b3d00Smrgm4_popdef([pkg_default])
279054b3d00Smrgm4_popdef([pkg_description])
280054b3d00Smrg])dnl PKG_NOARCH_INSTALLDIR
281054b3d00Smrg
282054b3d00Smrg
283054b3d00Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
284054b3d00Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
285054b3d00Smrgdnl -------------------------------------------
286054b3d00Smrgdnl Since: 0.28
287054b3d00Smrgdnl
288054b3d00Smrgdnl Retrieves the value of the pkg-config variable for the given module.
289054b3d00SmrgAC_DEFUN([PKG_CHECK_VAR],
290054b3d00Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
291054b3d00SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
29255074dd0Smrg
293054b3d00Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
294054b3d00SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29555074dd0Smrg
296054b3d00SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
297054b3d00Smrg])dnl PKG_CHECK_VAR
29855074dd0Smrg
299054b3d00Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
300054b3d00Smrgdnl
301054b3d00Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
302054b3d00Smrgdnl
303054b3d00Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
304054b3d00Smrgdnl copy of this software and associated documentation files (the "Software"),
305054b3d00Smrgdnl to deal in the Software without restriction, including without limitation
306054b3d00Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
307054b3d00Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
308054b3d00Smrgdnl Software is furnished to do so, subject to the following conditions:
309054b3d00Smrgdnl
310054b3d00Smrgdnl The above copyright notice and this permission notice (including the next
311054b3d00Smrgdnl paragraph) shall be included in all copies or substantial portions of the
312054b3d00Smrgdnl Software.
313054b3d00Smrgdnl
314054b3d00Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
315054b3d00Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
316054b3d00Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
317054b3d00Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
318054b3d00Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
319054b3d00Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
320054b3d00Smrgdnl DEALINGS IN THE SOFTWARE.
32155074dd0Smrg
322054b3d00Smrg# XORG_MACROS_VERSION(required-version)
323054b3d00Smrg# -------------------------------------
324054b3d00Smrg# Minimum version: 1.1.0
325054b3d00Smrg#
326054b3d00Smrg# If you're using a macro added in Version 1.1 or newer, include this in
327054b3d00Smrg# your configure.ac with the minimum required version, such as:
328054b3d00Smrg# XORG_MACROS_VERSION(1.1)
329054b3d00Smrg#
330054b3d00Smrg# To ensure that this macro is defined, also add:
331054b3d00Smrg# m4_ifndef([XORG_MACROS_VERSION],
332054b3d00Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
333054b3d00Smrg#
334054b3d00Smrg#
335054b3d00Smrg# See the "minimum version" comment for each macro you use to see what
336054b3d00Smrg# version you require.
337054b3d00Smrgm4_defun([XORG_MACROS_VERSION],[
338054b3d00Smrgm4_define([vers_have], [1.19.0])
339054b3d00Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
340054b3d00Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
341054b3d00Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
342054b3d00Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
343054b3d00Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
344054b3d00Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
345054b3d00Smrgm4_undefine([vers_have])
346054b3d00Smrgm4_undefine([maj_have])
347054b3d00Smrgm4_undefine([maj_needed])
348054b3d00Smrg]) # XORG_MACROS_VERSION
34955074dd0Smrg
350054b3d00Smrg# XORG_PROG_RAWCPP()
351054b3d00Smrg# ------------------
352054b3d00Smrg# Minimum version: 1.0.0
353054b3d00Smrg#
354054b3d00Smrg# Find cpp program and necessary flags for use in pre-processing text files
355054b3d00Smrg# such as man pages and config files
356054b3d00SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
357054b3d00SmrgAC_REQUIRE([AC_PROG_CPP])
358054b3d00SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
359054b3d00Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
36055074dd0Smrg
361054b3d00Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
362054b3d00Smrg# which is not the best choice for supporting other OS'es, but covers most
363054b3d00Smrg# of the ones we need for now.
364054b3d00SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
365054b3d00SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
366054b3d00Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
367054b3d00Smrg	AC_MSG_RESULT([no])
368054b3d00Smrgelse
369054b3d00Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
370054b3d00Smrg		RAWCPPFLAGS=-undef
371054b3d00Smrg		AC_MSG_RESULT([yes])
372054b3d00Smrg	# under Cygwin unix is still defined even with -undef
373054b3d00Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
374054b3d00Smrg		RAWCPPFLAGS="-undef -ansi"
375054b3d00Smrg		AC_MSG_RESULT([yes, with -ansi])
376054b3d00Smrg	else
377054b3d00Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
378054b3d00Smrg	fi
37955074dd0Smrgfi
380054b3d00Smrgrm -f conftest.$ac_ext
38155074dd0Smrg
382054b3d00SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
383054b3d00SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
384054b3d00Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
385054b3d00Smrg	AC_MSG_RESULT([no])
386054b3d00Smrgelse
387054b3d00Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
388054b3d00Smrg		TRADITIONALCPPFLAGS="-traditional"
389054b3d00Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
390054b3d00Smrg		AC_MSG_RESULT([yes])
391054b3d00Smrg	else
392054b3d00Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
393054b3d00Smrg	fi
394054b3d00Smrgfi
395054b3d00Smrgrm -f conftest.$ac_ext
396054b3d00SmrgAC_SUBST(RAWCPPFLAGS)
397054b3d00SmrgAC_SUBST(TRADITIONALCPPFLAGS)
398054b3d00Smrg]) # XORG_PROG_RAWCPP
39955074dd0Smrg
400054b3d00Smrg# XORG_MANPAGE_SECTIONS()
401054b3d00Smrg# -----------------------
402054b3d00Smrg# Minimum version: 1.0.0
4032ddb6cf1Smrg#
404054b3d00Smrg# Determine which sections man pages go in for the different man page types
405054b3d00Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
406054b3d00Smrg# Not sure if there's any better way than just hardcoding by OS name.
407054b3d00Smrg# Override default settings by setting environment variables
408054b3d00Smrg# Added MAN_SUBSTS in version 1.8
409054b3d00Smrg# Added AC_PROG_SED in version 1.8
41055074dd0Smrg
411054b3d00SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
412054b3d00SmrgAC_REQUIRE([AC_CANONICAL_HOST])
413054b3d00SmrgAC_REQUIRE([AC_PROG_SED])
41455074dd0Smrg
415054b3d00Smrgif test x$APP_MAN_SUFFIX = x    ; then
416054b3d00Smrg    APP_MAN_SUFFIX=1
417054b3d00Smrgfi
418054b3d00Smrgif test x$APP_MAN_DIR = x    ; then
419054b3d00Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420054b3d00Smrgfi
42155074dd0Smrg
422054b3d00Smrgif test x$LIB_MAN_SUFFIX = x    ; then
423054b3d00Smrg    LIB_MAN_SUFFIX=3
424054b3d00Smrgfi
425054b3d00Smrgif test x$LIB_MAN_DIR = x    ; then
426054b3d00Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
427054b3d00Smrgfi
42855074dd0Smrg
429054b3d00Smrgif test x$FILE_MAN_SUFFIX = x    ; then
430054b3d00Smrg    case $host_os in
431054b3d00Smrg	# Solaris 2.0 - 11 use SysV man page sections
432054b3d00Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
433054b3d00Smrg	*)				FILE_MAN_SUFFIX=5  ;;
434054b3d00Smrg    esac
435054b3d00Smrgfi
436054b3d00Smrgif test x$FILE_MAN_DIR = x    ; then
437054b3d00Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
438054b3d00Smrgfi
439a1d141d5Smrg
440054b3d00Smrgif test x$MISC_MAN_SUFFIX = x    ; then
441054b3d00Smrg    case $host_os in
442054b3d00Smrg	# Solaris 2.0 - 11 use SysV man page sections
443054b3d00Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
444054b3d00Smrg	*)				MISC_MAN_SUFFIX=7  ;;
445054b3d00Smrg    esac
446054b3d00Smrgfi
447054b3d00Smrgif test x$MISC_MAN_DIR = x    ; then
448054b3d00Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
449054b3d00Smrgfi
45055074dd0Smrg
451054b3d00Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
452054b3d00Smrg    case $host_os in
453054b3d00Smrg	# Solaris 2.0 - 11 use SysV man page sections
454054b3d00Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
455054b3d00Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
456054b3d00Smrg    esac
457054b3d00Smrgfi
458054b3d00Smrgif test x$DRIVER_MAN_DIR = x    ; then
459054b3d00Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4602ddb6cf1Smrgfi
461a1d141d5Smrg
462054b3d00Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
463054b3d00Smrg    case $host_os in
464054b3d00Smrg	# Solaris 2.0 - 11 use SysV man page sections
465054b3d00Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
466054b3d00Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
467054b3d00Smrg    esac
468054b3d00Smrgfi
469054b3d00Smrgif test x$ADMIN_MAN_DIR = x    ; then
470054b3d00Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4712ddb6cf1Smrgfi
472a1d141d5Smrg
473a1d141d5Smrg
474054b3d00SmrgAC_SUBST([APP_MAN_SUFFIX])
475054b3d00SmrgAC_SUBST([LIB_MAN_SUFFIX])
476054b3d00SmrgAC_SUBST([FILE_MAN_SUFFIX])
477054b3d00SmrgAC_SUBST([MISC_MAN_SUFFIX])
478054b3d00SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
479054b3d00SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
480054b3d00SmrgAC_SUBST([APP_MAN_DIR])
481054b3d00SmrgAC_SUBST([LIB_MAN_DIR])
482054b3d00SmrgAC_SUBST([FILE_MAN_DIR])
483054b3d00SmrgAC_SUBST([MISC_MAN_DIR])
484054b3d00SmrgAC_SUBST([DRIVER_MAN_DIR])
485054b3d00SmrgAC_SUBST([ADMIN_MAN_DIR])
48655074dd0Smrg
487054b3d00SmrgXORG_MAN_PAGE="X Version 11"
488054b3d00SmrgAC_SUBST([XORG_MAN_PAGE])
489054b3d00SmrgMAN_SUBSTS="\
490054b3d00Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
491054b3d00Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
492054b3d00Smrg	-e 's|__xservername__|Xorg|g' \
493054b3d00Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
494054b3d00Smrg	-e 's|__projectroot__|\$(prefix)|g' \
495054b3d00Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
496054b3d00Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
497054b3d00Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
498054b3d00Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
499054b3d00Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
500054b3d00Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
501054b3d00Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
502054b3d00SmrgAC_SUBST([MAN_SUBSTS])
503a1d141d5Smrg
504054b3d00Smrg]) # XORG_MANPAGE_SECTIONS
505a1d141d5Smrg
506054b3d00Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
507054b3d00Smrg# ------------------------
508054b3d00Smrg# Minimum version: 1.7.0
509054b3d00Smrg#
510054b3d00Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
511054b3d00Smrg# provided by xorg-sgml-doctools, if installed.
512054b3d00SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
513054b3d00SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
514054b3d00SmrgXORG_SGML_PATH=
515054b3d00SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
516054b3d00Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
517054b3d00Smrg    [m4_ifval([$1],[:],
518054b3d00Smrg        [if test x"$cross_compiling" != x"yes" ; then
519054b3d00Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
520054b3d00Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
521054b3d00Smrg         fi])
522054b3d00Smrg    ])
523a1d141d5Smrg
524054b3d00Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
525054b3d00Smrg# the path and the name of the doc stylesheet
526054b3d00Smrgif test "x$XORG_SGML_PATH" != "x" ; then
527054b3d00Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
528054b3d00Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
529054b3d00Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
530054b3d00Smrgelse
531054b3d00Smrg   AC_MSG_RESULT([no])
532054b3d00Smrgfi
533a1d141d5Smrg
534054b3d00SmrgAC_SUBST(XORG_SGML_PATH)
535054b3d00SmrgAC_SUBST(STYLESHEET_SRCDIR)
536054b3d00SmrgAC_SUBST(XSL_STYLESHEET)
537054b3d00SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
538054b3d00Smrg]) # XORG_CHECK_SGML_DOCTOOLS
539a1d141d5Smrg
540054b3d00Smrg# XORG_CHECK_LINUXDOC
541054b3d00Smrg# -------------------
542054b3d00Smrg# Minimum version: 1.0.0
54355074dd0Smrg#
544054b3d00Smrg# Defines the variable MAKE_TEXT if the necessary tools and
545054b3d00Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
546054b3d00Smrg# Whether or not the necessary tools and files are found can be checked
547054b3d00Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
548054b3d00SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
549054b3d00SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
550054b3d00SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551a1d141d5Smrg
552054b3d00SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553054b3d00Smrg
554054b3d00SmrgAC_MSG_CHECKING([whether to build documentation])
555054b3d00Smrg
556054b3d00Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
557054b3d00Smrg   BUILDDOC=yes
558054b3d00Smrgelse
559054b3d00Smrg   BUILDDOC=no
5602ddb6cf1Smrgfi
561a1d141d5Smrg
562054b3d00SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
56355074dd0Smrg
564054b3d00SmrgAC_MSG_RESULT([$BUILDDOC])
565a1d141d5Smrg
566054b3d00SmrgAC_MSG_CHECKING([whether to build pdf documentation])
567054b3d00Smrg
568054b3d00Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
569054b3d00Smrg   BUILDPDFDOC=yes
570a1d141d5Smrgelse
571054b3d00Smrg   BUILDPDFDOC=no
572a1d141d5Smrgfi
573a1d141d5Smrg
574054b3d00SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575a1d141d5Smrg
576054b3d00SmrgAC_MSG_RESULT([$BUILDPDFDOC])
577a1d141d5Smrg
578054b3d00SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
579054b3d00SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
580054b3d00SmrgMAKE_PDF="$PS2PDF"
581054b3d00SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582a1d141d5Smrg
583054b3d00SmrgAC_SUBST(MAKE_TEXT)
584054b3d00SmrgAC_SUBST(MAKE_PS)
585054b3d00SmrgAC_SUBST(MAKE_PDF)
586054b3d00SmrgAC_SUBST(MAKE_HTML)
587054b3d00Smrg]) # XORG_CHECK_LINUXDOC
588a1d141d5Smrg
589054b3d00Smrg# XORG_CHECK_DOCBOOK
590054b3d00Smrg# -------------------
591054b3d00Smrg# Minimum version: 1.0.0
59255074dd0Smrg#
593054b3d00Smrg# Checks for the ability to build output formats from SGML DocBook source.
594054b3d00Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
595054b3d00Smrg# indicates whether the necessary tools and files are found and, if set,
596054b3d00Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
597054b3d00SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
598054b3d00SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599a1d141d5Smrg
600054b3d00SmrgBUILDTXTDOC=no
601054b3d00SmrgBUILDPDFDOC=no
602054b3d00SmrgBUILDPSDOC=no
603054b3d00SmrgBUILDHTMLDOC=no
604a1d141d5Smrg
605054b3d00SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
606054b3d00SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
607054b3d00SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
608054b3d00SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609a1d141d5Smrg
610054b3d00SmrgAC_MSG_CHECKING([whether to build text documentation])
611054b3d00Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
612054b3d00Smrg   test x$BUILD_TXTDOC != xno; then
613054b3d00Smrg	BUILDTXTDOC=yes
614054b3d00Smrgfi
615054b3d00SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
616054b3d00SmrgAC_MSG_RESULT([$BUILDTXTDOC])
617a1d141d5Smrg
618054b3d00SmrgAC_MSG_CHECKING([whether to build PDF documentation])
619054b3d00Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
620054b3d00Smrg   test x$BUILD_PDFDOC != xno; then
621054b3d00Smrg	BUILDPDFDOC=yes
622054b3d00Smrgfi
623054b3d00SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
624054b3d00SmrgAC_MSG_RESULT([$BUILDPDFDOC])
6252ddb6cf1Smrg
626054b3d00SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
627054b3d00Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
628054b3d00Smrg   test x$BUILD_PSDOC != xno; then
629054b3d00Smrg	BUILDPSDOC=yes
630054b3d00Smrgfi
631054b3d00SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
632054b3d00SmrgAC_MSG_RESULT([$BUILDPSDOC])
6332ddb6cf1Smrg
634054b3d00SmrgAC_MSG_CHECKING([whether to build HTML documentation])
635054b3d00Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
636054b3d00Smrg   test x$BUILD_HTMLDOC != xno; then
637054b3d00Smrg	BUILDHTMLDOC=yes
638054b3d00Smrgfi
639054b3d00SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
640054b3d00SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6412ddb6cf1Smrg
642054b3d00SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
643054b3d00SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
644054b3d00SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
645054b3d00SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
646a1d141d5Smrg
647054b3d00SmrgAC_SUBST(MAKE_TEXT)
648054b3d00SmrgAC_SUBST(MAKE_PS)
649054b3d00SmrgAC_SUBST(MAKE_PDF)
650054b3d00SmrgAC_SUBST(MAKE_HTML)
651054b3d00Smrg]) # XORG_CHECK_DOCBOOK
652a1d141d5Smrg
653054b3d00Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
654054b3d00Smrg# ----------------
655054b3d00Smrg# Minimum version: 1.5.0
656054b3d00Smrg# Minimum version for optional DEFAULT argument: 1.11.0
65755074dd0Smrg#
658054b3d00Smrg# Documentation tools are not always available on all platforms and sometimes
659054b3d00Smrg# not at the appropriate level. This macro enables a module to test for the
660054b3d00Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
661054b3d00Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
662054b3d00Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
663054b3d00Smrg# --with-xmlto assumes 'auto'.
664054b3d00Smrg#
665054b3d00Smrg# Interface to module:
666054b3d00Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
667054b3d00Smrg# XMLTO:	returns the path of the xmlto program found
668054b3d00Smrg#		returns the path set by the user in the environment
669054b3d00Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
670054b3d00Smrg#		'no' user instructs the module not to use xmlto
671054b3d00Smrg#
672054b3d00Smrg# Added in version 1.10.0
673054b3d00Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
674054b3d00Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
675054b3d00Smrg#
676054b3d00Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
677054b3d00Smrg#
678054b3d00SmrgAC_DEFUN([XORG_WITH_XMLTO],[
679054b3d00SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
680054b3d00Smrgm4_define([_defopt], m4_default([$2], [auto]))
681054b3d00SmrgAC_ARG_WITH(xmlto,
682054b3d00Smrg	AS_HELP_STRING([--with-xmlto],
683054b3d00Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
684054b3d00Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
685054b3d00Smrgm4_undefine([_defopt])
686a1d141d5Smrg
687054b3d00Smrgif test "x$use_xmlto" = x"auto"; then
688054b3d00Smrg   AC_PATH_PROG([XMLTO], [xmlto])
689054b3d00Smrg   if test "x$XMLTO" = "x"; then
690054b3d00Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
691054b3d00Smrg	have_xmlto=no
692054b3d00Smrg   else
693054b3d00Smrg        have_xmlto=yes
694054b3d00Smrg   fi
695054b3d00Smrgelif test "x$use_xmlto" = x"yes" ; then
696054b3d00Smrg   AC_PATH_PROG([XMLTO], [xmlto])
697054b3d00Smrg   if test "x$XMLTO" = "x"; then
698054b3d00Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
699054b3d00Smrg   fi
700054b3d00Smrg   have_xmlto=yes
701054b3d00Smrgelif test "x$use_xmlto" = x"no" ; then
702054b3d00Smrg   if test "x$XMLTO" != "x"; then
703054b3d00Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
704054b3d00Smrg   fi
705054b3d00Smrg   have_xmlto=no
706054b3d00Smrgelse
707054b3d00Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
708054b3d00Smrgfi
709a1d141d5Smrg
710054b3d00Smrg# Test for a minimum version of xmlto, if provided.
711054b3d00Smrgm4_ifval([$1],
712054b3d00Smrg[if test "$have_xmlto" = yes; then
713054b3d00Smrg    # scrape the xmlto version
714054b3d00Smrg    AC_MSG_CHECKING([the xmlto version])
715054b3d00Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
716054b3d00Smrg    AC_MSG_RESULT([$xmlto_version])
717054b3d00Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
718054b3d00Smrg        [if test "x$use_xmlto" = xauto; then
719054b3d00Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
720054b3d00Smrg            have_xmlto=no
721054b3d00Smrg        else
722054b3d00Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
723054b3d00Smrg        fi])
724054b3d00Smrgfi])
725a1d141d5Smrg
726054b3d00Smrg# Test for the ability of xmlto to generate a text target
7272ddb6cf1Smrg#
728054b3d00Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
729054b3d00Smrg# following test for empty XML docbook files.
730054b3d00Smrg# For compatibility reasons use the following empty XML docbook file and if
731054b3d00Smrg# it fails try it again with a non-empty XML file.
732054b3d00Smrghave_xmlto_text=no
733054b3d00Smrgcat > conftest.xml << "EOF"
734054b3d00SmrgEOF
735054b3d00SmrgAS_IF([test "$have_xmlto" = yes],
736054b3d00Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
737054b3d00Smrg             [have_xmlto_text=yes],
738054b3d00Smrg             [# Try it again with a non-empty XML file.
739054b3d00Smrg              cat > conftest.xml << "EOF"
740054b3d00Smrg<x></x>
741054b3d00SmrgEOF
742054b3d00Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
743054b3d00Smrg                    [have_xmlto_text=yes],
744054b3d00Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
745054b3d00Smrgrm -f conftest.xml
746054b3d00SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
747054b3d00SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
748054b3d00Smrg]) # XORG_WITH_XMLTO
749a1d141d5Smrg
750054b3d00Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
751054b3d00Smrg# --------------------------------------------
752054b3d00Smrg# Minimum version: 1.12.0
753054b3d00Smrg# Minimum version for optional DEFAULT argument: 1.12.0
754054b3d00Smrg#
755054b3d00Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
756054b3d00Smrg# XML-based language used for the transformation of XML documents.
757054b3d00Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
758054b3d00Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
759054b3d00Smrg# The XSLT processor is often used as a standalone tool for transformations.
760054b3d00Smrg# It should not be assumed that this tool is used only to work with documnetation.
761054b3d00Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
762054b3d00Smrg#
763054b3d00Smrg# Interface to module:
764054b3d00Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
765054b3d00Smrg# XSLTPROC:	 returns the path of the xsltproc program found
766054b3d00Smrg#		 returns the path set by the user in the environment
767054b3d00Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
768054b3d00Smrg#		  'no' user instructs the module not to use xsltproc
769054b3d00Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
770054b3d00Smrg#
771054b3d00Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
772054b3d00Smrg#
773054b3d00SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
774054b3d00SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
775054b3d00Smrg# Preserves the interface, should it be implemented later
776054b3d00Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
777054b3d00Smrgm4_define([_defopt], m4_default([$2], [auto]))
778054b3d00SmrgAC_ARG_WITH(xsltproc,
779054b3d00Smrg	AS_HELP_STRING([--with-xsltproc],
780054b3d00Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
781054b3d00Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
782054b3d00Smrgm4_undefine([_defopt])
783a1d141d5Smrg
784054b3d00Smrgif test "x$use_xsltproc" = x"auto"; then
785054b3d00Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
786054b3d00Smrg   if test "x$XSLTPROC" = "x"; then
787054b3d00Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
788054b3d00Smrg	have_xsltproc=no
789054b3d00Smrg   else
790054b3d00Smrg        have_xsltproc=yes
791054b3d00Smrg   fi
792054b3d00Smrgelif test "x$use_xsltproc" = x"yes" ; then
793054b3d00Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
794054b3d00Smrg   if test "x$XSLTPROC" = "x"; then
795054b3d00Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
796054b3d00Smrg   fi
797054b3d00Smrg   have_xsltproc=yes
798054b3d00Smrgelif test "x$use_xsltproc" = x"no" ; then
799054b3d00Smrg   if test "x$XSLTPROC" != "x"; then
800054b3d00Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
801054b3d00Smrg   fi
802054b3d00Smrg   have_xsltproc=no
803054b3d00Smrgelse
804054b3d00Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805054b3d00Smrgfi
806a1d141d5Smrg
807054b3d00SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
808054b3d00Smrg]) # XORG_WITH_XSLTPROC
8092ddb6cf1Smrg
810054b3d00Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
811054b3d00Smrg# ----------------------------------------
812054b3d00Smrg# Minimum version: 1.15.0
813054b3d00Smrg#
814054b3d00Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
815054b3d00Smrg# scanning arbitrary text files, extracting information from those text files,
816054b3d00Smrg# and printing reports based on that information.
817054b3d00Smrg#
818054b3d00Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
819054b3d00Smrg#
820054b3d00Smrg# Interface to module:
821054b3d00Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
822054b3d00Smrg# PERL:	     returns the path of the perl program found
823054b3d00Smrg#	     returns the path set by the user in the environment
824054b3d00Smrg# --with-perl: 'yes' user instructs the module to use perl
825054b3d00Smrg#	       'no' user instructs the module not to use perl
826054b3d00Smrg# have_perl: returns yes if perl found in PATH or no
827054b3d00Smrg#
828054b3d00Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
829054b3d00Smrg#
830054b3d00SmrgAC_DEFUN([XORG_WITH_PERL],[
831054b3d00SmrgAC_ARG_VAR([PERL], [Path to perl command])
832054b3d00Smrg# Preserves the interface, should it be implemented later
833054b3d00Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
834054b3d00Smrgm4_define([_defopt], m4_default([$2], [auto]))
835054b3d00SmrgAC_ARG_WITH(perl,
836054b3d00Smrg	AS_HELP_STRING([--with-perl],
837054b3d00Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
838054b3d00Smrg	   [use_perl=$withval], [use_perl=]_defopt)
839054b3d00Smrgm4_undefine([_defopt])
840a1d141d5Smrg
841054b3d00Smrgif test "x$use_perl" = x"auto"; then
842054b3d00Smrg   AC_PATH_PROG([PERL], [perl])
843054b3d00Smrg   if test "x$PERL" = "x"; then
844054b3d00Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
845054b3d00Smrg	have_perl=no
846054b3d00Smrg   else
847054b3d00Smrg        have_perl=yes
848054b3d00Smrg   fi
849054b3d00Smrgelif test "x$use_perl" = x"yes" ; then
850054b3d00Smrg   AC_PATH_PROG([PERL], [perl])
851054b3d00Smrg   if test "x$PERL" = "x"; then
852054b3d00Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
853054b3d00Smrg   fi
854054b3d00Smrg   have_perl=yes
855054b3d00Smrgelif test "x$use_perl" = x"no" ; then
856054b3d00Smrg   if test "x$PERL" != "x"; then
857054b3d00Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
858054b3d00Smrg   fi
859054b3d00Smrg   have_perl=no
860054b3d00Smrgelse
861054b3d00Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
862054b3d00Smrgfi
863a1d141d5Smrg
864054b3d00SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
865054b3d00Smrg]) # XORG_WITH_PERL
866a1d141d5Smrg
867054b3d00Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
868054b3d00Smrg# ----------------
869054b3d00Smrg# Minimum version: 1.5.0
870054b3d00Smrg# Minimum version for optional DEFAULT argument: 1.11.0
8712ddb6cf1Smrg#
872054b3d00Smrg# Documentation tools are not always available on all platforms and sometimes
873054b3d00Smrg# not at the appropriate level. This macro enables a module to test for the
874054b3d00Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
875054b3d00Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
876054b3d00Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
877054b3d00Smrg# --with-asciidoc assumes 'auto'.
878054b3d00Smrg#
879054b3d00Smrg# Interface to module:
880054b3d00Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
881054b3d00Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
882054b3d00Smrg#		 returns the path set by the user in the environment
883054b3d00Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
884054b3d00Smrg#		  'no' user instructs the module not to use asciidoc
885054b3d00Smrg#
886054b3d00Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
887054b3d00Smrg#
888054b3d00SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
889054b3d00SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
890054b3d00Smrgm4_define([_defopt], m4_default([$2], [auto]))
891054b3d00SmrgAC_ARG_WITH(asciidoc,
892054b3d00Smrg	AS_HELP_STRING([--with-asciidoc],
893054b3d00Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
894054b3d00Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
895054b3d00Smrgm4_undefine([_defopt])
896a1d141d5Smrg
897054b3d00Smrgif test "x$use_asciidoc" = x"auto"; then
898054b3d00Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
899054b3d00Smrg   if test "x$ASCIIDOC" = "x"; then
900054b3d00Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
901054b3d00Smrg	have_asciidoc=no
902054b3d00Smrg   else
903054b3d00Smrg        have_asciidoc=yes
90455074dd0Smrg   fi
905054b3d00Smrgelif test "x$use_asciidoc" = x"yes" ; then
906054b3d00Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
907054b3d00Smrg   if test "x$ASCIIDOC" = "x"; then
908054b3d00Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
90955074dd0Smrg   fi
910054b3d00Smrg   have_asciidoc=yes
911054b3d00Smrgelif test "x$use_asciidoc" = x"no" ; then
912054b3d00Smrg   if test "x$ASCIIDOC" != "x"; then
913054b3d00Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
914054b3d00Smrg   fi
915054b3d00Smrg   have_asciidoc=no
91655074dd0Smrgelse
917054b3d00Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9182ddb6cf1Smrgfi
919054b3d00Smrgm4_ifval([$1],
920054b3d00Smrg[if test "$have_asciidoc" = yes; then
921054b3d00Smrg    # scrape the asciidoc version
922054b3d00Smrg    AC_MSG_CHECKING([the asciidoc version])
923054b3d00Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
924054b3d00Smrg    AC_MSG_RESULT([$asciidoc_version])
925054b3d00Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
926054b3d00Smrg        [if test "x$use_asciidoc" = xauto; then
927054b3d00Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
928054b3d00Smrg            have_asciidoc=no
929054b3d00Smrg        else
930054b3d00Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
931054b3d00Smrg        fi])
932054b3d00Smrgfi])
933054b3d00SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
934054b3d00Smrg]) # XORG_WITH_ASCIIDOC
935a1d141d5Smrg
936054b3d00Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
937054b3d00Smrg# -------------------------------------------
938054b3d00Smrg# Minimum version: 1.5.0
939054b3d00Smrg# Minimum version for optional DEFAULT argument: 1.11.0
940054b3d00Smrg# Minimum version for optional DOT checking: 1.18.0
9412ddb6cf1Smrg#
942054b3d00Smrg# Documentation tools are not always available on all platforms and sometimes
943054b3d00Smrg# not at the appropriate level. This macro enables a module to test for the
944054b3d00Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
945054b3d00Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
946054b3d00Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
947054b3d00Smrg# --with-doxygen assumes 'auto'.
9482ddb6cf1Smrg#
949054b3d00Smrg# Interface to module:
950054b3d00Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
951054b3d00Smrg# DOXYGEN:	 returns the path of the doxygen program found
952054b3d00Smrg#		 returns the path set by the user in the environment
953054b3d00Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
954054b3d00Smrg#		  'no' user instructs the module not to use doxygen
9552ddb6cf1Smrg#
956054b3d00Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
957054b3d00Smrg#
958054b3d00SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
959054b3d00SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
960054b3d00SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
961054b3d00Smrgm4_define([_defopt], m4_default([$2], [auto]))
962054b3d00SmrgAC_ARG_WITH(doxygen,
963054b3d00Smrg	AS_HELP_STRING([--with-doxygen],
964054b3d00Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
965054b3d00Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
966054b3d00Smrgm4_undefine([_defopt])
96755074dd0Smrg
968054b3d00Smrgif test "x$use_doxygen" = x"auto"; then
969054b3d00Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
970054b3d00Smrg   if test "x$DOXYGEN" = "x"; then
971054b3d00Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
972054b3d00Smrg	have_doxygen=no
973054b3d00Smrg   else
974054b3d00Smrg        have_doxygen=yes
975054b3d00Smrg   fi
976054b3d00Smrgelif test "x$use_doxygen" = x"yes" ; then
977054b3d00Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
978054b3d00Smrg   if test "x$DOXYGEN" = "x"; then
979054b3d00Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
980054b3d00Smrg   fi
981054b3d00Smrg   have_doxygen=yes
982054b3d00Smrgelif test "x$use_doxygen" = x"no" ; then
983054b3d00Smrg   if test "x$DOXYGEN" != "x"; then
984054b3d00Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
985054b3d00Smrg   fi
986054b3d00Smrg   have_doxygen=no
987054b3d00Smrgelse
988054b3d00Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
989054b3d00Smrgfi
990054b3d00Smrgm4_ifval([$1],
991054b3d00Smrg[if test "$have_doxygen" = yes; then
992054b3d00Smrg    # scrape the doxygen version
993054b3d00Smrg    AC_MSG_CHECKING([the doxygen version])
994054b3d00Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
995054b3d00Smrg    AC_MSG_RESULT([$doxygen_version])
996054b3d00Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
997054b3d00Smrg        [if test "x$use_doxygen" = xauto; then
998054b3d00Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
999054b3d00Smrg            have_doxygen=no
1000054b3d00Smrg        else
1001054b3d00Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1002054b3d00Smrg        fi])
1003054b3d00Smrgfi])
100455074dd0Smrg
1005054b3d00Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
1006054b3d00Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
1007054b3d00Smrgdnl 	HAVE_DOT = @HAVE_DOT@
1008054b3d00SmrgHAVE_DOT=no
1009054b3d00Smrgif test "x$have_doxygen" = "xyes"; then
1010054b3d00Smrg  AC_PATH_PROG([DOT], [dot])
1011054b3d00Smrg    if test "x$DOT" != "x"; then
1012054b3d00Smrg      HAVE_DOT=yes
1013054b3d00Smrg    fi
1014054b3d00Smrgfi
101555074dd0Smrg
1016054b3d00SmrgAC_SUBST([HAVE_DOT])
1017054b3d00SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
1018054b3d00SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1019054b3d00Smrg]) # XORG_WITH_DOXYGEN
102055074dd0Smrg
1021054b3d00Smrg# XORG_WITH_GROFF([DEFAULT])
1022054b3d00Smrg# ----------------
1023054b3d00Smrg# Minimum version: 1.6.0
1024054b3d00Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10252ddb6cf1Smrg#
1026054b3d00Smrg# Documentation tools are not always available on all platforms and sometimes
1027054b3d00Smrg# not at the appropriate level. This macro enables a module to test for the
1028054b3d00Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1029054b3d00Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1030054b3d00Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1031054b3d00Smrg# --with-groff assumes 'auto'.
103255074dd0Smrg#
1033054b3d00Smrg# Interface to module:
1034054b3d00Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1035054b3d00Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1036054b3d00Smrg# HAVE_GROFF_MS: the -ms macros package
1037054b3d00Smrg# GROFF:	 returns the path of the groff program found
1038054b3d00Smrg#		 returns the path set by the user in the environment
1039054b3d00Smrg# --with-groff:	 'yes' user instructs the module to use groff
1040054b3d00Smrg#		 'no' user instructs the module not to use groff
104155074dd0Smrg#
1042054b3d00Smrg# Added in version 1.9.0:
1043054b3d00Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1044054b3d00Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1045054b3d00Smrg#		   psselect from the psutils package.
1046054b3d00Smrg#		   the ghostcript package. Refer to the grohtml man pages
10472ddb6cf1Smrg#
1048054b3d00Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10492ddb6cf1Smrg#
1050054b3d00Smrg# OS and distros often splits groff in a basic and full package, the former
1051054b3d00Smrg# having the groff program and the later having devices, fonts and macros
1052054b3d00Smrg# Checking for the groff executable is not enough.
10532ddb6cf1Smrg#
1054054b3d00Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1055054b3d00Smrg# unset HAVE_GROFF or GROFF env variables.
1056054b3d00Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10572ddb6cf1Smrg#
1058054b3d00SmrgAC_DEFUN([XORG_WITH_GROFF],[
1059054b3d00SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1060054b3d00Smrgm4_define([_defopt], m4_default([$1], [auto]))
1061054b3d00SmrgAC_ARG_WITH(groff,
1062054b3d00Smrg	AS_HELP_STRING([--with-groff],
1063054b3d00Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1064054b3d00Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1065054b3d00Smrgm4_undefine([_defopt])
10662ddb6cf1Smrg
1067054b3d00Smrgif test "x$use_groff" = x"auto"; then
1068054b3d00Smrg   AC_PATH_PROG([GROFF], [groff])
1069054b3d00Smrg   if test "x$GROFF" = "x"; then
1070054b3d00Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1071054b3d00Smrg	have_groff=no
1072054b3d00Smrg   else
1073054b3d00Smrg        have_groff=yes
1074054b3d00Smrg   fi
1075054b3d00Smrgelif test "x$use_groff" = x"yes" ; then
1076054b3d00Smrg   AC_PATH_PROG([GROFF], [groff])
1077054b3d00Smrg   if test "x$GROFF" = "x"; then
1078054b3d00Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1079054b3d00Smrg   fi
1080054b3d00Smrg   have_groff=yes
1081054b3d00Smrgelif test "x$use_groff" = x"no" ; then
1082054b3d00Smrg   if test "x$GROFF" != "x"; then
1083054b3d00Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1084054b3d00Smrg   fi
1085054b3d00Smrg   have_groff=no
108655074dd0Smrgelse
1087054b3d00Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
108855074dd0Smrgfi
10892ddb6cf1Smrg
1090054b3d00Smrg# We have groff, test for the presence of the macro packages
1091054b3d00Smrgif test "x$have_groff" = x"yes"; then
1092054b3d00Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1093054b3d00Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1094054b3d00Smrg        groff_ms_works=yes
1095054b3d00Smrg    else
1096054b3d00Smrg        groff_ms_works=no
1097054b3d00Smrg    fi
1098054b3d00Smrg    AC_MSG_RESULT([$groff_ms_works])
1099054b3d00Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1100054b3d00Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1101054b3d00Smrg        groff_mm_works=yes
1102054b3d00Smrg    else
1103054b3d00Smrg        groff_mm_works=no
1104054b3d00Smrg    fi
1105054b3d00Smrg    AC_MSG_RESULT([$groff_mm_works])
11062ddb6cf1Smrgfi
11072ddb6cf1Smrg
1108054b3d00Smrg# We have groff, test for HTML dependencies, one command per package
1109054b3d00Smrgif test "x$have_groff" = x"yes"; then
1110054b3d00Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1111054b3d00Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1112054b3d00Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1113054b3d00Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1114054b3d00Smrg      have_groff_html=yes
1115054b3d00Smrg   else
1116054b3d00Smrg      have_groff_html=no
1117054b3d00Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1118054b3d00Smrg   fi
1119054b3d00Smrgfi
11202ddb6cf1Smrg
1121054b3d00Smrg# Set Automake conditionals for Makefiles
1122054b3d00SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1123054b3d00SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1124054b3d00SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1125054b3d00SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1126054b3d00Smrg]) # XORG_WITH_GROFF
11272ddb6cf1Smrg
1128054b3d00Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1129054b3d00Smrg# ---------------------------------------
1130054b3d00Smrg# Minimum version: 1.6.0
1131054b3d00Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1132054b3d00Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1133054b3d00Smrg#
1134054b3d00Smrg# Documentation tools are not always available on all platforms and sometimes
1135054b3d00Smrg# not at the appropriate level. This macro enables a module to test for the
1136054b3d00Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1137054b3d00Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
1138054b3d00Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
1139054b3d00Smrg# --with-fop assumes 'auto'.
1140054b3d00Smrg#
1141054b3d00Smrg# Interface to module:
1142054b3d00Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1143054b3d00Smrg# FOP:	 	returns the path of the fop program found
1144054b3d00Smrg#		returns the path set by the user in the environment
1145054b3d00Smrg# --with-fop: 	'yes' user instructs the module to use fop
1146054b3d00Smrg#		'no' user instructs the module not to use fop
1147054b3d00Smrg#
1148054b3d00Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149054b3d00Smrg#
1150054b3d00SmrgAC_DEFUN([XORG_WITH_FOP],[
1151054b3d00SmrgAC_ARG_VAR([FOP], [Path to fop command])
1152054b3d00Smrgm4_define([_defopt], m4_default([$2], [auto]))
1153054b3d00SmrgAC_ARG_WITH(fop,
1154054b3d00Smrg	AS_HELP_STRING([--with-fop],
1155054b3d00Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1156054b3d00Smrg	   [use_fop=$withval], [use_fop=]_defopt)
1157054b3d00Smrgm4_undefine([_defopt])
11582ddb6cf1Smrg
1159054b3d00Smrgif test "x$use_fop" = x"auto"; then
1160054b3d00Smrg   AC_PATH_PROG([FOP], [fop])
1161054b3d00Smrg   if test "x$FOP" = "x"; then
1162054b3d00Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1163054b3d00Smrg	have_fop=no
1164054b3d00Smrg   else
1165054b3d00Smrg        have_fop=yes
1166054b3d00Smrg   fi
1167054b3d00Smrgelif test "x$use_fop" = x"yes" ; then
1168054b3d00Smrg   AC_PATH_PROG([FOP], [fop])
1169054b3d00Smrg   if test "x$FOP" = "x"; then
1170054b3d00Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1171054b3d00Smrg   fi
1172054b3d00Smrg   have_fop=yes
1173054b3d00Smrgelif test "x$use_fop" = x"no" ; then
1174054b3d00Smrg   if test "x$FOP" != "x"; then
1175054b3d00Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1176054b3d00Smrg   fi
1177054b3d00Smrg   have_fop=no
1178054b3d00Smrgelse
1179054b3d00Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
118055074dd0Smrgfi
1181a1d141d5Smrg
1182054b3d00Smrg# Test for a minimum version of fop, if provided.
1183054b3d00Smrgm4_ifval([$1],
1184054b3d00Smrg[if test "$have_fop" = yes; then
1185054b3d00Smrg    # scrape the fop version
1186054b3d00Smrg    AC_MSG_CHECKING([for fop minimum version])
1187054b3d00Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1188054b3d00Smrg    AC_MSG_RESULT([$fop_version])
1189054b3d00Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
1190054b3d00Smrg        [if test "x$use_fop" = xauto; then
1191054b3d00Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1192054b3d00Smrg            have_fop=no
1193054b3d00Smrg        else
1194054b3d00Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1195054b3d00Smrg        fi])
1196054b3d00Smrgfi])
1197054b3d00SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1198054b3d00Smrg]) # XORG_WITH_FOP
11992ddb6cf1Smrg
1200054b3d00Smrg# XORG_WITH_M4([MIN-VERSION])
1201054b3d00Smrg# ---------------------------
1202054b3d00Smrg# Minimum version: 1.19.0
1203054b3d00Smrg#
1204054b3d00Smrg# This macro attempts to locate an m4 macro processor which supports
1205054b3d00Smrg# -I option and is only useful for modules relying on M4 in order to
1206054b3d00Smrg# expand macros in source code files.
1207054b3d00Smrg#
1208054b3d00Smrg# Interface to module:
1209054b3d00Smrg# M4:	 	returns the path of the m4 program found
1210054b3d00Smrg#		returns the path set by the user in the environment
1211054b3d00Smrg#
1212054b3d00SmrgAC_DEFUN([XORG_WITH_M4], [
1213054b3d00SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
1214054b3d00Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
1215054b3d00Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
1216054b3d00Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
1217054b3d00Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
1218054b3d00Smrg   [$PATH:/usr/gnu/bin])])
1219a1d141d5Smrg
1220054b3d00SmrgAC_SUBST([M4], [$ac_cv_path_M4])
1221054b3d00Smrg]) # XORG_WITH_M4
1222a1d141d5Smrg
1223054b3d00Smrg# XORG_WITH_PS2PDF([DEFAULT])
122455074dd0Smrg# ----------------
1225054b3d00Smrg# Minimum version: 1.6.0
122655074dd0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
122755074dd0Smrg#
122855074dd0Smrg# Documentation tools are not always available on all platforms and sometimes
122955074dd0Smrg# not at the appropriate level. This macro enables a module to test for the
123055074dd0Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1231054b3d00Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1232054b3d00Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1233054b3d00Smrg# --with-ps2pdf assumes 'auto'.
123455074dd0Smrg#
123555074dd0Smrg# Interface to module:
1236054b3d00Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1237054b3d00Smrg# PS2PDF:	returns the path of the ps2pdf program found
123855074dd0Smrg#		returns the path set by the user in the environment
1239054b3d00Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1240054b3d00Smrg#		 'no' user instructs the module not to use ps2pdf
124155074dd0Smrg#
1242054b3d00Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
124355074dd0Smrg#
1244054b3d00SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1245054b3d00SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1246054b3d00Smrgm4_define([_defopt], m4_default([$1], [auto]))
1247054b3d00SmrgAC_ARG_WITH(ps2pdf,
1248054b3d00Smrg	AS_HELP_STRING([--with-ps2pdf],
1249054b3d00Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1250054b3d00Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
125155074dd0Smrgm4_undefine([_defopt])
125255074dd0Smrg
1253054b3d00Smrgif test "x$use_ps2pdf" = x"auto"; then
1254054b3d00Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1255054b3d00Smrg   if test "x$PS2PDF" = "x"; then
1256054b3d00Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1257054b3d00Smrg	have_ps2pdf=no
125855074dd0Smrg   else
1259054b3d00Smrg        have_ps2pdf=yes
126055074dd0Smrg   fi
1261054b3d00Smrgelif test "x$use_ps2pdf" = x"yes" ; then
1262054b3d00Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1263054b3d00Smrg   if test "x$PS2PDF" = "x"; then
1264054b3d00Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
126555074dd0Smrg   fi
1266054b3d00Smrg   have_ps2pdf=yes
1267054b3d00Smrgelif test "x$use_ps2pdf" = x"no" ; then
1268054b3d00Smrg   if test "x$PS2PDF" != "x"; then
1269054b3d00Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
127055074dd0Smrg   fi
1271054b3d00Smrg   have_ps2pdf=no
127255074dd0Smrgelse
1273054b3d00Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
127455074dd0Smrgfi
1275054b3d00SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1276054b3d00Smrg]) # XORG_WITH_PS2PDF
12772ddb6cf1Smrg
1278054b3d00Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
1279054b3d00Smrg# ----------------
1280054b3d00Smrg# Minimum version: 1.6.0
1281054b3d00Smrg#
1282054b3d00Smrg# Documentation tools are not always available on all platforms and sometimes
1283054b3d00Smrg# not at the appropriate level. This macro enables a builder to skip all
1284054b3d00Smrg# documentation targets except traditional man pages.
1285054b3d00Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1286054b3d00Smrg# maximum flexibilty in controlling documentation building.
1287054b3d00Smrg# Refer to:
1288054b3d00Smrg# XORG_WITH_XMLTO         --with-xmlto
1289054b3d00Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1290054b3d00Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1291054b3d00Smrg# XORG_WITH_FOP           --with-fop
1292054b3d00Smrg# XORG_WITH_GROFF         --with-groff
1293054b3d00Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294054b3d00Smrg#
1295054b3d00Smrg# Interface to module:
1296054b3d00Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1297054b3d00Smrg# --enable-docs: 'yes' user instructs the module to generate docs
1298054b3d00Smrg#		 'no' user instructs the module not to generate docs
1299054b3d00Smrg# parm1:	specify the default value, yes or no.
1300054b3d00Smrg#
1301054b3d00SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1302054b3d00Smrgm4_define([docs_default], m4_default([$1], [yes]))
1303054b3d00SmrgAC_ARG_ENABLE(docs,
1304054b3d00Smrg	AS_HELP_STRING([--enable-docs],
1305054b3d00Smrg	   [Enable building the documentation (default: ]docs_default[)]),
1306054b3d00Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
1307054b3d00Smrgm4_undefine([docs_default])
1308054b3d00SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1309054b3d00SmrgAC_MSG_CHECKING([whether to build documentation])
1310054b3d00SmrgAC_MSG_RESULT([$build_docs])
1311054b3d00Smrg]) # XORG_ENABLE_DOCS
13122ddb6cf1Smrg
1313054b3d00Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1314054b3d00Smrg# ----------------
1315054b3d00Smrg# Minimum version: 1.6.0
1316054b3d00Smrg#
1317054b3d00Smrg# This macro enables a builder to skip all developer documentation.
1318054b3d00Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1319054b3d00Smrg# maximum flexibilty in controlling documentation building.
1320054b3d00Smrg# Refer to:
1321054b3d00Smrg# XORG_WITH_XMLTO         --with-xmlto
1322054b3d00Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1323054b3d00Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1324054b3d00Smrg# XORG_WITH_FOP           --with-fop
1325054b3d00Smrg# XORG_WITH_GROFF         --with-groff
1326054b3d00Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1327054b3d00Smrg#
1328054b3d00Smrg# Interface to module:
1329054b3d00Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1330054b3d00Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1331054b3d00Smrg#			'no' user instructs the module not to generate developer docs
1332054b3d00Smrg# parm1:		specify the default value, yes or no.
1333054b3d00Smrg#
1334054b3d00SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1335054b3d00Smrgm4_define([devel_default], m4_default([$1], [yes]))
1336054b3d00SmrgAC_ARG_ENABLE(devel-docs,
1337054b3d00Smrg	AS_HELP_STRING([--enable-devel-docs],
1338054b3d00Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1339054b3d00Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1340054b3d00Smrgm4_undefine([devel_default])
1341054b3d00SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1342054b3d00SmrgAC_MSG_CHECKING([whether to build developer documentation])
1343054b3d00SmrgAC_MSG_RESULT([$build_devel_docs])
1344054b3d00Smrg]) # XORG_ENABLE_DEVEL_DOCS
134555074dd0Smrg
1346054b3d00Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
134755074dd0Smrg# ----------------
1348054b3d00Smrg# Minimum version: 1.6.0
13492ddb6cf1Smrg#
1350054b3d00Smrg# This macro enables a builder to skip all functional specification targets.
1351054b3d00Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1352054b3d00Smrg# maximum flexibilty in controlling documentation building.
1353054b3d00Smrg# Refer to:
1354054b3d00Smrg# XORG_WITH_XMLTO         --with-xmlto
1355054b3d00Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1356054b3d00Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1357054b3d00Smrg# XORG_WITH_FOP           --with-fop
1358054b3d00Smrg# XORG_WITH_GROFF         --with-groff
1359054b3d00Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
136055074dd0Smrg#
136155074dd0Smrg# Interface to module:
1362054b3d00Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1363054b3d00Smrg# --enable-specs:	'yes' user instructs the module to generate specs
1364054b3d00Smrg#			'no' user instructs the module not to generate specs
1365054b3d00Smrg# parm1:		specify the default value, yes or no.
136655074dd0Smrg#
1367054b3d00SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1368054b3d00Smrgm4_define([spec_default], m4_default([$1], [yes]))
1369054b3d00SmrgAC_ARG_ENABLE(specs,
1370054b3d00Smrg	AS_HELP_STRING([--enable-specs],
1371054b3d00Smrg	   [Enable building the specs (default: ]spec_default[)]),
1372054b3d00Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
1373054b3d00Smrgm4_undefine([spec_default])
1374054b3d00SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1375054b3d00SmrgAC_MSG_CHECKING([whether to build functional specifications])
1376054b3d00SmrgAC_MSG_RESULT([$build_specs])
1377054b3d00Smrg]) # XORG_ENABLE_SPECS
1378054b3d00Smrg
1379054b3d00Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
1380054b3d00Smrg# ----------------------------------------------
1381054b3d00Smrg# Minimum version: 1.13.0
138255074dd0Smrg#
1383054b3d00Smrg# This macro enables a builder to enable/disable unit testing
1384054b3d00Smrg# It makes no assumption about the test cases implementation
1385054b3d00Smrg# Test cases may or may not use Automake "Support for test suites"
1386054b3d00Smrg# They may or may not use the software utility library GLib
1387054b3d00Smrg#
1388054b3d00Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
1389054b3d00Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
1390054b3d00Smrg# The variable enable_unit_tests is used by other macros in this file.
1391054b3d00Smrg#
1392054b3d00Smrg# Interface to module:
1393054b3d00Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
1394054b3d00Smrg# enable_unit_tests:    used in configure.ac for additional configuration
1395054b3d00Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
1396054b3d00Smrg#			'no' user instructs the module not to build tests
1397054b3d00Smrg# parm1:		specify the default value, yes or no.
1398054b3d00Smrg#
1399054b3d00SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
1400054b3d00SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
1401054b3d00SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1402054b3d00SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1403054b3d00Smrgm4_define([_defopt], m4_default([$1], [auto]))
1404054b3d00SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
1405054b3d00Smrg	[Enable building unit test cases (default: ]_defopt[)]),
1406054b3d00Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
1407054b3d00Smrgm4_undefine([_defopt])
1408054b3d00SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
1409054b3d00SmrgAC_MSG_CHECKING([whether to build unit test cases])
1410054b3d00SmrgAC_MSG_RESULT([$enable_unit_tests])
1411054b3d00Smrg]) # XORG_ENABLE_UNIT_TESTS
1412054b3d00Smrg
1413054b3d00Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
1414054b3d00Smrg# ------------------------------------------------------
1415054b3d00Smrg# Minimum version: 1.17.0
1416054b3d00Smrg#
1417054b3d00Smrg# This macro enables a builder to enable/disable integration testing
1418054b3d00Smrg# It makes no assumption about the test cases' implementation
1419054b3d00Smrg# Test cases may or may not use Automake "Support for test suites"
1420054b3d00Smrg#
1421054b3d00Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
1422054b3d00Smrg# usually requires less dependencies and may be built and run under less
1423054b3d00Smrg# stringent environments than integration tests.
1424054b3d00Smrg#
1425054b3d00Smrg# Interface to module:
1426054b3d00Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
1427054b3d00Smrg# enable_integration_tests:   used in configure.ac for additional configuration
1428054b3d00Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
1429054b3d00Smrg#                             'no' user instructs the module not to build tests
1430054b3d00Smrg# parm1:                      specify the default value, yes or no.
1431054b3d00Smrg#
1432054b3d00SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
1433054b3d00SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1434054b3d00Smrgm4_define([_defopt], m4_default([$1], [auto]))
1435054b3d00SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
1436054b3d00Smrg	[Enable building integration test cases (default: ]_defopt[)]),
1437054b3d00Smrg	[enable_integration_tests=$enableval],
1438054b3d00Smrg	[enable_integration_tests=]_defopt)
1439054b3d00Smrgm4_undefine([_defopt])
1440054b3d00SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
1441054b3d00Smrg	[test "x$enable_integration_tests" != xno])
1442054b3d00SmrgAC_MSG_CHECKING([whether to build unit test cases])
1443054b3d00SmrgAC_MSG_RESULT([$enable_integration_tests])
1444054b3d00Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445054b3d00Smrg
1446054b3d00Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
1447054b3d00Smrg# ----------------------------------------
1448054b3d00Smrg# Minimum version: 1.13.0
1449054b3d00Smrg#
1450054b3d00Smrg# GLib is a library which provides advanced data structures and functions.
1451054b3d00Smrg# This macro enables a module to test for the presence of Glib.
1452054b3d00Smrg#
1453054b3d00Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
1454054b3d00Smrg# Otherwise the value of $enable_unit_tests is blank.
1455054b3d00Smrg#
1456054b3d00Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
1457054b3d00Smrg# test support usually requires less dependencies and may be built and run under
1458054b3d00Smrg# less stringent environments than integration tests.
1459054b3d00Smrg#
1460054b3d00Smrg# Interface to module:
1461054b3d00Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
1462054b3d00Smrg# with_glib: used in configure.ac to know if GLib has been found
1463054b3d00Smrg# --with-glib:	'yes' user instructs the module to use glib
1464054b3d00Smrg#		'no' user instructs the module not to use glib
1465054b3d00Smrg#
1466054b3d00SmrgAC_DEFUN([XORG_WITH_GLIB],[
1467054b3d00SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146855074dd0Smrgm4_define([_defopt], m4_default([$2], [auto]))
1469054b3d00SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
1470054b3d00Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
1471054b3d00Smrg	[with_glib=$withval], [with_glib=]_defopt)
147255074dd0Smrgm4_undefine([_defopt])
147355074dd0Smrg
1474054b3d00Smrghave_glib=no
1475054b3d00Smrg# Do not probe GLib if user explicitly disabled unit testing
1476054b3d00Smrgif test "x$enable_unit_tests" != x"no"; then
1477054b3d00Smrg  # Do not probe GLib if user explicitly disabled it
1478054b3d00Smrg  if test "x$with_glib" != x"no"; then
1479054b3d00Smrg    m4_ifval(
1480054b3d00Smrg      [$1],
1481054b3d00Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
1482054b3d00Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
1483054b3d00Smrg    )
1484054b3d00Smrg  fi
1485054b3d00Smrgfi
1486054b3d00Smrg
1487054b3d00Smrg# Not having GLib when unit testing has been explicitly requested is an error
1488054b3d00Smrgif test "x$enable_unit_tests" = x"yes"; then
1489054b3d00Smrg  if test "x$have_glib" = x"no"; then
1490054b3d00Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1491054b3d00Smrg  fi
1492054b3d00Smrgfi
1493054b3d00Smrg
1494054b3d00Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
1495054b3d00Smrgif test "x$enable_unit_tests" = x"no"; then
1496054b3d00Smrg  if test "x$with_glib" = x"yes"; then
1497054b3d00Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1498054b3d00Smrg  fi
1499054b3d00Smrgfi
1500054b3d00Smrg
1501054b3d00Smrg# Not having GLib when it has been explicitly requested is an error
1502054b3d00Smrgif test "x$with_glib" = x"yes"; then
1503054b3d00Smrg  if test "x$have_glib" = x"no"; then
1504054b3d00Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
1505054b3d00Smrg  fi
1506054b3d00Smrgfi
1507054b3d00Smrg
1508054b3d00SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
1509054b3d00Smrg]) # XORG_WITH_GLIB
1510054b3d00Smrg
1511054b3d00Smrg# XORG_LD_WRAP([required|optional])
1512054b3d00Smrg# ---------------------------------
1513054b3d00Smrg# Minimum version: 1.13.0
1514054b3d00Smrg#
1515054b3d00Smrg# Check if linker supports -wrap, passed via compiler flags
1516054b3d00Smrg#
1517054b3d00Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
1518054b3d00Smrg# Otherwise the value of $enable_unit_tests is blank.
1519054b3d00Smrg#
1520054b3d00Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
1521054b3d00Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
1522054b3d00Smrg# available, an argument of "optional" allows use when some unit tests require
1523054b3d00Smrg# ld -wrap and others do not.
1524054b3d00Smrg#
1525054b3d00SmrgAC_DEFUN([XORG_LD_WRAP],[
1526054b3d00SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
1527054b3d00Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
1528054b3d00Smrg                      void __wrap_exit(int status) { return; }],
1529054b3d00Smrg                     [exit(0);])])
1530054b3d00Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
1531054b3d00Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
1532054b3d00Smrg  if test "x$have_ld_wrap" = x"no"; then
1533054b3d00Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
1534054b3d00Smrg  fi
1535054b3d00Smrgfi
1536054b3d00SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1537054b3d00Smrg#
1538054b3d00Smrg]) # XORG_LD_WRAP
1539054b3d00Smrg
1540054b3d00Smrg# XORG_CHECK_LINKER_FLAGS
1541054b3d00Smrg# -----------------------
1542054b3d00Smrg# SYNOPSIS
1543054b3d00Smrg#
1544054b3d00Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
1545054b3d00Smrg#
1546054b3d00Smrg# DESCRIPTION
1547054b3d00Smrg#
1548054b3d00Smrg#   Check whether the given linker FLAGS work with the current language's
1549054b3d00Smrg#   linker, or whether they give an error.
1550054b3d00Smrg#
1551054b3d00Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
1552054b3d00Smrg#   success/failure.
1553054b3d00Smrg#
1554054b3d00Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
1555054b3d00Smrg#
1556054b3d00Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
1557054b3d00Smrg#
1558054b3d00Smrg# LICENSE
1559054b3d00Smrg#
1560054b3d00Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
1561054b3d00Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
1562054b3d00Smrg#   Copyright (c) 2009 Matteo Frigo
1563054b3d00Smrg#
1564054b3d00Smrg#   This program is free software: you can redistribute it and/or modify it
1565054b3d00Smrg#   under the terms of the GNU General Public License as published by the
1566054b3d00Smrg#   Free Software Foundation, either version 3 of the License, or (at your
1567054b3d00Smrg#   option) any later version.
1568054b3d00Smrg#
1569054b3d00Smrg#   This program is distributed in the hope that it will be useful, but
1570054b3d00Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
1571054b3d00Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1572054b3d00Smrg#   Public License for more details.
1573054b3d00Smrg#
1574054b3d00Smrg#   You should have received a copy of the GNU General Public License along
1575054b3d00Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
1576054b3d00Smrg#
1577054b3d00Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
1578054b3d00Smrg#   gives unlimited permission to copy, distribute and modify the configure
1579054b3d00Smrg#   scripts that are the output of Autoconf when processing the Macro. You
1580054b3d00Smrg#   need not follow the terms of the GNU General Public License when using
1581054b3d00Smrg#   or distributing such scripts, even though portions of the text of the
1582054b3d00Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
1583054b3d00Smrg#   all other use of the material that constitutes the Autoconf Macro.
1584054b3d00Smrg#
1585054b3d00Smrg#   This special exception to the GPL applies to versions of the Autoconf
1586054b3d00Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
1587054b3d00Smrg#   modified version of the Autoconf Macro, you may extend this special
1588054b3d00Smrg#   exception to the GPL to apply to your modified version as well.#
1589054b3d00SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
1590054b3d00Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
1591054b3d00Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
1592054b3d00SmrgAS_LITERAL_IF([$1],
1593054b3d00Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
1594054b3d00Smrg      ax_save_FLAGS=$LDFLAGS
1595054b3d00Smrg      LDFLAGS="$1"
1596054b3d00Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
1597054b3d00Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1598054b3d00Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1599054b3d00Smrg      LDFLAGS=$ax_save_FLAGS])],
1600054b3d00Smrg  [ax_save_FLAGS=$LDFLAGS
1601054b3d00Smrg   LDFLAGS="$1"
1602054b3d00Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1603054b3d00Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1604054b3d00Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1605054b3d00Smrg   LDFLAGS=$ax_save_FLAGS])
1606054b3d00Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
1607054b3d00SmrgAC_MSG_RESULT($xorg_check_linker_flags)
1608054b3d00Smrgif test "x$xorg_check_linker_flags" = xyes; then
1609054b3d00Smrg	m4_default([$2], :)
161055074dd0Smrgelse
1611054b3d00Smrg	m4_default([$3], :)
16122ddb6cf1Smrgfi
1613054b3d00Smrg]) # XORG_CHECK_LINKER_FLAGS
16142ddb6cf1Smrg
1615054b3d00Smrg# XORG_MEMORY_CHECK_FLAGS
1616054b3d00Smrg# -----------------------
1617054b3d00Smrg# Minimum version: 1.16.0
16182ddb6cf1Smrg#
1619054b3d00Smrg# This macro attempts to find appropriate memory checking functionality
1620054b3d00Smrg# for various platforms which unit testing code may use to catch various
1621054b3d00Smrg# forms of memory allocation and access errors in testing.
162255074dd0Smrg#
162355074dd0Smrg# Interface to module:
1624054b3d00Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
1625054b3d00Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162655074dd0Smrg#
1627054b3d00Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162855074dd0Smrg#
1629054b3d00SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
163055074dd0Smrg
1631054b3d00SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1632054b3d00SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
1633054b3d00Smrg           [Environment variables to enable memory checking in tests])
1634054b3d00Smrg
1635054b3d00Smrg# Check for different types of support on different platforms
1636054b3d00Smrgcase $host_os in
1637054b3d00Smrg    solaris*)
1638054b3d00Smrg        AC_CHECK_LIB([umem], [umem_alloc],
1639054b3d00Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
1640054b3d00Smrg        ;;
1641054b3d00Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
1642054b3d00Smrg        # both directly and inverted, so should not be 0 or 255.
1643054b3d00Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
1644054b3d00Smrg        ;;
1645054b3d00Smrg    darwin*)
1646054b3d00Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
1647054b3d00Smrg        ;;
1648054b3d00Smrg    *bsd*)
1649054b3d00Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
1650054b3d00Smrg        ;;
1651054b3d00Smrgesac
1652054b3d00Smrg
1653054b3d00Smrg# User supplied flags override default flags
1654054b3d00Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
1655054b3d00Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1656054b3d00Smrgfi
1657054b3d00Smrg
1658054b3d00SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
1659054b3d00Smrg]) # XORG_WITH_LINT
1660054b3d00Smrg
1661054b3d00Smrg# XORG_CHECK_MALLOC_ZERO
1662054b3d00Smrg# ----------------------
1663054b3d00Smrg# Minimum version: 1.0.0
1664054b3d00Smrg#
1665054b3d00Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1666054b3d00Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1667054b3d00Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1668054b3d00SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1669054b3d00SmrgAC_ARG_ENABLE(malloc0returnsnull,
1670054b3d00Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1671054b3d00Smrg		       [malloc(0) returns NULL (default: auto)]),
1672054b3d00Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1673054b3d00Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1674054b3d00Smrg
1675054b3d00SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1676054b3d00Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1677054b3d00SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
1678054b3d00Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
1679054b3d00Smrg#include <stdlib.h>
1680054b3d00Smrg],[
1681054b3d00Smrg    char *m0, *r0, *c0, *p;
1682054b3d00Smrg    m0 = malloc(0);
1683054b3d00Smrg    p = malloc(10);
1684054b3d00Smrg    r0 = realloc(p,0);
1685054b3d00Smrg    c0 = calloc(0,10);
1686054b3d00Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
1687054b3d00Smrg])],
1688054b3d00Smrg		[xorg_cv_malloc0_returns_null=yes],
1689054b3d00Smrg		[xorg_cv_malloc0_returns_null=no])])
1690054b3d00SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1691054b3d00Smrgfi
1692054b3d00SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1693054b3d00Smrg
1694054b3d00Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1695054b3d00Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1696054b3d00Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1697054b3d00Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
169855074dd0Smrgelse
1699054b3d00Smrg	MALLOC_ZERO_CFLAGS=""
1700054b3d00Smrg	XMALLOC_ZERO_CFLAGS=""
1701054b3d00Smrg	XTMALLOC_ZERO_CFLAGS=""
170255074dd0Smrgfi
1703a1d141d5Smrg
1704054b3d00SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1705054b3d00SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1706054b3d00SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1707054b3d00Smrg]) # XORG_CHECK_MALLOC_ZERO
1708054b3d00Smrg
1709054b3d00Smrg# XORG_WITH_LINT()
171055074dd0Smrg# ----------------
1711054b3d00Smrg# Minimum version: 1.1.0
171255074dd0Smrg#
1713054b3d00Smrg# This macro enables the use of a tool that flags some suspicious and
1714054b3d00Smrg# non-portable constructs (likely to be bugs) in C language source code.
1715054b3d00Smrg# It will attempt to locate the tool and use appropriate options.
1716054b3d00Smrg# There are various lint type tools on different platforms.
171755074dd0Smrg#
171855074dd0Smrg# Interface to module:
1719054b3d00Smrg# LINT:		returns the path to the tool found on the platform
1720054b3d00Smrg#		or the value set to LINT on the configure cmd line
1721054b3d00Smrg#		also an Automake conditional
1722054b3d00Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
172355074dd0Smrg#
1724054b3d00Smrg# --with-lint:	'yes' user instructs the module to use lint
1725054b3d00Smrg#		'no' user instructs the module not to use lint (default)
172655074dd0Smrg#
1727054b3d00Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1728054b3d00Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
172955074dd0Smrg#
1730054b3d00SmrgAC_DEFUN([XORG_WITH_LINT],[
173155074dd0Smrg
1732054b3d00SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1733054b3d00SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1734054b3d00SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1735054b3d00Smrg		[Use a lint-style source code checker (default: disabled)])],
1736054b3d00Smrg		[use_lint=$withval], [use_lint=no])
1737054b3d00Smrg
1738054b3d00Smrg# Obtain platform specific info like program name and options
1739054b3d00Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1740054b3d00Smrgcase $host_os in
1741054b3d00Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1742054b3d00Smrg	lint_name=splint
1743054b3d00Smrg	lint_options="-badflag"
1744054b3d00Smrg	;;
1745054b3d00Smrg  *freebsd* | *netbsd*)
1746054b3d00Smrg	lint_name=lint
1747054b3d00Smrg	lint_options="-u -b"
1748054b3d00Smrg	;;
1749054b3d00Smrg  *solaris*)
1750054b3d00Smrg	lint_name=lint
1751054b3d00Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1752054b3d00Smrg	;;
1753054b3d00Smrgesac
1754054b3d00Smrg
1755054b3d00Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1756054b3d00Smrgif test "x$use_lint" = x"yes" ; then
1757054b3d00Smrg   AC_PATH_PROG([LINT], [$lint_name])
1758054b3d00Smrg   if test "x$LINT" = "x"; then
1759054b3d00Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
176055074dd0Smrg   fi
1761054b3d00Smrgelif test "x$use_lint" = x"no" ; then
1762054b3d00Smrg   if test "x$LINT" != "x"; then
1763054b3d00Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
176455074dd0Smrg   fi
17652ddb6cf1Smrgelse
1766054b3d00Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17672ddb6cf1Smrgfi
17682ddb6cf1Smrg
1769054b3d00Smrg# User supplied flags override default flags
1770054b3d00Smrgif test "x$LINT_FLAGS" != "x"; then
1771054b3d00Smrg   lint_options=$LINT_FLAGS
177255074dd0Smrgfi
17732ddb6cf1Smrg
1774054b3d00SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1775054b3d00SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17762ddb6cf1Smrg
1777054b3d00Smrg]) # XORG_WITH_LINT
17782ddb6cf1Smrg
1779054b3d00Smrg# XORG_LINT_LIBRARY(LIBNAME)
1780054b3d00Smrg# --------------------------
1781054b3d00Smrg# Minimum version: 1.1.0
178255074dd0Smrg#
1783054b3d00Smrg# Sets up flags for building lint libraries for checking programs that call
1784054b3d00Smrg# functions in the library.
178555074dd0Smrg#
178655074dd0Smrg# Interface to module:
1787054b3d00Smrg# LINTLIB		- Automake variable with the name of lint library file to make
1788054b3d00Smrg# MAKE_LINT_LIB		- Automake conditional
178955074dd0Smrg#
1790054b3d00Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1791054b3d00Smrg#			  - 'no' user instructs the module not to create a lint library (default)
179255074dd0Smrg
1793054b3d00SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1794054b3d00SmrgAC_REQUIRE([XORG_WITH_LINT])
1795054b3d00SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1796054b3d00Smrg	[Create lint library (default: disabled)])],
1797054b3d00Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1798054b3d00Smrg
1799054b3d00Smrgif test "x$make_lint_lib" = x"yes" ; then
1800054b3d00Smrg   LINTLIB=llib-l$1.ln
1801054b3d00Smrg   if test "x$LINT" = "x"; then
1802054b3d00Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
180355074dd0Smrg   fi
1804054b3d00Smrgelif test "x$make_lint_lib" != x"no" ; then
1805054b3d00Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1806054b3d00Smrgfi
1807054b3d00Smrg
1808054b3d00SmrgAC_SUBST(LINTLIB)
1809054b3d00SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1810054b3d00Smrg
1811054b3d00Smrg]) # XORG_LINT_LIBRARY
1812054b3d00Smrg
1813054b3d00Smrg# XORG_COMPILER_BRAND
1814054b3d00Smrg# -------------------
1815054b3d00Smrg# Minimum version: 1.14.0
1816054b3d00Smrg#
1817054b3d00Smrg# Checks for various brands of compilers and sets flags as appropriate:
1818054b3d00Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
1819054b3d00Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
1820054b3d00Smrg#   clang compiler - sets CLANGCC to "yes"
1821054b3d00Smrg#   Intel compiler - sets INTELCC to "yes"
1822054b3d00Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823054b3d00Smrg#
1824054b3d00SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
1825054b3d00SmrgAC_LANG_CASE(
1826054b3d00Smrg	[C], [
1827054b3d00Smrg		AC_REQUIRE([AC_PROG_CC_C99])
1828054b3d00Smrg	],
1829054b3d00Smrg	[C++], [
1830054b3d00Smrg		AC_REQUIRE([AC_PROG_CXX])
1831054b3d00Smrg	]
1832054b3d00Smrg)
1833054b3d00SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
1834054b3d00SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1835054b3d00SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1836054b3d00Smrg]) # XORG_COMPILER_BRAND
1837054b3d00Smrg
1838054b3d00Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
1839054b3d00Smrg# ---------------
1840054b3d00Smrg# Minimum version: 1.16.0
1841054b3d00Smrg#
1842054b3d00Smrg# Test if the compiler works when passed the given flag as a command line argument.
1843054b3d00Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
1844054b3d00Smrg# next flag in the list until there are no more options.
1845054b3d00Smrg#
1846054b3d00Smrg# Note that this does not guarantee that the compiler supports the flag as some
1847054b3d00Smrg# compilers will simply ignore arguments that they do not understand, but we do
1848054b3d00Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
1849054b3d00Smrg# -Werror=unused-command-line-argument
1850054b3d00Smrg#
1851054b3d00SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
1852054b3d00Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1853054b3d00Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854054b3d00Smrg
1855054b3d00SmrgAC_LANG_COMPILER_REQUIRE
1856054b3d00Smrg
1857054b3d00SmrgAC_LANG_CASE(
1858054b3d00Smrg	[C], [
1859054b3d00Smrg		AC_REQUIRE([AC_PROG_CC_C99])
1860054b3d00Smrg		define([PREFIX], [C])
1861054b3d00Smrg		define([CACHE_PREFIX], [cc])
1862054b3d00Smrg		define([COMPILER], [$CC])
1863054b3d00Smrg	],
1864054b3d00Smrg	[C++], [
1865054b3d00Smrg		define([PREFIX], [CXX])
1866054b3d00Smrg		define([CACHE_PREFIX], [cxx])
1867054b3d00Smrg		define([COMPILER], [$CXX])
1868054b3d00Smrg	]
1869054b3d00Smrg)
1870054b3d00Smrg
1871054b3d00Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1872054b3d00Smrg
1873054b3d00Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
1874054b3d00Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1875054b3d00Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
1876054b3d00Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
1877054b3d00Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1878054b3d00Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
1879054b3d00Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
1880054b3d00Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
1881054b3d00Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882054b3d00Smrgfi
1883054b3d00Smrg
1884054b3d00Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
1885054b3d00Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
1886054b3d00Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1887054b3d00Smrg	fi
1888054b3d00Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1889054b3d00Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
1890054b3d00Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
1891054b3d00Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1892054b3d00Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
1893054b3d00Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
1894054b3d00Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
1895054b3d00Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1896054b3d00Smrgfi
1897054b3d00Smrg
1898054b3d00Smrgfound="no"
1899054b3d00Smrgm4_foreach([flag], m4_cdr($@), [
1900054b3d00Smrg	if test $found = "no" ; then
1901054b3d00Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
1902054b3d00Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1903054b3d00Smrg		fi
1904054b3d00Smrg
1905054b3d00Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
1906054b3d00Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1907054b3d00Smrg		fi
1908054b3d00Smrg
1909054b3d00Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1910054b3d00Smrg
1911054b3d00Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
1912054b3d00Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
1913054b3d00Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
1914054b3d00Smrg		AC_CACHE_VAL($cacheid,
1915054b3d00Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
1916054b3d00Smrg					     [eval $cacheid=yes],
1917054b3d00Smrg					     [eval $cacheid=no])])
1918054b3d00Smrg
1919054b3d00Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1920054b3d00Smrg
1921054b3d00Smrg		eval supported=\$$cacheid
1922054b3d00Smrg		AC_MSG_RESULT([$supported])
1923054b3d00Smrg		if test "$supported" = "yes" ; then
1924054b3d00Smrg			$1="$$1 ]flag["
1925054b3d00Smrg			found="yes"
1926054b3d00Smrg		fi
1927054b3d00Smrg	fi
1928054b3d00Smrg])
1929054b3d00Smrg]) # XORG_TESTSET_CFLAG
1930054b3d00Smrg
1931054b3d00Smrg# XORG_COMPILER_FLAGS
1932054b3d00Smrg# ---------------
1933054b3d00Smrg# Minimum version: 1.16.0
1934054b3d00Smrg#
1935054b3d00Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
1936054b3d00Smrg# arguments supported by the selected compiler which do NOT alter the generated
1937054b3d00Smrg# code.  These arguments will cause the compiler to print various warnings
1938054b3d00Smrg# during compilation AND turn a conservative set of warnings into errors.
1939054b3d00Smrg#
1940054b3d00Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
1941054b3d00Smrg# future versions of util-macros as options are added to new compilers.
1942054b3d00Smrg#
1943054b3d00SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
1944054b3d00SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945054b3d00Smrg
1946054b3d00SmrgAC_ARG_ENABLE(selective-werror,
1947054b3d00Smrg              AS_HELP_STRING([--disable-selective-werror],
1948054b3d00Smrg                             [Turn off selective compiler errors. (default: enabled)]),
1949054b3d00Smrg              [SELECTIVE_WERROR=$enableval],
1950054b3d00Smrg              [SELECTIVE_WERROR=yes])
1951054b3d00Smrg
1952054b3d00SmrgAC_LANG_CASE(
1953054b3d00Smrg        [C], [
1954054b3d00Smrg                define([PREFIX], [C])
1955054b3d00Smrg        ],
1956054b3d00Smrg        [C++], [
1957054b3d00Smrg                define([PREFIX], [CXX])
1958054b3d00Smrg        ]
1959054b3d00Smrg)
1960054b3d00Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
1961054b3d00Smrgif test "x$SUNCC" = "xyes"; then
1962054b3d00Smrg    [BASE_]PREFIX[FLAGS]="-v"
196355074dd0Smrgelse
1964054b3d00Smrg    [BASE_]PREFIX[FLAGS]=""
196555074dd0Smrgfi
19662ddb6cf1Smrg
1967054b3d00Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
1968054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
1969054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
1970054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
1971054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972054b3d00Smrg
1973054b3d00SmrgAC_LANG_CASE(
1974054b3d00Smrg	[C], [
1975054b3d00Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
1976054b3d00Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
1977054b3d00Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
1978054b3d00Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
1979054b3d00Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
1980054b3d00Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
1981054b3d00Smrg	]
1982054b3d00Smrg)
198355074dd0Smrg
1984054b3d00Smrg# This chunk adds additional warnings that could catch undesired effects.
1985054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
1986054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
1987054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
1988054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
1989054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
1990054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
1991054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
1992054b3d00Smrg
1993054b3d00Smrg# These are currently disabled because they are noisy.  They will be enabled
1994054b3d00Smrg# in the future once the codebase is sufficiently modernized to silence
1995054b3d00Smrg# them.  For now, I don't want them to drown out the other warnings.
1996054b3d00Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
1997054b3d00Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
1998054b3d00Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
1999054b3d00Smrg
2000054b3d00Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2001054b3d00Smrg# when there are problems that should be fixed.
2002054b3d00Smrg
2003054b3d00Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2004054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2005054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2006054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2007054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2008054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2009054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2010054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2011054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2012054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2013054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2014054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2015054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2016054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201755074dd0Smrgelse
2018054b3d00SmrgAC_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])
2019054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2020054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2021054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2022054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2023054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2024054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2025054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2026054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2027054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2028054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2029054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2030054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2031054b3d00SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203255074dd0Smrgfi
20332ddb6cf1Smrg
2034054b3d00SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2035054b3d00Smrg]) # XORG_COMPILER_FLAGS
2036054b3d00Smrg
2037054b3d00Smrg# XORG_CWARNFLAGS
2038054b3d00Smrg# ---------------
2039054b3d00Smrg# Minimum version: 1.2.0
2040054b3d00Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
204155074dd0Smrg#
2042054b3d00Smrg# Defines CWARNFLAGS to enable C compiler warnings.
204355074dd0Smrg#
2044054b3d00Smrg# This function is deprecated because it defines -fno-strict-aliasing
2045054b3d00Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2046054b3d00Smrg# is needed, then it should be added explicitly in the module when
2047054b3d00Smrg# it is updated to use BASE_CFLAGS.
204855074dd0Smrg#
2049054b3d00SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2050054b3d00SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2051054b3d00SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2052054b3d00SmrgAC_LANG_CASE(
2053054b3d00Smrg	[C], [
2054054b3d00Smrg		CWARNFLAGS="$BASE_CFLAGS"
2055054b3d00Smrg		if  test "x$GCC" = xyes ; then
2056054b3d00Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2057054b3d00Smrg		fi
2058054b3d00Smrg		AC_SUBST(CWARNFLAGS)
2059054b3d00Smrg	]
2060054b3d00Smrg)
2061054b3d00Smrg]) # XORG_CWARNFLAGS
206255074dd0Smrg
2063054b3d00Smrg# XORG_STRICT_OPTION
2064054b3d00Smrg# -----------------------
2065054b3d00Smrg# Minimum version: 1.3.0
206655074dd0Smrg#
2067054b3d00Smrg# Add configure option to enable strict compilation flags, such as treating
2068054b3d00Smrg# warnings as fatal errors.
2069054b3d00Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2070054b3d00Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
207155074dd0Smrg#
2072054b3d00Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2073054b3d00Smrg# when strict compilation is unconditionally desired.
2074054b3d00SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2075054b3d00SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2076054b3d00SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
207755074dd0Smrg
2078054b3d00SmrgAC_ARG_ENABLE(strict-compilation,
2079054b3d00Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2080054b3d00Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2081054b3d00Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082054b3d00Smrg
2083054b3d00SmrgAC_LANG_CASE(
2084054b3d00Smrg        [C], [
2085054b3d00Smrg                define([PREFIX], [C])
2086054b3d00Smrg        ],
2087054b3d00Smrg        [C++], [
2088054b3d00Smrg                define([PREFIX], [CXX])
2089054b3d00Smrg        ]
2090054b3d00Smrg)
2091054b3d00Smrg
2092054b3d00Smrg[STRICT_]PREFIX[FLAGS]=""
2093054b3d00SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2094054b3d00SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2095054b3d00Smrg
2096054b3d00Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2097054b3d00Smrg# activate it with -Werror, so we add it here explicitly.
2098054b3d00SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2099054b3d00Smrg
2100054b3d00Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2101054b3d00Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2102054b3d00Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2103054b3d00Smrgfi
2104054b3d00SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2105054b3d00SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2106054b3d00SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2107054b3d00Smrg]) # XORG_STRICT_OPTION
2108054b3d00Smrg
2109054b3d00Smrg# XORG_DEFAULT_OPTIONS
2110054b3d00Smrg# --------------------
2111054b3d00Smrg# Minimum version: 1.3.0
211255074dd0Smrg#
2113054b3d00Smrg# Defines default options for X.Org modules.
211455074dd0Smrg#
2115054b3d00SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2116054b3d00SmrgAC_REQUIRE([AC_PROG_INSTALL])
2117054b3d00SmrgXORG_COMPILER_FLAGS
2118054b3d00SmrgXORG_CWARNFLAGS
2119054b3d00SmrgXORG_STRICT_OPTION
2120054b3d00SmrgXORG_RELEASE_VERSION
2121054b3d00SmrgXORG_CHANGELOG
2122054b3d00SmrgXORG_INSTALL
2123054b3d00SmrgXORG_MANPAGE_SECTIONS
2124054b3d00Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2125054b3d00Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2126054b3d00Smrg]) # XORG_DEFAULT_OPTIONS
21272ddb6cf1Smrg
2128054b3d00Smrg# XORG_INSTALL()
2129054b3d00Smrg# ----------------
2130054b3d00Smrg# Minimum version: 1.4.0
21312ddb6cf1Smrg#
2132054b3d00Smrg# Defines the variable INSTALL_CMD as the command to copy
2133054b3d00Smrg# INSTALL from $prefix/share/util-macros.
2134054b3d00Smrg#
2135054b3d00SmrgAC_DEFUN([XORG_INSTALL], [
2136054b3d00SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2137054b3d00Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2138054b3d00SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2139054b3d00Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2140054b3d00Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2141054b3d00Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2142054b3d00SmrgAC_SUBST([INSTALL_CMD])
2143054b3d00Smrg]) # XORG_INSTALL
2144054b3d00Smrgdnl Copyright 2005 Red Hat, Inc
2145054b3d00Smrgdnl
2146054b3d00Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2147054b3d00Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2148054b3d00Smrgdnl the above copyright notice appear in all copies and that both that
2149054b3d00Smrgdnl copyright notice and this permission notice appear in supporting
2150054b3d00Smrgdnl documentation.
2151054b3d00Smrgdnl
2152054b3d00Smrgdnl The above copyright notice and this permission notice shall be included
2153054b3d00Smrgdnl in all copies or substantial portions of the Software.
2154054b3d00Smrgdnl
2155054b3d00Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2156054b3d00Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2157054b3d00Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2158054b3d00Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2159054b3d00Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2160054b3d00Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2161054b3d00Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2162054b3d00Smrgdnl
2163054b3d00Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2164054b3d00Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2165054b3d00Smrgdnl other dealings in this Software without prior written authorization
2166054b3d00Smrgdnl from the copyright holders.
2167054b3d00Smrgdnl
2168054b3d00Smrg
2169054b3d00Smrg# XORG_RELEASE_VERSION
2170054b3d00Smrg# --------------------
2171054b3d00Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172054b3d00Smrg
2173054b3d00SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2174054b3d00Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2175054b3d00Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2176054b3d00Smrg		[Major version of this package])
2177054b3d00Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2178054b3d00Smrg	if test "x$PVM" = "x"; then
2179054b3d00Smrg		PVM="0"
2180054b3d00Smrg	fi
2181054b3d00Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2182054b3d00Smrg		[$PVM],
2183054b3d00Smrg		[Minor version of this package])
2184054b3d00Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2185054b3d00Smrg	if test "x$PVP" = "x"; then
2186054b3d00Smrg		PVP="0"
2187054b3d00Smrg	fi
2188054b3d00Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2189054b3d00Smrg		[$PVP],
2190054b3d00Smrg		[Patch version of this package])
2191054b3d00Smrg])
2192054b3d00Smrg
2193054b3d00Smrg# XORG_CHANGELOG()
2194054b3d00Smrg# ----------------
2195054b3d00Smrg# Minimum version: 1.2.0
2196054b3d00Smrg#
2197054b3d00Smrg# Defines the variable CHANGELOG_CMD as the command to generate
2198054b3d00Smrg# ChangeLog from git.
2199054b3d00Smrg#
2200054b3d00Smrg#
2201054b3d00SmrgAC_DEFUN([XORG_CHANGELOG], [
2202054b3d00SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2203054b3d00Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2204054b3d00Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2205054b3d00Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2206054b3d00SmrgAC_SUBST([CHANGELOG_CMD])
2207054b3d00Smrg]) # XORG_CHANGELOG
2208054b3d00Smrg
2209054b3d00Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210054b3d00Smrg#
2211054b3d00Smrg# This file is free software; the Free Software Foundation
2212054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2213054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2214054b3d00Smrg
2215054b3d00Smrg# AM_AUTOMAKE_VERSION(VERSION)
2216054b3d00Smrg# ----------------------------
2217054b3d00Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2218054b3d00Smrg# generated from the m4 files accompanying Automake X.Y.
2219054b3d00Smrg# (This private macro should not be called outside this file.)
2220054b3d00SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2221054b3d00Smrg[am__api_version='1.15'
2222054b3d00Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2223054b3d00Smrgdnl require some minimum version.  Point them to the right macro.
2224054b3d00Smrgm4_if([$1], [1.15], [],
2225054b3d00Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2226054b3d00Smrg])
2227054b3d00Smrg
2228054b3d00Smrg# _AM_AUTOCONF_VERSION(VERSION)
2229054b3d00Smrg# -----------------------------
2230054b3d00Smrg# aclocal traces this macro to find the Autoconf version.
2231054b3d00Smrg# This is a private macro too.  Using m4_define simplifies
2232054b3d00Smrg# the logic in aclocal, which can simply ignore this definition.
2233054b3d00Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2234054b3d00Smrg
2235054b3d00Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2236054b3d00Smrg# -------------------------------
2237054b3d00Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2238054b3d00Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2239054b3d00SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2240054b3d00Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
2241054b3d00Smrgm4_ifndef([AC_AUTOCONF_VERSION],
2242054b3d00Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2243054b3d00Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244054b3d00Smrg
2245054b3d00Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2246054b3d00Smrg
2247054b3d00Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248054b3d00Smrg#
2249054b3d00Smrg# This file is free software; the Free Software Foundation
2250054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2251054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2252054b3d00Smrg
2253054b3d00Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2254054b3d00Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2255054b3d00Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256054b3d00Smrg#
2257054b3d00Smrg# Of course, Automake must honor this variable whenever it calls a
2258054b3d00Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2259054b3d00Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2260054b3d00Smrg# depending on how configure is run.  This is pretty annoying, since
2261054b3d00Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2262054b3d00Smrg# source directory, any form will work fine, but in subdirectories a
2263054b3d00Smrg# relative path needs to be adjusted first.
2264054b3d00Smrg#
2265054b3d00Smrg# $ac_aux_dir/missing
2266054b3d00Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2267054b3d00Smrg# $top_srcdir/$ac_aux_dir/missing
2268054b3d00Smrg#    fails if $ac_aux_dir is absolute,
2269054b3d00Smrg#    fails when called from a subdirectory in a VPATH build with
2270054b3d00Smrg#          a relative $ac_aux_dir
2271054b3d00Smrg#
2272054b3d00Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2273054b3d00Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
2274054b3d00Smrg# harmless because $srcdir is '.', but things will broke when you
2275054b3d00Smrg# start a VPATH build or use an absolute $srcdir.
2276054b3d00Smrg#
2277054b3d00Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2278054b3d00Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2279054b3d00Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2280054b3d00Smrg# and then we would define $MISSING as
2281054b3d00Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2282054b3d00Smrg# This will work as long as MISSING is not called from configure, because
2283054b3d00Smrg# unfortunately $(top_srcdir) has no meaning in configure.
2284054b3d00Smrg# However there are other variables, like CC, which are often used in
2285054b3d00Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286054b3d00Smrg#
2287054b3d00Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
2288054b3d00Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
2289054b3d00Smrg# configured tree to be moved without reconfiguration.
2290054b3d00Smrg
2291054b3d00SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
2292054b3d00Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2293054b3d00Smrg# Expand $ac_aux_dir to an absolute path.
2294054b3d00Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
2295054b3d00Smrg])
2296054b3d00Smrg
2297054b3d00Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2298054b3d00Smrg
2299054b3d00Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2300054b3d00Smrg#
2301054b3d00Smrg# This file is free software; the Free Software Foundation
2302054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2303054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2304054b3d00Smrg
2305054b3d00Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2306054b3d00Smrg# -------------------------------------
2307054b3d00Smrg# Define a conditional.
2308054b3d00SmrgAC_DEFUN([AM_CONDITIONAL],
2309054b3d00Smrg[AC_PREREQ([2.52])dnl
2310054b3d00Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2311054b3d00Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2312054b3d00SmrgAC_SUBST([$1_TRUE])dnl
2313054b3d00SmrgAC_SUBST([$1_FALSE])dnl
2314054b3d00Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2315054b3d00Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2316054b3d00Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2317054b3d00Smrgif $2; then
2318054b3d00Smrg  $1_TRUE=
2319054b3d00Smrg  $1_FALSE='#'
2320054b3d00Smrgelse
2321054b3d00Smrg  $1_TRUE='#'
2322054b3d00Smrg  $1_FALSE=
232355074dd0Smrgfi
2324054b3d00SmrgAC_CONFIG_COMMANDS_PRE(
2325054b3d00Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2326054b3d00Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2327054b3d00SmrgUsually this means the macro was only invoked conditionally.]])
2328054b3d00Smrgfi])])
2329054b3d00Smrg
2330054b3d00Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2331054b3d00Smrg#
2332054b3d00Smrg# This file is free software; the Free Software Foundation
2333054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2334054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2335054b3d00Smrg
2336054b3d00Smrg
2337054b3d00Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2338054b3d00Smrg# written in clear, in which case automake, when reading aclocal.m4,
2339054b3d00Smrg# will think it sees a *use*, and therefore will trigger all it's
2340054b3d00Smrg# C support machinery.  Also note that it means that autoscan, seeing
2341054b3d00Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2342054b3d00Smrg
2343054b3d00Smrg
2344054b3d00Smrg# _AM_DEPENDENCIES(NAME)
2345054b3d00Smrg# ----------------------
2346054b3d00Smrg# See how the compiler implements dependency checking.
2347054b3d00Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2348054b3d00Smrg# We try a few techniques and use that to set a single cache variable.
2349054b3d00Smrg#
2350054b3d00Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2351054b3d00Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2352054b3d00Smrg# dependency, and given that the user is not expected to run this macro,
2353054b3d00Smrg# just rely on AC_PROG_CC.
2354054b3d00SmrgAC_DEFUN([_AM_DEPENDENCIES],
2355054b3d00Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2356054b3d00SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2357054b3d00SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2358054b3d00SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359054b3d00Smrg
2360054b3d00Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2361054b3d00Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2362054b3d00Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2363054b3d00Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2364054b3d00Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2365054b3d00Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2366054b3d00Smrg                    [depcc="$$1"   am_compiler_list=])
2367054b3d00Smrg
2368054b3d00SmrgAC_CACHE_CHECK([dependency style of $depcc],
2369054b3d00Smrg               [am_cv_$1_dependencies_compiler_type],
2370054b3d00Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2371054b3d00Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
2372054b3d00Smrg  # making bogus files that we don't know about and never remove.  For
2373054b3d00Smrg  # instance it was reported that on HP-UX the gcc test will end up
2374054b3d00Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
2375054b3d00Smrg  # in D".
2376054b3d00Smrg  rm -rf conftest.dir
2377054b3d00Smrg  mkdir conftest.dir
2378054b3d00Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2379054b3d00Smrg  # using a relative directory.
2380054b3d00Smrg  cp "$am_depcomp" conftest.dir
2381054b3d00Smrg  cd conftest.dir
2382054b3d00Smrg  # We will build objects and dependencies in a subdirectory because
2383054b3d00Smrg  # it helps to detect inapplicable dependency modes.  For instance
2384054b3d00Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2385054b3d00Smrg  # side effect of compilation, but ICC will put the dependencies in
2386054b3d00Smrg  # the current directory while Tru64 will put them in the object
2387054b3d00Smrg  # directory.
2388054b3d00Smrg  mkdir sub
2389054b3d00Smrg
2390054b3d00Smrg  am_cv_$1_dependencies_compiler_type=none
2391054b3d00Smrg  if test "$am_compiler_list" = ""; then
2392054b3d00Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2393054b3d00Smrg  fi
2394054b3d00Smrg  am__universal=false
2395054b3d00Smrg  m4_case([$1], [CC],
2396054b3d00Smrg    [case " $depcc " in #(
2397054b3d00Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2398054b3d00Smrg     esac],
2399054b3d00Smrg    [CXX],
2400054b3d00Smrg    [case " $depcc " in #(
2401054b3d00Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2402054b3d00Smrg     esac])
2403054b3d00Smrg
2404054b3d00Smrg  for depmode in $am_compiler_list; do
2405054b3d00Smrg    # Setup a source with many dependencies, because some compilers
2406054b3d00Smrg    # like to wrap large dependency lists on column 80 (with \), and
2407054b3d00Smrg    # we should not choose a depcomp mode which is confused by this.
2408054b3d00Smrg    #
2409054b3d00Smrg    # We need to recreate these files for each test, as the compiler may
2410054b3d00Smrg    # overwrite some of them when testing with obscure command lines.
2411054b3d00Smrg    # This happens at least with the AIX C compiler.
2412054b3d00Smrg    : > sub/conftest.c
2413054b3d00Smrg    for i in 1 2 3 4 5 6; do
2414054b3d00Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2415054b3d00Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2416054b3d00Smrg      # Solaris 10 /bin/sh.
2417054b3d00Smrg      echo '/* dummy */' > sub/conftst$i.h
2418054b3d00Smrg    done
2419054b3d00Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2420054b3d00Smrg
2421054b3d00Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2422054b3d00Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2423054b3d00Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2424054b3d00Smrg    # versions had trouble with output in subdirs.
2425054b3d00Smrg    am__obj=sub/conftest.${OBJEXT-o}
2426054b3d00Smrg    am__minus_obj="-o $am__obj"
2427054b3d00Smrg    case $depmode in
2428054b3d00Smrg    gcc)
2429054b3d00Smrg      # This depmode causes a compiler race in universal mode.
2430054b3d00Smrg      test "$am__universal" = false || continue
2431054b3d00Smrg      ;;
2432054b3d00Smrg    nosideeffect)
2433054b3d00Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2434054b3d00Smrg      # only be used when explicitly requested.
2435054b3d00Smrg      if test "x$enable_dependency_tracking" = xyes; then
2436054b3d00Smrg	continue
2437054b3d00Smrg      else
2438054b3d00Smrg	break
2439054b3d00Smrg      fi
2440054b3d00Smrg      ;;
2441054b3d00Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2442054b3d00Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2443054b3d00Smrg      # not run yet.  These depmodes are late enough in the game, and
2444054b3d00Smrg      # so weak that their functioning should not be impacted.
2445054b3d00Smrg      am__obj=conftest.${OBJEXT-o}
2446054b3d00Smrg      am__minus_obj=
2447054b3d00Smrg      ;;
2448054b3d00Smrg    none) break ;;
2449054b3d00Smrg    esac
2450054b3d00Smrg    if depmode=$depmode \
2451054b3d00Smrg       source=sub/conftest.c object=$am__obj \
2452054b3d00Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2453054b3d00Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2454054b3d00Smrg         >/dev/null 2>conftest.err &&
2455054b3d00Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2456054b3d00Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2457054b3d00Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2458054b3d00Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2459054b3d00Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2460054b3d00Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2461054b3d00Smrg      # that says an option was ignored or not supported.
2462054b3d00Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2463054b3d00Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2464054b3d00Smrg      # The diagnosis changed in icc 8.0:
2465054b3d00Smrg      #   icc: Command line remark: option '-MP' not supported
2466054b3d00Smrg      if (grep 'ignoring option' conftest.err ||
2467054b3d00Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2468054b3d00Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2469054b3d00Smrg        break
2470054b3d00Smrg      fi
2471054b3d00Smrg    fi
2472054b3d00Smrg  done
24732ddb6cf1Smrg
2474054b3d00Smrg  cd ..
2475054b3d00Smrg  rm -rf conftest.dir
247655074dd0Smrgelse
2477054b3d00Smrg  am_cv_$1_dependencies_compiler_type=none
2478a1d141d5Smrgfi
2479054b3d00Smrg])
2480054b3d00SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2481054b3d00SmrgAM_CONDITIONAL([am__fastdep$1], [
2482054b3d00Smrg  test "x$enable_dependency_tracking" != xno \
2483054b3d00Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2484054b3d00Smrg])
2485a1d141d5Smrg
2486a1d141d5Smrg
2487054b3d00Smrg# AM_SET_DEPDIR
2488054b3d00Smrg# -------------
2489054b3d00Smrg# Choose a directory name for dependency files.
2490054b3d00Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2491054b3d00SmrgAC_DEFUN([AM_SET_DEPDIR],
2492054b3d00Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2493054b3d00SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2494054b3d00Smrg])
2495054b3d00Smrg
2496054b3d00Smrg
2497054b3d00Smrg# AM_DEP_TRACK
2498054b3d00Smrg# ------------
2499054b3d00SmrgAC_DEFUN([AM_DEP_TRACK],
2500054b3d00Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
2501054b3d00SmrgAS_HELP_STRING(
2502054b3d00Smrg  [--enable-dependency-tracking],
2503054b3d00Smrg  [do not reject slow dependency extractors])
2504054b3d00SmrgAS_HELP_STRING(
2505054b3d00Smrg  [--disable-dependency-tracking],
2506054b3d00Smrg  [speeds up one-time build])])
2507054b3d00Smrgif test "x$enable_dependency_tracking" != xno; then
2508054b3d00Smrg  am_depcomp="$ac_aux_dir/depcomp"
2509054b3d00Smrg  AMDEPBACKSLASH='\'
2510054b3d00Smrg  am__nodep='_no'
2511054b3d00Smrgfi
2512054b3d00SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2513054b3d00SmrgAC_SUBST([AMDEPBACKSLASH])dnl
2514054b3d00Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2515054b3d00SmrgAC_SUBST([am__nodep])dnl
2516054b3d00Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2517054b3d00Smrg])
2518054b3d00Smrg
2519054b3d00Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2520054b3d00Smrg
2521054b3d00Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
252255074dd0Smrg#
2523054b3d00Smrg# This file is free software; the Free Software Foundation
2524054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2525054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2526054b3d00Smrg
2527054b3d00Smrg
2528054b3d00Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2529054b3d00Smrg# ------------------------------
2530054b3d00SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2531054b3d00Smrg[{
2532054b3d00Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
2533054b3d00Smrg  # are listed without --file.  Let's play safe and only enable the eval
2534054b3d00Smrg  # if we detect the quoting.
2535054b3d00Smrg  case $CONFIG_FILES in
2536054b3d00Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
2537054b3d00Smrg  *)   set x $CONFIG_FILES ;;
2538054b3d00Smrg  esac
2539054b3d00Smrg  shift
2540054b3d00Smrg  for mf
2541054b3d00Smrg  do
2542054b3d00Smrg    # Strip MF so we end up with the name of the file.
2543054b3d00Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
2544054b3d00Smrg    # Check whether this is an Automake generated Makefile or not.
2545054b3d00Smrg    # We used to match only the files named 'Makefile.in', but
2546054b3d00Smrg    # some people rename them; so instead we look at the file content.
2547054b3d00Smrg    # Grep'ing the first line is not enough: some people post-process
2548054b3d00Smrg    # each Makefile.in and add a new line on top of each file to say so.
2549054b3d00Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
2550054b3d00Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
2551054b3d00Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2552054b3d00Smrg      dirpart=`AS_DIRNAME("$mf")`
2553054b3d00Smrg    else
2554054b3d00Smrg      continue
2555054b3d00Smrg    fi
2556054b3d00Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
2557054b3d00Smrg    # from the Makefile without running 'make'.
2558054b3d00Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2559054b3d00Smrg    test -z "$DEPDIR" && continue
2560054b3d00Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2561054b3d00Smrg    test -z "$am__include" && continue
2562054b3d00Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2563054b3d00Smrg    # Find all dependency output files, they are included files with
2564054b3d00Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2565054b3d00Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
2566054b3d00Smrg    # expansion.
2567054b3d00Smrg    for file in `sed -n "
2568054b3d00Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2569054b3d00Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2570054b3d00Smrg      # Make sure the directory exists.
2571054b3d00Smrg      test -f "$dirpart/$file" && continue
2572054b3d00Smrg      fdir=`AS_DIRNAME(["$file"])`
2573054b3d00Smrg      AS_MKDIR_P([$dirpart/$fdir])
2574054b3d00Smrg      # echo "creating $dirpart/$file"
2575054b3d00Smrg      echo '# dummy' > "$dirpart/$file"
2576054b3d00Smrg    done
2577054b3d00Smrg  done
2578054b3d00Smrg}
2579054b3d00Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2580054b3d00Smrg
2581054b3d00Smrg
2582054b3d00Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2583054b3d00Smrg# -----------------------------
2584054b3d00Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
258555074dd0Smrg#
2586054b3d00Smrg# This code is only required when automatic dependency tracking
2587054b3d00Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
2588054b3d00Smrg# need in order to bootstrap the dependency handling code.
2589054b3d00SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2590054b3d00Smrg[AC_CONFIG_COMMANDS([depfiles],
2591054b3d00Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2592054b3d00Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2593054b3d00Smrg])
2594054b3d00Smrg
2595054b3d00Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2596054b3d00Smrg
2597054b3d00Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
259855074dd0Smrg#
2599054b3d00Smrg# This file is free software; the Free Software Foundation
2600054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2601054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2602a1d141d5Smrg
2603054b3d00Smrg# This macro actually does too much.  Some checks are only needed if
2604054b3d00Smrg# your package does certain things.  But this isn't really a big deal.
2605a1d141d5Smrg
2606054b3d00Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2607054b3d00Smrgm4_define([AC_PROG_CC],
2608054b3d00Smrgm4_defn([AC_PROG_CC])
2609054b3d00Smrg[_AM_PROG_CC_C_O
2610054b3d00Smrg])
2611a1d141d5Smrg
2612054b3d00Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2613054b3d00Smrg# AM_INIT_AUTOMAKE([OPTIONS])
2614054b3d00Smrg# -----------------------------------------------
2615054b3d00Smrg# The call with PACKAGE and VERSION arguments is the old style
2616054b3d00Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2617054b3d00Smrg# and VERSION should now be passed to AC_INIT and removed from
2618054b3d00Smrg# the call to AM_INIT_AUTOMAKE.
2619054b3d00Smrg# We support both call styles for the transition.  After
2620054b3d00Smrg# the next Automake release, Autoconf can make the AC_INIT
2621054b3d00Smrg# arguments mandatory, and then we can depend on a new Autoconf
2622054b3d00Smrg# release and drop the old call support.
2623054b3d00SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
2624054b3d00Smrg[AC_PREREQ([2.65])dnl
2625054b3d00Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2626054b3d00Smrgdnl the ones we care about.
2627054b3d00Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2628054b3d00SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2629054b3d00SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2630054b3d00Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2631054b3d00Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2632054b3d00Smrg  # is not polluted with repeated "-I."
2633054b3d00Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2634054b3d00Smrg  # test to see if srcdir already configured
2635054b3d00Smrg  if test -f $srcdir/config.status; then
2636054b3d00Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637054b3d00Smrg  fi
2638a1d141d5Smrgfi
2639a1d141d5Smrg
2640054b3d00Smrg# test whether we have cygpath
2641054b3d00Smrgif test -z "$CYGPATH_W"; then
2642054b3d00Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2643054b3d00Smrg    CYGPATH_W='cygpath -w'
2644054b3d00Smrg  else
2645054b3d00Smrg    CYGPATH_W=echo
2646054b3d00Smrg  fi
264755074dd0Smrgfi
2648054b3d00SmrgAC_SUBST([CYGPATH_W])
2649a1d141d5Smrg
2650054b3d00Smrg# Define the identity of the package.
2651054b3d00Smrgdnl Distinguish between old-style and new-style calls.
2652054b3d00Smrgm4_ifval([$2],
2653054b3d00Smrg[AC_DIAGNOSE([obsolete],
2654054b3d00Smrg             [$0: two- and three-arguments forms are deprecated.])
2655054b3d00Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2656054b3d00Smrg AC_SUBST([PACKAGE], [$1])dnl
2657054b3d00Smrg AC_SUBST([VERSION], [$2])],
2658054b3d00Smrg[_AM_SET_OPTIONS([$1])dnl
2659054b3d00Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2660054b3d00Smrgm4_if(
2661054b3d00Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2662054b3d00Smrg  [ok:ok],,
2663054b3d00Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2664054b3d00Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2665054b3d00Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666a1d141d5Smrg
2667054b3d00Smrg_AM_IF_OPTION([no-define],,
2668054b3d00Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2669054b3d00Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670a1d141d5Smrg
2671054b3d00Smrg# Some tools Automake needs.
2672054b3d00SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2673054b3d00SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2674054b3d00SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2675054b3d00SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2676054b3d00SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2677054b3d00SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2678054b3d00SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2679054b3d00SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2680054b3d00SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2681054b3d00SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2682054b3d00Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
2683054b3d00Smrg# dies out for good.  For more background, see:
2684054b3d00Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2685054b3d00Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2686054b3d00SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2687054b3d00Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
2688054b3d00Smrg# system "awk" is bad on some platforms.
2689054b3d00SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2690054b3d00SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2691054b3d00SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2692054b3d00Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2693054b3d00Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2694054b3d00Smrg			     [_AM_PROG_TAR([v7])])])
2695054b3d00Smrg_AM_IF_OPTION([no-dependencies],,
2696054b3d00Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2697054b3d00Smrg		  [_AM_DEPENDENCIES([CC])],
2698054b3d00Smrg		  [m4_define([AC_PROG_CC],
2699054b3d00Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2700054b3d00SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2701054b3d00Smrg		  [_AM_DEPENDENCIES([CXX])],
2702054b3d00Smrg		  [m4_define([AC_PROG_CXX],
2703054b3d00Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2704054b3d00SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2705054b3d00Smrg		  [_AM_DEPENDENCIES([OBJC])],
2706054b3d00Smrg		  [m4_define([AC_PROG_OBJC],
2707054b3d00Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2708054b3d00SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2709054b3d00Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
2710054b3d00Smrg		  [m4_define([AC_PROG_OBJCXX],
2711054b3d00Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2712054b3d00Smrg])
2713054b3d00SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2714054b3d00Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
2715054b3d00Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2716054b3d00Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2717054b3d00SmrgAC_CONFIG_COMMANDS_PRE(dnl
2718054b3d00Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2719054b3d00Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720a1d141d5Smrg
2721054b3d00Smrg# POSIX will say in a future version that running "rm -f" with no argument
2722054b3d00Smrg# is OK; and we want to be able to make that assumption in our Makefile
2723054b3d00Smrg# recipes.  So use an aggressive probe to check that the usage we want is
2724054b3d00Smrg# actually supported "in the wild" to an acceptable degree.
2725054b3d00Smrg# See automake bug#10828.
2726054b3d00Smrg# To make any issue more visible, cause the running configure to be aborted
2727054b3d00Smrg# by default if the 'rm' program in use doesn't match our expectations; the
2728054b3d00Smrg# user can still override this though.
2729054b3d00Smrgif rm -f && rm -fr && rm -rf; then : OK; else
2730054b3d00Smrg  cat >&2 <<'END'
2731054b3d00SmrgOops!
2732054b3d00Smrg
2733054b3d00SmrgYour 'rm' program seems unable to run without file operands specified
2734054b3d00Smrgon the command line, even when the '-f' option is present.  This is contrary
2735054b3d00Smrgto the behaviour of most rm programs out there, and not conforming with
2736054b3d00Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737054b3d00Smrg
2738054b3d00SmrgPlease tell bug-automake@gnu.org about your system, including the value
2739054b3d00Smrgof your $PATH and any error possibly output before this message.  This
2740054b3d00Smrgcan help us improve future automake versions.
2741a1d141d5Smrg
2742054b3d00SmrgEND
2743054b3d00Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2744054b3d00Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2745054b3d00Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2746054b3d00Smrg    echo >&2
2747054b3d00Smrg  else
2748054b3d00Smrg    cat >&2 <<'END'
2749054b3d00SmrgAborting the configuration process, to ensure you take notice of the issue.
2750054b3d00Smrg
2751054b3d00SmrgYou can download and install GNU coreutils to get an 'rm' implementation
2752054b3d00Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753054b3d00Smrg
2754054b3d00SmrgIf you want to complete the configuration process using your problematic
2755054b3d00Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2756054b3d00Smrgto "yes", and re-run configure.
2757054b3d00Smrg
2758054b3d00SmrgEND
2759054b3d00Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2760054b3d00Smrg  fi
276155074dd0Smrgfi
2762054b3d00Smrgdnl The trailing newline in this macro's definition is deliberate, for
2763054b3d00Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
2764054b3d00Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2765054b3d00Smrg])
2766a1d141d5Smrg
2767054b3d00Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2768054b3d00Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2769054b3d00Smrgdnl mangled by Autoconf and run in a shell conditional statement.
2770054b3d00Smrgm4_define([_AC_COMPILER_EXEEXT],
2771054b3d00Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2772a1d141d5Smrg
2773054b3d00Smrg# When config.status generates a header, we must update the stamp-h file.
2774054b3d00Smrg# This file resides in the same directory as the config header
2775054b3d00Smrg# that is generated.  The stamp files are numbered to have different names.
2776a1d141d5Smrg
2777054b3d00Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2778054b3d00Smrg# loop where config.status creates the headers, so we can generate
2779054b3d00Smrg# our stamp files there.
2780054b3d00SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2781054b3d00Smrg[# Compute $1's index in $config_headers.
2782054b3d00Smrg_am_arg=$1
2783054b3d00Smrg_am_stamp_count=1
2784054b3d00Smrgfor _am_header in $config_headers :; do
2785054b3d00Smrg  case $_am_header in
2786054b3d00Smrg    $_am_arg | $_am_arg:* )
2787054b3d00Smrg      break ;;
2788054b3d00Smrg    * )
2789054b3d00Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2790054b3d00Smrg  esac
2791054b3d00Smrgdone
2792054b3d00Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2793054b3d00Smrg
2794054b3d00Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
279555074dd0Smrg#
2796054b3d00Smrg# This file is free software; the Free Software Foundation
2797054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2798054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2799054b3d00Smrg
2800054b3d00Smrg# AM_PROG_INSTALL_SH
2801054b3d00Smrg# ------------------
2802054b3d00Smrg# Define $install_sh.
2803054b3d00SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2804054b3d00Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2805054b3d00Smrgif test x"${install_sh+set}" != xset; then
2806054b3d00Smrg  case $am_aux_dir in
2807054b3d00Smrg  *\ * | *\	*)
2808054b3d00Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2809054b3d00Smrg  *)
2810054b3d00Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2811054b3d00Smrg  esac
281255074dd0Smrgfi
2813054b3d00SmrgAC_SUBST([install_sh])])
2814a1d141d5Smrg
2815054b3d00Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
281655074dd0Smrg#
2817054b3d00Smrg# This file is free software; the Free Software Foundation
2818054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2819054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2820a1d141d5Smrg
2821054b3d00Smrg# Check whether the underlying file-system supports filenames
2822054b3d00Smrg# with a leading dot.  For instance MS-DOS doesn't.
2823054b3d00SmrgAC_DEFUN([AM_SET_LEADING_DOT],
2824054b3d00Smrg[rm -rf .tst 2>/dev/null
2825054b3d00Smrgmkdir .tst 2>/dev/null
2826054b3d00Smrgif test -d .tst; then
2827054b3d00Smrg  am__leading_dot=.
2828054b3d00Smrgelse
2829054b3d00Smrg  am__leading_dot=_
283055074dd0Smrgfi
2831054b3d00Smrgrmdir .tst 2>/dev/null
2832054b3d00SmrgAC_SUBST([am__leading_dot])])
283355074dd0Smrg
2834054b3d00Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835a1d141d5Smrg
2836054b3d00Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
283755074dd0Smrg#
2838054b3d00Smrg# This file is free software; the Free Software Foundation
2839054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2840054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2841a1d141d5Smrg
2842054b3d00Smrg# AM_MAKE_INCLUDE()
2843054b3d00Smrg# -----------------
2844054b3d00Smrg# Check to see how make treats includes.
2845054b3d00SmrgAC_DEFUN([AM_MAKE_INCLUDE],
2846054b3d00Smrg[am_make=${MAKE-make}
2847054b3d00Smrgcat > confinc << 'END'
2848054b3d00Smrgam__doit:
2849054b3d00Smrg	@echo this is the am__doit target
2850054b3d00Smrg.PHONY: am__doit
2851054b3d00SmrgEND
2852054b3d00Smrg# If we don't find an include directive, just comment out the code.
2853054b3d00SmrgAC_MSG_CHECKING([for style of include used by $am_make])
2854054b3d00Smrgam__include="#"
2855054b3d00Smrgam__quote=
2856054b3d00Smrg_am_result=none
2857054b3d00Smrg# First try GNU make style include.
2858054b3d00Smrgecho "include confinc" > confmf
2859054b3d00Smrg# Ignore all kinds of additional output from 'make'.
2860054b3d00Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
2861054b3d00Smrg*the\ am__doit\ target*)
2862054b3d00Smrg  am__include=include
2863054b3d00Smrg  am__quote=
2864054b3d00Smrg  _am_result=GNU
2865054b3d00Smrg  ;;
2866054b3d00Smrgesac
2867054b3d00Smrg# Now try BSD make style include.
2868054b3d00Smrgif test "$am__include" = "#"; then
2869054b3d00Smrg   echo '.include "confinc"' > confmf
2870054b3d00Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
2871054b3d00Smrg   *the\ am__doit\ target*)
2872054b3d00Smrg     am__include=.include
2873054b3d00Smrg     am__quote="\""
2874054b3d00Smrg     _am_result=BSD
2875054b3d00Smrg     ;;
2876054b3d00Smrg   esac
2877054b3d00Smrgfi
2878054b3d00SmrgAC_SUBST([am__include])
2879054b3d00SmrgAC_SUBST([am__quote])
2880054b3d00SmrgAC_MSG_RESULT([$_am_result])
2881054b3d00Smrgrm -f confinc confmf
288255074dd0Smrg])
2883a1d141d5Smrg
2884054b3d00Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885054b3d00Smrg
2886054b3d00Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
288755074dd0Smrg#
2888054b3d00Smrg# This file is free software; the Free Software Foundation
2889054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2890054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2891054b3d00Smrg
2892054b3d00Smrg# AM_MISSING_PROG(NAME, PROGRAM)
2893054b3d00Smrg# ------------------------------
2894054b3d00SmrgAC_DEFUN([AM_MISSING_PROG],
2895054b3d00Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2896054b3d00Smrg$1=${$1-"${am_missing_run}$2"}
2897054b3d00SmrgAC_SUBST($1)])
2898054b3d00Smrg
2899054b3d00Smrg# AM_MISSING_HAS_RUN
2900054b3d00Smrg# ------------------
2901054b3d00Smrg# Define MISSING if not defined so far and test if it is modern enough.
2902054b3d00Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
2903054b3d00SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2904054b3d00Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2905054b3d00SmrgAC_REQUIRE_AUX_FILE([missing])dnl
2906054b3d00Smrgif test x"${MISSING+set}" != xset; then
2907054b3d00Smrg  case $am_aux_dir in
2908054b3d00Smrg  *\ * | *\	*)
2909054b3d00Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2910054b3d00Smrg  *)
2911054b3d00Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2912054b3d00Smrg  esac
2913054b3d00Smrgfi
2914054b3d00Smrg# Use eval to expand $SHELL
2915054b3d00Smrgif eval "$MISSING --is-lightweight"; then
2916054b3d00Smrg  am_missing_run="$MISSING "
2917054b3d00Smrgelse
2918054b3d00Smrg  am_missing_run=
2919054b3d00Smrg  AC_MSG_WARN(['missing' script is too old or missing])
2920054b3d00Smrgfi
2921054b3d00Smrg])
2922a1d141d5Smrg
2923054b3d00Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2924054b3d00Smrg
2925054b3d00Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292655074dd0Smrg#
2927054b3d00Smrg# This file is free software; the Free Software Foundation
2928054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2929054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2930054b3d00Smrg
2931054b3d00Smrg# _AM_MANGLE_OPTION(NAME)
2932054b3d00Smrg# -----------------------
2933054b3d00SmrgAC_DEFUN([_AM_MANGLE_OPTION],
2934054b3d00Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935054b3d00Smrg
2936054b3d00Smrg# _AM_SET_OPTION(NAME)
2937054b3d00Smrg# --------------------
2938054b3d00Smrg# Set option NAME.  Presently that only means defining a flag for this option.
2939054b3d00SmrgAC_DEFUN([_AM_SET_OPTION],
2940054b3d00Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941054b3d00Smrg
2942054b3d00Smrg# _AM_SET_OPTIONS(OPTIONS)
2943054b3d00Smrg# ------------------------
2944054b3d00Smrg# OPTIONS is a space-separated list of Automake options.
2945054b3d00SmrgAC_DEFUN([_AM_SET_OPTIONS],
2946054b3d00Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947054b3d00Smrg
2948054b3d00Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2949054b3d00Smrg# -------------------------------------------
2950054b3d00Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2951054b3d00SmrgAC_DEFUN([_AM_IF_OPTION],
2952054b3d00Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953054b3d00Smrg
2954054b3d00Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
295555074dd0Smrg#
2956054b3d00Smrg# This file is free software; the Free Software Foundation
2957054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
2958054b3d00Smrg# with or without modifications, as long as this notice is preserved.
2959a1d141d5Smrg
2960054b3d00Smrg# _AM_PROG_CC_C_O
2961054b3d00Smrg# ---------------
2962054b3d00Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
2963054b3d00Smrg# to automatically call this.
2964054b3d00SmrgAC_DEFUN([_AM_PROG_CC_C_O],
2965054b3d00Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2966054b3d00SmrgAC_REQUIRE_AUX_FILE([compile])dnl
2967054b3d00SmrgAC_LANG_PUSH([C])dnl
2968054b3d00SmrgAC_CACHE_CHECK(
2969054b3d00Smrg  [whether $CC understands -c and -o together],
2970054b3d00Smrg  [am_cv_prog_cc_c_o],
2971054b3d00Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
2972054b3d00Smrg  # Make sure it works both with $CC and with simple cc.
2973054b3d00Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
2974054b3d00Smrg  # compilers refuse to overwrite an existing .o file with -o,
2975054b3d00Smrg  # though they will create one.
2976054b3d00Smrg  am_cv_prog_cc_c_o=yes
2977054b3d00Smrg  for am_i in 1 2; do
2978054b3d00Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
2979054b3d00Smrg         && test -f conftest2.$ac_objext; then
2980054b3d00Smrg      : OK
2981054b3d00Smrg    else
2982054b3d00Smrg      am_cv_prog_cc_c_o=no
2983054b3d00Smrg      break
2984054b3d00Smrg    fi
2985054b3d00Smrg  done
2986054b3d00Smrg  rm -f core conftest*
2987054b3d00Smrg  unset am_i])
2988054b3d00Smrgif test "$am_cv_prog_cc_c_o" != yes; then
2989054b3d00Smrg   # Losing compiler, so override with the script.
2990054b3d00Smrg   # FIXME: It is wrong to rewrite CC.
2991054b3d00Smrg   # But if we don't then we get into trouble of one sort or another.
2992054b3d00Smrg   # A longer-term fix would be to have automake use am__CC in this case,
2993054b3d00Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
2994054b3d00Smrg   CC="$am_aux_dir/compile $CC"
29952ddb6cf1Smrgfi
2996054b3d00SmrgAC_LANG_POP([C])])
2997a1d141d5Smrg
2998054b3d00Smrg# For backward compatibility.
2999054b3d00SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3000054b3d00Smrg
3001054b3d00Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
300255074dd0Smrg#
3003054b3d00Smrg# This file is free software; the Free Software Foundation
3004054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
3005054b3d00Smrg# with or without modifications, as long as this notice is preserved.
30062ddb6cf1Smrg
3007054b3d00Smrg# AM_RUN_LOG(COMMAND)
3008054b3d00Smrg# -------------------
3009054b3d00Smrg# Run COMMAND, save the exit status in ac_status, and log it.
3010054b3d00Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3011054b3d00SmrgAC_DEFUN([AM_RUN_LOG],
3012054b3d00Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3013054b3d00Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3014054b3d00Smrg   ac_status=$?
3015054b3d00Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3016054b3d00Smrg   (exit $ac_status); }])
30172ddb6cf1Smrg
3018054b3d00Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30192ddb6cf1Smrg
3020054b3d00Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
3021054b3d00Smrg#
3022054b3d00Smrg# This file is free software; the Free Software Foundation
3023054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
3024054b3d00Smrg# with or without modifications, as long as this notice is preserved.
3025a1d141d5Smrg
3026054b3d00Smrg# AM_SANITY_CHECK
3027054b3d00Smrg# ---------------
3028054b3d00SmrgAC_DEFUN([AM_SANITY_CHECK],
3029054b3d00Smrg[AC_MSG_CHECKING([whether build environment is sane])
3030054b3d00Smrg# Reject unsafe characters in $srcdir or the absolute working directory
3031054b3d00Smrg# name.  Accept space and tab only in the latter.
3032054b3d00Smrgam_lf='
3033054b3d00Smrg'
3034054b3d00Smrgcase `pwd` in
3035054b3d00Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
3036054b3d00Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
3037054b3d00Smrgesac
3038054b3d00Smrgcase $srcdir in
3039054b3d00Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3040054b3d00Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3041054b3d00Smrgesac
3042a1d141d5Smrg
3043054b3d00Smrg# Do 'set' in a subshell so we don't clobber the current shell's
3044054b3d00Smrg# arguments.  Must try -L first in case configure is actually a
3045054b3d00Smrg# symlink; some systems play weird games with the mod time of symlinks
3046054b3d00Smrg# (eg FreeBSD returns the mod time of the symlink's containing
3047054b3d00Smrg# directory).
3048054b3d00Smrgif (
3049054b3d00Smrg   am_has_slept=no
3050054b3d00Smrg   for am_try in 1 2; do
3051054b3d00Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
3052054b3d00Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3053054b3d00Smrg     if test "$[*]" = "X"; then
3054054b3d00Smrg	# -L didn't work.
3055054b3d00Smrg	set X `ls -t "$srcdir/configure" conftest.file`
3056054b3d00Smrg     fi
3057054b3d00Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
3058054b3d00Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059054b3d00Smrg
3060054b3d00Smrg	# If neither matched, then we have a broken ls.  This can happen
3061054b3d00Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
3062054b3d00Smrg	# broken ls alias from the environment.  This has actually
3063054b3d00Smrg	# happened.  Such a system could not be considered "sane".
3064054b3d00Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3065054b3d00Smrg  alias in your environment])
3066054b3d00Smrg     fi
3067054b3d00Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3068054b3d00Smrg       break
3069054b3d00Smrg     fi
3070054b3d00Smrg     # Just in case.
3071054b3d00Smrg     sleep 1
3072054b3d00Smrg     am_has_slept=yes
3073054b3d00Smrg   done
3074054b3d00Smrg   test "$[2]" = conftest.file
3075054b3d00Smrg   )
3076054b3d00Smrgthen
3077054b3d00Smrg   # Ok.
3078054b3d00Smrg   :
3079054b3d00Smrgelse
3080054b3d00Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
3081054b3d00SmrgCheck your system clock])
3082054b3d00Smrgfi
3083054b3d00SmrgAC_MSG_RESULT([yes])
3084054b3d00Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
3085054b3d00Smrg# generated files are strictly newer.
3086054b3d00Smrgam_sleep_pid=
3087054b3d00Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
3088054b3d00Smrg  ( sleep 1 ) &
3089054b3d00Smrg  am_sleep_pid=$!
3090054b3d00Smrgfi
3091054b3d00SmrgAC_CONFIG_COMMANDS_PRE(
3092054b3d00Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
3093054b3d00Smrg   if test -n "$am_sleep_pid"; then
3094054b3d00Smrg     # Hide warnings about reused PIDs.
3095054b3d00Smrg     wait $am_sleep_pid 2>/dev/null
3096054b3d00Smrg   fi
3097054b3d00Smrg   AC_MSG_RESULT([done])])
3098054b3d00Smrgrm -f conftest.file
3099054b3d00Smrg])
3100054b3d00Smrg
3101054b3d00Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
310255074dd0Smrg#
3103054b3d00Smrg# This file is free software; the Free Software Foundation
3104054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
3105054b3d00Smrg# with or without modifications, as long as this notice is preserved.
3106054b3d00Smrg
3107054b3d00Smrg# AM_SILENT_RULES([DEFAULT])
3108054b3d00Smrg# --------------------------
3109054b3d00Smrg# Enable less verbose build rules; with the default set to DEFAULT
3110054b3d00Smrg# ("yes" being less verbose, "no" or empty being verbose).
3111054b3d00SmrgAC_DEFUN([AM_SILENT_RULES],
3112054b3d00Smrg[AC_ARG_ENABLE([silent-rules], [dnl
3113054b3d00SmrgAS_HELP_STRING(
3114054b3d00Smrg  [--enable-silent-rules],
3115054b3d00Smrg  [less verbose build output (undo: "make V=1")])
3116054b3d00SmrgAS_HELP_STRING(
3117054b3d00Smrg  [--disable-silent-rules],
3118054b3d00Smrg  [verbose build output (undo: "make V=0")])dnl
3119054b3d00Smrg])
3120054b3d00Smrgcase $enable_silent_rules in @%:@ (((
3121054b3d00Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
3122054b3d00Smrg   no) AM_DEFAULT_VERBOSITY=1;;
3123054b3d00Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3124054b3d00Smrgesac
3125054b3d00Smrgdnl
3126054b3d00Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3127054b3d00Smrgdnl do not support nested variable expansions.
3128054b3d00Smrgdnl See automake bug#9928 and bug#10237.
3129054b3d00Smrgam_make=${MAKE-make}
3130054b3d00SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
3131054b3d00Smrg   [am_cv_make_support_nested_variables],
3132054b3d00Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
3133054b3d00SmrgBAR0=false
3134054b3d00SmrgBAR1=true
3135054b3d00SmrgV=1
3136054b3d00Smrgam__doit:
3137054b3d00Smrg	@$(TRUE)
3138054b3d00Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3139054b3d00Smrg  am_cv_make_support_nested_variables=yes
3140054b3d00Smrgelse
3141054b3d00Smrg  am_cv_make_support_nested_variables=no
3142054b3d00Smrgfi])
3143054b3d00Smrgif test $am_cv_make_support_nested_variables = yes; then
3144054b3d00Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3145054b3d00Smrg  AM_V='$(V)'
3146054b3d00Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3147054b3d00Smrgelse
3148054b3d00Smrg  AM_V=$AM_DEFAULT_VERBOSITY
3149054b3d00Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3150054b3d00Smrgfi
3151054b3d00SmrgAC_SUBST([AM_V])dnl
3152054b3d00SmrgAM_SUBST_NOTMAKE([AM_V])dnl
3153054b3d00SmrgAC_SUBST([AM_DEFAULT_V])dnl
3154054b3d00SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3155054b3d00SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3156054b3d00SmrgAM_BACKSLASH='\'
3157054b3d00SmrgAC_SUBST([AM_BACKSLASH])dnl
3158054b3d00Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3159054b3d00Smrg])
3160054b3d00Smrg
3161054b3d00Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
316255074dd0Smrg#
3163054b3d00Smrg# This file is free software; the Free Software Foundation
3164054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
3165054b3d00Smrg# with or without modifications, as long as this notice is preserved.
3166054b3d00Smrg
3167054b3d00Smrg# AM_PROG_INSTALL_STRIP
3168054b3d00Smrg# ---------------------
3169054b3d00Smrg# One issue with vendor 'install' (even GNU) is that you can't
3170054b3d00Smrg# specify the program used to strip binaries.  This is especially
3171054b3d00Smrg# annoying in cross-compiling environments, where the build's strip
3172054b3d00Smrg# is unlikely to handle the host's binaries.
3173054b3d00Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
3174054b3d00Smrg# always use install-sh in "make install-strip", and initialize
3175054b3d00Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
3176054b3d00SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3177054b3d00Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3178054b3d00Smrg# Installed binaries are usually stripped using 'strip' when the user
3179054b3d00Smrg# run "make install-strip".  However 'strip' might not be the right
3180054b3d00Smrg# tool to use in cross-compilation environments, therefore Automake
3181054b3d00Smrg# will honor the 'STRIP' environment variable to overrule this program.
3182054b3d00Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3183054b3d00Smrgif test "$cross_compiling" != no; then
3184054b3d00Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
3185054b3d00Smrgfi
3186054b3d00SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3187054b3d00SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188054b3d00Smrg
3189054b3d00Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
319055074dd0Smrg#
3191054b3d00Smrg# This file is free software; the Free Software Foundation
3192054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
3193054b3d00Smrg# with or without modifications, as long as this notice is preserved.
3194a1d141d5Smrg
3195054b3d00Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
3196054b3d00Smrg# ---------------------------
3197054b3d00Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3198054b3d00Smrg# This macro is traced by Automake.
3199054b3d00SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200a1d141d5Smrg
3201054b3d00Smrg# AM_SUBST_NOTMAKE(VARIABLE)
3202054b3d00Smrg# --------------------------
3203054b3d00Smrg# Public sister of _AM_SUBST_NOTMAKE.
3204054b3d00SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205a1d141d5Smrg
3206054b3d00Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3207a1d141d5Smrg
3208054b3d00Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
3209054b3d00Smrg#
3210054b3d00Smrg# This file is free software; the Free Software Foundation
3211054b3d00Smrg# gives unlimited permission to copy and/or distribute it,
3212054b3d00Smrg# with or without modifications, as long as this notice is preserved.
3213a1d141d5Smrg
3214054b3d00Smrg# _AM_PROG_TAR(FORMAT)
3215054b3d00Smrg# --------------------
3216054b3d00Smrg# Check how to create a tarball in format FORMAT.
3217054b3d00Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218054b3d00Smrg#
3219054b3d00Smrg# Substitute a variable $(am__tar) that is a command
3220054b3d00Smrg# writing to stdout a FORMAT-tarball containing the directory
3221054b3d00Smrg# $tardir.
3222054b3d00Smrg#     tardir=directory && $(am__tar) > result.tar
3223054b3d00Smrg#
3224054b3d00Smrg# Substitute a variable $(am__untar) that extract such
3225054b3d00Smrg# a tarball read from stdin.
3226054b3d00Smrg#     $(am__untar) < result.tar
3227054b3d00Smrg#
3228054b3d00SmrgAC_DEFUN([_AM_PROG_TAR],
3229054b3d00Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
3230054b3d00Smrg# in the wild :-(  We should find a proper way to deprecate it ...
3231054b3d00SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32322ddb6cf1Smrg
3233054b3d00Smrg# We'll loop over all known methods to create a tar archive until one works.
3234054b3d00Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32352ddb6cf1Smrg
3236054b3d00Smrgm4_if([$1], [v7],
3237054b3d00Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3238054b3d00Smrg
3239054b3d00Smrg  [m4_case([$1],
3240054b3d00Smrg    [ustar],
3241054b3d00Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3242054b3d00Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3243054b3d00Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3244054b3d00Smrg      # and bug#13588).
3245054b3d00Smrg      am_max_uid=2097151 # 2^21 - 1
3246054b3d00Smrg      am_max_gid=$am_max_uid
3247054b3d00Smrg      # The $UID and $GID variables are not portable, so we need to resort
3248054b3d00Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3249054b3d00Smrg      # below are definitely unexpected, so allow the users to see them
3250054b3d00Smrg      # (that is, avoid stderr redirection).
3251054b3d00Smrg      am_uid=`id -u || echo unknown`
3252054b3d00Smrg      am_gid=`id -g || echo unknown`
3253054b3d00Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3254054b3d00Smrg      if test $am_uid -le $am_max_uid; then
3255054b3d00Smrg         AC_MSG_RESULT([yes])
3256054b3d00Smrg      else
3257054b3d00Smrg         AC_MSG_RESULT([no])
3258054b3d00Smrg         _am_tools=none
3259054b3d00Smrg      fi
3260054b3d00Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3261054b3d00Smrg      if test $am_gid -le $am_max_gid; then
3262054b3d00Smrg         AC_MSG_RESULT([yes])
3263054b3d00Smrg      else
3264054b3d00Smrg        AC_MSG_RESULT([no])
3265054b3d00Smrg        _am_tools=none
3266054b3d00Smrg      fi],
3267054b3d00Smrg
3268054b3d00Smrg  [pax],
3269054b3d00Smrg    [],
3270054b3d00Smrg
3271054b3d00Smrg  [m4_fatal([Unknown tar format])])
3272054b3d00Smrg
3273054b3d00Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3274054b3d00Smrg
3275054b3d00Smrg  # Go ahead even if we have the value already cached.  We do so because we
3276054b3d00Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
3277054b3d00Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3278054b3d00Smrg
3279054b3d00Smrg  for _am_tool in $_am_tools; do
3280054b3d00Smrg    case $_am_tool in
3281054b3d00Smrg    gnutar)
3282054b3d00Smrg      for _am_tar in tar gnutar gtar; do
3283054b3d00Smrg        AM_RUN_LOG([$_am_tar --version]) && break
3284054b3d00Smrg      done
3285054b3d00Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3286054b3d00Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3287054b3d00Smrg      am__untar="$_am_tar -xf -"
3288054b3d00Smrg      ;;
3289054b3d00Smrg    plaintar)
3290054b3d00Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
3291054b3d00Smrg      # ustar tarball either.
3292054b3d00Smrg      (tar --version) >/dev/null 2>&1 && continue
3293054b3d00Smrg      am__tar='tar chf - "$$tardir"'
3294054b3d00Smrg      am__tar_='tar chf - "$tardir"'
3295054b3d00Smrg      am__untar='tar xf -'
3296054b3d00Smrg      ;;
3297054b3d00Smrg    pax)
3298054b3d00Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
3299054b3d00Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
3300054b3d00Smrg      am__untar='pax -r'
3301054b3d00Smrg      ;;
3302054b3d00Smrg    cpio)
3303054b3d00Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3304054b3d00Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3305054b3d00Smrg      am__untar='cpio -i -H $1 -d'
3306054b3d00Smrg      ;;
3307054b3d00Smrg    none)
3308054b3d00Smrg      am__tar=false
3309054b3d00Smrg      am__tar_=false
3310054b3d00Smrg      am__untar=false
3311054b3d00Smrg      ;;
3312054b3d00Smrg    esac
3313a1d141d5Smrg
3314054b3d00Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
3315054b3d00Smrg    # and am__untar set.
3316054b3d00Smrg    test -n "${am_cv_prog_tar_$1}" && break
3317054b3d00Smrg
3318054b3d00Smrg    # tar/untar a dummy directory, and stop if the command works.
3319054b3d00Smrg    rm -rf conftest.dir
3320054b3d00Smrg    mkdir conftest.dir
3321054b3d00Smrg    echo GrepMe > conftest.dir/file
3322054b3d00Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3323054b3d00Smrg    rm -rf conftest.dir
3324054b3d00Smrg    if test -s conftest.tar; then
3325054b3d00Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
3326054b3d00Smrg      AM_RUN_LOG([cat conftest.dir/file])
3327054b3d00Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3328054b3d00Smrg    fi
3329054b3d00Smrg  done
3330054b3d00Smrg  rm -rf conftest.dir
3331a1d141d5Smrg
3332054b3d00Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3333054b3d00Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3334a1d141d5Smrg
3335054b3d00SmrgAC_SUBST([am__tar])
3336054b3d00SmrgAC_SUBST([am__untar])
3337054b3d00Smrg]) # _AM_PROG_TAR
3338a1d141d5Smrg
3339