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