aclocal.m4 revision 65c1f7cf
1533545b5Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2533545b5Smrg
3533545b5Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4264fa531Smrg
5264fa531Smrg# This file is free software; the Free Software Foundation
6264fa531Smrg# gives unlimited permission to copy and/or distribute it,
7264fa531Smrg# with or without modifications, as long as this notice is preserved.
8264fa531Smrg
9264fa531Smrg# This program is distributed in the hope that it will be useful,
10264fa531Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11264fa531Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12264fa531Smrg# PARTICULAR PURPOSE.
13264fa531Smrg
14533545b5Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15c37a63b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16c37a63b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17533545b5Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18533545b5Smrg[m4_warning([this file was generated for autoconf 2.69.
19c37a63b8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20c37a63b8SmrgIf you have problems, you may need to regenerate the build system entirely.
21533545b5SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22264fa531Smrg
2365c1f7cfSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2465c1f7cfSmrgdnl serial 11 (pkg-config-0.29)
2565c1f7cfSmrgdnl
2665c1f7cfSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2765c1f7cfSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2865c1f7cfSmrgdnl
2965c1f7cfSmrgdnl This program is free software; you can redistribute it and/or modify
3065c1f7cfSmrgdnl it under the terms of the GNU General Public License as published by
3165c1f7cfSmrgdnl the Free Software Foundation; either version 2 of the License, or
3265c1f7cfSmrgdnl (at your option) any later version.
3365c1f7cfSmrgdnl
3465c1f7cfSmrgdnl This program is distributed in the hope that it will be useful, but
3565c1f7cfSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3665c1f7cfSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3765c1f7cfSmrgdnl General Public License for more details.
3865c1f7cfSmrgdnl
3965c1f7cfSmrgdnl You should have received a copy of the GNU General Public License
4065c1f7cfSmrgdnl along with this program; if not, write to the Free Software
4165c1f7cfSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4265c1f7cfSmrgdnl 02111-1307, USA.
4365c1f7cfSmrgdnl
4465c1f7cfSmrgdnl As a special exception to the GNU General Public License, if you
4565c1f7cfSmrgdnl distribute this file as part of a program that contains a
4665c1f7cfSmrgdnl configuration script generated by Autoconf, you may include it under
4765c1f7cfSmrgdnl the same distribution terms that you use for the rest of that
4865c1f7cfSmrgdnl program.
4965c1f7cfSmrg
5065c1f7cfSmrgdnl PKG_PREREQ(MIN-VERSION)
5165c1f7cfSmrgdnl -----------------------
5265c1f7cfSmrgdnl Since: 0.29
5365c1f7cfSmrgdnl
5465c1f7cfSmrgdnl Verify that the version of the pkg-config macros are at least
5565c1f7cfSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5665c1f7cfSmrgdnl installed version of pkg-config, this checks the developer's version
5765c1f7cfSmrgdnl of pkg.m4 when generating configure.
5865c1f7cfSmrgdnl
5965c1f7cfSmrgdnl To ensure that this macro is defined, also add:
6065c1f7cfSmrgdnl m4_ifndef([PKG_PREREQ],
6165c1f7cfSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6265c1f7cfSmrgdnl
6365c1f7cfSmrgdnl See the "Since" comment for each macro you use to see what version
6465c1f7cfSmrgdnl of the macros you require.
6565c1f7cfSmrgm4_defun([PKG_PREREQ],
6665c1f7cfSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
6765c1f7cfSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6865c1f7cfSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6965c1f7cfSmrg])dnl PKG_PREREQ
7065c1f7cfSmrg
7165c1f7cfSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7265c1f7cfSmrgdnl ----------------------------------
7365c1f7cfSmrgdnl Since: 0.16
7465c1f7cfSmrgdnl
7565c1f7cfSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7665c1f7cfSmrgdnl first found in the path. Checks that the version of pkg-config found
7765c1f7cfSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7865c1f7cfSmrgdnl used since that's the first version where most current features of
7965c1f7cfSmrgdnl pkg-config existed.
8065c1f7cfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8165c1f7cfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8265c1f7cfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8365c1f7cfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8465c1f7cfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8565c1f7cfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8665c1f7cfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87264fa531Smrg
8865c1f7cfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8965c1f7cfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9065c1f7cfSmrgfi
9165c1f7cfSmrgif test -n "$PKG_CONFIG"; then
9265c1f7cfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
9365c1f7cfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9465c1f7cfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9565c1f7cfSmrg		AC_MSG_RESULT([yes])
9665c1f7cfSmrg	else
9765c1f7cfSmrg		AC_MSG_RESULT([no])
9865c1f7cfSmrg		PKG_CONFIG=""
9965c1f7cfSmrg	fi
10065c1f7cfSmrgfi[]dnl
10165c1f7cfSmrg])dnl PKG_PROG_PKG_CONFIG
102c37a63b8Smrg
10365c1f7cfSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10465c1f7cfSmrgdnl -------------------------------------------------------------------
10565c1f7cfSmrgdnl Since: 0.18
10665c1f7cfSmrgdnl
10765c1f7cfSmrgdnl Check to see whether a particular set of modules exists. Similar to
10865c1f7cfSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10965c1f7cfSmrgdnl
11065c1f7cfSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11165c1f7cfSmrgdnl only at the first occurence in configure.ac, so if the first place
11265c1f7cfSmrgdnl it's called might be skipped (such as if it is within an "if", you
11365c1f7cfSmrgdnl have to call PKG_CHECK_EXISTS manually
11465c1f7cfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
11565c1f7cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11665c1f7cfSmrgif test -n "$PKG_CONFIG" && \
11765c1f7cfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11865c1f7cfSmrg  m4_default([$2], [:])
11965c1f7cfSmrgm4_ifvaln([$3], [else
12065c1f7cfSmrg  $3])dnl
12165c1f7cfSmrgfi])
122264fa531Smrg
12365c1f7cfSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12465c1f7cfSmrgdnl ---------------------------------------------
12565c1f7cfSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12665c1f7cfSmrgdnl pkg_failed based on the result.
12765c1f7cfSmrgm4_define([_PKG_CONFIG],
12865c1f7cfSmrg[if test -n "$$1"; then
12965c1f7cfSmrg    pkg_cv_[]$1="$$1"
13065c1f7cfSmrg elif test -n "$PKG_CONFIG"; then
13165c1f7cfSmrg    PKG_CHECK_EXISTS([$3],
13265c1f7cfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13365c1f7cfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
13465c1f7cfSmrg		     [pkg_failed=yes])
13565c1f7cfSmrg else
13665c1f7cfSmrg    pkg_failed=untried
13765c1f7cfSmrgfi[]dnl
13865c1f7cfSmrg])dnl _PKG_CONFIG
139264fa531Smrg
14065c1f7cfSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14165c1f7cfSmrgdnl ---------------------------
14265c1f7cfSmrgdnl Internal check to see if pkg-config supports short errors.
14365c1f7cfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14465c1f7cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14565c1f7cfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14665c1f7cfSmrg        _pkg_short_errors_supported=yes
14765c1f7cfSmrgelse
14865c1f7cfSmrg        _pkg_short_errors_supported=no
14965c1f7cfSmrgfi[]dnl
15065c1f7cfSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151264fa531Smrg
152264fa531Smrg
15365c1f7cfSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15465c1f7cfSmrgdnl   [ACTION-IF-NOT-FOUND])
15565c1f7cfSmrgdnl --------------------------------------------------------------
15665c1f7cfSmrgdnl Since: 0.4.0
15765c1f7cfSmrgdnl
15865c1f7cfSmrgdnl Note that if there is a possibility the first call to
15965c1f7cfSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16065c1f7cfSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16165c1f7cfSmrgAC_DEFUN([PKG_CHECK_MODULES],
16265c1f7cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16365c1f7cfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16465c1f7cfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165264fa531Smrg
16665c1f7cfSmrgpkg_failed=no
16765c1f7cfSmrgAC_MSG_CHECKING([for $1])
168264fa531Smrg
16965c1f7cfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17065c1f7cfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171264fa531Smrg
17265c1f7cfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17365c1f7cfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
17465c1f7cfSmrgSee the pkg-config man page for more details.])
175264fa531Smrg
17665c1f7cfSmrgif test $pkg_failed = yes; then
17765c1f7cfSmrg   	AC_MSG_RESULT([no])
17865c1f7cfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
17965c1f7cfSmrg        if test $_pkg_short_errors_supported = yes; then
18065c1f7cfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18165c1f7cfSmrg        else 
18265c1f7cfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18365c1f7cfSmrg        fi
18465c1f7cfSmrg	# Put the nasty error message in config.log where it belongs
18565c1f7cfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186264fa531Smrg
18765c1f7cfSmrg	m4_default([$4], [AC_MSG_ERROR(
18865c1f7cfSmrg[Package requirements ($2) were not met:
189264fa531Smrg
19065c1f7cfSmrg$$1_PKG_ERRORS
191264fa531Smrg
19265c1f7cfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19365c1f7cfSmrginstalled software in a non-standard prefix.
194264fa531Smrg
19565c1f7cfSmrg_PKG_TEXT])[]dnl
19665c1f7cfSmrg        ])
19765c1f7cfSmrgelif test $pkg_failed = untried; then
19865c1f7cfSmrg     	AC_MSG_RESULT([no])
19965c1f7cfSmrg	m4_default([$4], [AC_MSG_FAILURE(
20065c1f7cfSmrg[The pkg-config script could not be found or is too old.  Make sure it
20165c1f7cfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
20265c1f7cfSmrgpath to pkg-config.
203264fa531Smrg
20465c1f7cfSmrg_PKG_TEXT
205264fa531Smrg
20665c1f7cfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20765c1f7cfSmrg        ])
20865c1f7cfSmrgelse
20965c1f7cfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21065c1f7cfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21165c1f7cfSmrg        AC_MSG_RESULT([yes])
21265c1f7cfSmrg	$3
21365c1f7cfSmrgfi[]dnl
21465c1f7cfSmrg])dnl PKG_CHECK_MODULES
215264fa531Smrg
216264fa531Smrg
21765c1f7cfSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21865c1f7cfSmrgdnl   [ACTION-IF-NOT-FOUND])
21965c1f7cfSmrgdnl ---------------------------------------------------------------------
22065c1f7cfSmrgdnl Since: 0.29
22165c1f7cfSmrgdnl
22265c1f7cfSmrgdnl Checks for existence of MODULES and gathers its build flags with
22365c1f7cfSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22465c1f7cfSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22565c1f7cfSmrgdnl
22665c1f7cfSmrgdnl Note that if there is a possibility the first call to
22765c1f7cfSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22865c1f7cfSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22965c1f7cfSmrgdnl configure.ac.
23065c1f7cfSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23165c1f7cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23265c1f7cfSmrg_save_PKG_CONFIG=$PKG_CONFIG
23365c1f7cfSmrgPKG_CONFIG="$PKG_CONFIG --static"
23465c1f7cfSmrgPKG_CHECK_MODULES($@)
23565c1f7cfSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23665c1f7cfSmrg])dnl PKG_CHECK_MODULES_STATIC
237c37a63b8Smrg
238264fa531Smrg
23965c1f7cfSmrgdnl PKG_INSTALLDIR([DIRECTORY])
24065c1f7cfSmrgdnl -------------------------
24165c1f7cfSmrgdnl Since: 0.27
24265c1f7cfSmrgdnl
24365c1f7cfSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
24465c1f7cfSmrgdnl should install pkg-config .pc files. By default the directory is
24565c1f7cfSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
24665c1f7cfSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24765c1f7cfSmrgdnl parameter.
24865c1f7cfSmrgAC_DEFUN([PKG_INSTALLDIR],
24965c1f7cfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25065c1f7cfSmrgm4_pushdef([pkg_description],
25165c1f7cfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25265c1f7cfSmrgAC_ARG_WITH([pkgconfigdir],
25365c1f7cfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25465c1f7cfSmrg    [with_pkgconfigdir=]pkg_default)
25565c1f7cfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25665c1f7cfSmrgm4_popdef([pkg_default])
25765c1f7cfSmrgm4_popdef([pkg_description])
25865c1f7cfSmrg])dnl PKG_INSTALLDIR
25965c1f7cfSmrg
26065c1f7cfSmrg
26165c1f7cfSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26265c1f7cfSmrgdnl --------------------------------
26365c1f7cfSmrgdnl Since: 0.27
26465c1f7cfSmrgdnl
26565c1f7cfSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26665c1f7cfSmrgdnl module should install arch-independent pkg-config .pc files. By
26765c1f7cfSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
26865c1f7cfSmrgdnl changed by passing DIRECTORY. The user can override through the
26965c1f7cfSmrgdnl --with-noarch-pkgconfigdir parameter.
27065c1f7cfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27165c1f7cfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27265c1f7cfSmrgm4_pushdef([pkg_description],
27365c1f7cfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27465c1f7cfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
27565c1f7cfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27665c1f7cfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
27765c1f7cfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27865c1f7cfSmrgm4_popdef([pkg_default])
27965c1f7cfSmrgm4_popdef([pkg_description])
28065c1f7cfSmrg])dnl PKG_NOARCH_INSTALLDIR
28165c1f7cfSmrg
28265c1f7cfSmrg
28365c1f7cfSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28465c1f7cfSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28565c1f7cfSmrgdnl -------------------------------------------
28665c1f7cfSmrgdnl Since: 0.28
28765c1f7cfSmrgdnl
28865c1f7cfSmrgdnl Retrieves the value of the pkg-config variable for the given module.
28965c1f7cfSmrgAC_DEFUN([PKG_CHECK_VAR],
29065c1f7cfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29165c1f7cfSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292264fa531Smrg
29365c1f7cfSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29465c1f7cfSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29565c1f7cfSmrg
29665c1f7cfSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29765c1f7cfSmrg])dnl PKG_CHECK_VAR
29865c1f7cfSmrg
29965c1f7cfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
30065c1f7cfSmrgdnl
30165c1f7cfSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
30265c1f7cfSmrgdnl
30365c1f7cfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
30465c1f7cfSmrgdnl copy of this software and associated documentation files (the "Software"),
30565c1f7cfSmrgdnl to deal in the Software without restriction, including without limitation
30665c1f7cfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
30765c1f7cfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
30865c1f7cfSmrgdnl Software is furnished to do so, subject to the following conditions:
30965c1f7cfSmrgdnl
31065c1f7cfSmrgdnl The above copyright notice and this permission notice (including the next
31165c1f7cfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
31265c1f7cfSmrgdnl Software.
31365c1f7cfSmrgdnl
31465c1f7cfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31565c1f7cfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31665c1f7cfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31765c1f7cfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31865c1f7cfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31965c1f7cfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32065c1f7cfSmrgdnl DEALINGS IN THE SOFTWARE.
32165c1f7cfSmrg
32265c1f7cfSmrg# XORG_MACROS_VERSION(required-version)
32365c1f7cfSmrg# -------------------------------------
32465c1f7cfSmrg# Minimum version: 1.1.0
32565c1f7cfSmrg#
32665c1f7cfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
32765c1f7cfSmrg# your configure.ac with the minimum required version, such as:
32865c1f7cfSmrg# XORG_MACROS_VERSION(1.1)
32965c1f7cfSmrg#
33065c1f7cfSmrg# To ensure that this macro is defined, also add:
33165c1f7cfSmrg# m4_ifndef([XORG_MACROS_VERSION],
33265c1f7cfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
33365c1f7cfSmrg#
33465c1f7cfSmrg#
33565c1f7cfSmrg# See the "minimum version" comment for each macro you use to see what
33665c1f7cfSmrg# version you require.
33765c1f7cfSmrgm4_defun([XORG_MACROS_VERSION],[
33865c1f7cfSmrgm4_define([vers_have], [1.19.0])
33965c1f7cfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
34065c1f7cfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
34165c1f7cfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
34265c1f7cfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
34365c1f7cfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
34465c1f7cfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
34565c1f7cfSmrgm4_undefine([vers_have])
34665c1f7cfSmrgm4_undefine([maj_have])
34765c1f7cfSmrgm4_undefine([maj_needed])
34865c1f7cfSmrg]) # XORG_MACROS_VERSION
34965c1f7cfSmrg
35065c1f7cfSmrg# XORG_PROG_RAWCPP()
35165c1f7cfSmrg# ------------------
35265c1f7cfSmrg# Minimum version: 1.0.0
35365c1f7cfSmrg#
35465c1f7cfSmrg# Find cpp program and necessary flags for use in pre-processing text files
35565c1f7cfSmrg# such as man pages and config files
35665c1f7cfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
35765c1f7cfSmrgAC_REQUIRE([AC_PROG_CPP])
35865c1f7cfSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
35965c1f7cfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
36065c1f7cfSmrg
36165c1f7cfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
36265c1f7cfSmrg# which is not the best choice for supporting other OS'es, but covers most
36365c1f7cfSmrg# of the ones we need for now.
36465c1f7cfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
36565c1f7cfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
36665c1f7cfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
36765c1f7cfSmrg	AC_MSG_RESULT([no])
368264fa531Smrgelse
36965c1f7cfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37065c1f7cfSmrg		RAWCPPFLAGS=-undef
37165c1f7cfSmrg		AC_MSG_RESULT([yes])
37265c1f7cfSmrg	# under Cygwin unix is still defined even with -undef
37365c1f7cfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37465c1f7cfSmrg		RAWCPPFLAGS="-undef -ansi"
37565c1f7cfSmrg		AC_MSG_RESULT([yes, with -ansi])
37665c1f7cfSmrg	else
37765c1f7cfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
37865c1f7cfSmrg	fi
379264fa531Smrgfi
38065c1f7cfSmrgrm -f conftest.$ac_ext
381264fa531Smrg
38265c1f7cfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
38365c1f7cfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
38465c1f7cfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38565c1f7cfSmrg	AC_MSG_RESULT([no])
38665c1f7cfSmrgelse
38765c1f7cfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38865c1f7cfSmrg		TRADITIONALCPPFLAGS="-traditional"
38965c1f7cfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
39065c1f7cfSmrg		AC_MSG_RESULT([yes])
39165c1f7cfSmrg	else
39265c1f7cfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
39365c1f7cfSmrg	fi
39465c1f7cfSmrgfi
39565c1f7cfSmrgrm -f conftest.$ac_ext
39665c1f7cfSmrgAC_SUBST(RAWCPPFLAGS)
39765c1f7cfSmrgAC_SUBST(TRADITIONALCPPFLAGS)
39865c1f7cfSmrg]) # XORG_PROG_RAWCPP
399264fa531Smrg
40065c1f7cfSmrg# XORG_MANPAGE_SECTIONS()
40165c1f7cfSmrg# -----------------------
40265c1f7cfSmrg# Minimum version: 1.0.0
40365c1f7cfSmrg#
40465c1f7cfSmrg# Determine which sections man pages go in for the different man page types
40565c1f7cfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
40665c1f7cfSmrg# Not sure if there's any better way than just hardcoding by OS name.
40765c1f7cfSmrg# Override default settings by setting environment variables
40865c1f7cfSmrg# Added MAN_SUBSTS in version 1.8
40965c1f7cfSmrg# Added AC_PROG_SED in version 1.8
410264fa531Smrg
41165c1f7cfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
41265c1f7cfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
41365c1f7cfSmrgAC_REQUIRE([AC_PROG_SED])
414264fa531Smrg
41565c1f7cfSmrgif test x$APP_MAN_SUFFIX = x    ; then
41665c1f7cfSmrg    APP_MAN_SUFFIX=1
41765c1f7cfSmrgfi
41865c1f7cfSmrgif test x$APP_MAN_DIR = x    ; then
41965c1f7cfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420264fa531Smrgfi
421264fa531Smrg
42265c1f7cfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
42365c1f7cfSmrg    LIB_MAN_SUFFIX=3
42465c1f7cfSmrgfi
42565c1f7cfSmrgif test x$LIB_MAN_DIR = x    ; then
42665c1f7cfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
42765c1f7cfSmrgfi
428264fa531Smrg
42965c1f7cfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
43065c1f7cfSmrg    case $host_os in
43165c1f7cfSmrg	# Solaris 2.0 - 11 use SysV man page sections
43265c1f7cfSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
43365c1f7cfSmrg	*)				FILE_MAN_SUFFIX=5  ;;
43465c1f7cfSmrg    esac
43565c1f7cfSmrgfi
43665c1f7cfSmrgif test x$FILE_MAN_DIR = x    ; then
43765c1f7cfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
43865c1f7cfSmrgfi
439264fa531Smrg
44065c1f7cfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
44165c1f7cfSmrg    case $host_os in
44265c1f7cfSmrg	# Solaris 2.0 - 11 use SysV man page sections
44365c1f7cfSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
44465c1f7cfSmrg	*)				MISC_MAN_SUFFIX=7  ;;
44565c1f7cfSmrg    esac
44665c1f7cfSmrgfi
44765c1f7cfSmrgif test x$MISC_MAN_DIR = x    ; then
44865c1f7cfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
44965c1f7cfSmrgfi
450264fa531Smrg
45165c1f7cfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
45265c1f7cfSmrg    case $host_os in
45365c1f7cfSmrg	# Solaris 2.0 - 11 use SysV man page sections
45465c1f7cfSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
45565c1f7cfSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
45665c1f7cfSmrg    esac
45765c1f7cfSmrgfi
45865c1f7cfSmrgif test x$DRIVER_MAN_DIR = x    ; then
45965c1f7cfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
46065c1f7cfSmrgfi
46165c1f7cfSmrg
46265c1f7cfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
46365c1f7cfSmrg    case $host_os in
46465c1f7cfSmrg	# Solaris 2.0 - 11 use SysV man page sections
46565c1f7cfSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
46665c1f7cfSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
46765c1f7cfSmrg    esac
46865c1f7cfSmrgfi
46965c1f7cfSmrgif test x$ADMIN_MAN_DIR = x    ; then
47065c1f7cfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
47165c1f7cfSmrgfi
472264fa531Smrg
473264fa531Smrg
47465c1f7cfSmrgAC_SUBST([APP_MAN_SUFFIX])
47565c1f7cfSmrgAC_SUBST([LIB_MAN_SUFFIX])
47665c1f7cfSmrgAC_SUBST([FILE_MAN_SUFFIX])
47765c1f7cfSmrgAC_SUBST([MISC_MAN_SUFFIX])
47865c1f7cfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
47965c1f7cfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
48065c1f7cfSmrgAC_SUBST([APP_MAN_DIR])
48165c1f7cfSmrgAC_SUBST([LIB_MAN_DIR])
48265c1f7cfSmrgAC_SUBST([FILE_MAN_DIR])
48365c1f7cfSmrgAC_SUBST([MISC_MAN_DIR])
48465c1f7cfSmrgAC_SUBST([DRIVER_MAN_DIR])
48565c1f7cfSmrgAC_SUBST([ADMIN_MAN_DIR])
48665c1f7cfSmrg
48765c1f7cfSmrgXORG_MAN_PAGE="X Version 11"
48865c1f7cfSmrgAC_SUBST([XORG_MAN_PAGE])
48965c1f7cfSmrgMAN_SUBSTS="\
49065c1f7cfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49165c1f7cfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49265c1f7cfSmrg	-e 's|__xservername__|Xorg|g' \
49365c1f7cfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
49465c1f7cfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
49565c1f7cfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
49665c1f7cfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
49765c1f7cfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
49865c1f7cfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
49965c1f7cfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
50065c1f7cfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
50165c1f7cfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
50265c1f7cfSmrgAC_SUBST([MAN_SUBSTS])
50365c1f7cfSmrg
50465c1f7cfSmrg]) # XORG_MANPAGE_SECTIONS
50565c1f7cfSmrg
50665c1f7cfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
50765c1f7cfSmrg# ------------------------
50865c1f7cfSmrg# Minimum version: 1.7.0
509264fa531Smrg#
51065c1f7cfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
51165c1f7cfSmrg# provided by xorg-sgml-doctools, if installed.
51265c1f7cfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
51365c1f7cfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
51465c1f7cfSmrgXORG_SGML_PATH=
51565c1f7cfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
51665c1f7cfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
51765c1f7cfSmrg    [m4_ifval([$1],[:],
51865c1f7cfSmrg        [if test x"$cross_compiling" != x"yes" ; then
51965c1f7cfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
52065c1f7cfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
52165c1f7cfSmrg         fi])
52265c1f7cfSmrg    ])
523264fa531Smrg
52465c1f7cfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
52565c1f7cfSmrg# the path and the name of the doc stylesheet
52665c1f7cfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
52765c1f7cfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
52865c1f7cfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
52965c1f7cfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
53065c1f7cfSmrgelse
53165c1f7cfSmrg   AC_MSG_RESULT([no])
53265c1f7cfSmrgfi
533264fa531Smrg
53465c1f7cfSmrgAC_SUBST(XORG_SGML_PATH)
53565c1f7cfSmrgAC_SUBST(STYLESHEET_SRCDIR)
53665c1f7cfSmrgAC_SUBST(XSL_STYLESHEET)
53765c1f7cfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
53865c1f7cfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
53965c1f7cfSmrg
54065c1f7cfSmrg# XORG_CHECK_LINUXDOC
54165c1f7cfSmrg# -------------------
54265c1f7cfSmrg# Minimum version: 1.0.0
543c37a63b8Smrg#
54465c1f7cfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
54565c1f7cfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
54665c1f7cfSmrg# Whether or not the necessary tools and files are found can be checked
54765c1f7cfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
54865c1f7cfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
54965c1f7cfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
55065c1f7cfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551264fa531Smrg
55265c1f7cfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553c37a63b8Smrg
55465c1f7cfSmrgAC_MSG_CHECKING([whether to build documentation])
555533545b5Smrg
55665c1f7cfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
55765c1f7cfSmrg   BUILDDOC=yes
55865c1f7cfSmrgelse
55965c1f7cfSmrg   BUILDDOC=no
560264fa531Smrgfi
561c37a63b8Smrg
56265c1f7cfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
56365c1f7cfSmrg
56465c1f7cfSmrgAC_MSG_RESULT([$BUILDDOC])
56565c1f7cfSmrg
56665c1f7cfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
56765c1f7cfSmrg
56865c1f7cfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
56965c1f7cfSmrg   BUILDPDFDOC=yes
57065c1f7cfSmrgelse
57165c1f7cfSmrg   BUILDPDFDOC=no
572264fa531Smrgfi
573264fa531Smrg
57465c1f7cfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575264fa531Smrg
57665c1f7cfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
577264fa531Smrg
57865c1f7cfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
57965c1f7cfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
58065c1f7cfSmrgMAKE_PDF="$PS2PDF"
58165c1f7cfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582533545b5Smrg
58365c1f7cfSmrgAC_SUBST(MAKE_TEXT)
58465c1f7cfSmrgAC_SUBST(MAKE_PS)
58565c1f7cfSmrgAC_SUBST(MAKE_PDF)
58665c1f7cfSmrgAC_SUBST(MAKE_HTML)
58765c1f7cfSmrg]) # XORG_CHECK_LINUXDOC
588533545b5Smrg
58965c1f7cfSmrg# XORG_CHECK_DOCBOOK
59065c1f7cfSmrg# -------------------
59165c1f7cfSmrg# Minimum version: 1.0.0
59265c1f7cfSmrg#
59365c1f7cfSmrg# Checks for the ability to build output formats from SGML DocBook source.
59465c1f7cfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
59565c1f7cfSmrg# indicates whether the necessary tools and files are found and, if set,
59665c1f7cfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
59765c1f7cfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
59865c1f7cfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599533545b5Smrg
60065c1f7cfSmrgBUILDTXTDOC=no
60165c1f7cfSmrgBUILDPDFDOC=no
60265c1f7cfSmrgBUILDPSDOC=no
60365c1f7cfSmrgBUILDHTMLDOC=no
604533545b5Smrg
60565c1f7cfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
60665c1f7cfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
60765c1f7cfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
60865c1f7cfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609533545b5Smrg
61065c1f7cfSmrgAC_MSG_CHECKING([whether to build text documentation])
61165c1f7cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
61265c1f7cfSmrg   test x$BUILD_TXTDOC != xno; then
61365c1f7cfSmrg	BUILDTXTDOC=yes
61465c1f7cfSmrgfi
61565c1f7cfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
61665c1f7cfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
617533545b5Smrg
61865c1f7cfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
61965c1f7cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
62065c1f7cfSmrg   test x$BUILD_PDFDOC != xno; then
62165c1f7cfSmrg	BUILDPDFDOC=yes
62265c1f7cfSmrgfi
62365c1f7cfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
62465c1f7cfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
625533545b5Smrg
62665c1f7cfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
62765c1f7cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
62865c1f7cfSmrg   test x$BUILD_PSDOC != xno; then
62965c1f7cfSmrg	BUILDPSDOC=yes
630533545b5Smrgfi
63165c1f7cfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
63265c1f7cfSmrgAC_MSG_RESULT([$BUILDPSDOC])
633264fa531Smrg
63465c1f7cfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
63565c1f7cfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
63665c1f7cfSmrg   test x$BUILD_HTMLDOC != xno; then
63765c1f7cfSmrg	BUILDHTMLDOC=yes
63865c1f7cfSmrgfi
63965c1f7cfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
64065c1f7cfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641264fa531Smrg
64265c1f7cfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
64365c1f7cfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
64465c1f7cfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
64565c1f7cfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
646c37a63b8Smrg
64765c1f7cfSmrgAC_SUBST(MAKE_TEXT)
64865c1f7cfSmrgAC_SUBST(MAKE_PS)
64965c1f7cfSmrgAC_SUBST(MAKE_PDF)
65065c1f7cfSmrgAC_SUBST(MAKE_HTML)
65165c1f7cfSmrg]) # XORG_CHECK_DOCBOOK
652264fa531Smrg
65365c1f7cfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
65465c1f7cfSmrg# ----------------
65565c1f7cfSmrg# Minimum version: 1.5.0
65665c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
657c37a63b8Smrg#
65865c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
65965c1f7cfSmrg# not at the appropriate level. This macro enables a module to test for the
66065c1f7cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
66165c1f7cfSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
66265c1f7cfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
66365c1f7cfSmrg# --with-xmlto assumes 'auto'.
664c37a63b8Smrg#
66565c1f7cfSmrg# Interface to module:
66665c1f7cfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
66765c1f7cfSmrg# XMLTO:	returns the path of the xmlto program found
66865c1f7cfSmrg#		returns the path set by the user in the environment
66965c1f7cfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
67065c1f7cfSmrg#		'no' user instructs the module not to use xmlto
67165c1f7cfSmrg#
67265c1f7cfSmrg# Added in version 1.10.0
67365c1f7cfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
67465c1f7cfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
67565c1f7cfSmrg#
67665c1f7cfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
67765c1f7cfSmrg#
67865c1f7cfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
67965c1f7cfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
68065c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
68165c1f7cfSmrgAC_ARG_WITH(xmlto,
68265c1f7cfSmrg	AS_HELP_STRING([--with-xmlto],
68365c1f7cfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
68465c1f7cfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
68565c1f7cfSmrgm4_undefine([_defopt])
686264fa531Smrg
68765c1f7cfSmrgif test "x$use_xmlto" = x"auto"; then
68865c1f7cfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
68965c1f7cfSmrg   if test "x$XMLTO" = "x"; then
69065c1f7cfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
69165c1f7cfSmrg	have_xmlto=no
69265c1f7cfSmrg   else
69365c1f7cfSmrg        have_xmlto=yes
69465c1f7cfSmrg   fi
69565c1f7cfSmrgelif test "x$use_xmlto" = x"yes" ; then
69665c1f7cfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
69765c1f7cfSmrg   if test "x$XMLTO" = "x"; then
69865c1f7cfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
69965c1f7cfSmrg   fi
70065c1f7cfSmrg   have_xmlto=yes
70165c1f7cfSmrgelif test "x$use_xmlto" = x"no" ; then
70265c1f7cfSmrg   if test "x$XMLTO" != "x"; then
70365c1f7cfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
70465c1f7cfSmrg   fi
70565c1f7cfSmrg   have_xmlto=no
706c37a63b8Smrgelse
70765c1f7cfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
708c37a63b8Smrgfi
709264fa531Smrg
71065c1f7cfSmrg# Test for a minimum version of xmlto, if provided.
71165c1f7cfSmrgm4_ifval([$1],
71265c1f7cfSmrg[if test "$have_xmlto" = yes; then
71365c1f7cfSmrg    # scrape the xmlto version
71465c1f7cfSmrg    AC_MSG_CHECKING([the xmlto version])
71565c1f7cfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
71665c1f7cfSmrg    AC_MSG_RESULT([$xmlto_version])
71765c1f7cfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
71865c1f7cfSmrg        [if test "x$use_xmlto" = xauto; then
71965c1f7cfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
72065c1f7cfSmrg            have_xmlto=no
72165c1f7cfSmrg        else
72265c1f7cfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
72365c1f7cfSmrg        fi])
72465c1f7cfSmrgfi])
725264fa531Smrg
72665c1f7cfSmrg# Test for the ability of xmlto to generate a text target
727c37a63b8Smrg#
72865c1f7cfSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
72965c1f7cfSmrg# following test for empty XML docbook files.
73065c1f7cfSmrg# For compatibility reasons use the following empty XML docbook file and if
73165c1f7cfSmrg# it fails try it again with a non-empty XML file.
73265c1f7cfSmrghave_xmlto_text=no
73365c1f7cfSmrgcat > conftest.xml << "EOF"
73465c1f7cfSmrgEOF
73565c1f7cfSmrgAS_IF([test "$have_xmlto" = yes],
73665c1f7cfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73765c1f7cfSmrg             [have_xmlto_text=yes],
73865c1f7cfSmrg             [# Try it again with a non-empty XML file.
73965c1f7cfSmrg              cat > conftest.xml << "EOF"
74065c1f7cfSmrg<x></x>
74165c1f7cfSmrgEOF
74265c1f7cfSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
74365c1f7cfSmrg                    [have_xmlto_text=yes],
74465c1f7cfSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
74565c1f7cfSmrgrm -f conftest.xml
74665c1f7cfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
74765c1f7cfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
74865c1f7cfSmrg]) # XORG_WITH_XMLTO
749264fa531Smrg
75065c1f7cfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
75165c1f7cfSmrg# --------------------------------------------
75265c1f7cfSmrg# Minimum version: 1.12.0
75365c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
754c37a63b8Smrg#
75565c1f7cfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
75665c1f7cfSmrg# XML-based language used for the transformation of XML documents.
75765c1f7cfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
75865c1f7cfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
75965c1f7cfSmrg# The XSLT processor is often used as a standalone tool for transformations.
76065c1f7cfSmrg# It should not be assumed that this tool is used only to work with documnetation.
76165c1f7cfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
76265c1f7cfSmrg#
76365c1f7cfSmrg# Interface to module:
76465c1f7cfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
76565c1f7cfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
76665c1f7cfSmrg#		 returns the path set by the user in the environment
76765c1f7cfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
76865c1f7cfSmrg#		  'no' user instructs the module not to use xsltproc
76965c1f7cfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
77065c1f7cfSmrg#
77165c1f7cfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
77265c1f7cfSmrg#
77365c1f7cfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
77465c1f7cfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
77565c1f7cfSmrg# Preserves the interface, should it be implemented later
77665c1f7cfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
77765c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
77865c1f7cfSmrgAC_ARG_WITH(xsltproc,
77965c1f7cfSmrg	AS_HELP_STRING([--with-xsltproc],
78065c1f7cfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
78165c1f7cfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
78265c1f7cfSmrgm4_undefine([_defopt])
783264fa531Smrg
78465c1f7cfSmrgif test "x$use_xsltproc" = x"auto"; then
78565c1f7cfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
78665c1f7cfSmrg   if test "x$XSLTPROC" = "x"; then
78765c1f7cfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
78865c1f7cfSmrg	have_xsltproc=no
78965c1f7cfSmrg   else
79065c1f7cfSmrg        have_xsltproc=yes
79165c1f7cfSmrg   fi
79265c1f7cfSmrgelif test "x$use_xsltproc" = x"yes" ; then
79365c1f7cfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
79465c1f7cfSmrg   if test "x$XSLTPROC" = "x"; then
79565c1f7cfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
79665c1f7cfSmrg   fi
79765c1f7cfSmrg   have_xsltproc=yes
79865c1f7cfSmrgelif test "x$use_xsltproc" = x"no" ; then
79965c1f7cfSmrg   if test "x$XSLTPROC" != "x"; then
80065c1f7cfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
80165c1f7cfSmrg   fi
80265c1f7cfSmrg   have_xsltproc=no
803c37a63b8Smrgelse
80465c1f7cfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805c37a63b8Smrgfi
806264fa531Smrg
80765c1f7cfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
80865c1f7cfSmrg]) # XORG_WITH_XSLTPROC
809c37a63b8Smrg
81065c1f7cfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
81165c1f7cfSmrg# ----------------------------------------
81265c1f7cfSmrg# Minimum version: 1.15.0
813264fa531Smrg#
81465c1f7cfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
81565c1f7cfSmrg# scanning arbitrary text files, extracting information from those text files,
81665c1f7cfSmrg# and printing reports based on that information.
81765c1f7cfSmrg#
81865c1f7cfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
81965c1f7cfSmrg#
82065c1f7cfSmrg# Interface to module:
82165c1f7cfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
82265c1f7cfSmrg# PERL:	     returns the path of the perl program found
82365c1f7cfSmrg#	     returns the path set by the user in the environment
82465c1f7cfSmrg# --with-perl: 'yes' user instructs the module to use perl
82565c1f7cfSmrg#	       'no' user instructs the module not to use perl
82665c1f7cfSmrg# have_perl: returns yes if perl found in PATH or no
82765c1f7cfSmrg#
82865c1f7cfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
82965c1f7cfSmrg#
83065c1f7cfSmrgAC_DEFUN([XORG_WITH_PERL],[
83165c1f7cfSmrgAC_ARG_VAR([PERL], [Path to perl command])
83265c1f7cfSmrg# Preserves the interface, should it be implemented later
83365c1f7cfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
83465c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
83565c1f7cfSmrgAC_ARG_WITH(perl,
83665c1f7cfSmrg	AS_HELP_STRING([--with-perl],
83765c1f7cfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
83865c1f7cfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
83965c1f7cfSmrgm4_undefine([_defopt])
840c37a63b8Smrg
84165c1f7cfSmrgif test "x$use_perl" = x"auto"; then
84265c1f7cfSmrg   AC_PATH_PROG([PERL], [perl])
84365c1f7cfSmrg   if test "x$PERL" = "x"; then
84465c1f7cfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
84565c1f7cfSmrg	have_perl=no
84665c1f7cfSmrg   else
84765c1f7cfSmrg        have_perl=yes
84865c1f7cfSmrg   fi
84965c1f7cfSmrgelif test "x$use_perl" = x"yes" ; then
85065c1f7cfSmrg   AC_PATH_PROG([PERL], [perl])
85165c1f7cfSmrg   if test "x$PERL" = "x"; then
85265c1f7cfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
85365c1f7cfSmrg   fi
85465c1f7cfSmrg   have_perl=yes
85565c1f7cfSmrgelif test "x$use_perl" = x"no" ; then
85665c1f7cfSmrg   if test "x$PERL" != "x"; then
85765c1f7cfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
85865c1f7cfSmrg   fi
85965c1f7cfSmrg   have_perl=no
86065c1f7cfSmrgelse
86165c1f7cfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
86265c1f7cfSmrgfi
863c37a63b8Smrg
86465c1f7cfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
86565c1f7cfSmrg]) # XORG_WITH_PERL
866c37a63b8Smrg
86765c1f7cfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
86865c1f7cfSmrg# ----------------
86965c1f7cfSmrg# Minimum version: 1.5.0
87065c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
871533545b5Smrg#
87265c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
87365c1f7cfSmrg# not at the appropriate level. This macro enables a module to test for the
87465c1f7cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
87565c1f7cfSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
87665c1f7cfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
87765c1f7cfSmrg# --with-asciidoc assumes 'auto'.
87865c1f7cfSmrg#
87965c1f7cfSmrg# Interface to module:
88065c1f7cfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
88165c1f7cfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
88265c1f7cfSmrg#		 returns the path set by the user in the environment
88365c1f7cfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
88465c1f7cfSmrg#		  'no' user instructs the module not to use asciidoc
88565c1f7cfSmrg#
88665c1f7cfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
88765c1f7cfSmrg#
88865c1f7cfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
88965c1f7cfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
89065c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
89165c1f7cfSmrgAC_ARG_WITH(asciidoc,
89265c1f7cfSmrg	AS_HELP_STRING([--with-asciidoc],
89365c1f7cfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
89465c1f7cfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
89565c1f7cfSmrgm4_undefine([_defopt])
896533545b5Smrg
89765c1f7cfSmrgif test "x$use_asciidoc" = x"auto"; then
89865c1f7cfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
89965c1f7cfSmrg   if test "x$ASCIIDOC" = "x"; then
90065c1f7cfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
90165c1f7cfSmrg	have_asciidoc=no
90265c1f7cfSmrg   else
90365c1f7cfSmrg        have_asciidoc=yes
90465c1f7cfSmrg   fi
90565c1f7cfSmrgelif test "x$use_asciidoc" = x"yes" ; then
90665c1f7cfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
90765c1f7cfSmrg   if test "x$ASCIIDOC" = "x"; then
90865c1f7cfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
90965c1f7cfSmrg   fi
91065c1f7cfSmrg   have_asciidoc=yes
91165c1f7cfSmrgelif test "x$use_asciidoc" = x"no" ; then
91265c1f7cfSmrg   if test "x$ASCIIDOC" != "x"; then
91365c1f7cfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
91465c1f7cfSmrg   fi
91565c1f7cfSmrg   have_asciidoc=no
91665c1f7cfSmrgelse
91765c1f7cfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918533545b5Smrgfi
91965c1f7cfSmrgm4_ifval([$1],
92065c1f7cfSmrg[if test "$have_asciidoc" = yes; then
92165c1f7cfSmrg    # scrape the asciidoc version
92265c1f7cfSmrg    AC_MSG_CHECKING([the asciidoc version])
92365c1f7cfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
92465c1f7cfSmrg    AC_MSG_RESULT([$asciidoc_version])
92565c1f7cfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
92665c1f7cfSmrg        [if test "x$use_asciidoc" = xauto; then
92765c1f7cfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
92865c1f7cfSmrg            have_asciidoc=no
92965c1f7cfSmrg        else
93065c1f7cfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
93165c1f7cfSmrg        fi])
93265c1f7cfSmrgfi])
93365c1f7cfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
93465c1f7cfSmrg]) # XORG_WITH_ASCIIDOC
935533545b5Smrg
93665c1f7cfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
93765c1f7cfSmrg# -------------------------------------------
93865c1f7cfSmrg# Minimum version: 1.5.0
93965c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
94065c1f7cfSmrg# Minimum version for optional DOT checking: 1.18.0
941264fa531Smrg#
94265c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
94365c1f7cfSmrg# not at the appropriate level. This macro enables a module to test for the
94465c1f7cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
94565c1f7cfSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
94665c1f7cfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
94765c1f7cfSmrg# --with-doxygen assumes 'auto'.
948533545b5Smrg#
94965c1f7cfSmrg# Interface to module:
95065c1f7cfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
95165c1f7cfSmrg# DOXYGEN:	 returns the path of the doxygen program found
95265c1f7cfSmrg#		 returns the path set by the user in the environment
95365c1f7cfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
95465c1f7cfSmrg#		  'no' user instructs the module not to use doxygen
95565c1f7cfSmrg#
95665c1f7cfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
95765c1f7cfSmrg#
95865c1f7cfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
95965c1f7cfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
96065c1f7cfSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
96165c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
96265c1f7cfSmrgAC_ARG_WITH(doxygen,
96365c1f7cfSmrg	AS_HELP_STRING([--with-doxygen],
96465c1f7cfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
96565c1f7cfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
96665c1f7cfSmrgm4_undefine([_defopt])
967533545b5Smrg
96865c1f7cfSmrgif test "x$use_doxygen" = x"auto"; then
96965c1f7cfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97065c1f7cfSmrg   if test "x$DOXYGEN" = "x"; then
97165c1f7cfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
97265c1f7cfSmrg	have_doxygen=no
97365c1f7cfSmrg   else
97465c1f7cfSmrg        have_doxygen=yes
97565c1f7cfSmrg   fi
97665c1f7cfSmrgelif test "x$use_doxygen" = x"yes" ; then
97765c1f7cfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97865c1f7cfSmrg   if test "x$DOXYGEN" = "x"; then
97965c1f7cfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
98065c1f7cfSmrg   fi
98165c1f7cfSmrg   have_doxygen=yes
98265c1f7cfSmrgelif test "x$use_doxygen" = x"no" ; then
98365c1f7cfSmrg   if test "x$DOXYGEN" != "x"; then
98465c1f7cfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
98565c1f7cfSmrg   fi
98665c1f7cfSmrg   have_doxygen=no
987264fa531Smrgelse
98865c1f7cfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
989c37a63b8Smrgfi
99065c1f7cfSmrgm4_ifval([$1],
99165c1f7cfSmrg[if test "$have_doxygen" = yes; then
99265c1f7cfSmrg    # scrape the doxygen version
99365c1f7cfSmrg    AC_MSG_CHECKING([the doxygen version])
99465c1f7cfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
99565c1f7cfSmrg    AC_MSG_RESULT([$doxygen_version])
99665c1f7cfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
99765c1f7cfSmrg        [if test "x$use_doxygen" = xauto; then
99865c1f7cfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
99965c1f7cfSmrg            have_doxygen=no
100065c1f7cfSmrg        else
100165c1f7cfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
100265c1f7cfSmrg        fi])
100365c1f7cfSmrgfi])
100465c1f7cfSmrg
100565c1f7cfSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
100665c1f7cfSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
100765c1f7cfSmrgdnl 	HAVE_DOT = @HAVE_DOT@
100865c1f7cfSmrgHAVE_DOT=no
100965c1f7cfSmrgif test "x$have_doxygen" = "xyes"; then
101065c1f7cfSmrg  AC_PATH_PROG([DOT], [dot])
101165c1f7cfSmrg    if test "x$DOT" != "x"; then
101265c1f7cfSmrg      HAVE_DOT=yes
101365c1f7cfSmrg    fi
1014533545b5Smrgfi
1015264fa531Smrg
101665c1f7cfSmrgAC_SUBST([HAVE_DOT])
101765c1f7cfSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
101865c1f7cfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
101965c1f7cfSmrg]) # XORG_WITH_DOXYGEN
1020c37a63b8Smrg
102165c1f7cfSmrg# XORG_WITH_GROFF([DEFAULT])
102265c1f7cfSmrg# ----------------
102365c1f7cfSmrg# Minimum version: 1.6.0
102465c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1025264fa531Smrg#
102665c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
102765c1f7cfSmrg# not at the appropriate level. This macro enables a module to test for the
102865c1f7cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
102965c1f7cfSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
103065c1f7cfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
103165c1f7cfSmrg# --with-groff assumes 'auto'.
103265c1f7cfSmrg#
103365c1f7cfSmrg# Interface to module:
103465c1f7cfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
103565c1f7cfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
103665c1f7cfSmrg# HAVE_GROFF_MS: the -ms macros package
103765c1f7cfSmrg# GROFF:	 returns the path of the groff program found
103865c1f7cfSmrg#		 returns the path set by the user in the environment
103965c1f7cfSmrg# --with-groff:	 'yes' user instructs the module to use groff
104065c1f7cfSmrg#		 'no' user instructs the module not to use groff
104165c1f7cfSmrg#
104265c1f7cfSmrg# Added in version 1.9.0:
104365c1f7cfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
104465c1f7cfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
104565c1f7cfSmrg#		   psselect from the psutils package.
104665c1f7cfSmrg#		   the ghostcript package. Refer to the grohtml man pages
104765c1f7cfSmrg#
104865c1f7cfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
104965c1f7cfSmrg#
105065c1f7cfSmrg# OS and distros often splits groff in a basic and full package, the former
105165c1f7cfSmrg# having the groff program and the later having devices, fonts and macros
105265c1f7cfSmrg# Checking for the groff executable is not enough.
105365c1f7cfSmrg#
105465c1f7cfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
105565c1f7cfSmrg# unset HAVE_GROFF or GROFF env variables.
105665c1f7cfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
105765c1f7cfSmrg#
105865c1f7cfSmrgAC_DEFUN([XORG_WITH_GROFF],[
105965c1f7cfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
106065c1f7cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
106165c1f7cfSmrgAC_ARG_WITH(groff,
106265c1f7cfSmrg	AS_HELP_STRING([--with-groff],
106365c1f7cfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
106465c1f7cfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
106565c1f7cfSmrgm4_undefine([_defopt])
1066c37a63b8Smrg
106765c1f7cfSmrgif test "x$use_groff" = x"auto"; then
106865c1f7cfSmrg   AC_PATH_PROG([GROFF], [groff])
106965c1f7cfSmrg   if test "x$GROFF" = "x"; then
107065c1f7cfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
107165c1f7cfSmrg	have_groff=no
107265c1f7cfSmrg   else
107365c1f7cfSmrg        have_groff=yes
107465c1f7cfSmrg   fi
107565c1f7cfSmrgelif test "x$use_groff" = x"yes" ; then
107665c1f7cfSmrg   AC_PATH_PROG([GROFF], [groff])
107765c1f7cfSmrg   if test "x$GROFF" = "x"; then
107865c1f7cfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
107965c1f7cfSmrg   fi
108065c1f7cfSmrg   have_groff=yes
108165c1f7cfSmrgelif test "x$use_groff" = x"no" ; then
108265c1f7cfSmrg   if test "x$GROFF" != "x"; then
108365c1f7cfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
108465c1f7cfSmrg   fi
108565c1f7cfSmrg   have_groff=no
108665c1f7cfSmrgelse
108765c1f7cfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1088c37a63b8Smrgfi
1089c37a63b8Smrg
109065c1f7cfSmrg# We have groff, test for the presence of the macro packages
109165c1f7cfSmrgif test "x$have_groff" = x"yes"; then
109265c1f7cfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
109365c1f7cfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
109465c1f7cfSmrg        groff_ms_works=yes
109565c1f7cfSmrg    else
109665c1f7cfSmrg        groff_ms_works=no
109765c1f7cfSmrg    fi
109865c1f7cfSmrg    AC_MSG_RESULT([$groff_ms_works])
109965c1f7cfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
110065c1f7cfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
110165c1f7cfSmrg        groff_mm_works=yes
110265c1f7cfSmrg    else
110365c1f7cfSmrg        groff_mm_works=no
110465c1f7cfSmrg    fi
110565c1f7cfSmrg    AC_MSG_RESULT([$groff_mm_works])
110665c1f7cfSmrgfi
1107264fa531Smrg
110865c1f7cfSmrg# We have groff, test for HTML dependencies, one command per package
110965c1f7cfSmrgif test "x$have_groff" = x"yes"; then
111065c1f7cfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
111165c1f7cfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
111265c1f7cfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
111365c1f7cfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
111465c1f7cfSmrg      have_groff_html=yes
111565c1f7cfSmrg   else
111665c1f7cfSmrg      have_groff_html=no
111765c1f7cfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
111865c1f7cfSmrg   fi
111965c1f7cfSmrgfi
1120264fa531Smrg
112165c1f7cfSmrg# Set Automake conditionals for Makefiles
112265c1f7cfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
112365c1f7cfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
112465c1f7cfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
112565c1f7cfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
112665c1f7cfSmrg]) # XORG_WITH_GROFF
1127c37a63b8Smrg
112865c1f7cfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
112965c1f7cfSmrg# ---------------------------------------
113065c1f7cfSmrg# Minimum version: 1.6.0
113165c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
113265c1f7cfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1133c37a63b8Smrg#
113465c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
113565c1f7cfSmrg# not at the appropriate level. This macro enables a module to test for the
113665c1f7cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
113765c1f7cfSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
113865c1f7cfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
113965c1f7cfSmrg# --with-fop assumes 'auto'.
1140c37a63b8Smrg#
114165c1f7cfSmrg# Interface to module:
114265c1f7cfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
114365c1f7cfSmrg# FOP:	 	returns the path of the fop program found
114465c1f7cfSmrg#		returns the path set by the user in the environment
114565c1f7cfSmrg# --with-fop: 	'yes' user instructs the module to use fop
114665c1f7cfSmrg#		'no' user instructs the module not to use fop
1147c37a63b8Smrg#
114865c1f7cfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149533545b5Smrg#
115065c1f7cfSmrgAC_DEFUN([XORG_WITH_FOP],[
115165c1f7cfSmrgAC_ARG_VAR([FOP], [Path to fop command])
115265c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
115365c1f7cfSmrgAC_ARG_WITH(fop,
115465c1f7cfSmrg	AS_HELP_STRING([--with-fop],
115565c1f7cfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
115665c1f7cfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
115765c1f7cfSmrgm4_undefine([_defopt])
1158533545b5Smrg
115965c1f7cfSmrgif test "x$use_fop" = x"auto"; then
116065c1f7cfSmrg   AC_PATH_PROG([FOP], [fop])
116165c1f7cfSmrg   if test "x$FOP" = "x"; then
116265c1f7cfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
116365c1f7cfSmrg	have_fop=no
116465c1f7cfSmrg   else
116565c1f7cfSmrg        have_fop=yes
116665c1f7cfSmrg   fi
116765c1f7cfSmrgelif test "x$use_fop" = x"yes" ; then
116865c1f7cfSmrg   AC_PATH_PROG([FOP], [fop])
116965c1f7cfSmrg   if test "x$FOP" = "x"; then
117065c1f7cfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
117165c1f7cfSmrg   fi
117265c1f7cfSmrg   have_fop=yes
117365c1f7cfSmrgelif test "x$use_fop" = x"no" ; then
117465c1f7cfSmrg   if test "x$FOP" != "x"; then
117565c1f7cfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
117665c1f7cfSmrg   fi
117765c1f7cfSmrg   have_fop=no
117865c1f7cfSmrgelse
117965c1f7cfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
118065c1f7cfSmrgfi
1181533545b5Smrg
118265c1f7cfSmrg# Test for a minimum version of fop, if provided.
118365c1f7cfSmrgm4_ifval([$1],
118465c1f7cfSmrg[if test "$have_fop" = yes; then
118565c1f7cfSmrg    # scrape the fop version
118665c1f7cfSmrg    AC_MSG_CHECKING([for fop minimum version])
118765c1f7cfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
118865c1f7cfSmrg    AC_MSG_RESULT([$fop_version])
118965c1f7cfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
119065c1f7cfSmrg        [if test "x$use_fop" = xauto; then
119165c1f7cfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
119265c1f7cfSmrg            have_fop=no
119365c1f7cfSmrg        else
119465c1f7cfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
119565c1f7cfSmrg        fi])
119665c1f7cfSmrgfi])
119765c1f7cfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
119865c1f7cfSmrg]) # XORG_WITH_FOP
1199264fa531Smrg
120065c1f7cfSmrg# XORG_WITH_M4([MIN-VERSION])
120165c1f7cfSmrg# ---------------------------
120265c1f7cfSmrg# Minimum version: 1.19.0
1203533545b5Smrg#
120465c1f7cfSmrg# This macro attempts to locate an m4 macro processor which supports
120565c1f7cfSmrg# -I option and is only useful for modules relying on M4 in order to
120665c1f7cfSmrg# expand macros in source code files.
1207533545b5Smrg#
120865c1f7cfSmrg# Interface to module:
120965c1f7cfSmrg# M4:	 	returns the path of the m4 program found
121065c1f7cfSmrg#		returns the path set by the user in the environment
1211533545b5Smrg#
121265c1f7cfSmrgAC_DEFUN([XORG_WITH_M4], [
121365c1f7cfSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
121465c1f7cfSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
121565c1f7cfSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
121665c1f7cfSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
121765c1f7cfSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
121865c1f7cfSmrg   [$PATH:/usr/gnu/bin])])
1219533545b5Smrg
122065c1f7cfSmrgAC_SUBST([M4], [$ac_cv_path_M4])
122165c1f7cfSmrg]) # XORG_WITH_M4
1222533545b5Smrg
122365c1f7cfSmrg# XORG_WITH_PS2PDF([DEFAULT])
122465c1f7cfSmrg# ----------------
122565c1f7cfSmrg# Minimum version: 1.6.0
122665c1f7cfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
122765c1f7cfSmrg#
122865c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
122965c1f7cfSmrg# not at the appropriate level. This macro enables a module to test for the
123065c1f7cfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
123165c1f7cfSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
123265c1f7cfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
123365c1f7cfSmrg# --with-ps2pdf assumes 'auto'.
1234533545b5Smrg#
123565c1f7cfSmrg# Interface to module:
123665c1f7cfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
123765c1f7cfSmrg# PS2PDF:	returns the path of the ps2pdf program found
123865c1f7cfSmrg#		returns the path set by the user in the environment
123965c1f7cfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
124065c1f7cfSmrg#		 'no' user instructs the module not to use ps2pdf
1241533545b5Smrg#
124265c1f7cfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243533545b5Smrg#
124465c1f7cfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
124565c1f7cfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
124665c1f7cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
124765c1f7cfSmrgAC_ARG_WITH(ps2pdf,
124865c1f7cfSmrg	AS_HELP_STRING([--with-ps2pdf],
124965c1f7cfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
125065c1f7cfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
125165c1f7cfSmrgm4_undefine([_defopt])
1252533545b5Smrg
125365c1f7cfSmrgif test "x$use_ps2pdf" = x"auto"; then
125465c1f7cfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
125565c1f7cfSmrg   if test "x$PS2PDF" = "x"; then
125665c1f7cfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
125765c1f7cfSmrg	have_ps2pdf=no
125865c1f7cfSmrg   else
125965c1f7cfSmrg        have_ps2pdf=yes
126065c1f7cfSmrg   fi
126165c1f7cfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
126265c1f7cfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
126365c1f7cfSmrg   if test "x$PS2PDF" = "x"; then
126465c1f7cfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
126565c1f7cfSmrg   fi
126665c1f7cfSmrg   have_ps2pdf=yes
126765c1f7cfSmrgelif test "x$use_ps2pdf" = x"no" ; then
126865c1f7cfSmrg   if test "x$PS2PDF" != "x"; then
126965c1f7cfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
127065c1f7cfSmrg   fi
127165c1f7cfSmrg   have_ps2pdf=no
1272533545b5Smrgelse
127365c1f7cfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
127465c1f7cfSmrgfi
127565c1f7cfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
127665c1f7cfSmrg]) # XORG_WITH_PS2PDF
1277533545b5Smrg
127865c1f7cfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
127965c1f7cfSmrg# ----------------
128065c1f7cfSmrg# Minimum version: 1.6.0
1281533545b5Smrg#
128265c1f7cfSmrg# Documentation tools are not always available on all platforms and sometimes
128365c1f7cfSmrg# not at the appropriate level. This macro enables a builder to skip all
128465c1f7cfSmrg# documentation targets except traditional man pages.
128565c1f7cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
128665c1f7cfSmrg# maximum flexibilty in controlling documentation building.
128765c1f7cfSmrg# Refer to:
128865c1f7cfSmrg# XORG_WITH_XMLTO         --with-xmlto
128965c1f7cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
129065c1f7cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
129165c1f7cfSmrg# XORG_WITH_FOP           --with-fop
129265c1f7cfSmrg# XORG_WITH_GROFF         --with-groff
129365c1f7cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294533545b5Smrg#
129565c1f7cfSmrg# Interface to module:
129665c1f7cfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
129765c1f7cfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
129865c1f7cfSmrg#		 'no' user instructs the module not to generate docs
129965c1f7cfSmrg# parm1:	specify the default value, yes or no.
1300533545b5Smrg#
130165c1f7cfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
130265c1f7cfSmrgm4_define([docs_default], m4_default([$1], [yes]))
130365c1f7cfSmrgAC_ARG_ENABLE(docs,
130465c1f7cfSmrg	AS_HELP_STRING([--enable-docs],
130565c1f7cfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
130665c1f7cfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
130765c1f7cfSmrgm4_undefine([docs_default])
130865c1f7cfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
130965c1f7cfSmrgAC_MSG_CHECKING([whether to build documentation])
131065c1f7cfSmrgAC_MSG_RESULT([$build_docs])
131165c1f7cfSmrg]) # XORG_ENABLE_DOCS
1312533545b5Smrg
131365c1f7cfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
131465c1f7cfSmrg# ----------------
131565c1f7cfSmrg# Minimum version: 1.6.0
131665c1f7cfSmrg#
131765c1f7cfSmrg# This macro enables a builder to skip all developer documentation.
131865c1f7cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
131965c1f7cfSmrg# maximum flexibilty in controlling documentation building.
132065c1f7cfSmrg# Refer to:
132165c1f7cfSmrg# XORG_WITH_XMLTO         --with-xmlto
132265c1f7cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
132365c1f7cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
132465c1f7cfSmrg# XORG_WITH_FOP           --with-fop
132565c1f7cfSmrg# XORG_WITH_GROFF         --with-groff
132665c1f7cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
132765c1f7cfSmrg#
132865c1f7cfSmrg# Interface to module:
132965c1f7cfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
133065c1f7cfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
133165c1f7cfSmrg#			'no' user instructs the module not to generate developer docs
133265c1f7cfSmrg# parm1:		specify the default value, yes or no.
133365c1f7cfSmrg#
133465c1f7cfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
133565c1f7cfSmrgm4_define([devel_default], m4_default([$1], [yes]))
133665c1f7cfSmrgAC_ARG_ENABLE(devel-docs,
133765c1f7cfSmrg	AS_HELP_STRING([--enable-devel-docs],
133865c1f7cfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
133965c1f7cfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
134065c1f7cfSmrgm4_undefine([devel_default])
134165c1f7cfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
134265c1f7cfSmrgAC_MSG_CHECKING([whether to build developer documentation])
134365c1f7cfSmrgAC_MSG_RESULT([$build_devel_docs])
134465c1f7cfSmrg]) # XORG_ENABLE_DEVEL_DOCS
1345533545b5Smrg
134665c1f7cfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
134765c1f7cfSmrg# ----------------
134865c1f7cfSmrg# Minimum version: 1.6.0
134965c1f7cfSmrg#
135065c1f7cfSmrg# This macro enables a builder to skip all functional specification targets.
135165c1f7cfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
135265c1f7cfSmrg# maximum flexibilty in controlling documentation building.
135365c1f7cfSmrg# Refer to:
135465c1f7cfSmrg# XORG_WITH_XMLTO         --with-xmlto
135565c1f7cfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
135665c1f7cfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
135765c1f7cfSmrg# XORG_WITH_FOP           --with-fop
135865c1f7cfSmrg# XORG_WITH_GROFF         --with-groff
135965c1f7cfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
136065c1f7cfSmrg#
136165c1f7cfSmrg# Interface to module:
136265c1f7cfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
136365c1f7cfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
136465c1f7cfSmrg#			'no' user instructs the module not to generate specs
136565c1f7cfSmrg# parm1:		specify the default value, yes or no.
136665c1f7cfSmrg#
136765c1f7cfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
136865c1f7cfSmrgm4_define([spec_default], m4_default([$1], [yes]))
136965c1f7cfSmrgAC_ARG_ENABLE(specs,
137065c1f7cfSmrg	AS_HELP_STRING([--enable-specs],
137165c1f7cfSmrg	   [Enable building the specs (default: ]spec_default[)]),
137265c1f7cfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
137365c1f7cfSmrgm4_undefine([spec_default])
137465c1f7cfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
137565c1f7cfSmrgAC_MSG_CHECKING([whether to build functional specifications])
137665c1f7cfSmrgAC_MSG_RESULT([$build_specs])
137765c1f7cfSmrg]) # XORG_ENABLE_SPECS
1378533545b5Smrg
137965c1f7cfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
138065c1f7cfSmrg# ----------------------------------------------
138165c1f7cfSmrg# Minimum version: 1.13.0
138265c1f7cfSmrg#
138365c1f7cfSmrg# This macro enables a builder to enable/disable unit testing
138465c1f7cfSmrg# It makes no assumption about the test cases implementation
138565c1f7cfSmrg# Test cases may or may not use Automake "Support for test suites"
138665c1f7cfSmrg# They may or may not use the software utility library GLib
138765c1f7cfSmrg#
138865c1f7cfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
138965c1f7cfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
139065c1f7cfSmrg# The variable enable_unit_tests is used by other macros in this file.
139165c1f7cfSmrg#
139265c1f7cfSmrg# Interface to module:
139365c1f7cfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
139465c1f7cfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
139565c1f7cfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
139665c1f7cfSmrg#			'no' user instructs the module not to build tests
139765c1f7cfSmrg# parm1:		specify the default value, yes or no.
139865c1f7cfSmrg#
139965c1f7cfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
140065c1f7cfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
140165c1f7cfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
140265c1f7cfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
140365c1f7cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
140465c1f7cfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
140565c1f7cfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
140665c1f7cfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
140765c1f7cfSmrgm4_undefine([_defopt])
140865c1f7cfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
140965c1f7cfSmrgAC_MSG_CHECKING([whether to build unit test cases])
141065c1f7cfSmrgAC_MSG_RESULT([$enable_unit_tests])
141165c1f7cfSmrg]) # XORG_ENABLE_UNIT_TESTS
1412533545b5Smrg
141365c1f7cfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
141465c1f7cfSmrg# ------------------------------------------------------
141565c1f7cfSmrg# Minimum version: 1.17.0
141665c1f7cfSmrg#
141765c1f7cfSmrg# This macro enables a builder to enable/disable integration testing
141865c1f7cfSmrg# It makes no assumption about the test cases' implementation
141965c1f7cfSmrg# Test cases may or may not use Automake "Support for test suites"
142065c1f7cfSmrg#
142165c1f7cfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
142265c1f7cfSmrg# usually requires less dependencies and may be built and run under less
142365c1f7cfSmrg# stringent environments than integration tests.
142465c1f7cfSmrg#
142565c1f7cfSmrg# Interface to module:
142665c1f7cfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
142765c1f7cfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
142865c1f7cfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
142965c1f7cfSmrg#                             'no' user instructs the module not to build tests
143065c1f7cfSmrg# parm1:                      specify the default value, yes or no.
143165c1f7cfSmrg#
143265c1f7cfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
143365c1f7cfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
143465c1f7cfSmrgm4_define([_defopt], m4_default([$1], [auto]))
143565c1f7cfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
143665c1f7cfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
143765c1f7cfSmrg	[enable_integration_tests=$enableval],
143865c1f7cfSmrg	[enable_integration_tests=]_defopt)
143965c1f7cfSmrgm4_undefine([_defopt])
144065c1f7cfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
144165c1f7cfSmrg	[test "x$enable_integration_tests" != xno])
144265c1f7cfSmrgAC_MSG_CHECKING([whether to build unit test cases])
144365c1f7cfSmrgAC_MSG_RESULT([$enable_integration_tests])
144465c1f7cfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445533545b5Smrg
144665c1f7cfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
144765c1f7cfSmrg# ----------------------------------------
144865c1f7cfSmrg# Minimum version: 1.13.0
144965c1f7cfSmrg#
145065c1f7cfSmrg# GLib is a library which provides advanced data structures and functions.
145165c1f7cfSmrg# This macro enables a module to test for the presence of Glib.
145265c1f7cfSmrg#
145365c1f7cfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
145465c1f7cfSmrg# Otherwise the value of $enable_unit_tests is blank.
145565c1f7cfSmrg#
145665c1f7cfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
145765c1f7cfSmrg# test support usually requires less dependencies and may be built and run under
145865c1f7cfSmrg# less stringent environments than integration tests.
145965c1f7cfSmrg#
146065c1f7cfSmrg# Interface to module:
146165c1f7cfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
146265c1f7cfSmrg# with_glib: used in configure.ac to know if GLib has been found
146365c1f7cfSmrg# --with-glib:	'yes' user instructs the module to use glib
146465c1f7cfSmrg#		'no' user instructs the module not to use glib
146565c1f7cfSmrg#
146665c1f7cfSmrgAC_DEFUN([XORG_WITH_GLIB],[
146765c1f7cfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146865c1f7cfSmrgm4_define([_defopt], m4_default([$2], [auto]))
146965c1f7cfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
147065c1f7cfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
147165c1f7cfSmrg	[with_glib=$withval], [with_glib=]_defopt)
147265c1f7cfSmrgm4_undefine([_defopt])
1473533545b5Smrg
147465c1f7cfSmrghave_glib=no
147565c1f7cfSmrg# Do not probe GLib if user explicitly disabled unit testing
147665c1f7cfSmrgif test "x$enable_unit_tests" != x"no"; then
147765c1f7cfSmrg  # Do not probe GLib if user explicitly disabled it
147865c1f7cfSmrg  if test "x$with_glib" != x"no"; then
147965c1f7cfSmrg    m4_ifval(
148065c1f7cfSmrg      [$1],
148165c1f7cfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
148265c1f7cfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
148365c1f7cfSmrg    )
148465c1f7cfSmrg  fi
148565c1f7cfSmrgfi
1486533545b5Smrg
148765c1f7cfSmrg# Not having GLib when unit testing has been explicitly requested is an error
148865c1f7cfSmrgif test "x$enable_unit_tests" = x"yes"; then
148965c1f7cfSmrg  if test "x$have_glib" = x"no"; then
149065c1f7cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149165c1f7cfSmrg  fi
149265c1f7cfSmrgfi
1493533545b5Smrg
149465c1f7cfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
149565c1f7cfSmrgif test "x$enable_unit_tests" = x"no"; then
149665c1f7cfSmrg  if test "x$with_glib" = x"yes"; then
149765c1f7cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149865c1f7cfSmrg  fi
149965c1f7cfSmrgfi
1500533545b5Smrg
150165c1f7cfSmrg# Not having GLib when it has been explicitly requested is an error
150265c1f7cfSmrgif test "x$with_glib" = x"yes"; then
150365c1f7cfSmrg  if test "x$have_glib" = x"no"; then
150465c1f7cfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
150565c1f7cfSmrg  fi
150665c1f7cfSmrgfi
1507533545b5Smrg
150865c1f7cfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
150965c1f7cfSmrg]) # XORG_WITH_GLIB
1510c37a63b8Smrg
151165c1f7cfSmrg# XORG_LD_WRAP([required|optional])
151265c1f7cfSmrg# ---------------------------------
151365c1f7cfSmrg# Minimum version: 1.13.0
1514c37a63b8Smrg#
151565c1f7cfSmrg# Check if linker supports -wrap, passed via compiler flags
1516c37a63b8Smrg#
151765c1f7cfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
151865c1f7cfSmrg# Otherwise the value of $enable_unit_tests is blank.
1519c37a63b8Smrg#
152065c1f7cfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
152165c1f7cfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
152265c1f7cfSmrg# available, an argument of "optional" allows use when some unit tests require
152365c1f7cfSmrg# ld -wrap and others do not.
1524c37a63b8Smrg#
152565c1f7cfSmrgAC_DEFUN([XORG_LD_WRAP],[
152665c1f7cfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
152765c1f7cfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
152865c1f7cfSmrg                      void __wrap_exit(int status) { return; }],
152965c1f7cfSmrg                     [exit(0);])])
153065c1f7cfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
153165c1f7cfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
153265c1f7cfSmrg  if test "x$have_ld_wrap" = x"no"; then
153365c1f7cfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
153465c1f7cfSmrg  fi
1535264fa531Smrgfi
153665c1f7cfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
153765c1f7cfSmrg#
153865c1f7cfSmrg]) # XORG_LD_WRAP
1539264fa531Smrg
154065c1f7cfSmrg# XORG_CHECK_LINKER_FLAGS
154165c1f7cfSmrg# -----------------------
154265c1f7cfSmrg# SYNOPSIS
154365c1f7cfSmrg#
154465c1f7cfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
154565c1f7cfSmrg#
154665c1f7cfSmrg# DESCRIPTION
154765c1f7cfSmrg#
154865c1f7cfSmrg#   Check whether the given linker FLAGS work with the current language's
154965c1f7cfSmrg#   linker, or whether they give an error.
155065c1f7cfSmrg#
155165c1f7cfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
155265c1f7cfSmrg#   success/failure.
155365c1f7cfSmrg#
155465c1f7cfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
155565c1f7cfSmrg#
155665c1f7cfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
155765c1f7cfSmrg#
155865c1f7cfSmrg# LICENSE
155965c1f7cfSmrg#
156065c1f7cfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
156165c1f7cfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
156265c1f7cfSmrg#   Copyright (c) 2009 Matteo Frigo
156365c1f7cfSmrg#
156465c1f7cfSmrg#   This program is free software: you can redistribute it and/or modify it
156565c1f7cfSmrg#   under the terms of the GNU General Public License as published by the
156665c1f7cfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
156765c1f7cfSmrg#   option) any later version.
156865c1f7cfSmrg#
156965c1f7cfSmrg#   This program is distributed in the hope that it will be useful, but
157065c1f7cfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
157165c1f7cfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
157265c1f7cfSmrg#   Public License for more details.
157365c1f7cfSmrg#
157465c1f7cfSmrg#   You should have received a copy of the GNU General Public License along
157565c1f7cfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
157665c1f7cfSmrg#
157765c1f7cfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
157865c1f7cfSmrg#   gives unlimited permission to copy, distribute and modify the configure
157965c1f7cfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
158065c1f7cfSmrg#   need not follow the terms of the GNU General Public License when using
158165c1f7cfSmrg#   or distributing such scripts, even though portions of the text of the
158265c1f7cfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
158365c1f7cfSmrg#   all other use of the material that constitutes the Autoconf Macro.
158465c1f7cfSmrg#
158565c1f7cfSmrg#   This special exception to the GPL applies to versions of the Autoconf
158665c1f7cfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
158765c1f7cfSmrg#   modified version of the Autoconf Macro, you may extend this special
158865c1f7cfSmrg#   exception to the GPL to apply to your modified version as well.#
158965c1f7cfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
159065c1f7cfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
159165c1f7cfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
159265c1f7cfSmrgAS_LITERAL_IF([$1],
159365c1f7cfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
159465c1f7cfSmrg      ax_save_FLAGS=$LDFLAGS
159565c1f7cfSmrg      LDFLAGS="$1"
159665c1f7cfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
159765c1f7cfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
159865c1f7cfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
159965c1f7cfSmrg      LDFLAGS=$ax_save_FLAGS])],
160065c1f7cfSmrg  [ax_save_FLAGS=$LDFLAGS
160165c1f7cfSmrg   LDFLAGS="$1"
160265c1f7cfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
160365c1f7cfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
160465c1f7cfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
160565c1f7cfSmrg   LDFLAGS=$ax_save_FLAGS])
160665c1f7cfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
160765c1f7cfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
160865c1f7cfSmrgif test "x$xorg_check_linker_flags" = xyes; then
160965c1f7cfSmrg	m4_default([$2], :)
1610264fa531Smrgelse
161165c1f7cfSmrg	m4_default([$3], :)
1612264fa531Smrgfi
161365c1f7cfSmrg]) # XORG_CHECK_LINKER_FLAGS
1614264fa531Smrg
161565c1f7cfSmrg# XORG_MEMORY_CHECK_FLAGS
1616264fa531Smrg# -----------------------
161765c1f7cfSmrg# Minimum version: 1.16.0
1618c37a63b8Smrg#
161965c1f7cfSmrg# This macro attempts to find appropriate memory checking functionality
162065c1f7cfSmrg# for various platforms which unit testing code may use to catch various
162165c1f7cfSmrg# forms of memory allocation and access errors in testing.
162265c1f7cfSmrg#
162365c1f7cfSmrg# Interface to module:
162465c1f7cfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
162565c1f7cfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162665c1f7cfSmrg#
162765c1f7cfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162865c1f7cfSmrg#
162965c1f7cfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1630264fa531Smrg
1631264fa531SmrgAC_REQUIRE([AC_CANONICAL_HOST])
163265c1f7cfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
163365c1f7cfSmrg           [Environment variables to enable memory checking in tests])
1634264fa531Smrg
163565c1f7cfSmrg# Check for different types of support on different platforms
163665c1f7cfSmrgcase $host_os in
163765c1f7cfSmrg    solaris*)
163865c1f7cfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
163965c1f7cfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
164065c1f7cfSmrg        ;;
164165c1f7cfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
164265c1f7cfSmrg        # both directly and inverted, so should not be 0 or 255.
164365c1f7cfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
164465c1f7cfSmrg        ;;
164565c1f7cfSmrg    darwin*)
164665c1f7cfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
164765c1f7cfSmrg        ;;
164865c1f7cfSmrg    *bsd*)
164965c1f7cfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
165065c1f7cfSmrg        ;;
165165c1f7cfSmrgesac
1652264fa531Smrg
165365c1f7cfSmrg# User supplied flags override default flags
165465c1f7cfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
165565c1f7cfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1656264fa531Smrgfi
1657264fa531Smrg
165865c1f7cfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
165965c1f7cfSmrg]) # XORG_WITH_LINT
1660264fa531Smrg
166165c1f7cfSmrg# XORG_CHECK_MALLOC_ZERO
166265c1f7cfSmrg# ----------------------
166365c1f7cfSmrg# Minimum version: 1.0.0
166465c1f7cfSmrg#
166565c1f7cfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
166665c1f7cfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
166765c1f7cfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
166865c1f7cfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
166965c1f7cfSmrgAC_ARG_ENABLE(malloc0returnsnull,
167065c1f7cfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
167165c1f7cfSmrg		       [malloc(0) returns NULL (default: auto)]),
167265c1f7cfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
167365c1f7cfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1674264fa531Smrg
167565c1f7cfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
167665c1f7cfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
167765c1f7cfSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
167865c1f7cfSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
167965c1f7cfSmrg#include <stdlib.h>
168065c1f7cfSmrg],[
168165c1f7cfSmrg    char *m0, *r0, *c0, *p;
168265c1f7cfSmrg    m0 = malloc(0);
168365c1f7cfSmrg    p = malloc(10);
168465c1f7cfSmrg    r0 = realloc(p,0);
168565c1f7cfSmrg    c0 = calloc(0,10);
168665c1f7cfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
168765c1f7cfSmrg])],
168865c1f7cfSmrg		[xorg_cv_malloc0_returns_null=yes],
168965c1f7cfSmrg		[xorg_cv_malloc0_returns_null=no])])
169065c1f7cfSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1691264fa531Smrgfi
169265c1f7cfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1693264fa531Smrg
169465c1f7cfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
169565c1f7cfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
169665c1f7cfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
169765c1f7cfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1698736a7e2cSmrgelse
169965c1f7cfSmrg	MALLOC_ZERO_CFLAGS=""
170065c1f7cfSmrg	XMALLOC_ZERO_CFLAGS=""
170165c1f7cfSmrg	XTMALLOC_ZERO_CFLAGS=""
1702736a7e2cSmrgfi
1703736a7e2cSmrg
170465c1f7cfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
170565c1f7cfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
170665c1f7cfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
170765c1f7cfSmrg]) # XORG_CHECK_MALLOC_ZERO
1708736a7e2cSmrg
170965c1f7cfSmrg# XORG_WITH_LINT()
171065c1f7cfSmrg# ----------------
171165c1f7cfSmrg# Minimum version: 1.1.0
1712c37a63b8Smrg#
171365c1f7cfSmrg# This macro enables the use of a tool that flags some suspicious and
171465c1f7cfSmrg# non-portable constructs (likely to be bugs) in C language source code.
171565c1f7cfSmrg# It will attempt to locate the tool and use appropriate options.
171665c1f7cfSmrg# There are various lint type tools on different platforms.
171765c1f7cfSmrg#
171865c1f7cfSmrg# Interface to module:
171965c1f7cfSmrg# LINT:		returns the path to the tool found on the platform
172065c1f7cfSmrg#		or the value set to LINT on the configure cmd line
172165c1f7cfSmrg#		also an Automake conditional
172265c1f7cfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
172365c1f7cfSmrg#
172465c1f7cfSmrg# --with-lint:	'yes' user instructs the module to use lint
172565c1f7cfSmrg#		'no' user instructs the module not to use lint (default)
172665c1f7cfSmrg#
172765c1f7cfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
172865c1f7cfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
172965c1f7cfSmrg#
173065c1f7cfSmrgAC_DEFUN([XORG_WITH_LINT],[
1731264fa531Smrg
173265c1f7cfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
173365c1f7cfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
173465c1f7cfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
173565c1f7cfSmrg		[Use a lint-style source code checker (default: disabled)])],
173665c1f7cfSmrg		[use_lint=$withval], [use_lint=no])
1737264fa531Smrg
173865c1f7cfSmrg# Obtain platform specific info like program name and options
173965c1f7cfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
174065c1f7cfSmrgcase $host_os in
174165c1f7cfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
174265c1f7cfSmrg	lint_name=splint
174365c1f7cfSmrg	lint_options="-badflag"
174465c1f7cfSmrg	;;
174565c1f7cfSmrg  *freebsd* | *netbsd*)
174665c1f7cfSmrg	lint_name=lint
174765c1f7cfSmrg	lint_options="-u -b"
174865c1f7cfSmrg	;;
174965c1f7cfSmrg  *solaris*)
175065c1f7cfSmrg	lint_name=lint
175165c1f7cfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
175265c1f7cfSmrg	;;
175365c1f7cfSmrgesac
1754264fa531Smrg
175565c1f7cfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
175665c1f7cfSmrgif test "x$use_lint" = x"yes" ; then
175765c1f7cfSmrg   AC_PATH_PROG([LINT], [$lint_name])
175865c1f7cfSmrg   if test "x$LINT" = "x"; then
175965c1f7cfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
176065c1f7cfSmrg   fi
176165c1f7cfSmrgelif test "x$use_lint" = x"no" ; then
176265c1f7cfSmrg   if test "x$LINT" != "x"; then
176365c1f7cfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
176465c1f7cfSmrg   fi
1765264fa531Smrgelse
176665c1f7cfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1767264fa531Smrgfi
1768264fa531Smrg
176965c1f7cfSmrg# User supplied flags override default flags
177065c1f7cfSmrgif test "x$LINT_FLAGS" != "x"; then
177165c1f7cfSmrg   lint_options=$LINT_FLAGS
1772264fa531Smrgfi
1773264fa531Smrg
177465c1f7cfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
177565c1f7cfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776264fa531Smrg
177765c1f7cfSmrg]) # XORG_WITH_LINT
1778264fa531Smrg
177965c1f7cfSmrg# XORG_LINT_LIBRARY(LIBNAME)
178065c1f7cfSmrg# --------------------------
178165c1f7cfSmrg# Minimum version: 1.1.0
1782c37a63b8Smrg#
178365c1f7cfSmrg# Sets up flags for building lint libraries for checking programs that call
178465c1f7cfSmrg# functions in the library.
178565c1f7cfSmrg#
178665c1f7cfSmrg# Interface to module:
178765c1f7cfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
178865c1f7cfSmrg# MAKE_LINT_LIB		- Automake conditional
178965c1f7cfSmrg#
179065c1f7cfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
179165c1f7cfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1792c37a63b8Smrg
179365c1f7cfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
179465c1f7cfSmrgAC_REQUIRE([XORG_WITH_LINT])
179565c1f7cfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
179665c1f7cfSmrg	[Create lint library (default: disabled)])],
179765c1f7cfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1798c37a63b8Smrg
179965c1f7cfSmrgif test "x$make_lint_lib" = x"yes" ; then
180065c1f7cfSmrg   LINTLIB=llib-l$1.ln
180165c1f7cfSmrg   if test "x$LINT" = "x"; then
180265c1f7cfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
180365c1f7cfSmrg   fi
180465c1f7cfSmrgelif test "x$make_lint_lib" != x"no" ; then
180565c1f7cfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1806c37a63b8Smrgfi
1807c37a63b8Smrg
180865c1f7cfSmrgAC_SUBST(LINTLIB)
180965c1f7cfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1810c37a63b8Smrg
181165c1f7cfSmrg]) # XORG_LINT_LIBRARY
1812c37a63b8Smrg
181365c1f7cfSmrg# XORG_COMPILER_BRAND
181465c1f7cfSmrg# -------------------
181565c1f7cfSmrg# Minimum version: 1.14.0
1816736a7e2cSmrg#
181765c1f7cfSmrg# Checks for various brands of compilers and sets flags as appropriate:
181865c1f7cfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
181965c1f7cfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
182065c1f7cfSmrg#   clang compiler - sets CLANGCC to "yes"
182165c1f7cfSmrg#   Intel compiler - sets INTELCC to "yes"
182265c1f7cfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823736a7e2cSmrg#
182465c1f7cfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
182565c1f7cfSmrgAC_LANG_CASE(
182665c1f7cfSmrg	[C], [
182765c1f7cfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
182865c1f7cfSmrg	],
182965c1f7cfSmrg	[C++], [
183065c1f7cfSmrg		AC_REQUIRE([AC_PROG_CXX])
183165c1f7cfSmrg	]
183265c1f7cfSmrg)
183365c1f7cfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
183465c1f7cfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
183565c1f7cfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
183665c1f7cfSmrg]) # XORG_COMPILER_BRAND
183765c1f7cfSmrg
183865c1f7cfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
183965c1f7cfSmrg# ---------------
184065c1f7cfSmrg# Minimum version: 1.16.0
1841736a7e2cSmrg#
184265c1f7cfSmrg# Test if the compiler works when passed the given flag as a command line argument.
184365c1f7cfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
184465c1f7cfSmrg# next flag in the list until there are no more options.
1845736a7e2cSmrg#
184665c1f7cfSmrg# Note that this does not guarantee that the compiler supports the flag as some
184765c1f7cfSmrg# compilers will simply ignore arguments that they do not understand, but we do
184865c1f7cfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
184965c1f7cfSmrg# -Werror=unused-command-line-argument
1850736a7e2cSmrg#
185165c1f7cfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
185265c1f7cfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185365c1f7cfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854736a7e2cSmrg
185565c1f7cfSmrgAC_LANG_COMPILER_REQUIRE
185665c1f7cfSmrg
185765c1f7cfSmrgAC_LANG_CASE(
185865c1f7cfSmrg	[C], [
185965c1f7cfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
186065c1f7cfSmrg		define([PREFIX], [C])
186165c1f7cfSmrg		define([CACHE_PREFIX], [cc])
186265c1f7cfSmrg		define([COMPILER], [$CC])
186365c1f7cfSmrg	],
186465c1f7cfSmrg	[C++], [
186565c1f7cfSmrg		define([PREFIX], [CXX])
186665c1f7cfSmrg		define([CACHE_PREFIX], [cxx])
186765c1f7cfSmrg		define([COMPILER], [$CXX])
186865c1f7cfSmrg	]
186965c1f7cfSmrg)
187065c1f7cfSmrg
187165c1f7cfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
187265c1f7cfSmrg
187365c1f7cfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
187465c1f7cfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
187565c1f7cfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
187665c1f7cfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
187765c1f7cfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
187865c1f7cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
187965c1f7cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
188065c1f7cfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
188165c1f7cfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882736a7e2cSmrgfi
1883736a7e2cSmrg
188465c1f7cfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
188565c1f7cfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
188665c1f7cfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
188765c1f7cfSmrg	fi
188865c1f7cfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
188965c1f7cfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
189065c1f7cfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
189165c1f7cfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
189265c1f7cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
189365c1f7cfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
189465c1f7cfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
189565c1f7cfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189665c1f7cfSmrgfi
1897736a7e2cSmrg
189865c1f7cfSmrgfound="no"
189965c1f7cfSmrgm4_foreach([flag], m4_cdr($@), [
190065c1f7cfSmrg	if test $found = "no" ; then
190165c1f7cfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
190265c1f7cfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
190365c1f7cfSmrg		fi
1904736a7e2cSmrg
190565c1f7cfSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
190665c1f7cfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
190765c1f7cfSmrg		fi
190865c1f7cfSmrg
190965c1f7cfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
191065c1f7cfSmrg
191165c1f7cfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
191265c1f7cfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
191365c1f7cfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
191465c1f7cfSmrg		AC_CACHE_VAL($cacheid,
191565c1f7cfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
191665c1f7cfSmrg					     [eval $cacheid=yes],
191765c1f7cfSmrg					     [eval $cacheid=no])])
191865c1f7cfSmrg
191965c1f7cfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
192065c1f7cfSmrg
192165c1f7cfSmrg		eval supported=\$$cacheid
192265c1f7cfSmrg		AC_MSG_RESULT([$supported])
192365c1f7cfSmrg		if test "$supported" = "yes" ; then
192465c1f7cfSmrg			$1="$$1 ]flag["
192565c1f7cfSmrg			found="yes"
192665c1f7cfSmrg		fi
192765c1f7cfSmrg	fi
192865c1f7cfSmrg])
192965c1f7cfSmrg]) # XORG_TESTSET_CFLAG
193065c1f7cfSmrg
193165c1f7cfSmrg# XORG_COMPILER_FLAGS
193265c1f7cfSmrg# ---------------
193365c1f7cfSmrg# Minimum version: 1.16.0
1934e4ee1255Smrg#
193565c1f7cfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
193665c1f7cfSmrg# arguments supported by the selected compiler which do NOT alter the generated
193765c1f7cfSmrg# code.  These arguments will cause the compiler to print various warnings
193865c1f7cfSmrg# during compilation AND turn a conservative set of warnings into errors.
1939e4ee1255Smrg#
194065c1f7cfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
194165c1f7cfSmrg# future versions of util-macros as options are added to new compilers.
1942e4ee1255Smrg#
194365c1f7cfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
194465c1f7cfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945e4ee1255Smrg
194665c1f7cfSmrgAC_ARG_ENABLE(selective-werror,
194765c1f7cfSmrg              AS_HELP_STRING([--disable-selective-werror],
194865c1f7cfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
194965c1f7cfSmrg              [SELECTIVE_WERROR=$enableval],
195065c1f7cfSmrg              [SELECTIVE_WERROR=yes])
195165c1f7cfSmrg
195265c1f7cfSmrgAC_LANG_CASE(
195365c1f7cfSmrg        [C], [
195465c1f7cfSmrg                define([PREFIX], [C])
195565c1f7cfSmrg        ],
195665c1f7cfSmrg        [C++], [
195765c1f7cfSmrg                define([PREFIX], [CXX])
195865c1f7cfSmrg        ]
195965c1f7cfSmrg)
196065c1f7cfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
196165c1f7cfSmrgif test "x$SUNCC" = "xyes"; then
196265c1f7cfSmrg    [BASE_]PREFIX[FLAGS]="-v"
1963e4ee1255Smrgelse
196465c1f7cfSmrg    [BASE_]PREFIX[FLAGS]=""
1965e4ee1255Smrgfi
1966e4ee1255Smrg
196765c1f7cfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
196865c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
196965c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
197065c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
197165c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972e4ee1255Smrg
197365c1f7cfSmrgAC_LANG_CASE(
197465c1f7cfSmrg	[C], [
197565c1f7cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
197665c1f7cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
197765c1f7cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
197865c1f7cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
197965c1f7cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
198065c1f7cfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
198165c1f7cfSmrg	]
198265c1f7cfSmrg)
198365c1f7cfSmrg
198465c1f7cfSmrg# This chunk adds additional warnings that could catch undesired effects.
198565c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
198665c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
198765c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
198865c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
198965c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
199065c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
199165c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
199265c1f7cfSmrg
199365c1f7cfSmrg# These are currently disabled because they are noisy.  They will be enabled
199465c1f7cfSmrg# in the future once the codebase is sufficiently modernized to silence
199565c1f7cfSmrg# them.  For now, I don't want them to drown out the other warnings.
199665c1f7cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
199765c1f7cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
199865c1f7cfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
199965c1f7cfSmrg
200065c1f7cfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
200165c1f7cfSmrg# when there are problems that should be fixed.
200265c1f7cfSmrg
200365c1f7cfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
200465c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
200565c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
200665c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
200765c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
200865c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
200965c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
201065c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
201165c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
201265c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
201365c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
201465c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
201565c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
201665c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201765c1f7cfSmrgelse
201865c1f7cfSmrgAC_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])
201965c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
202065c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
202165c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
202265c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
202365c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
202465c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
202565c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
202665c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
202765c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
202865c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
202965c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
203065c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
203165c1f7cfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203265c1f7cfSmrgfi
203365c1f7cfSmrg
203465c1f7cfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203565c1f7cfSmrg]) # XORG_COMPILER_FLAGS
203665c1f7cfSmrg
203765c1f7cfSmrg# XORG_CWARNFLAGS
203865c1f7cfSmrg# ---------------
203965c1f7cfSmrg# Minimum version: 1.2.0
204065c1f7cfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041e4ee1255Smrg#
204265c1f7cfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2043e4ee1255Smrg#
204465c1f7cfSmrg# This function is deprecated because it defines -fno-strict-aliasing
204565c1f7cfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
204665c1f7cfSmrg# is needed, then it should be added explicitly in the module when
204765c1f7cfSmrg# it is updated to use BASE_CFLAGS.
2048e4ee1255Smrg#
204965c1f7cfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
205065c1f7cfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
205165c1f7cfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
205265c1f7cfSmrgAC_LANG_CASE(
205365c1f7cfSmrg	[C], [
205465c1f7cfSmrg		CWARNFLAGS="$BASE_CFLAGS"
205565c1f7cfSmrg		if  test "x$GCC" = xyes ; then
205665c1f7cfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
205765c1f7cfSmrg		fi
205865c1f7cfSmrg		AC_SUBST(CWARNFLAGS)
205965c1f7cfSmrg	]
206065c1f7cfSmrg)
206165c1f7cfSmrg]) # XORG_CWARNFLAGS
206265c1f7cfSmrg
206365c1f7cfSmrg# XORG_STRICT_OPTION
206465c1f7cfSmrg# -----------------------
206565c1f7cfSmrg# Minimum version: 1.3.0
2066e4ee1255Smrg#
206765c1f7cfSmrg# Add configure option to enable strict compilation flags, such as treating
206865c1f7cfSmrg# warnings as fatal errors.
206965c1f7cfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
207065c1f7cfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071e4ee1255Smrg#
207265c1f7cfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
207365c1f7cfSmrg# when strict compilation is unconditionally desired.
207465c1f7cfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
207565c1f7cfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
207665c1f7cfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077e4ee1255Smrg
207865c1f7cfSmrgAC_ARG_ENABLE(strict-compilation,
207965c1f7cfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
208065c1f7cfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
208165c1f7cfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082e4ee1255Smrg
208365c1f7cfSmrgAC_LANG_CASE(
208465c1f7cfSmrg        [C], [
208565c1f7cfSmrg                define([PREFIX], [C])
208665c1f7cfSmrg        ],
208765c1f7cfSmrg        [C++], [
208865c1f7cfSmrg                define([PREFIX], [CXX])
208965c1f7cfSmrg        ]
209065c1f7cfSmrg)
2091e4ee1255Smrg
209265c1f7cfSmrg[STRICT_]PREFIX[FLAGS]=""
209365c1f7cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
209465c1f7cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209565c1f7cfSmrg
209665c1f7cfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
209765c1f7cfSmrg# activate it with -Werror, so we add it here explicitly.
209865c1f7cfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209965c1f7cfSmrg
210065c1f7cfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
210165c1f7cfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
210265c1f7cfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
210365c1f7cfSmrgfi
210465c1f7cfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
210565c1f7cfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
210665c1f7cfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
210765c1f7cfSmrg]) # XORG_STRICT_OPTION
210865c1f7cfSmrg
210965c1f7cfSmrg# XORG_DEFAULT_OPTIONS
211065c1f7cfSmrg# --------------------
211165c1f7cfSmrg# Minimum version: 1.3.0
2112736a7e2cSmrg#
211365c1f7cfSmrg# Defines default options for X.Org modules.
2114736a7e2cSmrg#
211565c1f7cfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211665c1f7cfSmrgAC_REQUIRE([AC_PROG_INSTALL])
211765c1f7cfSmrgXORG_COMPILER_FLAGS
211865c1f7cfSmrgXORG_CWARNFLAGS
211965c1f7cfSmrgXORG_STRICT_OPTION
212065c1f7cfSmrgXORG_RELEASE_VERSION
212165c1f7cfSmrgXORG_CHANGELOG
212265c1f7cfSmrgXORG_INSTALL
212365c1f7cfSmrgXORG_MANPAGE_SECTIONS
212465c1f7cfSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212565c1f7cfSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212665c1f7cfSmrg]) # XORG_DEFAULT_OPTIONS
212765c1f7cfSmrg
212865c1f7cfSmrg# XORG_INSTALL()
212965c1f7cfSmrg# ----------------
213065c1f7cfSmrg# Minimum version: 1.4.0
2131736a7e2cSmrg#
213265c1f7cfSmrg# Defines the variable INSTALL_CMD as the command to copy
213365c1f7cfSmrg# INSTALL from $prefix/share/util-macros.
2134736a7e2cSmrg#
213565c1f7cfSmrgAC_DEFUN([XORG_INSTALL], [
213665c1f7cfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213765c1f7cfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
213865c1f7cfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
213965c1f7cfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214065c1f7cfSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214165c1f7cfSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214265c1f7cfSmrgAC_SUBST([INSTALL_CMD])
214365c1f7cfSmrg]) # XORG_INSTALL
214465c1f7cfSmrgdnl Copyright 2005 Red Hat, Inc
214565c1f7cfSmrgdnl
214665c1f7cfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
214765c1f7cfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
214865c1f7cfSmrgdnl the above copyright notice appear in all copies and that both that
214965c1f7cfSmrgdnl copyright notice and this permission notice appear in supporting
215065c1f7cfSmrgdnl documentation.
215165c1f7cfSmrgdnl
215265c1f7cfSmrgdnl The above copyright notice and this permission notice shall be included
215365c1f7cfSmrgdnl in all copies or substantial portions of the Software.
215465c1f7cfSmrgdnl
215565c1f7cfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
215665c1f7cfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215765c1f7cfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
215865c1f7cfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
215965c1f7cfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
216065c1f7cfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
216165c1f7cfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
216265c1f7cfSmrgdnl
216365c1f7cfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
216465c1f7cfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
216565c1f7cfSmrgdnl other dealings in this Software without prior written authorization
216665c1f7cfSmrgdnl from the copyright holders.
216765c1f7cfSmrgdnl
2168736a7e2cSmrg
216965c1f7cfSmrg# XORG_RELEASE_VERSION
217065c1f7cfSmrg# --------------------
217165c1f7cfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
217265c1f7cfSmrg
217365c1f7cfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
217465c1f7cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
217565c1f7cfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
217665c1f7cfSmrg		[Major version of this package])
217765c1f7cfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
217865c1f7cfSmrg	if test "x$PVM" = "x"; then
217965c1f7cfSmrg		PVM="0"
218065c1f7cfSmrg	fi
218165c1f7cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
218265c1f7cfSmrg		[$PVM],
218365c1f7cfSmrg		[Minor version of this package])
218465c1f7cfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
218565c1f7cfSmrg	if test "x$PVP" = "x"; then
218665c1f7cfSmrg		PVP="0"
218765c1f7cfSmrg	fi
218865c1f7cfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
218965c1f7cfSmrg		[$PVP],
219065c1f7cfSmrg		[Patch version of this package])
219165c1f7cfSmrg])
219265c1f7cfSmrg
219365c1f7cfSmrg# XORG_CHANGELOG()
219465c1f7cfSmrg# ----------------
219565c1f7cfSmrg# Minimum version: 1.2.0
2196736a7e2cSmrg#
219765c1f7cfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
219865c1f7cfSmrg# ChangeLog from git.
2199736a7e2cSmrg#
2200736a7e2cSmrg#
220165c1f7cfSmrgAC_DEFUN([XORG_CHANGELOG], [
220265c1f7cfSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220365c1f7cfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220465c1f7cfSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220565c1f7cfSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220665c1f7cfSmrgAC_SUBST([CHANGELOG_CMD])
220765c1f7cfSmrg]) # XORG_CHANGELOG
220865c1f7cfSmrg
220965c1f7cfSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210736a7e2cSmrg#
221165c1f7cfSmrg# This file is free software; the Free Software Foundation
221265c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
221365c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2214736a7e2cSmrg
221565c1f7cfSmrg# AM_AUTOMAKE_VERSION(VERSION)
221665c1f7cfSmrg# ----------------------------
221765c1f7cfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
221865c1f7cfSmrg# generated from the m4 files accompanying Automake X.Y.
221965c1f7cfSmrg# (This private macro should not be called outside this file.)
222065c1f7cfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
222165c1f7cfSmrg[am__api_version='1.15'
222265c1f7cfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
222365c1f7cfSmrgdnl require some minimum version.  Point them to the right macro.
222465c1f7cfSmrgm4_if([$1], [1.15], [],
222565c1f7cfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
222665c1f7cfSmrg])
2227533545b5Smrg
222865c1f7cfSmrg# _AM_AUTOCONF_VERSION(VERSION)
222965c1f7cfSmrg# -----------------------------
223065c1f7cfSmrg# aclocal traces this macro to find the Autoconf version.
223165c1f7cfSmrg# This is a private macro too.  Using m4_define simplifies
223265c1f7cfSmrg# the logic in aclocal, which can simply ignore this definition.
223365c1f7cfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
2234533545b5Smrg
223565c1f7cfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
223665c1f7cfSmrg# -------------------------------
223765c1f7cfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
223865c1f7cfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
223965c1f7cfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
224065c1f7cfSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
224165c1f7cfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
224265c1f7cfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
224365c1f7cfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244736a7e2cSmrg
224565c1f7cfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
224665c1f7cfSmrg
224765c1f7cfSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248736a7e2cSmrg#
224965c1f7cfSmrg# This file is free software; the Free Software Foundation
225065c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
225165c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
225265c1f7cfSmrg
225365c1f7cfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
225465c1f7cfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
225565c1f7cfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256736a7e2cSmrg#
225765c1f7cfSmrg# Of course, Automake must honor this variable whenever it calls a
225865c1f7cfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
225965c1f7cfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
226065c1f7cfSmrg# depending on how configure is run.  This is pretty annoying, since
226165c1f7cfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
226265c1f7cfSmrg# source directory, any form will work fine, but in subdirectories a
226365c1f7cfSmrg# relative path needs to be adjusted first.
2264736a7e2cSmrg#
226565c1f7cfSmrg# $ac_aux_dir/missing
226665c1f7cfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
226765c1f7cfSmrg# $top_srcdir/$ac_aux_dir/missing
226865c1f7cfSmrg#    fails if $ac_aux_dir is absolute,
226965c1f7cfSmrg#    fails when called from a subdirectory in a VPATH build with
227065c1f7cfSmrg#          a relative $ac_aux_dir
2271736a7e2cSmrg#
227265c1f7cfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
227365c1f7cfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
227465c1f7cfSmrg# harmless because $srcdir is '.', but things will broke when you
227565c1f7cfSmrg# start a VPATH build or use an absolute $srcdir.
2276736a7e2cSmrg#
227765c1f7cfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
227865c1f7cfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
227965c1f7cfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
228065c1f7cfSmrg# and then we would define $MISSING as
228165c1f7cfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
228265c1f7cfSmrg# This will work as long as MISSING is not called from configure, because
228365c1f7cfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
228465c1f7cfSmrg# However there are other variables, like CC, which are often used in
228565c1f7cfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286736a7e2cSmrg#
228765c1f7cfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
228865c1f7cfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
228965c1f7cfSmrg# configured tree to be moved without reconfiguration.
2290736a7e2cSmrg
229165c1f7cfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
229265c1f7cfSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
229365c1f7cfSmrg# Expand $ac_aux_dir to an absolute path.
229465c1f7cfSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
229565c1f7cfSmrg])
229665c1f7cfSmrg
229765c1f7cfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
229865c1f7cfSmrg
229965c1f7cfSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230065c1f7cfSmrg#
230165c1f7cfSmrg# This file is free software; the Free Software Foundation
230265c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
230365c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
230465c1f7cfSmrg
230565c1f7cfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
230665c1f7cfSmrg# -------------------------------------
230765c1f7cfSmrg# Define a conditional.
230865c1f7cfSmrgAC_DEFUN([AM_CONDITIONAL],
230965c1f7cfSmrg[AC_PREREQ([2.52])dnl
231065c1f7cfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
231165c1f7cfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
231265c1f7cfSmrgAC_SUBST([$1_TRUE])dnl
231365c1f7cfSmrgAC_SUBST([$1_FALSE])dnl
231465c1f7cfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
231565c1f7cfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
231665c1f7cfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
231765c1f7cfSmrgif $2; then
231865c1f7cfSmrg  $1_TRUE=
231965c1f7cfSmrg  $1_FALSE='#'
2320736a7e2cSmrgelse
232165c1f7cfSmrg  $1_TRUE='#'
232265c1f7cfSmrg  $1_FALSE=
2323736a7e2cSmrgfi
232465c1f7cfSmrgAC_CONFIG_COMMANDS_PRE(
232565c1f7cfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
232665c1f7cfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
232765c1f7cfSmrgUsually this means the macro was only invoked conditionally.]])
232865c1f7cfSmrgfi])])
2329736a7e2cSmrg
233065c1f7cfSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233165c1f7cfSmrg#
233265c1f7cfSmrg# This file is free software; the Free Software Foundation
233365c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
233465c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2335736a7e2cSmrg
2336736a7e2cSmrg
233765c1f7cfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
233865c1f7cfSmrg# written in clear, in which case automake, when reading aclocal.m4,
233965c1f7cfSmrg# will think it sees a *use*, and therefore will trigger all it's
234065c1f7cfSmrg# C support machinery.  Also note that it means that autoscan, seeing
234165c1f7cfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2342736a7e2cSmrg
234365c1f7cfSmrg
234465c1f7cfSmrg# _AM_DEPENDENCIES(NAME)
234565c1f7cfSmrg# ----------------------
234665c1f7cfSmrg# See how the compiler implements dependency checking.
234765c1f7cfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
234865c1f7cfSmrg# We try a few techniques and use that to set a single cache variable.
2349736a7e2cSmrg#
235065c1f7cfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
235165c1f7cfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
235265c1f7cfSmrg# dependency, and given that the user is not expected to run this macro,
235365c1f7cfSmrg# just rely on AC_PROG_CC.
235465c1f7cfSmrgAC_DEFUN([_AM_DEPENDENCIES],
235565c1f7cfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
235665c1f7cfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
235765c1f7cfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
235865c1f7cfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359736a7e2cSmrg
236065c1f7cfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
236165c1f7cfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
236265c1f7cfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
236365c1f7cfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
236465c1f7cfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
236565c1f7cfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
236665c1f7cfSmrg                    [depcc="$$1"   am_compiler_list=])
2367e4ee1255Smrg
236865c1f7cfSmrgAC_CACHE_CHECK([dependency style of $depcc],
236965c1f7cfSmrg               [am_cv_$1_dependencies_compiler_type],
237065c1f7cfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
237165c1f7cfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
237265c1f7cfSmrg  # making bogus files that we don't know about and never remove.  For
237365c1f7cfSmrg  # instance it was reported that on HP-UX the gcc test will end up
237465c1f7cfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
237565c1f7cfSmrg  # in D".
237665c1f7cfSmrg  rm -rf conftest.dir
237765c1f7cfSmrg  mkdir conftest.dir
237865c1f7cfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
237965c1f7cfSmrg  # using a relative directory.
238065c1f7cfSmrg  cp "$am_depcomp" conftest.dir
238165c1f7cfSmrg  cd conftest.dir
238265c1f7cfSmrg  # We will build objects and dependencies in a subdirectory because
238365c1f7cfSmrg  # it helps to detect inapplicable dependency modes.  For instance
238465c1f7cfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
238565c1f7cfSmrg  # side effect of compilation, but ICC will put the dependencies in
238665c1f7cfSmrg  # the current directory while Tru64 will put them in the object
238765c1f7cfSmrg  # directory.
238865c1f7cfSmrg  mkdir sub
2389736a7e2cSmrg
239065c1f7cfSmrg  am_cv_$1_dependencies_compiler_type=none
239165c1f7cfSmrg  if test "$am_compiler_list" = ""; then
239265c1f7cfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
239365c1f7cfSmrg  fi
239465c1f7cfSmrg  am__universal=false
239565c1f7cfSmrg  m4_case([$1], [CC],
239665c1f7cfSmrg    [case " $depcc " in #(
239765c1f7cfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
239865c1f7cfSmrg     esac],
239965c1f7cfSmrg    [CXX],
240065c1f7cfSmrg    [case " $depcc " in #(
240165c1f7cfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
240265c1f7cfSmrg     esac])
2403533545b5Smrg
240465c1f7cfSmrg  for depmode in $am_compiler_list; do
240565c1f7cfSmrg    # Setup a source with many dependencies, because some compilers
240665c1f7cfSmrg    # like to wrap large dependency lists on column 80 (with \), and
240765c1f7cfSmrg    # we should not choose a depcomp mode which is confused by this.
240865c1f7cfSmrg    #
240965c1f7cfSmrg    # We need to recreate these files for each test, as the compiler may
241065c1f7cfSmrg    # overwrite some of them when testing with obscure command lines.
241165c1f7cfSmrg    # This happens at least with the AIX C compiler.
241265c1f7cfSmrg    : > sub/conftest.c
241365c1f7cfSmrg    for i in 1 2 3 4 5 6; do
241465c1f7cfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
241565c1f7cfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
241665c1f7cfSmrg      # Solaris 10 /bin/sh.
241765c1f7cfSmrg      echo '/* dummy */' > sub/conftst$i.h
241865c1f7cfSmrg    done
241965c1f7cfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2420533545b5Smrg
242165c1f7cfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
242265c1f7cfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
242365c1f7cfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
242465c1f7cfSmrg    # versions had trouble with output in subdirs.
242565c1f7cfSmrg    am__obj=sub/conftest.${OBJEXT-o}
242665c1f7cfSmrg    am__minus_obj="-o $am__obj"
242765c1f7cfSmrg    case $depmode in
242865c1f7cfSmrg    gcc)
242965c1f7cfSmrg      # This depmode causes a compiler race in universal mode.
243065c1f7cfSmrg      test "$am__universal" = false || continue
243165c1f7cfSmrg      ;;
243265c1f7cfSmrg    nosideeffect)
243365c1f7cfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
243465c1f7cfSmrg      # only be used when explicitly requested.
243565c1f7cfSmrg      if test "x$enable_dependency_tracking" = xyes; then
243665c1f7cfSmrg	continue
243765c1f7cfSmrg      else
243865c1f7cfSmrg	break
243965c1f7cfSmrg      fi
244065c1f7cfSmrg      ;;
244165c1f7cfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
244265c1f7cfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
244365c1f7cfSmrg      # not run yet.  These depmodes are late enough in the game, and
244465c1f7cfSmrg      # so weak that their functioning should not be impacted.
244565c1f7cfSmrg      am__obj=conftest.${OBJEXT-o}
244665c1f7cfSmrg      am__minus_obj=
244765c1f7cfSmrg      ;;
244865c1f7cfSmrg    none) break ;;
244965c1f7cfSmrg    esac
245065c1f7cfSmrg    if depmode=$depmode \
245165c1f7cfSmrg       source=sub/conftest.c object=$am__obj \
245265c1f7cfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
245365c1f7cfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
245465c1f7cfSmrg         >/dev/null 2>conftest.err &&
245565c1f7cfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
245665c1f7cfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
245765c1f7cfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
245865c1f7cfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
245965c1f7cfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
246065c1f7cfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
246165c1f7cfSmrg      # that says an option was ignored or not supported.
246265c1f7cfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
246365c1f7cfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
246465c1f7cfSmrg      # The diagnosis changed in icc 8.0:
246565c1f7cfSmrg      #   icc: Command line remark: option '-MP' not supported
246665c1f7cfSmrg      if (grep 'ignoring option' conftest.err ||
246765c1f7cfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
246865c1f7cfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
246965c1f7cfSmrg        break
247065c1f7cfSmrg      fi
247165c1f7cfSmrg    fi
247265c1f7cfSmrg  done
2473736a7e2cSmrg
247465c1f7cfSmrg  cd ..
247565c1f7cfSmrg  rm -rf conftest.dir
2476736a7e2cSmrgelse
247765c1f7cfSmrg  am_cv_$1_dependencies_compiler_type=none
2478736a7e2cSmrgfi
247965c1f7cfSmrg])
248065c1f7cfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
248165c1f7cfSmrgAM_CONDITIONAL([am__fastdep$1], [
248265c1f7cfSmrg  test "x$enable_dependency_tracking" != xno \
248365c1f7cfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
248465c1f7cfSmrg])
2485736a7e2cSmrg
2486736a7e2cSmrg
248765c1f7cfSmrg# AM_SET_DEPDIR
248865c1f7cfSmrg# -------------
248965c1f7cfSmrg# Choose a directory name for dependency files.
249065c1f7cfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
249165c1f7cfSmrgAC_DEFUN([AM_SET_DEPDIR],
249265c1f7cfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
249365c1f7cfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
249465c1f7cfSmrg])
249565c1f7cfSmrg
249665c1f7cfSmrg
249765c1f7cfSmrg# AM_DEP_TRACK
249865c1f7cfSmrg# ------------
249965c1f7cfSmrgAC_DEFUN([AM_DEP_TRACK],
250065c1f7cfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
250165c1f7cfSmrgAS_HELP_STRING(
250265c1f7cfSmrg  [--enable-dependency-tracking],
250365c1f7cfSmrg  [do not reject slow dependency extractors])
250465c1f7cfSmrgAS_HELP_STRING(
250565c1f7cfSmrg  [--disable-dependency-tracking],
250665c1f7cfSmrg  [speeds up one-time build])])
250765c1f7cfSmrgif test "x$enable_dependency_tracking" != xno; then
250865c1f7cfSmrg  am_depcomp="$ac_aux_dir/depcomp"
250965c1f7cfSmrg  AMDEPBACKSLASH='\'
251065c1f7cfSmrg  am__nodep='_no'
251165c1f7cfSmrgfi
251265c1f7cfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
251365c1f7cfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
251465c1f7cfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
251565c1f7cfSmrgAC_SUBST([am__nodep])dnl
251665c1f7cfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
251765c1f7cfSmrg])
2518736a7e2cSmrg
251965c1f7cfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2520736a7e2cSmrg
252165c1f7cfSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2522e4ee1255Smrg#
252365c1f7cfSmrg# This file is free software; the Free Software Foundation
252465c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
252565c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2526e4ee1255Smrg
2527533545b5Smrg
252865c1f7cfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
252965c1f7cfSmrg# ------------------------------
253065c1f7cfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
253165c1f7cfSmrg[{
253265c1f7cfSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
253365c1f7cfSmrg  # are listed without --file.  Let's play safe and only enable the eval
253465c1f7cfSmrg  # if we detect the quoting.
253565c1f7cfSmrg  case $CONFIG_FILES in
253665c1f7cfSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
253765c1f7cfSmrg  *)   set x $CONFIG_FILES ;;
253865c1f7cfSmrg  esac
253965c1f7cfSmrg  shift
254065c1f7cfSmrg  for mf
254165c1f7cfSmrg  do
254265c1f7cfSmrg    # Strip MF so we end up with the name of the file.
254365c1f7cfSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
254465c1f7cfSmrg    # Check whether this is an Automake generated Makefile or not.
254565c1f7cfSmrg    # We used to match only the files named 'Makefile.in', but
254665c1f7cfSmrg    # some people rename them; so instead we look at the file content.
254765c1f7cfSmrg    # Grep'ing the first line is not enough: some people post-process
254865c1f7cfSmrg    # each Makefile.in and add a new line on top of each file to say so.
254965c1f7cfSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
255065c1f7cfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
255165c1f7cfSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
255265c1f7cfSmrg      dirpart=`AS_DIRNAME("$mf")`
255365c1f7cfSmrg    else
255465c1f7cfSmrg      continue
255565c1f7cfSmrg    fi
255665c1f7cfSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
255765c1f7cfSmrg    # from the Makefile without running 'make'.
255865c1f7cfSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
255965c1f7cfSmrg    test -z "$DEPDIR" && continue
256065c1f7cfSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
256165c1f7cfSmrg    test -z "$am__include" && continue
256265c1f7cfSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
256365c1f7cfSmrg    # Find all dependency output files, they are included files with
256465c1f7cfSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
256565c1f7cfSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
256665c1f7cfSmrg    # expansion.
256765c1f7cfSmrg    for file in `sed -n "
256865c1f7cfSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
256965c1f7cfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
257065c1f7cfSmrg      # Make sure the directory exists.
257165c1f7cfSmrg      test -f "$dirpart/$file" && continue
257265c1f7cfSmrg      fdir=`AS_DIRNAME(["$file"])`
257365c1f7cfSmrg      AS_MKDIR_P([$dirpart/$fdir])
257465c1f7cfSmrg      # echo "creating $dirpart/$file"
257565c1f7cfSmrg      echo '# dummy' > "$dirpart/$file"
257665c1f7cfSmrg    done
257765c1f7cfSmrg  done
257865c1f7cfSmrg}
257965c1f7cfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
258065c1f7cfSmrg
258165c1f7cfSmrg
258265c1f7cfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
258365c1f7cfSmrg# -----------------------------
258465c1f7cfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2585533545b5Smrg#
258665c1f7cfSmrg# This code is only required when automatic dependency tracking
258765c1f7cfSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
258865c1f7cfSmrg# need in order to bootstrap the dependency handling code.
258965c1f7cfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
259065c1f7cfSmrg[AC_CONFIG_COMMANDS([depfiles],
259165c1f7cfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
259265c1f7cfSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
259365c1f7cfSmrg])
259465c1f7cfSmrg
259565c1f7cfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
259665c1f7cfSmrg
259765c1f7cfSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
2598e4ee1255Smrg#
259965c1f7cfSmrg# This file is free software; the Free Software Foundation
260065c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
260165c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2602e4ee1255Smrg
260365c1f7cfSmrg# This macro actually does too much.  Some checks are only needed if
260465c1f7cfSmrg# your package does certain things.  But this isn't really a big deal.
2605e4ee1255Smrg
260665c1f7cfSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
260765c1f7cfSmrgm4_define([AC_PROG_CC],
260865c1f7cfSmrgm4_defn([AC_PROG_CC])
260965c1f7cfSmrg[_AM_PROG_CC_C_O
261065c1f7cfSmrg])
2611e4ee1255Smrg
261265c1f7cfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
261365c1f7cfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
261465c1f7cfSmrg# -----------------------------------------------
261565c1f7cfSmrg# The call with PACKAGE and VERSION arguments is the old style
261665c1f7cfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
261765c1f7cfSmrg# and VERSION should now be passed to AC_INIT and removed from
261865c1f7cfSmrg# the call to AM_INIT_AUTOMAKE.
261965c1f7cfSmrg# We support both call styles for the transition.  After
262065c1f7cfSmrg# the next Automake release, Autoconf can make the AC_INIT
262165c1f7cfSmrg# arguments mandatory, and then we can depend on a new Autoconf
262265c1f7cfSmrg# release and drop the old call support.
262365c1f7cfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
262465c1f7cfSmrg[AC_PREREQ([2.65])dnl
262565c1f7cfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
262665c1f7cfSmrgdnl the ones we care about.
262765c1f7cfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
262865c1f7cfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
262965c1f7cfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
263065c1f7cfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
263165c1f7cfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
263265c1f7cfSmrg  # is not polluted with repeated "-I."
263365c1f7cfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
263465c1f7cfSmrg  # test to see if srcdir already configured
263565c1f7cfSmrg  if test -f $srcdir/config.status; then
263665c1f7cfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637e4ee1255Smrg  fi
2638e4ee1255Smrgfi
2639e4ee1255Smrg
264065c1f7cfSmrg# test whether we have cygpath
264165c1f7cfSmrgif test -z "$CYGPATH_W"; then
264265c1f7cfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
264365c1f7cfSmrg    CYGPATH_W='cygpath -w'
264465c1f7cfSmrg  else
264565c1f7cfSmrg    CYGPATH_W=echo
2646e4ee1255Smrg  fi
2647e4ee1255Smrgfi
264865c1f7cfSmrgAC_SUBST([CYGPATH_W])
2649e4ee1255Smrg
265065c1f7cfSmrg# Define the identity of the package.
265165c1f7cfSmrgdnl Distinguish between old-style and new-style calls.
265265c1f7cfSmrgm4_ifval([$2],
265365c1f7cfSmrg[AC_DIAGNOSE([obsolete],
265465c1f7cfSmrg             [$0: two- and three-arguments forms are deprecated.])
265565c1f7cfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
265665c1f7cfSmrg AC_SUBST([PACKAGE], [$1])dnl
265765c1f7cfSmrg AC_SUBST([VERSION], [$2])],
265865c1f7cfSmrg[_AM_SET_OPTIONS([$1])dnl
265965c1f7cfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
266065c1f7cfSmrgm4_if(
266165c1f7cfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
266265c1f7cfSmrg  [ok:ok],,
266365c1f7cfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
266465c1f7cfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
266565c1f7cfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666e4ee1255Smrg
266765c1f7cfSmrg_AM_IF_OPTION([no-define],,
266865c1f7cfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
266965c1f7cfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670e4ee1255Smrg
267165c1f7cfSmrg# Some tools Automake needs.
267265c1f7cfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
267365c1f7cfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
267465c1f7cfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
267565c1f7cfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
267665c1f7cfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
267765c1f7cfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
267865c1f7cfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
267965c1f7cfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
268065c1f7cfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
268165c1f7cfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
268265c1f7cfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
268365c1f7cfSmrg# dies out for good.  For more background, see:
268465c1f7cfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
268565c1f7cfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
268665c1f7cfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
268765c1f7cfSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
268865c1f7cfSmrg# system "awk" is bad on some platforms.
268965c1f7cfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
269065c1f7cfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
269165c1f7cfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
269265c1f7cfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
269365c1f7cfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
269465c1f7cfSmrg			     [_AM_PROG_TAR([v7])])])
269565c1f7cfSmrg_AM_IF_OPTION([no-dependencies],,
269665c1f7cfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
269765c1f7cfSmrg		  [_AM_DEPENDENCIES([CC])],
269865c1f7cfSmrg		  [m4_define([AC_PROG_CC],
269965c1f7cfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
270065c1f7cfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
270165c1f7cfSmrg		  [_AM_DEPENDENCIES([CXX])],
270265c1f7cfSmrg		  [m4_define([AC_PROG_CXX],
270365c1f7cfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
270465c1f7cfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
270565c1f7cfSmrg		  [_AM_DEPENDENCIES([OBJC])],
270665c1f7cfSmrg		  [m4_define([AC_PROG_OBJC],
270765c1f7cfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
270865c1f7cfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
270965c1f7cfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
271065c1f7cfSmrg		  [m4_define([AC_PROG_OBJCXX],
271165c1f7cfSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
271265c1f7cfSmrg])
271365c1f7cfSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
271465c1f7cfSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
271565c1f7cfSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
271665c1f7cfSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
271765c1f7cfSmrgAC_CONFIG_COMMANDS_PRE(dnl
271865c1f7cfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
271965c1f7cfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720e4ee1255Smrg
272165c1f7cfSmrg# POSIX will say in a future version that running "rm -f" with no argument
272265c1f7cfSmrg# is OK; and we want to be able to make that assumption in our Makefile
272365c1f7cfSmrg# recipes.  So use an aggressive probe to check that the usage we want is
272465c1f7cfSmrg# actually supported "in the wild" to an acceptable degree.
272565c1f7cfSmrg# See automake bug#10828.
272665c1f7cfSmrg# To make any issue more visible, cause the running configure to be aborted
272765c1f7cfSmrg# by default if the 'rm' program in use doesn't match our expectations; the
272865c1f7cfSmrg# user can still override this though.
272965c1f7cfSmrgif rm -f && rm -fr && rm -rf; then : OK; else
273065c1f7cfSmrg  cat >&2 <<'END'
273165c1f7cfSmrgOops!
2732533545b5Smrg
273365c1f7cfSmrgYour 'rm' program seems unable to run without file operands specified
273465c1f7cfSmrgon the command line, even when the '-f' option is present.  This is contrary
273565c1f7cfSmrgto the behaviour of most rm programs out there, and not conforming with
273665c1f7cfSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737533545b5Smrg
273865c1f7cfSmrgPlease tell bug-automake@gnu.org about your system, including the value
273965c1f7cfSmrgof your $PATH and any error possibly output before this message.  This
274065c1f7cfSmrgcan help us improve future automake versions.
2741533545b5Smrg
274265c1f7cfSmrgEND
274365c1f7cfSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
274465c1f7cfSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
274565c1f7cfSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
274665c1f7cfSmrg    echo >&2
274765c1f7cfSmrg  else
274865c1f7cfSmrg    cat >&2 <<'END'
274965c1f7cfSmrgAborting the configuration process, to ensure you take notice of the issue.
2750533545b5Smrg
275165c1f7cfSmrgYou can download and install GNU coreutils to get an 'rm' implementation
275265c1f7cfSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753533545b5Smrg
275465c1f7cfSmrgIf you want to complete the configuration process using your problematic
275565c1f7cfSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
275665c1f7cfSmrgto "yes", and re-run configure.
2757264fa531Smrg
275865c1f7cfSmrgEND
275965c1f7cfSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
276065c1f7cfSmrg  fi
2761264fa531Smrgfi
276265c1f7cfSmrgdnl The trailing newline in this macro's definition is deliberate, for
276365c1f7cfSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
276465c1f7cfSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
276565c1f7cfSmrg])
2766264fa531Smrg
276765c1f7cfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
276865c1f7cfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
276965c1f7cfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
277065c1f7cfSmrgm4_define([_AC_COMPILER_EXEEXT],
277165c1f7cfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2772264fa531Smrg
277365c1f7cfSmrg# When config.status generates a header, we must update the stamp-h file.
277465c1f7cfSmrg# This file resides in the same directory as the config header
277565c1f7cfSmrg# that is generated.  The stamp files are numbered to have different names.
2776264fa531Smrg
277765c1f7cfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
277865c1f7cfSmrg# loop where config.status creates the headers, so we can generate
277965c1f7cfSmrg# our stamp files there.
278065c1f7cfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
278165c1f7cfSmrg[# Compute $1's index in $config_headers.
278265c1f7cfSmrg_am_arg=$1
278365c1f7cfSmrg_am_stamp_count=1
278465c1f7cfSmrgfor _am_header in $config_headers :; do
278565c1f7cfSmrg  case $_am_header in
278665c1f7cfSmrg    $_am_arg | $_am_arg:* )
278765c1f7cfSmrg      break ;;
278865c1f7cfSmrg    * )
278965c1f7cfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
279065c1f7cfSmrg  esac
279165c1f7cfSmrgdone
279265c1f7cfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
279365c1f7cfSmrg
279465c1f7cfSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2795c37a63b8Smrg#
279665c1f7cfSmrg# This file is free software; the Free Software Foundation
279765c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
279865c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2799c37a63b8Smrg
280065c1f7cfSmrg# AM_PROG_INSTALL_SH
280165c1f7cfSmrg# ------------------
280265c1f7cfSmrg# Define $install_sh.
280365c1f7cfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
280465c1f7cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
280565c1f7cfSmrgif test x"${install_sh+set}" != xset; then
280665c1f7cfSmrg  case $am_aux_dir in
280765c1f7cfSmrg  *\ * | *\	*)
280865c1f7cfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
280965c1f7cfSmrg  *)
281065c1f7cfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
281165c1f7cfSmrg  esac
281265c1f7cfSmrgfi
281365c1f7cfSmrgAC_SUBST([install_sh])])
2814736a7e2cSmrg
281565c1f7cfSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
281665c1f7cfSmrg#
281765c1f7cfSmrg# This file is free software; the Free Software Foundation
281865c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
281965c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2820736a7e2cSmrg
282165c1f7cfSmrg# Check whether the underlying file-system supports filenames
282265c1f7cfSmrg# with a leading dot.  For instance MS-DOS doesn't.
282365c1f7cfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
282465c1f7cfSmrg[rm -rf .tst 2>/dev/null
282565c1f7cfSmrgmkdir .tst 2>/dev/null
282665c1f7cfSmrgif test -d .tst; then
282765c1f7cfSmrg  am__leading_dot=.
2828c37a63b8Smrgelse
282965c1f7cfSmrg  am__leading_dot=_
2830c37a63b8Smrgfi
283165c1f7cfSmrgrmdir .tst 2>/dev/null
283265c1f7cfSmrgAC_SUBST([am__leading_dot])])
2833c37a63b8Smrg
283465c1f7cfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835c37a63b8Smrg
283665c1f7cfSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2837736a7e2cSmrg#
283865c1f7cfSmrg# This file is free software; the Free Software Foundation
283965c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
284065c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2841736a7e2cSmrg
284265c1f7cfSmrg# AM_MAKE_INCLUDE()
284365c1f7cfSmrg# -----------------
284465c1f7cfSmrg# Check to see how make treats includes.
284565c1f7cfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
284665c1f7cfSmrg[am_make=${MAKE-make}
284765c1f7cfSmrgcat > confinc << 'END'
284865c1f7cfSmrgam__doit:
284965c1f7cfSmrg	@echo this is the am__doit target
285065c1f7cfSmrg.PHONY: am__doit
285165c1f7cfSmrgEND
285265c1f7cfSmrg# If we don't find an include directive, just comment out the code.
285365c1f7cfSmrgAC_MSG_CHECKING([for style of include used by $am_make])
285465c1f7cfSmrgam__include="#"
285565c1f7cfSmrgam__quote=
285665c1f7cfSmrg_am_result=none
285765c1f7cfSmrg# First try GNU make style include.
285865c1f7cfSmrgecho "include confinc" > confmf
285965c1f7cfSmrg# Ignore all kinds of additional output from 'make'.
286065c1f7cfSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
286165c1f7cfSmrg*the\ am__doit\ target*)
286265c1f7cfSmrg  am__include=include
286365c1f7cfSmrg  am__quote=
286465c1f7cfSmrg  _am_result=GNU
286565c1f7cfSmrg  ;;
286665c1f7cfSmrgesac
286765c1f7cfSmrg# Now try BSD make style include.
286865c1f7cfSmrgif test "$am__include" = "#"; then
286965c1f7cfSmrg   echo '.include "confinc"' > confmf
287065c1f7cfSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
287165c1f7cfSmrg   *the\ am__doit\ target*)
287265c1f7cfSmrg     am__include=.include
287365c1f7cfSmrg     am__quote="\""
287465c1f7cfSmrg     _am_result=BSD
287565c1f7cfSmrg     ;;
287665c1f7cfSmrg   esac
2877c37a63b8Smrgfi
287865c1f7cfSmrgAC_SUBST([am__include])
287965c1f7cfSmrgAC_SUBST([am__quote])
288065c1f7cfSmrgAC_MSG_RESULT([$_am_result])
288165c1f7cfSmrgrm -f confinc confmf
288265c1f7cfSmrg])
2883736a7e2cSmrg
288465c1f7cfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885e4ee1255Smrg
288665c1f7cfSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887533545b5Smrg#
288865c1f7cfSmrg# This file is free software; the Free Software Foundation
288965c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
289065c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2891533545b5Smrg
289265c1f7cfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
289365c1f7cfSmrg# ------------------------------
289465c1f7cfSmrgAC_DEFUN([AM_MISSING_PROG],
289565c1f7cfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
289665c1f7cfSmrg$1=${$1-"${am_missing_run}$2"}
289765c1f7cfSmrgAC_SUBST($1)])
2898533545b5Smrg
289965c1f7cfSmrg# AM_MISSING_HAS_RUN
290065c1f7cfSmrg# ------------------
290165c1f7cfSmrg# Define MISSING if not defined so far and test if it is modern enough.
290265c1f7cfSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
290365c1f7cfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
290465c1f7cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
290565c1f7cfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
290665c1f7cfSmrgif test x"${MISSING+set}" != xset; then
290765c1f7cfSmrg  case $am_aux_dir in
290865c1f7cfSmrg  *\ * | *\	*)
290965c1f7cfSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
291065c1f7cfSmrg  *)
291165c1f7cfSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
291265c1f7cfSmrg  esac
2913533545b5Smrgfi
291465c1f7cfSmrg# Use eval to expand $SHELL
291565c1f7cfSmrgif eval "$MISSING --is-lightweight"; then
291665c1f7cfSmrg  am_missing_run="$MISSING "
291765c1f7cfSmrgelse
291865c1f7cfSmrg  am_missing_run=
291965c1f7cfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2920533545b5Smrgfi
292165c1f7cfSmrg])
2922533545b5Smrg
292365c1f7cfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2924533545b5Smrg
292565c1f7cfSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292665c1f7cfSmrg#
292765c1f7cfSmrg# This file is free software; the Free Software Foundation
292865c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
292965c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2930533545b5Smrg
293165c1f7cfSmrg# _AM_MANGLE_OPTION(NAME)
293265c1f7cfSmrg# -----------------------
293365c1f7cfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
293465c1f7cfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935533545b5Smrg
293665c1f7cfSmrg# _AM_SET_OPTION(NAME)
293765c1f7cfSmrg# --------------------
293865c1f7cfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
293965c1f7cfSmrgAC_DEFUN([_AM_SET_OPTION],
294065c1f7cfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941533545b5Smrg
294265c1f7cfSmrg# _AM_SET_OPTIONS(OPTIONS)
294365c1f7cfSmrg# ------------------------
294465c1f7cfSmrg# OPTIONS is a space-separated list of Automake options.
294565c1f7cfSmrgAC_DEFUN([_AM_SET_OPTIONS],
294665c1f7cfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947533545b5Smrg
294865c1f7cfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
294965c1f7cfSmrg# -------------------------------------------
295065c1f7cfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
295165c1f7cfSmrgAC_DEFUN([_AM_IF_OPTION],
295265c1f7cfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953533545b5Smrg
295465c1f7cfSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955533545b5Smrg#
295665c1f7cfSmrg# This file is free software; the Free Software Foundation
295765c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
295865c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
2959533545b5Smrg
296065c1f7cfSmrg# _AM_PROG_CC_C_O
296165c1f7cfSmrg# ---------------
296265c1f7cfSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
296365c1f7cfSmrg# to automatically call this.
296465c1f7cfSmrgAC_DEFUN([_AM_PROG_CC_C_O],
296565c1f7cfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
296665c1f7cfSmrgAC_REQUIRE_AUX_FILE([compile])dnl
296765c1f7cfSmrgAC_LANG_PUSH([C])dnl
296865c1f7cfSmrgAC_CACHE_CHECK(
296965c1f7cfSmrg  [whether $CC understands -c and -o together],
297065c1f7cfSmrg  [am_cv_prog_cc_c_o],
297165c1f7cfSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
297265c1f7cfSmrg  # Make sure it works both with $CC and with simple cc.
297365c1f7cfSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
297465c1f7cfSmrg  # compilers refuse to overwrite an existing .o file with -o,
297565c1f7cfSmrg  # though they will create one.
297665c1f7cfSmrg  am_cv_prog_cc_c_o=yes
297765c1f7cfSmrg  for am_i in 1 2; do
297865c1f7cfSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
297965c1f7cfSmrg         && test -f conftest2.$ac_objext; then
298065c1f7cfSmrg      : OK
298165c1f7cfSmrg    else
298265c1f7cfSmrg      am_cv_prog_cc_c_o=no
298365c1f7cfSmrg      break
298465c1f7cfSmrg    fi
298565c1f7cfSmrg  done
298665c1f7cfSmrg  rm -f core conftest*
298765c1f7cfSmrg  unset am_i])
298865c1f7cfSmrgif test "$am_cv_prog_cc_c_o" != yes; then
298965c1f7cfSmrg   # Losing compiler, so override with the script.
299065c1f7cfSmrg   # FIXME: It is wrong to rewrite CC.
299165c1f7cfSmrg   # But if we don't then we get into trouble of one sort or another.
299265c1f7cfSmrg   # A longer-term fix would be to have automake use am__CC in this case,
299365c1f7cfSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
299465c1f7cfSmrg   CC="$am_aux_dir/compile $CC"
2995533545b5Smrgfi
299665c1f7cfSmrgAC_LANG_POP([C])])
2997533545b5Smrg
299865c1f7cfSmrg# For backward compatibility.
299965c1f7cfSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
300065c1f7cfSmrg
300165c1f7cfSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
300265c1f7cfSmrg#
300365c1f7cfSmrg# This file is free software; the Free Software Foundation
300465c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
300565c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
300665c1f7cfSmrg
300765c1f7cfSmrg# AM_RUN_LOG(COMMAND)
300865c1f7cfSmrg# -------------------
300965c1f7cfSmrg# Run COMMAND, save the exit status in ac_status, and log it.
301065c1f7cfSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
301165c1f7cfSmrgAC_DEFUN([AM_RUN_LOG],
301265c1f7cfSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
301365c1f7cfSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
301465c1f7cfSmrg   ac_status=$?
301565c1f7cfSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
301665c1f7cfSmrg   (exit $ac_status); }])
3017533545b5Smrg
301865c1f7cfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019533545b5Smrg
302065c1f7cfSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
302165c1f7cfSmrg#
302265c1f7cfSmrg# This file is free software; the Free Software Foundation
302365c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
302465c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
3025533545b5Smrg
302665c1f7cfSmrg# AM_SANITY_CHECK
302765c1f7cfSmrg# ---------------
302865c1f7cfSmrgAC_DEFUN([AM_SANITY_CHECK],
302965c1f7cfSmrg[AC_MSG_CHECKING([whether build environment is sane])
303065c1f7cfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
303165c1f7cfSmrg# name.  Accept space and tab only in the latter.
303265c1f7cfSmrgam_lf='
303365c1f7cfSmrg'
303465c1f7cfSmrgcase `pwd` in
303565c1f7cfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
303665c1f7cfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
303765c1f7cfSmrgesac
303865c1f7cfSmrgcase $srcdir in
303965c1f7cfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
304065c1f7cfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
304165c1f7cfSmrgesac
3042533545b5Smrg
304365c1f7cfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
304465c1f7cfSmrg# arguments.  Must try -L first in case configure is actually a
304565c1f7cfSmrg# symlink; some systems play weird games with the mod time of symlinks
304665c1f7cfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
304765c1f7cfSmrg# directory).
304865c1f7cfSmrgif (
304965c1f7cfSmrg   am_has_slept=no
305065c1f7cfSmrg   for am_try in 1 2; do
305165c1f7cfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
305265c1f7cfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
305365c1f7cfSmrg     if test "$[*]" = "X"; then
305465c1f7cfSmrg	# -L didn't work.
305565c1f7cfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
305665c1f7cfSmrg     fi
305765c1f7cfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
305865c1f7cfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059533545b5Smrg
306065c1f7cfSmrg	# If neither matched, then we have a broken ls.  This can happen
306165c1f7cfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
306265c1f7cfSmrg	# broken ls alias from the environment.  This has actually
306365c1f7cfSmrg	# happened.  Such a system could not be considered "sane".
306465c1f7cfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
306565c1f7cfSmrg  alias in your environment])
306665c1f7cfSmrg     fi
306765c1f7cfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
306865c1f7cfSmrg       break
306965c1f7cfSmrg     fi
307065c1f7cfSmrg     # Just in case.
307165c1f7cfSmrg     sleep 1
307265c1f7cfSmrg     am_has_slept=yes
307365c1f7cfSmrg   done
307465c1f7cfSmrg   test "$[2]" = conftest.file
307565c1f7cfSmrg   )
307665c1f7cfSmrgthen
307765c1f7cfSmrg   # Ok.
307865c1f7cfSmrg   :
3079533545b5Smrgelse
308065c1f7cfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
308165c1f7cfSmrgCheck your system clock])
3082533545b5Smrgfi
308365c1f7cfSmrgAC_MSG_RESULT([yes])
308465c1f7cfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
308565c1f7cfSmrg# generated files are strictly newer.
308665c1f7cfSmrgam_sleep_pid=
308765c1f7cfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
308865c1f7cfSmrg  ( sleep 1 ) &
308965c1f7cfSmrg  am_sleep_pid=$!
309065c1f7cfSmrgfi
309165c1f7cfSmrgAC_CONFIG_COMMANDS_PRE(
309265c1f7cfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
309365c1f7cfSmrg   if test -n "$am_sleep_pid"; then
309465c1f7cfSmrg     # Hide warnings about reused PIDs.
309565c1f7cfSmrg     wait $am_sleep_pid 2>/dev/null
309665c1f7cfSmrg   fi
309765c1f7cfSmrg   AC_MSG_RESULT([done])])
309865c1f7cfSmrgrm -f conftest.file
309965c1f7cfSmrg])
3100533545b5Smrg
310165c1f7cfSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102533545b5Smrg#
310365c1f7cfSmrg# This file is free software; the Free Software Foundation
310465c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
310565c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
3106c37a63b8Smrg
310765c1f7cfSmrg# AM_SILENT_RULES([DEFAULT])
310865c1f7cfSmrg# --------------------------
310965c1f7cfSmrg# Enable less verbose build rules; with the default set to DEFAULT
311065c1f7cfSmrg# ("yes" being less verbose, "no" or empty being verbose).
311165c1f7cfSmrgAC_DEFUN([AM_SILENT_RULES],
311265c1f7cfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
311365c1f7cfSmrgAS_HELP_STRING(
311465c1f7cfSmrg  [--enable-silent-rules],
311565c1f7cfSmrg  [less verbose build output (undo: "make V=1")])
311665c1f7cfSmrgAS_HELP_STRING(
311765c1f7cfSmrg  [--disable-silent-rules],
311865c1f7cfSmrg  [verbose build output (undo: "make V=0")])dnl
311965c1f7cfSmrg])
312065c1f7cfSmrgcase $enable_silent_rules in @%:@ (((
312165c1f7cfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
312265c1f7cfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
312365c1f7cfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
312465c1f7cfSmrgesac
312565c1f7cfSmrgdnl
312665c1f7cfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
312765c1f7cfSmrgdnl do not support nested variable expansions.
312865c1f7cfSmrgdnl See automake bug#9928 and bug#10237.
312965c1f7cfSmrgam_make=${MAKE-make}
313065c1f7cfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
313165c1f7cfSmrg   [am_cv_make_support_nested_variables],
313265c1f7cfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
313365c1f7cfSmrgBAR0=false
313465c1f7cfSmrgBAR1=true
313565c1f7cfSmrgV=1
313665c1f7cfSmrgam__doit:
313765c1f7cfSmrg	@$(TRUE)
313865c1f7cfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
313965c1f7cfSmrg  am_cv_make_support_nested_variables=yes
314065c1f7cfSmrgelse
314165c1f7cfSmrg  am_cv_make_support_nested_variables=no
314265c1f7cfSmrgfi])
314365c1f7cfSmrgif test $am_cv_make_support_nested_variables = yes; then
314465c1f7cfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
314565c1f7cfSmrg  AM_V='$(V)'
314665c1f7cfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
314765c1f7cfSmrgelse
314865c1f7cfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
314965c1f7cfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
315065c1f7cfSmrgfi
315165c1f7cfSmrgAC_SUBST([AM_V])dnl
315265c1f7cfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
315365c1f7cfSmrgAC_SUBST([AM_DEFAULT_V])dnl
315465c1f7cfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
315565c1f7cfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
315665c1f7cfSmrgAM_BACKSLASH='\'
315765c1f7cfSmrgAC_SUBST([AM_BACKSLASH])dnl
315865c1f7cfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
315965c1f7cfSmrg])
316065c1f7cfSmrg
316165c1f7cfSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162e4ee1255Smrg#
316365c1f7cfSmrg# This file is free software; the Free Software Foundation
316465c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
316565c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
316665c1f7cfSmrg
316765c1f7cfSmrg# AM_PROG_INSTALL_STRIP
316865c1f7cfSmrg# ---------------------
316965c1f7cfSmrg# One issue with vendor 'install' (even GNU) is that you can't
317065c1f7cfSmrg# specify the program used to strip binaries.  This is especially
317165c1f7cfSmrg# annoying in cross-compiling environments, where the build's strip
317265c1f7cfSmrg# is unlikely to handle the host's binaries.
317365c1f7cfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
317465c1f7cfSmrg# always use install-sh in "make install-strip", and initialize
317565c1f7cfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
317665c1f7cfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
317765c1f7cfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
317865c1f7cfSmrg# Installed binaries are usually stripped using 'strip' when the user
317965c1f7cfSmrg# run "make install-strip".  However 'strip' might not be the right
318065c1f7cfSmrg# tool to use in cross-compilation environments, therefore Automake
318165c1f7cfSmrg# will honor the 'STRIP' environment variable to overrule this program.
318265c1f7cfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
318365c1f7cfSmrgif test "$cross_compiling" != no; then
318465c1f7cfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
318565c1f7cfSmrgfi
318665c1f7cfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
318765c1f7cfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188c37a63b8Smrg
318965c1f7cfSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
319065c1f7cfSmrg#
319165c1f7cfSmrg# This file is free software; the Free Software Foundation
319265c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
319365c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
3194533545b5Smrg
319565c1f7cfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
319665c1f7cfSmrg# ---------------------------
319765c1f7cfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
319865c1f7cfSmrg# This macro is traced by Automake.
319965c1f7cfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200533545b5Smrg
320165c1f7cfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
320265c1f7cfSmrg# --------------------------
320365c1f7cfSmrg# Public sister of _AM_SUBST_NOTMAKE.
320465c1f7cfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205533545b5Smrg
320665c1f7cfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3207533545b5Smrg
320865c1f7cfSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
320965c1f7cfSmrg#
321065c1f7cfSmrg# This file is free software; the Free Software Foundation
321165c1f7cfSmrg# gives unlimited permission to copy and/or distribute it,
321265c1f7cfSmrg# with or without modifications, as long as this notice is preserved.
3213c37a63b8Smrg
321465c1f7cfSmrg# _AM_PROG_TAR(FORMAT)
3215c37a63b8Smrg# --------------------
321665c1f7cfSmrg# Check how to create a tarball in format FORMAT.
321765c1f7cfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218c37a63b8Smrg#
321965c1f7cfSmrg# Substitute a variable $(am__tar) that is a command
322065c1f7cfSmrg# writing to stdout a FORMAT-tarball containing the directory
322165c1f7cfSmrg# $tardir.
322265c1f7cfSmrg#     tardir=directory && $(am__tar) > result.tar
3223736a7e2cSmrg#
322465c1f7cfSmrg# Substitute a variable $(am__untar) that extract such
322565c1f7cfSmrg# a tarball read from stdin.
322665c1f7cfSmrg#     $(am__untar) < result.tar
3227736a7e2cSmrg#
322865c1f7cfSmrgAC_DEFUN([_AM_PROG_TAR],
322965c1f7cfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
323065c1f7cfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
323165c1f7cfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232264fa531Smrg
323365c1f7cfSmrg# We'll loop over all known methods to create a tar archive until one works.
323465c1f7cfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235533545b5Smrg
323665c1f7cfSmrgm4_if([$1], [v7],
323765c1f7cfSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3238264fa531Smrg
323965c1f7cfSmrg  [m4_case([$1],
324065c1f7cfSmrg    [ustar],
324165c1f7cfSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
324265c1f7cfSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
324365c1f7cfSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
324465c1f7cfSmrg      # and bug#13588).
324565c1f7cfSmrg      am_max_uid=2097151 # 2^21 - 1
324665c1f7cfSmrg      am_max_gid=$am_max_uid
324765c1f7cfSmrg      # The $UID and $GID variables are not portable, so we need to resort
324865c1f7cfSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
324965c1f7cfSmrg      # below are definitely unexpected, so allow the users to see them
325065c1f7cfSmrg      # (that is, avoid stderr redirection).
325165c1f7cfSmrg      am_uid=`id -u || echo unknown`
325265c1f7cfSmrg      am_gid=`id -g || echo unknown`
325365c1f7cfSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
325465c1f7cfSmrg      if test $am_uid -le $am_max_uid; then
325565c1f7cfSmrg         AC_MSG_RESULT([yes])
325665c1f7cfSmrg      else
325765c1f7cfSmrg         AC_MSG_RESULT([no])
325865c1f7cfSmrg         _am_tools=none
325965c1f7cfSmrg      fi
326065c1f7cfSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
326165c1f7cfSmrg      if test $am_gid -le $am_max_gid; then
326265c1f7cfSmrg         AC_MSG_RESULT([yes])
326365c1f7cfSmrg      else
326465c1f7cfSmrg        AC_MSG_RESULT([no])
326565c1f7cfSmrg        _am_tools=none
326665c1f7cfSmrg      fi],
326765c1f7cfSmrg
326865c1f7cfSmrg  [pax],
326965c1f7cfSmrg    [],
327065c1f7cfSmrg
327165c1f7cfSmrg  [m4_fatal([Unknown tar format])])
327265c1f7cfSmrg
327365c1f7cfSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
327465c1f7cfSmrg
327565c1f7cfSmrg  # Go ahead even if we have the value already cached.  We do so because we
327665c1f7cfSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
327765c1f7cfSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
327865c1f7cfSmrg
327965c1f7cfSmrg  for _am_tool in $_am_tools; do
328065c1f7cfSmrg    case $_am_tool in
328165c1f7cfSmrg    gnutar)
328265c1f7cfSmrg      for _am_tar in tar gnutar gtar; do
328365c1f7cfSmrg        AM_RUN_LOG([$_am_tar --version]) && break
328465c1f7cfSmrg      done
328565c1f7cfSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
328665c1f7cfSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
328765c1f7cfSmrg      am__untar="$_am_tar -xf -"
328865c1f7cfSmrg      ;;
328965c1f7cfSmrg    plaintar)
329065c1f7cfSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
329165c1f7cfSmrg      # ustar tarball either.
329265c1f7cfSmrg      (tar --version) >/dev/null 2>&1 && continue
329365c1f7cfSmrg      am__tar='tar chf - "$$tardir"'
329465c1f7cfSmrg      am__tar_='tar chf - "$tardir"'
329565c1f7cfSmrg      am__untar='tar xf -'
329665c1f7cfSmrg      ;;
329765c1f7cfSmrg    pax)
329865c1f7cfSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
329965c1f7cfSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
330065c1f7cfSmrg      am__untar='pax -r'
330165c1f7cfSmrg      ;;
330265c1f7cfSmrg    cpio)
330365c1f7cfSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
330465c1f7cfSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
330565c1f7cfSmrg      am__untar='cpio -i -H $1 -d'
330665c1f7cfSmrg      ;;
330765c1f7cfSmrg    none)
330865c1f7cfSmrg      am__tar=false
330965c1f7cfSmrg      am__tar_=false
331065c1f7cfSmrg      am__untar=false
331165c1f7cfSmrg      ;;
331265c1f7cfSmrg    esac
331365c1f7cfSmrg
331465c1f7cfSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
331565c1f7cfSmrg    # and am__untar set.
331665c1f7cfSmrg    test -n "${am_cv_prog_tar_$1}" && break
331765c1f7cfSmrg
331865c1f7cfSmrg    # tar/untar a dummy directory, and stop if the command works.
331965c1f7cfSmrg    rm -rf conftest.dir
332065c1f7cfSmrg    mkdir conftest.dir
332165c1f7cfSmrg    echo GrepMe > conftest.dir/file
332265c1f7cfSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
332365c1f7cfSmrg    rm -rf conftest.dir
332465c1f7cfSmrg    if test -s conftest.tar; then
332565c1f7cfSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
332665c1f7cfSmrg      AM_RUN_LOG([cat conftest.dir/file])
332765c1f7cfSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
332865c1f7cfSmrg    fi
332965c1f7cfSmrg  done
333065c1f7cfSmrg  rm -rf conftest.dir
333165c1f7cfSmrg
333265c1f7cfSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
333365c1f7cfSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
333465c1f7cfSmrg
333565c1f7cfSmrgAC_SUBST([am__tar])
333665c1f7cfSmrgAC_SUBST([am__untar])
333765c1f7cfSmrg]) # _AM_PROG_TAR
3338c37a63b8Smrg
3339