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