aclocal.m4 revision 38c51623
1c6a6acfbSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2c6a6acfbSmrg
3c6a6acfbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
466fe65f6Smrg
566fe65f6Smrg# This file is free software; the Free Software Foundation
666fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
766fe65f6Smrg# with or without modifications, as long as this notice is preserved.
866fe65f6Smrg
966fe65f6Smrg# This program is distributed in the hope that it will be useful,
1066fe65f6Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1166fe65f6Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1266fe65f6Smrg# PARTICULAR PURPOSE.
1366fe65f6Smrg
14c6a6acfbSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1589d09728Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1689d09728Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17c6a6acfbSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18c6a6acfbSmrg[m4_warning([this file was generated for autoconf 2.69.
1989d09728SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2089d09728SmrgIf you have problems, you may need to regenerate the build system entirely.
21c6a6acfbSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2289d09728Smrg
2338c51623Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2438c51623Smrgdnl serial 11 (pkg-config-0.29)
2538c51623Smrgdnl
2638c51623Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2738c51623Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2838c51623Smrgdnl
2938c51623Smrgdnl This program is free software; you can redistribute it and/or modify
3038c51623Smrgdnl it under the terms of the GNU General Public License as published by
3138c51623Smrgdnl the Free Software Foundation; either version 2 of the License, or
3238c51623Smrgdnl (at your option) any later version.
3338c51623Smrgdnl
3438c51623Smrgdnl This program is distributed in the hope that it will be useful, but
3538c51623Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3638c51623Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3738c51623Smrgdnl General Public License for more details.
3838c51623Smrgdnl
3938c51623Smrgdnl You should have received a copy of the GNU General Public License
4038c51623Smrgdnl along with this program; if not, write to the Free Software
4138c51623Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4238c51623Smrgdnl 02111-1307, USA.
4338c51623Smrgdnl
4438c51623Smrgdnl As a special exception to the GNU General Public License, if you
4538c51623Smrgdnl distribute this file as part of a program that contains a
4638c51623Smrgdnl configuration script generated by Autoconf, you may include it under
4738c51623Smrgdnl the same distribution terms that you use for the rest of that
4838c51623Smrgdnl program.
4938c51623Smrg
5038c51623Smrgdnl PKG_PREREQ(MIN-VERSION)
5138c51623Smrgdnl -----------------------
5238c51623Smrgdnl Since: 0.29
5338c51623Smrgdnl
5438c51623Smrgdnl Verify that the version of the pkg-config macros are at least
5538c51623Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5638c51623Smrgdnl installed version of pkg-config, this checks the developer's version
5738c51623Smrgdnl of pkg.m4 when generating configure.
5838c51623Smrgdnl
5938c51623Smrgdnl To ensure that this macro is defined, also add:
6038c51623Smrgdnl m4_ifndef([PKG_PREREQ],
6138c51623Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6238c51623Smrgdnl
6338c51623Smrgdnl See the "Since" comment for each macro you use to see what version
6438c51623Smrgdnl of the macros you require.
6538c51623Smrgm4_defun([PKG_PREREQ],
6638c51623Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
6738c51623Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6838c51623Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6938c51623Smrg])dnl PKG_PREREQ
7038c51623Smrg
7138c51623Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7238c51623Smrgdnl ----------------------------------
7338c51623Smrgdnl Since: 0.16
7438c51623Smrgdnl
7538c51623Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7638c51623Smrgdnl first found in the path. Checks that the version of pkg-config found
7738c51623Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7838c51623Smrgdnl used since that's the first version where most current features of
7938c51623Smrgdnl pkg-config existed.
8038c51623SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8138c51623Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8238c51623Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8338c51623Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8438c51623SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8538c51623SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8638c51623SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8789d09728Smrg
8838c51623Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8938c51623Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9038c51623Smrgfi
9138c51623Smrgif test -n "$PKG_CONFIG"; then
9238c51623Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9338c51623Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9438c51623Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9538c51623Smrg		AC_MSG_RESULT([yes])
9638c51623Smrg	else
9738c51623Smrg		AC_MSG_RESULT([no])
9838c51623Smrg		PKG_CONFIG=""
9938c51623Smrg	fi
10038c51623Smrgfi[]dnl
10138c51623Smrg])dnl PKG_PROG_PKG_CONFIG
102a9274bcdSmrg
10338c51623Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10438c51623Smrgdnl -------------------------------------------------------------------
10538c51623Smrgdnl Since: 0.18
10638c51623Smrgdnl
10738c51623Smrgdnl Check to see whether a particular set of modules exists. Similar to
10838c51623Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10938c51623Smrgdnl
11038c51623Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11138c51623Smrgdnl only at the first occurence in configure.ac, so if the first place
11238c51623Smrgdnl it's called might be skipped (such as if it is within an "if", you
11338c51623Smrgdnl have to call PKG_CHECK_EXISTS manually
11438c51623SmrgAC_DEFUN([PKG_CHECK_EXISTS],
11538c51623Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11638c51623Smrgif test -n "$PKG_CONFIG" && \
11738c51623Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11838c51623Smrg  m4_default([$2], [:])
11938c51623Smrgm4_ifvaln([$3], [else
12038c51623Smrg  $3])dnl
12138c51623Smrgfi])
122a9274bcdSmrg
12338c51623Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12438c51623Smrgdnl ---------------------------------------------
12538c51623Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12638c51623Smrgdnl pkg_failed based on the result.
12738c51623Smrgm4_define([_PKG_CONFIG],
12838c51623Smrg[if test -n "$$1"; then
12938c51623Smrg    pkg_cv_[]$1="$$1"
13038c51623Smrg elif test -n "$PKG_CONFIG"; then
13138c51623Smrg    PKG_CHECK_EXISTS([$3],
13238c51623Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13338c51623Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
13438c51623Smrg		     [pkg_failed=yes])
13538c51623Smrg else
13638c51623Smrg    pkg_failed=untried
13738c51623Smrgfi[]dnl
13838c51623Smrg])dnl _PKG_CONFIG
139a9274bcdSmrg
14038c51623Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14138c51623Smrgdnl ---------------------------
14238c51623Smrgdnl Internal check to see if pkg-config supports short errors.
14338c51623SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14438c51623Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14538c51623Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14638c51623Smrg        _pkg_short_errors_supported=yes
14738c51623Smrgelse
14838c51623Smrg        _pkg_short_errors_supported=no
14938c51623Smrgfi[]dnl
15038c51623Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151a9274bcdSmrg
152a9274bcdSmrg
15338c51623Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15438c51623Smrgdnl   [ACTION-IF-NOT-FOUND])
15538c51623Smrgdnl --------------------------------------------------------------
15638c51623Smrgdnl Since: 0.4.0
15738c51623Smrgdnl
15838c51623Smrgdnl Note that if there is a possibility the first call to
15938c51623Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16038c51623Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16138c51623SmrgAC_DEFUN([PKG_CHECK_MODULES],
16238c51623Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16338c51623SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16438c51623SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
16566fe65f6Smrg
16638c51623Smrgpkg_failed=no
16738c51623SmrgAC_MSG_CHECKING([for $1])
16866fe65f6Smrg
16938c51623Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17038c51623Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
17166fe65f6Smrg
17238c51623Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17338c51623Smrgand $1[]_LIBS to avoid the need to call pkg-config.
17438c51623SmrgSee the pkg-config man page for more details.])
17566fe65f6Smrg
17638c51623Smrgif test $pkg_failed = yes; then
17738c51623Smrg   	AC_MSG_RESULT([no])
17838c51623Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17938c51623Smrg        if test $_pkg_short_errors_supported = yes; then
18038c51623Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18138c51623Smrg        else 
18238c51623Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18338c51623Smrg        fi
18438c51623Smrg	# Put the nasty error message in config.log where it belongs
18538c51623Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
18666fe65f6Smrg
18738c51623Smrg	m4_default([$4], [AC_MSG_ERROR(
18838c51623Smrg[Package requirements ($2) were not met:
18966fe65f6Smrg
19038c51623Smrg$$1_PKG_ERRORS
19166fe65f6Smrg
19238c51623SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19338c51623Smrginstalled software in a non-standard prefix.
19466fe65f6Smrg
19538c51623Smrg_PKG_TEXT])[]dnl
19638c51623Smrg        ])
19738c51623Smrgelif test $pkg_failed = untried; then
19838c51623Smrg     	AC_MSG_RESULT([no])
19938c51623Smrg	m4_default([$4], [AC_MSG_FAILURE(
20038c51623Smrg[The pkg-config script could not be found or is too old.  Make sure it
20138c51623Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
20238c51623Smrgpath to pkg-config.
20366fe65f6Smrg
20438c51623Smrg_PKG_TEXT
20566fe65f6Smrg
20638c51623SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20738c51623Smrg        ])
20838c51623Smrgelse
20938c51623Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21038c51623Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21138c51623Smrg        AC_MSG_RESULT([yes])
21238c51623Smrg	$3
21338c51623Smrgfi[]dnl
21438c51623Smrg])dnl PKG_CHECK_MODULES
21566fe65f6Smrg
21689d09728Smrg
21738c51623Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21838c51623Smrgdnl   [ACTION-IF-NOT-FOUND])
21938c51623Smrgdnl ---------------------------------------------------------------------
22038c51623Smrgdnl Since: 0.29
22138c51623Smrgdnl
22238c51623Smrgdnl Checks for existence of MODULES and gathers its build flags with
22338c51623Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22438c51623Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22538c51623Smrgdnl
22638c51623Smrgdnl Note that if there is a possibility the first call to
22738c51623Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22838c51623Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22938c51623Smrgdnl configure.ac.
23038c51623SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23138c51623Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23238c51623Smrg_save_PKG_CONFIG=$PKG_CONFIG
23338c51623SmrgPKG_CONFIG="$PKG_CONFIG --static"
23438c51623SmrgPKG_CHECK_MODULES($@)
23538c51623SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23638c51623Smrg])dnl PKG_CHECK_MODULES_STATIC
23766fe65f6Smrg
23866fe65f6Smrg
23938c51623Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24038c51623Smrgdnl -------------------------
24138c51623Smrgdnl Since: 0.27
24238c51623Smrgdnl
24338c51623Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
24438c51623Smrgdnl should install pkg-config .pc files. By default the directory is
24538c51623Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
24638c51623Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24738c51623Smrgdnl parameter.
24838c51623SmrgAC_DEFUN([PKG_INSTALLDIR],
24938c51623Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25038c51623Smrgm4_pushdef([pkg_description],
25138c51623Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25238c51623SmrgAC_ARG_WITH([pkgconfigdir],
25338c51623Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25438c51623Smrg    [with_pkgconfigdir=]pkg_default)
25538c51623SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25638c51623Smrgm4_popdef([pkg_default])
25738c51623Smrgm4_popdef([pkg_description])
25838c51623Smrg])dnl PKG_INSTALLDIR
25938c51623Smrg
26038c51623Smrg
26138c51623Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26238c51623Smrgdnl --------------------------------
26338c51623Smrgdnl Since: 0.27
26438c51623Smrgdnl
26538c51623Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26638c51623Smrgdnl module should install arch-independent pkg-config .pc files. By
26738c51623Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
26838c51623Smrgdnl changed by passing DIRECTORY. The user can override through the
26938c51623Smrgdnl --with-noarch-pkgconfigdir parameter.
27038c51623SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27138c51623Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27238c51623Smrgm4_pushdef([pkg_description],
27338c51623Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27438c51623SmrgAC_ARG_WITH([noarch-pkgconfigdir],
27538c51623Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27638c51623Smrg    [with_noarch_pkgconfigdir=]pkg_default)
27738c51623SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27838c51623Smrgm4_popdef([pkg_default])
27938c51623Smrgm4_popdef([pkg_description])
28038c51623Smrg])dnl PKG_NOARCH_INSTALLDIR
28138c51623Smrg
28238c51623Smrg
28338c51623Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28438c51623Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28538c51623Smrgdnl -------------------------------------------
28638c51623Smrgdnl Since: 0.28
28738c51623Smrgdnl
28838c51623Smrgdnl Retrieves the value of the pkg-config variable for the given module.
28938c51623SmrgAC_DEFUN([PKG_CHECK_VAR],
29038c51623Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29138c51623SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
29266fe65f6Smrg
29338c51623Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29438c51623SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29538c51623Smrg
29638c51623SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29738c51623Smrg])dnl PKG_CHECK_VAR
29838c51623Smrg
29938c51623Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
30038c51623Smrgdnl
30138c51623Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
30238c51623Smrgdnl
30338c51623Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
30438c51623Smrgdnl copy of this software and associated documentation files (the "Software"),
30538c51623Smrgdnl to deal in the Software without restriction, including without limitation
30638c51623Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
30738c51623Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
30838c51623Smrgdnl Software is furnished to do so, subject to the following conditions:
30938c51623Smrgdnl
31038c51623Smrgdnl The above copyright notice and this permission notice (including the next
31138c51623Smrgdnl paragraph) shall be included in all copies or substantial portions of the
31238c51623Smrgdnl Software.
31338c51623Smrgdnl
31438c51623Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31538c51623Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31638c51623Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31738c51623Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31838c51623Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31938c51623Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32038c51623Smrgdnl DEALINGS IN THE SOFTWARE.
32138c51623Smrg
32238c51623Smrg# XORG_MACROS_VERSION(required-version)
32338c51623Smrg# -------------------------------------
32438c51623Smrg# Minimum version: 1.1.0
32538c51623Smrg#
32638c51623Smrg# If you're using a macro added in Version 1.1 or newer, include this in
32738c51623Smrg# your configure.ac with the minimum required version, such as:
32838c51623Smrg# XORG_MACROS_VERSION(1.1)
32938c51623Smrg#
33038c51623Smrg# To ensure that this macro is defined, also add:
33138c51623Smrg# m4_ifndef([XORG_MACROS_VERSION],
33238c51623Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
33338c51623Smrg#
33438c51623Smrg#
33538c51623Smrg# See the "minimum version" comment for each macro you use to see what
33638c51623Smrg# version you require.
33738c51623Smrgm4_defun([XORG_MACROS_VERSION],[
33838c51623Smrgm4_define([vers_have], [1.19.0])
33938c51623Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
34038c51623Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
34138c51623Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
34238c51623Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
34338c51623Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
34438c51623Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
34538c51623Smrgm4_undefine([vers_have])
34638c51623Smrgm4_undefine([maj_have])
34738c51623Smrgm4_undefine([maj_needed])
34838c51623Smrg]) # XORG_MACROS_VERSION
34938c51623Smrg
35038c51623Smrg# XORG_PROG_RAWCPP()
35138c51623Smrg# ------------------
35238c51623Smrg# Minimum version: 1.0.0
35338c51623Smrg#
35438c51623Smrg# Find cpp program and necessary flags for use in pre-processing text files
35538c51623Smrg# such as man pages and config files
35638c51623SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
35738c51623SmrgAC_REQUIRE([AC_PROG_CPP])
35838c51623SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
35938c51623Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
36038c51623Smrg
36138c51623Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
36238c51623Smrg# which is not the best choice for supporting other OS'es, but covers most
36338c51623Smrg# of the ones we need for now.
36438c51623SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
36538c51623SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
36638c51623Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
36738c51623Smrg	AC_MSG_RESULT([no])
36866fe65f6Smrgelse
36938c51623Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37038c51623Smrg		RAWCPPFLAGS=-undef
37138c51623Smrg		AC_MSG_RESULT([yes])
37238c51623Smrg	# under Cygwin unix is still defined even with -undef
37338c51623Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37438c51623Smrg		RAWCPPFLAGS="-undef -ansi"
37538c51623Smrg		AC_MSG_RESULT([yes, with -ansi])
37638c51623Smrg	else
37738c51623Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
37838c51623Smrg	fi
37966fe65f6Smrgfi
38038c51623Smrgrm -f conftest.$ac_ext
38166fe65f6Smrg
38238c51623SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
38338c51623SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
38438c51623Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38538c51623Smrg	AC_MSG_RESULT([no])
38638c51623Smrgelse
38738c51623Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38838c51623Smrg		TRADITIONALCPPFLAGS="-traditional"
38938c51623Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
39038c51623Smrg		AC_MSG_RESULT([yes])
39138c51623Smrg	else
39238c51623Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
39338c51623Smrg	fi
39438c51623Smrgfi
39538c51623Smrgrm -f conftest.$ac_ext
39638c51623SmrgAC_SUBST(RAWCPPFLAGS)
39738c51623SmrgAC_SUBST(TRADITIONALCPPFLAGS)
39838c51623Smrg]) # XORG_PROG_RAWCPP
39966fe65f6Smrg
40038c51623Smrg# XORG_MANPAGE_SECTIONS()
40138c51623Smrg# -----------------------
40238c51623Smrg# Minimum version: 1.0.0
40338c51623Smrg#
40438c51623Smrg# Determine which sections man pages go in for the different man page types
40538c51623Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
40638c51623Smrg# Not sure if there's any better way than just hardcoding by OS name.
40738c51623Smrg# Override default settings by setting environment variables
40838c51623Smrg# Added MAN_SUBSTS in version 1.8
40938c51623Smrg# Added AC_PROG_SED in version 1.8
41066fe65f6Smrg
41138c51623SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
41238c51623SmrgAC_REQUIRE([AC_CANONICAL_HOST])
41338c51623SmrgAC_REQUIRE([AC_PROG_SED])
41466fe65f6Smrg
41538c51623Smrgif test x$APP_MAN_SUFFIX = x    ; then
41638c51623Smrg    APP_MAN_SUFFIX=1
41738c51623Smrgfi
41838c51623Smrgif test x$APP_MAN_DIR = x    ; then
41938c51623Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
42066fe65f6Smrgfi
42166fe65f6Smrg
42238c51623Smrgif test x$LIB_MAN_SUFFIX = x    ; then
42338c51623Smrg    LIB_MAN_SUFFIX=3
42438c51623Smrgfi
42538c51623Smrgif test x$LIB_MAN_DIR = x    ; then
42638c51623Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
42738c51623Smrgfi
42866fe65f6Smrg
42938c51623Smrgif test x$FILE_MAN_SUFFIX = x    ; then
43038c51623Smrg    case $host_os in
43138c51623Smrg	# Solaris 2.0 - 11 use SysV man page sections
43238c51623Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
43338c51623Smrg	*)				FILE_MAN_SUFFIX=5  ;;
43438c51623Smrg    esac
43538c51623Smrgfi
43638c51623Smrgif test x$FILE_MAN_DIR = x    ; then
43738c51623Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
43838c51623Smrgfi
43966fe65f6Smrg
44038c51623Smrgif test x$MISC_MAN_SUFFIX = x    ; then
44138c51623Smrg    case $host_os in
44238c51623Smrg	# Solaris 2.0 - 11 use SysV man page sections
44338c51623Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
44438c51623Smrg	*)				MISC_MAN_SUFFIX=7  ;;
44538c51623Smrg    esac
44638c51623Smrgfi
44738c51623Smrgif test x$MISC_MAN_DIR = x    ; then
44838c51623Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
44938c51623Smrgfi
45066fe65f6Smrg
45138c51623Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
45238c51623Smrg    case $host_os in
45338c51623Smrg	# Solaris 2.0 - 11 use SysV man page sections
45438c51623Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
45538c51623Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
45638c51623Smrg    esac
45738c51623Smrgfi
45838c51623Smrgif test x$DRIVER_MAN_DIR = x    ; then
45938c51623Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
46038c51623Smrgfi
46138c51623Smrg
46238c51623Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
46338c51623Smrg    case $host_os in
46438c51623Smrg	# Solaris 2.0 - 11 use SysV man page sections
46538c51623Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
46638c51623Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
46738c51623Smrg    esac
46838c51623Smrgfi
46938c51623Smrgif test x$ADMIN_MAN_DIR = x    ; then
47038c51623Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
47138c51623Smrgfi
47266fe65f6Smrg
473a9274bcdSmrg
47438c51623SmrgAC_SUBST([APP_MAN_SUFFIX])
47538c51623SmrgAC_SUBST([LIB_MAN_SUFFIX])
47638c51623SmrgAC_SUBST([FILE_MAN_SUFFIX])
47738c51623SmrgAC_SUBST([MISC_MAN_SUFFIX])
47838c51623SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
47938c51623SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
48038c51623SmrgAC_SUBST([APP_MAN_DIR])
48138c51623SmrgAC_SUBST([LIB_MAN_DIR])
48238c51623SmrgAC_SUBST([FILE_MAN_DIR])
48338c51623SmrgAC_SUBST([MISC_MAN_DIR])
48438c51623SmrgAC_SUBST([DRIVER_MAN_DIR])
48538c51623SmrgAC_SUBST([ADMIN_MAN_DIR])
48638c51623Smrg
48738c51623SmrgXORG_MAN_PAGE="X Version 11"
48838c51623SmrgAC_SUBST([XORG_MAN_PAGE])
48938c51623SmrgMAN_SUBSTS="\
49038c51623Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49138c51623Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49238c51623Smrg	-e 's|__xservername__|Xorg|g' \
49338c51623Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
49438c51623Smrg	-e 's|__projectroot__|\$(prefix)|g' \
49538c51623Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
49638c51623Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
49738c51623Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
49838c51623Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
49938c51623Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
50038c51623Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
50138c51623Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
50238c51623SmrgAC_SUBST([MAN_SUBSTS])
50338c51623Smrg
50438c51623Smrg]) # XORG_MANPAGE_SECTIONS
50538c51623Smrg
50638c51623Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
50738c51623Smrg# ------------------------
50838c51623Smrg# Minimum version: 1.7.0
50989d09728Smrg#
51038c51623Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
51138c51623Smrg# provided by xorg-sgml-doctools, if installed.
51238c51623SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
51338c51623SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
51438c51623SmrgXORG_SGML_PATH=
51538c51623SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
51638c51623Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
51738c51623Smrg    [m4_ifval([$1],[:],
51838c51623Smrg        [if test x"$cross_compiling" != x"yes" ; then
51938c51623Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
52038c51623Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
52138c51623Smrg         fi])
52238c51623Smrg    ])
52389d09728Smrg
52438c51623Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
52538c51623Smrg# the path and the name of the doc stylesheet
52638c51623Smrgif test "x$XORG_SGML_PATH" != "x" ; then
52738c51623Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
52838c51623Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
52938c51623Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
53038c51623Smrgelse
53138c51623Smrg   AC_MSG_RESULT([no])
53238c51623Smrgfi
53389d09728Smrg
53438c51623SmrgAC_SUBST(XORG_SGML_PATH)
53538c51623SmrgAC_SUBST(STYLESHEET_SRCDIR)
53638c51623SmrgAC_SUBST(XSL_STYLESHEET)
53738c51623SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
53838c51623Smrg]) # XORG_CHECK_SGML_DOCTOOLS
53938c51623Smrg
54038c51623Smrg# XORG_CHECK_LINUXDOC
54138c51623Smrg# -------------------
54238c51623Smrg# Minimum version: 1.0.0
543a9274bcdSmrg#
54438c51623Smrg# Defines the variable MAKE_TEXT if the necessary tools and
54538c51623Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
54638c51623Smrg# Whether or not the necessary tools and files are found can be checked
54738c51623Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
54838c51623SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
54938c51623SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
55038c51623SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551a9274bcdSmrg
55238c51623SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553a9274bcdSmrg
55438c51623SmrgAC_MSG_CHECKING([whether to build documentation])
555c6a6acfbSmrg
55638c51623Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
55738c51623Smrg   BUILDDOC=yes
55838c51623Smrgelse
55938c51623Smrg   BUILDDOC=no
56089d09728Smrgfi
56189d09728Smrg
56238c51623SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
56338c51623Smrg
56438c51623SmrgAC_MSG_RESULT([$BUILDDOC])
56538c51623Smrg
56638c51623SmrgAC_MSG_CHECKING([whether to build pdf documentation])
56738c51623Smrg
56838c51623Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
56938c51623Smrg   BUILDPDFDOC=yes
57038c51623Smrgelse
57138c51623Smrg   BUILDPDFDOC=no
57289d09728Smrgfi
57389d09728Smrg
57438c51623SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
57589d09728Smrg
57638c51623SmrgAC_MSG_RESULT([$BUILDPDFDOC])
57789d09728Smrg
57838c51623SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
57938c51623SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
58038c51623SmrgMAKE_PDF="$PS2PDF"
58138c51623SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582c6a6acfbSmrg
58338c51623SmrgAC_SUBST(MAKE_TEXT)
58438c51623SmrgAC_SUBST(MAKE_PS)
58538c51623SmrgAC_SUBST(MAKE_PDF)
58638c51623SmrgAC_SUBST(MAKE_HTML)
58738c51623Smrg]) # XORG_CHECK_LINUXDOC
588c6a6acfbSmrg
58938c51623Smrg# XORG_CHECK_DOCBOOK
59038c51623Smrg# -------------------
59138c51623Smrg# Minimum version: 1.0.0
59238c51623Smrg#
59338c51623Smrg# Checks for the ability to build output formats from SGML DocBook source.
59438c51623Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
59538c51623Smrg# indicates whether the necessary tools and files are found and, if set,
59638c51623Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
59738c51623SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
59838c51623SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599c6a6acfbSmrg
60038c51623SmrgBUILDTXTDOC=no
60138c51623SmrgBUILDPDFDOC=no
60238c51623SmrgBUILDPSDOC=no
60338c51623SmrgBUILDHTMLDOC=no
604c6a6acfbSmrg
60538c51623SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
60638c51623SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
60738c51623SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
60838c51623SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609c6a6acfbSmrg
61038c51623SmrgAC_MSG_CHECKING([whether to build text documentation])
61138c51623Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
61238c51623Smrg   test x$BUILD_TXTDOC != xno; then
61338c51623Smrg	BUILDTXTDOC=yes
61438c51623Smrgfi
61538c51623SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
61638c51623SmrgAC_MSG_RESULT([$BUILDTXTDOC])
617c6a6acfbSmrg
61838c51623SmrgAC_MSG_CHECKING([whether to build PDF documentation])
61938c51623Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
62038c51623Smrg   test x$BUILD_PDFDOC != xno; then
62138c51623Smrg	BUILDPDFDOC=yes
62238c51623Smrgfi
62338c51623SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
62438c51623SmrgAC_MSG_RESULT([$BUILDPDFDOC])
625c6a6acfbSmrg
62638c51623SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
62738c51623Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
62838c51623Smrg   test x$BUILD_PSDOC != xno; then
62938c51623Smrg	BUILDPSDOC=yes
630c6a6acfbSmrgfi
63138c51623SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
63238c51623SmrgAC_MSG_RESULT([$BUILDPSDOC])
633a9274bcdSmrg
63438c51623SmrgAC_MSG_CHECKING([whether to build HTML documentation])
63538c51623Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
63638c51623Smrg   test x$BUILD_HTMLDOC != xno; then
63738c51623Smrg	BUILDHTMLDOC=yes
63838c51623Smrgfi
63938c51623SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
64038c51623SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641a9274bcdSmrg
64238c51623SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
64338c51623SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
64438c51623SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
64538c51623SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
646a9274bcdSmrg
64738c51623SmrgAC_SUBST(MAKE_TEXT)
64838c51623SmrgAC_SUBST(MAKE_PS)
64938c51623SmrgAC_SUBST(MAKE_PDF)
65038c51623SmrgAC_SUBST(MAKE_HTML)
65138c51623Smrg]) # XORG_CHECK_DOCBOOK
652a9274bcdSmrg
65338c51623Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
65438c51623Smrg# ----------------
65538c51623Smrg# Minimum version: 1.5.0
65638c51623Smrg# Minimum version for optional DEFAULT argument: 1.11.0
65789d09728Smrg#
65838c51623Smrg# Documentation tools are not always available on all platforms and sometimes
65938c51623Smrg# not at the appropriate level. This macro enables a module to test for the
66038c51623Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
66138c51623Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
66238c51623Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
66338c51623Smrg# --with-xmlto assumes 'auto'.
664a9274bcdSmrg#
66538c51623Smrg# Interface to module:
66638c51623Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
66738c51623Smrg# XMLTO:	returns the path of the xmlto program found
66838c51623Smrg#		returns the path set by the user in the environment
66938c51623Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
67038c51623Smrg#		'no' user instructs the module not to use xmlto
67138c51623Smrg#
67238c51623Smrg# Added in version 1.10.0
67338c51623Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
67438c51623Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
67538c51623Smrg#
67638c51623Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
67738c51623Smrg#
67838c51623SmrgAC_DEFUN([XORG_WITH_XMLTO],[
67938c51623SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
68038c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
68138c51623SmrgAC_ARG_WITH(xmlto,
68238c51623Smrg	AS_HELP_STRING([--with-xmlto],
68338c51623Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
68438c51623Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
68538c51623Smrgm4_undefine([_defopt])
686a9274bcdSmrg
68738c51623Smrgif test "x$use_xmlto" = x"auto"; then
68838c51623Smrg   AC_PATH_PROG([XMLTO], [xmlto])
68938c51623Smrg   if test "x$XMLTO" = "x"; then
69038c51623Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
69138c51623Smrg	have_xmlto=no
69238c51623Smrg   else
69338c51623Smrg        have_xmlto=yes
69438c51623Smrg   fi
69538c51623Smrgelif test "x$use_xmlto" = x"yes" ; then
69638c51623Smrg   AC_PATH_PROG([XMLTO], [xmlto])
69738c51623Smrg   if test "x$XMLTO" = "x"; then
69838c51623Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
69938c51623Smrg   fi
70038c51623Smrg   have_xmlto=yes
70138c51623Smrgelif test "x$use_xmlto" = x"no" ; then
70238c51623Smrg   if test "x$XMLTO" != "x"; then
70338c51623Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
70438c51623Smrg   fi
70538c51623Smrg   have_xmlto=no
70666fe65f6Smrgelse
70738c51623Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
70866fe65f6Smrgfi
70966fe65f6Smrg
71038c51623Smrg# Test for a minimum version of xmlto, if provided.
71138c51623Smrgm4_ifval([$1],
71238c51623Smrg[if test "$have_xmlto" = yes; then
71338c51623Smrg    # scrape the xmlto version
71438c51623Smrg    AC_MSG_CHECKING([the xmlto version])
71538c51623Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
71638c51623Smrg    AC_MSG_RESULT([$xmlto_version])
71738c51623Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
71838c51623Smrg        [if test "x$use_xmlto" = xauto; then
71938c51623Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
72038c51623Smrg            have_xmlto=no
72138c51623Smrg        else
72238c51623Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
72338c51623Smrg        fi])
72438c51623Smrgfi])
725a9274bcdSmrg
72638c51623Smrg# Test for the ability of xmlto to generate a text target
72789d09728Smrg#
72838c51623Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
72938c51623Smrg# following test for empty XML docbook files.
73038c51623Smrg# For compatibility reasons use the following empty XML docbook file and if
73138c51623Smrg# it fails try it again with a non-empty XML file.
73238c51623Smrghave_xmlto_text=no
73338c51623Smrgcat > conftest.xml << "EOF"
73438c51623SmrgEOF
73538c51623SmrgAS_IF([test "$have_xmlto" = yes],
73638c51623Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73738c51623Smrg             [have_xmlto_text=yes],
73838c51623Smrg             [# Try it again with a non-empty XML file.
73938c51623Smrg              cat > conftest.xml << "EOF"
74038c51623Smrg<x></x>
74138c51623SmrgEOF
74238c51623Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
74338c51623Smrg                    [have_xmlto_text=yes],
74438c51623Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
74538c51623Smrgrm -f conftest.xml
74638c51623SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
74738c51623SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
74838c51623Smrg]) # XORG_WITH_XMLTO
74989d09728Smrg
75038c51623Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
75138c51623Smrg# --------------------------------------------
75238c51623Smrg# Minimum version: 1.12.0
75338c51623Smrg# Minimum version for optional DEFAULT argument: 1.12.0
75466fe65f6Smrg#
75538c51623Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
75638c51623Smrg# XML-based language used for the transformation of XML documents.
75738c51623Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
75838c51623Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
75938c51623Smrg# The XSLT processor is often used as a standalone tool for transformations.
76038c51623Smrg# It should not be assumed that this tool is used only to work with documnetation.
76138c51623Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
76238c51623Smrg#
76338c51623Smrg# Interface to module:
76438c51623Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
76538c51623Smrg# XSLTPROC:	 returns the path of the xsltproc program found
76638c51623Smrg#		 returns the path set by the user in the environment
76738c51623Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
76838c51623Smrg#		  'no' user instructs the module not to use xsltproc
76938c51623Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
77038c51623Smrg#
77138c51623Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
77238c51623Smrg#
77338c51623SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
77438c51623SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
77538c51623Smrg# Preserves the interface, should it be implemented later
77638c51623Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
77738c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
77838c51623SmrgAC_ARG_WITH(xsltproc,
77938c51623Smrg	AS_HELP_STRING([--with-xsltproc],
78038c51623Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
78138c51623Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
78238c51623Smrgm4_undefine([_defopt])
78366fe65f6Smrg
78438c51623Smrgif test "x$use_xsltproc" = x"auto"; then
78538c51623Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
78638c51623Smrg   if test "x$XSLTPROC" = "x"; then
78738c51623Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
78838c51623Smrg	have_xsltproc=no
78938c51623Smrg   else
79038c51623Smrg        have_xsltproc=yes
79138c51623Smrg   fi
79238c51623Smrgelif test "x$use_xsltproc" = x"yes" ; then
79338c51623Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
79438c51623Smrg   if test "x$XSLTPROC" = "x"; then
79538c51623Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
79638c51623Smrg   fi
79738c51623Smrg   have_xsltproc=yes
79838c51623Smrgelif test "x$use_xsltproc" = x"no" ; then
79938c51623Smrg   if test "x$XSLTPROC" != "x"; then
80038c51623Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
80138c51623Smrg   fi
80238c51623Smrg   have_xsltproc=no
803a9274bcdSmrgelse
80438c51623Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805a9274bcdSmrgfi
80666fe65f6Smrg
80738c51623SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
80838c51623Smrg]) # XORG_WITH_XSLTPROC
80966fe65f6Smrg
81038c51623Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
81138c51623Smrg# ----------------------------------------
81238c51623Smrg# Minimum version: 1.15.0
81366fe65f6Smrg#
81438c51623Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
81538c51623Smrg# scanning arbitrary text files, extracting information from those text files,
81638c51623Smrg# and printing reports based on that information.
81738c51623Smrg#
81838c51623Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
81938c51623Smrg#
82038c51623Smrg# Interface to module:
82138c51623Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
82238c51623Smrg# PERL:	     returns the path of the perl program found
82338c51623Smrg#	     returns the path set by the user in the environment
82438c51623Smrg# --with-perl: 'yes' user instructs the module to use perl
82538c51623Smrg#	       'no' user instructs the module not to use perl
82638c51623Smrg# have_perl: returns yes if perl found in PATH or no
82738c51623Smrg#
82838c51623Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
82938c51623Smrg#
83038c51623SmrgAC_DEFUN([XORG_WITH_PERL],[
83138c51623SmrgAC_ARG_VAR([PERL], [Path to perl command])
83238c51623Smrg# Preserves the interface, should it be implemented later
83338c51623Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
83438c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
83538c51623SmrgAC_ARG_WITH(perl,
83638c51623Smrg	AS_HELP_STRING([--with-perl],
83738c51623Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
83838c51623Smrg	   [use_perl=$withval], [use_perl=]_defopt)
83938c51623Smrgm4_undefine([_defopt])
84066fe65f6Smrg
84138c51623Smrgif test "x$use_perl" = x"auto"; then
84238c51623Smrg   AC_PATH_PROG([PERL], [perl])
84338c51623Smrg   if test "x$PERL" = "x"; then
84438c51623Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
84538c51623Smrg	have_perl=no
84638c51623Smrg   else
84738c51623Smrg        have_perl=yes
84838c51623Smrg   fi
84938c51623Smrgelif test "x$use_perl" = x"yes" ; then
85038c51623Smrg   AC_PATH_PROG([PERL], [perl])
85138c51623Smrg   if test "x$PERL" = "x"; then
85238c51623Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
85338c51623Smrg   fi
85438c51623Smrg   have_perl=yes
85538c51623Smrgelif test "x$use_perl" = x"no" ; then
85638c51623Smrg   if test "x$PERL" != "x"; then
85738c51623Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
85838c51623Smrg   fi
85938c51623Smrg   have_perl=no
86038c51623Smrgelse
86138c51623Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
86238c51623Smrgfi
86366fe65f6Smrg
86438c51623SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
86538c51623Smrg]) # XORG_WITH_PERL
86666fe65f6Smrg
86738c51623Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
86838c51623Smrg# ----------------
86938c51623Smrg# Minimum version: 1.5.0
87038c51623Smrg# Minimum version for optional DEFAULT argument: 1.11.0
871c6a6acfbSmrg#
87238c51623Smrg# Documentation tools are not always available on all platforms and sometimes
87338c51623Smrg# not at the appropriate level. This macro enables a module to test for the
87438c51623Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
87538c51623Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
87638c51623Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
87738c51623Smrg# --with-asciidoc assumes 'auto'.
87838c51623Smrg#
87938c51623Smrg# Interface to module:
88038c51623Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
88138c51623Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
88238c51623Smrg#		 returns the path set by the user in the environment
88338c51623Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
88438c51623Smrg#		  'no' user instructs the module not to use asciidoc
88538c51623Smrg#
88638c51623Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
88738c51623Smrg#
88838c51623SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
88938c51623SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
89038c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
89138c51623SmrgAC_ARG_WITH(asciidoc,
89238c51623Smrg	AS_HELP_STRING([--with-asciidoc],
89338c51623Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
89438c51623Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
89538c51623Smrgm4_undefine([_defopt])
89666fe65f6Smrg
89738c51623Smrgif test "x$use_asciidoc" = x"auto"; then
89838c51623Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
89938c51623Smrg   if test "x$ASCIIDOC" = "x"; then
90038c51623Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
90138c51623Smrg	have_asciidoc=no
90238c51623Smrg   else
90338c51623Smrg        have_asciidoc=yes
90438c51623Smrg   fi
90538c51623Smrgelif test "x$use_asciidoc" = x"yes" ; then
90638c51623Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
90738c51623Smrg   if test "x$ASCIIDOC" = "x"; then
90838c51623Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
90938c51623Smrg   fi
91038c51623Smrg   have_asciidoc=yes
91138c51623Smrgelif test "x$use_asciidoc" = x"no" ; then
91238c51623Smrg   if test "x$ASCIIDOC" != "x"; then
91338c51623Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
91438c51623Smrg   fi
91538c51623Smrg   have_asciidoc=no
91638c51623Smrgelse
91738c51623Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918c6a6acfbSmrgfi
91938c51623Smrgm4_ifval([$1],
92038c51623Smrg[if test "$have_asciidoc" = yes; then
92138c51623Smrg    # scrape the asciidoc version
92238c51623Smrg    AC_MSG_CHECKING([the asciidoc version])
92338c51623Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
92438c51623Smrg    AC_MSG_RESULT([$asciidoc_version])
92538c51623Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
92638c51623Smrg        [if test "x$use_asciidoc" = xauto; then
92738c51623Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
92838c51623Smrg            have_asciidoc=no
92938c51623Smrg        else
93038c51623Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
93138c51623Smrg        fi])
93238c51623Smrgfi])
93338c51623SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
93438c51623Smrg]) # XORG_WITH_ASCIIDOC
935c6a6acfbSmrg
93638c51623Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
93738c51623Smrg# -------------------------------------------
93838c51623Smrg# Minimum version: 1.5.0
93938c51623Smrg# Minimum version for optional DEFAULT argument: 1.11.0
94038c51623Smrg# Minimum version for optional DOT checking: 1.18.0
94166fe65f6Smrg#
94238c51623Smrg# Documentation tools are not always available on all platforms and sometimes
94338c51623Smrg# not at the appropriate level. This macro enables a module to test for the
94438c51623Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
94538c51623Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
94638c51623Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
94738c51623Smrg# --with-doxygen assumes 'auto'.
948c6a6acfbSmrg#
94938c51623Smrg# Interface to module:
95038c51623Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
95138c51623Smrg# DOXYGEN:	 returns the path of the doxygen program found
95238c51623Smrg#		 returns the path set by the user in the environment
95338c51623Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
95438c51623Smrg#		  'no' user instructs the module not to use doxygen
95538c51623Smrg#
95638c51623Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
95738c51623Smrg#
95838c51623SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
95938c51623SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
96038c51623SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
96138c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
96238c51623SmrgAC_ARG_WITH(doxygen,
96338c51623Smrg	AS_HELP_STRING([--with-doxygen],
96438c51623Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
96538c51623Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
96638c51623Smrgm4_undefine([_defopt])
967c6a6acfbSmrg
96838c51623Smrgif test "x$use_doxygen" = x"auto"; then
96938c51623Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97038c51623Smrg   if test "x$DOXYGEN" = "x"; then
97138c51623Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
97238c51623Smrg	have_doxygen=no
97338c51623Smrg   else
97438c51623Smrg        have_doxygen=yes
97538c51623Smrg   fi
97638c51623Smrgelif test "x$use_doxygen" = x"yes" ; then
97738c51623Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97838c51623Smrg   if test "x$DOXYGEN" = "x"; then
97938c51623Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
98038c51623Smrg   fi
98138c51623Smrg   have_doxygen=yes
98238c51623Smrgelif test "x$use_doxygen" = x"no" ; then
98338c51623Smrg   if test "x$DOXYGEN" != "x"; then
98438c51623Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
98538c51623Smrg   fi
98638c51623Smrg   have_doxygen=no
98766fe65f6Smrgelse
98838c51623Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
98966fe65f6Smrgfi
99038c51623Smrgm4_ifval([$1],
99138c51623Smrg[if test "$have_doxygen" = yes; then
99238c51623Smrg    # scrape the doxygen version
99338c51623Smrg    AC_MSG_CHECKING([the doxygen version])
99438c51623Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
99538c51623Smrg    AC_MSG_RESULT([$doxygen_version])
99638c51623Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
99738c51623Smrg        [if test "x$use_doxygen" = xauto; then
99838c51623Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
99938c51623Smrg            have_doxygen=no
100038c51623Smrg        else
100138c51623Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
100238c51623Smrg        fi])
100338c51623Smrgfi])
100438c51623Smrg
100538c51623Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
100638c51623Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
100738c51623Smrgdnl 	HAVE_DOT = @HAVE_DOT@
100838c51623SmrgHAVE_DOT=no
100938c51623Smrgif test "x$have_doxygen" = "xyes"; then
101038c51623Smrg  AC_PATH_PROG([DOT], [dot])
101138c51623Smrg    if test "x$DOT" != "x"; then
101238c51623Smrg      HAVE_DOT=yes
101338c51623Smrg    fi
1014c6a6acfbSmrgfi
101566fe65f6Smrg
101638c51623SmrgAC_SUBST([HAVE_DOT])
101738c51623SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
101838c51623SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
101938c51623Smrg]) # XORG_WITH_DOXYGEN
102066fe65f6Smrg
102138c51623Smrg# XORG_WITH_GROFF([DEFAULT])
102238c51623Smrg# ----------------
102338c51623Smrg# Minimum version: 1.6.0
102438c51623Smrg# Minimum version for optional DEFAULT argument: 1.11.0
102566fe65f6Smrg#
102638c51623Smrg# Documentation tools are not always available on all platforms and sometimes
102738c51623Smrg# not at the appropriate level. This macro enables a module to test for the
102838c51623Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
102938c51623Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
103038c51623Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
103138c51623Smrg# --with-groff assumes 'auto'.
103238c51623Smrg#
103338c51623Smrg# Interface to module:
103438c51623Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
103538c51623Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
103638c51623Smrg# HAVE_GROFF_MS: the -ms macros package
103738c51623Smrg# GROFF:	 returns the path of the groff program found
103838c51623Smrg#		 returns the path set by the user in the environment
103938c51623Smrg# --with-groff:	 'yes' user instructs the module to use groff
104038c51623Smrg#		 'no' user instructs the module not to use groff
104138c51623Smrg#
104238c51623Smrg# Added in version 1.9.0:
104338c51623Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
104438c51623Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
104538c51623Smrg#		   psselect from the psutils package.
104638c51623Smrg#		   the ghostcript package. Refer to the grohtml man pages
104738c51623Smrg#
104838c51623Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
104938c51623Smrg#
105038c51623Smrg# OS and distros often splits groff in a basic and full package, the former
105138c51623Smrg# having the groff program and the later having devices, fonts and macros
105238c51623Smrg# Checking for the groff executable is not enough.
105338c51623Smrg#
105438c51623Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
105538c51623Smrg# unset HAVE_GROFF or GROFF env variables.
105638c51623Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
105738c51623Smrg#
105838c51623SmrgAC_DEFUN([XORG_WITH_GROFF],[
105938c51623SmrgAC_ARG_VAR([GROFF], [Path to groff command])
106038c51623Smrgm4_define([_defopt], m4_default([$1], [auto]))
106138c51623SmrgAC_ARG_WITH(groff,
106238c51623Smrg	AS_HELP_STRING([--with-groff],
106338c51623Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
106438c51623Smrg	   [use_groff=$withval], [use_groff=]_defopt)
106538c51623Smrgm4_undefine([_defopt])
106666fe65f6Smrg
106738c51623Smrgif test "x$use_groff" = x"auto"; then
106838c51623Smrg   AC_PATH_PROG([GROFF], [groff])
106938c51623Smrg   if test "x$GROFF" = "x"; then
107038c51623Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
107138c51623Smrg	have_groff=no
107238c51623Smrg   else
107338c51623Smrg        have_groff=yes
107438c51623Smrg   fi
107538c51623Smrgelif test "x$use_groff" = x"yes" ; then
107638c51623Smrg   AC_PATH_PROG([GROFF], [groff])
107738c51623Smrg   if test "x$GROFF" = "x"; then
107838c51623Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
107938c51623Smrg   fi
108038c51623Smrg   have_groff=yes
108138c51623Smrgelif test "x$use_groff" = x"no" ; then
108238c51623Smrg   if test "x$GROFF" != "x"; then
108338c51623Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
108438c51623Smrg   fi
108538c51623Smrg   have_groff=no
108638c51623Smrgelse
108738c51623Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1088a9274bcdSmrgfi
108966fe65f6Smrg
109038c51623Smrg# We have groff, test for the presence of the macro packages
109138c51623Smrgif test "x$have_groff" = x"yes"; then
109238c51623Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
109338c51623Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
109438c51623Smrg        groff_ms_works=yes
109538c51623Smrg    else
109638c51623Smrg        groff_ms_works=no
109738c51623Smrg    fi
109838c51623Smrg    AC_MSG_RESULT([$groff_ms_works])
109938c51623Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
110038c51623Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
110138c51623Smrg        groff_mm_works=yes
110238c51623Smrg    else
110338c51623Smrg        groff_mm_works=no
110438c51623Smrg    fi
110538c51623Smrg    AC_MSG_RESULT([$groff_mm_works])
110638c51623Smrgfi
110766fe65f6Smrg
110838c51623Smrg# We have groff, test for HTML dependencies, one command per package
110938c51623Smrgif test "x$have_groff" = x"yes"; then
111038c51623Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
111138c51623Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
111238c51623Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
111338c51623Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
111438c51623Smrg      have_groff_html=yes
111538c51623Smrg   else
111638c51623Smrg      have_groff_html=no
111738c51623Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
111838c51623Smrg   fi
111938c51623Smrgfi
112066fe65f6Smrg
112138c51623Smrg# Set Automake conditionals for Makefiles
112238c51623SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
112338c51623SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
112438c51623SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
112538c51623SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
112638c51623Smrg]) # XORG_WITH_GROFF
112766fe65f6Smrg
112838c51623Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
112938c51623Smrg# ---------------------------------------
113038c51623Smrg# Minimum version: 1.6.0
113138c51623Smrg# Minimum version for optional DEFAULT argument: 1.11.0
113238c51623Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
113366fe65f6Smrg#
113438c51623Smrg# Documentation tools are not always available on all platforms and sometimes
113538c51623Smrg# not at the appropriate level. This macro enables a module to test for the
113638c51623Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
113738c51623Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
113838c51623Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
113938c51623Smrg# --with-fop assumes 'auto'.
114066fe65f6Smrg#
114138c51623Smrg# Interface to module:
114238c51623Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
114338c51623Smrg# FOP:	 	returns the path of the fop program found
114438c51623Smrg#		returns the path set by the user in the environment
114538c51623Smrg# --with-fop: 	'yes' user instructs the module to use fop
114638c51623Smrg#		'no' user instructs the module not to use fop
114766fe65f6Smrg#
114838c51623Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149c6a6acfbSmrg#
115038c51623SmrgAC_DEFUN([XORG_WITH_FOP],[
115138c51623SmrgAC_ARG_VAR([FOP], [Path to fop command])
115238c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
115338c51623SmrgAC_ARG_WITH(fop,
115438c51623Smrg	AS_HELP_STRING([--with-fop],
115538c51623Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
115638c51623Smrg	   [use_fop=$withval], [use_fop=]_defopt)
115738c51623Smrgm4_undefine([_defopt])
1158c6a6acfbSmrg
115938c51623Smrgif test "x$use_fop" = x"auto"; then
116038c51623Smrg   AC_PATH_PROG([FOP], [fop])
116138c51623Smrg   if test "x$FOP" = "x"; then
116238c51623Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
116338c51623Smrg	have_fop=no
116438c51623Smrg   else
116538c51623Smrg        have_fop=yes
116638c51623Smrg   fi
116738c51623Smrgelif test "x$use_fop" = x"yes" ; then
116838c51623Smrg   AC_PATH_PROG([FOP], [fop])
116938c51623Smrg   if test "x$FOP" = "x"; then
117038c51623Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
117138c51623Smrg   fi
117238c51623Smrg   have_fop=yes
117338c51623Smrgelif test "x$use_fop" = x"no" ; then
117438c51623Smrg   if test "x$FOP" != "x"; then
117538c51623Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
117638c51623Smrg   fi
117738c51623Smrg   have_fop=no
117838c51623Smrgelse
117938c51623Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
118038c51623Smrgfi
1181c6a6acfbSmrg
118238c51623Smrg# Test for a minimum version of fop, if provided.
118338c51623Smrgm4_ifval([$1],
118438c51623Smrg[if test "$have_fop" = yes; then
118538c51623Smrg    # scrape the fop version
118638c51623Smrg    AC_MSG_CHECKING([for fop minimum version])
118738c51623Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
118838c51623Smrg    AC_MSG_RESULT([$fop_version])
118938c51623Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
119038c51623Smrg        [if test "x$use_fop" = xauto; then
119138c51623Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
119238c51623Smrg            have_fop=no
119338c51623Smrg        else
119438c51623Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
119538c51623Smrg        fi])
119638c51623Smrgfi])
119738c51623SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
119838c51623Smrg]) # XORG_WITH_FOP
119966fe65f6Smrg
120038c51623Smrg# XORG_WITH_M4([MIN-VERSION])
120138c51623Smrg# ---------------------------
120238c51623Smrg# Minimum version: 1.19.0
1203f931275dSmrg#
120438c51623Smrg# This macro attempts to locate an m4 macro processor which supports
120538c51623Smrg# -I option and is only useful for modules relying on M4 in order to
120638c51623Smrg# expand macros in source code files.
1207f931275dSmrg#
120838c51623Smrg# Interface to module:
120938c51623Smrg# M4:	 	returns the path of the m4 program found
121038c51623Smrg#		returns the path set by the user in the environment
1211f931275dSmrg#
121238c51623SmrgAC_DEFUN([XORG_WITH_M4], [
121338c51623SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
121438c51623Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
121538c51623Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
121638c51623Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
121738c51623Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
121838c51623Smrg   [$PATH:/usr/gnu/bin])])
1219f931275dSmrg
122038c51623SmrgAC_SUBST([M4], [$ac_cv_path_M4])
122138c51623Smrg]) # XORG_WITH_M4
1222f931275dSmrg
122338c51623Smrg# XORG_WITH_PS2PDF([DEFAULT])
122438c51623Smrg# ----------------
122538c51623Smrg# Minimum version: 1.6.0
122638c51623Smrg# Minimum version for optional DEFAULT argument: 1.11.0
122738c51623Smrg#
122838c51623Smrg# Documentation tools are not always available on all platforms and sometimes
122938c51623Smrg# not at the appropriate level. This macro enables a module to test for the
123038c51623Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
123138c51623Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
123238c51623Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
123338c51623Smrg# --with-ps2pdf assumes 'auto'.
1234f931275dSmrg#
123538c51623Smrg# Interface to module:
123638c51623Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
123738c51623Smrg# PS2PDF:	returns the path of the ps2pdf program found
123838c51623Smrg#		returns the path set by the user in the environment
123938c51623Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
124038c51623Smrg#		 'no' user instructs the module not to use ps2pdf
1241f931275dSmrg#
124238c51623Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243f931275dSmrg#
124438c51623SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
124538c51623SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
124638c51623Smrgm4_define([_defopt], m4_default([$1], [auto]))
124738c51623SmrgAC_ARG_WITH(ps2pdf,
124838c51623Smrg	AS_HELP_STRING([--with-ps2pdf],
124938c51623Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
125038c51623Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
125138c51623Smrgm4_undefine([_defopt])
1252f931275dSmrg
125338c51623Smrgif test "x$use_ps2pdf" = x"auto"; then
125438c51623Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
125538c51623Smrg   if test "x$PS2PDF" = "x"; then
125638c51623Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
125738c51623Smrg	have_ps2pdf=no
125838c51623Smrg   else
125938c51623Smrg        have_ps2pdf=yes
126038c51623Smrg   fi
126138c51623Smrgelif test "x$use_ps2pdf" = x"yes" ; then
126238c51623Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
126338c51623Smrg   if test "x$PS2PDF" = "x"; then
126438c51623Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
126538c51623Smrg   fi
126638c51623Smrg   have_ps2pdf=yes
126738c51623Smrgelif test "x$use_ps2pdf" = x"no" ; then
126838c51623Smrg   if test "x$PS2PDF" != "x"; then
126938c51623Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
127038c51623Smrg   fi
127138c51623Smrg   have_ps2pdf=no
1272f931275dSmrgelse
127338c51623Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
127438c51623Smrgfi
127538c51623SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
127638c51623Smrg]) # XORG_WITH_PS2PDF
1277f931275dSmrg
127838c51623Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
127938c51623Smrg# ----------------
128038c51623Smrg# Minimum version: 1.6.0
1281f931275dSmrg#
128238c51623Smrg# Documentation tools are not always available on all platforms and sometimes
128338c51623Smrg# not at the appropriate level. This macro enables a builder to skip all
128438c51623Smrg# documentation targets except traditional man pages.
128538c51623Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
128638c51623Smrg# maximum flexibilty in controlling documentation building.
128738c51623Smrg# Refer to:
128838c51623Smrg# XORG_WITH_XMLTO         --with-xmlto
128938c51623Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
129038c51623Smrg# XORG_WITH_DOXYGEN       --with-doxygen
129138c51623Smrg# XORG_WITH_FOP           --with-fop
129238c51623Smrg# XORG_WITH_GROFF         --with-groff
129338c51623Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294f931275dSmrg#
129538c51623Smrg# Interface to module:
129638c51623Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
129738c51623Smrg# --enable-docs: 'yes' user instructs the module to generate docs
129838c51623Smrg#		 'no' user instructs the module not to generate docs
129938c51623Smrg# parm1:	specify the default value, yes or no.
1300f931275dSmrg#
130138c51623SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
130238c51623Smrgm4_define([docs_default], m4_default([$1], [yes]))
130338c51623SmrgAC_ARG_ENABLE(docs,
130438c51623Smrg	AS_HELP_STRING([--enable-docs],
130538c51623Smrg	   [Enable building the documentation (default: ]docs_default[)]),
130638c51623Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
130738c51623Smrgm4_undefine([docs_default])
130838c51623SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
130938c51623SmrgAC_MSG_CHECKING([whether to build documentation])
131038c51623SmrgAC_MSG_RESULT([$build_docs])
131138c51623Smrg]) # XORG_ENABLE_DOCS
1312f931275dSmrg
131338c51623Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
131438c51623Smrg# ----------------
131538c51623Smrg# Minimum version: 1.6.0
131638c51623Smrg#
131738c51623Smrg# This macro enables a builder to skip all developer documentation.
131838c51623Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
131938c51623Smrg# maximum flexibilty in controlling documentation building.
132038c51623Smrg# Refer to:
132138c51623Smrg# XORG_WITH_XMLTO         --with-xmlto
132238c51623Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
132338c51623Smrg# XORG_WITH_DOXYGEN       --with-doxygen
132438c51623Smrg# XORG_WITH_FOP           --with-fop
132538c51623Smrg# XORG_WITH_GROFF         --with-groff
132638c51623Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
132738c51623Smrg#
132838c51623Smrg# Interface to module:
132938c51623Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
133038c51623Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
133138c51623Smrg#			'no' user instructs the module not to generate developer docs
133238c51623Smrg# parm1:		specify the default value, yes or no.
133338c51623Smrg#
133438c51623SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
133538c51623Smrgm4_define([devel_default], m4_default([$1], [yes]))
133638c51623SmrgAC_ARG_ENABLE(devel-docs,
133738c51623Smrg	AS_HELP_STRING([--enable-devel-docs],
133838c51623Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
133938c51623Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
134038c51623Smrgm4_undefine([devel_default])
134138c51623SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
134238c51623SmrgAC_MSG_CHECKING([whether to build developer documentation])
134338c51623SmrgAC_MSG_RESULT([$build_devel_docs])
134438c51623Smrg]) # XORG_ENABLE_DEVEL_DOCS
1345f931275dSmrg
134638c51623Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
134738c51623Smrg# ----------------
134838c51623Smrg# Minimum version: 1.6.0
134938c51623Smrg#
135038c51623Smrg# This macro enables a builder to skip all functional specification targets.
135138c51623Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
135238c51623Smrg# maximum flexibilty in controlling documentation building.
135338c51623Smrg# Refer to:
135438c51623Smrg# XORG_WITH_XMLTO         --with-xmlto
135538c51623Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
135638c51623Smrg# XORG_WITH_DOXYGEN       --with-doxygen
135738c51623Smrg# XORG_WITH_FOP           --with-fop
135838c51623Smrg# XORG_WITH_GROFF         --with-groff
135938c51623Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
136038c51623Smrg#
136138c51623Smrg# Interface to module:
136238c51623Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
136338c51623Smrg# --enable-specs:	'yes' user instructs the module to generate specs
136438c51623Smrg#			'no' user instructs the module not to generate specs
136538c51623Smrg# parm1:		specify the default value, yes or no.
136638c51623Smrg#
136738c51623SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
136838c51623Smrgm4_define([spec_default], m4_default([$1], [yes]))
136938c51623SmrgAC_ARG_ENABLE(specs,
137038c51623Smrg	AS_HELP_STRING([--enable-specs],
137138c51623Smrg	   [Enable building the specs (default: ]spec_default[)]),
137238c51623Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
137338c51623Smrgm4_undefine([spec_default])
137438c51623SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
137538c51623SmrgAC_MSG_CHECKING([whether to build functional specifications])
137638c51623SmrgAC_MSG_RESULT([$build_specs])
137738c51623Smrg]) # XORG_ENABLE_SPECS
1378f931275dSmrg
137938c51623Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
138038c51623Smrg# ----------------------------------------------
138138c51623Smrg# Minimum version: 1.13.0
138238c51623Smrg#
138338c51623Smrg# This macro enables a builder to enable/disable unit testing
138438c51623Smrg# It makes no assumption about the test cases implementation
138538c51623Smrg# Test cases may or may not use Automake "Support for test suites"
138638c51623Smrg# They may or may not use the software utility library GLib
138738c51623Smrg#
138838c51623Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
138938c51623Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
139038c51623Smrg# The variable enable_unit_tests is used by other macros in this file.
139138c51623Smrg#
139238c51623Smrg# Interface to module:
139338c51623Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
139438c51623Smrg# enable_unit_tests:    used in configure.ac for additional configuration
139538c51623Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
139638c51623Smrg#			'no' user instructs the module not to build tests
139738c51623Smrg# parm1:		specify the default value, yes or no.
139838c51623Smrg#
139938c51623SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
140038c51623SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
140138c51623SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
140238c51623SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
140338c51623Smrgm4_define([_defopt], m4_default([$1], [auto]))
140438c51623SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
140538c51623Smrg	[Enable building unit test cases (default: ]_defopt[)]),
140638c51623Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
140738c51623Smrgm4_undefine([_defopt])
140838c51623SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
140938c51623SmrgAC_MSG_CHECKING([whether to build unit test cases])
141038c51623SmrgAC_MSG_RESULT([$enable_unit_tests])
141138c51623Smrg]) # XORG_ENABLE_UNIT_TESTS
1412f931275dSmrg
141338c51623Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
141438c51623Smrg# ------------------------------------------------------
141538c51623Smrg# Minimum version: 1.17.0
141638c51623Smrg#
141738c51623Smrg# This macro enables a builder to enable/disable integration testing
141838c51623Smrg# It makes no assumption about the test cases' implementation
141938c51623Smrg# Test cases may or may not use Automake "Support for test suites"
142038c51623Smrg#
142138c51623Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
142238c51623Smrg# usually requires less dependencies and may be built and run under less
142338c51623Smrg# stringent environments than integration tests.
142438c51623Smrg#
142538c51623Smrg# Interface to module:
142638c51623Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
142738c51623Smrg# enable_integration_tests:   used in configure.ac for additional configuration
142838c51623Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
142938c51623Smrg#                             'no' user instructs the module not to build tests
143038c51623Smrg# parm1:                      specify the default value, yes or no.
143138c51623Smrg#
143238c51623SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
143338c51623SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
143438c51623Smrgm4_define([_defopt], m4_default([$1], [auto]))
143538c51623SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
143638c51623Smrg	[Enable building integration test cases (default: ]_defopt[)]),
143738c51623Smrg	[enable_integration_tests=$enableval],
143838c51623Smrg	[enable_integration_tests=]_defopt)
143938c51623Smrgm4_undefine([_defopt])
144038c51623SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
144138c51623Smrg	[test "x$enable_integration_tests" != xno])
144238c51623SmrgAC_MSG_CHECKING([whether to build unit test cases])
144338c51623SmrgAC_MSG_RESULT([$enable_integration_tests])
144438c51623Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445f931275dSmrg
144638c51623Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
144738c51623Smrg# ----------------------------------------
144838c51623Smrg# Minimum version: 1.13.0
144938c51623Smrg#
145038c51623Smrg# GLib is a library which provides advanced data structures and functions.
145138c51623Smrg# This macro enables a module to test for the presence of Glib.
145238c51623Smrg#
145338c51623Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
145438c51623Smrg# Otherwise the value of $enable_unit_tests is blank.
145538c51623Smrg#
145638c51623Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
145738c51623Smrg# test support usually requires less dependencies and may be built and run under
145838c51623Smrg# less stringent environments than integration tests.
145938c51623Smrg#
146038c51623Smrg# Interface to module:
146138c51623Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
146238c51623Smrg# with_glib: used in configure.ac to know if GLib has been found
146338c51623Smrg# --with-glib:	'yes' user instructs the module to use glib
146438c51623Smrg#		'no' user instructs the module not to use glib
146538c51623Smrg#
146638c51623SmrgAC_DEFUN([XORG_WITH_GLIB],[
146738c51623SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146838c51623Smrgm4_define([_defopt], m4_default([$2], [auto]))
146938c51623SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
147038c51623Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
147138c51623Smrg	[with_glib=$withval], [with_glib=]_defopt)
147238c51623Smrgm4_undefine([_defopt])
1473f931275dSmrg
147438c51623Smrghave_glib=no
147538c51623Smrg# Do not probe GLib if user explicitly disabled unit testing
147638c51623Smrgif test "x$enable_unit_tests" != x"no"; then
147738c51623Smrg  # Do not probe GLib if user explicitly disabled it
147838c51623Smrg  if test "x$with_glib" != x"no"; then
147938c51623Smrg    m4_ifval(
148038c51623Smrg      [$1],
148138c51623Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
148238c51623Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
148338c51623Smrg    )
148438c51623Smrg  fi
148538c51623Smrgfi
1486f931275dSmrg
148738c51623Smrg# Not having GLib when unit testing has been explicitly requested is an error
148838c51623Smrgif test "x$enable_unit_tests" = x"yes"; then
148938c51623Smrg  if test "x$have_glib" = x"no"; then
149038c51623Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149138c51623Smrg  fi
149238c51623Smrgfi
1493f931275dSmrg
149438c51623Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
149538c51623Smrgif test "x$enable_unit_tests" = x"no"; then
149638c51623Smrg  if test "x$with_glib" = x"yes"; then
149738c51623Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149838c51623Smrg  fi
149938c51623Smrgfi
1500f931275dSmrg
150138c51623Smrg# Not having GLib when it has been explicitly requested is an error
150238c51623Smrgif test "x$with_glib" = x"yes"; then
150338c51623Smrg  if test "x$have_glib" = x"no"; then
150438c51623Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
150538c51623Smrg  fi
150638c51623Smrgfi
1507f931275dSmrg
150838c51623SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
150938c51623Smrg]) # XORG_WITH_GLIB
151066fe65f6Smrg
151138c51623Smrg# XORG_LD_WRAP([required|optional])
151238c51623Smrg# ---------------------------------
151338c51623Smrg# Minimum version: 1.13.0
1514a9274bcdSmrg#
151538c51623Smrg# Check if linker supports -wrap, passed via compiler flags
1516a9274bcdSmrg#
151738c51623Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
151838c51623Smrg# Otherwise the value of $enable_unit_tests is blank.
1519a9274bcdSmrg#
152038c51623Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
152138c51623Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
152238c51623Smrg# available, an argument of "optional" allows use when some unit tests require
152338c51623Smrg# ld -wrap and others do not.
1524a9274bcdSmrg#
152538c51623SmrgAC_DEFUN([XORG_LD_WRAP],[
152638c51623SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
152738c51623Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
152838c51623Smrg                      void __wrap_exit(int status) { return; }],
152938c51623Smrg                     [exit(0);])])
153038c51623Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
153138c51623Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
153238c51623Smrg  if test "x$have_ld_wrap" = x"no"; then
153338c51623Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
153438c51623Smrg  fi
1535a9274bcdSmrgfi
153638c51623SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
153738c51623Smrg#
153838c51623Smrg]) # XORG_LD_WRAP
153966fe65f6Smrg
154038c51623Smrg# XORG_CHECK_LINKER_FLAGS
154138c51623Smrg# -----------------------
154238c51623Smrg# SYNOPSIS
154338c51623Smrg#
154438c51623Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
154538c51623Smrg#
154638c51623Smrg# DESCRIPTION
154738c51623Smrg#
154838c51623Smrg#   Check whether the given linker FLAGS work with the current language's
154938c51623Smrg#   linker, or whether they give an error.
155038c51623Smrg#
155138c51623Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
155238c51623Smrg#   success/failure.
155338c51623Smrg#
155438c51623Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
155538c51623Smrg#
155638c51623Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
155738c51623Smrg#
155838c51623Smrg# LICENSE
155938c51623Smrg#
156038c51623Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
156138c51623Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
156238c51623Smrg#   Copyright (c) 2009 Matteo Frigo
156338c51623Smrg#
156438c51623Smrg#   This program is free software: you can redistribute it and/or modify it
156538c51623Smrg#   under the terms of the GNU General Public License as published by the
156638c51623Smrg#   Free Software Foundation, either version 3 of the License, or (at your
156738c51623Smrg#   option) any later version.
156838c51623Smrg#
156938c51623Smrg#   This program is distributed in the hope that it will be useful, but
157038c51623Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
157138c51623Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
157238c51623Smrg#   Public License for more details.
157338c51623Smrg#
157438c51623Smrg#   You should have received a copy of the GNU General Public License along
157538c51623Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
157638c51623Smrg#
157738c51623Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
157838c51623Smrg#   gives unlimited permission to copy, distribute and modify the configure
157938c51623Smrg#   scripts that are the output of Autoconf when processing the Macro. You
158038c51623Smrg#   need not follow the terms of the GNU General Public License when using
158138c51623Smrg#   or distributing such scripts, even though portions of the text of the
158238c51623Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
158338c51623Smrg#   all other use of the material that constitutes the Autoconf Macro.
158438c51623Smrg#
158538c51623Smrg#   This special exception to the GPL applies to versions of the Autoconf
158638c51623Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
158738c51623Smrg#   modified version of the Autoconf Macro, you may extend this special
158838c51623Smrg#   exception to the GPL to apply to your modified version as well.#
158938c51623SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
159038c51623Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
159138c51623Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
159238c51623SmrgAS_LITERAL_IF([$1],
159338c51623Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
159438c51623Smrg      ax_save_FLAGS=$LDFLAGS
159538c51623Smrg      LDFLAGS="$1"
159638c51623Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
159738c51623Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
159838c51623Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
159938c51623Smrg      LDFLAGS=$ax_save_FLAGS])],
160038c51623Smrg  [ax_save_FLAGS=$LDFLAGS
160138c51623Smrg   LDFLAGS="$1"
160238c51623Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
160338c51623Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
160438c51623Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
160538c51623Smrg   LDFLAGS=$ax_save_FLAGS])
160638c51623Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
160738c51623SmrgAC_MSG_RESULT($xorg_check_linker_flags)
160838c51623Smrgif test "x$xorg_check_linker_flags" = xyes; then
160938c51623Smrg	m4_default([$2], :)
161066fe65f6Smrgelse
161138c51623Smrg	m4_default([$3], :)
161266fe65f6Smrgfi
161338c51623Smrg]) # XORG_CHECK_LINKER_FLAGS
161466fe65f6Smrg
161538c51623Smrg# XORG_MEMORY_CHECK_FLAGS
1616a9274bcdSmrg# -----------------------
161738c51623Smrg# Minimum version: 1.16.0
161866fe65f6Smrg#
161938c51623Smrg# This macro attempts to find appropriate memory checking functionality
162038c51623Smrg# for various platforms which unit testing code may use to catch various
162138c51623Smrg# forms of memory allocation and access errors in testing.
162238c51623Smrg#
162338c51623Smrg# Interface to module:
162438c51623Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
162538c51623Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162638c51623Smrg#
162738c51623Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162838c51623Smrg#
162938c51623SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
163066fe65f6Smrg
1631a9274bcdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
163238c51623SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
163338c51623Smrg           [Environment variables to enable memory checking in tests])
163466fe65f6Smrg
163538c51623Smrg# Check for different types of support on different platforms
163638c51623Smrgcase $host_os in
163738c51623Smrg    solaris*)
163838c51623Smrg        AC_CHECK_LIB([umem], [umem_alloc],
163938c51623Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
164038c51623Smrg        ;;
164138c51623Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
164238c51623Smrg        # both directly and inverted, so should not be 0 or 255.
164338c51623Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
164438c51623Smrg        ;;
164538c51623Smrg    darwin*)
164638c51623Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
164738c51623Smrg        ;;
164838c51623Smrg    *bsd*)
164938c51623Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
165038c51623Smrg        ;;
165138c51623Smrgesac
165266fe65f6Smrg
165338c51623Smrg# User supplied flags override default flags
165438c51623Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
165538c51623Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1656a9274bcdSmrgfi
165766fe65f6Smrg
165838c51623SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
165938c51623Smrg]) # XORG_WITH_LINT
166066fe65f6Smrg
166138c51623Smrg# XORG_CHECK_MALLOC_ZERO
166238c51623Smrg# ----------------------
166338c51623Smrg# Minimum version: 1.0.0
166438c51623Smrg#
166538c51623Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
166638c51623Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
166738c51623Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
166838c51623SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
166938c51623SmrgAC_ARG_ENABLE(malloc0returnsnull,
167038c51623Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
167138c51623Smrg		       [malloc(0) returns NULL (default: auto)]),
167238c51623Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
167338c51623Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
167466fe65f6Smrg
167538c51623SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
167638c51623Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
167738c51623SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
167838c51623Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
167938c51623Smrg#include <stdlib.h>
168038c51623Smrg],[
168138c51623Smrg    char *m0, *r0, *c0, *p;
168238c51623Smrg    m0 = malloc(0);
168338c51623Smrg    p = malloc(10);
168438c51623Smrg    r0 = realloc(p,0);
168538c51623Smrg    c0 = calloc(0,10);
168638c51623Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
168738c51623Smrg])],
168838c51623Smrg		[xorg_cv_malloc0_returns_null=yes],
168938c51623Smrg		[xorg_cv_malloc0_returns_null=no])])
169038c51623SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1691a9274bcdSmrgfi
169238c51623SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
169366fe65f6Smrg
169438c51623Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
169538c51623Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
169638c51623Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
169738c51623Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
169848af84faSmrgelse
169938c51623Smrg	MALLOC_ZERO_CFLAGS=""
170038c51623Smrg	XMALLOC_ZERO_CFLAGS=""
170138c51623Smrg	XTMALLOC_ZERO_CFLAGS=""
170248af84faSmrgfi
170348af84faSmrg
170438c51623SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
170538c51623SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
170638c51623SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
170738c51623Smrg]) # XORG_CHECK_MALLOC_ZERO
170848af84faSmrg
170938c51623Smrg# XORG_WITH_LINT()
171038c51623Smrg# ----------------
171138c51623Smrg# Minimum version: 1.1.0
171266fe65f6Smrg#
171338c51623Smrg# This macro enables the use of a tool that flags some suspicious and
171438c51623Smrg# non-portable constructs (likely to be bugs) in C language source code.
171538c51623Smrg# It will attempt to locate the tool and use appropriate options.
171638c51623Smrg# There are various lint type tools on different platforms.
171738c51623Smrg#
171838c51623Smrg# Interface to module:
171938c51623Smrg# LINT:		returns the path to the tool found on the platform
172038c51623Smrg#		or the value set to LINT on the configure cmd line
172138c51623Smrg#		also an Automake conditional
172238c51623Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
172338c51623Smrg#
172438c51623Smrg# --with-lint:	'yes' user instructs the module to use lint
172538c51623Smrg#		'no' user instructs the module not to use lint (default)
172638c51623Smrg#
172738c51623Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
172838c51623Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
172938c51623Smrg#
173038c51623SmrgAC_DEFUN([XORG_WITH_LINT],[
173166fe65f6Smrg
173238c51623SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
173338c51623SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
173438c51623SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
173538c51623Smrg		[Use a lint-style source code checker (default: disabled)])],
173638c51623Smrg		[use_lint=$withval], [use_lint=no])
173766fe65f6Smrg
173838c51623Smrg# Obtain platform specific info like program name and options
173938c51623Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
174038c51623Smrgcase $host_os in
174138c51623Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
174238c51623Smrg	lint_name=splint
174338c51623Smrg	lint_options="-badflag"
174438c51623Smrg	;;
174538c51623Smrg  *freebsd* | *netbsd*)
174638c51623Smrg	lint_name=lint
174738c51623Smrg	lint_options="-u -b"
174838c51623Smrg	;;
174938c51623Smrg  *solaris*)
175038c51623Smrg	lint_name=lint
175138c51623Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
175238c51623Smrg	;;
175338c51623Smrgesac
175466fe65f6Smrg
175538c51623Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
175638c51623Smrgif test "x$use_lint" = x"yes" ; then
175738c51623Smrg   AC_PATH_PROG([LINT], [$lint_name])
175838c51623Smrg   if test "x$LINT" = "x"; then
175938c51623Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
176038c51623Smrg   fi
176138c51623Smrgelif test "x$use_lint" = x"no" ; then
176238c51623Smrg   if test "x$LINT" != "x"; then
176338c51623Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
176438c51623Smrg   fi
176566fe65f6Smrgelse
176638c51623Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
176766fe65f6Smrgfi
176866fe65f6Smrg
176938c51623Smrg# User supplied flags override default flags
177038c51623Smrgif test "x$LINT_FLAGS" != "x"; then
177138c51623Smrg   lint_options=$LINT_FLAGS
1772a9274bcdSmrgfi
1773a9274bcdSmrg
177438c51623SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
177538c51623SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776a9274bcdSmrg
177738c51623Smrg]) # XORG_WITH_LINT
1778a9274bcdSmrg
177938c51623Smrg# XORG_LINT_LIBRARY(LIBNAME)
178038c51623Smrg# --------------------------
178138c51623Smrg# Minimum version: 1.1.0
178266fe65f6Smrg#
178338c51623Smrg# Sets up flags for building lint libraries for checking programs that call
178438c51623Smrg# functions in the library.
178538c51623Smrg#
178638c51623Smrg# Interface to module:
178738c51623Smrg# LINTLIB		- Automake variable with the name of lint library file to make
178838c51623Smrg# MAKE_LINT_LIB		- Automake conditional
178938c51623Smrg#
179038c51623Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
179138c51623Smrg#			  - 'no' user instructs the module not to create a lint library (default)
179266fe65f6Smrg
179338c51623SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
179438c51623SmrgAC_REQUIRE([XORG_WITH_LINT])
179538c51623SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
179638c51623Smrg	[Create lint library (default: disabled)])],
179738c51623Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1798a9274bcdSmrg
179938c51623Smrgif test "x$make_lint_lib" = x"yes" ; then
180038c51623Smrg   LINTLIB=llib-l$1.ln
180138c51623Smrg   if test "x$LINT" = "x"; then
180238c51623Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
180338c51623Smrg   fi
180438c51623Smrgelif test "x$make_lint_lib" != x"no" ; then
180538c51623Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
180666fe65f6Smrgfi
180766fe65f6Smrg
180838c51623SmrgAC_SUBST(LINTLIB)
180938c51623SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1810a9274bcdSmrg
181138c51623Smrg]) # XORG_LINT_LIBRARY
1812a9274bcdSmrg
181338c51623Smrg# XORG_COMPILER_BRAND
181438c51623Smrg# -------------------
181538c51623Smrg# Minimum version: 1.14.0
181648af84faSmrg#
181738c51623Smrg# Checks for various brands of compilers and sets flags as appropriate:
181838c51623Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
181938c51623Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
182038c51623Smrg#   clang compiler - sets CLANGCC to "yes"
182138c51623Smrg#   Intel compiler - sets INTELCC to "yes"
182238c51623Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
182348af84faSmrg#
182438c51623SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
182538c51623SmrgAC_LANG_CASE(
182638c51623Smrg	[C], [
182738c51623Smrg		AC_REQUIRE([AC_PROG_CC_C99])
182838c51623Smrg	],
182938c51623Smrg	[C++], [
183038c51623Smrg		AC_REQUIRE([AC_PROG_CXX])
183138c51623Smrg	]
183238c51623Smrg)
183338c51623SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
183438c51623SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
183538c51623SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
183638c51623Smrg]) # XORG_COMPILER_BRAND
183738c51623Smrg
183838c51623Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
183938c51623Smrg# ---------------
184038c51623Smrg# Minimum version: 1.16.0
184148af84faSmrg#
184238c51623Smrg# Test if the compiler works when passed the given flag as a command line argument.
184338c51623Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
184438c51623Smrg# next flag in the list until there are no more options.
184548af84faSmrg#
184638c51623Smrg# Note that this does not guarantee that the compiler supports the flag as some
184738c51623Smrg# compilers will simply ignore arguments that they do not understand, but we do
184838c51623Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
184938c51623Smrg# -Werror=unused-command-line-argument
185048af84faSmrg#
185138c51623SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
185238c51623Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185338c51623Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185448af84faSmrg
185538c51623SmrgAC_LANG_COMPILER_REQUIRE
185638c51623Smrg
185738c51623SmrgAC_LANG_CASE(
185838c51623Smrg	[C], [
185938c51623Smrg		AC_REQUIRE([AC_PROG_CC_C99])
186038c51623Smrg		define([PREFIX], [C])
186138c51623Smrg		define([CACHE_PREFIX], [cc])
186238c51623Smrg		define([COMPILER], [$CC])
186338c51623Smrg	],
186438c51623Smrg	[C++], [
186538c51623Smrg		define([PREFIX], [CXX])
186638c51623Smrg		define([CACHE_PREFIX], [cxx])
186738c51623Smrg		define([COMPILER], [$CXX])
186838c51623Smrg	]
186938c51623Smrg)
187038c51623Smrg
187138c51623Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
187238c51623Smrg
187338c51623Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
187438c51623Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
187538c51623Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
187638c51623Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
187738c51623Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
187838c51623Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
187938c51623Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
188038c51623Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
188138c51623Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
188248af84faSmrgfi
188348af84faSmrg
188438c51623Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
188538c51623Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
188638c51623Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
188738c51623Smrg	fi
188838c51623Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
188938c51623Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
189038c51623Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
189138c51623Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
189238c51623Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
189338c51623Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
189438c51623Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
189538c51623Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189638c51623Smrgfi
189748af84faSmrg
189838c51623Smrgfound="no"
189938c51623Smrgm4_foreach([flag], m4_cdr($@), [
190038c51623Smrg	if test $found = "no" ; then
190138c51623Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
190238c51623Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
190338c51623Smrg		fi
190448af84faSmrg
190538c51623Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
190638c51623Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
190738c51623Smrg		fi
190838c51623Smrg
190938c51623Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
191038c51623Smrg
191138c51623Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
191238c51623Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
191338c51623Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
191438c51623Smrg		AC_CACHE_VAL($cacheid,
191538c51623Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
191638c51623Smrg					     [eval $cacheid=yes],
191738c51623Smrg					     [eval $cacheid=no])])
191838c51623Smrg
191938c51623Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
192038c51623Smrg
192138c51623Smrg		eval supported=\$$cacheid
192238c51623Smrg		AC_MSG_RESULT([$supported])
192338c51623Smrg		if test "$supported" = "yes" ; then
192438c51623Smrg			$1="$$1 ]flag["
192538c51623Smrg			found="yes"
192638c51623Smrg		fi
192738c51623Smrg	fi
192838c51623Smrg])
192938c51623Smrg]) # XORG_TESTSET_CFLAG
193038c51623Smrg
193138c51623Smrg# XORG_COMPILER_FLAGS
193238c51623Smrg# ---------------
193338c51623Smrg# Minimum version: 1.16.0
1934f931275dSmrg#
193538c51623Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
193638c51623Smrg# arguments supported by the selected compiler which do NOT alter the generated
193738c51623Smrg# code.  These arguments will cause the compiler to print various warnings
193838c51623Smrg# during compilation AND turn a conservative set of warnings into errors.
1939f931275dSmrg#
194038c51623Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
194138c51623Smrg# future versions of util-macros as options are added to new compilers.
1942f931275dSmrg#
194338c51623SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
194438c51623SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945f931275dSmrg
194638c51623SmrgAC_ARG_ENABLE(selective-werror,
194738c51623Smrg              AS_HELP_STRING([--disable-selective-werror],
194838c51623Smrg                             [Turn off selective compiler errors. (default: enabled)]),
194938c51623Smrg              [SELECTIVE_WERROR=$enableval],
195038c51623Smrg              [SELECTIVE_WERROR=yes])
195138c51623Smrg
195238c51623SmrgAC_LANG_CASE(
195338c51623Smrg        [C], [
195438c51623Smrg                define([PREFIX], [C])
195538c51623Smrg        ],
195638c51623Smrg        [C++], [
195738c51623Smrg                define([PREFIX], [CXX])
195838c51623Smrg        ]
195938c51623Smrg)
196038c51623Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
196138c51623Smrgif test "x$SUNCC" = "xyes"; then
196238c51623Smrg    [BASE_]PREFIX[FLAGS]="-v"
1963f931275dSmrgelse
196438c51623Smrg    [BASE_]PREFIX[FLAGS]=""
1965f931275dSmrgfi
1966f931275dSmrg
196738c51623Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
196838c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
196938c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
197038c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
197138c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972f931275dSmrg
197338c51623SmrgAC_LANG_CASE(
197438c51623Smrg	[C], [
197538c51623Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
197638c51623Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
197738c51623Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
197838c51623Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
197938c51623Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
198038c51623Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
198138c51623Smrg	]
198238c51623Smrg)
198338c51623Smrg
198438c51623Smrg# This chunk adds additional warnings that could catch undesired effects.
198538c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
198638c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
198738c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
198838c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
198938c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
199038c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
199138c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
199238c51623Smrg
199338c51623Smrg# These are currently disabled because they are noisy.  They will be enabled
199438c51623Smrg# in the future once the codebase is sufficiently modernized to silence
199538c51623Smrg# them.  For now, I don't want them to drown out the other warnings.
199638c51623Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
199738c51623Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
199838c51623Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
199938c51623Smrg
200038c51623Smrg# Turn some warnings into errors, so we don't accidently get successful builds
200138c51623Smrg# when there are problems that should be fixed.
200238c51623Smrg
200338c51623Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
200438c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
200538c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
200638c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
200738c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
200838c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
200938c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
201038c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
201138c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
201238c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
201338c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
201438c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
201538c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
201638c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201738c51623Smrgelse
201838c51623SmrgAC_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])
201938c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
202038c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
202138c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
202238c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
202338c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
202438c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
202538c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
202638c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
202738c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
202838c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
202938c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
203038c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
203138c51623SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203238c51623Smrgfi
203338c51623Smrg
203438c51623SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203538c51623Smrg]) # XORG_COMPILER_FLAGS
203638c51623Smrg
203738c51623Smrg# XORG_CWARNFLAGS
203838c51623Smrg# ---------------
203938c51623Smrg# Minimum version: 1.2.0
204038c51623Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041f931275dSmrg#
204238c51623Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2043f931275dSmrg#
204438c51623Smrg# This function is deprecated because it defines -fno-strict-aliasing
204538c51623Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
204638c51623Smrg# is needed, then it should be added explicitly in the module when
204738c51623Smrg# it is updated to use BASE_CFLAGS.
2048f931275dSmrg#
204938c51623SmrgAC_DEFUN([XORG_CWARNFLAGS], [
205038c51623SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
205138c51623SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
205238c51623SmrgAC_LANG_CASE(
205338c51623Smrg	[C], [
205438c51623Smrg		CWARNFLAGS="$BASE_CFLAGS"
205538c51623Smrg		if  test "x$GCC" = xyes ; then
205638c51623Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
205738c51623Smrg		fi
205838c51623Smrg		AC_SUBST(CWARNFLAGS)
205938c51623Smrg	]
206038c51623Smrg)
206138c51623Smrg]) # XORG_CWARNFLAGS
206238c51623Smrg
206338c51623Smrg# XORG_STRICT_OPTION
206438c51623Smrg# -----------------------
206538c51623Smrg# Minimum version: 1.3.0
2066f931275dSmrg#
206738c51623Smrg# Add configure option to enable strict compilation flags, such as treating
206838c51623Smrg# warnings as fatal errors.
206938c51623Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
207038c51623Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071f931275dSmrg#
207238c51623Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
207338c51623Smrg# when strict compilation is unconditionally desired.
207438c51623SmrgAC_DEFUN([XORG_STRICT_OPTION], [
207538c51623SmrgAC_REQUIRE([XORG_CWARNFLAGS])
207638c51623SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077f931275dSmrg
207838c51623SmrgAC_ARG_ENABLE(strict-compilation,
207938c51623Smrg			  AS_HELP_STRING([--enable-strict-compilation],
208038c51623Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
208138c51623Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082f931275dSmrg
208338c51623SmrgAC_LANG_CASE(
208438c51623Smrg        [C], [
208538c51623Smrg                define([PREFIX], [C])
208638c51623Smrg        ],
208738c51623Smrg        [C++], [
208838c51623Smrg                define([PREFIX], [CXX])
208938c51623Smrg        ]
209038c51623Smrg)
2091f931275dSmrg
209238c51623Smrg[STRICT_]PREFIX[FLAGS]=""
209338c51623SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
209438c51623SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209538c51623Smrg
209638c51623Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
209738c51623Smrg# activate it with -Werror, so we add it here explicitly.
209838c51623SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209938c51623Smrg
210038c51623Smrgif test "x$STRICT_COMPILE" = "xyes"; then
210138c51623Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
210238c51623Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
210338c51623Smrgfi
210438c51623SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
210538c51623SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
210638c51623SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
210738c51623Smrg]) # XORG_STRICT_OPTION
210838c51623Smrg
210938c51623Smrg# XORG_DEFAULT_OPTIONS
211038c51623Smrg# --------------------
211138c51623Smrg# Minimum version: 1.3.0
211248af84faSmrg#
211338c51623Smrg# Defines default options for X.Org modules.
211448af84faSmrg#
211538c51623SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211638c51623SmrgAC_REQUIRE([AC_PROG_INSTALL])
211738c51623SmrgXORG_COMPILER_FLAGS
211838c51623SmrgXORG_CWARNFLAGS
211938c51623SmrgXORG_STRICT_OPTION
212038c51623SmrgXORG_RELEASE_VERSION
212138c51623SmrgXORG_CHANGELOG
212238c51623SmrgXORG_INSTALL
212338c51623SmrgXORG_MANPAGE_SECTIONS
212438c51623Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212538c51623Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212638c51623Smrg]) # XORG_DEFAULT_OPTIONS
212738c51623Smrg
212838c51623Smrg# XORG_INSTALL()
212938c51623Smrg# ----------------
213038c51623Smrg# Minimum version: 1.4.0
213148af84faSmrg#
213238c51623Smrg# Defines the variable INSTALL_CMD as the command to copy
213338c51623Smrg# INSTALL from $prefix/share/util-macros.
213448af84faSmrg#
213538c51623SmrgAC_DEFUN([XORG_INSTALL], [
213638c51623SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213738c51623Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
213838c51623SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
213938c51623Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214038c51623Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214138c51623Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214238c51623SmrgAC_SUBST([INSTALL_CMD])
214338c51623Smrg]) # XORG_INSTALL
214438c51623Smrgdnl Copyright 2005 Red Hat, Inc
214538c51623Smrgdnl
214638c51623Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
214738c51623Smrgdnl documentation for any purpose is hereby granted without fee, provided that
214838c51623Smrgdnl the above copyright notice appear in all copies and that both that
214938c51623Smrgdnl copyright notice and this permission notice appear in supporting
215038c51623Smrgdnl documentation.
215138c51623Smrgdnl
215238c51623Smrgdnl The above copyright notice and this permission notice shall be included
215338c51623Smrgdnl in all copies or substantial portions of the Software.
215438c51623Smrgdnl
215538c51623Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
215638c51623Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215738c51623Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
215838c51623Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
215938c51623Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
216038c51623Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
216138c51623Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
216238c51623Smrgdnl
216338c51623Smrgdnl Except as contained in this notice, the name of the copyright holders shall
216438c51623Smrgdnl not be used in advertising or otherwise to promote the sale, use or
216538c51623Smrgdnl other dealings in this Software without prior written authorization
216638c51623Smrgdnl from the copyright holders.
216738c51623Smrgdnl
216848af84faSmrg
216938c51623Smrg# XORG_RELEASE_VERSION
217038c51623Smrg# --------------------
217138c51623Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
217238c51623Smrg
217338c51623SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
217438c51623Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
217538c51623Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
217638c51623Smrg		[Major version of this package])
217738c51623Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
217838c51623Smrg	if test "x$PVM" = "x"; then
217938c51623Smrg		PVM="0"
218038c51623Smrg	fi
218138c51623Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
218238c51623Smrg		[$PVM],
218338c51623Smrg		[Minor version of this package])
218438c51623Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
218538c51623Smrg	if test "x$PVP" = "x"; then
218638c51623Smrg		PVP="0"
218738c51623Smrg	fi
218838c51623Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
218938c51623Smrg		[$PVP],
219038c51623Smrg		[Patch version of this package])
219138c51623Smrg])
219238c51623Smrg
219338c51623Smrg# XORG_CHANGELOG()
219438c51623Smrg# ----------------
219538c51623Smrg# Minimum version: 1.2.0
219648af84faSmrg#
219738c51623Smrg# Defines the variable CHANGELOG_CMD as the command to generate
219838c51623Smrg# ChangeLog from git.
219948af84faSmrg#
220048af84faSmrg#
220138c51623SmrgAC_DEFUN([XORG_CHANGELOG], [
220238c51623SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220338c51623Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220438c51623Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220538c51623Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220638c51623SmrgAC_SUBST([CHANGELOG_CMD])
220738c51623Smrg]) # XORG_CHANGELOG
220838c51623Smrg
220938c51623Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
221048af84faSmrg#
221138c51623Smrg# This file is free software; the Free Software Foundation
221238c51623Smrg# gives unlimited permission to copy and/or distribute it,
221338c51623Smrg# with or without modifications, as long as this notice is preserved.
221448af84faSmrg
221538c51623Smrg# AM_AUTOMAKE_VERSION(VERSION)
221638c51623Smrg# ----------------------------
221738c51623Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
221838c51623Smrg# generated from the m4 files accompanying Automake X.Y.
221938c51623Smrg# (This private macro should not be called outside this file.)
222038c51623SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
222138c51623Smrg[am__api_version='1.15'
222238c51623Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
222338c51623Smrgdnl require some minimum version.  Point them to the right macro.
222438c51623Smrgm4_if([$1], [1.15], [],
222538c51623Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
222638c51623Smrg])
2227c6a6acfbSmrg
222838c51623Smrg# _AM_AUTOCONF_VERSION(VERSION)
222938c51623Smrg# -----------------------------
223038c51623Smrg# aclocal traces this macro to find the Autoconf version.
223138c51623Smrg# This is a private macro too.  Using m4_define simplifies
223238c51623Smrg# the logic in aclocal, which can simply ignore this definition.
223338c51623Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2234c6a6acfbSmrg
223538c51623Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
223638c51623Smrg# -------------------------------
223738c51623Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
223838c51623Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
223938c51623SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
224038c51623Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
224138c51623Smrgm4_ifndef([AC_AUTOCONF_VERSION],
224238c51623Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
224338c51623Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
224448af84faSmrg
224538c51623Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
224638c51623Smrg
224738c51623Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
224848af84faSmrg#
224938c51623Smrg# This file is free software; the Free Software Foundation
225038c51623Smrg# gives unlimited permission to copy and/or distribute it,
225138c51623Smrg# with or without modifications, as long as this notice is preserved.
225238c51623Smrg
225338c51623Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
225438c51623Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
225538c51623Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
225648af84faSmrg#
225738c51623Smrg# Of course, Automake must honor this variable whenever it calls a
225838c51623Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
225938c51623Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
226038c51623Smrg# depending on how configure is run.  This is pretty annoying, since
226138c51623Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
226238c51623Smrg# source directory, any form will work fine, but in subdirectories a
226338c51623Smrg# relative path needs to be adjusted first.
226448af84faSmrg#
226538c51623Smrg# $ac_aux_dir/missing
226638c51623Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
226738c51623Smrg# $top_srcdir/$ac_aux_dir/missing
226838c51623Smrg#    fails if $ac_aux_dir is absolute,
226938c51623Smrg#    fails when called from a subdirectory in a VPATH build with
227038c51623Smrg#          a relative $ac_aux_dir
227148af84faSmrg#
227238c51623Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
227338c51623Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
227438c51623Smrg# harmless because $srcdir is '.', but things will broke when you
227538c51623Smrg# start a VPATH build or use an absolute $srcdir.
227648af84faSmrg#
227738c51623Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
227838c51623Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
227938c51623Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
228038c51623Smrg# and then we would define $MISSING as
228138c51623Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
228238c51623Smrg# This will work as long as MISSING is not called from configure, because
228338c51623Smrg# unfortunately $(top_srcdir) has no meaning in configure.
228438c51623Smrg# However there are other variables, like CC, which are often used in
228538c51623Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
228648af84faSmrg#
228738c51623Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
228838c51623Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
228938c51623Smrg# configured tree to be moved without reconfiguration.
229048af84faSmrg
229138c51623SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
229238c51623Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
229338c51623Smrg# Expand $ac_aux_dir to an absolute path.
229438c51623Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
229538c51623Smrg])
229638c51623Smrg
229738c51623Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
229838c51623Smrg
229938c51623Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230038c51623Smrg#
230138c51623Smrg# This file is free software; the Free Software Foundation
230238c51623Smrg# gives unlimited permission to copy and/or distribute it,
230338c51623Smrg# with or without modifications, as long as this notice is preserved.
230438c51623Smrg
230538c51623Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
230638c51623Smrg# -------------------------------------
230738c51623Smrg# Define a conditional.
230838c51623SmrgAC_DEFUN([AM_CONDITIONAL],
230938c51623Smrg[AC_PREREQ([2.52])dnl
231038c51623Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
231138c51623Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
231238c51623SmrgAC_SUBST([$1_TRUE])dnl
231338c51623SmrgAC_SUBST([$1_FALSE])dnl
231438c51623Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
231538c51623Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
231638c51623Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
231738c51623Smrgif $2; then
231838c51623Smrg  $1_TRUE=
231938c51623Smrg  $1_FALSE='#'
232048af84faSmrgelse
232138c51623Smrg  $1_TRUE='#'
232238c51623Smrg  $1_FALSE=
232348af84faSmrgfi
232438c51623SmrgAC_CONFIG_COMMANDS_PRE(
232538c51623Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
232638c51623Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
232738c51623SmrgUsually this means the macro was only invoked conditionally.]])
232838c51623Smrgfi])])
232948af84faSmrg
233038c51623Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233138c51623Smrg#
233238c51623Smrg# This file is free software; the Free Software Foundation
233338c51623Smrg# gives unlimited permission to copy and/or distribute it,
233438c51623Smrg# with or without modifications, as long as this notice is preserved.
233548af84faSmrg
233648af84faSmrg
233738c51623Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
233838c51623Smrg# written in clear, in which case automake, when reading aclocal.m4,
233938c51623Smrg# will think it sees a *use*, and therefore will trigger all it's
234038c51623Smrg# C support machinery.  Also note that it means that autoscan, seeing
234138c51623Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
234248af84faSmrg
234338c51623Smrg
234438c51623Smrg# _AM_DEPENDENCIES(NAME)
234538c51623Smrg# ----------------------
234638c51623Smrg# See how the compiler implements dependency checking.
234738c51623Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
234838c51623Smrg# We try a few techniques and use that to set a single cache variable.
234948af84faSmrg#
235038c51623Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
235138c51623Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
235238c51623Smrg# dependency, and given that the user is not expected to run this macro,
235338c51623Smrg# just rely on AC_PROG_CC.
235438c51623SmrgAC_DEFUN([_AM_DEPENDENCIES],
235538c51623Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
235638c51623SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
235738c51623SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
235838c51623SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
235948af84faSmrg
236038c51623Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
236138c51623Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
236238c51623Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
236338c51623Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
236438c51623Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
236538c51623Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
236638c51623Smrg                    [depcc="$$1"   am_compiler_list=])
2367f931275dSmrg
236838c51623SmrgAC_CACHE_CHECK([dependency style of $depcc],
236938c51623Smrg               [am_cv_$1_dependencies_compiler_type],
237038c51623Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
237138c51623Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
237238c51623Smrg  # making bogus files that we don't know about and never remove.  For
237338c51623Smrg  # instance it was reported that on HP-UX the gcc test will end up
237438c51623Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
237538c51623Smrg  # in D".
237638c51623Smrg  rm -rf conftest.dir
237738c51623Smrg  mkdir conftest.dir
237838c51623Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
237938c51623Smrg  # using a relative directory.
238038c51623Smrg  cp "$am_depcomp" conftest.dir
238138c51623Smrg  cd conftest.dir
238238c51623Smrg  # We will build objects and dependencies in a subdirectory because
238338c51623Smrg  # it helps to detect inapplicable dependency modes.  For instance
238438c51623Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
238538c51623Smrg  # side effect of compilation, but ICC will put the dependencies in
238638c51623Smrg  # the current directory while Tru64 will put them in the object
238738c51623Smrg  # directory.
238838c51623Smrg  mkdir sub
238948af84faSmrg
239038c51623Smrg  am_cv_$1_dependencies_compiler_type=none
239138c51623Smrg  if test "$am_compiler_list" = ""; then
239238c51623Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
239338c51623Smrg  fi
239438c51623Smrg  am__universal=false
239538c51623Smrg  m4_case([$1], [CC],
239638c51623Smrg    [case " $depcc " in #(
239738c51623Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
239838c51623Smrg     esac],
239938c51623Smrg    [CXX],
240038c51623Smrg    [case " $depcc " in #(
240138c51623Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
240238c51623Smrg     esac])
2403c6a6acfbSmrg
240438c51623Smrg  for depmode in $am_compiler_list; do
240538c51623Smrg    # Setup a source with many dependencies, because some compilers
240638c51623Smrg    # like to wrap large dependency lists on column 80 (with \), and
240738c51623Smrg    # we should not choose a depcomp mode which is confused by this.
240838c51623Smrg    #
240938c51623Smrg    # We need to recreate these files for each test, as the compiler may
241038c51623Smrg    # overwrite some of them when testing with obscure command lines.
241138c51623Smrg    # This happens at least with the AIX C compiler.
241238c51623Smrg    : > sub/conftest.c
241338c51623Smrg    for i in 1 2 3 4 5 6; do
241438c51623Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
241538c51623Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
241638c51623Smrg      # Solaris 10 /bin/sh.
241738c51623Smrg      echo '/* dummy */' > sub/conftst$i.h
241838c51623Smrg    done
241938c51623Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2420c6a6acfbSmrg
242138c51623Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
242238c51623Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
242338c51623Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
242438c51623Smrg    # versions had trouble with output in subdirs.
242538c51623Smrg    am__obj=sub/conftest.${OBJEXT-o}
242638c51623Smrg    am__minus_obj="-o $am__obj"
242738c51623Smrg    case $depmode in
242838c51623Smrg    gcc)
242938c51623Smrg      # This depmode causes a compiler race in universal mode.
243038c51623Smrg      test "$am__universal" = false || continue
243138c51623Smrg      ;;
243238c51623Smrg    nosideeffect)
243338c51623Smrg      # After this tag, mechanisms are not by side-effect, so they'll
243438c51623Smrg      # only be used when explicitly requested.
243538c51623Smrg      if test "x$enable_dependency_tracking" = xyes; then
243638c51623Smrg	continue
243738c51623Smrg      else
243838c51623Smrg	break
243938c51623Smrg      fi
244038c51623Smrg      ;;
244138c51623Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
244238c51623Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
244338c51623Smrg      # not run yet.  These depmodes are late enough in the game, and
244438c51623Smrg      # so weak that their functioning should not be impacted.
244538c51623Smrg      am__obj=conftest.${OBJEXT-o}
244638c51623Smrg      am__minus_obj=
244738c51623Smrg      ;;
244838c51623Smrg    none) break ;;
244938c51623Smrg    esac
245038c51623Smrg    if depmode=$depmode \
245138c51623Smrg       source=sub/conftest.c object=$am__obj \
245238c51623Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
245338c51623Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
245438c51623Smrg         >/dev/null 2>conftest.err &&
245538c51623Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
245638c51623Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
245738c51623Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
245838c51623Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
245938c51623Smrg      # icc doesn't choke on unknown options, it will just issue warnings
246038c51623Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
246138c51623Smrg      # that says an option was ignored or not supported.
246238c51623Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
246338c51623Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
246438c51623Smrg      # The diagnosis changed in icc 8.0:
246538c51623Smrg      #   icc: Command line remark: option '-MP' not supported
246638c51623Smrg      if (grep 'ignoring option' conftest.err ||
246738c51623Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
246838c51623Smrg        am_cv_$1_dependencies_compiler_type=$depmode
246938c51623Smrg        break
247038c51623Smrg      fi
247138c51623Smrg    fi
247238c51623Smrg  done
247348af84faSmrg
247438c51623Smrg  cd ..
247538c51623Smrg  rm -rf conftest.dir
247648af84faSmrgelse
247738c51623Smrg  am_cv_$1_dependencies_compiler_type=none
247848af84faSmrgfi
247938c51623Smrg])
248038c51623SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
248138c51623SmrgAM_CONDITIONAL([am__fastdep$1], [
248238c51623Smrg  test "x$enable_dependency_tracking" != xno \
248338c51623Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
248438c51623Smrg])
248548af84faSmrg
248648af84faSmrg
248738c51623Smrg# AM_SET_DEPDIR
248838c51623Smrg# -------------
248938c51623Smrg# Choose a directory name for dependency files.
249038c51623Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
249138c51623SmrgAC_DEFUN([AM_SET_DEPDIR],
249238c51623Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
249338c51623SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
249438c51623Smrg])
249538c51623Smrg
249638c51623Smrg
249738c51623Smrg# AM_DEP_TRACK
249838c51623Smrg# ------------
249938c51623SmrgAC_DEFUN([AM_DEP_TRACK],
250038c51623Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
250138c51623SmrgAS_HELP_STRING(
250238c51623Smrg  [--enable-dependency-tracking],
250338c51623Smrg  [do not reject slow dependency extractors])
250438c51623SmrgAS_HELP_STRING(
250538c51623Smrg  [--disable-dependency-tracking],
250638c51623Smrg  [speeds up one-time build])])
250738c51623Smrgif test "x$enable_dependency_tracking" != xno; then
250838c51623Smrg  am_depcomp="$ac_aux_dir/depcomp"
250938c51623Smrg  AMDEPBACKSLASH='\'
251038c51623Smrg  am__nodep='_no'
251138c51623Smrgfi
251238c51623SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
251338c51623SmrgAC_SUBST([AMDEPBACKSLASH])dnl
251438c51623Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
251538c51623SmrgAC_SUBST([am__nodep])dnl
251638c51623Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
251738c51623Smrg])
251848af84faSmrg
251938c51623Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
252048af84faSmrg
252138c51623Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2522f931275dSmrg#
252338c51623Smrg# This file is free software; the Free Software Foundation
252438c51623Smrg# gives unlimited permission to copy and/or distribute it,
252538c51623Smrg# with or without modifications, as long as this notice is preserved.
2526f931275dSmrg
2527c6a6acfbSmrg
252838c51623Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
252938c51623Smrg# ------------------------------
253038c51623SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
253138c51623Smrg[{
253238c51623Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
253338c51623Smrg  # are listed without --file.  Let's play safe and only enable the eval
253438c51623Smrg  # if we detect the quoting.
253538c51623Smrg  case $CONFIG_FILES in
253638c51623Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
253738c51623Smrg  *)   set x $CONFIG_FILES ;;
253838c51623Smrg  esac
253938c51623Smrg  shift
254038c51623Smrg  for mf
254138c51623Smrg  do
254238c51623Smrg    # Strip MF so we end up with the name of the file.
254338c51623Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
254438c51623Smrg    # Check whether this is an Automake generated Makefile or not.
254538c51623Smrg    # We used to match only the files named 'Makefile.in', but
254638c51623Smrg    # some people rename them; so instead we look at the file content.
254738c51623Smrg    # Grep'ing the first line is not enough: some people post-process
254838c51623Smrg    # each Makefile.in and add a new line on top of each file to say so.
254938c51623Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
255038c51623Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
255138c51623Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
255238c51623Smrg      dirpart=`AS_DIRNAME("$mf")`
255338c51623Smrg    else
255438c51623Smrg      continue
255538c51623Smrg    fi
255638c51623Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
255738c51623Smrg    # from the Makefile without running 'make'.
255838c51623Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
255938c51623Smrg    test -z "$DEPDIR" && continue
256038c51623Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
256138c51623Smrg    test -z "$am__include" && continue
256238c51623Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
256338c51623Smrg    # Find all dependency output files, they are included files with
256438c51623Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
256538c51623Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
256638c51623Smrg    # expansion.
256738c51623Smrg    for file in `sed -n "
256838c51623Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
256938c51623Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
257038c51623Smrg      # Make sure the directory exists.
257138c51623Smrg      test -f "$dirpart/$file" && continue
257238c51623Smrg      fdir=`AS_DIRNAME(["$file"])`
257338c51623Smrg      AS_MKDIR_P([$dirpart/$fdir])
257438c51623Smrg      # echo "creating $dirpart/$file"
257538c51623Smrg      echo '# dummy' > "$dirpart/$file"
257638c51623Smrg    done
257738c51623Smrg  done
257838c51623Smrg}
257938c51623Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
258038c51623Smrg
258138c51623Smrg
258238c51623Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
258338c51623Smrg# -----------------------------
258438c51623Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2585c6a6acfbSmrg#
258638c51623Smrg# This code is only required when automatic dependency tracking
258738c51623Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
258838c51623Smrg# need in order to bootstrap the dependency handling code.
258938c51623SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
259038c51623Smrg[AC_CONFIG_COMMANDS([depfiles],
259138c51623Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
259238c51623Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
259338c51623Smrg])
259438c51623Smrg
259538c51623Smrg# Do all the work for Automake.                             -*- Autoconf -*-
259638c51623Smrg
259738c51623Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
2598f931275dSmrg#
259938c51623Smrg# This file is free software; the Free Software Foundation
260038c51623Smrg# gives unlimited permission to copy and/or distribute it,
260138c51623Smrg# with or without modifications, as long as this notice is preserved.
2602f931275dSmrg
260338c51623Smrg# This macro actually does too much.  Some checks are only needed if
260438c51623Smrg# your package does certain things.  But this isn't really a big deal.
2605f931275dSmrg
260638c51623Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
260738c51623Smrgm4_define([AC_PROG_CC],
260838c51623Smrgm4_defn([AC_PROG_CC])
260938c51623Smrg[_AM_PROG_CC_C_O
261038c51623Smrg])
2611f931275dSmrg
261238c51623Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
261338c51623Smrg# AM_INIT_AUTOMAKE([OPTIONS])
261438c51623Smrg# -----------------------------------------------
261538c51623Smrg# The call with PACKAGE and VERSION arguments is the old style
261638c51623Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
261738c51623Smrg# and VERSION should now be passed to AC_INIT and removed from
261838c51623Smrg# the call to AM_INIT_AUTOMAKE.
261938c51623Smrg# We support both call styles for the transition.  After
262038c51623Smrg# the next Automake release, Autoconf can make the AC_INIT
262138c51623Smrg# arguments mandatory, and then we can depend on a new Autoconf
262238c51623Smrg# release and drop the old call support.
262338c51623SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
262438c51623Smrg[AC_PREREQ([2.65])dnl
262538c51623Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
262638c51623Smrgdnl the ones we care about.
262738c51623Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
262838c51623SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
262938c51623SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
263038c51623Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
263138c51623Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
263238c51623Smrg  # is not polluted with repeated "-I."
263338c51623Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
263438c51623Smrg  # test to see if srcdir already configured
263538c51623Smrg  if test -f $srcdir/config.status; then
263638c51623Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637f931275dSmrg  fi
2638f931275dSmrgfi
2639f931275dSmrg
264038c51623Smrg# test whether we have cygpath
264138c51623Smrgif test -z "$CYGPATH_W"; then
264238c51623Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
264338c51623Smrg    CYGPATH_W='cygpath -w'
264438c51623Smrg  else
264538c51623Smrg    CYGPATH_W=echo
2646f931275dSmrg  fi
2647f931275dSmrgfi
264838c51623SmrgAC_SUBST([CYGPATH_W])
2649f931275dSmrg
265038c51623Smrg# Define the identity of the package.
265138c51623Smrgdnl Distinguish between old-style and new-style calls.
265238c51623Smrgm4_ifval([$2],
265338c51623Smrg[AC_DIAGNOSE([obsolete],
265438c51623Smrg             [$0: two- and three-arguments forms are deprecated.])
265538c51623Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
265638c51623Smrg AC_SUBST([PACKAGE], [$1])dnl
265738c51623Smrg AC_SUBST([VERSION], [$2])],
265838c51623Smrg[_AM_SET_OPTIONS([$1])dnl
265938c51623Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
266038c51623Smrgm4_if(
266138c51623Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
266238c51623Smrg  [ok:ok],,
266338c51623Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
266438c51623Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
266538c51623Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666f931275dSmrg
266738c51623Smrg_AM_IF_OPTION([no-define],,
266838c51623Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
266938c51623Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670f931275dSmrg
267138c51623Smrg# Some tools Automake needs.
267238c51623SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
267338c51623SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
267438c51623SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
267538c51623SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
267638c51623SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
267738c51623SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
267838c51623SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
267938c51623SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
268038c51623SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
268138c51623SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
268238c51623Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
268338c51623Smrg# dies out for good.  For more background, see:
268438c51623Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
268538c51623Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
268638c51623SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
268738c51623Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
268838c51623Smrg# system "awk" is bad on some platforms.
268938c51623SmrgAC_REQUIRE([AC_PROG_AWK])dnl
269038c51623SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
269138c51623SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
269238c51623Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
269338c51623Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
269438c51623Smrg			     [_AM_PROG_TAR([v7])])])
269538c51623Smrg_AM_IF_OPTION([no-dependencies],,
269638c51623Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
269738c51623Smrg		  [_AM_DEPENDENCIES([CC])],
269838c51623Smrg		  [m4_define([AC_PROG_CC],
269938c51623Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
270038c51623SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
270138c51623Smrg		  [_AM_DEPENDENCIES([CXX])],
270238c51623Smrg		  [m4_define([AC_PROG_CXX],
270338c51623Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
270438c51623SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
270538c51623Smrg		  [_AM_DEPENDENCIES([OBJC])],
270638c51623Smrg		  [m4_define([AC_PROG_OBJC],
270738c51623Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
270838c51623SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
270938c51623Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
271038c51623Smrg		  [m4_define([AC_PROG_OBJCXX],
271138c51623Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
271238c51623Smrg])
271338c51623SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
271438c51623Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
271538c51623Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
271638c51623Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
271738c51623SmrgAC_CONFIG_COMMANDS_PRE(dnl
271838c51623Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
271938c51623Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720f931275dSmrg
272138c51623Smrg# POSIX will say in a future version that running "rm -f" with no argument
272238c51623Smrg# is OK; and we want to be able to make that assumption in our Makefile
272338c51623Smrg# recipes.  So use an aggressive probe to check that the usage we want is
272438c51623Smrg# actually supported "in the wild" to an acceptable degree.
272538c51623Smrg# See automake bug#10828.
272638c51623Smrg# To make any issue more visible, cause the running configure to be aborted
272738c51623Smrg# by default if the 'rm' program in use doesn't match our expectations; the
272838c51623Smrg# user can still override this though.
272938c51623Smrgif rm -f && rm -fr && rm -rf; then : OK; else
273038c51623Smrg  cat >&2 <<'END'
273138c51623SmrgOops!
2732f931275dSmrg
273338c51623SmrgYour 'rm' program seems unable to run without file operands specified
273438c51623Smrgon the command line, even when the '-f' option is present.  This is contrary
273538c51623Smrgto the behaviour of most rm programs out there, and not conforming with
273638c51623Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737f931275dSmrg
273838c51623SmrgPlease tell bug-automake@gnu.org about your system, including the value
273938c51623Smrgof your $PATH and any error possibly output before this message.  This
274038c51623Smrgcan help us improve future automake versions.
2741f931275dSmrg
274238c51623SmrgEND
274338c51623Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
274438c51623Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
274538c51623Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
274638c51623Smrg    echo >&2
274738c51623Smrg  else
274838c51623Smrg    cat >&2 <<'END'
274938c51623SmrgAborting the configuration process, to ensure you take notice of the issue.
2750f931275dSmrg
275138c51623SmrgYou can download and install GNU coreutils to get an 'rm' implementation
275238c51623Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753f931275dSmrg
275438c51623SmrgIf you want to complete the configuration process using your problematic
275538c51623Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
275638c51623Smrgto "yes", and re-run configure.
275789d09728Smrg
275838c51623SmrgEND
275938c51623Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
276038c51623Smrg  fi
2761a9274bcdSmrgfi
276238c51623Smrgdnl The trailing newline in this macro's definition is deliberate, for
276338c51623Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
276438c51623Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
276538c51623Smrg])
276689d09728Smrg
276738c51623Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
276838c51623Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
276938c51623Smrgdnl mangled by Autoconf and run in a shell conditional statement.
277038c51623Smrgm4_define([_AC_COMPILER_EXEEXT],
277138c51623Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
277266fe65f6Smrg
277338c51623Smrg# When config.status generates a header, we must update the stamp-h file.
277438c51623Smrg# This file resides in the same directory as the config header
277538c51623Smrg# that is generated.  The stamp files are numbered to have different names.
2776a9274bcdSmrg
277738c51623Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
277838c51623Smrg# loop where config.status creates the headers, so we can generate
277938c51623Smrg# our stamp files there.
278038c51623SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
278138c51623Smrg[# Compute $1's index in $config_headers.
278238c51623Smrg_am_arg=$1
278338c51623Smrg_am_stamp_count=1
278438c51623Smrgfor _am_header in $config_headers :; do
278538c51623Smrg  case $_am_header in
278638c51623Smrg    $_am_arg | $_am_arg:* )
278738c51623Smrg      break ;;
278838c51623Smrg    * )
278938c51623Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
279038c51623Smrg  esac
279138c51623Smrgdone
279238c51623Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
279338c51623Smrg
279438c51623Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2795a9274bcdSmrg#
279638c51623Smrg# This file is free software; the Free Software Foundation
279738c51623Smrg# gives unlimited permission to copy and/or distribute it,
279838c51623Smrg# with or without modifications, as long as this notice is preserved.
279966fe65f6Smrg
280038c51623Smrg# AM_PROG_INSTALL_SH
280138c51623Smrg# ------------------
280238c51623Smrg# Define $install_sh.
280338c51623SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
280438c51623Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
280538c51623Smrgif test x"${install_sh+set}" != xset; then
280638c51623Smrg  case $am_aux_dir in
280738c51623Smrg  *\ * | *\	*)
280838c51623Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
280938c51623Smrg  *)
281038c51623Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
281138c51623Smrg  esac
281238c51623Smrgfi
281338c51623SmrgAC_SUBST([install_sh])])
281448af84faSmrg
281538c51623Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
281638c51623Smrg#
281738c51623Smrg# This file is free software; the Free Software Foundation
281838c51623Smrg# gives unlimited permission to copy and/or distribute it,
281938c51623Smrg# with or without modifications, as long as this notice is preserved.
282048af84faSmrg
282138c51623Smrg# Check whether the underlying file-system supports filenames
282238c51623Smrg# with a leading dot.  For instance MS-DOS doesn't.
282338c51623SmrgAC_DEFUN([AM_SET_LEADING_DOT],
282438c51623Smrg[rm -rf .tst 2>/dev/null
282538c51623Smrgmkdir .tst 2>/dev/null
282638c51623Smrgif test -d .tst; then
282738c51623Smrg  am__leading_dot=.
2828a9274bcdSmrgelse
282938c51623Smrg  am__leading_dot=_
2830a9274bcdSmrgfi
283138c51623Smrgrmdir .tst 2>/dev/null
283238c51623SmrgAC_SUBST([am__leading_dot])])
283366fe65f6Smrg
283438c51623Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835a9274bcdSmrg
283638c51623Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
283748af84faSmrg#
283838c51623Smrg# This file is free software; the Free Software Foundation
283938c51623Smrg# gives unlimited permission to copy and/or distribute it,
284038c51623Smrg# with or without modifications, as long as this notice is preserved.
284148af84faSmrg
284238c51623Smrg# AM_MAKE_INCLUDE()
284338c51623Smrg# -----------------
284438c51623Smrg# Check to see how make treats includes.
284538c51623SmrgAC_DEFUN([AM_MAKE_INCLUDE],
284638c51623Smrg[am_make=${MAKE-make}
284738c51623Smrgcat > confinc << 'END'
284838c51623Smrgam__doit:
284938c51623Smrg	@echo this is the am__doit target
285038c51623Smrg.PHONY: am__doit
285138c51623SmrgEND
285238c51623Smrg# If we don't find an include directive, just comment out the code.
285338c51623SmrgAC_MSG_CHECKING([for style of include used by $am_make])
285438c51623Smrgam__include="#"
285538c51623Smrgam__quote=
285638c51623Smrg_am_result=none
285738c51623Smrg# First try GNU make style include.
285838c51623Smrgecho "include confinc" > confmf
285938c51623Smrg# Ignore all kinds of additional output from 'make'.
286038c51623Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
286138c51623Smrg*the\ am__doit\ target*)
286238c51623Smrg  am__include=include
286338c51623Smrg  am__quote=
286438c51623Smrg  _am_result=GNU
286538c51623Smrg  ;;
286638c51623Smrgesac
286738c51623Smrg# Now try BSD make style include.
286838c51623Smrgif test "$am__include" = "#"; then
286938c51623Smrg   echo '.include "confinc"' > confmf
287038c51623Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
287138c51623Smrg   *the\ am__doit\ target*)
287238c51623Smrg     am__include=.include
287338c51623Smrg     am__quote="\""
287438c51623Smrg     _am_result=BSD
287538c51623Smrg     ;;
287638c51623Smrg   esac
2877a9274bcdSmrgfi
287838c51623SmrgAC_SUBST([am__include])
287938c51623SmrgAC_SUBST([am__quote])
288038c51623SmrgAC_MSG_RESULT([$_am_result])
288138c51623Smrgrm -f confinc confmf
288238c51623Smrg])
288348af84faSmrg
288438c51623Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885f931275dSmrg
288638c51623Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887f931275dSmrg#
288838c51623Smrg# This file is free software; the Free Software Foundation
288938c51623Smrg# gives unlimited permission to copy and/or distribute it,
289038c51623Smrg# with or without modifications, as long as this notice is preserved.
2891c6a6acfbSmrg
289238c51623Smrg# AM_MISSING_PROG(NAME, PROGRAM)
289338c51623Smrg# ------------------------------
289438c51623SmrgAC_DEFUN([AM_MISSING_PROG],
289538c51623Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
289638c51623Smrg$1=${$1-"${am_missing_run}$2"}
289738c51623SmrgAC_SUBST($1)])
2898f931275dSmrg
289938c51623Smrg# AM_MISSING_HAS_RUN
290038c51623Smrg# ------------------
290138c51623Smrg# Define MISSING if not defined so far and test if it is modern enough.
290238c51623Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
290338c51623SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
290438c51623Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
290538c51623SmrgAC_REQUIRE_AUX_FILE([missing])dnl
290638c51623Smrgif test x"${MISSING+set}" != xset; then
290738c51623Smrg  case $am_aux_dir in
290838c51623Smrg  *\ * | *\	*)
290938c51623Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
291038c51623Smrg  *)
291138c51623Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
291238c51623Smrg  esac
2913f931275dSmrgfi
291438c51623Smrg# Use eval to expand $SHELL
291538c51623Smrgif eval "$MISSING --is-lightweight"; then
291638c51623Smrg  am_missing_run="$MISSING "
291738c51623Smrgelse
291838c51623Smrg  am_missing_run=
291938c51623Smrg  AC_MSG_WARN(['missing' script is too old or missing])
2920f931275dSmrgfi
292138c51623Smrg])
2922f931275dSmrg
292338c51623Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2924f931275dSmrg
292538c51623Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292638c51623Smrg#
292738c51623Smrg# This file is free software; the Free Software Foundation
292838c51623Smrg# gives unlimited permission to copy and/or distribute it,
292938c51623Smrg# with or without modifications, as long as this notice is preserved.
2930f931275dSmrg
293138c51623Smrg# _AM_MANGLE_OPTION(NAME)
293238c51623Smrg# -----------------------
293338c51623SmrgAC_DEFUN([_AM_MANGLE_OPTION],
293438c51623Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935f931275dSmrg
293638c51623Smrg# _AM_SET_OPTION(NAME)
293738c51623Smrg# --------------------
293838c51623Smrg# Set option NAME.  Presently that only means defining a flag for this option.
293938c51623SmrgAC_DEFUN([_AM_SET_OPTION],
294038c51623Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941f931275dSmrg
294238c51623Smrg# _AM_SET_OPTIONS(OPTIONS)
294338c51623Smrg# ------------------------
294438c51623Smrg# OPTIONS is a space-separated list of Automake options.
294538c51623SmrgAC_DEFUN([_AM_SET_OPTIONS],
294638c51623Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947f931275dSmrg
294838c51623Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
294938c51623Smrg# -------------------------------------------
295038c51623Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
295138c51623SmrgAC_DEFUN([_AM_IF_OPTION],
295238c51623Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953f931275dSmrg
295438c51623Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955f931275dSmrg#
295638c51623Smrg# This file is free software; the Free Software Foundation
295738c51623Smrg# gives unlimited permission to copy and/or distribute it,
295838c51623Smrg# with or without modifications, as long as this notice is preserved.
2959f931275dSmrg
296038c51623Smrg# _AM_PROG_CC_C_O
296138c51623Smrg# ---------------
296238c51623Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
296338c51623Smrg# to automatically call this.
296438c51623SmrgAC_DEFUN([_AM_PROG_CC_C_O],
296538c51623Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
296638c51623SmrgAC_REQUIRE_AUX_FILE([compile])dnl
296738c51623SmrgAC_LANG_PUSH([C])dnl
296838c51623SmrgAC_CACHE_CHECK(
296938c51623Smrg  [whether $CC understands -c and -o together],
297038c51623Smrg  [am_cv_prog_cc_c_o],
297138c51623Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
297238c51623Smrg  # Make sure it works both with $CC and with simple cc.
297338c51623Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
297438c51623Smrg  # compilers refuse to overwrite an existing .o file with -o,
297538c51623Smrg  # though they will create one.
297638c51623Smrg  am_cv_prog_cc_c_o=yes
297738c51623Smrg  for am_i in 1 2; do
297838c51623Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
297938c51623Smrg         && test -f conftest2.$ac_objext; then
298038c51623Smrg      : OK
298138c51623Smrg    else
298238c51623Smrg      am_cv_prog_cc_c_o=no
298338c51623Smrg      break
298438c51623Smrg    fi
298538c51623Smrg  done
298638c51623Smrg  rm -f core conftest*
298738c51623Smrg  unset am_i])
298838c51623Smrgif test "$am_cv_prog_cc_c_o" != yes; then
298938c51623Smrg   # Losing compiler, so override with the script.
299038c51623Smrg   # FIXME: It is wrong to rewrite CC.
299138c51623Smrg   # But if we don't then we get into trouble of one sort or another.
299238c51623Smrg   # A longer-term fix would be to have automake use am__CC in this case,
299338c51623Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
299438c51623Smrg   CC="$am_aux_dir/compile $CC"
2995f931275dSmrgfi
299638c51623SmrgAC_LANG_POP([C])])
2997f931275dSmrg
299838c51623Smrg# For backward compatibility.
299938c51623SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
300038c51623Smrg
300138c51623Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
300238c51623Smrg#
300338c51623Smrg# This file is free software; the Free Software Foundation
300438c51623Smrg# gives unlimited permission to copy and/or distribute it,
300538c51623Smrg# with or without modifications, as long as this notice is preserved.
300638c51623Smrg
300738c51623Smrg# AM_RUN_LOG(COMMAND)
300838c51623Smrg# -------------------
300938c51623Smrg# Run COMMAND, save the exit status in ac_status, and log it.
301038c51623Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
301138c51623SmrgAC_DEFUN([AM_RUN_LOG],
301238c51623Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
301338c51623Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
301438c51623Smrg   ac_status=$?
301538c51623Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
301638c51623Smrg   (exit $ac_status); }])
3017c6a6acfbSmrg
301838c51623Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019f931275dSmrg
302038c51623Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
302138c51623Smrg#
302238c51623Smrg# This file is free software; the Free Software Foundation
302338c51623Smrg# gives unlimited permission to copy and/or distribute it,
302438c51623Smrg# with or without modifications, as long as this notice is preserved.
3025f931275dSmrg
302638c51623Smrg# AM_SANITY_CHECK
302738c51623Smrg# ---------------
302838c51623SmrgAC_DEFUN([AM_SANITY_CHECK],
302938c51623Smrg[AC_MSG_CHECKING([whether build environment is sane])
303038c51623Smrg# Reject unsafe characters in $srcdir or the absolute working directory
303138c51623Smrg# name.  Accept space and tab only in the latter.
303238c51623Smrgam_lf='
303338c51623Smrg'
303438c51623Smrgcase `pwd` in
303538c51623Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
303638c51623Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
303738c51623Smrgesac
303838c51623Smrgcase $srcdir in
303938c51623Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
304038c51623Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
304138c51623Smrgesac
3042f931275dSmrg
304338c51623Smrg# Do 'set' in a subshell so we don't clobber the current shell's
304438c51623Smrg# arguments.  Must try -L first in case configure is actually a
304538c51623Smrg# symlink; some systems play weird games with the mod time of symlinks
304638c51623Smrg# (eg FreeBSD returns the mod time of the symlink's containing
304738c51623Smrg# directory).
304838c51623Smrgif (
304938c51623Smrg   am_has_slept=no
305038c51623Smrg   for am_try in 1 2; do
305138c51623Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
305238c51623Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
305338c51623Smrg     if test "$[*]" = "X"; then
305438c51623Smrg	# -L didn't work.
305538c51623Smrg	set X `ls -t "$srcdir/configure" conftest.file`
305638c51623Smrg     fi
305738c51623Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
305838c51623Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059f931275dSmrg
306038c51623Smrg	# If neither matched, then we have a broken ls.  This can happen
306138c51623Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
306238c51623Smrg	# broken ls alias from the environment.  This has actually
306338c51623Smrg	# happened.  Such a system could not be considered "sane".
306438c51623Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
306538c51623Smrg  alias in your environment])
306638c51623Smrg     fi
306738c51623Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
306838c51623Smrg       break
306938c51623Smrg     fi
307038c51623Smrg     # Just in case.
307138c51623Smrg     sleep 1
307238c51623Smrg     am_has_slept=yes
307338c51623Smrg   done
307438c51623Smrg   test "$[2]" = conftest.file
307538c51623Smrg   )
307638c51623Smrgthen
307738c51623Smrg   # Ok.
307838c51623Smrg   :
3079f931275dSmrgelse
308038c51623Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
308138c51623SmrgCheck your system clock])
3082c6a6acfbSmrgfi
308338c51623SmrgAC_MSG_RESULT([yes])
308438c51623Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
308538c51623Smrg# generated files are strictly newer.
308638c51623Smrgam_sleep_pid=
308738c51623Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
308838c51623Smrg  ( sleep 1 ) &
308938c51623Smrg  am_sleep_pid=$!
309038c51623Smrgfi
309138c51623SmrgAC_CONFIG_COMMANDS_PRE(
309238c51623Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
309338c51623Smrg   if test -n "$am_sleep_pid"; then
309438c51623Smrg     # Hide warnings about reused PIDs.
309538c51623Smrg     wait $am_sleep_pid 2>/dev/null
309638c51623Smrg   fi
309738c51623Smrg   AC_MSG_RESULT([done])])
309838c51623Smrgrm -f conftest.file
309938c51623Smrg])
3100c6a6acfbSmrg
310138c51623Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102f931275dSmrg#
310338c51623Smrg# This file is free software; the Free Software Foundation
310438c51623Smrg# gives unlimited permission to copy and/or distribute it,
310538c51623Smrg# with or without modifications, as long as this notice is preserved.
3106a9274bcdSmrg
310738c51623Smrg# AM_SILENT_RULES([DEFAULT])
310838c51623Smrg# --------------------------
310938c51623Smrg# Enable less verbose build rules; with the default set to DEFAULT
311038c51623Smrg# ("yes" being less verbose, "no" or empty being verbose).
311138c51623SmrgAC_DEFUN([AM_SILENT_RULES],
311238c51623Smrg[AC_ARG_ENABLE([silent-rules], [dnl
311338c51623SmrgAS_HELP_STRING(
311438c51623Smrg  [--enable-silent-rules],
311538c51623Smrg  [less verbose build output (undo: "make V=1")])
311638c51623SmrgAS_HELP_STRING(
311738c51623Smrg  [--disable-silent-rules],
311838c51623Smrg  [verbose build output (undo: "make V=0")])dnl
311938c51623Smrg])
312038c51623Smrgcase $enable_silent_rules in @%:@ (((
312138c51623Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
312238c51623Smrg   no) AM_DEFAULT_VERBOSITY=1;;
312338c51623Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
312438c51623Smrgesac
312538c51623Smrgdnl
312638c51623Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
312738c51623Smrgdnl do not support nested variable expansions.
312838c51623Smrgdnl See automake bug#9928 and bug#10237.
312938c51623Smrgam_make=${MAKE-make}
313038c51623SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
313138c51623Smrg   [am_cv_make_support_nested_variables],
313238c51623Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
313338c51623SmrgBAR0=false
313438c51623SmrgBAR1=true
313538c51623SmrgV=1
313638c51623Smrgam__doit:
313738c51623Smrg	@$(TRUE)
313838c51623Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
313938c51623Smrg  am_cv_make_support_nested_variables=yes
314038c51623Smrgelse
314138c51623Smrg  am_cv_make_support_nested_variables=no
314238c51623Smrgfi])
314338c51623Smrgif test $am_cv_make_support_nested_variables = yes; then
314438c51623Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
314538c51623Smrg  AM_V='$(V)'
314638c51623Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
314738c51623Smrgelse
314838c51623Smrg  AM_V=$AM_DEFAULT_VERBOSITY
314938c51623Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
315038c51623Smrgfi
315138c51623SmrgAC_SUBST([AM_V])dnl
315238c51623SmrgAM_SUBST_NOTMAKE([AM_V])dnl
315338c51623SmrgAC_SUBST([AM_DEFAULT_V])dnl
315438c51623SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
315538c51623SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
315638c51623SmrgAM_BACKSLASH='\'
315738c51623SmrgAC_SUBST([AM_BACKSLASH])dnl
315838c51623Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
315938c51623Smrg])
316038c51623Smrg
316138c51623Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162f931275dSmrg#
316338c51623Smrg# This file is free software; the Free Software Foundation
316438c51623Smrg# gives unlimited permission to copy and/or distribute it,
316538c51623Smrg# with or without modifications, as long as this notice is preserved.
316638c51623Smrg
316738c51623Smrg# AM_PROG_INSTALL_STRIP
316838c51623Smrg# ---------------------
316938c51623Smrg# One issue with vendor 'install' (even GNU) is that you can't
317038c51623Smrg# specify the program used to strip binaries.  This is especially
317138c51623Smrg# annoying in cross-compiling environments, where the build's strip
317238c51623Smrg# is unlikely to handle the host's binaries.
317338c51623Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
317438c51623Smrg# always use install-sh in "make install-strip", and initialize
317538c51623Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
317638c51623SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
317738c51623Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
317838c51623Smrg# Installed binaries are usually stripped using 'strip' when the user
317938c51623Smrg# run "make install-strip".  However 'strip' might not be the right
318038c51623Smrg# tool to use in cross-compilation environments, therefore Automake
318138c51623Smrg# will honor the 'STRIP' environment variable to overrule this program.
318238c51623Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
318338c51623Smrgif test "$cross_compiling" != no; then
318438c51623Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
318538c51623Smrgfi
318638c51623SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
318738c51623SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188a9274bcdSmrg
318938c51623Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
319038c51623Smrg#
319138c51623Smrg# This file is free software; the Free Software Foundation
319238c51623Smrg# gives unlimited permission to copy and/or distribute it,
319338c51623Smrg# with or without modifications, as long as this notice is preserved.
3194f931275dSmrg
319538c51623Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
319638c51623Smrg# ---------------------------
319738c51623Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
319838c51623Smrg# This macro is traced by Automake.
319938c51623SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200c6a6acfbSmrg
320138c51623Smrg# AM_SUBST_NOTMAKE(VARIABLE)
320238c51623Smrg# --------------------------
320338c51623Smrg# Public sister of _AM_SUBST_NOTMAKE.
320438c51623SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205f931275dSmrg
320638c51623Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3207f931275dSmrg
320838c51623Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
320938c51623Smrg#
321038c51623Smrg# This file is free software; the Free Software Foundation
321138c51623Smrg# gives unlimited permission to copy and/or distribute it,
321238c51623Smrg# with or without modifications, as long as this notice is preserved.
3213a9274bcdSmrg
321438c51623Smrg# _AM_PROG_TAR(FORMAT)
3215a9274bcdSmrg# --------------------
321638c51623Smrg# Check how to create a tarball in format FORMAT.
321738c51623Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218a9274bcdSmrg#
321938c51623Smrg# Substitute a variable $(am__tar) that is a command
322038c51623Smrg# writing to stdout a FORMAT-tarball containing the directory
322138c51623Smrg# $tardir.
322238c51623Smrg#     tardir=directory && $(am__tar) > result.tar
322348af84faSmrg#
322438c51623Smrg# Substitute a variable $(am__untar) that extract such
322538c51623Smrg# a tarball read from stdin.
322638c51623Smrg#     $(am__untar) < result.tar
322748af84faSmrg#
322838c51623SmrgAC_DEFUN([_AM_PROG_TAR],
322938c51623Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
323038c51623Smrg# in the wild :-(  We should find a proper way to deprecate it ...
323138c51623SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232a9274bcdSmrg
323338c51623Smrg# We'll loop over all known methods to create a tar archive until one works.
323438c51623Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235c6a6acfbSmrg
323638c51623Smrgm4_if([$1], [v7],
323738c51623Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3238a9274bcdSmrg
323938c51623Smrg  [m4_case([$1],
324038c51623Smrg    [ustar],
324138c51623Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
324238c51623Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
324338c51623Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
324438c51623Smrg      # and bug#13588).
324538c51623Smrg      am_max_uid=2097151 # 2^21 - 1
324638c51623Smrg      am_max_gid=$am_max_uid
324738c51623Smrg      # The $UID and $GID variables are not portable, so we need to resort
324838c51623Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
324938c51623Smrg      # below are definitely unexpected, so allow the users to see them
325038c51623Smrg      # (that is, avoid stderr redirection).
325138c51623Smrg      am_uid=`id -u || echo unknown`
325238c51623Smrg      am_gid=`id -g || echo unknown`
325338c51623Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
325438c51623Smrg      if test $am_uid -le $am_max_uid; then
325538c51623Smrg         AC_MSG_RESULT([yes])
325638c51623Smrg      else
325738c51623Smrg         AC_MSG_RESULT([no])
325838c51623Smrg         _am_tools=none
325938c51623Smrg      fi
326038c51623Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
326138c51623Smrg      if test $am_gid -le $am_max_gid; then
326238c51623Smrg         AC_MSG_RESULT([yes])
326338c51623Smrg      else
326438c51623Smrg        AC_MSG_RESULT([no])
326538c51623Smrg        _am_tools=none
326638c51623Smrg      fi],
326738c51623Smrg
326838c51623Smrg  [pax],
326938c51623Smrg    [],
327038c51623Smrg
327138c51623Smrg  [m4_fatal([Unknown tar format])])
327238c51623Smrg
327338c51623Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
327438c51623Smrg
327538c51623Smrg  # Go ahead even if we have the value already cached.  We do so because we
327638c51623Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
327738c51623Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
327838c51623Smrg
327938c51623Smrg  for _am_tool in $_am_tools; do
328038c51623Smrg    case $_am_tool in
328138c51623Smrg    gnutar)
328238c51623Smrg      for _am_tar in tar gnutar gtar; do
328338c51623Smrg        AM_RUN_LOG([$_am_tar --version]) && break
328438c51623Smrg      done
328538c51623Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
328638c51623Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
328738c51623Smrg      am__untar="$_am_tar -xf -"
328838c51623Smrg      ;;
328938c51623Smrg    plaintar)
329038c51623Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
329138c51623Smrg      # ustar tarball either.
329238c51623Smrg      (tar --version) >/dev/null 2>&1 && continue
329338c51623Smrg      am__tar='tar chf - "$$tardir"'
329438c51623Smrg      am__tar_='tar chf - "$tardir"'
329538c51623Smrg      am__untar='tar xf -'
329638c51623Smrg      ;;
329738c51623Smrg    pax)
329838c51623Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
329938c51623Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
330038c51623Smrg      am__untar='pax -r'
330138c51623Smrg      ;;
330238c51623Smrg    cpio)
330338c51623Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
330438c51623Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
330538c51623Smrg      am__untar='cpio -i -H $1 -d'
330638c51623Smrg      ;;
330738c51623Smrg    none)
330838c51623Smrg      am__tar=false
330938c51623Smrg      am__tar_=false
331038c51623Smrg      am__untar=false
331138c51623Smrg      ;;
331238c51623Smrg    esac
331338c51623Smrg
331438c51623Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
331538c51623Smrg    # and am__untar set.
331638c51623Smrg    test -n "${am_cv_prog_tar_$1}" && break
331738c51623Smrg
331838c51623Smrg    # tar/untar a dummy directory, and stop if the command works.
331938c51623Smrg    rm -rf conftest.dir
332038c51623Smrg    mkdir conftest.dir
332138c51623Smrg    echo GrepMe > conftest.dir/file
332238c51623Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
332338c51623Smrg    rm -rf conftest.dir
332438c51623Smrg    if test -s conftest.tar; then
332538c51623Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
332638c51623Smrg      AM_RUN_LOG([cat conftest.dir/file])
332738c51623Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
332838c51623Smrg    fi
332938c51623Smrg  done
333038c51623Smrg  rm -rf conftest.dir
333138c51623Smrg
333238c51623Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
333338c51623Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
333438c51623Smrg
333538c51623SmrgAC_SUBST([am__tar])
333638c51623SmrgAC_SUBST([am__untar])
333738c51623Smrg]) # _AM_PROG_TAR
333866fe65f6Smrg
3339