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