aclocal.m4 revision 13e6bc1c
1b8414663Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2b8414663Smrg
3b8414663Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
47d5e3a19Smrg
57d5e3a19Smrg# This file is free software; the Free Software Foundation
67d5e3a19Smrg# gives unlimited permission to copy and/or distribute it,
77d5e3a19Smrg# with or without modifications, as long as this notice is preserved.
87d5e3a19Smrg
97d5e3a19Smrg# This program is distributed in the hope that it will be useful,
107d5e3a19Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117d5e3a19Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127d5e3a19Smrg# PARTICULAR PURPOSE.
137d5e3a19Smrg
14b8414663Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151568b75bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
161568b75bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17b8414663Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18b8414663Smrg[m4_warning([this file was generated for autoconf 2.69.
191568b75bSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201568b75bSmrgIf you have problems, you may need to regenerate the build system entirely.
21b8414663SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227d5e3a19Smrg
2313e6bc1cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2413e6bc1cSmrgdnl serial 11 (pkg-config-0.29)
2513e6bc1cSmrgdnl
2613e6bc1cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2713e6bc1cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2813e6bc1cSmrgdnl
2913e6bc1cSmrgdnl This program is free software; you can redistribute it and/or modify
3013e6bc1cSmrgdnl it under the terms of the GNU General Public License as published by
3113e6bc1cSmrgdnl the Free Software Foundation; either version 2 of the License, or
3213e6bc1cSmrgdnl (at your option) any later version.
3313e6bc1cSmrgdnl
3413e6bc1cSmrgdnl This program is distributed in the hope that it will be useful, but
3513e6bc1cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3613e6bc1cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3713e6bc1cSmrgdnl General Public License for more details.
3813e6bc1cSmrgdnl
3913e6bc1cSmrgdnl You should have received a copy of the GNU General Public License
4013e6bc1cSmrgdnl along with this program; if not, write to the Free Software
4113e6bc1cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4213e6bc1cSmrgdnl 02111-1307, USA.
4313e6bc1cSmrgdnl
4413e6bc1cSmrgdnl As a special exception to the GNU General Public License, if you
4513e6bc1cSmrgdnl distribute this file as part of a program that contains a
4613e6bc1cSmrgdnl configuration script generated by Autoconf, you may include it under
4713e6bc1cSmrgdnl the same distribution terms that you use for the rest of that
4813e6bc1cSmrgdnl program.
4913e6bc1cSmrg
5013e6bc1cSmrgdnl PKG_PREREQ(MIN-VERSION)
5113e6bc1cSmrgdnl -----------------------
5213e6bc1cSmrgdnl Since: 0.29
5313e6bc1cSmrgdnl
5413e6bc1cSmrgdnl Verify that the version of the pkg-config macros are at least
5513e6bc1cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5613e6bc1cSmrgdnl installed version of pkg-config, this checks the developer's version
5713e6bc1cSmrgdnl of pkg.m4 when generating configure.
5813e6bc1cSmrgdnl
5913e6bc1cSmrgdnl To ensure that this macro is defined, also add:
6013e6bc1cSmrgdnl m4_ifndef([PKG_PREREQ],
6113e6bc1cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6213e6bc1cSmrgdnl
6313e6bc1cSmrgdnl See the "Since" comment for each macro you use to see what version
6413e6bc1cSmrgdnl of the macros you require.
6513e6bc1cSmrgm4_defun([PKG_PREREQ],
6613e6bc1cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
6713e6bc1cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6813e6bc1cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6913e6bc1cSmrg])dnl PKG_PREREQ
7013e6bc1cSmrg
7113e6bc1cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7213e6bc1cSmrgdnl ----------------------------------
7313e6bc1cSmrgdnl Since: 0.16
7413e6bc1cSmrgdnl
7513e6bc1cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7613e6bc1cSmrgdnl first found in the path. Checks that the version of pkg-config found
7713e6bc1cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7813e6bc1cSmrgdnl used since that's the first version where most current features of
7913e6bc1cSmrgdnl pkg-config existed.
8013e6bc1cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8113e6bc1cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8213e6bc1cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8313e6bc1cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8413e6bc1cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8513e6bc1cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8613e6bc1cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
877d5e3a19Smrg
8813e6bc1cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8913e6bc1cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9013e6bc1cSmrgfi
9113e6bc1cSmrgif test -n "$PKG_CONFIG"; then
9213e6bc1cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
9313e6bc1cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9413e6bc1cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9513e6bc1cSmrg		AC_MSG_RESULT([yes])
9613e6bc1cSmrg	else
9713e6bc1cSmrg		AC_MSG_RESULT([no])
9813e6bc1cSmrg		PKG_CONFIG=""
9913e6bc1cSmrg	fi
10013e6bc1cSmrgfi[]dnl
10113e6bc1cSmrg])dnl PKG_PROG_PKG_CONFIG
1027d5e3a19Smrg
10313e6bc1cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10413e6bc1cSmrgdnl -------------------------------------------------------------------
10513e6bc1cSmrgdnl Since: 0.18
10613e6bc1cSmrgdnl
10713e6bc1cSmrgdnl Check to see whether a particular set of modules exists. Similar to
10813e6bc1cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10913e6bc1cSmrgdnl
11013e6bc1cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11113e6bc1cSmrgdnl only at the first occurence in configure.ac, so if the first place
11213e6bc1cSmrgdnl it's called might be skipped (such as if it is within an "if", you
11313e6bc1cSmrgdnl have to call PKG_CHECK_EXISTS manually
11413e6bc1cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
11513e6bc1cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11613e6bc1cSmrgif test -n "$PKG_CONFIG" && \
11713e6bc1cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11813e6bc1cSmrg  m4_default([$2], [:])
11913e6bc1cSmrgm4_ifvaln([$3], [else
12013e6bc1cSmrg  $3])dnl
12113e6bc1cSmrgfi])
1227d5e3a19Smrg
12313e6bc1cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12413e6bc1cSmrgdnl ---------------------------------------------
12513e6bc1cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12613e6bc1cSmrgdnl pkg_failed based on the result.
12713e6bc1cSmrgm4_define([_PKG_CONFIG],
12813e6bc1cSmrg[if test -n "$$1"; then
12913e6bc1cSmrg    pkg_cv_[]$1="$$1"
13013e6bc1cSmrg elif test -n "$PKG_CONFIG"; then
13113e6bc1cSmrg    PKG_CHECK_EXISTS([$3],
13213e6bc1cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13313e6bc1cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
13413e6bc1cSmrg		     [pkg_failed=yes])
13513e6bc1cSmrg else
13613e6bc1cSmrg    pkg_failed=untried
13713e6bc1cSmrgfi[]dnl
13813e6bc1cSmrg])dnl _PKG_CONFIG
1397d5e3a19Smrg
14013e6bc1cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14113e6bc1cSmrgdnl ---------------------------
14213e6bc1cSmrgdnl Internal check to see if pkg-config supports short errors.
14313e6bc1cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14413e6bc1cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14513e6bc1cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14613e6bc1cSmrg        _pkg_short_errors_supported=yes
14713e6bc1cSmrgelse
14813e6bc1cSmrg        _pkg_short_errors_supported=no
14913e6bc1cSmrgfi[]dnl
15013e6bc1cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1517d5e3a19Smrg
1527d5e3a19Smrg
15313e6bc1cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15413e6bc1cSmrgdnl   [ACTION-IF-NOT-FOUND])
15513e6bc1cSmrgdnl --------------------------------------------------------------
15613e6bc1cSmrgdnl Since: 0.4.0
15713e6bc1cSmrgdnl
15813e6bc1cSmrgdnl Note that if there is a possibility the first call to
15913e6bc1cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16013e6bc1cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16113e6bc1cSmrgAC_DEFUN([PKG_CHECK_MODULES],
16213e6bc1cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16313e6bc1cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16413e6bc1cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1657d5e3a19Smrg
16613e6bc1cSmrgpkg_failed=no
16713e6bc1cSmrgAC_MSG_CHECKING([for $1])
1687d5e3a19Smrg
16913e6bc1cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17013e6bc1cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1717d5e3a19Smrg
17213e6bc1cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17313e6bc1cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
17413e6bc1cSmrgSee the pkg-config man page for more details.])
1757d5e3a19Smrg
17613e6bc1cSmrgif test $pkg_failed = yes; then
17713e6bc1cSmrg   	AC_MSG_RESULT([no])
17813e6bc1cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
17913e6bc1cSmrg        if test $_pkg_short_errors_supported = yes; then
18013e6bc1cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18113e6bc1cSmrg        else 
18213e6bc1cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18313e6bc1cSmrg        fi
18413e6bc1cSmrg	# Put the nasty error message in config.log where it belongs
18513e6bc1cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1867d5e3a19Smrg
18713e6bc1cSmrg	m4_default([$4], [AC_MSG_ERROR(
18813e6bc1cSmrg[Package requirements ($2) were not met:
1897d5e3a19Smrg
19013e6bc1cSmrg$$1_PKG_ERRORS
1917d5e3a19Smrg
19213e6bc1cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19313e6bc1cSmrginstalled software in a non-standard prefix.
1947d5e3a19Smrg
19513e6bc1cSmrg_PKG_TEXT])[]dnl
19613e6bc1cSmrg        ])
19713e6bc1cSmrgelif test $pkg_failed = untried; then
19813e6bc1cSmrg     	AC_MSG_RESULT([no])
19913e6bc1cSmrg	m4_default([$4], [AC_MSG_FAILURE(
20013e6bc1cSmrg[The pkg-config script could not be found or is too old.  Make sure it
20113e6bc1cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
20213e6bc1cSmrgpath to pkg-config.
2037d5e3a19Smrg
20413e6bc1cSmrg_PKG_TEXT
2057d5e3a19Smrg
20613e6bc1cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20713e6bc1cSmrg        ])
20813e6bc1cSmrgelse
20913e6bc1cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21013e6bc1cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21113e6bc1cSmrg        AC_MSG_RESULT([yes])
21213e6bc1cSmrg	$3
21313e6bc1cSmrgfi[]dnl
21413e6bc1cSmrg])dnl PKG_CHECK_MODULES
2157d5e3a19Smrg
2167d5e3a19Smrg
21713e6bc1cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21813e6bc1cSmrgdnl   [ACTION-IF-NOT-FOUND])
21913e6bc1cSmrgdnl ---------------------------------------------------------------------
22013e6bc1cSmrgdnl Since: 0.29
22113e6bc1cSmrgdnl
22213e6bc1cSmrgdnl Checks for existence of MODULES and gathers its build flags with
22313e6bc1cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22413e6bc1cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22513e6bc1cSmrgdnl
22613e6bc1cSmrgdnl Note that if there is a possibility the first call to
22713e6bc1cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22813e6bc1cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22913e6bc1cSmrgdnl configure.ac.
23013e6bc1cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23113e6bc1cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23213e6bc1cSmrg_save_PKG_CONFIG=$PKG_CONFIG
23313e6bc1cSmrgPKG_CONFIG="$PKG_CONFIG --static"
23413e6bc1cSmrgPKG_CHECK_MODULES($@)
23513e6bc1cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23613e6bc1cSmrg])dnl PKG_CHECK_MODULES_STATIC
2371568b75bSmrg
2387d5e3a19Smrg
23913e6bc1cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
24013e6bc1cSmrgdnl -------------------------
24113e6bc1cSmrgdnl Since: 0.27
24213e6bc1cSmrgdnl
24313e6bc1cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
24413e6bc1cSmrgdnl should install pkg-config .pc files. By default the directory is
24513e6bc1cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
24613e6bc1cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24713e6bc1cSmrgdnl parameter.
24813e6bc1cSmrgAC_DEFUN([PKG_INSTALLDIR],
24913e6bc1cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25013e6bc1cSmrgm4_pushdef([pkg_description],
25113e6bc1cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25213e6bc1cSmrgAC_ARG_WITH([pkgconfigdir],
25313e6bc1cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25413e6bc1cSmrg    [with_pkgconfigdir=]pkg_default)
25513e6bc1cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25613e6bc1cSmrgm4_popdef([pkg_default])
25713e6bc1cSmrgm4_popdef([pkg_description])
25813e6bc1cSmrg])dnl PKG_INSTALLDIR
25913e6bc1cSmrg
26013e6bc1cSmrg
26113e6bc1cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26213e6bc1cSmrgdnl --------------------------------
26313e6bc1cSmrgdnl Since: 0.27
26413e6bc1cSmrgdnl
26513e6bc1cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26613e6bc1cSmrgdnl module should install arch-independent pkg-config .pc files. By
26713e6bc1cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
26813e6bc1cSmrgdnl changed by passing DIRECTORY. The user can override through the
26913e6bc1cSmrgdnl --with-noarch-pkgconfigdir parameter.
27013e6bc1cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27113e6bc1cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27213e6bc1cSmrgm4_pushdef([pkg_description],
27313e6bc1cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27413e6bc1cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
27513e6bc1cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27613e6bc1cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
27713e6bc1cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27813e6bc1cSmrgm4_popdef([pkg_default])
27913e6bc1cSmrgm4_popdef([pkg_description])
28013e6bc1cSmrg])dnl PKG_NOARCH_INSTALLDIR
28113e6bc1cSmrg
28213e6bc1cSmrg
28313e6bc1cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28413e6bc1cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28513e6bc1cSmrgdnl -------------------------------------------
28613e6bc1cSmrgdnl Since: 0.28
28713e6bc1cSmrgdnl
28813e6bc1cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
28913e6bc1cSmrgAC_DEFUN([PKG_CHECK_VAR],
29013e6bc1cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29113e6bc1cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2927d5e3a19Smrg
29313e6bc1cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29413e6bc1cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29513e6bc1cSmrg
29613e6bc1cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29713e6bc1cSmrg])dnl PKG_CHECK_VAR
29813e6bc1cSmrg
29913e6bc1cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
30013e6bc1cSmrgdnl
30113e6bc1cSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
30213e6bc1cSmrgdnl
30313e6bc1cSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
30413e6bc1cSmrgdnl copy of this software and associated documentation files (the "Software"),
30513e6bc1cSmrgdnl to deal in the Software without restriction, including without limitation
30613e6bc1cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
30713e6bc1cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
30813e6bc1cSmrgdnl Software is furnished to do so, subject to the following conditions:
30913e6bc1cSmrgdnl
31013e6bc1cSmrgdnl The above copyright notice and this permission notice (including the next
31113e6bc1cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
31213e6bc1cSmrgdnl Software.
31313e6bc1cSmrgdnl
31413e6bc1cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31513e6bc1cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31613e6bc1cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31713e6bc1cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31813e6bc1cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31913e6bc1cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32013e6bc1cSmrgdnl DEALINGS IN THE SOFTWARE.
32113e6bc1cSmrg
32213e6bc1cSmrg# XORG_MACROS_VERSION(required-version)
32313e6bc1cSmrg# -------------------------------------
32413e6bc1cSmrg# Minimum version: 1.1.0
32513e6bc1cSmrg#
32613e6bc1cSmrg# If you're using a macro added in Version 1.1 or newer, include this in
32713e6bc1cSmrg# your configure.ac with the minimum required version, such as:
32813e6bc1cSmrg# XORG_MACROS_VERSION(1.1)
32913e6bc1cSmrg#
33013e6bc1cSmrg# To ensure that this macro is defined, also add:
33113e6bc1cSmrg# m4_ifndef([XORG_MACROS_VERSION],
33213e6bc1cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
33313e6bc1cSmrg#
33413e6bc1cSmrg#
33513e6bc1cSmrg# See the "minimum version" comment for each macro you use to see what
33613e6bc1cSmrg# version you require.
33713e6bc1cSmrgm4_defun([XORG_MACROS_VERSION],[
33813e6bc1cSmrgm4_define([vers_have], [1.19.0])
33913e6bc1cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
34013e6bc1cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
34113e6bc1cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
34213e6bc1cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
34313e6bc1cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
34413e6bc1cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
34513e6bc1cSmrgm4_undefine([vers_have])
34613e6bc1cSmrgm4_undefine([maj_have])
34713e6bc1cSmrgm4_undefine([maj_needed])
34813e6bc1cSmrg]) # XORG_MACROS_VERSION
34913e6bc1cSmrg
35013e6bc1cSmrg# XORG_PROG_RAWCPP()
35113e6bc1cSmrg# ------------------
35213e6bc1cSmrg# Minimum version: 1.0.0
35313e6bc1cSmrg#
35413e6bc1cSmrg# Find cpp program and necessary flags for use in pre-processing text files
35513e6bc1cSmrg# such as man pages and config files
35613e6bc1cSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
35713e6bc1cSmrgAC_REQUIRE([AC_PROG_CPP])
35813e6bc1cSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
35913e6bc1cSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
36013e6bc1cSmrg
36113e6bc1cSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
36213e6bc1cSmrg# which is not the best choice for supporting other OS'es, but covers most
36313e6bc1cSmrg# of the ones we need for now.
36413e6bc1cSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
36513e6bc1cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
36613e6bc1cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
36713e6bc1cSmrg	AC_MSG_RESULT([no])
3687d5e3a19Smrgelse
36913e6bc1cSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37013e6bc1cSmrg		RAWCPPFLAGS=-undef
37113e6bc1cSmrg		AC_MSG_RESULT([yes])
37213e6bc1cSmrg	# under Cygwin unix is still defined even with -undef
37313e6bc1cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37413e6bc1cSmrg		RAWCPPFLAGS="-undef -ansi"
37513e6bc1cSmrg		AC_MSG_RESULT([yes, with -ansi])
37613e6bc1cSmrg	else
37713e6bc1cSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
37813e6bc1cSmrg	fi
3797d5e3a19Smrgfi
38013e6bc1cSmrgrm -f conftest.$ac_ext
3817d5e3a19Smrg
38213e6bc1cSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
38313e6bc1cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
38413e6bc1cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38513e6bc1cSmrg	AC_MSG_RESULT([no])
38613e6bc1cSmrgelse
38713e6bc1cSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38813e6bc1cSmrg		TRADITIONALCPPFLAGS="-traditional"
38913e6bc1cSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
39013e6bc1cSmrg		AC_MSG_RESULT([yes])
39113e6bc1cSmrg	else
39213e6bc1cSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
39313e6bc1cSmrg	fi
39413e6bc1cSmrgfi
39513e6bc1cSmrgrm -f conftest.$ac_ext
39613e6bc1cSmrgAC_SUBST(RAWCPPFLAGS)
39713e6bc1cSmrgAC_SUBST(TRADITIONALCPPFLAGS)
39813e6bc1cSmrg]) # XORG_PROG_RAWCPP
3997d5e3a19Smrg
40013e6bc1cSmrg# XORG_MANPAGE_SECTIONS()
40113e6bc1cSmrg# -----------------------
40213e6bc1cSmrg# Minimum version: 1.0.0
40313e6bc1cSmrg#
40413e6bc1cSmrg# Determine which sections man pages go in for the different man page types
40513e6bc1cSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
40613e6bc1cSmrg# Not sure if there's any better way than just hardcoding by OS name.
40713e6bc1cSmrg# Override default settings by setting environment variables
40813e6bc1cSmrg# Added MAN_SUBSTS in version 1.8
40913e6bc1cSmrg# Added AC_PROG_SED in version 1.8
4107d5e3a19Smrg
41113e6bc1cSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
41213e6bc1cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
41313e6bc1cSmrgAC_REQUIRE([AC_PROG_SED])
4147d5e3a19Smrg
41513e6bc1cSmrgif test x$APP_MAN_SUFFIX = x    ; then
41613e6bc1cSmrg    APP_MAN_SUFFIX=1
41713e6bc1cSmrgfi
41813e6bc1cSmrgif test x$APP_MAN_DIR = x    ; then
41913e6bc1cSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4207d5e3a19Smrgfi
4217d5e3a19Smrg
42213e6bc1cSmrgif test x$LIB_MAN_SUFFIX = x    ; then
42313e6bc1cSmrg    LIB_MAN_SUFFIX=3
42413e6bc1cSmrgfi
42513e6bc1cSmrgif test x$LIB_MAN_DIR = x    ; then
42613e6bc1cSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
42713e6bc1cSmrgfi
4287d5e3a19Smrg
42913e6bc1cSmrgif test x$FILE_MAN_SUFFIX = x    ; then
43013e6bc1cSmrg    case $host_os in
43113e6bc1cSmrg	# Solaris 2.0 - 11 use SysV man page sections
43213e6bc1cSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
43313e6bc1cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
43413e6bc1cSmrg    esac
43513e6bc1cSmrgfi
43613e6bc1cSmrgif test x$FILE_MAN_DIR = x    ; then
43713e6bc1cSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
43813e6bc1cSmrgfi
4397d5e3a19Smrg
44013e6bc1cSmrgif test x$MISC_MAN_SUFFIX = x    ; then
44113e6bc1cSmrg    case $host_os in
44213e6bc1cSmrg	# Solaris 2.0 - 11 use SysV man page sections
44313e6bc1cSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
44413e6bc1cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
44513e6bc1cSmrg    esac
44613e6bc1cSmrgfi
44713e6bc1cSmrgif test x$MISC_MAN_DIR = x    ; then
44813e6bc1cSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
44913e6bc1cSmrgfi
4507d5e3a19Smrg
45113e6bc1cSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
45213e6bc1cSmrg    case $host_os in
45313e6bc1cSmrg	# Solaris 2.0 - 11 use SysV man page sections
45413e6bc1cSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
45513e6bc1cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
45613e6bc1cSmrg    esac
45713e6bc1cSmrgfi
45813e6bc1cSmrgif test x$DRIVER_MAN_DIR = x    ; then
45913e6bc1cSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
46013e6bc1cSmrgfi
46113e6bc1cSmrg
46213e6bc1cSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
46313e6bc1cSmrg    case $host_os in
46413e6bc1cSmrg	# Solaris 2.0 - 11 use SysV man page sections
46513e6bc1cSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
46613e6bc1cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
46713e6bc1cSmrg    esac
46813e6bc1cSmrgfi
46913e6bc1cSmrgif test x$ADMIN_MAN_DIR = x    ; then
47013e6bc1cSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
47113e6bc1cSmrgfi
4727d5e3a19Smrg
4737d5e3a19Smrg
47413e6bc1cSmrgAC_SUBST([APP_MAN_SUFFIX])
47513e6bc1cSmrgAC_SUBST([LIB_MAN_SUFFIX])
47613e6bc1cSmrgAC_SUBST([FILE_MAN_SUFFIX])
47713e6bc1cSmrgAC_SUBST([MISC_MAN_SUFFIX])
47813e6bc1cSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
47913e6bc1cSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
48013e6bc1cSmrgAC_SUBST([APP_MAN_DIR])
48113e6bc1cSmrgAC_SUBST([LIB_MAN_DIR])
48213e6bc1cSmrgAC_SUBST([FILE_MAN_DIR])
48313e6bc1cSmrgAC_SUBST([MISC_MAN_DIR])
48413e6bc1cSmrgAC_SUBST([DRIVER_MAN_DIR])
48513e6bc1cSmrgAC_SUBST([ADMIN_MAN_DIR])
48613e6bc1cSmrg
48713e6bc1cSmrgXORG_MAN_PAGE="X Version 11"
48813e6bc1cSmrgAC_SUBST([XORG_MAN_PAGE])
48913e6bc1cSmrgMAN_SUBSTS="\
49013e6bc1cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49113e6bc1cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49213e6bc1cSmrg	-e 's|__xservername__|Xorg|g' \
49313e6bc1cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
49413e6bc1cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
49513e6bc1cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
49613e6bc1cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
49713e6bc1cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
49813e6bc1cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
49913e6bc1cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
50013e6bc1cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
50113e6bc1cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
50213e6bc1cSmrgAC_SUBST([MAN_SUBSTS])
50313e6bc1cSmrg
50413e6bc1cSmrg]) # XORG_MANPAGE_SECTIONS
50513e6bc1cSmrg
50613e6bc1cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
50713e6bc1cSmrg# ------------------------
50813e6bc1cSmrg# Minimum version: 1.7.0
5097d5e3a19Smrg#
51013e6bc1cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
51113e6bc1cSmrg# provided by xorg-sgml-doctools, if installed.
51213e6bc1cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
51313e6bc1cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
51413e6bc1cSmrgXORG_SGML_PATH=
51513e6bc1cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
51613e6bc1cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
51713e6bc1cSmrg    [m4_ifval([$1],[:],
51813e6bc1cSmrg        [if test x"$cross_compiling" != x"yes" ; then
51913e6bc1cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
52013e6bc1cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
52113e6bc1cSmrg         fi])
52213e6bc1cSmrg    ])
5237d5e3a19Smrg
52413e6bc1cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
52513e6bc1cSmrg# the path and the name of the doc stylesheet
52613e6bc1cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
52713e6bc1cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
52813e6bc1cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
52913e6bc1cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
53013e6bc1cSmrgelse
53113e6bc1cSmrg   AC_MSG_RESULT([no])
53213e6bc1cSmrgfi
5337d5e3a19Smrg
53413e6bc1cSmrgAC_SUBST(XORG_SGML_PATH)
53513e6bc1cSmrgAC_SUBST(STYLESHEET_SRCDIR)
53613e6bc1cSmrgAC_SUBST(XSL_STYLESHEET)
53713e6bc1cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
53813e6bc1cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
53913e6bc1cSmrg
54013e6bc1cSmrg# XORG_CHECK_LINUXDOC
54113e6bc1cSmrg# -------------------
54213e6bc1cSmrg# Minimum version: 1.0.0
5437d5e3a19Smrg#
54413e6bc1cSmrg# Defines the variable MAKE_TEXT if the necessary tools and
54513e6bc1cSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
54613e6bc1cSmrg# Whether or not the necessary tools and files are found can be checked
54713e6bc1cSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
54813e6bc1cSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
54913e6bc1cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
55013e6bc1cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5517d5e3a19Smrg
55213e6bc1cSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5537d5e3a19Smrg
55413e6bc1cSmrgAC_MSG_CHECKING([whether to build documentation])
555b8414663Smrg
55613e6bc1cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
55713e6bc1cSmrg   BUILDDOC=yes
55813e6bc1cSmrgelse
55913e6bc1cSmrg   BUILDDOC=no
5607d5e3a19Smrgfi
5617d5e3a19Smrg
56213e6bc1cSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
56313e6bc1cSmrg
56413e6bc1cSmrgAC_MSG_RESULT([$BUILDDOC])
56513e6bc1cSmrg
56613e6bc1cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
56713e6bc1cSmrg
56813e6bc1cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
56913e6bc1cSmrg   BUILDPDFDOC=yes
57013e6bc1cSmrgelse
57113e6bc1cSmrg   BUILDPDFDOC=no
5727d5e3a19Smrgfi
5737d5e3a19Smrg
57413e6bc1cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5757d5e3a19Smrg
57613e6bc1cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5777d5e3a19Smrg
57813e6bc1cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
57913e6bc1cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
58013e6bc1cSmrgMAKE_PDF="$PS2PDF"
58113e6bc1cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582b8414663Smrg
58313e6bc1cSmrgAC_SUBST(MAKE_TEXT)
58413e6bc1cSmrgAC_SUBST(MAKE_PS)
58513e6bc1cSmrgAC_SUBST(MAKE_PDF)
58613e6bc1cSmrgAC_SUBST(MAKE_HTML)
58713e6bc1cSmrg]) # XORG_CHECK_LINUXDOC
588b8414663Smrg
58913e6bc1cSmrg# XORG_CHECK_DOCBOOK
59013e6bc1cSmrg# -------------------
59113e6bc1cSmrg# Minimum version: 1.0.0
59213e6bc1cSmrg#
59313e6bc1cSmrg# Checks for the ability to build output formats from SGML DocBook source.
59413e6bc1cSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
59513e6bc1cSmrg# indicates whether the necessary tools and files are found and, if set,
59613e6bc1cSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
59713e6bc1cSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
59813e6bc1cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599b8414663Smrg
60013e6bc1cSmrgBUILDTXTDOC=no
60113e6bc1cSmrgBUILDPDFDOC=no
60213e6bc1cSmrgBUILDPSDOC=no
60313e6bc1cSmrgBUILDHTMLDOC=no
604b8414663Smrg
60513e6bc1cSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
60613e6bc1cSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
60713e6bc1cSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
60813e6bc1cSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609b8414663Smrg
61013e6bc1cSmrgAC_MSG_CHECKING([whether to build text documentation])
61113e6bc1cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
61213e6bc1cSmrg   test x$BUILD_TXTDOC != xno; then
61313e6bc1cSmrg	BUILDTXTDOC=yes
61413e6bc1cSmrgfi
61513e6bc1cSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
61613e6bc1cSmrgAC_MSG_RESULT([$BUILDTXTDOC])
617b8414663Smrg
61813e6bc1cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
61913e6bc1cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
62013e6bc1cSmrg   test x$BUILD_PDFDOC != xno; then
62113e6bc1cSmrg	BUILDPDFDOC=yes
62213e6bc1cSmrgfi
62313e6bc1cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
62413e6bc1cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
625b8414663Smrg
62613e6bc1cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
62713e6bc1cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
62813e6bc1cSmrg   test x$BUILD_PSDOC != xno; then
62913e6bc1cSmrg	BUILDPSDOC=yes
630b8414663Smrgfi
63113e6bc1cSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
63213e6bc1cSmrgAC_MSG_RESULT([$BUILDPSDOC])
6337d5e3a19Smrg
63413e6bc1cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
63513e6bc1cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
63613e6bc1cSmrg   test x$BUILD_HTMLDOC != xno; then
63713e6bc1cSmrg	BUILDHTMLDOC=yes
63813e6bc1cSmrgfi
63913e6bc1cSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
64013e6bc1cSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6411568b75bSmrg
64213e6bc1cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
64313e6bc1cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
64413e6bc1cSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
64513e6bc1cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6467d5e3a19Smrg
64713e6bc1cSmrgAC_SUBST(MAKE_TEXT)
64813e6bc1cSmrgAC_SUBST(MAKE_PS)
64913e6bc1cSmrgAC_SUBST(MAKE_PDF)
65013e6bc1cSmrgAC_SUBST(MAKE_HTML)
65113e6bc1cSmrg]) # XORG_CHECK_DOCBOOK
6527d5e3a19Smrg
65313e6bc1cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
65413e6bc1cSmrg# ----------------
65513e6bc1cSmrg# Minimum version: 1.5.0
65613e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
6577d5e3a19Smrg#
65813e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
65913e6bc1cSmrg# not at the appropriate level. This macro enables a module to test for the
66013e6bc1cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
66113e6bc1cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
66213e6bc1cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
66313e6bc1cSmrg# --with-xmlto assumes 'auto'.
6647d5e3a19Smrg#
66513e6bc1cSmrg# Interface to module:
66613e6bc1cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
66713e6bc1cSmrg# XMLTO:	returns the path of the xmlto program found
66813e6bc1cSmrg#		returns the path set by the user in the environment
66913e6bc1cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
67013e6bc1cSmrg#		'no' user instructs the module not to use xmlto
67113e6bc1cSmrg#
67213e6bc1cSmrg# Added in version 1.10.0
67313e6bc1cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
67413e6bc1cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
67513e6bc1cSmrg#
67613e6bc1cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
67713e6bc1cSmrg#
67813e6bc1cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
67913e6bc1cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
68013e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
68113e6bc1cSmrgAC_ARG_WITH(xmlto,
68213e6bc1cSmrg	AS_HELP_STRING([--with-xmlto],
68313e6bc1cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
68413e6bc1cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
68513e6bc1cSmrgm4_undefine([_defopt])
6867d5e3a19Smrg
68713e6bc1cSmrgif test "x$use_xmlto" = x"auto"; then
68813e6bc1cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
68913e6bc1cSmrg   if test "x$XMLTO" = "x"; then
69013e6bc1cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
69113e6bc1cSmrg	have_xmlto=no
69213e6bc1cSmrg   else
69313e6bc1cSmrg        have_xmlto=yes
69413e6bc1cSmrg   fi
69513e6bc1cSmrgelif test "x$use_xmlto" = x"yes" ; then
69613e6bc1cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
69713e6bc1cSmrg   if test "x$XMLTO" = "x"; then
69813e6bc1cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
69913e6bc1cSmrg   fi
70013e6bc1cSmrg   have_xmlto=yes
70113e6bc1cSmrgelif test "x$use_xmlto" = x"no" ; then
70213e6bc1cSmrg   if test "x$XMLTO" != "x"; then
70313e6bc1cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
70413e6bc1cSmrg   fi
70513e6bc1cSmrg   have_xmlto=no
7067d5e3a19Smrgelse
70713e6bc1cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7087d5e3a19Smrgfi
7097d5e3a19Smrg
71013e6bc1cSmrg# Test for a minimum version of xmlto, if provided.
71113e6bc1cSmrgm4_ifval([$1],
71213e6bc1cSmrg[if test "$have_xmlto" = yes; then
71313e6bc1cSmrg    # scrape the xmlto version
71413e6bc1cSmrg    AC_MSG_CHECKING([the xmlto version])
71513e6bc1cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
71613e6bc1cSmrg    AC_MSG_RESULT([$xmlto_version])
71713e6bc1cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
71813e6bc1cSmrg        [if test "x$use_xmlto" = xauto; then
71913e6bc1cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
72013e6bc1cSmrg            have_xmlto=no
72113e6bc1cSmrg        else
72213e6bc1cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
72313e6bc1cSmrg        fi])
72413e6bc1cSmrgfi])
7257d5e3a19Smrg
72613e6bc1cSmrg# Test for the ability of xmlto to generate a text target
7277d5e3a19Smrg#
72813e6bc1cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
72913e6bc1cSmrg# following test for empty XML docbook files.
73013e6bc1cSmrg# For compatibility reasons use the following empty XML docbook file and if
73113e6bc1cSmrg# it fails try it again with a non-empty XML file.
73213e6bc1cSmrghave_xmlto_text=no
73313e6bc1cSmrgcat > conftest.xml << "EOF"
73413e6bc1cSmrgEOF
73513e6bc1cSmrgAS_IF([test "$have_xmlto" = yes],
73613e6bc1cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73713e6bc1cSmrg             [have_xmlto_text=yes],
73813e6bc1cSmrg             [# Try it again with a non-empty XML file.
73913e6bc1cSmrg              cat > conftest.xml << "EOF"
74013e6bc1cSmrg<x></x>
74113e6bc1cSmrgEOF
74213e6bc1cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
74313e6bc1cSmrg                    [have_xmlto_text=yes],
74413e6bc1cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
74513e6bc1cSmrgrm -f conftest.xml
74613e6bc1cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
74713e6bc1cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
74813e6bc1cSmrg]) # XORG_WITH_XMLTO
7497d5e3a19Smrg
75013e6bc1cSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
75113e6bc1cSmrg# --------------------------------------------
75213e6bc1cSmrg# Minimum version: 1.12.0
75313e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.12.0
7547d5e3a19Smrg#
75513e6bc1cSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
75613e6bc1cSmrg# XML-based language used for the transformation of XML documents.
75713e6bc1cSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
75813e6bc1cSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
75913e6bc1cSmrg# The XSLT processor is often used as a standalone tool for transformations.
76013e6bc1cSmrg# It should not be assumed that this tool is used only to work with documnetation.
76113e6bc1cSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
76213e6bc1cSmrg#
76313e6bc1cSmrg# Interface to module:
76413e6bc1cSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
76513e6bc1cSmrg# XSLTPROC:	 returns the path of the xsltproc program found
76613e6bc1cSmrg#		 returns the path set by the user in the environment
76713e6bc1cSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
76813e6bc1cSmrg#		  'no' user instructs the module not to use xsltproc
76913e6bc1cSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
77013e6bc1cSmrg#
77113e6bc1cSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
77213e6bc1cSmrg#
77313e6bc1cSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
77413e6bc1cSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
77513e6bc1cSmrg# Preserves the interface, should it be implemented later
77613e6bc1cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
77713e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
77813e6bc1cSmrgAC_ARG_WITH(xsltproc,
77913e6bc1cSmrg	AS_HELP_STRING([--with-xsltproc],
78013e6bc1cSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
78113e6bc1cSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
78213e6bc1cSmrgm4_undefine([_defopt])
7837d5e3a19Smrg
78413e6bc1cSmrgif test "x$use_xsltproc" = x"auto"; then
78513e6bc1cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
78613e6bc1cSmrg   if test "x$XSLTPROC" = "x"; then
78713e6bc1cSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
78813e6bc1cSmrg	have_xsltproc=no
78913e6bc1cSmrg   else
79013e6bc1cSmrg        have_xsltproc=yes
79113e6bc1cSmrg   fi
79213e6bc1cSmrgelif test "x$use_xsltproc" = x"yes" ; then
79313e6bc1cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
79413e6bc1cSmrg   if test "x$XSLTPROC" = "x"; then
79513e6bc1cSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
79613e6bc1cSmrg   fi
79713e6bc1cSmrg   have_xsltproc=yes
79813e6bc1cSmrgelif test "x$use_xsltproc" = x"no" ; then
79913e6bc1cSmrg   if test "x$XSLTPROC" != "x"; then
80013e6bc1cSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
80113e6bc1cSmrg   fi
80213e6bc1cSmrg   have_xsltproc=no
8037d5e3a19Smrgelse
80413e6bc1cSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8057d5e3a19Smrgfi
8067d5e3a19Smrg
80713e6bc1cSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
80813e6bc1cSmrg]) # XORG_WITH_XSLTPROC
8097d5e3a19Smrg
81013e6bc1cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
81113e6bc1cSmrg# ----------------------------------------
81213e6bc1cSmrg# Minimum version: 1.15.0
8137d5e3a19Smrg#
81413e6bc1cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
81513e6bc1cSmrg# scanning arbitrary text files, extracting information from those text files,
81613e6bc1cSmrg# and printing reports based on that information.
81713e6bc1cSmrg#
81813e6bc1cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
81913e6bc1cSmrg#
82013e6bc1cSmrg# Interface to module:
82113e6bc1cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
82213e6bc1cSmrg# PERL:	     returns the path of the perl program found
82313e6bc1cSmrg#	     returns the path set by the user in the environment
82413e6bc1cSmrg# --with-perl: 'yes' user instructs the module to use perl
82513e6bc1cSmrg#	       'no' user instructs the module not to use perl
82613e6bc1cSmrg# have_perl: returns yes if perl found in PATH or no
82713e6bc1cSmrg#
82813e6bc1cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
82913e6bc1cSmrg#
83013e6bc1cSmrgAC_DEFUN([XORG_WITH_PERL],[
83113e6bc1cSmrgAC_ARG_VAR([PERL], [Path to perl command])
83213e6bc1cSmrg# Preserves the interface, should it be implemented later
83313e6bc1cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
83413e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
83513e6bc1cSmrgAC_ARG_WITH(perl,
83613e6bc1cSmrg	AS_HELP_STRING([--with-perl],
83713e6bc1cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
83813e6bc1cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
83913e6bc1cSmrgm4_undefine([_defopt])
8407d5e3a19Smrg
84113e6bc1cSmrgif test "x$use_perl" = x"auto"; then
84213e6bc1cSmrg   AC_PATH_PROG([PERL], [perl])
84313e6bc1cSmrg   if test "x$PERL" = "x"; then
84413e6bc1cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
84513e6bc1cSmrg	have_perl=no
84613e6bc1cSmrg   else
84713e6bc1cSmrg        have_perl=yes
84813e6bc1cSmrg   fi
84913e6bc1cSmrgelif test "x$use_perl" = x"yes" ; then
85013e6bc1cSmrg   AC_PATH_PROG([PERL], [perl])
85113e6bc1cSmrg   if test "x$PERL" = "x"; then
85213e6bc1cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
85313e6bc1cSmrg   fi
85413e6bc1cSmrg   have_perl=yes
85513e6bc1cSmrgelif test "x$use_perl" = x"no" ; then
85613e6bc1cSmrg   if test "x$PERL" != "x"; then
85713e6bc1cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
85813e6bc1cSmrg   fi
85913e6bc1cSmrg   have_perl=no
86013e6bc1cSmrgelse
86113e6bc1cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
86213e6bc1cSmrgfi
8637d5e3a19Smrg
86413e6bc1cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
86513e6bc1cSmrg]) # XORG_WITH_PERL
8667d5e3a19Smrg
86713e6bc1cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
86813e6bc1cSmrg# ----------------
86913e6bc1cSmrg# Minimum version: 1.5.0
87013e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
871b8414663Smrg#
87213e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
87313e6bc1cSmrg# not at the appropriate level. This macro enables a module to test for the
87413e6bc1cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
87513e6bc1cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
87613e6bc1cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
87713e6bc1cSmrg# --with-asciidoc assumes 'auto'.
87813e6bc1cSmrg#
87913e6bc1cSmrg# Interface to module:
88013e6bc1cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
88113e6bc1cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
88213e6bc1cSmrg#		 returns the path set by the user in the environment
88313e6bc1cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
88413e6bc1cSmrg#		  'no' user instructs the module not to use asciidoc
88513e6bc1cSmrg#
88613e6bc1cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
88713e6bc1cSmrg#
88813e6bc1cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
88913e6bc1cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
89013e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
89113e6bc1cSmrgAC_ARG_WITH(asciidoc,
89213e6bc1cSmrg	AS_HELP_STRING([--with-asciidoc],
89313e6bc1cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
89413e6bc1cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
89513e6bc1cSmrgm4_undefine([_defopt])
8967d5e3a19Smrg
89713e6bc1cSmrgif test "x$use_asciidoc" = x"auto"; then
89813e6bc1cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
89913e6bc1cSmrg   if test "x$ASCIIDOC" = "x"; then
90013e6bc1cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
90113e6bc1cSmrg	have_asciidoc=no
90213e6bc1cSmrg   else
90313e6bc1cSmrg        have_asciidoc=yes
90413e6bc1cSmrg   fi
90513e6bc1cSmrgelif test "x$use_asciidoc" = x"yes" ; then
90613e6bc1cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
90713e6bc1cSmrg   if test "x$ASCIIDOC" = "x"; then
90813e6bc1cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
90913e6bc1cSmrg   fi
91013e6bc1cSmrg   have_asciidoc=yes
91113e6bc1cSmrgelif test "x$use_asciidoc" = x"no" ; then
91213e6bc1cSmrg   if test "x$ASCIIDOC" != "x"; then
91313e6bc1cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
91413e6bc1cSmrg   fi
91513e6bc1cSmrg   have_asciidoc=no
91613e6bc1cSmrgelse
91713e6bc1cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918b8414663Smrgfi
91913e6bc1cSmrgm4_ifval([$1],
92013e6bc1cSmrg[if test "$have_asciidoc" = yes; then
92113e6bc1cSmrg    # scrape the asciidoc version
92213e6bc1cSmrg    AC_MSG_CHECKING([the asciidoc version])
92313e6bc1cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
92413e6bc1cSmrg    AC_MSG_RESULT([$asciidoc_version])
92513e6bc1cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
92613e6bc1cSmrg        [if test "x$use_asciidoc" = xauto; then
92713e6bc1cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
92813e6bc1cSmrg            have_asciidoc=no
92913e6bc1cSmrg        else
93013e6bc1cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
93113e6bc1cSmrg        fi])
93213e6bc1cSmrgfi])
93313e6bc1cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
93413e6bc1cSmrg]) # XORG_WITH_ASCIIDOC
935b8414663Smrg
93613e6bc1cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
93713e6bc1cSmrg# -------------------------------------------
93813e6bc1cSmrg# Minimum version: 1.5.0
93913e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
94013e6bc1cSmrg# Minimum version for optional DOT checking: 1.18.0
9417d5e3a19Smrg#
94213e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
94313e6bc1cSmrg# not at the appropriate level. This macro enables a module to test for the
94413e6bc1cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
94513e6bc1cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
94613e6bc1cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
94713e6bc1cSmrg# --with-doxygen assumes 'auto'.
948b8414663Smrg#
94913e6bc1cSmrg# Interface to module:
95013e6bc1cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
95113e6bc1cSmrg# DOXYGEN:	 returns the path of the doxygen program found
95213e6bc1cSmrg#		 returns the path set by the user in the environment
95313e6bc1cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
95413e6bc1cSmrg#		  'no' user instructs the module not to use doxygen
95513e6bc1cSmrg#
95613e6bc1cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
95713e6bc1cSmrg#
95813e6bc1cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
95913e6bc1cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
96013e6bc1cSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
96113e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
96213e6bc1cSmrgAC_ARG_WITH(doxygen,
96313e6bc1cSmrg	AS_HELP_STRING([--with-doxygen],
96413e6bc1cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
96513e6bc1cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
96613e6bc1cSmrgm4_undefine([_defopt])
967b8414663Smrg
96813e6bc1cSmrgif test "x$use_doxygen" = x"auto"; then
96913e6bc1cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97013e6bc1cSmrg   if test "x$DOXYGEN" = "x"; then
97113e6bc1cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
97213e6bc1cSmrg	have_doxygen=no
97313e6bc1cSmrg   else
97413e6bc1cSmrg        have_doxygen=yes
97513e6bc1cSmrg   fi
97613e6bc1cSmrgelif test "x$use_doxygen" = x"yes" ; then
97713e6bc1cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97813e6bc1cSmrg   if test "x$DOXYGEN" = "x"; then
97913e6bc1cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
98013e6bc1cSmrg   fi
98113e6bc1cSmrg   have_doxygen=yes
98213e6bc1cSmrgelif test "x$use_doxygen" = x"no" ; then
98313e6bc1cSmrg   if test "x$DOXYGEN" != "x"; then
98413e6bc1cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
98513e6bc1cSmrg   fi
98613e6bc1cSmrg   have_doxygen=no
9877d5e3a19Smrgelse
98813e6bc1cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9897d5e3a19Smrgfi
99013e6bc1cSmrgm4_ifval([$1],
99113e6bc1cSmrg[if test "$have_doxygen" = yes; then
99213e6bc1cSmrg    # scrape the doxygen version
99313e6bc1cSmrg    AC_MSG_CHECKING([the doxygen version])
99413e6bc1cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
99513e6bc1cSmrg    AC_MSG_RESULT([$doxygen_version])
99613e6bc1cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
99713e6bc1cSmrg        [if test "x$use_doxygen" = xauto; then
99813e6bc1cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
99913e6bc1cSmrg            have_doxygen=no
100013e6bc1cSmrg        else
100113e6bc1cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
100213e6bc1cSmrg        fi])
100313e6bc1cSmrgfi])
100413e6bc1cSmrg
100513e6bc1cSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
100613e6bc1cSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
100713e6bc1cSmrgdnl 	HAVE_DOT = @HAVE_DOT@
100813e6bc1cSmrgHAVE_DOT=no
100913e6bc1cSmrgif test "x$have_doxygen" = "xyes"; then
101013e6bc1cSmrg  AC_PATH_PROG([DOT], [dot])
101113e6bc1cSmrg    if test "x$DOT" != "x"; then
101213e6bc1cSmrg      HAVE_DOT=yes
101313e6bc1cSmrg    fi
1014b8414663Smrgfi
10157d5e3a19Smrg
101613e6bc1cSmrgAC_SUBST([HAVE_DOT])
101713e6bc1cSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
101813e6bc1cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
101913e6bc1cSmrg]) # XORG_WITH_DOXYGEN
1020765486e8Smrg
102113e6bc1cSmrg# XORG_WITH_GROFF([DEFAULT])
102213e6bc1cSmrg# ----------------
102313e6bc1cSmrg# Minimum version: 1.6.0
102413e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10257d5e3a19Smrg#
102613e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
102713e6bc1cSmrg# not at the appropriate level. This macro enables a module to test for the
102813e6bc1cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
102913e6bc1cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
103013e6bc1cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
103113e6bc1cSmrg# --with-groff assumes 'auto'.
103213e6bc1cSmrg#
103313e6bc1cSmrg# Interface to module:
103413e6bc1cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
103513e6bc1cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
103613e6bc1cSmrg# HAVE_GROFF_MS: the -ms macros package
103713e6bc1cSmrg# GROFF:	 returns the path of the groff program found
103813e6bc1cSmrg#		 returns the path set by the user in the environment
103913e6bc1cSmrg# --with-groff:	 'yes' user instructs the module to use groff
104013e6bc1cSmrg#		 'no' user instructs the module not to use groff
104113e6bc1cSmrg#
104213e6bc1cSmrg# Added in version 1.9.0:
104313e6bc1cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
104413e6bc1cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
104513e6bc1cSmrg#		   psselect from the psutils package.
104613e6bc1cSmrg#		   the ghostcript package. Refer to the grohtml man pages
104713e6bc1cSmrg#
104813e6bc1cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
104913e6bc1cSmrg#
105013e6bc1cSmrg# OS and distros often splits groff in a basic and full package, the former
105113e6bc1cSmrg# having the groff program and the later having devices, fonts and macros
105213e6bc1cSmrg# Checking for the groff executable is not enough.
105313e6bc1cSmrg#
105413e6bc1cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
105513e6bc1cSmrg# unset HAVE_GROFF or GROFF env variables.
105613e6bc1cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
105713e6bc1cSmrg#
105813e6bc1cSmrgAC_DEFUN([XORG_WITH_GROFF],[
105913e6bc1cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
106013e6bc1cSmrgm4_define([_defopt], m4_default([$1], [auto]))
106113e6bc1cSmrgAC_ARG_WITH(groff,
106213e6bc1cSmrg	AS_HELP_STRING([--with-groff],
106313e6bc1cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
106413e6bc1cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
106513e6bc1cSmrgm4_undefine([_defopt])
10667d5e3a19Smrg
106713e6bc1cSmrgif test "x$use_groff" = x"auto"; then
106813e6bc1cSmrg   AC_PATH_PROG([GROFF], [groff])
106913e6bc1cSmrg   if test "x$GROFF" = "x"; then
107013e6bc1cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
107113e6bc1cSmrg	have_groff=no
107213e6bc1cSmrg   else
107313e6bc1cSmrg        have_groff=yes
107413e6bc1cSmrg   fi
107513e6bc1cSmrgelif test "x$use_groff" = x"yes" ; then
107613e6bc1cSmrg   AC_PATH_PROG([GROFF], [groff])
107713e6bc1cSmrg   if test "x$GROFF" = "x"; then
107813e6bc1cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
107913e6bc1cSmrg   fi
108013e6bc1cSmrg   have_groff=yes
108113e6bc1cSmrgelif test "x$use_groff" = x"no" ; then
108213e6bc1cSmrg   if test "x$GROFF" != "x"; then
108313e6bc1cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
108413e6bc1cSmrg   fi
108513e6bc1cSmrg   have_groff=no
108613e6bc1cSmrgelse
108713e6bc1cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10887d5e3a19Smrgfi
10897d5e3a19Smrg
109013e6bc1cSmrg# We have groff, test for the presence of the macro packages
109113e6bc1cSmrgif test "x$have_groff" = x"yes"; then
109213e6bc1cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
109313e6bc1cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
109413e6bc1cSmrg        groff_ms_works=yes
109513e6bc1cSmrg    else
109613e6bc1cSmrg        groff_ms_works=no
109713e6bc1cSmrg    fi
109813e6bc1cSmrg    AC_MSG_RESULT([$groff_ms_works])
109913e6bc1cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
110013e6bc1cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
110113e6bc1cSmrg        groff_mm_works=yes
110213e6bc1cSmrg    else
110313e6bc1cSmrg        groff_mm_works=no
110413e6bc1cSmrg    fi
110513e6bc1cSmrg    AC_MSG_RESULT([$groff_mm_works])
110613e6bc1cSmrgfi
11077d5e3a19Smrg
110813e6bc1cSmrg# We have groff, test for HTML dependencies, one command per package
110913e6bc1cSmrgif test "x$have_groff" = x"yes"; then
111013e6bc1cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
111113e6bc1cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
111213e6bc1cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
111313e6bc1cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
111413e6bc1cSmrg      have_groff_html=yes
111513e6bc1cSmrg   else
111613e6bc1cSmrg      have_groff_html=no
111713e6bc1cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
111813e6bc1cSmrg   fi
111913e6bc1cSmrgfi
11201568b75bSmrg
112113e6bc1cSmrg# Set Automake conditionals for Makefiles
112213e6bc1cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
112313e6bc1cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
112413e6bc1cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
112513e6bc1cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
112613e6bc1cSmrg]) # XORG_WITH_GROFF
11277d5e3a19Smrg
112813e6bc1cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
112913e6bc1cSmrg# ---------------------------------------
113013e6bc1cSmrg# Minimum version: 1.6.0
113113e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
113213e6bc1cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11337d5e3a19Smrg#
113413e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
113513e6bc1cSmrg# not at the appropriate level. This macro enables a module to test for the
113613e6bc1cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
113713e6bc1cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
113813e6bc1cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
113913e6bc1cSmrg# --with-fop assumes 'auto'.
11407d5e3a19Smrg#
114113e6bc1cSmrg# Interface to module:
114213e6bc1cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
114313e6bc1cSmrg# FOP:	 	returns the path of the fop program found
114413e6bc1cSmrg#		returns the path set by the user in the environment
114513e6bc1cSmrg# --with-fop: 	'yes' user instructs the module to use fop
114613e6bc1cSmrg#		'no' user instructs the module not to use fop
11477d5e3a19Smrg#
114813e6bc1cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149b8414663Smrg#
115013e6bc1cSmrgAC_DEFUN([XORG_WITH_FOP],[
115113e6bc1cSmrgAC_ARG_VAR([FOP], [Path to fop command])
115213e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
115313e6bc1cSmrgAC_ARG_WITH(fop,
115413e6bc1cSmrg	AS_HELP_STRING([--with-fop],
115513e6bc1cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
115613e6bc1cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
115713e6bc1cSmrgm4_undefine([_defopt])
1158b8414663Smrg
115913e6bc1cSmrgif test "x$use_fop" = x"auto"; then
116013e6bc1cSmrg   AC_PATH_PROG([FOP], [fop])
116113e6bc1cSmrg   if test "x$FOP" = "x"; then
116213e6bc1cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
116313e6bc1cSmrg	have_fop=no
116413e6bc1cSmrg   else
116513e6bc1cSmrg        have_fop=yes
116613e6bc1cSmrg   fi
116713e6bc1cSmrgelif test "x$use_fop" = x"yes" ; then
116813e6bc1cSmrg   AC_PATH_PROG([FOP], [fop])
116913e6bc1cSmrg   if test "x$FOP" = "x"; then
117013e6bc1cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
117113e6bc1cSmrg   fi
117213e6bc1cSmrg   have_fop=yes
117313e6bc1cSmrgelif test "x$use_fop" = x"no" ; then
117413e6bc1cSmrg   if test "x$FOP" != "x"; then
117513e6bc1cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
117613e6bc1cSmrg   fi
117713e6bc1cSmrg   have_fop=no
117813e6bc1cSmrgelse
117913e6bc1cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
118013e6bc1cSmrgfi
1181b8414663Smrg
118213e6bc1cSmrg# Test for a minimum version of fop, if provided.
118313e6bc1cSmrgm4_ifval([$1],
118413e6bc1cSmrg[if test "$have_fop" = yes; then
118513e6bc1cSmrg    # scrape the fop version
118613e6bc1cSmrg    AC_MSG_CHECKING([for fop minimum version])
118713e6bc1cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
118813e6bc1cSmrg    AC_MSG_RESULT([$fop_version])
118913e6bc1cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
119013e6bc1cSmrg        [if test "x$use_fop" = xauto; then
119113e6bc1cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
119213e6bc1cSmrg            have_fop=no
119313e6bc1cSmrg        else
119413e6bc1cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
119513e6bc1cSmrg        fi])
119613e6bc1cSmrgfi])
119713e6bc1cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
119813e6bc1cSmrg]) # XORG_WITH_FOP
11997d5e3a19Smrg
120013e6bc1cSmrg# XORG_WITH_M4([MIN-VERSION])
120113e6bc1cSmrg# ---------------------------
120213e6bc1cSmrg# Minimum version: 1.19.0
1203bda5b58fSmrg#
120413e6bc1cSmrg# This macro attempts to locate an m4 macro processor which supports
120513e6bc1cSmrg# -I option and is only useful for modules relying on M4 in order to
120613e6bc1cSmrg# expand macros in source code files.
1207bda5b58fSmrg#
120813e6bc1cSmrg# Interface to module:
120913e6bc1cSmrg# M4:	 	returns the path of the m4 program found
121013e6bc1cSmrg#		returns the path set by the user in the environment
1211bda5b58fSmrg#
121213e6bc1cSmrgAC_DEFUN([XORG_WITH_M4], [
121313e6bc1cSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
121413e6bc1cSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
121513e6bc1cSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
121613e6bc1cSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
121713e6bc1cSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
121813e6bc1cSmrg   [$PATH:/usr/gnu/bin])])
1219bda5b58fSmrg
122013e6bc1cSmrgAC_SUBST([M4], [$ac_cv_path_M4])
122113e6bc1cSmrg]) # XORG_WITH_M4
1222bda5b58fSmrg
122313e6bc1cSmrg# XORG_WITH_PS2PDF([DEFAULT])
122413e6bc1cSmrg# ----------------
122513e6bc1cSmrg# Minimum version: 1.6.0
122613e6bc1cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
122713e6bc1cSmrg#
122813e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
122913e6bc1cSmrg# not at the appropriate level. This macro enables a module to test for the
123013e6bc1cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
123113e6bc1cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
123213e6bc1cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
123313e6bc1cSmrg# --with-ps2pdf assumes 'auto'.
1234bda5b58fSmrg#
123513e6bc1cSmrg# Interface to module:
123613e6bc1cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
123713e6bc1cSmrg# PS2PDF:	returns the path of the ps2pdf program found
123813e6bc1cSmrg#		returns the path set by the user in the environment
123913e6bc1cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
124013e6bc1cSmrg#		 'no' user instructs the module not to use ps2pdf
1241bda5b58fSmrg#
124213e6bc1cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243bda5b58fSmrg#
124413e6bc1cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
124513e6bc1cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
124613e6bc1cSmrgm4_define([_defopt], m4_default([$1], [auto]))
124713e6bc1cSmrgAC_ARG_WITH(ps2pdf,
124813e6bc1cSmrg	AS_HELP_STRING([--with-ps2pdf],
124913e6bc1cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
125013e6bc1cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
125113e6bc1cSmrgm4_undefine([_defopt])
1252bda5b58fSmrg
125313e6bc1cSmrgif test "x$use_ps2pdf" = x"auto"; then
125413e6bc1cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
125513e6bc1cSmrg   if test "x$PS2PDF" = "x"; then
125613e6bc1cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
125713e6bc1cSmrg	have_ps2pdf=no
125813e6bc1cSmrg   else
125913e6bc1cSmrg        have_ps2pdf=yes
126013e6bc1cSmrg   fi
126113e6bc1cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
126213e6bc1cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
126313e6bc1cSmrg   if test "x$PS2PDF" = "x"; then
126413e6bc1cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
126513e6bc1cSmrg   fi
126613e6bc1cSmrg   have_ps2pdf=yes
126713e6bc1cSmrgelif test "x$use_ps2pdf" = x"no" ; then
126813e6bc1cSmrg   if test "x$PS2PDF" != "x"; then
126913e6bc1cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
127013e6bc1cSmrg   fi
127113e6bc1cSmrg   have_ps2pdf=no
1272bda5b58fSmrgelse
127313e6bc1cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
127413e6bc1cSmrgfi
127513e6bc1cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
127613e6bc1cSmrg]) # XORG_WITH_PS2PDF
1277bda5b58fSmrg
127813e6bc1cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
127913e6bc1cSmrg# ----------------
128013e6bc1cSmrg# Minimum version: 1.6.0
1281bda5b58fSmrg#
128213e6bc1cSmrg# Documentation tools are not always available on all platforms and sometimes
128313e6bc1cSmrg# not at the appropriate level. This macro enables a builder to skip all
128413e6bc1cSmrg# documentation targets except traditional man pages.
128513e6bc1cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
128613e6bc1cSmrg# maximum flexibilty in controlling documentation building.
128713e6bc1cSmrg# Refer to:
128813e6bc1cSmrg# XORG_WITH_XMLTO         --with-xmlto
128913e6bc1cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
129013e6bc1cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
129113e6bc1cSmrg# XORG_WITH_FOP           --with-fop
129213e6bc1cSmrg# XORG_WITH_GROFF         --with-groff
129313e6bc1cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294bda5b58fSmrg#
129513e6bc1cSmrg# Interface to module:
129613e6bc1cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
129713e6bc1cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
129813e6bc1cSmrg#		 'no' user instructs the module not to generate docs
129913e6bc1cSmrg# parm1:	specify the default value, yes or no.
1300bda5b58fSmrg#
130113e6bc1cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
130213e6bc1cSmrgm4_define([docs_default], m4_default([$1], [yes]))
130313e6bc1cSmrgAC_ARG_ENABLE(docs,
130413e6bc1cSmrg	AS_HELP_STRING([--enable-docs],
130513e6bc1cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
130613e6bc1cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
130713e6bc1cSmrgm4_undefine([docs_default])
130813e6bc1cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
130913e6bc1cSmrgAC_MSG_CHECKING([whether to build documentation])
131013e6bc1cSmrgAC_MSG_RESULT([$build_docs])
131113e6bc1cSmrg]) # XORG_ENABLE_DOCS
1312bda5b58fSmrg
131313e6bc1cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
131413e6bc1cSmrg# ----------------
131513e6bc1cSmrg# Minimum version: 1.6.0
131613e6bc1cSmrg#
131713e6bc1cSmrg# This macro enables a builder to skip all developer documentation.
131813e6bc1cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
131913e6bc1cSmrg# maximum flexibilty in controlling documentation building.
132013e6bc1cSmrg# Refer to:
132113e6bc1cSmrg# XORG_WITH_XMLTO         --with-xmlto
132213e6bc1cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
132313e6bc1cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
132413e6bc1cSmrg# XORG_WITH_FOP           --with-fop
132513e6bc1cSmrg# XORG_WITH_GROFF         --with-groff
132613e6bc1cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
132713e6bc1cSmrg#
132813e6bc1cSmrg# Interface to module:
132913e6bc1cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
133013e6bc1cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
133113e6bc1cSmrg#			'no' user instructs the module not to generate developer docs
133213e6bc1cSmrg# parm1:		specify the default value, yes or no.
133313e6bc1cSmrg#
133413e6bc1cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
133513e6bc1cSmrgm4_define([devel_default], m4_default([$1], [yes]))
133613e6bc1cSmrgAC_ARG_ENABLE(devel-docs,
133713e6bc1cSmrg	AS_HELP_STRING([--enable-devel-docs],
133813e6bc1cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
133913e6bc1cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
134013e6bc1cSmrgm4_undefine([devel_default])
134113e6bc1cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
134213e6bc1cSmrgAC_MSG_CHECKING([whether to build developer documentation])
134313e6bc1cSmrgAC_MSG_RESULT([$build_devel_docs])
134413e6bc1cSmrg]) # XORG_ENABLE_DEVEL_DOCS
1345bda5b58fSmrg
134613e6bc1cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
134713e6bc1cSmrg# ----------------
134813e6bc1cSmrg# Minimum version: 1.6.0
134913e6bc1cSmrg#
135013e6bc1cSmrg# This macro enables a builder to skip all functional specification targets.
135113e6bc1cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
135213e6bc1cSmrg# maximum flexibilty in controlling documentation building.
135313e6bc1cSmrg# Refer to:
135413e6bc1cSmrg# XORG_WITH_XMLTO         --with-xmlto
135513e6bc1cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
135613e6bc1cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
135713e6bc1cSmrg# XORG_WITH_FOP           --with-fop
135813e6bc1cSmrg# XORG_WITH_GROFF         --with-groff
135913e6bc1cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
136013e6bc1cSmrg#
136113e6bc1cSmrg# Interface to module:
136213e6bc1cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
136313e6bc1cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
136413e6bc1cSmrg#			'no' user instructs the module not to generate specs
136513e6bc1cSmrg# parm1:		specify the default value, yes or no.
136613e6bc1cSmrg#
136713e6bc1cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
136813e6bc1cSmrgm4_define([spec_default], m4_default([$1], [yes]))
136913e6bc1cSmrgAC_ARG_ENABLE(specs,
137013e6bc1cSmrg	AS_HELP_STRING([--enable-specs],
137113e6bc1cSmrg	   [Enable building the specs (default: ]spec_default[)]),
137213e6bc1cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
137313e6bc1cSmrgm4_undefine([spec_default])
137413e6bc1cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
137513e6bc1cSmrgAC_MSG_CHECKING([whether to build functional specifications])
137613e6bc1cSmrgAC_MSG_RESULT([$build_specs])
137713e6bc1cSmrg]) # XORG_ENABLE_SPECS
1378bda5b58fSmrg
137913e6bc1cSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
138013e6bc1cSmrg# ----------------------------------------------
138113e6bc1cSmrg# Minimum version: 1.13.0
138213e6bc1cSmrg#
138313e6bc1cSmrg# This macro enables a builder to enable/disable unit testing
138413e6bc1cSmrg# It makes no assumption about the test cases implementation
138513e6bc1cSmrg# Test cases may or may not use Automake "Support for test suites"
138613e6bc1cSmrg# They may or may not use the software utility library GLib
138713e6bc1cSmrg#
138813e6bc1cSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
138913e6bc1cSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
139013e6bc1cSmrg# The variable enable_unit_tests is used by other macros in this file.
139113e6bc1cSmrg#
139213e6bc1cSmrg# Interface to module:
139313e6bc1cSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
139413e6bc1cSmrg# enable_unit_tests:    used in configure.ac for additional configuration
139513e6bc1cSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
139613e6bc1cSmrg#			'no' user instructs the module not to build tests
139713e6bc1cSmrg# parm1:		specify the default value, yes or no.
139813e6bc1cSmrg#
139913e6bc1cSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
140013e6bc1cSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
140113e6bc1cSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
140213e6bc1cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
140313e6bc1cSmrgm4_define([_defopt], m4_default([$1], [auto]))
140413e6bc1cSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
140513e6bc1cSmrg	[Enable building unit test cases (default: ]_defopt[)]),
140613e6bc1cSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
140713e6bc1cSmrgm4_undefine([_defopt])
140813e6bc1cSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
140913e6bc1cSmrgAC_MSG_CHECKING([whether to build unit test cases])
141013e6bc1cSmrgAC_MSG_RESULT([$enable_unit_tests])
141113e6bc1cSmrg]) # XORG_ENABLE_UNIT_TESTS
1412bda5b58fSmrg
141313e6bc1cSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
141413e6bc1cSmrg# ------------------------------------------------------
141513e6bc1cSmrg# Minimum version: 1.17.0
141613e6bc1cSmrg#
141713e6bc1cSmrg# This macro enables a builder to enable/disable integration testing
141813e6bc1cSmrg# It makes no assumption about the test cases' implementation
141913e6bc1cSmrg# Test cases may or may not use Automake "Support for test suites"
142013e6bc1cSmrg#
142113e6bc1cSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
142213e6bc1cSmrg# usually requires less dependencies and may be built and run under less
142313e6bc1cSmrg# stringent environments than integration tests.
142413e6bc1cSmrg#
142513e6bc1cSmrg# Interface to module:
142613e6bc1cSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
142713e6bc1cSmrg# enable_integration_tests:   used in configure.ac for additional configuration
142813e6bc1cSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
142913e6bc1cSmrg#                             'no' user instructs the module not to build tests
143013e6bc1cSmrg# parm1:                      specify the default value, yes or no.
143113e6bc1cSmrg#
143213e6bc1cSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
143313e6bc1cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
143413e6bc1cSmrgm4_define([_defopt], m4_default([$1], [auto]))
143513e6bc1cSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
143613e6bc1cSmrg	[Enable building integration test cases (default: ]_defopt[)]),
143713e6bc1cSmrg	[enable_integration_tests=$enableval],
143813e6bc1cSmrg	[enable_integration_tests=]_defopt)
143913e6bc1cSmrgm4_undefine([_defopt])
144013e6bc1cSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
144113e6bc1cSmrg	[test "x$enable_integration_tests" != xno])
144213e6bc1cSmrgAC_MSG_CHECKING([whether to build unit test cases])
144313e6bc1cSmrgAC_MSG_RESULT([$enable_integration_tests])
144413e6bc1cSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445bda5b58fSmrg
144613e6bc1cSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
144713e6bc1cSmrg# ----------------------------------------
144813e6bc1cSmrg# Minimum version: 1.13.0
144913e6bc1cSmrg#
145013e6bc1cSmrg# GLib is a library which provides advanced data structures and functions.
145113e6bc1cSmrg# This macro enables a module to test for the presence of Glib.
145213e6bc1cSmrg#
145313e6bc1cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
145413e6bc1cSmrg# Otherwise the value of $enable_unit_tests is blank.
145513e6bc1cSmrg#
145613e6bc1cSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
145713e6bc1cSmrg# test support usually requires less dependencies and may be built and run under
145813e6bc1cSmrg# less stringent environments than integration tests.
145913e6bc1cSmrg#
146013e6bc1cSmrg# Interface to module:
146113e6bc1cSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
146213e6bc1cSmrg# with_glib: used in configure.ac to know if GLib has been found
146313e6bc1cSmrg# --with-glib:	'yes' user instructs the module to use glib
146413e6bc1cSmrg#		'no' user instructs the module not to use glib
146513e6bc1cSmrg#
146613e6bc1cSmrgAC_DEFUN([XORG_WITH_GLIB],[
146713e6bc1cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146813e6bc1cSmrgm4_define([_defopt], m4_default([$2], [auto]))
146913e6bc1cSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
147013e6bc1cSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
147113e6bc1cSmrg	[with_glib=$withval], [with_glib=]_defopt)
147213e6bc1cSmrgm4_undefine([_defopt])
1473bda5b58fSmrg
147413e6bc1cSmrghave_glib=no
147513e6bc1cSmrg# Do not probe GLib if user explicitly disabled unit testing
147613e6bc1cSmrgif test "x$enable_unit_tests" != x"no"; then
147713e6bc1cSmrg  # Do not probe GLib if user explicitly disabled it
147813e6bc1cSmrg  if test "x$with_glib" != x"no"; then
147913e6bc1cSmrg    m4_ifval(
148013e6bc1cSmrg      [$1],
148113e6bc1cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
148213e6bc1cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
148313e6bc1cSmrg    )
148413e6bc1cSmrg  fi
148513e6bc1cSmrgfi
1486bda5b58fSmrg
148713e6bc1cSmrg# Not having GLib when unit testing has been explicitly requested is an error
148813e6bc1cSmrgif test "x$enable_unit_tests" = x"yes"; then
148913e6bc1cSmrg  if test "x$have_glib" = x"no"; then
149013e6bc1cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149113e6bc1cSmrg  fi
149213e6bc1cSmrgfi
1493bda5b58fSmrg
149413e6bc1cSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
149513e6bc1cSmrgif test "x$enable_unit_tests" = x"no"; then
149613e6bc1cSmrg  if test "x$with_glib" = x"yes"; then
149713e6bc1cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149813e6bc1cSmrg  fi
149913e6bc1cSmrgfi
1500bda5b58fSmrg
150113e6bc1cSmrg# Not having GLib when it has been explicitly requested is an error
150213e6bc1cSmrgif test "x$with_glib" = x"yes"; then
150313e6bc1cSmrg  if test "x$have_glib" = x"no"; then
150413e6bc1cSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
150513e6bc1cSmrg  fi
150613e6bc1cSmrgfi
1507bda5b58fSmrg
150813e6bc1cSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
150913e6bc1cSmrg]) # XORG_WITH_GLIB
15107d5e3a19Smrg
151113e6bc1cSmrg# XORG_LD_WRAP([required|optional])
151213e6bc1cSmrg# ---------------------------------
151313e6bc1cSmrg# Minimum version: 1.13.0
15147d5e3a19Smrg#
151513e6bc1cSmrg# Check if linker supports -wrap, passed via compiler flags
15167d5e3a19Smrg#
151713e6bc1cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
151813e6bc1cSmrg# Otherwise the value of $enable_unit_tests is blank.
15197d5e3a19Smrg#
152013e6bc1cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
152113e6bc1cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
152213e6bc1cSmrg# available, an argument of "optional" allows use when some unit tests require
152313e6bc1cSmrg# ld -wrap and others do not.
15247d5e3a19Smrg#
152513e6bc1cSmrgAC_DEFUN([XORG_LD_WRAP],[
152613e6bc1cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
152713e6bc1cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
152813e6bc1cSmrg                      void __wrap_exit(int status) { return; }],
152913e6bc1cSmrg                     [exit(0);])])
153013e6bc1cSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
153113e6bc1cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
153213e6bc1cSmrg  if test "x$have_ld_wrap" = x"no"; then
153313e6bc1cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
153413e6bc1cSmrg  fi
15357d5e3a19Smrgfi
153613e6bc1cSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
153713e6bc1cSmrg#
153813e6bc1cSmrg]) # XORG_LD_WRAP
15397d5e3a19Smrg
154013e6bc1cSmrg# XORG_CHECK_LINKER_FLAGS
154113e6bc1cSmrg# -----------------------
154213e6bc1cSmrg# SYNOPSIS
154313e6bc1cSmrg#
154413e6bc1cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
154513e6bc1cSmrg#
154613e6bc1cSmrg# DESCRIPTION
154713e6bc1cSmrg#
154813e6bc1cSmrg#   Check whether the given linker FLAGS work with the current language's
154913e6bc1cSmrg#   linker, or whether they give an error.
155013e6bc1cSmrg#
155113e6bc1cSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
155213e6bc1cSmrg#   success/failure.
155313e6bc1cSmrg#
155413e6bc1cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
155513e6bc1cSmrg#
155613e6bc1cSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
155713e6bc1cSmrg#
155813e6bc1cSmrg# LICENSE
155913e6bc1cSmrg#
156013e6bc1cSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
156113e6bc1cSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
156213e6bc1cSmrg#   Copyright (c) 2009 Matteo Frigo
156313e6bc1cSmrg#
156413e6bc1cSmrg#   This program is free software: you can redistribute it and/or modify it
156513e6bc1cSmrg#   under the terms of the GNU General Public License as published by the
156613e6bc1cSmrg#   Free Software Foundation, either version 3 of the License, or (at your
156713e6bc1cSmrg#   option) any later version.
156813e6bc1cSmrg#
156913e6bc1cSmrg#   This program is distributed in the hope that it will be useful, but
157013e6bc1cSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
157113e6bc1cSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
157213e6bc1cSmrg#   Public License for more details.
157313e6bc1cSmrg#
157413e6bc1cSmrg#   You should have received a copy of the GNU General Public License along
157513e6bc1cSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
157613e6bc1cSmrg#
157713e6bc1cSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
157813e6bc1cSmrg#   gives unlimited permission to copy, distribute and modify the configure
157913e6bc1cSmrg#   scripts that are the output of Autoconf when processing the Macro. You
158013e6bc1cSmrg#   need not follow the terms of the GNU General Public License when using
158113e6bc1cSmrg#   or distributing such scripts, even though portions of the text of the
158213e6bc1cSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
158313e6bc1cSmrg#   all other use of the material that constitutes the Autoconf Macro.
158413e6bc1cSmrg#
158513e6bc1cSmrg#   This special exception to the GPL applies to versions of the Autoconf
158613e6bc1cSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
158713e6bc1cSmrg#   modified version of the Autoconf Macro, you may extend this special
158813e6bc1cSmrg#   exception to the GPL to apply to your modified version as well.#
158913e6bc1cSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
159013e6bc1cSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
159113e6bc1cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
159213e6bc1cSmrgAS_LITERAL_IF([$1],
159313e6bc1cSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
159413e6bc1cSmrg      ax_save_FLAGS=$LDFLAGS
159513e6bc1cSmrg      LDFLAGS="$1"
159613e6bc1cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
159713e6bc1cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
159813e6bc1cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
159913e6bc1cSmrg      LDFLAGS=$ax_save_FLAGS])],
160013e6bc1cSmrg  [ax_save_FLAGS=$LDFLAGS
160113e6bc1cSmrg   LDFLAGS="$1"
160213e6bc1cSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
160313e6bc1cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
160413e6bc1cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
160513e6bc1cSmrg   LDFLAGS=$ax_save_FLAGS])
160613e6bc1cSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
160713e6bc1cSmrgAC_MSG_RESULT($xorg_check_linker_flags)
160813e6bc1cSmrgif test "x$xorg_check_linker_flags" = xyes; then
160913e6bc1cSmrg	m4_default([$2], :)
16107d5e3a19Smrgelse
161113e6bc1cSmrg	m4_default([$3], :)
16127d5e3a19Smrgfi
161313e6bc1cSmrg]) # XORG_CHECK_LINKER_FLAGS
16147d5e3a19Smrg
161513e6bc1cSmrg# XORG_MEMORY_CHECK_FLAGS
16167d5e3a19Smrg# -----------------------
161713e6bc1cSmrg# Minimum version: 1.16.0
16187d5e3a19Smrg#
161913e6bc1cSmrg# This macro attempts to find appropriate memory checking functionality
162013e6bc1cSmrg# for various platforms which unit testing code may use to catch various
162113e6bc1cSmrg# forms of memory allocation and access errors in testing.
162213e6bc1cSmrg#
162313e6bc1cSmrg# Interface to module:
162413e6bc1cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
162513e6bc1cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162613e6bc1cSmrg#
162713e6bc1cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162813e6bc1cSmrg#
162913e6bc1cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16307d5e3a19Smrg
16317d5e3a19SmrgAC_REQUIRE([AC_CANONICAL_HOST])
163213e6bc1cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
163313e6bc1cSmrg           [Environment variables to enable memory checking in tests])
16347d5e3a19Smrg
163513e6bc1cSmrg# Check for different types of support on different platforms
163613e6bc1cSmrgcase $host_os in
163713e6bc1cSmrg    solaris*)
163813e6bc1cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
163913e6bc1cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
164013e6bc1cSmrg        ;;
164113e6bc1cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
164213e6bc1cSmrg        # both directly and inverted, so should not be 0 or 255.
164313e6bc1cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
164413e6bc1cSmrg        ;;
164513e6bc1cSmrg    darwin*)
164613e6bc1cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
164713e6bc1cSmrg        ;;
164813e6bc1cSmrg    *bsd*)
164913e6bc1cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
165013e6bc1cSmrg        ;;
165113e6bc1cSmrgesac
16527d5e3a19Smrg
165313e6bc1cSmrg# User supplied flags override default flags
165413e6bc1cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
165513e6bc1cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16567d5e3a19Smrgfi
16577d5e3a19Smrg
165813e6bc1cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
165913e6bc1cSmrg]) # XORG_WITH_LINT
16607d5e3a19Smrg
166113e6bc1cSmrg# XORG_CHECK_MALLOC_ZERO
166213e6bc1cSmrg# ----------------------
166313e6bc1cSmrg# Minimum version: 1.0.0
166413e6bc1cSmrg#
166513e6bc1cSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
166613e6bc1cSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
166713e6bc1cSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
166813e6bc1cSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
166913e6bc1cSmrgAC_ARG_ENABLE(malloc0returnsnull,
167013e6bc1cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
167113e6bc1cSmrg		       [malloc(0) returns NULL (default: auto)]),
167213e6bc1cSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
167313e6bc1cSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16747d5e3a19Smrg
167513e6bc1cSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
167613e6bc1cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
167713e6bc1cSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
167813e6bc1cSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
167913e6bc1cSmrg#include <stdlib.h>
168013e6bc1cSmrg],[
168113e6bc1cSmrg    char *m0, *r0, *c0, *p;
168213e6bc1cSmrg    m0 = malloc(0);
168313e6bc1cSmrg    p = malloc(10);
168413e6bc1cSmrg    r0 = realloc(p,0);
168513e6bc1cSmrg    c0 = calloc(0,10);
168613e6bc1cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
168713e6bc1cSmrg])],
168813e6bc1cSmrg		[xorg_cv_malloc0_returns_null=yes],
168913e6bc1cSmrg		[xorg_cv_malloc0_returns_null=no])])
169013e6bc1cSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16917d5e3a19Smrgfi
169213e6bc1cSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16937d5e3a19Smrg
169413e6bc1cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
169513e6bc1cSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
169613e6bc1cSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
169713e6bc1cSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1698765486e8Smrgelse
169913e6bc1cSmrg	MALLOC_ZERO_CFLAGS=""
170013e6bc1cSmrg	XMALLOC_ZERO_CFLAGS=""
170113e6bc1cSmrg	XTMALLOC_ZERO_CFLAGS=""
1702765486e8Smrgfi
1703765486e8Smrg
170413e6bc1cSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
170513e6bc1cSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
170613e6bc1cSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
170713e6bc1cSmrg]) # XORG_CHECK_MALLOC_ZERO
1708765486e8Smrg
170913e6bc1cSmrg# XORG_WITH_LINT()
171013e6bc1cSmrg# ----------------
171113e6bc1cSmrg# Minimum version: 1.1.0
17127d5e3a19Smrg#
171313e6bc1cSmrg# This macro enables the use of a tool that flags some suspicious and
171413e6bc1cSmrg# non-portable constructs (likely to be bugs) in C language source code.
171513e6bc1cSmrg# It will attempt to locate the tool and use appropriate options.
171613e6bc1cSmrg# There are various lint type tools on different platforms.
171713e6bc1cSmrg#
171813e6bc1cSmrg# Interface to module:
171913e6bc1cSmrg# LINT:		returns the path to the tool found on the platform
172013e6bc1cSmrg#		or the value set to LINT on the configure cmd line
172113e6bc1cSmrg#		also an Automake conditional
172213e6bc1cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
172313e6bc1cSmrg#
172413e6bc1cSmrg# --with-lint:	'yes' user instructs the module to use lint
172513e6bc1cSmrg#		'no' user instructs the module not to use lint (default)
172613e6bc1cSmrg#
172713e6bc1cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
172813e6bc1cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
172913e6bc1cSmrg#
173013e6bc1cSmrgAC_DEFUN([XORG_WITH_LINT],[
17317d5e3a19Smrg
173213e6bc1cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
173313e6bc1cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
173413e6bc1cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
173513e6bc1cSmrg		[Use a lint-style source code checker (default: disabled)])],
173613e6bc1cSmrg		[use_lint=$withval], [use_lint=no])
17377d5e3a19Smrg
173813e6bc1cSmrg# Obtain platform specific info like program name and options
173913e6bc1cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
174013e6bc1cSmrgcase $host_os in
174113e6bc1cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
174213e6bc1cSmrg	lint_name=splint
174313e6bc1cSmrg	lint_options="-badflag"
174413e6bc1cSmrg	;;
174513e6bc1cSmrg  *freebsd* | *netbsd*)
174613e6bc1cSmrg	lint_name=lint
174713e6bc1cSmrg	lint_options="-u -b"
174813e6bc1cSmrg	;;
174913e6bc1cSmrg  *solaris*)
175013e6bc1cSmrg	lint_name=lint
175113e6bc1cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
175213e6bc1cSmrg	;;
175313e6bc1cSmrgesac
17547d5e3a19Smrg
175513e6bc1cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
175613e6bc1cSmrgif test "x$use_lint" = x"yes" ; then
175713e6bc1cSmrg   AC_PATH_PROG([LINT], [$lint_name])
175813e6bc1cSmrg   if test "x$LINT" = "x"; then
175913e6bc1cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
176013e6bc1cSmrg   fi
176113e6bc1cSmrgelif test "x$use_lint" = x"no" ; then
176213e6bc1cSmrg   if test "x$LINT" != "x"; then
176313e6bc1cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
176413e6bc1cSmrg   fi
17657d5e3a19Smrgelse
176613e6bc1cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17677d5e3a19Smrgfi
17687d5e3a19Smrg
176913e6bc1cSmrg# User supplied flags override default flags
177013e6bc1cSmrgif test "x$LINT_FLAGS" != "x"; then
177113e6bc1cSmrg   lint_options=$LINT_FLAGS
17727d5e3a19Smrgfi
17737d5e3a19Smrg
177413e6bc1cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
177513e6bc1cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17767d5e3a19Smrg
177713e6bc1cSmrg]) # XORG_WITH_LINT
17787d5e3a19Smrg
177913e6bc1cSmrg# XORG_LINT_LIBRARY(LIBNAME)
178013e6bc1cSmrg# --------------------------
178113e6bc1cSmrg# Minimum version: 1.1.0
17827d5e3a19Smrg#
178313e6bc1cSmrg# Sets up flags for building lint libraries for checking programs that call
178413e6bc1cSmrg# functions in the library.
178513e6bc1cSmrg#
178613e6bc1cSmrg# Interface to module:
178713e6bc1cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
178813e6bc1cSmrg# MAKE_LINT_LIB		- Automake conditional
178913e6bc1cSmrg#
179013e6bc1cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
179113e6bc1cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
17927d5e3a19Smrg
179313e6bc1cSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
179413e6bc1cSmrgAC_REQUIRE([XORG_WITH_LINT])
179513e6bc1cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
179613e6bc1cSmrg	[Create lint library (default: disabled)])],
179713e6bc1cSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17987d5e3a19Smrg
179913e6bc1cSmrgif test "x$make_lint_lib" = x"yes" ; then
180013e6bc1cSmrg   LINTLIB=llib-l$1.ln
180113e6bc1cSmrg   if test "x$LINT" = "x"; then
180213e6bc1cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
180313e6bc1cSmrg   fi
180413e6bc1cSmrgelif test "x$make_lint_lib" != x"no" ; then
180513e6bc1cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18067d5e3a19Smrgfi
18077d5e3a19Smrg
180813e6bc1cSmrgAC_SUBST(LINTLIB)
180913e6bc1cSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18107d5e3a19Smrg
181113e6bc1cSmrg]) # XORG_LINT_LIBRARY
18127d5e3a19Smrg
181313e6bc1cSmrg# XORG_COMPILER_BRAND
181413e6bc1cSmrg# -------------------
181513e6bc1cSmrg# Minimum version: 1.14.0
1816765486e8Smrg#
181713e6bc1cSmrg# Checks for various brands of compilers and sets flags as appropriate:
181813e6bc1cSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
181913e6bc1cSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
182013e6bc1cSmrg#   clang compiler - sets CLANGCC to "yes"
182113e6bc1cSmrg#   Intel compiler - sets INTELCC to "yes"
182213e6bc1cSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823765486e8Smrg#
182413e6bc1cSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
182513e6bc1cSmrgAC_LANG_CASE(
182613e6bc1cSmrg	[C], [
182713e6bc1cSmrg		AC_REQUIRE([AC_PROG_CC_C99])
182813e6bc1cSmrg	],
182913e6bc1cSmrg	[C++], [
183013e6bc1cSmrg		AC_REQUIRE([AC_PROG_CXX])
183113e6bc1cSmrg	]
183213e6bc1cSmrg)
183313e6bc1cSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
183413e6bc1cSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
183513e6bc1cSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
183613e6bc1cSmrg]) # XORG_COMPILER_BRAND
183713e6bc1cSmrg
183813e6bc1cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
183913e6bc1cSmrg# ---------------
184013e6bc1cSmrg# Minimum version: 1.16.0
1841765486e8Smrg#
184213e6bc1cSmrg# Test if the compiler works when passed the given flag as a command line argument.
184313e6bc1cSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
184413e6bc1cSmrg# next flag in the list until there are no more options.
1845765486e8Smrg#
184613e6bc1cSmrg# Note that this does not guarantee that the compiler supports the flag as some
184713e6bc1cSmrg# compilers will simply ignore arguments that they do not understand, but we do
184813e6bc1cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
184913e6bc1cSmrg# -Werror=unused-command-line-argument
1850765486e8Smrg#
185113e6bc1cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
185213e6bc1cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185313e6bc1cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854765486e8Smrg
185513e6bc1cSmrgAC_LANG_COMPILER_REQUIRE
185613e6bc1cSmrg
185713e6bc1cSmrgAC_LANG_CASE(
185813e6bc1cSmrg	[C], [
185913e6bc1cSmrg		AC_REQUIRE([AC_PROG_CC_C99])
186013e6bc1cSmrg		define([PREFIX], [C])
186113e6bc1cSmrg		define([CACHE_PREFIX], [cc])
186213e6bc1cSmrg		define([COMPILER], [$CC])
186313e6bc1cSmrg	],
186413e6bc1cSmrg	[C++], [
186513e6bc1cSmrg		define([PREFIX], [CXX])
186613e6bc1cSmrg		define([CACHE_PREFIX], [cxx])
186713e6bc1cSmrg		define([COMPILER], [$CXX])
186813e6bc1cSmrg	]
186913e6bc1cSmrg)
187013e6bc1cSmrg
187113e6bc1cSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
187213e6bc1cSmrg
187313e6bc1cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
187413e6bc1cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
187513e6bc1cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
187613e6bc1cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
187713e6bc1cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
187813e6bc1cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
187913e6bc1cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
188013e6bc1cSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
188113e6bc1cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882765486e8Smrgfi
1883765486e8Smrg
188413e6bc1cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
188513e6bc1cSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
188613e6bc1cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
188713e6bc1cSmrg	fi
188813e6bc1cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
188913e6bc1cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
189013e6bc1cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
189113e6bc1cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
189213e6bc1cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
189313e6bc1cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
189413e6bc1cSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
189513e6bc1cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189613e6bc1cSmrgfi
1897765486e8Smrg
189813e6bc1cSmrgfound="no"
189913e6bc1cSmrgm4_foreach([flag], m4_cdr($@), [
190013e6bc1cSmrg	if test $found = "no" ; then
190113e6bc1cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
190213e6bc1cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
190313e6bc1cSmrg		fi
1904765486e8Smrg
190513e6bc1cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
190613e6bc1cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
190713e6bc1cSmrg		fi
190813e6bc1cSmrg
190913e6bc1cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
191013e6bc1cSmrg
191113e6bc1cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
191213e6bc1cSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
191313e6bc1cSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
191413e6bc1cSmrg		AC_CACHE_VAL($cacheid,
191513e6bc1cSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
191613e6bc1cSmrg					     [eval $cacheid=yes],
191713e6bc1cSmrg					     [eval $cacheid=no])])
191813e6bc1cSmrg
191913e6bc1cSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
192013e6bc1cSmrg
192113e6bc1cSmrg		eval supported=\$$cacheid
192213e6bc1cSmrg		AC_MSG_RESULT([$supported])
192313e6bc1cSmrg		if test "$supported" = "yes" ; then
192413e6bc1cSmrg			$1="$$1 ]flag["
192513e6bc1cSmrg			found="yes"
192613e6bc1cSmrg		fi
192713e6bc1cSmrg	fi
192813e6bc1cSmrg])
192913e6bc1cSmrg]) # XORG_TESTSET_CFLAG
193013e6bc1cSmrg
193113e6bc1cSmrg# XORG_COMPILER_FLAGS
193213e6bc1cSmrg# ---------------
193313e6bc1cSmrg# Minimum version: 1.16.0
1934bda5b58fSmrg#
193513e6bc1cSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
193613e6bc1cSmrg# arguments supported by the selected compiler which do NOT alter the generated
193713e6bc1cSmrg# code.  These arguments will cause the compiler to print various warnings
193813e6bc1cSmrg# during compilation AND turn a conservative set of warnings into errors.
1939bda5b58fSmrg#
194013e6bc1cSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
194113e6bc1cSmrg# future versions of util-macros as options are added to new compilers.
1942bda5b58fSmrg#
194313e6bc1cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
194413e6bc1cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945bda5b58fSmrg
194613e6bc1cSmrgAC_ARG_ENABLE(selective-werror,
194713e6bc1cSmrg              AS_HELP_STRING([--disable-selective-werror],
194813e6bc1cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
194913e6bc1cSmrg              [SELECTIVE_WERROR=$enableval],
195013e6bc1cSmrg              [SELECTIVE_WERROR=yes])
195113e6bc1cSmrg
195213e6bc1cSmrgAC_LANG_CASE(
195313e6bc1cSmrg        [C], [
195413e6bc1cSmrg                define([PREFIX], [C])
195513e6bc1cSmrg        ],
195613e6bc1cSmrg        [C++], [
195713e6bc1cSmrg                define([PREFIX], [CXX])
195813e6bc1cSmrg        ]
195913e6bc1cSmrg)
196013e6bc1cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
196113e6bc1cSmrgif test "x$SUNCC" = "xyes"; then
196213e6bc1cSmrg    [BASE_]PREFIX[FLAGS]="-v"
1963bda5b58fSmrgelse
196413e6bc1cSmrg    [BASE_]PREFIX[FLAGS]=""
1965bda5b58fSmrgfi
1966bda5b58fSmrg
196713e6bc1cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
196813e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
196913e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
197013e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
197113e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972bda5b58fSmrg
197313e6bc1cSmrgAC_LANG_CASE(
197413e6bc1cSmrg	[C], [
197513e6bc1cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
197613e6bc1cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
197713e6bc1cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
197813e6bc1cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
197913e6bc1cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
198013e6bc1cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
198113e6bc1cSmrg	]
198213e6bc1cSmrg)
198313e6bc1cSmrg
198413e6bc1cSmrg# This chunk adds additional warnings that could catch undesired effects.
198513e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
198613e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
198713e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
198813e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
198913e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
199013e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
199113e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
199213e6bc1cSmrg
199313e6bc1cSmrg# These are currently disabled because they are noisy.  They will be enabled
199413e6bc1cSmrg# in the future once the codebase is sufficiently modernized to silence
199513e6bc1cSmrg# them.  For now, I don't want them to drown out the other warnings.
199613e6bc1cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
199713e6bc1cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
199813e6bc1cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
199913e6bc1cSmrg
200013e6bc1cSmrg# Turn some warnings into errors, so we don't accidently get successful builds
200113e6bc1cSmrg# when there are problems that should be fixed.
200213e6bc1cSmrg
200313e6bc1cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
200413e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
200513e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
200613e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
200713e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
200813e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
200913e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
201013e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
201113e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
201213e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
201313e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
201413e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
201513e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
201613e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201713e6bc1cSmrgelse
201813e6bc1cSmrgAC_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])
201913e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
202013e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
202113e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
202213e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
202313e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
202413e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
202513e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
202613e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
202713e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
202813e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
202913e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
203013e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
203113e6bc1cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203213e6bc1cSmrgfi
203313e6bc1cSmrg
203413e6bc1cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203513e6bc1cSmrg]) # XORG_COMPILER_FLAGS
203613e6bc1cSmrg
203713e6bc1cSmrg# XORG_CWARNFLAGS
203813e6bc1cSmrg# ---------------
203913e6bc1cSmrg# Minimum version: 1.2.0
204013e6bc1cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041bda5b58fSmrg#
204213e6bc1cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2043bda5b58fSmrg#
204413e6bc1cSmrg# This function is deprecated because it defines -fno-strict-aliasing
204513e6bc1cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
204613e6bc1cSmrg# is needed, then it should be added explicitly in the module when
204713e6bc1cSmrg# it is updated to use BASE_CFLAGS.
2048bda5b58fSmrg#
204913e6bc1cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
205013e6bc1cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
205113e6bc1cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
205213e6bc1cSmrgAC_LANG_CASE(
205313e6bc1cSmrg	[C], [
205413e6bc1cSmrg		CWARNFLAGS="$BASE_CFLAGS"
205513e6bc1cSmrg		if  test "x$GCC" = xyes ; then
205613e6bc1cSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
205713e6bc1cSmrg		fi
205813e6bc1cSmrg		AC_SUBST(CWARNFLAGS)
205913e6bc1cSmrg	]
206013e6bc1cSmrg)
206113e6bc1cSmrg]) # XORG_CWARNFLAGS
206213e6bc1cSmrg
206313e6bc1cSmrg# XORG_STRICT_OPTION
206413e6bc1cSmrg# -----------------------
206513e6bc1cSmrg# Minimum version: 1.3.0
2066bda5b58fSmrg#
206713e6bc1cSmrg# Add configure option to enable strict compilation flags, such as treating
206813e6bc1cSmrg# warnings as fatal errors.
206913e6bc1cSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
207013e6bc1cSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071bda5b58fSmrg#
207213e6bc1cSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
207313e6bc1cSmrg# when strict compilation is unconditionally desired.
207413e6bc1cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
207513e6bc1cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
207613e6bc1cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077bda5b58fSmrg
207813e6bc1cSmrgAC_ARG_ENABLE(strict-compilation,
207913e6bc1cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
208013e6bc1cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
208113e6bc1cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082bda5b58fSmrg
208313e6bc1cSmrgAC_LANG_CASE(
208413e6bc1cSmrg        [C], [
208513e6bc1cSmrg                define([PREFIX], [C])
208613e6bc1cSmrg        ],
208713e6bc1cSmrg        [C++], [
208813e6bc1cSmrg                define([PREFIX], [CXX])
208913e6bc1cSmrg        ]
209013e6bc1cSmrg)
2091bda5b58fSmrg
209213e6bc1cSmrg[STRICT_]PREFIX[FLAGS]=""
209313e6bc1cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
209413e6bc1cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209513e6bc1cSmrg
209613e6bc1cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
209713e6bc1cSmrg# activate it with -Werror, so we add it here explicitly.
209813e6bc1cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209913e6bc1cSmrg
210013e6bc1cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
210113e6bc1cSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
210213e6bc1cSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
210313e6bc1cSmrgfi
210413e6bc1cSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
210513e6bc1cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
210613e6bc1cSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
210713e6bc1cSmrg]) # XORG_STRICT_OPTION
210813e6bc1cSmrg
210913e6bc1cSmrg# XORG_DEFAULT_OPTIONS
211013e6bc1cSmrg# --------------------
211113e6bc1cSmrg# Minimum version: 1.3.0
2112765486e8Smrg#
211313e6bc1cSmrg# Defines default options for X.Org modules.
2114765486e8Smrg#
211513e6bc1cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211613e6bc1cSmrgAC_REQUIRE([AC_PROG_INSTALL])
211713e6bc1cSmrgXORG_COMPILER_FLAGS
211813e6bc1cSmrgXORG_CWARNFLAGS
211913e6bc1cSmrgXORG_STRICT_OPTION
212013e6bc1cSmrgXORG_RELEASE_VERSION
212113e6bc1cSmrgXORG_CHANGELOG
212213e6bc1cSmrgXORG_INSTALL
212313e6bc1cSmrgXORG_MANPAGE_SECTIONS
212413e6bc1cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212513e6bc1cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212613e6bc1cSmrg]) # XORG_DEFAULT_OPTIONS
212713e6bc1cSmrg
212813e6bc1cSmrg# XORG_INSTALL()
212913e6bc1cSmrg# ----------------
213013e6bc1cSmrg# Minimum version: 1.4.0
2131765486e8Smrg#
213213e6bc1cSmrg# Defines the variable INSTALL_CMD as the command to copy
213313e6bc1cSmrg# INSTALL from $prefix/share/util-macros.
2134765486e8Smrg#
213513e6bc1cSmrgAC_DEFUN([XORG_INSTALL], [
213613e6bc1cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213713e6bc1cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
213813e6bc1cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
213913e6bc1cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214013e6bc1cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214113e6bc1cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214213e6bc1cSmrgAC_SUBST([INSTALL_CMD])
214313e6bc1cSmrg]) # XORG_INSTALL
214413e6bc1cSmrgdnl Copyright 2005 Red Hat, Inc
214513e6bc1cSmrgdnl
214613e6bc1cSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
214713e6bc1cSmrgdnl documentation for any purpose is hereby granted without fee, provided that
214813e6bc1cSmrgdnl the above copyright notice appear in all copies and that both that
214913e6bc1cSmrgdnl copyright notice and this permission notice appear in supporting
215013e6bc1cSmrgdnl documentation.
215113e6bc1cSmrgdnl
215213e6bc1cSmrgdnl The above copyright notice and this permission notice shall be included
215313e6bc1cSmrgdnl in all copies or substantial portions of the Software.
215413e6bc1cSmrgdnl
215513e6bc1cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
215613e6bc1cSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215713e6bc1cSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
215813e6bc1cSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
215913e6bc1cSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
216013e6bc1cSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
216113e6bc1cSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
216213e6bc1cSmrgdnl
216313e6bc1cSmrgdnl Except as contained in this notice, the name of the copyright holders shall
216413e6bc1cSmrgdnl not be used in advertising or otherwise to promote the sale, use or
216513e6bc1cSmrgdnl other dealings in this Software without prior written authorization
216613e6bc1cSmrgdnl from the copyright holders.
216713e6bc1cSmrgdnl
2168765486e8Smrg
216913e6bc1cSmrg# XORG_RELEASE_VERSION
217013e6bc1cSmrg# --------------------
217113e6bc1cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
217213e6bc1cSmrg
217313e6bc1cSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
217413e6bc1cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
217513e6bc1cSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
217613e6bc1cSmrg		[Major version of this package])
217713e6bc1cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
217813e6bc1cSmrg	if test "x$PVM" = "x"; then
217913e6bc1cSmrg		PVM="0"
218013e6bc1cSmrg	fi
218113e6bc1cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
218213e6bc1cSmrg		[$PVM],
218313e6bc1cSmrg		[Minor version of this package])
218413e6bc1cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
218513e6bc1cSmrg	if test "x$PVP" = "x"; then
218613e6bc1cSmrg		PVP="0"
218713e6bc1cSmrg	fi
218813e6bc1cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
218913e6bc1cSmrg		[$PVP],
219013e6bc1cSmrg		[Patch version of this package])
219113e6bc1cSmrg])
219213e6bc1cSmrg
219313e6bc1cSmrg# XORG_CHANGELOG()
219413e6bc1cSmrg# ----------------
219513e6bc1cSmrg# Minimum version: 1.2.0
2196765486e8Smrg#
219713e6bc1cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
219813e6bc1cSmrg# ChangeLog from git.
2199765486e8Smrg#
2200765486e8Smrg#
220113e6bc1cSmrgAC_DEFUN([XORG_CHANGELOG], [
220213e6bc1cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220313e6bc1cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220413e6bc1cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220513e6bc1cSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220613e6bc1cSmrgAC_SUBST([CHANGELOG_CMD])
220713e6bc1cSmrg]) # XORG_CHANGELOG
220813e6bc1cSmrg
220913e6bc1cSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210765486e8Smrg#
221113e6bc1cSmrg# This file is free software; the Free Software Foundation
221213e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
221313e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2214765486e8Smrg
221513e6bc1cSmrg# AM_AUTOMAKE_VERSION(VERSION)
221613e6bc1cSmrg# ----------------------------
221713e6bc1cSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
221813e6bc1cSmrg# generated from the m4 files accompanying Automake X.Y.
221913e6bc1cSmrg# (This private macro should not be called outside this file.)
222013e6bc1cSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
222113e6bc1cSmrg[am__api_version='1.15'
222213e6bc1cSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
222313e6bc1cSmrgdnl require some minimum version.  Point them to the right macro.
222413e6bc1cSmrgm4_if([$1], [1.15], [],
222513e6bc1cSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
222613e6bc1cSmrg])
2227b8414663Smrg
222813e6bc1cSmrg# _AM_AUTOCONF_VERSION(VERSION)
222913e6bc1cSmrg# -----------------------------
223013e6bc1cSmrg# aclocal traces this macro to find the Autoconf version.
223113e6bc1cSmrg# This is a private macro too.  Using m4_define simplifies
223213e6bc1cSmrg# the logic in aclocal, which can simply ignore this definition.
223313e6bc1cSmrgm4_define([_AM_AUTOCONF_VERSION], [])
2234b8414663Smrg
223513e6bc1cSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
223613e6bc1cSmrg# -------------------------------
223713e6bc1cSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
223813e6bc1cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
223913e6bc1cSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
224013e6bc1cSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
224113e6bc1cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
224213e6bc1cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
224313e6bc1cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244765486e8Smrg
224513e6bc1cSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
224613e6bc1cSmrg
224713e6bc1cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248765486e8Smrg#
224913e6bc1cSmrg# This file is free software; the Free Software Foundation
225013e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
225113e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
225213e6bc1cSmrg
225313e6bc1cSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
225413e6bc1cSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
225513e6bc1cSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256765486e8Smrg#
225713e6bc1cSmrg# Of course, Automake must honor this variable whenever it calls a
225813e6bc1cSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
225913e6bc1cSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
226013e6bc1cSmrg# depending on how configure is run.  This is pretty annoying, since
226113e6bc1cSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
226213e6bc1cSmrg# source directory, any form will work fine, but in subdirectories a
226313e6bc1cSmrg# relative path needs to be adjusted first.
2264765486e8Smrg#
226513e6bc1cSmrg# $ac_aux_dir/missing
226613e6bc1cSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
226713e6bc1cSmrg# $top_srcdir/$ac_aux_dir/missing
226813e6bc1cSmrg#    fails if $ac_aux_dir is absolute,
226913e6bc1cSmrg#    fails when called from a subdirectory in a VPATH build with
227013e6bc1cSmrg#          a relative $ac_aux_dir
2271765486e8Smrg#
227213e6bc1cSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
227313e6bc1cSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
227413e6bc1cSmrg# harmless because $srcdir is '.', but things will broke when you
227513e6bc1cSmrg# start a VPATH build or use an absolute $srcdir.
2276765486e8Smrg#
227713e6bc1cSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
227813e6bc1cSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
227913e6bc1cSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
228013e6bc1cSmrg# and then we would define $MISSING as
228113e6bc1cSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
228213e6bc1cSmrg# This will work as long as MISSING is not called from configure, because
228313e6bc1cSmrg# unfortunately $(top_srcdir) has no meaning in configure.
228413e6bc1cSmrg# However there are other variables, like CC, which are often used in
228513e6bc1cSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286765486e8Smrg#
228713e6bc1cSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
228813e6bc1cSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
228913e6bc1cSmrg# configured tree to be moved without reconfiguration.
2290765486e8Smrg
229113e6bc1cSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
229213e6bc1cSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
229313e6bc1cSmrg# Expand $ac_aux_dir to an absolute path.
229413e6bc1cSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
229513e6bc1cSmrg])
229613e6bc1cSmrg
229713e6bc1cSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
229813e6bc1cSmrg
229913e6bc1cSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230013e6bc1cSmrg#
230113e6bc1cSmrg# This file is free software; the Free Software Foundation
230213e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
230313e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
230413e6bc1cSmrg
230513e6bc1cSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
230613e6bc1cSmrg# -------------------------------------
230713e6bc1cSmrg# Define a conditional.
230813e6bc1cSmrgAC_DEFUN([AM_CONDITIONAL],
230913e6bc1cSmrg[AC_PREREQ([2.52])dnl
231013e6bc1cSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
231113e6bc1cSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
231213e6bc1cSmrgAC_SUBST([$1_TRUE])dnl
231313e6bc1cSmrgAC_SUBST([$1_FALSE])dnl
231413e6bc1cSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
231513e6bc1cSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
231613e6bc1cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
231713e6bc1cSmrgif $2; then
231813e6bc1cSmrg  $1_TRUE=
231913e6bc1cSmrg  $1_FALSE='#'
2320765486e8Smrgelse
232113e6bc1cSmrg  $1_TRUE='#'
232213e6bc1cSmrg  $1_FALSE=
2323765486e8Smrgfi
232413e6bc1cSmrgAC_CONFIG_COMMANDS_PRE(
232513e6bc1cSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
232613e6bc1cSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
232713e6bc1cSmrgUsually this means the macro was only invoked conditionally.]])
232813e6bc1cSmrgfi])])
2329765486e8Smrg
233013e6bc1cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233113e6bc1cSmrg#
233213e6bc1cSmrg# This file is free software; the Free Software Foundation
233313e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
233413e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2335765486e8Smrg
2336765486e8Smrg
233713e6bc1cSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
233813e6bc1cSmrg# written in clear, in which case automake, when reading aclocal.m4,
233913e6bc1cSmrg# will think it sees a *use*, and therefore will trigger all it's
234013e6bc1cSmrg# C support machinery.  Also note that it means that autoscan, seeing
234113e6bc1cSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2342765486e8Smrg
234313e6bc1cSmrg
234413e6bc1cSmrg# _AM_DEPENDENCIES(NAME)
234513e6bc1cSmrg# ----------------------
234613e6bc1cSmrg# See how the compiler implements dependency checking.
234713e6bc1cSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
234813e6bc1cSmrg# We try a few techniques and use that to set a single cache variable.
2349765486e8Smrg#
235013e6bc1cSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
235113e6bc1cSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
235213e6bc1cSmrg# dependency, and given that the user is not expected to run this macro,
235313e6bc1cSmrg# just rely on AC_PROG_CC.
235413e6bc1cSmrgAC_DEFUN([_AM_DEPENDENCIES],
235513e6bc1cSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
235613e6bc1cSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
235713e6bc1cSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
235813e6bc1cSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359765486e8Smrg
236013e6bc1cSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
236113e6bc1cSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
236213e6bc1cSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
236313e6bc1cSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
236413e6bc1cSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
236513e6bc1cSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
236613e6bc1cSmrg                    [depcc="$$1"   am_compiler_list=])
2367bda5b58fSmrg
236813e6bc1cSmrgAC_CACHE_CHECK([dependency style of $depcc],
236913e6bc1cSmrg               [am_cv_$1_dependencies_compiler_type],
237013e6bc1cSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
237113e6bc1cSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
237213e6bc1cSmrg  # making bogus files that we don't know about and never remove.  For
237313e6bc1cSmrg  # instance it was reported that on HP-UX the gcc test will end up
237413e6bc1cSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
237513e6bc1cSmrg  # in D".
237613e6bc1cSmrg  rm -rf conftest.dir
237713e6bc1cSmrg  mkdir conftest.dir
237813e6bc1cSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
237913e6bc1cSmrg  # using a relative directory.
238013e6bc1cSmrg  cp "$am_depcomp" conftest.dir
238113e6bc1cSmrg  cd conftest.dir
238213e6bc1cSmrg  # We will build objects and dependencies in a subdirectory because
238313e6bc1cSmrg  # it helps to detect inapplicable dependency modes.  For instance
238413e6bc1cSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
238513e6bc1cSmrg  # side effect of compilation, but ICC will put the dependencies in
238613e6bc1cSmrg  # the current directory while Tru64 will put them in the object
238713e6bc1cSmrg  # directory.
238813e6bc1cSmrg  mkdir sub
2389765486e8Smrg
239013e6bc1cSmrg  am_cv_$1_dependencies_compiler_type=none
239113e6bc1cSmrg  if test "$am_compiler_list" = ""; then
239213e6bc1cSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
239313e6bc1cSmrg  fi
239413e6bc1cSmrg  am__universal=false
239513e6bc1cSmrg  m4_case([$1], [CC],
239613e6bc1cSmrg    [case " $depcc " in #(
239713e6bc1cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
239813e6bc1cSmrg     esac],
239913e6bc1cSmrg    [CXX],
240013e6bc1cSmrg    [case " $depcc " in #(
240113e6bc1cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
240213e6bc1cSmrg     esac])
2403b8414663Smrg
240413e6bc1cSmrg  for depmode in $am_compiler_list; do
240513e6bc1cSmrg    # Setup a source with many dependencies, because some compilers
240613e6bc1cSmrg    # like to wrap large dependency lists on column 80 (with \), and
240713e6bc1cSmrg    # we should not choose a depcomp mode which is confused by this.
240813e6bc1cSmrg    #
240913e6bc1cSmrg    # We need to recreate these files for each test, as the compiler may
241013e6bc1cSmrg    # overwrite some of them when testing with obscure command lines.
241113e6bc1cSmrg    # This happens at least with the AIX C compiler.
241213e6bc1cSmrg    : > sub/conftest.c
241313e6bc1cSmrg    for i in 1 2 3 4 5 6; do
241413e6bc1cSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
241513e6bc1cSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
241613e6bc1cSmrg      # Solaris 10 /bin/sh.
241713e6bc1cSmrg      echo '/* dummy */' > sub/conftst$i.h
241813e6bc1cSmrg    done
241913e6bc1cSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2420b8414663Smrg
242113e6bc1cSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
242213e6bc1cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
242313e6bc1cSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
242413e6bc1cSmrg    # versions had trouble with output in subdirs.
242513e6bc1cSmrg    am__obj=sub/conftest.${OBJEXT-o}
242613e6bc1cSmrg    am__minus_obj="-o $am__obj"
242713e6bc1cSmrg    case $depmode in
242813e6bc1cSmrg    gcc)
242913e6bc1cSmrg      # This depmode causes a compiler race in universal mode.
243013e6bc1cSmrg      test "$am__universal" = false || continue
243113e6bc1cSmrg      ;;
243213e6bc1cSmrg    nosideeffect)
243313e6bc1cSmrg      # After this tag, mechanisms are not by side-effect, so they'll
243413e6bc1cSmrg      # only be used when explicitly requested.
243513e6bc1cSmrg      if test "x$enable_dependency_tracking" = xyes; then
243613e6bc1cSmrg	continue
243713e6bc1cSmrg      else
243813e6bc1cSmrg	break
243913e6bc1cSmrg      fi
244013e6bc1cSmrg      ;;
244113e6bc1cSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
244213e6bc1cSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
244313e6bc1cSmrg      # not run yet.  These depmodes are late enough in the game, and
244413e6bc1cSmrg      # so weak that their functioning should not be impacted.
244513e6bc1cSmrg      am__obj=conftest.${OBJEXT-o}
244613e6bc1cSmrg      am__minus_obj=
244713e6bc1cSmrg      ;;
244813e6bc1cSmrg    none) break ;;
244913e6bc1cSmrg    esac
245013e6bc1cSmrg    if depmode=$depmode \
245113e6bc1cSmrg       source=sub/conftest.c object=$am__obj \
245213e6bc1cSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
245313e6bc1cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
245413e6bc1cSmrg         >/dev/null 2>conftest.err &&
245513e6bc1cSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
245613e6bc1cSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
245713e6bc1cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
245813e6bc1cSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
245913e6bc1cSmrg      # icc doesn't choke on unknown options, it will just issue warnings
246013e6bc1cSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
246113e6bc1cSmrg      # that says an option was ignored or not supported.
246213e6bc1cSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
246313e6bc1cSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
246413e6bc1cSmrg      # The diagnosis changed in icc 8.0:
246513e6bc1cSmrg      #   icc: Command line remark: option '-MP' not supported
246613e6bc1cSmrg      if (grep 'ignoring option' conftest.err ||
246713e6bc1cSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
246813e6bc1cSmrg        am_cv_$1_dependencies_compiler_type=$depmode
246913e6bc1cSmrg        break
247013e6bc1cSmrg      fi
247113e6bc1cSmrg    fi
247213e6bc1cSmrg  done
2473765486e8Smrg
247413e6bc1cSmrg  cd ..
247513e6bc1cSmrg  rm -rf conftest.dir
2476765486e8Smrgelse
247713e6bc1cSmrg  am_cv_$1_dependencies_compiler_type=none
2478765486e8Smrgfi
247913e6bc1cSmrg])
248013e6bc1cSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
248113e6bc1cSmrgAM_CONDITIONAL([am__fastdep$1], [
248213e6bc1cSmrg  test "x$enable_dependency_tracking" != xno \
248313e6bc1cSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
248413e6bc1cSmrg])
2485765486e8Smrg
2486765486e8Smrg
248713e6bc1cSmrg# AM_SET_DEPDIR
248813e6bc1cSmrg# -------------
248913e6bc1cSmrg# Choose a directory name for dependency files.
249013e6bc1cSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
249113e6bc1cSmrgAC_DEFUN([AM_SET_DEPDIR],
249213e6bc1cSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
249313e6bc1cSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
249413e6bc1cSmrg])
249513e6bc1cSmrg
249613e6bc1cSmrg
249713e6bc1cSmrg# AM_DEP_TRACK
249813e6bc1cSmrg# ------------
249913e6bc1cSmrgAC_DEFUN([AM_DEP_TRACK],
250013e6bc1cSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
250113e6bc1cSmrgAS_HELP_STRING(
250213e6bc1cSmrg  [--enable-dependency-tracking],
250313e6bc1cSmrg  [do not reject slow dependency extractors])
250413e6bc1cSmrgAS_HELP_STRING(
250513e6bc1cSmrg  [--disable-dependency-tracking],
250613e6bc1cSmrg  [speeds up one-time build])])
250713e6bc1cSmrgif test "x$enable_dependency_tracking" != xno; then
250813e6bc1cSmrg  am_depcomp="$ac_aux_dir/depcomp"
250913e6bc1cSmrg  AMDEPBACKSLASH='\'
251013e6bc1cSmrg  am__nodep='_no'
251113e6bc1cSmrgfi
251213e6bc1cSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
251313e6bc1cSmrgAC_SUBST([AMDEPBACKSLASH])dnl
251413e6bc1cSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
251513e6bc1cSmrgAC_SUBST([am__nodep])dnl
251613e6bc1cSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
251713e6bc1cSmrg])
2518765486e8Smrg
251913e6bc1cSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2520765486e8Smrg
252113e6bc1cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2522bda5b58fSmrg#
252313e6bc1cSmrg# This file is free software; the Free Software Foundation
252413e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
252513e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2526bda5b58fSmrg
2527bda5b58fSmrg
252813e6bc1cSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
252913e6bc1cSmrg# ------------------------------
253013e6bc1cSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
253113e6bc1cSmrg[{
253213e6bc1cSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
253313e6bc1cSmrg  # are listed without --file.  Let's play safe and only enable the eval
253413e6bc1cSmrg  # if we detect the quoting.
253513e6bc1cSmrg  case $CONFIG_FILES in
253613e6bc1cSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
253713e6bc1cSmrg  *)   set x $CONFIG_FILES ;;
253813e6bc1cSmrg  esac
253913e6bc1cSmrg  shift
254013e6bc1cSmrg  for mf
254113e6bc1cSmrg  do
254213e6bc1cSmrg    # Strip MF so we end up with the name of the file.
254313e6bc1cSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
254413e6bc1cSmrg    # Check whether this is an Automake generated Makefile or not.
254513e6bc1cSmrg    # We used to match only the files named 'Makefile.in', but
254613e6bc1cSmrg    # some people rename them; so instead we look at the file content.
254713e6bc1cSmrg    # Grep'ing the first line is not enough: some people post-process
254813e6bc1cSmrg    # each Makefile.in and add a new line on top of each file to say so.
254913e6bc1cSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
255013e6bc1cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
255113e6bc1cSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
255213e6bc1cSmrg      dirpart=`AS_DIRNAME("$mf")`
255313e6bc1cSmrg    else
255413e6bc1cSmrg      continue
255513e6bc1cSmrg    fi
255613e6bc1cSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
255713e6bc1cSmrg    # from the Makefile without running 'make'.
255813e6bc1cSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
255913e6bc1cSmrg    test -z "$DEPDIR" && continue
256013e6bc1cSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
256113e6bc1cSmrg    test -z "$am__include" && continue
256213e6bc1cSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
256313e6bc1cSmrg    # Find all dependency output files, they are included files with
256413e6bc1cSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
256513e6bc1cSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
256613e6bc1cSmrg    # expansion.
256713e6bc1cSmrg    for file in `sed -n "
256813e6bc1cSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
256913e6bc1cSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
257013e6bc1cSmrg      # Make sure the directory exists.
257113e6bc1cSmrg      test -f "$dirpart/$file" && continue
257213e6bc1cSmrg      fdir=`AS_DIRNAME(["$file"])`
257313e6bc1cSmrg      AS_MKDIR_P([$dirpart/$fdir])
257413e6bc1cSmrg      # echo "creating $dirpart/$file"
257513e6bc1cSmrg      echo '# dummy' > "$dirpart/$file"
257613e6bc1cSmrg    done
257713e6bc1cSmrg  done
257813e6bc1cSmrg}
257913e6bc1cSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
258013e6bc1cSmrg
258113e6bc1cSmrg
258213e6bc1cSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
258313e6bc1cSmrg# -----------------------------
258413e6bc1cSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2585bda5b58fSmrg#
258613e6bc1cSmrg# This code is only required when automatic dependency tracking
258713e6bc1cSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
258813e6bc1cSmrg# need in order to bootstrap the dependency handling code.
258913e6bc1cSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
259013e6bc1cSmrg[AC_CONFIG_COMMANDS([depfiles],
259113e6bc1cSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
259213e6bc1cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
259313e6bc1cSmrg])
259413e6bc1cSmrg
259513e6bc1cSmrg# Do all the work for Automake.                             -*- Autoconf -*-
259613e6bc1cSmrg
259713e6bc1cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
2598bda5b58fSmrg#
259913e6bc1cSmrg# This file is free software; the Free Software Foundation
260013e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
260113e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2602bda5b58fSmrg
260313e6bc1cSmrg# This macro actually does too much.  Some checks are only needed if
260413e6bc1cSmrg# your package does certain things.  But this isn't really a big deal.
2605bda5b58fSmrg
260613e6bc1cSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
260713e6bc1cSmrgm4_define([AC_PROG_CC],
260813e6bc1cSmrgm4_defn([AC_PROG_CC])
260913e6bc1cSmrg[_AM_PROG_CC_C_O
261013e6bc1cSmrg])
2611bda5b58fSmrg
261213e6bc1cSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
261313e6bc1cSmrg# AM_INIT_AUTOMAKE([OPTIONS])
261413e6bc1cSmrg# -----------------------------------------------
261513e6bc1cSmrg# The call with PACKAGE and VERSION arguments is the old style
261613e6bc1cSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
261713e6bc1cSmrg# and VERSION should now be passed to AC_INIT and removed from
261813e6bc1cSmrg# the call to AM_INIT_AUTOMAKE.
261913e6bc1cSmrg# We support both call styles for the transition.  After
262013e6bc1cSmrg# the next Automake release, Autoconf can make the AC_INIT
262113e6bc1cSmrg# arguments mandatory, and then we can depend on a new Autoconf
262213e6bc1cSmrg# release and drop the old call support.
262313e6bc1cSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
262413e6bc1cSmrg[AC_PREREQ([2.65])dnl
262513e6bc1cSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
262613e6bc1cSmrgdnl the ones we care about.
262713e6bc1cSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
262813e6bc1cSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
262913e6bc1cSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
263013e6bc1cSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
263113e6bc1cSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
263213e6bc1cSmrg  # is not polluted with repeated "-I."
263313e6bc1cSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
263413e6bc1cSmrg  # test to see if srcdir already configured
263513e6bc1cSmrg  if test -f $srcdir/config.status; then
263613e6bc1cSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637bda5b58fSmrg  fi
2638bda5b58fSmrgfi
2639bda5b58fSmrg
264013e6bc1cSmrg# test whether we have cygpath
264113e6bc1cSmrgif test -z "$CYGPATH_W"; then
264213e6bc1cSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
264313e6bc1cSmrg    CYGPATH_W='cygpath -w'
264413e6bc1cSmrg  else
264513e6bc1cSmrg    CYGPATH_W=echo
2646bda5b58fSmrg  fi
2647bda5b58fSmrgfi
264813e6bc1cSmrgAC_SUBST([CYGPATH_W])
2649bda5b58fSmrg
265013e6bc1cSmrg# Define the identity of the package.
265113e6bc1cSmrgdnl Distinguish between old-style and new-style calls.
265213e6bc1cSmrgm4_ifval([$2],
265313e6bc1cSmrg[AC_DIAGNOSE([obsolete],
265413e6bc1cSmrg             [$0: two- and three-arguments forms are deprecated.])
265513e6bc1cSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
265613e6bc1cSmrg AC_SUBST([PACKAGE], [$1])dnl
265713e6bc1cSmrg AC_SUBST([VERSION], [$2])],
265813e6bc1cSmrg[_AM_SET_OPTIONS([$1])dnl
265913e6bc1cSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
266013e6bc1cSmrgm4_if(
266113e6bc1cSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
266213e6bc1cSmrg  [ok:ok],,
266313e6bc1cSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
266413e6bc1cSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
266513e6bc1cSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666bda5b58fSmrg
266713e6bc1cSmrg_AM_IF_OPTION([no-define],,
266813e6bc1cSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
266913e6bc1cSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670bda5b58fSmrg
267113e6bc1cSmrg# Some tools Automake needs.
267213e6bc1cSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
267313e6bc1cSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
267413e6bc1cSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
267513e6bc1cSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
267613e6bc1cSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
267713e6bc1cSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
267813e6bc1cSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
267913e6bc1cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
268013e6bc1cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
268113e6bc1cSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
268213e6bc1cSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
268313e6bc1cSmrg# dies out for good.  For more background, see:
268413e6bc1cSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
268513e6bc1cSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
268613e6bc1cSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
268713e6bc1cSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
268813e6bc1cSmrg# system "awk" is bad on some platforms.
268913e6bc1cSmrgAC_REQUIRE([AC_PROG_AWK])dnl
269013e6bc1cSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
269113e6bc1cSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
269213e6bc1cSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
269313e6bc1cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
269413e6bc1cSmrg			     [_AM_PROG_TAR([v7])])])
269513e6bc1cSmrg_AM_IF_OPTION([no-dependencies],,
269613e6bc1cSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
269713e6bc1cSmrg		  [_AM_DEPENDENCIES([CC])],
269813e6bc1cSmrg		  [m4_define([AC_PROG_CC],
269913e6bc1cSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
270013e6bc1cSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
270113e6bc1cSmrg		  [_AM_DEPENDENCIES([CXX])],
270213e6bc1cSmrg		  [m4_define([AC_PROG_CXX],
270313e6bc1cSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
270413e6bc1cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
270513e6bc1cSmrg		  [_AM_DEPENDENCIES([OBJC])],
270613e6bc1cSmrg		  [m4_define([AC_PROG_OBJC],
270713e6bc1cSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
270813e6bc1cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
270913e6bc1cSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
271013e6bc1cSmrg		  [m4_define([AC_PROG_OBJCXX],
271113e6bc1cSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
271213e6bc1cSmrg])
271313e6bc1cSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
271413e6bc1cSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
271513e6bc1cSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
271613e6bc1cSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
271713e6bc1cSmrgAC_CONFIG_COMMANDS_PRE(dnl
271813e6bc1cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
271913e6bc1cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720bda5b58fSmrg
272113e6bc1cSmrg# POSIX will say in a future version that running "rm -f" with no argument
272213e6bc1cSmrg# is OK; and we want to be able to make that assumption in our Makefile
272313e6bc1cSmrg# recipes.  So use an aggressive probe to check that the usage we want is
272413e6bc1cSmrg# actually supported "in the wild" to an acceptable degree.
272513e6bc1cSmrg# See automake bug#10828.
272613e6bc1cSmrg# To make any issue more visible, cause the running configure to be aborted
272713e6bc1cSmrg# by default if the 'rm' program in use doesn't match our expectations; the
272813e6bc1cSmrg# user can still override this though.
272913e6bc1cSmrgif rm -f && rm -fr && rm -rf; then : OK; else
273013e6bc1cSmrg  cat >&2 <<'END'
273113e6bc1cSmrgOops!
2732bda5b58fSmrg
273313e6bc1cSmrgYour 'rm' program seems unable to run without file operands specified
273413e6bc1cSmrgon the command line, even when the '-f' option is present.  This is contrary
273513e6bc1cSmrgto the behaviour of most rm programs out there, and not conforming with
273613e6bc1cSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737bda5b58fSmrg
273813e6bc1cSmrgPlease tell bug-automake@gnu.org about your system, including the value
273913e6bc1cSmrgof your $PATH and any error possibly output before this message.  This
274013e6bc1cSmrgcan help us improve future automake versions.
2741bda5b58fSmrg
274213e6bc1cSmrgEND
274313e6bc1cSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
274413e6bc1cSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
274513e6bc1cSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
274613e6bc1cSmrg    echo >&2
274713e6bc1cSmrg  else
274813e6bc1cSmrg    cat >&2 <<'END'
274913e6bc1cSmrgAborting the configuration process, to ensure you take notice of the issue.
2750bda5b58fSmrg
275113e6bc1cSmrgYou can download and install GNU coreutils to get an 'rm' implementation
275213e6bc1cSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753bda5b58fSmrg
275413e6bc1cSmrgIf you want to complete the configuration process using your problematic
275513e6bc1cSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
275613e6bc1cSmrgto "yes", and re-run configure.
27577d5e3a19Smrg
275813e6bc1cSmrgEND
275913e6bc1cSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
276013e6bc1cSmrg  fi
27617d5e3a19Smrgfi
276213e6bc1cSmrgdnl The trailing newline in this macro's definition is deliberate, for
276313e6bc1cSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
276413e6bc1cSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
276513e6bc1cSmrg])
27667d5e3a19Smrg
276713e6bc1cSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
276813e6bc1cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
276913e6bc1cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
277013e6bc1cSmrgm4_define([_AC_COMPILER_EXEEXT],
277113e6bc1cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27727d5e3a19Smrg
277313e6bc1cSmrg# When config.status generates a header, we must update the stamp-h file.
277413e6bc1cSmrg# This file resides in the same directory as the config header
277513e6bc1cSmrg# that is generated.  The stamp files are numbered to have different names.
27767d5e3a19Smrg
277713e6bc1cSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
277813e6bc1cSmrg# loop where config.status creates the headers, so we can generate
277913e6bc1cSmrg# our stamp files there.
278013e6bc1cSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
278113e6bc1cSmrg[# Compute $1's index in $config_headers.
278213e6bc1cSmrg_am_arg=$1
278313e6bc1cSmrg_am_stamp_count=1
278413e6bc1cSmrgfor _am_header in $config_headers :; do
278513e6bc1cSmrg  case $_am_header in
278613e6bc1cSmrg    $_am_arg | $_am_arg:* )
278713e6bc1cSmrg      break ;;
278813e6bc1cSmrg    * )
278913e6bc1cSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
279013e6bc1cSmrg  esac
279113e6bc1cSmrgdone
279213e6bc1cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
279313e6bc1cSmrg
279413e6bc1cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27957d5e3a19Smrg#
279613e6bc1cSmrg# This file is free software; the Free Software Foundation
279713e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
279813e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
27997d5e3a19Smrg
280013e6bc1cSmrg# AM_PROG_INSTALL_SH
280113e6bc1cSmrg# ------------------
280213e6bc1cSmrg# Define $install_sh.
280313e6bc1cSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
280413e6bc1cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
280513e6bc1cSmrgif test x"${install_sh+set}" != xset; then
280613e6bc1cSmrg  case $am_aux_dir in
280713e6bc1cSmrg  *\ * | *\	*)
280813e6bc1cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
280913e6bc1cSmrg  *)
281013e6bc1cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
281113e6bc1cSmrg  esac
281213e6bc1cSmrgfi
281313e6bc1cSmrgAC_SUBST([install_sh])])
2814765486e8Smrg
281513e6bc1cSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
281613e6bc1cSmrg#
281713e6bc1cSmrg# This file is free software; the Free Software Foundation
281813e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
281913e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2820765486e8Smrg
282113e6bc1cSmrg# Check whether the underlying file-system supports filenames
282213e6bc1cSmrg# with a leading dot.  For instance MS-DOS doesn't.
282313e6bc1cSmrgAC_DEFUN([AM_SET_LEADING_DOT],
282413e6bc1cSmrg[rm -rf .tst 2>/dev/null
282513e6bc1cSmrgmkdir .tst 2>/dev/null
282613e6bc1cSmrgif test -d .tst; then
282713e6bc1cSmrg  am__leading_dot=.
28287d5e3a19Smrgelse
282913e6bc1cSmrg  am__leading_dot=_
28307d5e3a19Smrgfi
283113e6bc1cSmrgrmdir .tst 2>/dev/null
283213e6bc1cSmrgAC_SUBST([am__leading_dot])])
28337d5e3a19Smrg
283413e6bc1cSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
28357d5e3a19Smrg
283613e6bc1cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2837765486e8Smrg#
283813e6bc1cSmrg# This file is free software; the Free Software Foundation
283913e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
284013e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2841765486e8Smrg
284213e6bc1cSmrg# AM_MAKE_INCLUDE()
284313e6bc1cSmrg# -----------------
284413e6bc1cSmrg# Check to see how make treats includes.
284513e6bc1cSmrgAC_DEFUN([AM_MAKE_INCLUDE],
284613e6bc1cSmrg[am_make=${MAKE-make}
284713e6bc1cSmrgcat > confinc << 'END'
284813e6bc1cSmrgam__doit:
284913e6bc1cSmrg	@echo this is the am__doit target
285013e6bc1cSmrg.PHONY: am__doit
285113e6bc1cSmrgEND
285213e6bc1cSmrg# If we don't find an include directive, just comment out the code.
285313e6bc1cSmrgAC_MSG_CHECKING([for style of include used by $am_make])
285413e6bc1cSmrgam__include="#"
285513e6bc1cSmrgam__quote=
285613e6bc1cSmrg_am_result=none
285713e6bc1cSmrg# First try GNU make style include.
285813e6bc1cSmrgecho "include confinc" > confmf
285913e6bc1cSmrg# Ignore all kinds of additional output from 'make'.
286013e6bc1cSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
286113e6bc1cSmrg*the\ am__doit\ target*)
286213e6bc1cSmrg  am__include=include
286313e6bc1cSmrg  am__quote=
286413e6bc1cSmrg  _am_result=GNU
286513e6bc1cSmrg  ;;
286613e6bc1cSmrgesac
286713e6bc1cSmrg# Now try BSD make style include.
286813e6bc1cSmrgif test "$am__include" = "#"; then
286913e6bc1cSmrg   echo '.include "confinc"' > confmf
287013e6bc1cSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
287113e6bc1cSmrg   *the\ am__doit\ target*)
287213e6bc1cSmrg     am__include=.include
287313e6bc1cSmrg     am__quote="\""
287413e6bc1cSmrg     _am_result=BSD
287513e6bc1cSmrg     ;;
287613e6bc1cSmrg   esac
28777d5e3a19Smrgfi
287813e6bc1cSmrgAC_SUBST([am__include])
287913e6bc1cSmrgAC_SUBST([am__quote])
288013e6bc1cSmrgAC_MSG_RESULT([$_am_result])
288113e6bc1cSmrgrm -f confinc confmf
288213e6bc1cSmrg])
2883765486e8Smrg
288413e6bc1cSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885bda5b58fSmrg
288613e6bc1cSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887bda5b58fSmrg#
288813e6bc1cSmrg# This file is free software; the Free Software Foundation
288913e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
289013e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2891bda5b58fSmrg
289213e6bc1cSmrg# AM_MISSING_PROG(NAME, PROGRAM)
289313e6bc1cSmrg# ------------------------------
289413e6bc1cSmrgAC_DEFUN([AM_MISSING_PROG],
289513e6bc1cSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
289613e6bc1cSmrg$1=${$1-"${am_missing_run}$2"}
289713e6bc1cSmrgAC_SUBST($1)])
2898bda5b58fSmrg
289913e6bc1cSmrg# AM_MISSING_HAS_RUN
290013e6bc1cSmrg# ------------------
290113e6bc1cSmrg# Define MISSING if not defined so far and test if it is modern enough.
290213e6bc1cSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
290313e6bc1cSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
290413e6bc1cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
290513e6bc1cSmrgAC_REQUIRE_AUX_FILE([missing])dnl
290613e6bc1cSmrgif test x"${MISSING+set}" != xset; then
290713e6bc1cSmrg  case $am_aux_dir in
290813e6bc1cSmrg  *\ * | *\	*)
290913e6bc1cSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
291013e6bc1cSmrg  *)
291113e6bc1cSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
291213e6bc1cSmrg  esac
2913bda5b58fSmrgfi
291413e6bc1cSmrg# Use eval to expand $SHELL
291513e6bc1cSmrgif eval "$MISSING --is-lightweight"; then
291613e6bc1cSmrg  am_missing_run="$MISSING "
291713e6bc1cSmrgelse
291813e6bc1cSmrg  am_missing_run=
291913e6bc1cSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2920bda5b58fSmrgfi
292113e6bc1cSmrg])
2922bda5b58fSmrg
292313e6bc1cSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2924bda5b58fSmrg
292513e6bc1cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292613e6bc1cSmrg#
292713e6bc1cSmrg# This file is free software; the Free Software Foundation
292813e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
292913e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2930bda5b58fSmrg
293113e6bc1cSmrg# _AM_MANGLE_OPTION(NAME)
293213e6bc1cSmrg# -----------------------
293313e6bc1cSmrgAC_DEFUN([_AM_MANGLE_OPTION],
293413e6bc1cSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935bda5b58fSmrg
293613e6bc1cSmrg# _AM_SET_OPTION(NAME)
293713e6bc1cSmrg# --------------------
293813e6bc1cSmrg# Set option NAME.  Presently that only means defining a flag for this option.
293913e6bc1cSmrgAC_DEFUN([_AM_SET_OPTION],
294013e6bc1cSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941bda5b58fSmrg
294213e6bc1cSmrg# _AM_SET_OPTIONS(OPTIONS)
294313e6bc1cSmrg# ------------------------
294413e6bc1cSmrg# OPTIONS is a space-separated list of Automake options.
294513e6bc1cSmrgAC_DEFUN([_AM_SET_OPTIONS],
294613e6bc1cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947bda5b58fSmrg
294813e6bc1cSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
294913e6bc1cSmrg# -------------------------------------------
295013e6bc1cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
295113e6bc1cSmrgAC_DEFUN([_AM_IF_OPTION],
295213e6bc1cSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953bda5b58fSmrg
295413e6bc1cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955bda5b58fSmrg#
295613e6bc1cSmrg# This file is free software; the Free Software Foundation
295713e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
295813e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
2959bda5b58fSmrg
296013e6bc1cSmrg# _AM_PROG_CC_C_O
296113e6bc1cSmrg# ---------------
296213e6bc1cSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
296313e6bc1cSmrg# to automatically call this.
296413e6bc1cSmrgAC_DEFUN([_AM_PROG_CC_C_O],
296513e6bc1cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
296613e6bc1cSmrgAC_REQUIRE_AUX_FILE([compile])dnl
296713e6bc1cSmrgAC_LANG_PUSH([C])dnl
296813e6bc1cSmrgAC_CACHE_CHECK(
296913e6bc1cSmrg  [whether $CC understands -c and -o together],
297013e6bc1cSmrg  [am_cv_prog_cc_c_o],
297113e6bc1cSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
297213e6bc1cSmrg  # Make sure it works both with $CC and with simple cc.
297313e6bc1cSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
297413e6bc1cSmrg  # compilers refuse to overwrite an existing .o file with -o,
297513e6bc1cSmrg  # though they will create one.
297613e6bc1cSmrg  am_cv_prog_cc_c_o=yes
297713e6bc1cSmrg  for am_i in 1 2; do
297813e6bc1cSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
297913e6bc1cSmrg         && test -f conftest2.$ac_objext; then
298013e6bc1cSmrg      : OK
298113e6bc1cSmrg    else
298213e6bc1cSmrg      am_cv_prog_cc_c_o=no
298313e6bc1cSmrg      break
298413e6bc1cSmrg    fi
298513e6bc1cSmrg  done
298613e6bc1cSmrg  rm -f core conftest*
298713e6bc1cSmrg  unset am_i])
298813e6bc1cSmrgif test "$am_cv_prog_cc_c_o" != yes; then
298913e6bc1cSmrg   # Losing compiler, so override with the script.
299013e6bc1cSmrg   # FIXME: It is wrong to rewrite CC.
299113e6bc1cSmrg   # But if we don't then we get into trouble of one sort or another.
299213e6bc1cSmrg   # A longer-term fix would be to have automake use am__CC in this case,
299313e6bc1cSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
299413e6bc1cSmrg   CC="$am_aux_dir/compile $CC"
2995bda5b58fSmrgfi
299613e6bc1cSmrgAC_LANG_POP([C])])
2997bda5b58fSmrg
299813e6bc1cSmrg# For backward compatibility.
299913e6bc1cSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
300013e6bc1cSmrg
300113e6bc1cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
300213e6bc1cSmrg#
300313e6bc1cSmrg# This file is free software; the Free Software Foundation
300413e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
300513e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
300613e6bc1cSmrg
300713e6bc1cSmrg# AM_RUN_LOG(COMMAND)
300813e6bc1cSmrg# -------------------
300913e6bc1cSmrg# Run COMMAND, save the exit status in ac_status, and log it.
301013e6bc1cSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
301113e6bc1cSmrgAC_DEFUN([AM_RUN_LOG],
301213e6bc1cSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
301313e6bc1cSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
301413e6bc1cSmrg   ac_status=$?
301513e6bc1cSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
301613e6bc1cSmrg   (exit $ac_status); }])
3017bda5b58fSmrg
301813e6bc1cSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019bda5b58fSmrg
302013e6bc1cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
302113e6bc1cSmrg#
302213e6bc1cSmrg# This file is free software; the Free Software Foundation
302313e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
302413e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
3025bda5b58fSmrg
302613e6bc1cSmrg# AM_SANITY_CHECK
302713e6bc1cSmrg# ---------------
302813e6bc1cSmrgAC_DEFUN([AM_SANITY_CHECK],
302913e6bc1cSmrg[AC_MSG_CHECKING([whether build environment is sane])
303013e6bc1cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
303113e6bc1cSmrg# name.  Accept space and tab only in the latter.
303213e6bc1cSmrgam_lf='
303313e6bc1cSmrg'
303413e6bc1cSmrgcase `pwd` in
303513e6bc1cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
303613e6bc1cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
303713e6bc1cSmrgesac
303813e6bc1cSmrgcase $srcdir in
303913e6bc1cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
304013e6bc1cSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
304113e6bc1cSmrgesac
3042bda5b58fSmrg
304313e6bc1cSmrg# Do 'set' in a subshell so we don't clobber the current shell's
304413e6bc1cSmrg# arguments.  Must try -L first in case configure is actually a
304513e6bc1cSmrg# symlink; some systems play weird games with the mod time of symlinks
304613e6bc1cSmrg# (eg FreeBSD returns the mod time of the symlink's containing
304713e6bc1cSmrg# directory).
304813e6bc1cSmrgif (
304913e6bc1cSmrg   am_has_slept=no
305013e6bc1cSmrg   for am_try in 1 2; do
305113e6bc1cSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
305213e6bc1cSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
305313e6bc1cSmrg     if test "$[*]" = "X"; then
305413e6bc1cSmrg	# -L didn't work.
305513e6bc1cSmrg	set X `ls -t "$srcdir/configure" conftest.file`
305613e6bc1cSmrg     fi
305713e6bc1cSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
305813e6bc1cSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059bda5b58fSmrg
306013e6bc1cSmrg	# If neither matched, then we have a broken ls.  This can happen
306113e6bc1cSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
306213e6bc1cSmrg	# broken ls alias from the environment.  This has actually
306313e6bc1cSmrg	# happened.  Such a system could not be considered "sane".
306413e6bc1cSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
306513e6bc1cSmrg  alias in your environment])
306613e6bc1cSmrg     fi
306713e6bc1cSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
306813e6bc1cSmrg       break
306913e6bc1cSmrg     fi
307013e6bc1cSmrg     # Just in case.
307113e6bc1cSmrg     sleep 1
307213e6bc1cSmrg     am_has_slept=yes
307313e6bc1cSmrg   done
307413e6bc1cSmrg   test "$[2]" = conftest.file
307513e6bc1cSmrg   )
307613e6bc1cSmrgthen
307713e6bc1cSmrg   # Ok.
307813e6bc1cSmrg   :
3079bda5b58fSmrgelse
308013e6bc1cSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
308113e6bc1cSmrgCheck your system clock])
3082bda5b58fSmrgfi
308313e6bc1cSmrgAC_MSG_RESULT([yes])
308413e6bc1cSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
308513e6bc1cSmrg# generated files are strictly newer.
308613e6bc1cSmrgam_sleep_pid=
308713e6bc1cSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
308813e6bc1cSmrg  ( sleep 1 ) &
308913e6bc1cSmrg  am_sleep_pid=$!
309013e6bc1cSmrgfi
309113e6bc1cSmrgAC_CONFIG_COMMANDS_PRE(
309213e6bc1cSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
309313e6bc1cSmrg   if test -n "$am_sleep_pid"; then
309413e6bc1cSmrg     # Hide warnings about reused PIDs.
309513e6bc1cSmrg     wait $am_sleep_pid 2>/dev/null
309613e6bc1cSmrg   fi
309713e6bc1cSmrg   AC_MSG_RESULT([done])])
309813e6bc1cSmrgrm -f conftest.file
309913e6bc1cSmrg])
3100bda5b58fSmrg
310113e6bc1cSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102bda5b58fSmrg#
310313e6bc1cSmrg# This file is free software; the Free Software Foundation
310413e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
310513e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
3106765486e8Smrg
310713e6bc1cSmrg# AM_SILENT_RULES([DEFAULT])
310813e6bc1cSmrg# --------------------------
310913e6bc1cSmrg# Enable less verbose build rules; with the default set to DEFAULT
311013e6bc1cSmrg# ("yes" being less verbose, "no" or empty being verbose).
311113e6bc1cSmrgAC_DEFUN([AM_SILENT_RULES],
311213e6bc1cSmrg[AC_ARG_ENABLE([silent-rules], [dnl
311313e6bc1cSmrgAS_HELP_STRING(
311413e6bc1cSmrg  [--enable-silent-rules],
311513e6bc1cSmrg  [less verbose build output (undo: "make V=1")])
311613e6bc1cSmrgAS_HELP_STRING(
311713e6bc1cSmrg  [--disable-silent-rules],
311813e6bc1cSmrg  [verbose build output (undo: "make V=0")])dnl
311913e6bc1cSmrg])
312013e6bc1cSmrgcase $enable_silent_rules in @%:@ (((
312113e6bc1cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
312213e6bc1cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
312313e6bc1cSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
312413e6bc1cSmrgesac
312513e6bc1cSmrgdnl
312613e6bc1cSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
312713e6bc1cSmrgdnl do not support nested variable expansions.
312813e6bc1cSmrgdnl See automake bug#9928 and bug#10237.
312913e6bc1cSmrgam_make=${MAKE-make}
313013e6bc1cSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
313113e6bc1cSmrg   [am_cv_make_support_nested_variables],
313213e6bc1cSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
313313e6bc1cSmrgBAR0=false
313413e6bc1cSmrgBAR1=true
313513e6bc1cSmrgV=1
313613e6bc1cSmrgam__doit:
313713e6bc1cSmrg	@$(TRUE)
313813e6bc1cSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
313913e6bc1cSmrg  am_cv_make_support_nested_variables=yes
314013e6bc1cSmrgelse
314113e6bc1cSmrg  am_cv_make_support_nested_variables=no
314213e6bc1cSmrgfi])
314313e6bc1cSmrgif test $am_cv_make_support_nested_variables = yes; then
314413e6bc1cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
314513e6bc1cSmrg  AM_V='$(V)'
314613e6bc1cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
314713e6bc1cSmrgelse
314813e6bc1cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
314913e6bc1cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
315013e6bc1cSmrgfi
315113e6bc1cSmrgAC_SUBST([AM_V])dnl
315213e6bc1cSmrgAM_SUBST_NOTMAKE([AM_V])dnl
315313e6bc1cSmrgAC_SUBST([AM_DEFAULT_V])dnl
315413e6bc1cSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
315513e6bc1cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
315613e6bc1cSmrgAM_BACKSLASH='\'
315713e6bc1cSmrgAC_SUBST([AM_BACKSLASH])dnl
315813e6bc1cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
315913e6bc1cSmrg])
316013e6bc1cSmrg
316113e6bc1cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162bda5b58fSmrg#
316313e6bc1cSmrg# This file is free software; the Free Software Foundation
316413e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
316513e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
316613e6bc1cSmrg
316713e6bc1cSmrg# AM_PROG_INSTALL_STRIP
316813e6bc1cSmrg# ---------------------
316913e6bc1cSmrg# One issue with vendor 'install' (even GNU) is that you can't
317013e6bc1cSmrg# specify the program used to strip binaries.  This is especially
317113e6bc1cSmrg# annoying in cross-compiling environments, where the build's strip
317213e6bc1cSmrg# is unlikely to handle the host's binaries.
317313e6bc1cSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
317413e6bc1cSmrg# always use install-sh in "make install-strip", and initialize
317513e6bc1cSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
317613e6bc1cSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
317713e6bc1cSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
317813e6bc1cSmrg# Installed binaries are usually stripped using 'strip' when the user
317913e6bc1cSmrg# run "make install-strip".  However 'strip' might not be the right
318013e6bc1cSmrg# tool to use in cross-compilation environments, therefore Automake
318113e6bc1cSmrg# will honor the 'STRIP' environment variable to overrule this program.
318213e6bc1cSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
318313e6bc1cSmrgif test "$cross_compiling" != no; then
318413e6bc1cSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
318513e6bc1cSmrgfi
318613e6bc1cSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
318713e6bc1cSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188765486e8Smrg
318913e6bc1cSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
319013e6bc1cSmrg#
319113e6bc1cSmrg# This file is free software; the Free Software Foundation
319213e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
319313e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
3194bda5b58fSmrg
319513e6bc1cSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
319613e6bc1cSmrg# ---------------------------
319713e6bc1cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
319813e6bc1cSmrg# This macro is traced by Automake.
319913e6bc1cSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200bda5b58fSmrg
320113e6bc1cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
320213e6bc1cSmrg# --------------------------
320313e6bc1cSmrg# Public sister of _AM_SUBST_NOTMAKE.
320413e6bc1cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205bda5b58fSmrg
320613e6bc1cSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3207bda5b58fSmrg
320813e6bc1cSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
320913e6bc1cSmrg#
321013e6bc1cSmrg# This file is free software; the Free Software Foundation
321113e6bc1cSmrg# gives unlimited permission to copy and/or distribute it,
321213e6bc1cSmrg# with or without modifications, as long as this notice is preserved.
3213765486e8Smrg
321413e6bc1cSmrg# _AM_PROG_TAR(FORMAT)
3215765486e8Smrg# --------------------
321613e6bc1cSmrg# Check how to create a tarball in format FORMAT.
321713e6bc1cSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218765486e8Smrg#
321913e6bc1cSmrg# Substitute a variable $(am__tar) that is a command
322013e6bc1cSmrg# writing to stdout a FORMAT-tarball containing the directory
322113e6bc1cSmrg# $tardir.
322213e6bc1cSmrg#     tardir=directory && $(am__tar) > result.tar
3223765486e8Smrg#
322413e6bc1cSmrg# Substitute a variable $(am__untar) that extract such
322513e6bc1cSmrg# a tarball read from stdin.
322613e6bc1cSmrg#     $(am__untar) < result.tar
3227765486e8Smrg#
322813e6bc1cSmrgAC_DEFUN([_AM_PROG_TAR],
322913e6bc1cSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
323013e6bc1cSmrg# in the wild :-(  We should find a proper way to deprecate it ...
323113e6bc1cSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32327d5e3a19Smrg
323313e6bc1cSmrg# We'll loop over all known methods to create a tar archive until one works.
323413e6bc1cSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235b8414663Smrg
323613e6bc1cSmrgm4_if([$1], [v7],
323713e6bc1cSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32387d5e3a19Smrg
323913e6bc1cSmrg  [m4_case([$1],
324013e6bc1cSmrg    [ustar],
324113e6bc1cSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
324213e6bc1cSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
324313e6bc1cSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
324413e6bc1cSmrg      # and bug#13588).
324513e6bc1cSmrg      am_max_uid=2097151 # 2^21 - 1
324613e6bc1cSmrg      am_max_gid=$am_max_uid
324713e6bc1cSmrg      # The $UID and $GID variables are not portable, so we need to resort
324813e6bc1cSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
324913e6bc1cSmrg      # below are definitely unexpected, so allow the users to see them
325013e6bc1cSmrg      # (that is, avoid stderr redirection).
325113e6bc1cSmrg      am_uid=`id -u || echo unknown`
325213e6bc1cSmrg      am_gid=`id -g || echo unknown`
325313e6bc1cSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
325413e6bc1cSmrg      if test $am_uid -le $am_max_uid; then
325513e6bc1cSmrg         AC_MSG_RESULT([yes])
325613e6bc1cSmrg      else
325713e6bc1cSmrg         AC_MSG_RESULT([no])
325813e6bc1cSmrg         _am_tools=none
325913e6bc1cSmrg      fi
326013e6bc1cSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
326113e6bc1cSmrg      if test $am_gid -le $am_max_gid; then
326213e6bc1cSmrg         AC_MSG_RESULT([yes])
326313e6bc1cSmrg      else
326413e6bc1cSmrg        AC_MSG_RESULT([no])
326513e6bc1cSmrg        _am_tools=none
326613e6bc1cSmrg      fi],
326713e6bc1cSmrg
326813e6bc1cSmrg  [pax],
326913e6bc1cSmrg    [],
327013e6bc1cSmrg
327113e6bc1cSmrg  [m4_fatal([Unknown tar format])])
327213e6bc1cSmrg
327313e6bc1cSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
327413e6bc1cSmrg
327513e6bc1cSmrg  # Go ahead even if we have the value already cached.  We do so because we
327613e6bc1cSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
327713e6bc1cSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
327813e6bc1cSmrg
327913e6bc1cSmrg  for _am_tool in $_am_tools; do
328013e6bc1cSmrg    case $_am_tool in
328113e6bc1cSmrg    gnutar)
328213e6bc1cSmrg      for _am_tar in tar gnutar gtar; do
328313e6bc1cSmrg        AM_RUN_LOG([$_am_tar --version]) && break
328413e6bc1cSmrg      done
328513e6bc1cSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
328613e6bc1cSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
328713e6bc1cSmrg      am__untar="$_am_tar -xf -"
328813e6bc1cSmrg      ;;
328913e6bc1cSmrg    plaintar)
329013e6bc1cSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
329113e6bc1cSmrg      # ustar tarball either.
329213e6bc1cSmrg      (tar --version) >/dev/null 2>&1 && continue
329313e6bc1cSmrg      am__tar='tar chf - "$$tardir"'
329413e6bc1cSmrg      am__tar_='tar chf - "$tardir"'
329513e6bc1cSmrg      am__untar='tar xf -'
329613e6bc1cSmrg      ;;
329713e6bc1cSmrg    pax)
329813e6bc1cSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
329913e6bc1cSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
330013e6bc1cSmrg      am__untar='pax -r'
330113e6bc1cSmrg      ;;
330213e6bc1cSmrg    cpio)
330313e6bc1cSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
330413e6bc1cSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
330513e6bc1cSmrg      am__untar='cpio -i -H $1 -d'
330613e6bc1cSmrg      ;;
330713e6bc1cSmrg    none)
330813e6bc1cSmrg      am__tar=false
330913e6bc1cSmrg      am__tar_=false
331013e6bc1cSmrg      am__untar=false
331113e6bc1cSmrg      ;;
331213e6bc1cSmrg    esac
331313e6bc1cSmrg
331413e6bc1cSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
331513e6bc1cSmrg    # and am__untar set.
331613e6bc1cSmrg    test -n "${am_cv_prog_tar_$1}" && break
331713e6bc1cSmrg
331813e6bc1cSmrg    # tar/untar a dummy directory, and stop if the command works.
331913e6bc1cSmrg    rm -rf conftest.dir
332013e6bc1cSmrg    mkdir conftest.dir
332113e6bc1cSmrg    echo GrepMe > conftest.dir/file
332213e6bc1cSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
332313e6bc1cSmrg    rm -rf conftest.dir
332413e6bc1cSmrg    if test -s conftest.tar; then
332513e6bc1cSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
332613e6bc1cSmrg      AM_RUN_LOG([cat conftest.dir/file])
332713e6bc1cSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
332813e6bc1cSmrg    fi
332913e6bc1cSmrg  done
333013e6bc1cSmrg  rm -rf conftest.dir
333113e6bc1cSmrg
333213e6bc1cSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
333313e6bc1cSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
333413e6bc1cSmrg
333513e6bc1cSmrgAC_SUBST([am__tar])
333613e6bc1cSmrgAC_SUBST([am__untar])
333713e6bc1cSmrg]) # _AM_PROG_TAR
33387d5e3a19Smrg
3339