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