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