aclocal.m4 revision 05cf1079
105cf1079Smrg# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
2f29dbc25Smrg
305cf1079Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
4f29dbc25Smrg
504007ebaSmrg# This file is free software; the Free Software Foundation
604007ebaSmrg# gives unlimited permission to copy and/or distribute it,
704007ebaSmrg# with or without modifications, as long as this notice is preserved.
8f29dbc25Smrg
904007ebaSmrg# This program is distributed in the hope that it will be useful,
1004007ebaSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1104007ebaSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1204007ebaSmrg# PARTICULAR PURPOSE.
13f29dbc25Smrg
1404007ebaSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1504007ebaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1604007ebaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1704007ebaSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1804007ebaSmrg[m4_warning([this file was generated for autoconf 2.69.
1904007ebaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2004007ebaSmrgIf you have problems, you may need to regenerate the build system entirely.
2104007ebaSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22f29dbc25Smrg
2305cf1079Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2405cf1079Smrgdnl serial 11 (pkg-config-0.29)
2505cf1079Smrgdnl
2605cf1079Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2705cf1079Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2805cf1079Smrgdnl
2905cf1079Smrgdnl This program is free software; you can redistribute it and/or modify
3005cf1079Smrgdnl it under the terms of the GNU General Public License as published by
3105cf1079Smrgdnl the Free Software Foundation; either version 2 of the License, or
3205cf1079Smrgdnl (at your option) any later version.
3305cf1079Smrgdnl
3405cf1079Smrgdnl This program is distributed in the hope that it will be useful, but
3505cf1079Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3605cf1079Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3705cf1079Smrgdnl General Public License for more details.
3805cf1079Smrgdnl
3905cf1079Smrgdnl You should have received a copy of the GNU General Public License
4005cf1079Smrgdnl along with this program; if not, write to the Free Software
4105cf1079Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4205cf1079Smrgdnl 02111-1307, USA.
4305cf1079Smrgdnl
4405cf1079Smrgdnl As a special exception to the GNU General Public License, if you
4505cf1079Smrgdnl distribute this file as part of a program that contains a
4605cf1079Smrgdnl configuration script generated by Autoconf, you may include it under
4705cf1079Smrgdnl the same distribution terms that you use for the rest of that
4805cf1079Smrgdnl program.
4905cf1079Smrg
5005cf1079Smrgdnl PKG_PREREQ(MIN-VERSION)
5105cf1079Smrgdnl -----------------------
5205cf1079Smrgdnl Since: 0.29
5305cf1079Smrgdnl
5405cf1079Smrgdnl Verify that the version of the pkg-config macros are at least
5505cf1079Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5605cf1079Smrgdnl installed version of pkg-config, this checks the developer's version
5705cf1079Smrgdnl of pkg.m4 when generating configure.
5805cf1079Smrgdnl
5905cf1079Smrgdnl To ensure that this macro is defined, also add:
6005cf1079Smrgdnl m4_ifndef([PKG_PREREQ],
6105cf1079Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6205cf1079Smrgdnl
6305cf1079Smrgdnl See the "Since" comment for each macro you use to see what version
6405cf1079Smrgdnl of the macros you require.
6505cf1079Smrgm4_defun([PKG_PREREQ],
6605cf1079Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
6705cf1079Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6805cf1079Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6905cf1079Smrg])dnl PKG_PREREQ
7005cf1079Smrg
7105cf1079Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7205cf1079Smrgdnl ----------------------------------
7305cf1079Smrgdnl Since: 0.16
7405cf1079Smrgdnl
7505cf1079Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7605cf1079Smrgdnl first found in the path. Checks that the version of pkg-config found
7705cf1079Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7805cf1079Smrgdnl used since that's the first version where most current features of
7905cf1079Smrgdnl pkg-config existed.
80f29dbc25SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
81f29dbc25Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8204007ebaSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8304007ebaSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
84170d5fdcSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
85170d5fdcSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
86170d5fdcSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87170d5fdcSmrg
88f29dbc25Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
89f29dbc25Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
90f29dbc25Smrgfi
91f29dbc25Smrgif test -n "$PKG_CONFIG"; then
92f29dbc25Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
93f29dbc25Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
94f29dbc25Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
95f29dbc25Smrg		AC_MSG_RESULT([yes])
96f29dbc25Smrg	else
97f29dbc25Smrg		AC_MSG_RESULT([no])
98f29dbc25Smrg		PKG_CONFIG=""
99f29dbc25Smrg	fi
100f29dbc25Smrgfi[]dnl
10105cf1079Smrg])dnl PKG_PROG_PKG_CONFIG
102f29dbc25Smrg
10305cf1079Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10405cf1079Smrgdnl -------------------------------------------------------------------
10505cf1079Smrgdnl Since: 0.18
10605cf1079Smrgdnl
10705cf1079Smrgdnl Check to see whether a particular set of modules exists. Similar to
10805cf1079Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10905cf1079Smrgdnl
11005cf1079Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11105cf1079Smrgdnl only at the first occurence in configure.ac, so if the first place
11205cf1079Smrgdnl it's called might be skipped (such as if it is within an "if", you
11305cf1079Smrgdnl have to call PKG_CHECK_EXISTS manually
114f29dbc25SmrgAC_DEFUN([PKG_CHECK_EXISTS],
115f29dbc25Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
116f29dbc25Smrgif test -n "$PKG_CONFIG" && \
117f29dbc25Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
118170d5fdcSmrg  m4_default([$2], [:])
119f29dbc25Smrgm4_ifvaln([$3], [else
120f29dbc25Smrg  $3])dnl
121f29dbc25Smrgfi])
122f29dbc25Smrg
12305cf1079Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12405cf1079Smrgdnl ---------------------------------------------
12505cf1079Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12605cf1079Smrgdnl pkg_failed based on the result.
127f29dbc25Smrgm4_define([_PKG_CONFIG],
128170d5fdcSmrg[if test -n "$$1"; then
129170d5fdcSmrg    pkg_cv_[]$1="$$1"
130170d5fdcSmrg elif test -n "$PKG_CONFIG"; then
131170d5fdcSmrg    PKG_CHECK_EXISTS([$3],
13204007ebaSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13304007ebaSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
134170d5fdcSmrg		     [pkg_failed=yes])
135170d5fdcSmrg else
136170d5fdcSmrg    pkg_failed=untried
137f29dbc25Smrgfi[]dnl
13805cf1079Smrg])dnl _PKG_CONFIG
139f29dbc25Smrg
14005cf1079Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14105cf1079Smrgdnl ---------------------------
14205cf1079Smrgdnl Internal check to see if pkg-config supports short errors.
143f29dbc25SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
144f29dbc25Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
145f29dbc25Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
146f29dbc25Smrg        _pkg_short_errors_supported=yes
147f29dbc25Smrgelse
148f29dbc25Smrg        _pkg_short_errors_supported=no
149f29dbc25Smrgfi[]dnl
15005cf1079Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151f29dbc25Smrg
152f29dbc25Smrg
15305cf1079Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15405cf1079Smrgdnl   [ACTION-IF-NOT-FOUND])
15505cf1079Smrgdnl --------------------------------------------------------------
15605cf1079Smrgdnl Since: 0.4.0
15705cf1079Smrgdnl
15805cf1079Smrgdnl Note that if there is a possibility the first call to
15905cf1079Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16005cf1079Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
161f29dbc25SmrgAC_DEFUN([PKG_CHECK_MODULES],
162f29dbc25Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
163f29dbc25SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
164f29dbc25SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165f29dbc25Smrg
166f29dbc25Smrgpkg_failed=no
167f29dbc25SmrgAC_MSG_CHECKING([for $1])
168f29dbc25Smrg
169f29dbc25Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
170f29dbc25Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171f29dbc25Smrg
172f29dbc25Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
173f29dbc25Smrgand $1[]_LIBS to avoid the need to call pkg-config.
174f29dbc25SmrgSee the pkg-config man page for more details.])
175f29dbc25Smrg
176f29dbc25Smrgif test $pkg_failed = yes; then
177170d5fdcSmrg   	AC_MSG_RESULT([no])
178f29dbc25Smrg        _PKG_SHORT_ERRORS_SUPPORTED
179f29dbc25Smrg        if test $_pkg_short_errors_supported = yes; then
18004007ebaSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
181f29dbc25Smrg        else 
18204007ebaSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
183f29dbc25Smrg        fi
184f29dbc25Smrg	# Put the nasty error message in config.log where it belongs
185f29dbc25Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186f29dbc25Smrg
187170d5fdcSmrg	m4_default([$4], [AC_MSG_ERROR(
188f29dbc25Smrg[Package requirements ($2) were not met:
189f29dbc25Smrg
190f29dbc25Smrg$$1_PKG_ERRORS
191f29dbc25Smrg
192f29dbc25SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
193f29dbc25Smrginstalled software in a non-standard prefix.
194f29dbc25Smrg
195170d5fdcSmrg_PKG_TEXT])[]dnl
196170d5fdcSmrg        ])
197f29dbc25Smrgelif test $pkg_failed = untried; then
198170d5fdcSmrg     	AC_MSG_RESULT([no])
199170d5fdcSmrg	m4_default([$4], [AC_MSG_FAILURE(
200f29dbc25Smrg[The pkg-config script could not be found or is too old.  Make sure it
201f29dbc25Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
202f29dbc25Smrgpath to pkg-config.
203f29dbc25Smrg
204f29dbc25Smrg_PKG_TEXT
205f29dbc25Smrg
206170d5fdcSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
207170d5fdcSmrg        ])
208f29dbc25Smrgelse
209f29dbc25Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
210f29dbc25Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
211f29dbc25Smrg        AC_MSG_RESULT([yes])
212170d5fdcSmrg	$3
213f29dbc25Smrgfi[]dnl
21405cf1079Smrg])dnl PKG_CHECK_MODULES
21505cf1079Smrg
21605cf1079Smrg
21705cf1079Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21805cf1079Smrgdnl   [ACTION-IF-NOT-FOUND])
21905cf1079Smrgdnl ---------------------------------------------------------------------
22005cf1079Smrgdnl Since: 0.29
22105cf1079Smrgdnl
22205cf1079Smrgdnl Checks for existence of MODULES and gathers its build flags with
22305cf1079Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22405cf1079Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22505cf1079Smrgdnl
22605cf1079Smrgdnl Note that if there is a possibility the first call to
22705cf1079Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22805cf1079Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22905cf1079Smrgdnl configure.ac.
23005cf1079SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23105cf1079Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23205cf1079Smrg_save_PKG_CONFIG=$PKG_CONFIG
23305cf1079SmrgPKG_CONFIG="$PKG_CONFIG --static"
23405cf1079SmrgPKG_CHECK_MODULES($@)
23505cf1079SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23605cf1079Smrg])dnl PKG_CHECK_MODULES_STATIC
237f29dbc25Smrg
2387f419768Smrg
23905cf1079Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24005cf1079Smrgdnl -------------------------
24105cf1079Smrgdnl Since: 0.27
24205cf1079Smrgdnl
24305cf1079Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
24405cf1079Smrgdnl should install pkg-config .pc files. By default the directory is
24505cf1079Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
24605cf1079Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24705cf1079Smrgdnl parameter.
2487f419768SmrgAC_DEFUN([PKG_INSTALLDIR],
2497f419768Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2507f419768Smrgm4_pushdef([pkg_description],
2517f419768Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2527f419768SmrgAC_ARG_WITH([pkgconfigdir],
2537f419768Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2547f419768Smrg    [with_pkgconfigdir=]pkg_default)
2557f419768SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2567f419768Smrgm4_popdef([pkg_default])
2577f419768Smrgm4_popdef([pkg_description])
25805cf1079Smrg])dnl PKG_INSTALLDIR
2597f419768Smrg
2607f419768Smrg
26105cf1079Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26205cf1079Smrgdnl --------------------------------
26305cf1079Smrgdnl Since: 0.27
26405cf1079Smrgdnl
26505cf1079Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26605cf1079Smrgdnl module should install arch-independent pkg-config .pc files. By
26705cf1079Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
26805cf1079Smrgdnl changed by passing DIRECTORY. The user can override through the
26905cf1079Smrgdnl --with-noarch-pkgconfigdir parameter.
2707f419768SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2717f419768Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2727f419768Smrgm4_pushdef([pkg_description],
2737f419768Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2747f419768SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2757f419768Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2767f419768Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2777f419768SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2787f419768Smrgm4_popdef([pkg_default])
2797f419768Smrgm4_popdef([pkg_description])
28005cf1079Smrg])dnl PKG_NOARCH_INSTALLDIR
2817f419768Smrg
2827f419768Smrg
28305cf1079Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28405cf1079Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28505cf1079Smrgdnl -------------------------------------------
28605cf1079Smrgdnl Since: 0.28
28705cf1079Smrgdnl
28805cf1079Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2897f419768SmrgAC_DEFUN([PKG_CHECK_VAR],
2907f419768Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2917f419768SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2927f419768Smrg
2937f419768Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2947f419768SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2957f419768Smrg
2967f419768SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29705cf1079Smrg])dnl PKG_CHECK_VAR
2987f419768Smrg
299f29dbc25Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
300f29dbc25Smrgdnl
301170d5fdcSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
30204007ebaSmrgdnl
303f29dbc25Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
304f29dbc25Smrgdnl copy of this software and associated documentation files (the "Software"),
305f29dbc25Smrgdnl to deal in the Software without restriction, including without limitation
306f29dbc25Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
307f29dbc25Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
308f29dbc25Smrgdnl Software is furnished to do so, subject to the following conditions:
309f29dbc25Smrgdnl
310f29dbc25Smrgdnl The above copyright notice and this permission notice (including the next
311f29dbc25Smrgdnl paragraph) shall be included in all copies or substantial portions of the
312f29dbc25Smrgdnl Software.
313f29dbc25Smrgdnl
314f29dbc25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
315f29dbc25Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
316f29dbc25Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
317f29dbc25Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
318f29dbc25Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
319f29dbc25Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
320f29dbc25Smrgdnl DEALINGS IN THE SOFTWARE.
321f29dbc25Smrg
322f29dbc25Smrg# XORG_MACROS_VERSION(required-version)
323f29dbc25Smrg# -------------------------------------
324f29dbc25Smrg# Minimum version: 1.1.0
325f29dbc25Smrg#
326f29dbc25Smrg# If you're using a macro added in Version 1.1 or newer, include this in
327f29dbc25Smrg# your configure.ac with the minimum required version, such as:
328f29dbc25Smrg# XORG_MACROS_VERSION(1.1)
329f29dbc25Smrg#
330f29dbc25Smrg# To ensure that this macro is defined, also add:
331f29dbc25Smrg# m4_ifndef([XORG_MACROS_VERSION],
332f29dbc25Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
333f29dbc25Smrg#
334f29dbc25Smrg#
33504007ebaSmrg# See the "minimum version" comment for each macro you use to see what
336f29dbc25Smrg# version you require.
337f29dbc25Smrgm4_defun([XORG_MACROS_VERSION],[
3387f419768Smrgm4_define([vers_have], [1.19.0])
339f29dbc25Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
340f29dbc25Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
341f29dbc25Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
342f29dbc25Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
343f29dbc25Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
344f29dbc25Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
345f29dbc25Smrgm4_undefine([vers_have])
346f29dbc25Smrgm4_undefine([maj_have])
347f29dbc25Smrgm4_undefine([maj_needed])
348f29dbc25Smrg]) # XORG_MACROS_VERSION
349f29dbc25Smrg
350f29dbc25Smrg# XORG_PROG_RAWCPP()
351f29dbc25Smrg# ------------------
352f29dbc25Smrg# Minimum version: 1.0.0
353f29dbc25Smrg#
354f29dbc25Smrg# Find cpp program and necessary flags for use in pre-processing text files
355f29dbc25Smrg# such as man pages and config files
356f29dbc25SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
357f29dbc25SmrgAC_REQUIRE([AC_PROG_CPP])
35804007ebaSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
359f29dbc25Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
360f29dbc25Smrg
361f29dbc25Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
362f29dbc25Smrg# which is not the best choice for supporting other OS'es, but covers most
363f29dbc25Smrg# of the ones we need for now.
364f29dbc25SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
36504007ebaSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
366f29dbc25Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
367f29dbc25Smrg	AC_MSG_RESULT([no])
368f29dbc25Smrgelse
369f29dbc25Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
370f29dbc25Smrg		RAWCPPFLAGS=-undef
371f29dbc25Smrg		AC_MSG_RESULT([yes])
372f29dbc25Smrg	# under Cygwin unix is still defined even with -undef
373f29dbc25Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
374f29dbc25Smrg		RAWCPPFLAGS="-undef -ansi"
375f29dbc25Smrg		AC_MSG_RESULT([yes, with -ansi])
376f29dbc25Smrg	else
377f29dbc25Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
378f29dbc25Smrg	fi
379f29dbc25Smrgfi
380f29dbc25Smrgrm -f conftest.$ac_ext
381f29dbc25Smrg
382f29dbc25SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
38304007ebaSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
384f29dbc25Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
385f29dbc25Smrg	AC_MSG_RESULT([no])
386f29dbc25Smrgelse
387f29dbc25Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3887f419768Smrg		TRADITIONALCPPFLAGS="-traditional"
389f29dbc25Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
390f29dbc25Smrg		AC_MSG_RESULT([yes])
391f29dbc25Smrg	else
392f29dbc25Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
393f29dbc25Smrg	fi
394f29dbc25Smrgfi
395f29dbc25Smrgrm -f conftest.$ac_ext
396f29dbc25SmrgAC_SUBST(RAWCPPFLAGS)
3977f419768SmrgAC_SUBST(TRADITIONALCPPFLAGS)
398f29dbc25Smrg]) # XORG_PROG_RAWCPP
399f29dbc25Smrg
400f29dbc25Smrg# XORG_MANPAGE_SECTIONS()
401f29dbc25Smrg# -----------------------
402f29dbc25Smrg# Minimum version: 1.0.0
403f29dbc25Smrg#
404f29dbc25Smrg# Determine which sections man pages go in for the different man page types
405f29dbc25Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
406f29dbc25Smrg# Not sure if there's any better way than just hardcoding by OS name.
407f29dbc25Smrg# Override default settings by setting environment variables
408170d5fdcSmrg# Added MAN_SUBSTS in version 1.8
409170d5fdcSmrg# Added AC_PROG_SED in version 1.8
410f29dbc25Smrg
411f29dbc25SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
412f29dbc25SmrgAC_REQUIRE([AC_CANONICAL_HOST])
413170d5fdcSmrgAC_REQUIRE([AC_PROG_SED])
414f29dbc25Smrg
415f29dbc25Smrgif test x$APP_MAN_SUFFIX = x    ; then
416f29dbc25Smrg    APP_MAN_SUFFIX=1
417f29dbc25Smrgfi
418f29dbc25Smrgif test x$APP_MAN_DIR = x    ; then
419f29dbc25Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420f29dbc25Smrgfi
421f29dbc25Smrg
422f29dbc25Smrgif test x$LIB_MAN_SUFFIX = x    ; then
423f29dbc25Smrg    LIB_MAN_SUFFIX=3
424f29dbc25Smrgfi
425f29dbc25Smrgif test x$LIB_MAN_DIR = x    ; then
426f29dbc25Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
427f29dbc25Smrgfi
428f29dbc25Smrg
429f29dbc25Smrgif test x$FILE_MAN_SUFFIX = x    ; then
430f29dbc25Smrg    case $host_os in
431f29dbc25Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
432f29dbc25Smrg	*)		FILE_MAN_SUFFIX=5  ;;
433f29dbc25Smrg    esac
434f29dbc25Smrgfi
435f29dbc25Smrgif test x$FILE_MAN_DIR = x    ; then
436f29dbc25Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
437f29dbc25Smrgfi
438f29dbc25Smrg
439f29dbc25Smrgif test x$MISC_MAN_SUFFIX = x    ; then
440f29dbc25Smrg    case $host_os in
441f29dbc25Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
442f29dbc25Smrg	*)		MISC_MAN_SUFFIX=7  ;;
443f29dbc25Smrg    esac
444f29dbc25Smrgfi
445f29dbc25Smrgif test x$MISC_MAN_DIR = x    ; then
446f29dbc25Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
447f29dbc25Smrgfi
448f29dbc25Smrg
449f29dbc25Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
450f29dbc25Smrg    case $host_os in
451f29dbc25Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
452f29dbc25Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
453f29dbc25Smrg    esac
454f29dbc25Smrgfi
455f29dbc25Smrgif test x$DRIVER_MAN_DIR = x    ; then
456f29dbc25Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
457f29dbc25Smrgfi
458f29dbc25Smrg
459f29dbc25Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
460f29dbc25Smrg    case $host_os in
461f29dbc25Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
462f29dbc25Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
463f29dbc25Smrg    esac
464f29dbc25Smrgfi
465f29dbc25Smrgif test x$ADMIN_MAN_DIR = x    ; then
466f29dbc25Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
467f29dbc25Smrgfi
468f29dbc25Smrg
469f29dbc25Smrg
470f29dbc25SmrgAC_SUBST([APP_MAN_SUFFIX])
471f29dbc25SmrgAC_SUBST([LIB_MAN_SUFFIX])
472f29dbc25SmrgAC_SUBST([FILE_MAN_SUFFIX])
473f29dbc25SmrgAC_SUBST([MISC_MAN_SUFFIX])
474f29dbc25SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
475f29dbc25SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
476f29dbc25SmrgAC_SUBST([APP_MAN_DIR])
477f29dbc25SmrgAC_SUBST([LIB_MAN_DIR])
478f29dbc25SmrgAC_SUBST([FILE_MAN_DIR])
479f29dbc25SmrgAC_SUBST([MISC_MAN_DIR])
480f29dbc25SmrgAC_SUBST([DRIVER_MAN_DIR])
481f29dbc25SmrgAC_SUBST([ADMIN_MAN_DIR])
482170d5fdcSmrg
483170d5fdcSmrgXORG_MAN_PAGE="X Version 11"
484170d5fdcSmrgAC_SUBST([XORG_MAN_PAGE])
485170d5fdcSmrgMAN_SUBSTS="\
486170d5fdcSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
487170d5fdcSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
488170d5fdcSmrg	-e 's|__xservername__|Xorg|g' \
489170d5fdcSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
490170d5fdcSmrg	-e 's|__projectroot__|\$(prefix)|g' \
491170d5fdcSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
492170d5fdcSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
493170d5fdcSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
494170d5fdcSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
495170d5fdcSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
496170d5fdcSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
497170d5fdcSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
498170d5fdcSmrgAC_SUBST([MAN_SUBSTS])
499170d5fdcSmrg
500f29dbc25Smrg]) # XORG_MANPAGE_SECTIONS
501f29dbc25Smrg
502170d5fdcSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
503170d5fdcSmrg# ------------------------
504170d5fdcSmrg# Minimum version: 1.7.0
505170d5fdcSmrg#
506170d5fdcSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
507170d5fdcSmrg# provided by xorg-sgml-doctools, if installed.
508170d5fdcSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
509170d5fdcSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
510170d5fdcSmrgXORG_SGML_PATH=
511170d5fdcSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
512170d5fdcSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
513170d5fdcSmrg    [m4_ifval([$1],[:],
514170d5fdcSmrg        [if test x"$cross_compiling" != x"yes" ; then
515170d5fdcSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
516170d5fdcSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
517170d5fdcSmrg         fi])
518170d5fdcSmrg    ])
519170d5fdcSmrg
520170d5fdcSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
521170d5fdcSmrg# the path and the name of the doc stylesheet
522170d5fdcSmrgif test "x$XORG_SGML_PATH" != "x" ; then
523170d5fdcSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
524170d5fdcSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
525170d5fdcSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
526170d5fdcSmrgelse
527170d5fdcSmrg   AC_MSG_RESULT([no])
528170d5fdcSmrgfi
529170d5fdcSmrg
530170d5fdcSmrgAC_SUBST(XORG_SGML_PATH)
531170d5fdcSmrgAC_SUBST(STYLESHEET_SRCDIR)
532170d5fdcSmrgAC_SUBST(XSL_STYLESHEET)
533170d5fdcSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
534170d5fdcSmrg]) # XORG_CHECK_SGML_DOCTOOLS
535170d5fdcSmrg
536f29dbc25Smrg# XORG_CHECK_LINUXDOC
537f29dbc25Smrg# -------------------
538f29dbc25Smrg# Minimum version: 1.0.0
539f29dbc25Smrg#
540f29dbc25Smrg# Defines the variable MAKE_TEXT if the necessary tools and
541f29dbc25Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
542f29dbc25Smrg# Whether or not the necessary tools and files are found can be checked
543f29dbc25Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
544f29dbc25SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
545170d5fdcSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
546170d5fdcSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
547f29dbc25Smrg
548f29dbc25SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
549f29dbc25Smrg
550170d5fdcSmrgAC_MSG_CHECKING([whether to build documentation])
551f29dbc25Smrg
552170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
553f29dbc25Smrg   BUILDDOC=yes
554f29dbc25Smrgelse
555f29dbc25Smrg   BUILDDOC=no
556f29dbc25Smrgfi
557f29dbc25Smrg
558f29dbc25SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
559f29dbc25Smrg
560f29dbc25SmrgAC_MSG_RESULT([$BUILDDOC])
561f29dbc25Smrg
562170d5fdcSmrgAC_MSG_CHECKING([whether to build pdf documentation])
563f29dbc25Smrg
564170d5fdcSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
565f29dbc25Smrg   BUILDPDFDOC=yes
566f29dbc25Smrgelse
567f29dbc25Smrg   BUILDPDFDOC=no
568f29dbc25Smrgfi
569f29dbc25Smrg
570f29dbc25SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
571f29dbc25Smrg
572f29dbc25SmrgAC_MSG_RESULT([$BUILDPDFDOC])
573f29dbc25Smrg
574170d5fdcSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
575f29dbc25SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
576f29dbc25SmrgMAKE_PDF="$PS2PDF"
577f29dbc25SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
578f29dbc25Smrg
579f29dbc25SmrgAC_SUBST(MAKE_TEXT)
580f29dbc25SmrgAC_SUBST(MAKE_PS)
581f29dbc25SmrgAC_SUBST(MAKE_PDF)
582f29dbc25SmrgAC_SUBST(MAKE_HTML)
583f29dbc25Smrg]) # XORG_CHECK_LINUXDOC
584f29dbc25Smrg
585f29dbc25Smrg# XORG_CHECK_DOCBOOK
586f29dbc25Smrg# -------------------
587f29dbc25Smrg# Minimum version: 1.0.0
588f29dbc25Smrg#
589f29dbc25Smrg# Checks for the ability to build output formats from SGML DocBook source.
590f29dbc25Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
591f29dbc25Smrg# indicates whether the necessary tools and files are found and, if set,
592f29dbc25Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
593f29dbc25SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
594170d5fdcSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
595170d5fdcSmrg
596f29dbc25SmrgBUILDTXTDOC=no
597f29dbc25SmrgBUILDPDFDOC=no
598f29dbc25SmrgBUILDPSDOC=no
599f29dbc25SmrgBUILDHTMLDOC=no
600f29dbc25Smrg
601f29dbc25SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
602f29dbc25SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
603f29dbc25SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
604f29dbc25SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
605f29dbc25Smrg
606170d5fdcSmrgAC_MSG_CHECKING([whether to build text documentation])
607170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
608f29dbc25Smrg   test x$BUILD_TXTDOC != xno; then
609f29dbc25Smrg	BUILDTXTDOC=yes
610f29dbc25Smrgfi
611f29dbc25SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
612f29dbc25SmrgAC_MSG_RESULT([$BUILDTXTDOC])
613f29dbc25Smrg
614170d5fdcSmrgAC_MSG_CHECKING([whether to build PDF documentation])
615170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
616f29dbc25Smrg   test x$BUILD_PDFDOC != xno; then
617f29dbc25Smrg	BUILDPDFDOC=yes
618f29dbc25Smrgfi
619f29dbc25SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
620f29dbc25SmrgAC_MSG_RESULT([$BUILDPDFDOC])
621f29dbc25Smrg
622170d5fdcSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
623170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
624f29dbc25Smrg   test x$BUILD_PSDOC != xno; then
625f29dbc25Smrg	BUILDPSDOC=yes
626f29dbc25Smrgfi
627f29dbc25SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
628f29dbc25SmrgAC_MSG_RESULT([$BUILDPSDOC])
629f29dbc25Smrg
630170d5fdcSmrgAC_MSG_CHECKING([whether to build HTML documentation])
631170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
632f29dbc25Smrg   test x$BUILD_HTMLDOC != xno; then
633f29dbc25Smrg	BUILDHTMLDOC=yes
634f29dbc25Smrgfi
635f29dbc25SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
636f29dbc25SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
637f29dbc25Smrg
638f29dbc25SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
639f29dbc25SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
640f29dbc25SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
641f29dbc25SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
642f29dbc25Smrg
643f29dbc25SmrgAC_SUBST(MAKE_TEXT)
644f29dbc25SmrgAC_SUBST(MAKE_PS)
645f29dbc25SmrgAC_SUBST(MAKE_PDF)
646f29dbc25SmrgAC_SUBST(MAKE_HTML)
647f29dbc25Smrg]) # XORG_CHECK_DOCBOOK
648f29dbc25Smrg
649170d5fdcSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
650f29dbc25Smrg# ----------------
651f29dbc25Smrg# Minimum version: 1.5.0
652170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
653f29dbc25Smrg#
654f29dbc25Smrg# Documentation tools are not always available on all platforms and sometimes
655f29dbc25Smrg# not at the appropriate level. This macro enables a module to test for the
656f29dbc25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
657f29dbc25Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
658170d5fdcSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
659170d5fdcSmrg# --with-xmlto assumes 'auto'.
660f29dbc25Smrg#
661f29dbc25Smrg# Interface to module:
662f29dbc25Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
663f29dbc25Smrg# XMLTO:	returns the path of the xmlto program found
664f29dbc25Smrg#		returns the path set by the user in the environment
665f29dbc25Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
666f29dbc25Smrg#		'no' user instructs the module not to use xmlto
667f29dbc25Smrg#
668170d5fdcSmrg# Added in version 1.10.0
669170d5fdcSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
670170d5fdcSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
671170d5fdcSmrg#
672f29dbc25Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
673f29dbc25Smrg#
674f29dbc25SmrgAC_DEFUN([XORG_WITH_XMLTO],[
675f29dbc25SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
676170d5fdcSmrgm4_define([_defopt], m4_default([$2], [auto]))
677f29dbc25SmrgAC_ARG_WITH(xmlto,
678f29dbc25Smrg	AS_HELP_STRING([--with-xmlto],
679170d5fdcSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
680170d5fdcSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
681170d5fdcSmrgm4_undefine([_defopt])
682f29dbc25Smrg
683f29dbc25Smrgif test "x$use_xmlto" = x"auto"; then
684f29dbc25Smrg   AC_PATH_PROG([XMLTO], [xmlto])
685f29dbc25Smrg   if test "x$XMLTO" = "x"; then
686f29dbc25Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
687f29dbc25Smrg	have_xmlto=no
688f29dbc25Smrg   else
689f29dbc25Smrg        have_xmlto=yes
690f29dbc25Smrg   fi
691f29dbc25Smrgelif test "x$use_xmlto" = x"yes" ; then
692f29dbc25Smrg   AC_PATH_PROG([XMLTO], [xmlto])
693f29dbc25Smrg   if test "x$XMLTO" = "x"; then
694f29dbc25Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
695f29dbc25Smrg   fi
696f29dbc25Smrg   have_xmlto=yes
697f29dbc25Smrgelif test "x$use_xmlto" = x"no" ; then
698f29dbc25Smrg   if test "x$XMLTO" != "x"; then
699f29dbc25Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
700f29dbc25Smrg   fi
701f29dbc25Smrg   have_xmlto=no
702f29dbc25Smrgelse
703f29dbc25Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
704f29dbc25Smrgfi
705170d5fdcSmrg
706170d5fdcSmrg# Test for a minimum version of xmlto, if provided.
707170d5fdcSmrgm4_ifval([$1],
708170d5fdcSmrg[if test "$have_xmlto" = yes; then
709170d5fdcSmrg    # scrape the xmlto version
710170d5fdcSmrg    AC_MSG_CHECKING([the xmlto version])
711170d5fdcSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
712170d5fdcSmrg    AC_MSG_RESULT([$xmlto_version])
713170d5fdcSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
714170d5fdcSmrg        [if test "x$use_xmlto" = xauto; then
715170d5fdcSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
716170d5fdcSmrg            have_xmlto=no
717170d5fdcSmrg        else
718170d5fdcSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
719170d5fdcSmrg        fi])
720170d5fdcSmrgfi])
721170d5fdcSmrg
72204007ebaSmrg# Test for the ability of xmlto to generate a text target
72305cf1079Smrg#
72405cf1079Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
72505cf1079Smrg# following test for empty XML docbook files.
72605cf1079Smrg# For compatibility reasons use the following empty XML docbook file and if
72705cf1079Smrg# it fails try it again with a non-empty XML file.
72804007ebaSmrghave_xmlto_text=no
72904007ebaSmrgcat > conftest.xml << "EOF"
73004007ebaSmrgEOF
73104007ebaSmrgAS_IF([test "$have_xmlto" = yes],
73204007ebaSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73304007ebaSmrg             [have_xmlto_text=yes],
73405cf1079Smrg             [# Try it again with a non-empty XML file.
73505cf1079Smrg              cat > conftest.xml << "EOF"
73605cf1079Smrg<x></x>
73705cf1079SmrgEOF
73805cf1079Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73905cf1079Smrg                    [have_xmlto_text=yes],
74005cf1079Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
74104007ebaSmrgrm -f conftest.xml
74204007ebaSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
74304007ebaSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
74404007ebaSmrg]) # XORG_WITH_XMLTO
74504007ebaSmrg
74604007ebaSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
74704007ebaSmrg# --------------------------------------------
74804007ebaSmrg# Minimum version: 1.12.0
74904007ebaSmrg# Minimum version for optional DEFAULT argument: 1.12.0
75004007ebaSmrg#
75104007ebaSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
75204007ebaSmrg# XML-based language used for the transformation of XML documents.
75304007ebaSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
75404007ebaSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
75504007ebaSmrg# The XSLT processor is often used as a standalone tool for transformations.
75604007ebaSmrg# It should not be assumed that this tool is used only to work with documnetation.
75704007ebaSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
75804007ebaSmrg#
75904007ebaSmrg# Interface to module:
76004007ebaSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
76104007ebaSmrg# XSLTPROC:	 returns the path of the xsltproc program found
76204007ebaSmrg#		 returns the path set by the user in the environment
76304007ebaSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
76404007ebaSmrg#		  'no' user instructs the module not to use xsltproc
76504007ebaSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
76604007ebaSmrg#
76704007ebaSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
76804007ebaSmrg#
76904007ebaSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
77004007ebaSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
77104007ebaSmrg# Preserves the interface, should it be implemented later
77204007ebaSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
77304007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
77404007ebaSmrgAC_ARG_WITH(xsltproc,
77504007ebaSmrg	AS_HELP_STRING([--with-xsltproc],
77604007ebaSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
77704007ebaSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
77804007ebaSmrgm4_undefine([_defopt])
77904007ebaSmrg
78004007ebaSmrgif test "x$use_xsltproc" = x"auto"; then
78104007ebaSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
78204007ebaSmrg   if test "x$XSLTPROC" = "x"; then
78304007ebaSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
78404007ebaSmrg	have_xsltproc=no
78504007ebaSmrg   else
78604007ebaSmrg        have_xsltproc=yes
78704007ebaSmrg   fi
78804007ebaSmrgelif test "x$use_xsltproc" = x"yes" ; then
78904007ebaSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
79004007ebaSmrg   if test "x$XSLTPROC" = "x"; then
79104007ebaSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
79204007ebaSmrg   fi
79304007ebaSmrg   have_xsltproc=yes
79404007ebaSmrgelif test "x$use_xsltproc" = x"no" ; then
79504007ebaSmrg   if test "x$XSLTPROC" != "x"; then
79604007ebaSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
79704007ebaSmrg   fi
79804007ebaSmrg   have_xsltproc=no
79904007ebaSmrgelse
80004007ebaSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
80104007ebaSmrgfi
80204007ebaSmrg
80304007ebaSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
80404007ebaSmrg]) # XORG_WITH_XSLTPROC
80504007ebaSmrg
80604007ebaSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
80704007ebaSmrg# ----------------------------------------
80804007ebaSmrg# Minimum version: 1.15.0
80904007ebaSmrg#
81004007ebaSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
81104007ebaSmrg# scanning arbitrary text files, extracting information from those text files,
81204007ebaSmrg# and printing reports based on that information.
81304007ebaSmrg#
81404007ebaSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
81504007ebaSmrg#
81604007ebaSmrg# Interface to module:
81704007ebaSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
81804007ebaSmrg# PERL:	     returns the path of the perl program found
81904007ebaSmrg#	     returns the path set by the user in the environment
82004007ebaSmrg# --with-perl: 'yes' user instructs the module to use perl
82104007ebaSmrg#	       'no' user instructs the module not to use perl
82204007ebaSmrg# have_perl: returns yes if perl found in PATH or no
82304007ebaSmrg#
82404007ebaSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
82504007ebaSmrg#
82604007ebaSmrgAC_DEFUN([XORG_WITH_PERL],[
82704007ebaSmrgAC_ARG_VAR([PERL], [Path to perl command])
82804007ebaSmrg# Preserves the interface, should it be implemented later
82904007ebaSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
83004007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
83104007ebaSmrgAC_ARG_WITH(perl,
83204007ebaSmrg	AS_HELP_STRING([--with-perl],
83304007ebaSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
83404007ebaSmrg	   [use_perl=$withval], [use_perl=]_defopt)
83504007ebaSmrgm4_undefine([_defopt])
83604007ebaSmrg
83704007ebaSmrgif test "x$use_perl" = x"auto"; then
83804007ebaSmrg   AC_PATH_PROG([PERL], [perl])
83904007ebaSmrg   if test "x$PERL" = "x"; then
84004007ebaSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
84104007ebaSmrg	have_perl=no
84204007ebaSmrg   else
84304007ebaSmrg        have_perl=yes
84404007ebaSmrg   fi
84504007ebaSmrgelif test "x$use_perl" = x"yes" ; then
84604007ebaSmrg   AC_PATH_PROG([PERL], [perl])
84704007ebaSmrg   if test "x$PERL" = "x"; then
84804007ebaSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
84904007ebaSmrg   fi
85004007ebaSmrg   have_perl=yes
85104007ebaSmrgelif test "x$use_perl" = x"no" ; then
85204007ebaSmrg   if test "x$PERL" != "x"; then
85304007ebaSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
85404007ebaSmrg   fi
85504007ebaSmrg   have_perl=no
85604007ebaSmrgelse
85704007ebaSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
85804007ebaSmrgfi
85904007ebaSmrg
86004007ebaSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
86104007ebaSmrg]) # XORG_WITH_PERL
862f29dbc25Smrg
863170d5fdcSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
864f29dbc25Smrg# ----------------
865f29dbc25Smrg# Minimum version: 1.5.0
866170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
867f29dbc25Smrg#
868f29dbc25Smrg# Documentation tools are not always available on all platforms and sometimes
869f29dbc25Smrg# not at the appropriate level. This macro enables a module to test for the
870f29dbc25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
871f29dbc25Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
872170d5fdcSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
873170d5fdcSmrg# --with-asciidoc assumes 'auto'.
874f29dbc25Smrg#
875f29dbc25Smrg# Interface to module:
876f29dbc25Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
877f29dbc25Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
878f29dbc25Smrg#		 returns the path set by the user in the environment
879f29dbc25Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
880f29dbc25Smrg#		  'no' user instructs the module not to use asciidoc
881f29dbc25Smrg#
882f29dbc25Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
883f29dbc25Smrg#
884f29dbc25SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
885f29dbc25SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
886170d5fdcSmrgm4_define([_defopt], m4_default([$2], [auto]))
887f29dbc25SmrgAC_ARG_WITH(asciidoc,
888f29dbc25Smrg	AS_HELP_STRING([--with-asciidoc],
889170d5fdcSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
890170d5fdcSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
891170d5fdcSmrgm4_undefine([_defopt])
892f29dbc25Smrg
893f29dbc25Smrgif test "x$use_asciidoc" = x"auto"; then
894f29dbc25Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
895f29dbc25Smrg   if test "x$ASCIIDOC" = "x"; then
896f29dbc25Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
897f29dbc25Smrg	have_asciidoc=no
898f29dbc25Smrg   else
899f29dbc25Smrg        have_asciidoc=yes
900f29dbc25Smrg   fi
901f29dbc25Smrgelif test "x$use_asciidoc" = x"yes" ; then
902f29dbc25Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
903f29dbc25Smrg   if test "x$ASCIIDOC" = "x"; then
904f29dbc25Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
905f29dbc25Smrg   fi
906f29dbc25Smrg   have_asciidoc=yes
907f29dbc25Smrgelif test "x$use_asciidoc" = x"no" ; then
908f29dbc25Smrg   if test "x$ASCIIDOC" != "x"; then
909f29dbc25Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
910f29dbc25Smrg   fi
911f29dbc25Smrg   have_asciidoc=no
912f29dbc25Smrgelse
913f29dbc25Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
914f29dbc25Smrgfi
915170d5fdcSmrgm4_ifval([$1],
916170d5fdcSmrg[if test "$have_asciidoc" = yes; then
917170d5fdcSmrg    # scrape the asciidoc version
918170d5fdcSmrg    AC_MSG_CHECKING([the asciidoc version])
919170d5fdcSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
920170d5fdcSmrg    AC_MSG_RESULT([$asciidoc_version])
921170d5fdcSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
922170d5fdcSmrg        [if test "x$use_asciidoc" = xauto; then
923170d5fdcSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
924170d5fdcSmrg            have_asciidoc=no
925170d5fdcSmrg        else
926170d5fdcSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
927170d5fdcSmrg        fi])
928170d5fdcSmrgfi])
929f29dbc25SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
930170d5fdcSmrg]) # XORG_WITH_ASCIIDOC
931f29dbc25Smrg
932170d5fdcSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9337f419768Smrg# -------------------------------------------
934f29dbc25Smrg# Minimum version: 1.5.0
935170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9367f419768Smrg# Minimum version for optional DOT checking: 1.18.0
937f29dbc25Smrg#
938f29dbc25Smrg# Documentation tools are not always available on all platforms and sometimes
939f29dbc25Smrg# not at the appropriate level. This macro enables a module to test for the
940f29dbc25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
941f29dbc25Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
942170d5fdcSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
943170d5fdcSmrg# --with-doxygen assumes 'auto'.
944f29dbc25Smrg#
945f29dbc25Smrg# Interface to module:
946f29dbc25Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
947f29dbc25Smrg# DOXYGEN:	 returns the path of the doxygen program found
948f29dbc25Smrg#		 returns the path set by the user in the environment
949f29dbc25Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
950f29dbc25Smrg#		  'no' user instructs the module not to use doxygen
951f29dbc25Smrg#
952f29dbc25Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
953f29dbc25Smrg#
954f29dbc25SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
955f29dbc25SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9567f419768SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
957170d5fdcSmrgm4_define([_defopt], m4_default([$2], [auto]))
958f29dbc25SmrgAC_ARG_WITH(doxygen,
959f29dbc25Smrg	AS_HELP_STRING([--with-doxygen],
960170d5fdcSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
961170d5fdcSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
962170d5fdcSmrgm4_undefine([_defopt])
963f29dbc25Smrg
964f29dbc25Smrgif test "x$use_doxygen" = x"auto"; then
965f29dbc25Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
966f29dbc25Smrg   if test "x$DOXYGEN" = "x"; then
967f29dbc25Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
968f29dbc25Smrg	have_doxygen=no
969f29dbc25Smrg   else
970f29dbc25Smrg        have_doxygen=yes
971f29dbc25Smrg   fi
972f29dbc25Smrgelif test "x$use_doxygen" = x"yes" ; then
973f29dbc25Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
974f29dbc25Smrg   if test "x$DOXYGEN" = "x"; then
975f29dbc25Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
976f29dbc25Smrg   fi
977f29dbc25Smrg   have_doxygen=yes
978f29dbc25Smrgelif test "x$use_doxygen" = x"no" ; then
979f29dbc25Smrg   if test "x$DOXYGEN" != "x"; then
980f29dbc25Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
981f29dbc25Smrg   fi
982f29dbc25Smrg   have_doxygen=no
983f29dbc25Smrgelse
984f29dbc25Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
985f29dbc25Smrgfi
986170d5fdcSmrgm4_ifval([$1],
987170d5fdcSmrg[if test "$have_doxygen" = yes; then
988170d5fdcSmrg    # scrape the doxygen version
989170d5fdcSmrg    AC_MSG_CHECKING([the doxygen version])
990170d5fdcSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
991170d5fdcSmrg    AC_MSG_RESULT([$doxygen_version])
992170d5fdcSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
993170d5fdcSmrg        [if test "x$use_doxygen" = xauto; then
994170d5fdcSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
995170d5fdcSmrg            have_doxygen=no
996170d5fdcSmrg        else
997170d5fdcSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
998170d5fdcSmrg        fi])
999170d5fdcSmrgfi])
10007f419768Smrg
10017f419768Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10027f419768Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10037f419768Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10047f419768SmrgHAVE_DOT=no
10057f419768Smrgif test "x$have_doxygen" = "xyes"; then
10067f419768Smrg  AC_PATH_PROG([DOT], [dot])
10077f419768Smrg    if test "x$DOT" != "x"; then
10087f419768Smrg      HAVE_DOT=yes
10097f419768Smrg    fi
10107f419768Smrgfi
10117f419768Smrg
10127f419768SmrgAC_SUBST([HAVE_DOT])
10137f419768SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
1014f29dbc25SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1015170d5fdcSmrg]) # XORG_WITH_DOXYGEN
1016170d5fdcSmrg
1017170d5fdcSmrg# XORG_WITH_GROFF([DEFAULT])
1018170d5fdcSmrg# ----------------
1019170d5fdcSmrg# Minimum version: 1.6.0
1020170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1021170d5fdcSmrg#
1022170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1023170d5fdcSmrg# not at the appropriate level. This macro enables a module to test for the
1024170d5fdcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1025170d5fdcSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1026170d5fdcSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1027170d5fdcSmrg# --with-groff assumes 'auto'.
1028170d5fdcSmrg#
1029170d5fdcSmrg# Interface to module:
1030170d5fdcSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1031170d5fdcSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1032170d5fdcSmrg# HAVE_GROFF_MS: the -ms macros package
1033170d5fdcSmrg# GROFF:	 returns the path of the groff program found
1034170d5fdcSmrg#		 returns the path set by the user in the environment
1035170d5fdcSmrg# --with-groff:	 'yes' user instructs the module to use groff
1036170d5fdcSmrg#		 'no' user instructs the module not to use groff
1037170d5fdcSmrg#
1038170d5fdcSmrg# Added in version 1.9.0:
1039170d5fdcSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1040170d5fdcSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1041170d5fdcSmrg#		   psselect from the psutils package.
1042170d5fdcSmrg#		   the ghostcript package. Refer to the grohtml man pages
1043170d5fdcSmrg#
1044170d5fdcSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1045170d5fdcSmrg#
1046170d5fdcSmrg# OS and distros often splits groff in a basic and full package, the former
1047170d5fdcSmrg# having the groff program and the later having devices, fonts and macros
1048170d5fdcSmrg# Checking for the groff executable is not enough.
1049170d5fdcSmrg#
1050170d5fdcSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1051170d5fdcSmrg# unset HAVE_GROFF or GROFF env variables.
1052170d5fdcSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1053170d5fdcSmrg#
1054170d5fdcSmrgAC_DEFUN([XORG_WITH_GROFF],[
1055170d5fdcSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1056170d5fdcSmrgm4_define([_defopt], m4_default([$1], [auto]))
1057170d5fdcSmrgAC_ARG_WITH(groff,
1058170d5fdcSmrg	AS_HELP_STRING([--with-groff],
1059170d5fdcSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1060170d5fdcSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1061170d5fdcSmrgm4_undefine([_defopt])
1062170d5fdcSmrg
1063170d5fdcSmrgif test "x$use_groff" = x"auto"; then
1064170d5fdcSmrg   AC_PATH_PROG([GROFF], [groff])
1065170d5fdcSmrg   if test "x$GROFF" = "x"; then
1066170d5fdcSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1067170d5fdcSmrg	have_groff=no
1068170d5fdcSmrg   else
1069170d5fdcSmrg        have_groff=yes
1070170d5fdcSmrg   fi
1071170d5fdcSmrgelif test "x$use_groff" = x"yes" ; then
1072170d5fdcSmrg   AC_PATH_PROG([GROFF], [groff])
1073170d5fdcSmrg   if test "x$GROFF" = "x"; then
1074170d5fdcSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1075170d5fdcSmrg   fi
1076170d5fdcSmrg   have_groff=yes
1077170d5fdcSmrgelif test "x$use_groff" = x"no" ; then
1078170d5fdcSmrg   if test "x$GROFF" != "x"; then
1079170d5fdcSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1080170d5fdcSmrg   fi
1081170d5fdcSmrg   have_groff=no
1082170d5fdcSmrgelse
1083170d5fdcSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1084170d5fdcSmrgfi
1085170d5fdcSmrg
1086170d5fdcSmrg# We have groff, test for the presence of the macro packages
1087170d5fdcSmrgif test "x$have_groff" = x"yes"; then
1088170d5fdcSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1089170d5fdcSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1090170d5fdcSmrg        groff_ms_works=yes
1091170d5fdcSmrg    else
1092170d5fdcSmrg        groff_ms_works=no
1093170d5fdcSmrg    fi
1094170d5fdcSmrg    AC_MSG_RESULT([$groff_ms_works])
1095170d5fdcSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1096170d5fdcSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1097170d5fdcSmrg        groff_mm_works=yes
1098170d5fdcSmrg    else
1099170d5fdcSmrg        groff_mm_works=no
1100170d5fdcSmrg    fi
1101170d5fdcSmrg    AC_MSG_RESULT([$groff_mm_works])
1102170d5fdcSmrgfi
1103170d5fdcSmrg
1104170d5fdcSmrg# We have groff, test for HTML dependencies, one command per package
1105170d5fdcSmrgif test "x$have_groff" = x"yes"; then
1106170d5fdcSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1107170d5fdcSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1108170d5fdcSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1109170d5fdcSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1110170d5fdcSmrg      have_groff_html=yes
1111170d5fdcSmrg   else
1112170d5fdcSmrg      have_groff_html=no
1113170d5fdcSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1114170d5fdcSmrg   fi
1115170d5fdcSmrgfi
1116170d5fdcSmrg
1117170d5fdcSmrg# Set Automake conditionals for Makefiles
1118170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1119170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1120170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1121170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1122170d5fdcSmrg]) # XORG_WITH_GROFF
1123170d5fdcSmrg
112404007ebaSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
112504007ebaSmrg# ---------------------------------------
1126170d5fdcSmrg# Minimum version: 1.6.0
1127170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
112804007ebaSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1129170d5fdcSmrg#
1130170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1131170d5fdcSmrg# not at the appropriate level. This macro enables a module to test for the
1132170d5fdcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1133170d5fdcSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1134170d5fdcSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1135170d5fdcSmrg# --with-fop assumes 'auto'.
1136170d5fdcSmrg#
1137170d5fdcSmrg# Interface to module:
1138170d5fdcSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1139170d5fdcSmrg# FOP:	 	returns the path of the fop program found
1140170d5fdcSmrg#		returns the path set by the user in the environment
1141170d5fdcSmrg# --with-fop: 	'yes' user instructs the module to use fop
1142170d5fdcSmrg#		'no' user instructs the module not to use fop
1143170d5fdcSmrg#
1144170d5fdcSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1145170d5fdcSmrg#
1146170d5fdcSmrgAC_DEFUN([XORG_WITH_FOP],[
1147170d5fdcSmrgAC_ARG_VAR([FOP], [Path to fop command])
114804007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
1149170d5fdcSmrgAC_ARG_WITH(fop,
1150170d5fdcSmrg	AS_HELP_STRING([--with-fop],
1151170d5fdcSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1152170d5fdcSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1153170d5fdcSmrgm4_undefine([_defopt])
1154170d5fdcSmrg
1155170d5fdcSmrgif test "x$use_fop" = x"auto"; then
1156170d5fdcSmrg   AC_PATH_PROG([FOP], [fop])
1157170d5fdcSmrg   if test "x$FOP" = "x"; then
1158170d5fdcSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1159170d5fdcSmrg	have_fop=no
1160170d5fdcSmrg   else
1161170d5fdcSmrg        have_fop=yes
1162170d5fdcSmrg   fi
1163170d5fdcSmrgelif test "x$use_fop" = x"yes" ; then
1164170d5fdcSmrg   AC_PATH_PROG([FOP], [fop])
1165170d5fdcSmrg   if test "x$FOP" = "x"; then
1166170d5fdcSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1167170d5fdcSmrg   fi
1168170d5fdcSmrg   have_fop=yes
1169170d5fdcSmrgelif test "x$use_fop" = x"no" ; then
1170170d5fdcSmrg   if test "x$FOP" != "x"; then
1171170d5fdcSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1172170d5fdcSmrg   fi
1173170d5fdcSmrg   have_fop=no
1174170d5fdcSmrgelse
1175170d5fdcSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1176170d5fdcSmrgfi
117704007ebaSmrg
117804007ebaSmrg# Test for a minimum version of fop, if provided.
117904007ebaSmrgm4_ifval([$1],
118004007ebaSmrg[if test "$have_fop" = yes; then
118104007ebaSmrg    # scrape the fop version
118204007ebaSmrg    AC_MSG_CHECKING([for fop minimum version])
118304007ebaSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
118404007ebaSmrg    AC_MSG_RESULT([$fop_version])
118504007ebaSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
118604007ebaSmrg        [if test "x$use_fop" = xauto; then
118704007ebaSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
118804007ebaSmrg            have_fop=no
118904007ebaSmrg        else
119004007ebaSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
119104007ebaSmrg        fi])
119204007ebaSmrgfi])
1193170d5fdcSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1194170d5fdcSmrg]) # XORG_WITH_FOP
1195170d5fdcSmrg
11967f419768Smrg# XORG_WITH_M4([MIN-VERSION])
11977f419768Smrg# ---------------------------
11987f419768Smrg# Minimum version: 1.19.0
11997f419768Smrg#
12007f419768Smrg# This macro attempts to locate an m4 macro processor which supports
12017f419768Smrg# -I option and is only useful for modules relying on M4 in order to
12027f419768Smrg# expand macros in source code files.
12037f419768Smrg#
12047f419768Smrg# Interface to module:
12057f419768Smrg# M4:	 	returns the path of the m4 program found
12067f419768Smrg#		returns the path set by the user in the environment
12077f419768Smrg#
12087f419768SmrgAC_DEFUN([XORG_WITH_M4], [
12097f419768SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12107f419768Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12117f419768Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12127f419768Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12137f419768Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12147f419768Smrg   [$PATH:/usr/gnu/bin])])
12157f419768Smrg
12167f419768SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12177f419768Smrg]) # XORG_WITH_M4
12187f419768Smrg
1219170d5fdcSmrg# XORG_WITH_PS2PDF([DEFAULT])
1220170d5fdcSmrg# ----------------
1221170d5fdcSmrg# Minimum version: 1.6.0
1222170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1223170d5fdcSmrg#
1224170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1225170d5fdcSmrg# not at the appropriate level. This macro enables a module to test for the
1226170d5fdcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1227170d5fdcSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1228170d5fdcSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1229170d5fdcSmrg# --with-ps2pdf assumes 'auto'.
1230170d5fdcSmrg#
1231170d5fdcSmrg# Interface to module:
1232170d5fdcSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1233170d5fdcSmrg# PS2PDF:	returns the path of the ps2pdf program found
1234170d5fdcSmrg#		returns the path set by the user in the environment
1235170d5fdcSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1236170d5fdcSmrg#		 'no' user instructs the module not to use ps2pdf
1237170d5fdcSmrg#
1238170d5fdcSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1239170d5fdcSmrg#
1240170d5fdcSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1241170d5fdcSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1242170d5fdcSmrgm4_define([_defopt], m4_default([$1], [auto]))
1243170d5fdcSmrgAC_ARG_WITH(ps2pdf,
1244170d5fdcSmrg	AS_HELP_STRING([--with-ps2pdf],
1245170d5fdcSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1246170d5fdcSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1247170d5fdcSmrgm4_undefine([_defopt])
1248170d5fdcSmrg
1249170d5fdcSmrgif test "x$use_ps2pdf" = x"auto"; then
1250170d5fdcSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1251170d5fdcSmrg   if test "x$PS2PDF" = "x"; then
1252170d5fdcSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1253170d5fdcSmrg	have_ps2pdf=no
1254170d5fdcSmrg   else
1255170d5fdcSmrg        have_ps2pdf=yes
1256170d5fdcSmrg   fi
1257170d5fdcSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1258170d5fdcSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1259170d5fdcSmrg   if test "x$PS2PDF" = "x"; then
1260170d5fdcSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1261170d5fdcSmrg   fi
1262170d5fdcSmrg   have_ps2pdf=yes
1263170d5fdcSmrgelif test "x$use_ps2pdf" = x"no" ; then
1264170d5fdcSmrg   if test "x$PS2PDF" != "x"; then
1265170d5fdcSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1266170d5fdcSmrg   fi
1267170d5fdcSmrg   have_ps2pdf=no
1268170d5fdcSmrgelse
1269170d5fdcSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1270170d5fdcSmrgfi
1271170d5fdcSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1272170d5fdcSmrg]) # XORG_WITH_PS2PDF
1273170d5fdcSmrg
1274170d5fdcSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1275170d5fdcSmrg# ----------------
1276170d5fdcSmrg# Minimum version: 1.6.0
1277170d5fdcSmrg#
1278170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1279170d5fdcSmrg# not at the appropriate level. This macro enables a builder to skip all
1280170d5fdcSmrg# documentation targets except traditional man pages.
1281170d5fdcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1282170d5fdcSmrg# maximum flexibilty in controlling documentation building.
1283170d5fdcSmrg# Refer to:
1284170d5fdcSmrg# XORG_WITH_XMLTO         --with-xmlto
1285170d5fdcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1286170d5fdcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1287170d5fdcSmrg# XORG_WITH_FOP           --with-fop
1288170d5fdcSmrg# XORG_WITH_GROFF         --with-groff
1289170d5fdcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1290170d5fdcSmrg#
1291170d5fdcSmrg# Interface to module:
1292170d5fdcSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1293170d5fdcSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1294170d5fdcSmrg#		 'no' user instructs the module not to generate docs
1295170d5fdcSmrg# parm1:	specify the default value, yes or no.
1296170d5fdcSmrg#
1297170d5fdcSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
129804007ebaSmrgm4_define([docs_default], m4_default([$1], [yes]))
1299170d5fdcSmrgAC_ARG_ENABLE(docs,
1300170d5fdcSmrg	AS_HELP_STRING([--enable-docs],
130104007ebaSmrg	   [Enable building the documentation (default: ]docs_default[)]),
130204007ebaSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
130304007ebaSmrgm4_undefine([docs_default])
1304170d5fdcSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1305170d5fdcSmrgAC_MSG_CHECKING([whether to build documentation])
1306170d5fdcSmrgAC_MSG_RESULT([$build_docs])
1307170d5fdcSmrg]) # XORG_ENABLE_DOCS
1308170d5fdcSmrg
1309170d5fdcSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1310170d5fdcSmrg# ----------------
1311170d5fdcSmrg# Minimum version: 1.6.0
1312170d5fdcSmrg#
1313170d5fdcSmrg# This macro enables a builder to skip all developer documentation.
1314170d5fdcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1315170d5fdcSmrg# maximum flexibilty in controlling documentation building.
1316170d5fdcSmrg# Refer to:
1317170d5fdcSmrg# XORG_WITH_XMLTO         --with-xmlto
1318170d5fdcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1319170d5fdcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1320170d5fdcSmrg# XORG_WITH_FOP           --with-fop
1321170d5fdcSmrg# XORG_WITH_GROFF         --with-groff
1322170d5fdcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1323170d5fdcSmrg#
1324170d5fdcSmrg# Interface to module:
1325170d5fdcSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1326170d5fdcSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1327170d5fdcSmrg#			'no' user instructs the module not to generate developer docs
1328170d5fdcSmrg# parm1:		specify the default value, yes or no.
1329170d5fdcSmrg#
1330170d5fdcSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1331170d5fdcSmrgm4_define([devel_default], m4_default([$1], [yes]))
1332170d5fdcSmrgAC_ARG_ENABLE(devel-docs,
1333170d5fdcSmrg	AS_HELP_STRING([--enable-devel-docs],
1334170d5fdcSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1335170d5fdcSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1336170d5fdcSmrgm4_undefine([devel_default])
1337170d5fdcSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1338170d5fdcSmrgAC_MSG_CHECKING([whether to build developer documentation])
1339170d5fdcSmrgAC_MSG_RESULT([$build_devel_docs])
1340170d5fdcSmrg]) # XORG_ENABLE_DEVEL_DOCS
1341170d5fdcSmrg
1342170d5fdcSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1343170d5fdcSmrg# ----------------
1344170d5fdcSmrg# Minimum version: 1.6.0
1345170d5fdcSmrg#
1346170d5fdcSmrg# This macro enables a builder to skip all functional specification targets.
1347170d5fdcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1348170d5fdcSmrg# maximum flexibilty in controlling documentation building.
1349170d5fdcSmrg# Refer to:
1350170d5fdcSmrg# XORG_WITH_XMLTO         --with-xmlto
1351170d5fdcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1352170d5fdcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1353170d5fdcSmrg# XORG_WITH_FOP           --with-fop
1354170d5fdcSmrg# XORG_WITH_GROFF         --with-groff
1355170d5fdcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1356170d5fdcSmrg#
1357170d5fdcSmrg# Interface to module:
1358170d5fdcSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1359170d5fdcSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1360170d5fdcSmrg#			'no' user instructs the module not to generate specs
1361170d5fdcSmrg# parm1:		specify the default value, yes or no.
1362170d5fdcSmrg#
1363170d5fdcSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1364170d5fdcSmrgm4_define([spec_default], m4_default([$1], [yes]))
1365170d5fdcSmrgAC_ARG_ENABLE(specs,
1366170d5fdcSmrg	AS_HELP_STRING([--enable-specs],
1367170d5fdcSmrg	   [Enable building the specs (default: ]spec_default[)]),
1368170d5fdcSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1369170d5fdcSmrgm4_undefine([spec_default])
1370170d5fdcSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1371170d5fdcSmrgAC_MSG_CHECKING([whether to build functional specifications])
1372170d5fdcSmrgAC_MSG_RESULT([$build_specs])
1373170d5fdcSmrg]) # XORG_ENABLE_SPECS
1374f29dbc25Smrg
137504007ebaSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
137604007ebaSmrg# ----------------------------------------------
137704007ebaSmrg# Minimum version: 1.13.0
137804007ebaSmrg#
137904007ebaSmrg# This macro enables a builder to enable/disable unit testing
138004007ebaSmrg# It makes no assumption about the test cases implementation
138104007ebaSmrg# Test cases may or may not use Automake "Support for test suites"
138204007ebaSmrg# They may or may not use the software utility library GLib
138304007ebaSmrg#
138404007ebaSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
138504007ebaSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
138604007ebaSmrg# The variable enable_unit_tests is used by other macros in this file.
138704007ebaSmrg#
138804007ebaSmrg# Interface to module:
138904007ebaSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
139004007ebaSmrg# enable_unit_tests:    used in configure.ac for additional configuration
139104007ebaSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
139204007ebaSmrg#			'no' user instructs the module not to build tests
139304007ebaSmrg# parm1:		specify the default value, yes or no.
139404007ebaSmrg#
139504007ebaSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
139604007ebaSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
139704007ebaSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
139804007ebaSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
139904007ebaSmrgm4_define([_defopt], m4_default([$1], [auto]))
140004007ebaSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
140104007ebaSmrg	[Enable building unit test cases (default: ]_defopt[)]),
140204007ebaSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
140304007ebaSmrgm4_undefine([_defopt])
140404007ebaSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
140504007ebaSmrgAC_MSG_CHECKING([whether to build unit test cases])
140604007ebaSmrgAC_MSG_RESULT([$enable_unit_tests])
140704007ebaSmrg]) # XORG_ENABLE_UNIT_TESTS
140804007ebaSmrg
140904007ebaSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
141004007ebaSmrg# ------------------------------------------------------
141104007ebaSmrg# Minimum version: 1.17.0
141204007ebaSmrg#
141304007ebaSmrg# This macro enables a builder to enable/disable integration testing
141404007ebaSmrg# It makes no assumption about the test cases' implementation
141504007ebaSmrg# Test cases may or may not use Automake "Support for test suites"
141604007ebaSmrg#
141704007ebaSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
141804007ebaSmrg# usually requires less dependencies and may be built and run under less
141904007ebaSmrg# stringent environments than integration tests.
142004007ebaSmrg#
142104007ebaSmrg# Interface to module:
142204007ebaSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
142304007ebaSmrg# enable_integration_tests:   used in configure.ac for additional configuration
142404007ebaSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
142504007ebaSmrg#                             'no' user instructs the module not to build tests
142604007ebaSmrg# parm1:                      specify the default value, yes or no.
142704007ebaSmrg#
142804007ebaSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
142904007ebaSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
143004007ebaSmrgm4_define([_defopt], m4_default([$1], [auto]))
143104007ebaSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
143204007ebaSmrg	[Enable building integration test cases (default: ]_defopt[)]),
143304007ebaSmrg	[enable_integration_tests=$enableval],
143404007ebaSmrg	[enable_integration_tests=]_defopt)
143504007ebaSmrgm4_undefine([_defopt])
143604007ebaSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
143704007ebaSmrg	[test "x$enable_integration_tests" != xno])
143804007ebaSmrgAC_MSG_CHECKING([whether to build unit test cases])
143904007ebaSmrgAC_MSG_RESULT([$enable_integration_tests])
144004007ebaSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
144104007ebaSmrg
144204007ebaSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
144304007ebaSmrg# ----------------------------------------
144404007ebaSmrg# Minimum version: 1.13.0
144504007ebaSmrg#
144604007ebaSmrg# GLib is a library which provides advanced data structures and functions.
144704007ebaSmrg# This macro enables a module to test for the presence of Glib.
144804007ebaSmrg#
144904007ebaSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
145004007ebaSmrg# Otherwise the value of $enable_unit_tests is blank.
145104007ebaSmrg#
145204007ebaSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
145304007ebaSmrg# test support usually requires less dependencies and may be built and run under
145404007ebaSmrg# less stringent environments than integration tests.
145504007ebaSmrg#
145604007ebaSmrg# Interface to module:
145704007ebaSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
145804007ebaSmrg# with_glib: used in configure.ac to know if GLib has been found
145904007ebaSmrg# --with-glib:	'yes' user instructs the module to use glib
146004007ebaSmrg#		'no' user instructs the module not to use glib
146104007ebaSmrg#
146204007ebaSmrgAC_DEFUN([XORG_WITH_GLIB],[
146304007ebaSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146404007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
146504007ebaSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
146604007ebaSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
146704007ebaSmrg	[with_glib=$withval], [with_glib=]_defopt)
146804007ebaSmrgm4_undefine([_defopt])
146904007ebaSmrg
147004007ebaSmrghave_glib=no
147104007ebaSmrg# Do not probe GLib if user explicitly disabled unit testing
147204007ebaSmrgif test "x$enable_unit_tests" != x"no"; then
147304007ebaSmrg  # Do not probe GLib if user explicitly disabled it
147404007ebaSmrg  if test "x$with_glib" != x"no"; then
147504007ebaSmrg    m4_ifval(
147604007ebaSmrg      [$1],
147704007ebaSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
147804007ebaSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
147904007ebaSmrg    )
148004007ebaSmrg  fi
148104007ebaSmrgfi
148204007ebaSmrg
148304007ebaSmrg# Not having GLib when unit testing has been explicitly requested is an error
148404007ebaSmrgif test "x$enable_unit_tests" = x"yes"; then
148504007ebaSmrg  if test "x$have_glib" = x"no"; then
148604007ebaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
148704007ebaSmrg  fi
148804007ebaSmrgfi
148904007ebaSmrg
149004007ebaSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
149104007ebaSmrgif test "x$enable_unit_tests" = x"no"; then
149204007ebaSmrg  if test "x$with_glib" = x"yes"; then
149304007ebaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149404007ebaSmrg  fi
149504007ebaSmrgfi
149604007ebaSmrg
149704007ebaSmrg# Not having GLib when it has been explicitly requested is an error
149804007ebaSmrgif test "x$with_glib" = x"yes"; then
149904007ebaSmrg  if test "x$have_glib" = x"no"; then
150004007ebaSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
150104007ebaSmrg  fi
150204007ebaSmrgfi
150304007ebaSmrg
150404007ebaSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
150504007ebaSmrg]) # XORG_WITH_GLIB
150604007ebaSmrg
150704007ebaSmrg# XORG_LD_WRAP([required|optional])
150804007ebaSmrg# ---------------------------------
150904007ebaSmrg# Minimum version: 1.13.0
151004007ebaSmrg#
151104007ebaSmrg# Check if linker supports -wrap, passed via compiler flags
151204007ebaSmrg#
151304007ebaSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
151404007ebaSmrg# Otherwise the value of $enable_unit_tests is blank.
151504007ebaSmrg#
151604007ebaSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
151704007ebaSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
151804007ebaSmrg# available, an argument of "optional" allows use when some unit tests require
151904007ebaSmrg# ld -wrap and others do not.
152004007ebaSmrg#
152104007ebaSmrgAC_DEFUN([XORG_LD_WRAP],[
152204007ebaSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
152304007ebaSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
152404007ebaSmrg                      void __wrap_exit(int status) { return; }],
152504007ebaSmrg                     [exit(0);])])
152604007ebaSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
152704007ebaSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
152804007ebaSmrg  if test "x$have_ld_wrap" = x"no"; then
152904007ebaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
153004007ebaSmrg  fi
153104007ebaSmrgfi
153204007ebaSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
153304007ebaSmrg#
153404007ebaSmrg]) # XORG_LD_WRAP
153504007ebaSmrg
153604007ebaSmrg# XORG_CHECK_LINKER_FLAGS
153704007ebaSmrg# -----------------------
153804007ebaSmrg# SYNOPSIS
153904007ebaSmrg#
154004007ebaSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
154104007ebaSmrg#
154204007ebaSmrg# DESCRIPTION
154304007ebaSmrg#
154404007ebaSmrg#   Check whether the given linker FLAGS work with the current language's
154504007ebaSmrg#   linker, or whether they give an error.
154604007ebaSmrg#
154704007ebaSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
154804007ebaSmrg#   success/failure.
154904007ebaSmrg#
155004007ebaSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
155104007ebaSmrg#
155204007ebaSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
155304007ebaSmrg#
155404007ebaSmrg# LICENSE
155504007ebaSmrg#
155604007ebaSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
155704007ebaSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
155804007ebaSmrg#   Copyright (c) 2009 Matteo Frigo
155904007ebaSmrg#
156004007ebaSmrg#   This program is free software: you can redistribute it and/or modify it
156104007ebaSmrg#   under the terms of the GNU General Public License as published by the
156204007ebaSmrg#   Free Software Foundation, either version 3 of the License, or (at your
156304007ebaSmrg#   option) any later version.
156404007ebaSmrg#
156504007ebaSmrg#   This program is distributed in the hope that it will be useful, but
156604007ebaSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
156704007ebaSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
156804007ebaSmrg#   Public License for more details.
156904007ebaSmrg#
157004007ebaSmrg#   You should have received a copy of the GNU General Public License along
157104007ebaSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
157204007ebaSmrg#
157304007ebaSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
157404007ebaSmrg#   gives unlimited permission to copy, distribute and modify the configure
157504007ebaSmrg#   scripts that are the output of Autoconf when processing the Macro. You
157604007ebaSmrg#   need not follow the terms of the GNU General Public License when using
157704007ebaSmrg#   or distributing such scripts, even though portions of the text of the
157804007ebaSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
157904007ebaSmrg#   all other use of the material that constitutes the Autoconf Macro.
158004007ebaSmrg#
158104007ebaSmrg#   This special exception to the GPL applies to versions of the Autoconf
158204007ebaSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
158304007ebaSmrg#   modified version of the Autoconf Macro, you may extend this special
158404007ebaSmrg#   exception to the GPL to apply to your modified version as well.#
158504007ebaSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
158604007ebaSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
158704007ebaSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
158804007ebaSmrgAS_LITERAL_IF([$1],
158904007ebaSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
159004007ebaSmrg      ax_save_FLAGS=$LDFLAGS
159104007ebaSmrg      LDFLAGS="$1"
159204007ebaSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
159304007ebaSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
159404007ebaSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
159504007ebaSmrg      LDFLAGS=$ax_save_FLAGS])],
159604007ebaSmrg  [ax_save_FLAGS=$LDFLAGS
159704007ebaSmrg   LDFLAGS="$1"
159804007ebaSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
159904007ebaSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
160004007ebaSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
160104007ebaSmrg   LDFLAGS=$ax_save_FLAGS])
160204007ebaSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
160304007ebaSmrgAC_MSG_RESULT($xorg_check_linker_flags)
160404007ebaSmrgif test "x$xorg_check_linker_flags" = xyes; then
160504007ebaSmrg	m4_default([$2], :)
160604007ebaSmrgelse
160704007ebaSmrg	m4_default([$3], :)
160804007ebaSmrgfi
160904007ebaSmrg]) # XORG_CHECK_LINKER_FLAGS
161004007ebaSmrg
161104007ebaSmrg# XORG_MEMORY_CHECK_FLAGS
161204007ebaSmrg# -----------------------
161304007ebaSmrg# Minimum version: 1.16.0
161404007ebaSmrg#
161504007ebaSmrg# This macro attempts to find appropriate memory checking functionality
161604007ebaSmrg# for various platforms which unit testing code may use to catch various
161704007ebaSmrg# forms of memory allocation and access errors in testing.
161804007ebaSmrg#
161904007ebaSmrg# Interface to module:
162004007ebaSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
162104007ebaSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162204007ebaSmrg#
162304007ebaSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162404007ebaSmrg#
162504007ebaSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
162604007ebaSmrg
162704007ebaSmrgAC_REQUIRE([AC_CANONICAL_HOST])
162804007ebaSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
162904007ebaSmrg           [Environment variables to enable memory checking in tests])
163004007ebaSmrg
163104007ebaSmrg# Check for different types of support on different platforms
163204007ebaSmrgcase $host_os in
163304007ebaSmrg    solaris*)
163404007ebaSmrg        AC_CHECK_LIB([umem], [umem_alloc],
163504007ebaSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
163604007ebaSmrg        ;;
163704007ebaSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
163804007ebaSmrg        # both directly and inverted, so should not be 0 or 255.
163904007ebaSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
164004007ebaSmrg        ;;
164104007ebaSmrg    darwin*)
164204007ebaSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
164304007ebaSmrg        ;;
164404007ebaSmrg    *bsd*)
164504007ebaSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
164604007ebaSmrg        ;;
164704007ebaSmrgesac
164804007ebaSmrg
164904007ebaSmrg# User supplied flags override default flags
165004007ebaSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
165104007ebaSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
165204007ebaSmrgfi
165304007ebaSmrg
165404007ebaSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
165504007ebaSmrg]) # XORG_WITH_LINT
165604007ebaSmrg
1657f29dbc25Smrg# XORG_CHECK_MALLOC_ZERO
1658f29dbc25Smrg# ----------------------
1659f29dbc25Smrg# Minimum version: 1.0.0
1660f29dbc25Smrg#
1661f29dbc25Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1662f29dbc25Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1663f29dbc25Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1664f29dbc25SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1665f29dbc25SmrgAC_ARG_ENABLE(malloc0returnsnull,
1666f29dbc25Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1667f29dbc25Smrg		       [malloc(0) returns NULL (default: auto)]),
1668f29dbc25Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1669f29dbc25Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1670f29dbc25Smrg
1671f29dbc25SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1672f29dbc25Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16737f419768SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16747f419768Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
167504007ebaSmrg#include <stdlib.h>
167604007ebaSmrg],[
1677f29dbc25Smrg    char *m0, *r0, *c0, *p;
1678f29dbc25Smrg    m0 = malloc(0);
1679f29dbc25Smrg    p = malloc(10);
1680f29dbc25Smrg    r0 = realloc(p,0);
168104007ebaSmrg    c0 = calloc(0,10);
168204007ebaSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
168304007ebaSmrg])],
16847f419768Smrg		[xorg_cv_malloc0_returns_null=yes],
16857f419768Smrg		[xorg_cv_malloc0_returns_null=no])])
16867f419768SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1687f29dbc25Smrgfi
1688f29dbc25SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1689f29dbc25Smrg
1690f29dbc25Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1691f29dbc25Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1692f29dbc25Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1693f29dbc25Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1694f29dbc25Smrgelse
1695f29dbc25Smrg	MALLOC_ZERO_CFLAGS=""
1696f29dbc25Smrg	XMALLOC_ZERO_CFLAGS=""
1697f29dbc25Smrg	XTMALLOC_ZERO_CFLAGS=""
1698f29dbc25Smrgfi
1699f29dbc25Smrg
1700f29dbc25SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1701f29dbc25SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1702f29dbc25SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1703f29dbc25Smrg]) # XORG_CHECK_MALLOC_ZERO
1704f29dbc25Smrg
1705f29dbc25Smrg# XORG_WITH_LINT()
1706f29dbc25Smrg# ----------------
1707f29dbc25Smrg# Minimum version: 1.1.0
1708f29dbc25Smrg#
1709170d5fdcSmrg# This macro enables the use of a tool that flags some suspicious and
1710170d5fdcSmrg# non-portable constructs (likely to be bugs) in C language source code.
1711170d5fdcSmrg# It will attempt to locate the tool and use appropriate options.
1712170d5fdcSmrg# There are various lint type tools on different platforms.
1713170d5fdcSmrg#
1714170d5fdcSmrg# Interface to module:
1715170d5fdcSmrg# LINT:		returns the path to the tool found on the platform
1716170d5fdcSmrg#		or the value set to LINT on the configure cmd line
1717170d5fdcSmrg#		also an Automake conditional
1718170d5fdcSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1719170d5fdcSmrg#
1720170d5fdcSmrg# --with-lint:	'yes' user instructs the module to use lint
1721170d5fdcSmrg#		'no' user instructs the module not to use lint (default)
1722170d5fdcSmrg#
1723170d5fdcSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1724170d5fdcSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1725f29dbc25Smrg#
1726f29dbc25SmrgAC_DEFUN([XORG_WITH_LINT],[
1727f29dbc25Smrg
1728170d5fdcSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1729170d5fdcSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1730f29dbc25SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1731f29dbc25Smrg		[Use a lint-style source code checker (default: disabled)])],
1732f29dbc25Smrg		[use_lint=$withval], [use_lint=no])
1733170d5fdcSmrg
1734170d5fdcSmrg# Obtain platform specific info like program name and options
1735170d5fdcSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1736170d5fdcSmrgcase $host_os in
1737170d5fdcSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1738170d5fdcSmrg	lint_name=splint
1739170d5fdcSmrg	lint_options="-badflag"
1740170d5fdcSmrg	;;
1741170d5fdcSmrg  *freebsd* | *netbsd*)
1742170d5fdcSmrg	lint_name=lint
1743170d5fdcSmrg	lint_options="-u -b"
1744170d5fdcSmrg	;;
1745170d5fdcSmrg  *solaris*)
1746170d5fdcSmrg	lint_name=lint
1747170d5fdcSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1748170d5fdcSmrg	;;
1749170d5fdcSmrgesac
1750170d5fdcSmrg
1751170d5fdcSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1752170d5fdcSmrgif test "x$use_lint" = x"yes" ; then
1753170d5fdcSmrg   AC_PATH_PROG([LINT], [$lint_name])
1754170d5fdcSmrg   if test "x$LINT" = "x"; then
1755170d5fdcSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1756170d5fdcSmrg   fi
1757170d5fdcSmrgelif test "x$use_lint" = x"no" ; then
1758170d5fdcSmrg   if test "x$LINT" != "x"; then
1759170d5fdcSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1760170d5fdcSmrg   fi
1761f29dbc25Smrgelse
1762170d5fdcSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1763f29dbc25Smrgfi
1764170d5fdcSmrg
1765170d5fdcSmrg# User supplied flags override default flags
1766170d5fdcSmrgif test "x$LINT_FLAGS" != "x"; then
1767170d5fdcSmrg   lint_options=$LINT_FLAGS
1768f29dbc25Smrgfi
1769f29dbc25Smrg
1770170d5fdcSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1771170d5fdcSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1772f29dbc25Smrg
1773f29dbc25Smrg]) # XORG_WITH_LINT
1774f29dbc25Smrg
1775f29dbc25Smrg# XORG_LINT_LIBRARY(LIBNAME)
1776f29dbc25Smrg# --------------------------
1777f29dbc25Smrg# Minimum version: 1.1.0
1778f29dbc25Smrg#
1779f29dbc25Smrg# Sets up flags for building lint libraries for checking programs that call
1780f29dbc25Smrg# functions in the library.
1781f29dbc25Smrg#
1782170d5fdcSmrg# Interface to module:
1783170d5fdcSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1784170d5fdcSmrg# MAKE_LINT_LIB		- Automake conditional
1785170d5fdcSmrg#
1786170d5fdcSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1787170d5fdcSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1788f29dbc25Smrg
1789f29dbc25SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1790f29dbc25SmrgAC_REQUIRE([XORG_WITH_LINT])
1791f29dbc25SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1792f29dbc25Smrg	[Create lint library (default: disabled)])],
1793f29dbc25Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1794170d5fdcSmrg
1795170d5fdcSmrgif test "x$make_lint_lib" = x"yes" ; then
1796170d5fdcSmrg   LINTLIB=llib-l$1.ln
1797170d5fdcSmrg   if test "x$LINT" = "x"; then
1798170d5fdcSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1799170d5fdcSmrg   fi
1800170d5fdcSmrgelif test "x$make_lint_lib" != x"no" ; then
1801170d5fdcSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1802f29dbc25Smrgfi
1803170d5fdcSmrg
1804f29dbc25SmrgAC_SUBST(LINTLIB)
1805f29dbc25SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1806f29dbc25Smrg
1807f29dbc25Smrg]) # XORG_LINT_LIBRARY
1808f29dbc25Smrg
180904007ebaSmrg# XORG_COMPILER_BRAND
181004007ebaSmrg# -------------------
181104007ebaSmrg# Minimum version: 1.14.0
181204007ebaSmrg#
181304007ebaSmrg# Checks for various brands of compilers and sets flags as appropriate:
181404007ebaSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
181504007ebaSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
181604007ebaSmrg#   clang compiler - sets CLANGCC to "yes"
181704007ebaSmrg#   Intel compiler - sets INTELCC to "yes"
181804007ebaSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
181904007ebaSmrg#
182004007ebaSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
182104007ebaSmrgAC_LANG_CASE(
182204007ebaSmrg	[C], [
182304007ebaSmrg		AC_REQUIRE([AC_PROG_CC_C99])
182404007ebaSmrg	],
182504007ebaSmrg	[C++], [
182604007ebaSmrg		AC_REQUIRE([AC_PROG_CXX])
182704007ebaSmrg	]
182804007ebaSmrg)
182904007ebaSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
183004007ebaSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
183104007ebaSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
183204007ebaSmrg]) # XORG_COMPILER_BRAND
183304007ebaSmrg
183404007ebaSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
183504007ebaSmrg# ---------------
183604007ebaSmrg# Minimum version: 1.16.0
183704007ebaSmrg#
183804007ebaSmrg# Test if the compiler works when passed the given flag as a command line argument.
183904007ebaSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
184004007ebaSmrg# next flag in the list until there are no more options.
184104007ebaSmrg#
184204007ebaSmrg# Note that this does not guarantee that the compiler supports the flag as some
184304007ebaSmrg# compilers will simply ignore arguments that they do not understand, but we do
184404007ebaSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
184504007ebaSmrg# -Werror=unused-command-line-argument
184604007ebaSmrg#
184704007ebaSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
184804007ebaSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
184904007ebaSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185004007ebaSmrg
185104007ebaSmrgAC_LANG_COMPILER_REQUIRE
185204007ebaSmrg
185304007ebaSmrgAC_LANG_CASE(
185404007ebaSmrg	[C], [
185504007ebaSmrg		AC_REQUIRE([AC_PROG_CC_C99])
185604007ebaSmrg		define([PREFIX], [C])
185704007ebaSmrg		define([CACHE_PREFIX], [cc])
185804007ebaSmrg		define([COMPILER], [$CC])
185904007ebaSmrg	],
186004007ebaSmrg	[C++], [
186104007ebaSmrg		define([PREFIX], [CXX])
186204007ebaSmrg		define([CACHE_PREFIX], [cxx])
186304007ebaSmrg		define([COMPILER], [$CXX])
186404007ebaSmrg	]
186504007ebaSmrg)
186604007ebaSmrg
186704007ebaSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
186804007ebaSmrg
186904007ebaSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
187004007ebaSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
187104007ebaSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
187204007ebaSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
187304007ebaSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
187404007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
187504007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
187604007ebaSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
187704007ebaSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
187804007ebaSmrgfi
187904007ebaSmrg
188004007ebaSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
188104007ebaSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
188204007ebaSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
188304007ebaSmrg	fi
188404007ebaSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
188504007ebaSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
188604007ebaSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
188704007ebaSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
188804007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
188904007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
189004007ebaSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
189104007ebaSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189204007ebaSmrgfi
189304007ebaSmrg
189404007ebaSmrgfound="no"
189504007ebaSmrgm4_foreach([flag], m4_cdr($@), [
189604007ebaSmrg	if test $found = "no" ; then
189704007ebaSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
189804007ebaSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
189904007ebaSmrg		fi
190004007ebaSmrg
190104007ebaSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
190204007ebaSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
190304007ebaSmrg		fi
190404007ebaSmrg
190504007ebaSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
190604007ebaSmrg
190704007ebaSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
190804007ebaSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
190904007ebaSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
191004007ebaSmrg		AC_CACHE_VAL($cacheid,
191104007ebaSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
191204007ebaSmrg					     [eval $cacheid=yes],
191304007ebaSmrg					     [eval $cacheid=no])])
191404007ebaSmrg
191504007ebaSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
191604007ebaSmrg
191704007ebaSmrg		eval supported=\$$cacheid
191804007ebaSmrg		AC_MSG_RESULT([$supported])
191904007ebaSmrg		if test "$supported" = "yes" ; then
192004007ebaSmrg			$1="$$1 ]flag["
192104007ebaSmrg			found="yes"
192204007ebaSmrg		fi
192304007ebaSmrg	fi
192404007ebaSmrg])
192504007ebaSmrg]) # XORG_TESTSET_CFLAG
192604007ebaSmrg
192704007ebaSmrg# XORG_COMPILER_FLAGS
192804007ebaSmrg# ---------------
192904007ebaSmrg# Minimum version: 1.16.0
193004007ebaSmrg#
193104007ebaSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
193204007ebaSmrg# arguments supported by the selected compiler which do NOT alter the generated
193304007ebaSmrg# code.  These arguments will cause the compiler to print various warnings
193404007ebaSmrg# during compilation AND turn a conservative set of warnings into errors.
193504007ebaSmrg#
193604007ebaSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
193704007ebaSmrg# future versions of util-macros as options are added to new compilers.
193804007ebaSmrg#
193904007ebaSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
194004007ebaSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
194104007ebaSmrg
194204007ebaSmrgAC_ARG_ENABLE(selective-werror,
194304007ebaSmrg              AS_HELP_STRING([--disable-selective-werror],
194404007ebaSmrg                             [Turn off selective compiler errors. (default: enabled)]),
194504007ebaSmrg              [SELECTIVE_WERROR=$enableval],
194604007ebaSmrg              [SELECTIVE_WERROR=yes])
194704007ebaSmrg
194804007ebaSmrgAC_LANG_CASE(
194904007ebaSmrg        [C], [
195004007ebaSmrg                define([PREFIX], [C])
195104007ebaSmrg        ],
195204007ebaSmrg        [C++], [
195304007ebaSmrg                define([PREFIX], [CXX])
195404007ebaSmrg        ]
195504007ebaSmrg)
195604007ebaSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
195704007ebaSmrgif test "x$SUNCC" = "xyes"; then
195804007ebaSmrg    [BASE_]PREFIX[FLAGS]="-v"
195904007ebaSmrgelse
196004007ebaSmrg    [BASE_]PREFIX[FLAGS]=""
196104007ebaSmrgfi
196204007ebaSmrg
196304007ebaSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
196404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
196504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
196604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
196704007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
196804007ebaSmrg
196904007ebaSmrgAC_LANG_CASE(
197004007ebaSmrg	[C], [
197104007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
197204007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
197304007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
197404007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19757f419768Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
197604007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
197704007ebaSmrg	]
197804007ebaSmrg)
197904007ebaSmrg
198004007ebaSmrg# This chunk adds additional warnings that could catch undesired effects.
198104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
198204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
198304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
198404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
198504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
198604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19877f419768SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
198804007ebaSmrg
198904007ebaSmrg# These are currently disabled because they are noisy.  They will be enabled
199004007ebaSmrg# in the future once the codebase is sufficiently modernized to silence
199104007ebaSmrg# them.  For now, I don't want them to drown out the other warnings.
199204007ebaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
199304007ebaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19947f419768Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
199504007ebaSmrg
199604007ebaSmrg# Turn some warnings into errors, so we don't accidently get successful builds
199704007ebaSmrg# when there are problems that should be fixed.
199804007ebaSmrg
199904007ebaSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
200004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
200104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
200204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
200304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
200404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
200504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
200604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
200704007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
200804007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
200904007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
201004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
201104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
201204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201304007ebaSmrgelse
201404007ebaSmrgAC_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])
201504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
201604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
201704007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
201804007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
201904007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
202004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
202104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
202204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
202304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
202404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
202504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
202604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
202704007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
202804007ebaSmrgfi
202904007ebaSmrg
203004007ebaSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203104007ebaSmrg]) # XORG_COMPILER_FLAGS
203204007ebaSmrg
2033f29dbc25Smrg# XORG_CWARNFLAGS
2034f29dbc25Smrg# ---------------
2035f29dbc25Smrg# Minimum version: 1.2.0
203604007ebaSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2037f29dbc25Smrg#
2038f29dbc25Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2039f29dbc25Smrg#
204004007ebaSmrg# This function is deprecated because it defines -fno-strict-aliasing
204104007ebaSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
204204007ebaSmrg# is needed, then it should be added explicitly in the module when
204304007ebaSmrg# it is updated to use BASE_CFLAGS.
204404007ebaSmrg#
2045f29dbc25SmrgAC_DEFUN([XORG_CWARNFLAGS], [
204604007ebaSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
204704007ebaSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
204804007ebaSmrgAC_LANG_CASE(
204904007ebaSmrg	[C], [
205004007ebaSmrg		CWARNFLAGS="$BASE_CFLAGS"
205104007ebaSmrg		if  test "x$GCC" = xyes ; then
205204007ebaSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
205304007ebaSmrg		fi
205404007ebaSmrg		AC_SUBST(CWARNFLAGS)
205504007ebaSmrg	]
205604007ebaSmrg)
2057f29dbc25Smrg]) # XORG_CWARNFLAGS
2058f29dbc25Smrg
2059f29dbc25Smrg# XORG_STRICT_OPTION
2060f29dbc25Smrg# -----------------------
2061f29dbc25Smrg# Minimum version: 1.3.0
2062f29dbc25Smrg#
206304007ebaSmrg# Add configure option to enable strict compilation flags, such as treating
206404007ebaSmrg# warnings as fatal errors.
206504007ebaSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
206604007ebaSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
206704007ebaSmrg#
206804007ebaSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
206904007ebaSmrg# when strict compilation is unconditionally desired.
2070f29dbc25SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2071f29dbc25SmrgAC_REQUIRE([XORG_CWARNFLAGS])
207204007ebaSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2073f29dbc25Smrg
2074f29dbc25SmrgAC_ARG_ENABLE(strict-compilation,
2075f29dbc25Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2076f29dbc25Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2077f29dbc25Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
207804007ebaSmrg
207904007ebaSmrgAC_LANG_CASE(
208004007ebaSmrg        [C], [
208104007ebaSmrg                define([PREFIX], [C])
208204007ebaSmrg        ],
208304007ebaSmrg        [C++], [
208404007ebaSmrg                define([PREFIX], [CXX])
208504007ebaSmrg        ]
208604007ebaSmrg)
208704007ebaSmrg
208804007ebaSmrg[STRICT_]PREFIX[FLAGS]=""
208904007ebaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
209004007ebaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209104007ebaSmrg
209204007ebaSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
209304007ebaSmrg# activate it with -Werror, so we add it here explicitly.
209404007ebaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209504007ebaSmrg
2096f29dbc25Smrgif test "x$STRICT_COMPILE" = "xyes"; then
209704007ebaSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
209804007ebaSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2099f29dbc25Smrgfi
210004007ebaSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
210104007ebaSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
210204007ebaSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2103f29dbc25Smrg]) # XORG_STRICT_OPTION
2104f29dbc25Smrg
2105f29dbc25Smrg# XORG_DEFAULT_OPTIONS
2106f29dbc25Smrg# --------------------
2107f29dbc25Smrg# Minimum version: 1.3.0
2108f29dbc25Smrg#
2109f29dbc25Smrg# Defines default options for X.Org modules.
2110f29dbc25Smrg#
2111f29dbc25SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2112170d5fdcSmrgAC_REQUIRE([AC_PROG_INSTALL])
211304007ebaSmrgXORG_COMPILER_FLAGS
2114f29dbc25SmrgXORG_CWARNFLAGS
2115f29dbc25SmrgXORG_STRICT_OPTION
2116f29dbc25SmrgXORG_RELEASE_VERSION
2117f29dbc25SmrgXORG_CHANGELOG
2118f29dbc25SmrgXORG_INSTALL
2119f29dbc25SmrgXORG_MANPAGE_SECTIONS
2120170d5fdcSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2121170d5fdcSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2122f29dbc25Smrg]) # XORG_DEFAULT_OPTIONS
2123f29dbc25Smrg
2124f29dbc25Smrg# XORG_INSTALL()
2125f29dbc25Smrg# ----------------
2126f29dbc25Smrg# Minimum version: 1.4.0
2127f29dbc25Smrg#
2128f29dbc25Smrg# Defines the variable INSTALL_CMD as the command to copy
2129f29dbc25Smrg# INSTALL from $prefix/share/util-macros.
2130f29dbc25Smrg#
2131f29dbc25SmrgAC_DEFUN([XORG_INSTALL], [
2132f29dbc25SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2133f29dbc25Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2134f29dbc25SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2135f29dbc25Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2136f29dbc25Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2137f29dbc25Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2138f29dbc25SmrgAC_SUBST([INSTALL_CMD])
2139f29dbc25Smrg]) # XORG_INSTALL
2140f29dbc25Smrgdnl Copyright 2005 Red Hat, Inc
2141f29dbc25Smrgdnl
2142f29dbc25Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2143f29dbc25Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2144f29dbc25Smrgdnl the above copyright notice appear in all copies and that both that
2145f29dbc25Smrgdnl copyright notice and this permission notice appear in supporting
2146f29dbc25Smrgdnl documentation.
2147f29dbc25Smrgdnl
2148f29dbc25Smrgdnl The above copyright notice and this permission notice shall be included
2149f29dbc25Smrgdnl in all copies or substantial portions of the Software.
2150f29dbc25Smrgdnl
2151f29dbc25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2152f29dbc25Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2153f29dbc25Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2154f29dbc25Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2155f29dbc25Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2156f29dbc25Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2157f29dbc25Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2158f29dbc25Smrgdnl
2159f29dbc25Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2160f29dbc25Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2161f29dbc25Smrgdnl other dealings in this Software without prior written authorization
2162f29dbc25Smrgdnl from the copyright holders.
2163f29dbc25Smrgdnl
2164f29dbc25Smrg
2165f29dbc25Smrg# XORG_RELEASE_VERSION
2166f29dbc25Smrg# --------------------
2167170d5fdcSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
216804007ebaSmrg
2169f29dbc25SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2170f29dbc25Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2171f29dbc25Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2172f29dbc25Smrg		[Major version of this package])
2173f29dbc25Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2174f29dbc25Smrg	if test "x$PVM" = "x"; then
2175f29dbc25Smrg		PVM="0"
2176f29dbc25Smrg	fi
2177f29dbc25Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2178f29dbc25Smrg		[$PVM],
2179f29dbc25Smrg		[Minor version of this package])
2180f29dbc25Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2181f29dbc25Smrg	if test "x$PVP" = "x"; then
2182f29dbc25Smrg		PVP="0"
2183f29dbc25Smrg	fi
2184f29dbc25Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2185f29dbc25Smrg		[$PVP],
2186f29dbc25Smrg		[Patch version of this package])
2187f29dbc25Smrg])
2188f29dbc25Smrg
2189f29dbc25Smrg# XORG_CHANGELOG()
2190f29dbc25Smrg# ----------------
2191f29dbc25Smrg# Minimum version: 1.2.0
2192f29dbc25Smrg#
2193f29dbc25Smrg# Defines the variable CHANGELOG_CMD as the command to generate
2194f29dbc25Smrg# ChangeLog from git.
2195f29dbc25Smrg#
2196f29dbc25Smrg#
2197f29dbc25SmrgAC_DEFUN([XORG_CHANGELOG], [
2198f29dbc25SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2199f29dbc25Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2200f29dbc25Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2201f29dbc25Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2202f29dbc25SmrgAC_SUBST([CHANGELOG_CMD])
2203f29dbc25Smrg]) # XORG_CHANGELOG
2204f29dbc25Smrg
2205f29dbc25Smrgdnl Copyright 2005 Red Hat, Inc
2206f29dbc25Smrgdnl 
2207f29dbc25Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2208f29dbc25Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2209f29dbc25Smrgdnl the above copyright notice appear in all copies and that both that
2210f29dbc25Smrgdnl copyright notice and this permission notice appear in supporting
2211f29dbc25Smrgdnl documentation.
2212f29dbc25Smrgdnl 
2213f29dbc25Smrgdnl The above copyright notice and this permission notice shall be included
2214f29dbc25Smrgdnl in all copies or substantial portions of the Software.
2215f29dbc25Smrgdnl 
2216f29dbc25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2217f29dbc25Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2218f29dbc25Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2219f29dbc25Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2220f29dbc25Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2221f29dbc25Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2222f29dbc25Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2223f29dbc25Smrgdnl 
2224f29dbc25Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2225f29dbc25Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2226f29dbc25Smrgdnl other dealings in this Software without prior written authorization
2227f29dbc25Smrgdnl from the copyright holders.
2228f29dbc25Smrgdnl 
2229f29dbc25Smrg
223004007ebaSmrg# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2231f29dbc25Smrg# --------------------------
223204007ebaSmrg# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
223304007ebaSmrg# is defined, then add the given PROTO to $REQUIRED_MODULES.
2234f29dbc25Smrg
2235f29dbc25SmrgAC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2236f29dbc25Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2237f29dbc25Smrg	SAVE_CFLAGS="$CFLAGS"
2238f29dbc25Smrg	CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`"
2239f29dbc25Smrg	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2240f29dbc25Smrg#include "xorg-server.h"
2241f29dbc25Smrg#if !defined $1
2242f29dbc25Smrg#error $1 not defined
2243f29dbc25Smrg#endif
2244f29dbc25Smrg		]])],
2245f29dbc25Smrg		[_EXT_CHECK=yes],
2246f29dbc25Smrg		[_EXT_CHECK=no])
2247f29dbc25Smrg	CFLAGS="$SAVE_CFLAGS"
2248f29dbc25Smrg	AC_MSG_CHECKING([if $1 is defined])
2249f29dbc25Smrg	AC_MSG_RESULT([$_EXT_CHECK])
2250f29dbc25Smrg	if test "$_EXT_CHECK" != no; then
2251f29dbc25Smrg		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2252f29dbc25Smrg	fi
2253f29dbc25Smrg])
2254f29dbc25Smrg
225505cf1079Smrg# Copyright (C) 2002-2018 Free Software Foundation, Inc.
2256f29dbc25Smrg#
2257f29dbc25Smrg# This file is free software; the Free Software Foundation
2258f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2259f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2260f29dbc25Smrg
2261f29dbc25Smrg# AM_AUTOMAKE_VERSION(VERSION)
2262f29dbc25Smrg# ----------------------------
2263f29dbc25Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2264f29dbc25Smrg# generated from the m4 files accompanying Automake X.Y.
2265f29dbc25Smrg# (This private macro should not be called outside this file.)
2266f29dbc25SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
226705cf1079Smrg[am__api_version='1.16'
2268f29dbc25Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2269f29dbc25Smrgdnl require some minimum version.  Point them to the right macro.
227005cf1079Smrgm4_if([$1], [1.16.1], [],
2271f29dbc25Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2272f29dbc25Smrg])
2273f29dbc25Smrg
2274f29dbc25Smrg# _AM_AUTOCONF_VERSION(VERSION)
2275f29dbc25Smrg# -----------------------------
2276f29dbc25Smrg# aclocal traces this macro to find the Autoconf version.
2277f29dbc25Smrg# This is a private macro too.  Using m4_define simplifies
2278f29dbc25Smrg# the logic in aclocal, which can simply ignore this definition.
2279f29dbc25Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2280f29dbc25Smrg
2281f29dbc25Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2282f29dbc25Smrg# -------------------------------
2283f29dbc25Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2284f29dbc25Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2285f29dbc25SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
228605cf1079Smrg[AM_AUTOMAKE_VERSION([1.16.1])dnl
2287f29dbc25Smrgm4_ifndef([AC_AUTOCONF_VERSION],
2288f29dbc25Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2289f29dbc25Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2290f29dbc25Smrg
2291f29dbc25Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2292f29dbc25Smrg
229305cf1079Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2294f29dbc25Smrg#
2295f29dbc25Smrg# This file is free software; the Free Software Foundation
2296f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2297f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2298f29dbc25Smrg
2299f29dbc25Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
230004007ebaSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
230104007ebaSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2302f29dbc25Smrg#
2303f29dbc25Smrg# Of course, Automake must honor this variable whenever it calls a
2304f29dbc25Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2305f29dbc25Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2306f29dbc25Smrg# depending on how configure is run.  This is pretty annoying, since
2307f29dbc25Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2308f29dbc25Smrg# source directory, any form will work fine, but in subdirectories a
2309f29dbc25Smrg# relative path needs to be adjusted first.
2310f29dbc25Smrg#
2311f29dbc25Smrg# $ac_aux_dir/missing
2312f29dbc25Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2313f29dbc25Smrg# $top_srcdir/$ac_aux_dir/missing
2314f29dbc25Smrg#    fails if $ac_aux_dir is absolute,
2315f29dbc25Smrg#    fails when called from a subdirectory in a VPATH build with
2316f29dbc25Smrg#          a relative $ac_aux_dir
2317f29dbc25Smrg#
2318f29dbc25Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2319f29dbc25Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
232004007ebaSmrg# harmless because $srcdir is '.', but things will broke when you
2321f29dbc25Smrg# start a VPATH build or use an absolute $srcdir.
2322f29dbc25Smrg#
2323f29dbc25Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2324f29dbc25Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2325f29dbc25Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2326f29dbc25Smrg# and then we would define $MISSING as
2327f29dbc25Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2328f29dbc25Smrg# This will work as long as MISSING is not called from configure, because
2329f29dbc25Smrg# unfortunately $(top_srcdir) has no meaning in configure.
2330f29dbc25Smrg# However there are other variables, like CC, which are often used in
2331f29dbc25Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2332f29dbc25Smrg#
2333f29dbc25Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
2334f29dbc25Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
2335f29dbc25Smrg# configured tree to be moved without reconfiguration.
2336f29dbc25Smrg
2337f29dbc25SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23387f419768Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23397f419768Smrg# Expand $ac_aux_dir to an absolute path.
23407f419768Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
2341f29dbc25Smrg])
2342f29dbc25Smrg
2343f29dbc25Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2344f29dbc25Smrg
234505cf1079Smrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
2346f29dbc25Smrg#
2347f29dbc25Smrg# This file is free software; the Free Software Foundation
2348f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2349f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2350f29dbc25Smrg
2351f29dbc25Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2352f29dbc25Smrg# -------------------------------------
2353f29dbc25Smrg# Define a conditional.
2354f29dbc25SmrgAC_DEFUN([AM_CONDITIONAL],
235504007ebaSmrg[AC_PREREQ([2.52])dnl
235604007ebaSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
235704007ebaSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2358f29dbc25SmrgAC_SUBST([$1_TRUE])dnl
2359f29dbc25SmrgAC_SUBST([$1_FALSE])dnl
2360f29dbc25Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2361f29dbc25Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2362f29dbc25Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2363f29dbc25Smrgif $2; then
2364f29dbc25Smrg  $1_TRUE=
2365f29dbc25Smrg  $1_FALSE='#'
2366f29dbc25Smrgelse
2367f29dbc25Smrg  $1_TRUE='#'
2368f29dbc25Smrg  $1_FALSE=
2369f29dbc25Smrgfi
2370f29dbc25SmrgAC_CONFIG_COMMANDS_PRE(
2371f29dbc25Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2372f29dbc25Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2373f29dbc25SmrgUsually this means the macro was only invoked conditionally.]])
2374f29dbc25Smrgfi])])
2375f29dbc25Smrg
237605cf1079Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2377f29dbc25Smrg#
2378f29dbc25Smrg# This file is free software; the Free Software Foundation
2379f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2380f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2381f29dbc25Smrg
2382f29dbc25Smrg
238304007ebaSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2384f29dbc25Smrg# written in clear, in which case automake, when reading aclocal.m4,
2385f29dbc25Smrg# will think it sees a *use*, and therefore will trigger all it's
2386f29dbc25Smrg# C support machinery.  Also note that it means that autoscan, seeing
2387f29dbc25Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2388f29dbc25Smrg
2389f29dbc25Smrg
2390f29dbc25Smrg# _AM_DEPENDENCIES(NAME)
2391f29dbc25Smrg# ----------------------
2392f29dbc25Smrg# See how the compiler implements dependency checking.
239304007ebaSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2394f29dbc25Smrg# We try a few techniques and use that to set a single cache variable.
2395f29dbc25Smrg#
2396f29dbc25Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2397f29dbc25Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2398f29dbc25Smrg# dependency, and given that the user is not expected to run this macro,
2399f29dbc25Smrg# just rely on AC_PROG_CC.
2400f29dbc25SmrgAC_DEFUN([_AM_DEPENDENCIES],
2401f29dbc25Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2402f29dbc25SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2403f29dbc25SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2404f29dbc25SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2405f29dbc25Smrg
240604007ebaSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
240704007ebaSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
240804007ebaSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
240904007ebaSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
241004007ebaSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
241104007ebaSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
241204007ebaSmrg                    [depcc="$$1"   am_compiler_list=])
2413f29dbc25Smrg
2414f29dbc25SmrgAC_CACHE_CHECK([dependency style of $depcc],
2415f29dbc25Smrg               [am_cv_$1_dependencies_compiler_type],
2416f29dbc25Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2417f29dbc25Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
2418f29dbc25Smrg  # making bogus files that we don't know about and never remove.  For
2419f29dbc25Smrg  # instance it was reported that on HP-UX the gcc test will end up
242004007ebaSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
242104007ebaSmrg  # in D".
242204007ebaSmrg  rm -rf conftest.dir
2423f29dbc25Smrg  mkdir conftest.dir
2424f29dbc25Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2425f29dbc25Smrg  # using a relative directory.
2426f29dbc25Smrg  cp "$am_depcomp" conftest.dir
2427f29dbc25Smrg  cd conftest.dir
2428f29dbc25Smrg  # We will build objects and dependencies in a subdirectory because
2429f29dbc25Smrg  # it helps to detect inapplicable dependency modes.  For instance
2430f29dbc25Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2431f29dbc25Smrg  # side effect of compilation, but ICC will put the dependencies in
2432f29dbc25Smrg  # the current directory while Tru64 will put them in the object
2433f29dbc25Smrg  # directory.
2434f29dbc25Smrg  mkdir sub
2435f29dbc25Smrg
2436f29dbc25Smrg  am_cv_$1_dependencies_compiler_type=none
2437f29dbc25Smrg  if test "$am_compiler_list" = ""; then
2438f29dbc25Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2439f29dbc25Smrg  fi
2440f29dbc25Smrg  am__universal=false
2441f29dbc25Smrg  m4_case([$1], [CC],
2442f29dbc25Smrg    [case " $depcc " in #(
2443f29dbc25Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2444f29dbc25Smrg     esac],
2445f29dbc25Smrg    [CXX],
2446f29dbc25Smrg    [case " $depcc " in #(
2447f29dbc25Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2448f29dbc25Smrg     esac])
2449f29dbc25Smrg
2450f29dbc25Smrg  for depmode in $am_compiler_list; do
2451f29dbc25Smrg    # Setup a source with many dependencies, because some compilers
2452f29dbc25Smrg    # like to wrap large dependency lists on column 80 (with \), and
2453f29dbc25Smrg    # we should not choose a depcomp mode which is confused by this.
2454f29dbc25Smrg    #
2455f29dbc25Smrg    # We need to recreate these files for each test, as the compiler may
2456f29dbc25Smrg    # overwrite some of them when testing with obscure command lines.
2457f29dbc25Smrg    # This happens at least with the AIX C compiler.
2458f29dbc25Smrg    : > sub/conftest.c
2459f29dbc25Smrg    for i in 1 2 3 4 5 6; do
2460f29dbc25Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
246104007ebaSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
246204007ebaSmrg      # Solaris 10 /bin/sh.
246304007ebaSmrg      echo '/* dummy */' > sub/conftst$i.h
2464f29dbc25Smrg    done
2465f29dbc25Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2466f29dbc25Smrg
246704007ebaSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2468f29dbc25Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
246904007ebaSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
247004007ebaSmrg    # versions had trouble with output in subdirs.
2471f29dbc25Smrg    am__obj=sub/conftest.${OBJEXT-o}
2472f29dbc25Smrg    am__minus_obj="-o $am__obj"
2473f29dbc25Smrg    case $depmode in
2474f29dbc25Smrg    gcc)
2475f29dbc25Smrg      # This depmode causes a compiler race in universal mode.
2476f29dbc25Smrg      test "$am__universal" = false || continue
2477f29dbc25Smrg      ;;
2478f29dbc25Smrg    nosideeffect)
247904007ebaSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248004007ebaSmrg      # only be used when explicitly requested.
2481f29dbc25Smrg      if test "x$enable_dependency_tracking" = xyes; then
2482f29dbc25Smrg	continue
2483f29dbc25Smrg      else
2484f29dbc25Smrg	break
2485f29dbc25Smrg      fi
2486f29dbc25Smrg      ;;
248704007ebaSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
248804007ebaSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2489f29dbc25Smrg      # not run yet.  These depmodes are late enough in the game, and
2490f29dbc25Smrg      # so weak that their functioning should not be impacted.
2491f29dbc25Smrg      am__obj=conftest.${OBJEXT-o}
2492f29dbc25Smrg      am__minus_obj=
2493f29dbc25Smrg      ;;
2494f29dbc25Smrg    none) break ;;
2495f29dbc25Smrg    esac
2496f29dbc25Smrg    if depmode=$depmode \
2497f29dbc25Smrg       source=sub/conftest.c object=$am__obj \
2498f29dbc25Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2499f29dbc25Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2500f29dbc25Smrg         >/dev/null 2>conftest.err &&
2501f29dbc25Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2502f29dbc25Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2503f29dbc25Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2504f29dbc25Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2505f29dbc25Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2506f29dbc25Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2507f29dbc25Smrg      # that says an option was ignored or not supported.
2508f29dbc25Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2509f29dbc25Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2510f29dbc25Smrg      # The diagnosis changed in icc 8.0:
2511f29dbc25Smrg      #   icc: Command line remark: option '-MP' not supported
2512f29dbc25Smrg      if (grep 'ignoring option' conftest.err ||
2513f29dbc25Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2514f29dbc25Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2515f29dbc25Smrg        break
2516f29dbc25Smrg      fi
2517f29dbc25Smrg    fi
2518f29dbc25Smrg  done
2519f29dbc25Smrg
2520f29dbc25Smrg  cd ..
2521f29dbc25Smrg  rm -rf conftest.dir
2522f29dbc25Smrgelse
2523f29dbc25Smrg  am_cv_$1_dependencies_compiler_type=none
2524f29dbc25Smrgfi
2525f29dbc25Smrg])
2526f29dbc25SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2527f29dbc25SmrgAM_CONDITIONAL([am__fastdep$1], [
2528f29dbc25Smrg  test "x$enable_dependency_tracking" != xno \
2529f29dbc25Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2530f29dbc25Smrg])
2531f29dbc25Smrg
2532f29dbc25Smrg
2533f29dbc25Smrg# AM_SET_DEPDIR
2534f29dbc25Smrg# -------------
2535f29dbc25Smrg# Choose a directory name for dependency files.
253604007ebaSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2537f29dbc25SmrgAC_DEFUN([AM_SET_DEPDIR],
2538f29dbc25Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2539f29dbc25SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2540f29dbc25Smrg])
2541f29dbc25Smrg
2542f29dbc25Smrg
2543f29dbc25Smrg# AM_DEP_TRACK
2544f29dbc25Smrg# ------------
2545f29dbc25SmrgAC_DEFUN([AM_DEP_TRACK],
254604007ebaSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
254704007ebaSmrgAS_HELP_STRING(
254804007ebaSmrg  [--enable-dependency-tracking],
254904007ebaSmrg  [do not reject slow dependency extractors])
255004007ebaSmrgAS_HELP_STRING(
255104007ebaSmrg  [--disable-dependency-tracking],
255204007ebaSmrg  [speeds up one-time build])])
2553f29dbc25Smrgif test "x$enable_dependency_tracking" != xno; then
2554f29dbc25Smrg  am_depcomp="$ac_aux_dir/depcomp"
2555f29dbc25Smrg  AMDEPBACKSLASH='\'
255604007ebaSmrg  am__nodep='_no'
2557f29dbc25Smrgfi
2558f29dbc25SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2559f29dbc25SmrgAC_SUBST([AMDEPBACKSLASH])dnl
2560f29dbc25Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
256104007ebaSmrgAC_SUBST([am__nodep])dnl
256204007ebaSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2563f29dbc25Smrg])
2564f29dbc25Smrg
2565f29dbc25Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2566f29dbc25Smrg
256705cf1079Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2568f29dbc25Smrg#
2569f29dbc25Smrg# This file is free software; the Free Software Foundation
2570f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2571f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2572f29dbc25Smrg
2573f29dbc25Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2574f29dbc25Smrg# ------------------------------
2575f29dbc25SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2576f29dbc25Smrg[{
257704007ebaSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
2578f29dbc25Smrg  # are listed without --file.  Let's play safe and only enable the eval
2579f29dbc25Smrg  # if we detect the quoting.
258005cf1079Smrg  # TODO: see whether this extra hack can be removed once we start
258105cf1079Smrg  # requiring Autoconf 2.70 or later.
258205cf1079Smrg  AS_CASE([$CONFIG_FILES],
258305cf1079Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
258405cf1079Smrg          [*], [set x $CONFIG_FILES])
2585f29dbc25Smrg  shift
258605cf1079Smrg  # Used to flag and report bootstrapping failures.
258705cf1079Smrg  am_rc=0
258805cf1079Smrg  for am_mf
2589f29dbc25Smrg  do
2590f29dbc25Smrg    # Strip MF so we end up with the name of the file.
259105cf1079Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
259205cf1079Smrg    # Check whether this is an Automake generated Makefile which includes
259305cf1079Smrg    # dependency-tracking related rules and includes.
259405cf1079Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
2595f29dbc25Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
259605cf1079Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
259705cf1079Smrg      || continue
259805cf1079Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
259905cf1079Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
260005cf1079Smrg    AM_RUN_LOG([cd "$am_dirpart" \
260105cf1079Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
260205cf1079Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
2603f29dbc25Smrg  done
260405cf1079Smrg  if test $am_rc -ne 0; then
260505cf1079Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
260605cf1079Smrg    for automatic dependency tracking.  Try re-running configure with the
260705cf1079Smrg    '--disable-dependency-tracking' option to at least be able to build
260805cf1079Smrg    the package (albeit without support for automatic dependency tracking).])
260905cf1079Smrg  fi
261005cf1079Smrg  AS_UNSET([am_dirpart])
261105cf1079Smrg  AS_UNSET([am_filepart])
261205cf1079Smrg  AS_UNSET([am_mf])
261305cf1079Smrg  AS_UNSET([am_rc])
261405cf1079Smrg  rm -f conftest-deps.mk
2615f29dbc25Smrg}
2616f29dbc25Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2617f29dbc25Smrg
2618f29dbc25Smrg
2619f29dbc25Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2620f29dbc25Smrg# -----------------------------
2621f29dbc25Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2622f29dbc25Smrg#
262305cf1079Smrg# This code is only required when automatic dependency tracking is enabled.
262405cf1079Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
262505cf1079Smrg# order to bootstrap the dependency handling code.
2626f29dbc25SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2627f29dbc25Smrg[AC_CONFIG_COMMANDS([depfiles],
2628f29dbc25Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
262905cf1079Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
2630f29dbc25Smrg
2631f29dbc25Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2632f29dbc25Smrg
263305cf1079Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
2634f29dbc25Smrg#
2635f29dbc25Smrg# This file is free software; the Free Software Foundation
2636f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2637f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2638f29dbc25Smrg
2639f29dbc25Smrg# This macro actually does too much.  Some checks are only needed if
2640f29dbc25Smrg# your package does certain things.  But this isn't really a big deal.
2641f29dbc25Smrg
264204007ebaSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
264304007ebaSmrgm4_define([AC_PROG_CC],
264404007ebaSmrgm4_defn([AC_PROG_CC])
264504007ebaSmrg[_AM_PROG_CC_C_O
264604007ebaSmrg])
264704007ebaSmrg
2648f29dbc25Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2649f29dbc25Smrg# AM_INIT_AUTOMAKE([OPTIONS])
2650f29dbc25Smrg# -----------------------------------------------
2651f29dbc25Smrg# The call with PACKAGE and VERSION arguments is the old style
2652f29dbc25Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2653f29dbc25Smrg# and VERSION should now be passed to AC_INIT and removed from
2654f29dbc25Smrg# the call to AM_INIT_AUTOMAKE.
2655f29dbc25Smrg# We support both call styles for the transition.  After
2656f29dbc25Smrg# the next Automake release, Autoconf can make the AC_INIT
2657f29dbc25Smrg# arguments mandatory, and then we can depend on a new Autoconf
2658f29dbc25Smrg# release and drop the old call support.
2659f29dbc25SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
266004007ebaSmrg[AC_PREREQ([2.65])dnl
2661f29dbc25Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2662f29dbc25Smrgdnl the ones we care about.
2663f29dbc25Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2664f29dbc25SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2665f29dbc25SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2666f29dbc25Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2667f29dbc25Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2668f29dbc25Smrg  # is not polluted with repeated "-I."
2669f29dbc25Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2670f29dbc25Smrg  # test to see if srcdir already configured
2671f29dbc25Smrg  if test -f $srcdir/config.status; then
2672f29dbc25Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2673f29dbc25Smrg  fi
2674f29dbc25Smrgfi
2675f29dbc25Smrg
2676f29dbc25Smrg# test whether we have cygpath
2677f29dbc25Smrgif test -z "$CYGPATH_W"; then
2678f29dbc25Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2679f29dbc25Smrg    CYGPATH_W='cygpath -w'
2680f29dbc25Smrg  else
2681f29dbc25Smrg    CYGPATH_W=echo
2682f29dbc25Smrg  fi
2683f29dbc25Smrgfi
2684f29dbc25SmrgAC_SUBST([CYGPATH_W])
2685f29dbc25Smrg
2686f29dbc25Smrg# Define the identity of the package.
2687f29dbc25Smrgdnl Distinguish between old-style and new-style calls.
2688f29dbc25Smrgm4_ifval([$2],
268904007ebaSmrg[AC_DIAGNOSE([obsolete],
269004007ebaSmrg             [$0: two- and three-arguments forms are deprecated.])
269104007ebaSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2692f29dbc25Smrg AC_SUBST([PACKAGE], [$1])dnl
2693f29dbc25Smrg AC_SUBST([VERSION], [$2])],
2694f29dbc25Smrg[_AM_SET_OPTIONS([$1])dnl
2695f29dbc25Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
269604007ebaSmrgm4_if(
269704007ebaSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
269804007ebaSmrg  [ok:ok],,
2699f29dbc25Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2700f29dbc25Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2701f29dbc25Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2702f29dbc25Smrg
2703f29dbc25Smrg_AM_IF_OPTION([no-define],,
270404007ebaSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
270504007ebaSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2706f29dbc25Smrg
2707f29dbc25Smrg# Some tools Automake needs.
2708f29dbc25SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2709f29dbc25SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
271004007ebaSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
271104007ebaSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
271204007ebaSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
271304007ebaSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
271404007ebaSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2715f29dbc25SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2716f29dbc25SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
271704007ebaSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
271804007ebaSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
271904007ebaSmrg# dies out for good.  For more background, see:
272005cf1079Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
272105cf1079Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
272204007ebaSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
272305cf1079Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
272405cf1079Smrg# system "awk" is bad on some platforms.
2725f29dbc25SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2726f29dbc25SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2727f29dbc25SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2728f29dbc25Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2729f29dbc25Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2730f29dbc25Smrg			     [_AM_PROG_TAR([v7])])])
2731f29dbc25Smrg_AM_IF_OPTION([no-dependencies],,
2732f29dbc25Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
273304007ebaSmrg		  [_AM_DEPENDENCIES([CC])],
273404007ebaSmrg		  [m4_define([AC_PROG_CC],
273504007ebaSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2736f29dbc25SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
273704007ebaSmrg		  [_AM_DEPENDENCIES([CXX])],
273804007ebaSmrg		  [m4_define([AC_PROG_CXX],
273904007ebaSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2740f29dbc25SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
274104007ebaSmrg		  [_AM_DEPENDENCIES([OBJC])],
274204007ebaSmrg		  [m4_define([AC_PROG_OBJC],
274304007ebaSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
274404007ebaSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
274504007ebaSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
274604007ebaSmrg		  [m4_define([AC_PROG_OBJCXX],
274704007ebaSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2748f29dbc25Smrg])
274904007ebaSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
275004007ebaSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
275104007ebaSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
275204007ebaSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2753f29dbc25SmrgAC_CONFIG_COMMANDS_PRE(dnl
2754f29dbc25Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2755f29dbc25Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2756f29dbc25Smrg
275704007ebaSmrg# POSIX will say in a future version that running "rm -f" with no argument
275804007ebaSmrg# is OK; and we want to be able to make that assumption in our Makefile
275904007ebaSmrg# recipes.  So use an aggressive probe to check that the usage we want is
276004007ebaSmrg# actually supported "in the wild" to an acceptable degree.
276104007ebaSmrg# See automake bug#10828.
276204007ebaSmrg# To make any issue more visible, cause the running configure to be aborted
276304007ebaSmrg# by default if the 'rm' program in use doesn't match our expectations; the
276404007ebaSmrg# user can still override this though.
276504007ebaSmrgif rm -f && rm -fr && rm -rf; then : OK; else
276604007ebaSmrg  cat >&2 <<'END'
276704007ebaSmrgOops!
276804007ebaSmrg
276904007ebaSmrgYour 'rm' program seems unable to run without file operands specified
277004007ebaSmrgon the command line, even when the '-f' option is present.  This is contrary
277104007ebaSmrgto the behaviour of most rm programs out there, and not conforming with
277204007ebaSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
277304007ebaSmrg
277404007ebaSmrgPlease tell bug-automake@gnu.org about your system, including the value
277504007ebaSmrgof your $PATH and any error possibly output before this message.  This
277604007ebaSmrgcan help us improve future automake versions.
277704007ebaSmrg
277804007ebaSmrgEND
277904007ebaSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
278004007ebaSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
278104007ebaSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
278204007ebaSmrg    echo >&2
278304007ebaSmrg  else
278404007ebaSmrg    cat >&2 <<'END'
278504007ebaSmrgAborting the configuration process, to ensure you take notice of the issue.
278604007ebaSmrg
278704007ebaSmrgYou can download and install GNU coreutils to get an 'rm' implementation
278805cf1079Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
278904007ebaSmrg
279004007ebaSmrgIf you want to complete the configuration process using your problematic
279104007ebaSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
279204007ebaSmrgto "yes", and re-run configure.
279304007ebaSmrg
279404007ebaSmrgEND
279504007ebaSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
279604007ebaSmrg  fi
27977f419768Smrgfi
279805cf1079Smrgdnl The trailing newline in this macro's definition is deliberate, for
279905cf1079Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
280005cf1079Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28017f419768Smrg])
280204007ebaSmrg
280304007ebaSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2804f29dbc25Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2805f29dbc25Smrgdnl mangled by Autoconf and run in a shell conditional statement.
2806f29dbc25Smrgm4_define([_AC_COMPILER_EXEEXT],
2807f29dbc25Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2808f29dbc25Smrg
2809f29dbc25Smrg# When config.status generates a header, we must update the stamp-h file.
2810f29dbc25Smrg# This file resides in the same directory as the config header
2811f29dbc25Smrg# that is generated.  The stamp files are numbered to have different names.
2812f29dbc25Smrg
2813f29dbc25Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2814f29dbc25Smrg# loop where config.status creates the headers, so we can generate
2815f29dbc25Smrg# our stamp files there.
2816f29dbc25SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2817f29dbc25Smrg[# Compute $1's index in $config_headers.
2818f29dbc25Smrg_am_arg=$1
2819f29dbc25Smrg_am_stamp_count=1
2820f29dbc25Smrgfor _am_header in $config_headers :; do
2821f29dbc25Smrg  case $_am_header in
2822f29dbc25Smrg    $_am_arg | $_am_arg:* )
2823f29dbc25Smrg      break ;;
2824f29dbc25Smrg    * )
2825f29dbc25Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2826f29dbc25Smrg  esac
2827f29dbc25Smrgdone
2828f29dbc25Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2829f29dbc25Smrg
283005cf1079Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2831f29dbc25Smrg#
2832f29dbc25Smrg# This file is free software; the Free Software Foundation
2833f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2834f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2835f29dbc25Smrg
2836f29dbc25Smrg# AM_PROG_INSTALL_SH
2837f29dbc25Smrg# ------------------
2838f29dbc25Smrg# Define $install_sh.
2839f29dbc25SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2840f29dbc25Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
284105cf1079Smrgif test x"${install_sh+set}" != xset; then
2842f29dbc25Smrg  case $am_aux_dir in
2843f29dbc25Smrg  *\ * | *\	*)
2844f29dbc25Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2845f29dbc25Smrg  *)
2846f29dbc25Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2847f29dbc25Smrg  esac
2848f29dbc25Smrgfi
284904007ebaSmrgAC_SUBST([install_sh])])
2850f29dbc25Smrg
285105cf1079Smrg# Copyright (C) 2003-2018 Free Software Foundation, Inc.
2852f29dbc25Smrg#
2853f29dbc25Smrg# This file is free software; the Free Software Foundation
2854f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2855f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2856f29dbc25Smrg
2857f29dbc25Smrg# Check whether the underlying file-system supports filenames
2858f29dbc25Smrg# with a leading dot.  For instance MS-DOS doesn't.
2859f29dbc25SmrgAC_DEFUN([AM_SET_LEADING_DOT],
2860f29dbc25Smrg[rm -rf .tst 2>/dev/null
2861f29dbc25Smrgmkdir .tst 2>/dev/null
2862f29dbc25Smrgif test -d .tst; then
2863f29dbc25Smrg  am__leading_dot=.
2864f29dbc25Smrgelse
2865f29dbc25Smrg  am__leading_dot=_
2866f29dbc25Smrgfi
2867f29dbc25Smrgrmdir .tst 2>/dev/null
2868f29dbc25SmrgAC_SUBST([am__leading_dot])])
2869f29dbc25Smrg
2870f29dbc25Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
2871f29dbc25Smrg# From Jim Meyering
2872f29dbc25Smrg
287305cf1079Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
2874f29dbc25Smrg#
2875f29dbc25Smrg# This file is free software; the Free Software Foundation
2876f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2877f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2878f29dbc25Smrg
2879f29dbc25Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
2880f29dbc25Smrg# ----------------------------------
2881f29dbc25Smrg# Control maintainer-specific portions of Makefiles.
288204007ebaSmrg# Default is to disable them, unless 'enable' is passed literally.
288304007ebaSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
2884f29dbc25Smrg# can override the default with the --enable/--disable switch.
2885f29dbc25SmrgAC_DEFUN([AM_MAINTAINER_MODE],
2886f29dbc25Smrg[m4_case(m4_default([$1], [disable]),
2887f29dbc25Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
2888f29dbc25Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
2889f29dbc25Smrg       [m4_define([am_maintainer_other], [enable])
2890f29dbc25Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
289104007ebaSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2892f29dbc25Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
2893f29dbc25Smrg  AC_ARG_ENABLE([maintainer-mode],
289404007ebaSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
289504007ebaSmrg      am_maintainer_other[ make rules and dependencies not useful
289604007ebaSmrg      (and sometimes confusing) to the casual installer])],
289704007ebaSmrg    [USE_MAINTAINER_MODE=$enableval],
289804007ebaSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
2899f29dbc25Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
2900f29dbc25Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
2901f29dbc25Smrg  MAINT=$MAINTAINER_MODE_TRUE
2902f29dbc25Smrg  AC_SUBST([MAINT])dnl
2903f29dbc25Smrg]
2904f29dbc25Smrg)
2905f29dbc25Smrg
2906f29dbc25Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2907f29dbc25Smrg
290805cf1079Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2909f29dbc25Smrg#
2910f29dbc25Smrg# This file is free software; the Free Software Foundation
2911f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2912f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2913f29dbc25Smrg
2914f29dbc25Smrg# AM_MAKE_INCLUDE()
2915f29dbc25Smrg# -----------------
291605cf1079Smrg# Check whether make has an 'include' directive that can support all
291705cf1079Smrg# the idioms we need for our automatic dependency tracking code.
2918f29dbc25SmrgAC_DEFUN([AM_MAKE_INCLUDE],
291905cf1079Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
292005cf1079Smrgcat > confinc.mk << 'END'
2921f29dbc25Smrgam__doit:
292205cf1079Smrg	@echo this is the am__doit target >confinc.out
2923f29dbc25Smrg.PHONY: am__doit
2924f29dbc25SmrgEND
2925f29dbc25Smrgam__include="#"
2926f29dbc25Smrgam__quote=
292705cf1079Smrg# BSD make does it like this.
292805cf1079Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
292905cf1079Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
293005cf1079Smrgecho 'include confinc.mk # ignored' > confmf.GNU
293105cf1079Smrg_am_result=no
293205cf1079Smrgfor s in GNU BSD; do
293305cf1079Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
293405cf1079Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
293505cf1079Smrg      ['0:this is the am__doit target'],
293605cf1079Smrg      [AS_CASE([$s],
293705cf1079Smrg          [BSD], [am__include='.include' am__quote='"'],
293805cf1079Smrg          [am__include='include' am__quote=''])])
293905cf1079Smrg  if test "$am__include" != "#"; then
294005cf1079Smrg    _am_result="yes ($s style)"
294105cf1079Smrg    break
294205cf1079Smrg  fi
294305cf1079Smrgdone
294405cf1079Smrgrm -f confinc.* confmf.*
294505cf1079SmrgAC_MSG_RESULT([${_am_result}])
294605cf1079SmrgAC_SUBST([am__include])])
294705cf1079SmrgAC_SUBST([am__quote])])
2948f29dbc25Smrg
2949f29dbc25Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2950f29dbc25Smrg
295105cf1079Smrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
2952f29dbc25Smrg#
2953f29dbc25Smrg# This file is free software; the Free Software Foundation
2954f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2955f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2956f29dbc25Smrg
2957f29dbc25Smrg# AM_MISSING_PROG(NAME, PROGRAM)
2958f29dbc25Smrg# ------------------------------
2959f29dbc25SmrgAC_DEFUN([AM_MISSING_PROG],
2960f29dbc25Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2961f29dbc25Smrg$1=${$1-"${am_missing_run}$2"}
2962f29dbc25SmrgAC_SUBST($1)])
2963f29dbc25Smrg
2964f29dbc25Smrg# AM_MISSING_HAS_RUN
2965f29dbc25Smrg# ------------------
296604007ebaSmrg# Define MISSING if not defined so far and test if it is modern enough.
296704007ebaSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
2968f29dbc25SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2969f29dbc25Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2970f29dbc25SmrgAC_REQUIRE_AUX_FILE([missing])dnl
2971f29dbc25Smrgif test x"${MISSING+set}" != xset; then
2972f29dbc25Smrg  case $am_aux_dir in
2973f29dbc25Smrg  *\ * | *\	*)
2974f29dbc25Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2975f29dbc25Smrg  *)
2976f29dbc25Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2977f29dbc25Smrg  esac
2978f29dbc25Smrgfi
2979f29dbc25Smrg# Use eval to expand $SHELL
298004007ebaSmrgif eval "$MISSING --is-lightweight"; then
298104007ebaSmrg  am_missing_run="$MISSING "
2982f29dbc25Smrgelse
2983f29dbc25Smrg  am_missing_run=
298404007ebaSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2985f29dbc25Smrgfi
2986f29dbc25Smrg])
2987f29dbc25Smrg
2988f29dbc25Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2989f29dbc25Smrg
299005cf1079Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2991f29dbc25Smrg#
2992f29dbc25Smrg# This file is free software; the Free Software Foundation
2993f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2994f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2995f29dbc25Smrg
2996f29dbc25Smrg# _AM_MANGLE_OPTION(NAME)
2997f29dbc25Smrg# -----------------------
2998f29dbc25SmrgAC_DEFUN([_AM_MANGLE_OPTION],
2999f29dbc25Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3000f29dbc25Smrg
3001f29dbc25Smrg# _AM_SET_OPTION(NAME)
300204007ebaSmrg# --------------------
3003f29dbc25Smrg# Set option NAME.  Presently that only means defining a flag for this option.
3004f29dbc25SmrgAC_DEFUN([_AM_SET_OPTION],
300504007ebaSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3006f29dbc25Smrg
3007f29dbc25Smrg# _AM_SET_OPTIONS(OPTIONS)
300804007ebaSmrg# ------------------------
3009f29dbc25Smrg# OPTIONS is a space-separated list of Automake options.
3010f29dbc25SmrgAC_DEFUN([_AM_SET_OPTIONS],
3011f29dbc25Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3012f29dbc25Smrg
3013f29dbc25Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
3014f29dbc25Smrg# -------------------------------------------
3015f29dbc25Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
3016f29dbc25SmrgAC_DEFUN([_AM_IF_OPTION],
3017f29dbc25Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3018f29dbc25Smrg
301905cf1079Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
302004007ebaSmrg#
302104007ebaSmrg# This file is free software; the Free Software Foundation
302204007ebaSmrg# gives unlimited permission to copy and/or distribute it,
302304007ebaSmrg# with or without modifications, as long as this notice is preserved.
3024f29dbc25Smrg
302504007ebaSmrg# _AM_PROG_CC_C_O
302604007ebaSmrg# ---------------
302704007ebaSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
302804007ebaSmrg# to automatically call this.
302904007ebaSmrgAC_DEFUN([_AM_PROG_CC_C_O],
303004007ebaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
303104007ebaSmrgAC_REQUIRE_AUX_FILE([compile])dnl
303204007ebaSmrgAC_LANG_PUSH([C])dnl
303304007ebaSmrgAC_CACHE_CHECK(
303404007ebaSmrg  [whether $CC understands -c and -o together],
303504007ebaSmrg  [am_cv_prog_cc_c_o],
303604007ebaSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
303704007ebaSmrg  # Make sure it works both with $CC and with simple cc.
303804007ebaSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
303904007ebaSmrg  # compilers refuse to overwrite an existing .o file with -o,
304004007ebaSmrg  # though they will create one.
304104007ebaSmrg  am_cv_prog_cc_c_o=yes
304204007ebaSmrg  for am_i in 1 2; do
304304007ebaSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
304404007ebaSmrg         && test -f conftest2.$ac_objext; then
304504007ebaSmrg      : OK
304604007ebaSmrg    else
304704007ebaSmrg      am_cv_prog_cc_c_o=no
304804007ebaSmrg      break
304904007ebaSmrg    fi
305004007ebaSmrg  done
305104007ebaSmrg  rm -f core conftest*
305204007ebaSmrg  unset am_i])
305304007ebaSmrgif test "$am_cv_prog_cc_c_o" != yes; then
305404007ebaSmrg   # Losing compiler, so override with the script.
305504007ebaSmrg   # FIXME: It is wrong to rewrite CC.
305604007ebaSmrg   # But if we don't then we get into trouble of one sort or another.
305704007ebaSmrg   # A longer-term fix would be to have automake use am__CC in this case,
305804007ebaSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
305904007ebaSmrg   CC="$am_aux_dir/compile $CC"
306004007ebaSmrgfi
306104007ebaSmrgAC_LANG_POP([C])])
306204007ebaSmrg
306304007ebaSmrg# For backward compatibility.
306404007ebaSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
306504007ebaSmrg
306605cf1079Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
3067f29dbc25Smrg#
3068f29dbc25Smrg# This file is free software; the Free Software Foundation
3069f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3070f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3071f29dbc25Smrg
307204007ebaSmrg# AM_RUN_LOG(COMMAND)
307304007ebaSmrg# -------------------
307404007ebaSmrg# Run COMMAND, save the exit status in ac_status, and log it.
307504007ebaSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
307604007ebaSmrgAC_DEFUN([AM_RUN_LOG],
307704007ebaSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
307804007ebaSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
307904007ebaSmrg   ac_status=$?
308004007ebaSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
308104007ebaSmrg   (exit $ac_status); }])
308204007ebaSmrg
308304007ebaSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
308404007ebaSmrg
308505cf1079Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
308604007ebaSmrg#
308704007ebaSmrg# This file is free software; the Free Software Foundation
308804007ebaSmrg# gives unlimited permission to copy and/or distribute it,
308904007ebaSmrg# with or without modifications, as long as this notice is preserved.
3090f29dbc25Smrg
3091f29dbc25Smrg# AM_SANITY_CHECK
3092f29dbc25Smrg# ---------------
3093f29dbc25SmrgAC_DEFUN([AM_SANITY_CHECK],
3094f29dbc25Smrg[AC_MSG_CHECKING([whether build environment is sane])
3095f29dbc25Smrg# Reject unsafe characters in $srcdir or the absolute working directory
3096f29dbc25Smrg# name.  Accept space and tab only in the latter.
3097f29dbc25Smrgam_lf='
3098f29dbc25Smrg'
3099f29dbc25Smrgcase `pwd` in
3100f29dbc25Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
3101f29dbc25Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
3102f29dbc25Smrgesac
3103f29dbc25Smrgcase $srcdir in
3104f29dbc25Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
310504007ebaSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3106f29dbc25Smrgesac
3107f29dbc25Smrg
310804007ebaSmrg# Do 'set' in a subshell so we don't clobber the current shell's
3109f29dbc25Smrg# arguments.  Must try -L first in case configure is actually a
3110f29dbc25Smrg# symlink; some systems play weird games with the mod time of symlinks
3111f29dbc25Smrg# (eg FreeBSD returns the mod time of the symlink's containing
3112f29dbc25Smrg# directory).
3113f29dbc25Smrgif (
311404007ebaSmrg   am_has_slept=no
311504007ebaSmrg   for am_try in 1 2; do
311604007ebaSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
311704007ebaSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
311804007ebaSmrg     if test "$[*]" = "X"; then
311904007ebaSmrg	# -L didn't work.
312004007ebaSmrg	set X `ls -t "$srcdir/configure" conftest.file`
312104007ebaSmrg     fi
312204007ebaSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
312304007ebaSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
312404007ebaSmrg
312504007ebaSmrg	# If neither matched, then we have a broken ls.  This can happen
312604007ebaSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
312704007ebaSmrg	# broken ls alias from the environment.  This has actually
312804007ebaSmrg	# happened.  Such a system could not be considered "sane".
312904007ebaSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
313004007ebaSmrg  alias in your environment])
313104007ebaSmrg     fi
313204007ebaSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
313304007ebaSmrg       break
313404007ebaSmrg     fi
313504007ebaSmrg     # Just in case.
313604007ebaSmrg     sleep 1
313704007ebaSmrg     am_has_slept=yes
313804007ebaSmrg   done
3139f29dbc25Smrg   test "$[2]" = conftest.file
3140f29dbc25Smrg   )
3141f29dbc25Smrgthen
3142f29dbc25Smrg   # Ok.
3143f29dbc25Smrg   :
3144f29dbc25Smrgelse
3145f29dbc25Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
3146f29dbc25SmrgCheck your system clock])
3147f29dbc25Smrgfi
314804007ebaSmrgAC_MSG_RESULT([yes])
314904007ebaSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
315004007ebaSmrg# generated files are strictly newer.
315104007ebaSmrgam_sleep_pid=
315204007ebaSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
315304007ebaSmrg  ( sleep 1 ) &
315404007ebaSmrg  am_sleep_pid=$!
315504007ebaSmrgfi
315604007ebaSmrgAC_CONFIG_COMMANDS_PRE(
315704007ebaSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
315804007ebaSmrg   if test -n "$am_sleep_pid"; then
315904007ebaSmrg     # Hide warnings about reused PIDs.
316004007ebaSmrg     wait $am_sleep_pid 2>/dev/null
316104007ebaSmrg   fi
316204007ebaSmrg   AC_MSG_RESULT([done])])
316304007ebaSmrgrm -f conftest.file
316404007ebaSmrg])
3165f29dbc25Smrg
316605cf1079Smrg# Copyright (C) 2009-2018 Free Software Foundation, Inc.
3167f29dbc25Smrg#
3168f29dbc25Smrg# This file is free software; the Free Software Foundation
3169f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3170f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3171f29dbc25Smrg
3172f29dbc25Smrg# AM_SILENT_RULES([DEFAULT])
3173f29dbc25Smrg# --------------------------
3174f29dbc25Smrg# Enable less verbose build rules; with the default set to DEFAULT
317504007ebaSmrg# ("yes" being less verbose, "no" or empty being verbose).
3176f29dbc25SmrgAC_DEFUN([AM_SILENT_RULES],
317704007ebaSmrg[AC_ARG_ENABLE([silent-rules], [dnl
317804007ebaSmrgAS_HELP_STRING(
317904007ebaSmrg  [--enable-silent-rules],
318004007ebaSmrg  [less verbose build output (undo: "make V=1")])
318104007ebaSmrgAS_HELP_STRING(
318204007ebaSmrg  [--disable-silent-rules],
318304007ebaSmrg  [verbose build output (undo: "make V=0")])dnl
318404007ebaSmrg])
318504007ebaSmrgcase $enable_silent_rules in @%:@ (((
318604007ebaSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
318704007ebaSmrg   no) AM_DEFAULT_VERBOSITY=1;;
318804007ebaSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3189f29dbc25Smrgesac
319004007ebaSmrgdnl
319104007ebaSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
319204007ebaSmrgdnl do not support nested variable expansions.
319304007ebaSmrgdnl See automake bug#9928 and bug#10237.
319404007ebaSmrgam_make=${MAKE-make}
319504007ebaSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
319604007ebaSmrg   [am_cv_make_support_nested_variables],
319704007ebaSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
319804007ebaSmrgBAR0=false
319904007ebaSmrgBAR1=true
320004007ebaSmrgV=1
320104007ebaSmrgam__doit:
320204007ebaSmrg	@$(TRUE)
320304007ebaSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
320404007ebaSmrg  am_cv_make_support_nested_variables=yes
320504007ebaSmrgelse
320604007ebaSmrg  am_cv_make_support_nested_variables=no
320704007ebaSmrgfi])
320804007ebaSmrgif test $am_cv_make_support_nested_variables = yes; then
320904007ebaSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
321004007ebaSmrg  AM_V='$(V)'
321104007ebaSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
321204007ebaSmrgelse
321304007ebaSmrg  AM_V=$AM_DEFAULT_VERBOSITY
321404007ebaSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
321504007ebaSmrgfi
321604007ebaSmrgAC_SUBST([AM_V])dnl
321704007ebaSmrgAM_SUBST_NOTMAKE([AM_V])dnl
321804007ebaSmrgAC_SUBST([AM_DEFAULT_V])dnl
321904007ebaSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3220f29dbc25SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3221f29dbc25SmrgAM_BACKSLASH='\'
3222f29dbc25SmrgAC_SUBST([AM_BACKSLASH])dnl
3223f29dbc25Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3224f29dbc25Smrg])
3225f29dbc25Smrg
322605cf1079Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
3227f29dbc25Smrg#
3228f29dbc25Smrg# This file is free software; the Free Software Foundation
3229f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3230f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3231f29dbc25Smrg
3232f29dbc25Smrg# AM_PROG_INSTALL_STRIP
3233f29dbc25Smrg# ---------------------
323404007ebaSmrg# One issue with vendor 'install' (even GNU) is that you can't
3235f29dbc25Smrg# specify the program used to strip binaries.  This is especially
3236f29dbc25Smrg# annoying in cross-compiling environments, where the build's strip
3237f29dbc25Smrg# is unlikely to handle the host's binaries.
3238f29dbc25Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
323904007ebaSmrg# always use install-sh in "make install-strip", and initialize
3240f29dbc25Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
3241f29dbc25SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3242f29dbc25Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
324304007ebaSmrg# Installed binaries are usually stripped using 'strip' when the user
324404007ebaSmrg# run "make install-strip".  However 'strip' might not be the right
3245f29dbc25Smrg# tool to use in cross-compilation environments, therefore Automake
324604007ebaSmrg# will honor the 'STRIP' environment variable to overrule this program.
324704007ebaSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3248f29dbc25Smrgif test "$cross_compiling" != no; then
3249f29dbc25Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
3250f29dbc25Smrgfi
3251f29dbc25SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3252f29dbc25SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3253f29dbc25Smrg
325405cf1079Smrg# Copyright (C) 2006-2018 Free Software Foundation, Inc.
3255f29dbc25Smrg#
3256f29dbc25Smrg# This file is free software; the Free Software Foundation
3257f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3258f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3259f29dbc25Smrg
3260f29dbc25Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
3261f29dbc25Smrg# ---------------------------
3262f29dbc25Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3263f29dbc25Smrg# This macro is traced by Automake.
3264f29dbc25SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3265f29dbc25Smrg
3266f29dbc25Smrg# AM_SUBST_NOTMAKE(VARIABLE)
326704007ebaSmrg# --------------------------
3268f29dbc25Smrg# Public sister of _AM_SUBST_NOTMAKE.
3269f29dbc25SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3270f29dbc25Smrg
3271f29dbc25Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3272f29dbc25Smrg
327305cf1079Smrg# Copyright (C) 2004-2018 Free Software Foundation, Inc.
3274f29dbc25Smrg#
3275f29dbc25Smrg# This file is free software; the Free Software Foundation
3276f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3277f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3278f29dbc25Smrg
3279f29dbc25Smrg# _AM_PROG_TAR(FORMAT)
3280f29dbc25Smrg# --------------------
3281f29dbc25Smrg# Check how to create a tarball in format FORMAT.
328204007ebaSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3283f29dbc25Smrg#
3284f29dbc25Smrg# Substitute a variable $(am__tar) that is a command
3285f29dbc25Smrg# writing to stdout a FORMAT-tarball containing the directory
3286f29dbc25Smrg# $tardir.
3287f29dbc25Smrg#     tardir=directory && $(am__tar) > result.tar
3288f29dbc25Smrg#
3289f29dbc25Smrg# Substitute a variable $(am__untar) that extract such
3290f29dbc25Smrg# a tarball read from stdin.
3291f29dbc25Smrg#     $(am__untar) < result.tar
329204007ebaSmrg#
3293f29dbc25SmrgAC_DEFUN([_AM_PROG_TAR],
329404007ebaSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
329504007ebaSmrg# in the wild :-(  We should find a proper way to deprecate it ...
329604007ebaSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
329704007ebaSmrg
329804007ebaSmrg# We'll loop over all known methods to create a tar archive until one works.
3299f29dbc25Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3300f29dbc25Smrg
330104007ebaSmrgm4_if([$1], [v7],
330204007ebaSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
330304007ebaSmrg
330404007ebaSmrg  [m4_case([$1],
330504007ebaSmrg    [ustar],
330604007ebaSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
330704007ebaSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
330804007ebaSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
330904007ebaSmrg      # and bug#13588).
331004007ebaSmrg      am_max_uid=2097151 # 2^21 - 1
331104007ebaSmrg      am_max_gid=$am_max_uid
331204007ebaSmrg      # The $UID and $GID variables are not portable, so we need to resort
331304007ebaSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
331404007ebaSmrg      # below are definitely unexpected, so allow the users to see them
331504007ebaSmrg      # (that is, avoid stderr redirection).
331604007ebaSmrg      am_uid=`id -u || echo unknown`
331704007ebaSmrg      am_gid=`id -g || echo unknown`
331804007ebaSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
331904007ebaSmrg      if test $am_uid -le $am_max_uid; then
332004007ebaSmrg         AC_MSG_RESULT([yes])
332104007ebaSmrg      else
332204007ebaSmrg         AC_MSG_RESULT([no])
332304007ebaSmrg         _am_tools=none
332404007ebaSmrg      fi
332504007ebaSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
332604007ebaSmrg      if test $am_gid -le $am_max_gid; then
332704007ebaSmrg         AC_MSG_RESULT([yes])
332804007ebaSmrg      else
332904007ebaSmrg        AC_MSG_RESULT([no])
333004007ebaSmrg        _am_tools=none
333104007ebaSmrg      fi],
333204007ebaSmrg
333304007ebaSmrg  [pax],
333404007ebaSmrg    [],
3335f29dbc25Smrg
333604007ebaSmrg  [m4_fatal([Unknown tar format])])
333704007ebaSmrg
333804007ebaSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
333904007ebaSmrg
334004007ebaSmrg  # Go ahead even if we have the value already cached.  We do so because we
334104007ebaSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
334204007ebaSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
334304007ebaSmrg
334404007ebaSmrg  for _am_tool in $_am_tools; do
334504007ebaSmrg    case $_am_tool in
334604007ebaSmrg    gnutar)
334704007ebaSmrg      for _am_tar in tar gnutar gtar; do
334804007ebaSmrg        AM_RUN_LOG([$_am_tar --version]) && break
334904007ebaSmrg      done
335004007ebaSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
335104007ebaSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
335204007ebaSmrg      am__untar="$_am_tar -xf -"
335304007ebaSmrg      ;;
335404007ebaSmrg    plaintar)
335504007ebaSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
335604007ebaSmrg      # ustar tarball either.
335704007ebaSmrg      (tar --version) >/dev/null 2>&1 && continue
335804007ebaSmrg      am__tar='tar chf - "$$tardir"'
335904007ebaSmrg      am__tar_='tar chf - "$tardir"'
336004007ebaSmrg      am__untar='tar xf -'
336104007ebaSmrg      ;;
336204007ebaSmrg    pax)
336304007ebaSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
336404007ebaSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
336504007ebaSmrg      am__untar='pax -r'
336604007ebaSmrg      ;;
336704007ebaSmrg    cpio)
336804007ebaSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
336904007ebaSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
337004007ebaSmrg      am__untar='cpio -i -H $1 -d'
337104007ebaSmrg      ;;
337204007ebaSmrg    none)
337304007ebaSmrg      am__tar=false
337404007ebaSmrg      am__tar_=false
337504007ebaSmrg      am__untar=false
337604007ebaSmrg      ;;
337704007ebaSmrg    esac
337804007ebaSmrg
337904007ebaSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
338004007ebaSmrg    # and am__untar set.
338104007ebaSmrg    test -n "${am_cv_prog_tar_$1}" && break
338204007ebaSmrg
338304007ebaSmrg    # tar/untar a dummy directory, and stop if the command works.
338404007ebaSmrg    rm -rf conftest.dir
338504007ebaSmrg    mkdir conftest.dir
338604007ebaSmrg    echo GrepMe > conftest.dir/file
338704007ebaSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
338804007ebaSmrg    rm -rf conftest.dir
338904007ebaSmrg    if test -s conftest.tar; then
339004007ebaSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
339104007ebaSmrg      AM_RUN_LOG([cat conftest.dir/file])
339204007ebaSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
339304007ebaSmrg    fi
339404007ebaSmrg  done
3395f29dbc25Smrg  rm -rf conftest.dir
3396f29dbc25Smrg
339704007ebaSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
339804007ebaSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
339904007ebaSmrg
3400f29dbc25SmrgAC_SUBST([am__tar])
3401f29dbc25SmrgAC_SUBST([am__untar])
3402f29dbc25Smrg]) # _AM_PROG_TAR
3403f29dbc25Smrg
340404007ebaSmrgm4_include([m4/libtool.m4])
340504007ebaSmrgm4_include([m4/ltoptions.m4])
340604007ebaSmrgm4_include([m4/ltsugar.m4])
340704007ebaSmrgm4_include([m4/ltversion.m4])
340804007ebaSmrgm4_include([m4/lt~obsolete.m4])
3409