aclocal.m4 revision 12458b28
148f45e26Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
287aef7c3Smrg
348f45e26Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4ea6ae205Smrg
5ea6ae205Smrg# This file is free software; the Free Software Foundation
6ea6ae205Smrg# gives unlimited permission to copy and/or distribute it,
7ea6ae205Smrg# with or without modifications, as long as this notice is preserved.
8ea6ae205Smrg
9ea6ae205Smrg# This program is distributed in the hope that it will be useful,
10ea6ae205Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ea6ae205Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ea6ae205Smrg# PARTICULAR PURPOSE.
13ea6ae205Smrg
1487aef7c3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15e83ac88aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16e83ac88aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1748f45e26Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1848f45e26Smrg[m4_warning([this file was generated for autoconf 2.69.
19e83ac88aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20e83ac88aSmrgIf you have problems, you may need to regenerate the build system entirely.
2187aef7c3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22ea6ae205Smrg
2312458b28Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2412458b28Smrgdnl serial 11 (pkg-config-0.29)
2512458b28Smrgdnl
2612458b28Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2712458b28Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2812458b28Smrgdnl
2912458b28Smrgdnl This program is free software; you can redistribute it and/or modify
3012458b28Smrgdnl it under the terms of the GNU General Public License as published by
3112458b28Smrgdnl the Free Software Foundation; either version 2 of the License, or
3212458b28Smrgdnl (at your option) any later version.
3312458b28Smrgdnl
3412458b28Smrgdnl This program is distributed in the hope that it will be useful, but
3512458b28Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3612458b28Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3712458b28Smrgdnl General Public License for more details.
3812458b28Smrgdnl
3912458b28Smrgdnl You should have received a copy of the GNU General Public License
4012458b28Smrgdnl along with this program; if not, write to the Free Software
4112458b28Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4212458b28Smrgdnl 02111-1307, USA.
4312458b28Smrgdnl
4412458b28Smrgdnl As a special exception to the GNU General Public License, if you
4512458b28Smrgdnl distribute this file as part of a program that contains a
4612458b28Smrgdnl configuration script generated by Autoconf, you may include it under
4712458b28Smrgdnl the same distribution terms that you use for the rest of that
4812458b28Smrgdnl program.
49ea6ae205Smrg
5012458b28Smrgdnl PKG_PREREQ(MIN-VERSION)
5112458b28Smrgdnl -----------------------
5212458b28Smrgdnl Since: 0.29
5312458b28Smrgdnl
5412458b28Smrgdnl Verify that the version of the pkg-config macros are at least
5512458b28Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5612458b28Smrgdnl installed version of pkg-config, this checks the developer's version
5712458b28Smrgdnl of pkg.m4 when generating configure.
5812458b28Smrgdnl
5912458b28Smrgdnl To ensure that this macro is defined, also add:
6012458b28Smrgdnl m4_ifndef([PKG_PREREQ],
6112458b28Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6212458b28Smrgdnl
6312458b28Smrgdnl See the "Since" comment for each macro you use to see what version
6412458b28Smrgdnl of the macros you require.
6512458b28Smrgm4_defun([PKG_PREREQ],
6612458b28Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
6712458b28Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6812458b28Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6912458b28Smrg])dnl PKG_PREREQ
70ea6ae205Smrg
7112458b28Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7212458b28Smrgdnl ----------------------------------
7312458b28Smrgdnl Since: 0.16
7412458b28Smrgdnl
7512458b28Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7612458b28Smrgdnl first found in the path. Checks that the version of pkg-config found
7712458b28Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7812458b28Smrgdnl used since that's the first version where most current features of
7912458b28Smrgdnl pkg-config existed.
8012458b28SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8112458b28Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8212458b28Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8312458b28Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8412458b28SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8512458b28SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8612458b28SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87ea6ae205Smrg
8812458b28Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8912458b28Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9012458b28Smrgfi
9112458b28Smrgif test -n "$PKG_CONFIG"; then
9212458b28Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9312458b28Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9412458b28Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9512458b28Smrg		AC_MSG_RESULT([yes])
9612458b28Smrg	else
9712458b28Smrg		AC_MSG_RESULT([no])
9812458b28Smrg		PKG_CONFIG=""
9912458b28Smrg	fi
10012458b28Smrgfi[]dnl
10112458b28Smrg])dnl PKG_PROG_PKG_CONFIG
102ea6ae205Smrg
10312458b28Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10412458b28Smrgdnl -------------------------------------------------------------------
10512458b28Smrgdnl Since: 0.18
10612458b28Smrgdnl
10712458b28Smrgdnl Check to see whether a particular set of modules exists. Similar to
10812458b28Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10912458b28Smrgdnl
11012458b28Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11112458b28Smrgdnl only at the first occurence in configure.ac, so if the first place
11212458b28Smrgdnl it's called might be skipped (such as if it is within an "if", you
11312458b28Smrgdnl have to call PKG_CHECK_EXISTS manually
11412458b28SmrgAC_DEFUN([PKG_CHECK_EXISTS],
11512458b28Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11612458b28Smrgif test -n "$PKG_CONFIG" && \
11712458b28Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11812458b28Smrg  m4_default([$2], [:])
11912458b28Smrgm4_ifvaln([$3], [else
12012458b28Smrg  $3])dnl
12112458b28Smrgfi])
122ea6ae205Smrg
12312458b28Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12412458b28Smrgdnl ---------------------------------------------
12512458b28Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12612458b28Smrgdnl pkg_failed based on the result.
12712458b28Smrgm4_define([_PKG_CONFIG],
12812458b28Smrg[if test -n "$$1"; then
12912458b28Smrg    pkg_cv_[]$1="$$1"
13012458b28Smrg elif test -n "$PKG_CONFIG"; then
13112458b28Smrg    PKG_CHECK_EXISTS([$3],
13212458b28Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13312458b28Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
13412458b28Smrg		     [pkg_failed=yes])
13512458b28Smrg else
13612458b28Smrg    pkg_failed=untried
13712458b28Smrgfi[]dnl
13812458b28Smrg])dnl _PKG_CONFIG
139ea6ae205Smrg
14012458b28Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14112458b28Smrgdnl ---------------------------
14212458b28Smrgdnl Internal check to see if pkg-config supports short errors.
14312458b28SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14412458b28Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14512458b28Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14612458b28Smrg        _pkg_short_errors_supported=yes
14712458b28Smrgelse
14812458b28Smrg        _pkg_short_errors_supported=no
14912458b28Smrgfi[]dnl
15012458b28Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151ea6ae205Smrg
152ea6ae205Smrg
15312458b28Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15412458b28Smrgdnl   [ACTION-IF-NOT-FOUND])
15512458b28Smrgdnl --------------------------------------------------------------
15612458b28Smrgdnl Since: 0.4.0
15712458b28Smrgdnl
15812458b28Smrgdnl Note that if there is a possibility the first call to
15912458b28Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16012458b28Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16112458b28SmrgAC_DEFUN([PKG_CHECK_MODULES],
16212458b28Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16312458b28SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16412458b28SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165ea6ae205Smrg
16612458b28Smrgpkg_failed=no
16712458b28SmrgAC_MSG_CHECKING([for $1])
168ea6ae205Smrg
16912458b28Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17012458b28Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171ea6ae205Smrg
17212458b28Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17312458b28Smrgand $1[]_LIBS to avoid the need to call pkg-config.
17412458b28SmrgSee the pkg-config man page for more details.])
175ea6ae205Smrg
17612458b28Smrgif test $pkg_failed = yes; then
17712458b28Smrg   	AC_MSG_RESULT([no])
17812458b28Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17912458b28Smrg        if test $_pkg_short_errors_supported = yes; then
18012458b28Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18112458b28Smrg        else 
18212458b28Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18312458b28Smrg        fi
18412458b28Smrg	# Put the nasty error message in config.log where it belongs
18512458b28Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186ea6ae205Smrg
18712458b28Smrg	m4_default([$4], [AC_MSG_ERROR(
18812458b28Smrg[Package requirements ($2) were not met:
189ea6ae205Smrg
19012458b28Smrg$$1_PKG_ERRORS
191ea6ae205Smrg
19212458b28SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19312458b28Smrginstalled software in a non-standard prefix.
194e83ac88aSmrg
19512458b28Smrg_PKG_TEXT])[]dnl
19612458b28Smrg        ])
19712458b28Smrgelif test $pkg_failed = untried; then
19812458b28Smrg     	AC_MSG_RESULT([no])
19912458b28Smrg	m4_default([$4], [AC_MSG_FAILURE(
20012458b28Smrg[The pkg-config script could not be found or is too old.  Make sure it
20112458b28Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
20212458b28Smrgpath to pkg-config.
203ea6ae205Smrg
20412458b28Smrg_PKG_TEXT
205ea6ae205Smrg
20612458b28SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20712458b28Smrg        ])
2087978d3cdSmrgelse
20912458b28Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21012458b28Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21112458b28Smrg        AC_MSG_RESULT([yes])
21212458b28Smrg	$3
21312458b28Smrgfi[]dnl
21412458b28Smrg])dnl PKG_CHECK_MODULES
215ea6ae205Smrg
216ea6ae205Smrg
21712458b28Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21812458b28Smrgdnl   [ACTION-IF-NOT-FOUND])
21912458b28Smrgdnl ---------------------------------------------------------------------
22012458b28Smrgdnl Since: 0.29
22112458b28Smrgdnl
22212458b28Smrgdnl Checks for existence of MODULES and gathers its build flags with
22312458b28Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22412458b28Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22512458b28Smrgdnl
22612458b28Smrgdnl Note that if there is a possibility the first call to
22712458b28Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22812458b28Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22912458b28Smrgdnl configure.ac.
23012458b28SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23112458b28Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23212458b28Smrg_save_PKG_CONFIG=$PKG_CONFIG
23312458b28SmrgPKG_CONFIG="$PKG_CONFIG --static"
23412458b28SmrgPKG_CHECK_MODULES($@)
23512458b28SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23612458b28Smrg])dnl PKG_CHECK_MODULES_STATIC
237ea6ae205Smrg
238ea6ae205Smrg
23912458b28Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24012458b28Smrgdnl -------------------------
24112458b28Smrgdnl Since: 0.27
24212458b28Smrgdnl
24312458b28Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
24412458b28Smrgdnl should install pkg-config .pc files. By default the directory is
24512458b28Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
24612458b28Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24712458b28Smrgdnl parameter.
24812458b28SmrgAC_DEFUN([PKG_INSTALLDIR],
24912458b28Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25012458b28Smrgm4_pushdef([pkg_description],
25112458b28Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25212458b28SmrgAC_ARG_WITH([pkgconfigdir],
25312458b28Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25412458b28Smrg    [with_pkgconfigdir=]pkg_default)
25512458b28SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25612458b28Smrgm4_popdef([pkg_default])
25712458b28Smrgm4_popdef([pkg_description])
25812458b28Smrg])dnl PKG_INSTALLDIR
259ea6ae205Smrg
260ea6ae205Smrg
26112458b28Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26212458b28Smrgdnl --------------------------------
26312458b28Smrgdnl Since: 0.27
26412458b28Smrgdnl
26512458b28Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26612458b28Smrgdnl module should install arch-independent pkg-config .pc files. By
26712458b28Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
26812458b28Smrgdnl changed by passing DIRECTORY. The user can override through the
26912458b28Smrgdnl --with-noarch-pkgconfigdir parameter.
27012458b28SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27112458b28Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27212458b28Smrgm4_pushdef([pkg_description],
27312458b28Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27412458b28SmrgAC_ARG_WITH([noarch-pkgconfigdir],
27512458b28Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27612458b28Smrg    [with_noarch_pkgconfigdir=]pkg_default)
27712458b28SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27812458b28Smrgm4_popdef([pkg_default])
27912458b28Smrgm4_popdef([pkg_description])
28012458b28Smrg])dnl PKG_NOARCH_INSTALLDIR
281ea6ae205Smrg
282ea6ae205Smrg
28312458b28Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28412458b28Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28512458b28Smrgdnl -------------------------------------------
28612458b28Smrgdnl Since: 0.28
28712458b28Smrgdnl
28812458b28Smrgdnl Retrieves the value of the pkg-config variable for the given module.
28912458b28SmrgAC_DEFUN([PKG_CHECK_VAR],
29012458b28Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29112458b28SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292ea6ae205Smrg
29312458b28Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29412458b28SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
295ea6ae205Smrg
29612458b28SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29712458b28Smrg])dnl PKG_CHECK_VAR
29812458b28Smrg
29912458b28Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
30012458b28Smrgdnl
30112458b28Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
30212458b28Smrgdnl
30312458b28Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
30412458b28Smrgdnl copy of this software and associated documentation files (the "Software"),
30512458b28Smrgdnl to deal in the Software without restriction, including without limitation
30612458b28Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
30712458b28Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
30812458b28Smrgdnl Software is furnished to do so, subject to the following conditions:
30912458b28Smrgdnl
31012458b28Smrgdnl The above copyright notice and this permission notice (including the next
31112458b28Smrgdnl paragraph) shall be included in all copies or substantial portions of the
31212458b28Smrgdnl Software.
31312458b28Smrgdnl
31412458b28Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31512458b28Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31612458b28Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31712458b28Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31812458b28Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31912458b28Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32012458b28Smrgdnl DEALINGS IN THE SOFTWARE.
32112458b28Smrg
32212458b28Smrg# XORG_MACROS_VERSION(required-version)
32312458b28Smrg# -------------------------------------
32412458b28Smrg# Minimum version: 1.1.0
325ea6ae205Smrg#
32612458b28Smrg# If you're using a macro added in Version 1.1 or newer, include this in
32712458b28Smrg# your configure.ac with the minimum required version, such as:
32812458b28Smrg# XORG_MACROS_VERSION(1.1)
32912458b28Smrg#
33012458b28Smrg# To ensure that this macro is defined, also add:
33112458b28Smrg# m4_ifndef([XORG_MACROS_VERSION],
33212458b28Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
33312458b28Smrg#
33412458b28Smrg#
33512458b28Smrg# See the "minimum version" comment for each macro you use to see what
33612458b28Smrg# version you require.
33712458b28Smrgm4_defun([XORG_MACROS_VERSION],[
33812458b28Smrgm4_define([vers_have], [1.19.0])
33912458b28Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
34012458b28Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
34112458b28Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
34212458b28Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
34312458b28Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
34412458b28Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
34512458b28Smrgm4_undefine([vers_have])
34612458b28Smrgm4_undefine([maj_have])
34712458b28Smrgm4_undefine([maj_needed])
34812458b28Smrg]) # XORG_MACROS_VERSION
349ea6ae205Smrg
35012458b28Smrg# XORG_PROG_RAWCPP()
35112458b28Smrg# ------------------
35212458b28Smrg# Minimum version: 1.0.0
35312458b28Smrg#
35412458b28Smrg# Find cpp program and necessary flags for use in pre-processing text files
35512458b28Smrg# such as man pages and config files
35612458b28SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
35712458b28SmrgAC_REQUIRE([AC_PROG_CPP])
35812458b28SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
35912458b28Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
360ea6ae205Smrg
36112458b28Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
36212458b28Smrg# which is not the best choice for supporting other OS'es, but covers most
36312458b28Smrg# of the ones we need for now.
36412458b28SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
36512458b28SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
36612458b28Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
36712458b28Smrg	AC_MSG_RESULT([no])
36812458b28Smrgelse
36912458b28Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37012458b28Smrg		RAWCPPFLAGS=-undef
37112458b28Smrg		AC_MSG_RESULT([yes])
37212458b28Smrg	# under Cygwin unix is still defined even with -undef
37312458b28Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37412458b28Smrg		RAWCPPFLAGS="-undef -ansi"
37512458b28Smrg		AC_MSG_RESULT([yes, with -ansi])
37612458b28Smrg	else
37712458b28Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
37812458b28Smrg	fi
37912458b28Smrgfi
38012458b28Smrgrm -f conftest.$ac_ext
38187aef7c3Smrg
38212458b28SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
38312458b28SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
38412458b28Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38512458b28Smrg	AC_MSG_RESULT([no])
38612458b28Smrgelse
38712458b28Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38812458b28Smrg		TRADITIONALCPPFLAGS="-traditional"
38912458b28Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
39012458b28Smrg		AC_MSG_RESULT([yes])
39112458b28Smrg	else
39212458b28Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
39312458b28Smrg	fi
394ea6ae205Smrgfi
39512458b28Smrgrm -f conftest.$ac_ext
39612458b28SmrgAC_SUBST(RAWCPPFLAGS)
39712458b28SmrgAC_SUBST(TRADITIONALCPPFLAGS)
39812458b28Smrg]) # XORG_PROG_RAWCPP
399ea6ae205Smrg
40012458b28Smrg# XORG_MANPAGE_SECTIONS()
40112458b28Smrg# -----------------------
40212458b28Smrg# Minimum version: 1.0.0
40312458b28Smrg#
40412458b28Smrg# Determine which sections man pages go in for the different man page types
40512458b28Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
40612458b28Smrg# Not sure if there's any better way than just hardcoding by OS name.
40712458b28Smrg# Override default settings by setting environment variables
40812458b28Smrg# Added MAN_SUBSTS in version 1.8
40912458b28Smrg# Added AC_PROG_SED in version 1.8
41012458b28Smrg
41112458b28SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
41212458b28SmrgAC_REQUIRE([AC_CANONICAL_HOST])
41312458b28SmrgAC_REQUIRE([AC_PROG_SED])
41412458b28Smrg
41512458b28Smrgif test x$APP_MAN_SUFFIX = x    ; then
41612458b28Smrg    APP_MAN_SUFFIX=1
41712458b28Smrgfi
41812458b28Smrgif test x$APP_MAN_DIR = x    ; then
41912458b28Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420ea6ae205Smrgfi
421ea6ae205Smrg
42212458b28Smrgif test x$LIB_MAN_SUFFIX = x    ; then
42312458b28Smrg    LIB_MAN_SUFFIX=3
42412458b28Smrgfi
42512458b28Smrgif test x$LIB_MAN_DIR = x    ; then
42612458b28Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
42712458b28Smrgfi
428ea6ae205Smrg
42912458b28Smrgif test x$FILE_MAN_SUFFIX = x    ; then
43012458b28Smrg    case $host_os in
43112458b28Smrg	# Solaris 2.0 - 11 use SysV man page sections
43212458b28Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
43312458b28Smrg	*)				FILE_MAN_SUFFIX=5  ;;
43412458b28Smrg    esac
43512458b28Smrgfi
43612458b28Smrgif test x$FILE_MAN_DIR = x    ; then
43712458b28Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
43812458b28Smrgfi
439ea6ae205Smrg
44012458b28Smrgif test x$MISC_MAN_SUFFIX = x    ; then
44112458b28Smrg    case $host_os in
44212458b28Smrg	# Solaris 2.0 - 11 use SysV man page sections
44312458b28Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
44412458b28Smrg	*)				MISC_MAN_SUFFIX=7  ;;
44512458b28Smrg    esac
44612458b28Smrgfi
44712458b28Smrgif test x$MISC_MAN_DIR = x    ; then
44812458b28Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
44912458b28Smrgfi
4507978d3cdSmrg
45112458b28Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
45212458b28Smrg    case $host_os in
45312458b28Smrg	# Solaris 2.0 - 11 use SysV man page sections
45412458b28Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
45512458b28Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
45612458b28Smrg    esac
45712458b28Smrgfi
45812458b28Smrgif test x$DRIVER_MAN_DIR = x    ; then
45912458b28Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
46012458b28Smrgfi
46187aef7c3Smrg
46212458b28Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
46312458b28Smrg    case $host_os in
46412458b28Smrg	# Solaris 2.0 - 11 use SysV man page sections
46512458b28Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
46612458b28Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
46712458b28Smrg    esac
46812458b28Smrgfi
46912458b28Smrgif test x$ADMIN_MAN_DIR = x    ; then
47012458b28Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
47112458b28Smrgfi
47287aef7c3Smrg
47387aef7c3Smrg
47412458b28SmrgAC_SUBST([APP_MAN_SUFFIX])
47512458b28SmrgAC_SUBST([LIB_MAN_SUFFIX])
47612458b28SmrgAC_SUBST([FILE_MAN_SUFFIX])
47712458b28SmrgAC_SUBST([MISC_MAN_SUFFIX])
47812458b28SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
47912458b28SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
48012458b28SmrgAC_SUBST([APP_MAN_DIR])
48112458b28SmrgAC_SUBST([LIB_MAN_DIR])
48212458b28SmrgAC_SUBST([FILE_MAN_DIR])
48312458b28SmrgAC_SUBST([MISC_MAN_DIR])
48412458b28SmrgAC_SUBST([DRIVER_MAN_DIR])
48512458b28SmrgAC_SUBST([ADMIN_MAN_DIR])
48687aef7c3Smrg
48712458b28SmrgXORG_MAN_PAGE="X Version 11"
48812458b28SmrgAC_SUBST([XORG_MAN_PAGE])
48912458b28SmrgMAN_SUBSTS="\
49012458b28Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49112458b28Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49212458b28Smrg	-e 's|__xservername__|Xorg|g' \
49312458b28Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
49412458b28Smrg	-e 's|__projectroot__|\$(prefix)|g' \
49512458b28Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
49612458b28Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
49712458b28Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
49812458b28Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
49912458b28Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
50012458b28Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
50112458b28Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
50212458b28SmrgAC_SUBST([MAN_SUBSTS])
50387aef7c3Smrg
50412458b28Smrg]) # XORG_MANPAGE_SECTIONS
50587aef7c3Smrg
50612458b28Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
50712458b28Smrg# ------------------------
50812458b28Smrg# Minimum version: 1.7.0
50912458b28Smrg#
51012458b28Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
51112458b28Smrg# provided by xorg-sgml-doctools, if installed.
51212458b28SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
51312458b28SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
51412458b28SmrgXORG_SGML_PATH=
51512458b28SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
51612458b28Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
51712458b28Smrg    [m4_ifval([$1],[:],
51812458b28Smrg        [if test x"$cross_compiling" != x"yes" ; then
51912458b28Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
52012458b28Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
52112458b28Smrg         fi])
52212458b28Smrg    ])
52312458b28Smrg
52412458b28Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
52512458b28Smrg# the path and the name of the doc stylesheet
52612458b28Smrgif test "x$XORG_SGML_PATH" != "x" ; then
52712458b28Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
52812458b28Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
52912458b28Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
53012458b28Smrgelse
53112458b28Smrg   AC_MSG_RESULT([no])
53248f45e26Smrgfi
53387aef7c3Smrg
53412458b28SmrgAC_SUBST(XORG_SGML_PATH)
53512458b28SmrgAC_SUBST(STYLESHEET_SRCDIR)
53612458b28SmrgAC_SUBST(XSL_STYLESHEET)
53712458b28SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
53812458b28Smrg]) # XORG_CHECK_SGML_DOCTOOLS
539e83ac88aSmrg
54012458b28Smrg# XORG_CHECK_LINUXDOC
54112458b28Smrg# -------------------
54212458b28Smrg# Minimum version: 1.0.0
54312458b28Smrg#
54412458b28Smrg# Defines the variable MAKE_TEXT if the necessary tools and
54512458b28Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
54612458b28Smrg# Whether or not the necessary tools and files are found can be checked
54712458b28Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
54812458b28SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
54912458b28SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
55012458b28SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5517978d3cdSmrg
55212458b28SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5537978d3cdSmrg
55412458b28SmrgAC_MSG_CHECKING([whether to build documentation])
555ea6ae205Smrg
55612458b28Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
55712458b28Smrg   BUILDDOC=yes
55812458b28Smrgelse
55912458b28Smrg   BUILDDOC=no
560e83ac88aSmrgfi
561ea6ae205Smrg
56212458b28SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
563ea6ae205Smrg
56412458b28SmrgAC_MSG_RESULT([$BUILDDOC])
565ea6ae205Smrg
56612458b28SmrgAC_MSG_CHECKING([whether to build pdf documentation])
567ea6ae205Smrg
56812458b28Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
56912458b28Smrg   BUILDPDFDOC=yes
57012458b28Smrgelse
57112458b28Smrg   BUILDPDFDOC=no
5727978d3cdSmrgfi
5737978d3cdSmrg
57412458b28SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575ea6ae205Smrg
57612458b28SmrgAC_MSG_RESULT([$BUILDPDFDOC])
577ea6ae205Smrg
57812458b28SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
57912458b28SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
58012458b28SmrgMAKE_PDF="$PS2PDF"
58112458b28SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582ea6ae205Smrg
58312458b28SmrgAC_SUBST(MAKE_TEXT)
58412458b28SmrgAC_SUBST(MAKE_PS)
58512458b28SmrgAC_SUBST(MAKE_PDF)
58612458b28SmrgAC_SUBST(MAKE_HTML)
58712458b28Smrg]) # XORG_CHECK_LINUXDOC
588ea6ae205Smrg
58912458b28Smrg# XORG_CHECK_DOCBOOK
59012458b28Smrg# -------------------
59112458b28Smrg# Minimum version: 1.0.0
592ea6ae205Smrg#
59312458b28Smrg# Checks for the ability to build output formats from SGML DocBook source.
59412458b28Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
59512458b28Smrg# indicates whether the necessary tools and files are found and, if set,
59612458b28Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
59712458b28SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
59812458b28SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599ea6ae205Smrg
60012458b28SmrgBUILDTXTDOC=no
60112458b28SmrgBUILDPDFDOC=no
60212458b28SmrgBUILDPSDOC=no
60312458b28SmrgBUILDHTMLDOC=no
604ea6ae205Smrg
60512458b28SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
60612458b28SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
60712458b28SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
60812458b28SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609ea6ae205Smrg
61012458b28SmrgAC_MSG_CHECKING([whether to build text documentation])
61112458b28Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
61212458b28Smrg   test x$BUILD_TXTDOC != xno; then
61312458b28Smrg	BUILDTXTDOC=yes
61412458b28Smrgfi
61512458b28SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
61612458b28SmrgAC_MSG_RESULT([$BUILDTXTDOC])
617ea6ae205Smrg
61812458b28SmrgAC_MSG_CHECKING([whether to build PDF documentation])
61912458b28Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
62012458b28Smrg   test x$BUILD_PDFDOC != xno; then
62112458b28Smrg	BUILDPDFDOC=yes
62287aef7c3Smrgfi
62312458b28SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
62412458b28SmrgAC_MSG_RESULT([$BUILDPDFDOC])
62587aef7c3Smrg
62612458b28SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
62712458b28Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
62812458b28Smrg   test x$BUILD_PSDOC != xno; then
62912458b28Smrg	BUILDPSDOC=yes
63012458b28Smrgfi
63112458b28SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
63212458b28SmrgAC_MSG_RESULT([$BUILDPSDOC])
63387aef7c3Smrg
63412458b28SmrgAC_MSG_CHECKING([whether to build HTML documentation])
63512458b28Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
63612458b28Smrg   test x$BUILD_HTMLDOC != xno; then
63712458b28Smrg	BUILDHTMLDOC=yes
63812458b28Smrgfi
63912458b28SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
64012458b28SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641ea6ae205Smrg
64212458b28SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
64312458b28SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
64412458b28SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
64512458b28SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
64687aef7c3Smrg
64712458b28SmrgAC_SUBST(MAKE_TEXT)
64812458b28SmrgAC_SUBST(MAKE_PS)
64912458b28SmrgAC_SUBST(MAKE_PDF)
65012458b28SmrgAC_SUBST(MAKE_HTML)
65112458b28Smrg]) # XORG_CHECK_DOCBOOK
65287aef7c3Smrg
65312458b28Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
65412458b28Smrg# ----------------
65512458b28Smrg# Minimum version: 1.5.0
65612458b28Smrg# Minimum version for optional DEFAULT argument: 1.11.0
65787aef7c3Smrg#
65812458b28Smrg# Documentation tools are not always available on all platforms and sometimes
65912458b28Smrg# not at the appropriate level. This macro enables a module to test for the
66012458b28Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
66112458b28Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
66212458b28Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
66312458b28Smrg# --with-xmlto assumes 'auto'.
66412458b28Smrg#
66512458b28Smrg# Interface to module:
66612458b28Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
66712458b28Smrg# XMLTO:	returns the path of the xmlto program found
66812458b28Smrg#		returns the path set by the user in the environment
66912458b28Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
67012458b28Smrg#		'no' user instructs the module not to use xmlto
67112458b28Smrg#
67212458b28Smrg# Added in version 1.10.0
67312458b28Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
67412458b28Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
67512458b28Smrg#
67612458b28Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
67712458b28Smrg#
67812458b28SmrgAC_DEFUN([XORG_WITH_XMLTO],[
67912458b28SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
68012458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
68112458b28SmrgAC_ARG_WITH(xmlto,
68212458b28Smrg	AS_HELP_STRING([--with-xmlto],
68312458b28Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
68412458b28Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
68512458b28Smrgm4_undefine([_defopt])
68687aef7c3Smrg
68712458b28Smrgif test "x$use_xmlto" = x"auto"; then
68812458b28Smrg   AC_PATH_PROG([XMLTO], [xmlto])
68912458b28Smrg   if test "x$XMLTO" = "x"; then
69012458b28Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
69112458b28Smrg	have_xmlto=no
69212458b28Smrg   else
69312458b28Smrg        have_xmlto=yes
69412458b28Smrg   fi
69512458b28Smrgelif test "x$use_xmlto" = x"yes" ; then
69612458b28Smrg   AC_PATH_PROG([XMLTO], [xmlto])
69712458b28Smrg   if test "x$XMLTO" = "x"; then
69812458b28Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
69912458b28Smrg   fi
70012458b28Smrg   have_xmlto=yes
70112458b28Smrgelif test "x$use_xmlto" = x"no" ; then
70212458b28Smrg   if test "x$XMLTO" != "x"; then
70312458b28Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
70412458b28Smrg   fi
70512458b28Smrg   have_xmlto=no
706ea6ae205Smrgelse
70712458b28Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
70887aef7c3Smrgfi
709ea6ae205Smrg
71012458b28Smrg# Test for a minimum version of xmlto, if provided.
71112458b28Smrgm4_ifval([$1],
71212458b28Smrg[if test "$have_xmlto" = yes; then
71312458b28Smrg    # scrape the xmlto version
71412458b28Smrg    AC_MSG_CHECKING([the xmlto version])
71512458b28Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
71612458b28Smrg    AC_MSG_RESULT([$xmlto_version])
71712458b28Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
71812458b28Smrg        [if test "x$use_xmlto" = xauto; then
71912458b28Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
72012458b28Smrg            have_xmlto=no
72112458b28Smrg        else
72212458b28Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
72312458b28Smrg        fi])
72487aef7c3Smrgfi])
725e83ac88aSmrg
72612458b28Smrg# Test for the ability of xmlto to generate a text target
7277978d3cdSmrg#
72812458b28Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
72912458b28Smrg# following test for empty XML docbook files.
73012458b28Smrg# For compatibility reasons use the following empty XML docbook file and if
73112458b28Smrg# it fails try it again with a non-empty XML file.
73212458b28Smrghave_xmlto_text=no
73312458b28Smrgcat > conftest.xml << "EOF"
73412458b28SmrgEOF
73512458b28SmrgAS_IF([test "$have_xmlto" = yes],
73612458b28Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73712458b28Smrg             [have_xmlto_text=yes],
73812458b28Smrg             [# Try it again with a non-empty XML file.
73912458b28Smrg              cat > conftest.xml << "EOF"
74012458b28Smrg<x></x>
74112458b28SmrgEOF
74212458b28Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
74312458b28Smrg                    [have_xmlto_text=yes],
74412458b28Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
74512458b28Smrgrm -f conftest.xml
74612458b28SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
74712458b28SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
74812458b28Smrg]) # XORG_WITH_XMLTO
749ea6ae205Smrg
75012458b28Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
75112458b28Smrg# --------------------------------------------
75212458b28Smrg# Minimum version: 1.12.0
75312458b28Smrg# Minimum version for optional DEFAULT argument: 1.12.0
7547978d3cdSmrg#
75512458b28Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
75612458b28Smrg# XML-based language used for the transformation of XML documents.
75712458b28Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
75812458b28Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
75912458b28Smrg# The XSLT processor is often used as a standalone tool for transformations.
76012458b28Smrg# It should not be assumed that this tool is used only to work with documnetation.
76112458b28Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
76212458b28Smrg#
76312458b28Smrg# Interface to module:
76412458b28Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
76512458b28Smrg# XSLTPROC:	 returns the path of the xsltproc program found
76612458b28Smrg#		 returns the path set by the user in the environment
76712458b28Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
76812458b28Smrg#		  'no' user instructs the module not to use xsltproc
76912458b28Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
77012458b28Smrg#
77112458b28Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
77212458b28Smrg#
77312458b28SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
77412458b28SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
77512458b28Smrg# Preserves the interface, should it be implemented later
77612458b28Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
77712458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
77812458b28SmrgAC_ARG_WITH(xsltproc,
77912458b28Smrg	AS_HELP_STRING([--with-xsltproc],
78012458b28Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
78112458b28Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
78212458b28Smrgm4_undefine([_defopt])
783ea6ae205Smrg
78412458b28Smrgif test "x$use_xsltproc" = x"auto"; then
78512458b28Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
78612458b28Smrg   if test "x$XSLTPROC" = "x"; then
78712458b28Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
78812458b28Smrg	have_xsltproc=no
78912458b28Smrg   else
79012458b28Smrg        have_xsltproc=yes
79112458b28Smrg   fi
79212458b28Smrgelif test "x$use_xsltproc" = x"yes" ; then
79312458b28Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
79412458b28Smrg   if test "x$XSLTPROC" = "x"; then
79512458b28Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
79612458b28Smrg   fi
79712458b28Smrg   have_xsltproc=yes
79812458b28Smrgelif test "x$use_xsltproc" = x"no" ; then
79912458b28Smrg   if test "x$XSLTPROC" != "x"; then
80012458b28Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
80112458b28Smrg   fi
80212458b28Smrg   have_xsltproc=no
80312458b28Smrgelse
80412458b28Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
80512458b28Smrgfi
806e83ac88aSmrg
80712458b28SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
80812458b28Smrg]) # XORG_WITH_XSLTPROC
809ea6ae205Smrg
81012458b28Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
81112458b28Smrg# ----------------------------------------
81212458b28Smrg# Minimum version: 1.15.0
813ea6ae205Smrg#
81412458b28Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
81512458b28Smrg# scanning arbitrary text files, extracting information from those text files,
81612458b28Smrg# and printing reports based on that information.
8177978d3cdSmrg#
81812458b28Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8197978d3cdSmrg#
82012458b28Smrg# Interface to module:
82112458b28Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
82212458b28Smrg# PERL:	     returns the path of the perl program found
82312458b28Smrg#	     returns the path set by the user in the environment
82412458b28Smrg# --with-perl: 'yes' user instructs the module to use perl
82512458b28Smrg#	       'no' user instructs the module not to use perl
82612458b28Smrg# have_perl: returns yes if perl found in PATH or no
82787aef7c3Smrg#
82812458b28Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
82912458b28Smrg#
83012458b28SmrgAC_DEFUN([XORG_WITH_PERL],[
83112458b28SmrgAC_ARG_VAR([PERL], [Path to perl command])
83212458b28Smrg# Preserves the interface, should it be implemented later
83312458b28Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
83412458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
83512458b28SmrgAC_ARG_WITH(perl,
83612458b28Smrg	AS_HELP_STRING([--with-perl],
83712458b28Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
83812458b28Smrg	   [use_perl=$withval], [use_perl=]_defopt)
83912458b28Smrgm4_undefine([_defopt])
84087aef7c3Smrg
84112458b28Smrgif test "x$use_perl" = x"auto"; then
84212458b28Smrg   AC_PATH_PROG([PERL], [perl])
84312458b28Smrg   if test "x$PERL" = "x"; then
84412458b28Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
84512458b28Smrg	have_perl=no
84612458b28Smrg   else
84712458b28Smrg        have_perl=yes
84812458b28Smrg   fi
84912458b28Smrgelif test "x$use_perl" = x"yes" ; then
85012458b28Smrg   AC_PATH_PROG([PERL], [perl])
85112458b28Smrg   if test "x$PERL" = "x"; then
85212458b28Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
85312458b28Smrg   fi
85412458b28Smrg   have_perl=yes
85512458b28Smrgelif test "x$use_perl" = x"no" ; then
85612458b28Smrg   if test "x$PERL" != "x"; then
85712458b28Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
85812458b28Smrg   fi
85912458b28Smrg   have_perl=no
86012458b28Smrgelse
86112458b28Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
86212458b28Smrgfi
86387aef7c3Smrg
86412458b28SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
86512458b28Smrg]) # XORG_WITH_PERL
86687aef7c3Smrg
86712458b28Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
86812458b28Smrg# ----------------
86912458b28Smrg# Minimum version: 1.5.0
87012458b28Smrg# Minimum version for optional DEFAULT argument: 1.11.0
87112458b28Smrg#
87212458b28Smrg# Documentation tools are not always available on all platforms and sometimes
87312458b28Smrg# not at the appropriate level. This macro enables a module to test for the
87412458b28Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
87512458b28Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
87612458b28Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
87712458b28Smrg# --with-asciidoc assumes 'auto'.
87812458b28Smrg#
87912458b28Smrg# Interface to module:
88012458b28Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
88112458b28Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
88212458b28Smrg#		 returns the path set by the user in the environment
88312458b28Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
88412458b28Smrg#		  'no' user instructs the module not to use asciidoc
88512458b28Smrg#
88612458b28Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
88712458b28Smrg#
88812458b28SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
88912458b28SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
89012458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
89112458b28SmrgAC_ARG_WITH(asciidoc,
89212458b28Smrg	AS_HELP_STRING([--with-asciidoc],
89312458b28Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
89412458b28Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
89512458b28Smrgm4_undefine([_defopt])
89687aef7c3Smrg
89712458b28Smrgif test "x$use_asciidoc" = x"auto"; then
89812458b28Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
89912458b28Smrg   if test "x$ASCIIDOC" = "x"; then
90012458b28Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
90112458b28Smrg	have_asciidoc=no
90212458b28Smrg   else
90312458b28Smrg        have_asciidoc=yes
90412458b28Smrg   fi
90512458b28Smrgelif test "x$use_asciidoc" = x"yes" ; then
90612458b28Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
90712458b28Smrg   if test "x$ASCIIDOC" = "x"; then
90812458b28Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
90912458b28Smrg   fi
91012458b28Smrg   have_asciidoc=yes
91112458b28Smrgelif test "x$use_asciidoc" = x"no" ; then
91212458b28Smrg   if test "x$ASCIIDOC" != "x"; then
91312458b28Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
91412458b28Smrg   fi
91512458b28Smrg   have_asciidoc=no
91612458b28Smrgelse
91712458b28Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
91812458b28Smrgfi
91912458b28Smrgm4_ifval([$1],
92012458b28Smrg[if test "$have_asciidoc" = yes; then
92112458b28Smrg    # scrape the asciidoc version
92212458b28Smrg    AC_MSG_CHECKING([the asciidoc version])
92312458b28Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
92412458b28Smrg    AC_MSG_RESULT([$asciidoc_version])
92512458b28Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
92612458b28Smrg        [if test "x$use_asciidoc" = xauto; then
92712458b28Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
92812458b28Smrg            have_asciidoc=no
92912458b28Smrg        else
93012458b28Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
93112458b28Smrg        fi])
93212458b28Smrgfi])
93312458b28SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
93412458b28Smrg]) # XORG_WITH_ASCIIDOC
93587aef7c3Smrg
93612458b28Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
93712458b28Smrg# -------------------------------------------
93812458b28Smrg# Minimum version: 1.5.0
93912458b28Smrg# Minimum version for optional DEFAULT argument: 1.11.0
94012458b28Smrg# Minimum version for optional DOT checking: 1.18.0
94112458b28Smrg#
94212458b28Smrg# Documentation tools are not always available on all platforms and sometimes
94312458b28Smrg# not at the appropriate level. This macro enables a module to test for the
94412458b28Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
94512458b28Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
94612458b28Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
94712458b28Smrg# --with-doxygen assumes 'auto'.
94812458b28Smrg#
94912458b28Smrg# Interface to module:
95012458b28Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
95112458b28Smrg# DOXYGEN:	 returns the path of the doxygen program found
95212458b28Smrg#		 returns the path set by the user in the environment
95312458b28Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
95412458b28Smrg#		  'no' user instructs the module not to use doxygen
95512458b28Smrg#
95612458b28Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
95712458b28Smrg#
95812458b28SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
95912458b28SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
96012458b28SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
96112458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
96212458b28SmrgAC_ARG_WITH(doxygen,
96312458b28Smrg	AS_HELP_STRING([--with-doxygen],
96412458b28Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
96512458b28Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
96612458b28Smrgm4_undefine([_defopt])
967d87830e5Smrg
96812458b28Smrgif test "x$use_doxygen" = x"auto"; then
96912458b28Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97012458b28Smrg   if test "x$DOXYGEN" = "x"; then
97112458b28Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
97212458b28Smrg	have_doxygen=no
97312458b28Smrg   else
97412458b28Smrg        have_doxygen=yes
97512458b28Smrg   fi
97612458b28Smrgelif test "x$use_doxygen" = x"yes" ; then
97712458b28Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97812458b28Smrg   if test "x$DOXYGEN" = "x"; then
97912458b28Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
98012458b28Smrg   fi
98112458b28Smrg   have_doxygen=yes
98212458b28Smrgelif test "x$use_doxygen" = x"no" ; then
98312458b28Smrg   if test "x$DOXYGEN" != "x"; then
98412458b28Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
98512458b28Smrg   fi
98612458b28Smrg   have_doxygen=no
98712458b28Smrgelse
98812458b28Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
989663cdc11Smrgfi
99012458b28Smrgm4_ifval([$1],
99112458b28Smrg[if test "$have_doxygen" = yes; then
99212458b28Smrg    # scrape the doxygen version
99312458b28Smrg    AC_MSG_CHECKING([the doxygen version])
99412458b28Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
99512458b28Smrg    AC_MSG_RESULT([$doxygen_version])
99612458b28Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
99712458b28Smrg        [if test "x$use_doxygen" = xauto; then
99812458b28Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
99912458b28Smrg            have_doxygen=no
100012458b28Smrg        else
100112458b28Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
100212458b28Smrg        fi])
1003663cdc11Smrgfi])
1004663cdc11Smrg
100512458b28Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
100612458b28Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
100712458b28Smrgdnl 	HAVE_DOT = @HAVE_DOT@
100812458b28SmrgHAVE_DOT=no
100912458b28Smrgif test "x$have_doxygen" = "xyes"; then
101012458b28Smrg  AC_PATH_PROG([DOT], [dot])
101112458b28Smrg    if test "x$DOT" != "x"; then
101212458b28Smrg      HAVE_DOT=yes
101312458b28Smrg    fi
101412458b28Smrgfi
1015663cdc11Smrg
101612458b28SmrgAC_SUBST([HAVE_DOT])
101712458b28SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
101812458b28SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
101912458b28Smrg]) # XORG_WITH_DOXYGEN
1020663cdc11Smrg
102112458b28Smrg# XORG_WITH_GROFF([DEFAULT])
102212458b28Smrg# ----------------
102312458b28Smrg# Minimum version: 1.6.0
102412458b28Smrg# Minimum version for optional DEFAULT argument: 1.11.0
102512458b28Smrg#
102612458b28Smrg# Documentation tools are not always available on all platforms and sometimes
102712458b28Smrg# not at the appropriate level. This macro enables a module to test for the
102812458b28Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
102912458b28Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
103012458b28Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
103112458b28Smrg# --with-groff assumes 'auto'.
103212458b28Smrg#
103312458b28Smrg# Interface to module:
103412458b28Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
103512458b28Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
103612458b28Smrg# HAVE_GROFF_MS: the -ms macros package
103712458b28Smrg# GROFF:	 returns the path of the groff program found
103812458b28Smrg#		 returns the path set by the user in the environment
103912458b28Smrg# --with-groff:	 'yes' user instructs the module to use groff
104012458b28Smrg#		 'no' user instructs the module not to use groff
104112458b28Smrg#
104212458b28Smrg# Added in version 1.9.0:
104312458b28Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
104412458b28Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
104512458b28Smrg#		   psselect from the psutils package.
104612458b28Smrg#		   the ghostcript package. Refer to the grohtml man pages
104712458b28Smrg#
104812458b28Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
104912458b28Smrg#
105012458b28Smrg# OS and distros often splits groff in a basic and full package, the former
105112458b28Smrg# having the groff program and the later having devices, fonts and macros
105212458b28Smrg# Checking for the groff executable is not enough.
105312458b28Smrg#
105412458b28Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
105512458b28Smrg# unset HAVE_GROFF or GROFF env variables.
105612458b28Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
105712458b28Smrg#
105812458b28SmrgAC_DEFUN([XORG_WITH_GROFF],[
105912458b28SmrgAC_ARG_VAR([GROFF], [Path to groff command])
106012458b28Smrgm4_define([_defopt], m4_default([$1], [auto]))
106112458b28SmrgAC_ARG_WITH(groff,
106212458b28Smrg	AS_HELP_STRING([--with-groff],
106312458b28Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
106412458b28Smrg	   [use_groff=$withval], [use_groff=]_defopt)
106512458b28Smrgm4_undefine([_defopt])
1066663cdc11Smrg
106712458b28Smrgif test "x$use_groff" = x"auto"; then
106812458b28Smrg   AC_PATH_PROG([GROFF], [groff])
106912458b28Smrg   if test "x$GROFF" = "x"; then
107012458b28Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
107112458b28Smrg	have_groff=no
107212458b28Smrg   else
107312458b28Smrg        have_groff=yes
107412458b28Smrg   fi
107512458b28Smrgelif test "x$use_groff" = x"yes" ; then
107612458b28Smrg   AC_PATH_PROG([GROFF], [groff])
107712458b28Smrg   if test "x$GROFF" = "x"; then
107812458b28Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
107912458b28Smrg   fi
108012458b28Smrg   have_groff=yes
108112458b28Smrgelif test "x$use_groff" = x"no" ; then
108212458b28Smrg   if test "x$GROFF" != "x"; then
108312458b28Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
108412458b28Smrg   fi
108512458b28Smrg   have_groff=no
1086663cdc11Smrgelse
108712458b28Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
108812458b28Smrgfi
1089d87830e5Smrg
109012458b28Smrg# We have groff, test for the presence of the macro packages
109112458b28Smrgif test "x$have_groff" = x"yes"; then
109212458b28Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
109312458b28Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
109412458b28Smrg        groff_ms_works=yes
109512458b28Smrg    else
109612458b28Smrg        groff_ms_works=no
109712458b28Smrg    fi
109812458b28Smrg    AC_MSG_RESULT([$groff_ms_works])
109912458b28Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
110012458b28Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
110112458b28Smrg        groff_mm_works=yes
110212458b28Smrg    else
110312458b28Smrg        groff_mm_works=no
110412458b28Smrg    fi
110512458b28Smrg    AC_MSG_RESULT([$groff_mm_works])
110612458b28Smrgfi
1107d87830e5Smrg
110812458b28Smrg# We have groff, test for HTML dependencies, one command per package
110912458b28Smrgif test "x$have_groff" = x"yes"; then
111012458b28Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
111112458b28Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
111212458b28Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
111312458b28Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
111412458b28Smrg      have_groff_html=yes
111512458b28Smrg   else
111612458b28Smrg      have_groff_html=no
111712458b28Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
111812458b28Smrg   fi
111912458b28Smrgfi
1120d87830e5Smrg
112112458b28Smrg# Set Automake conditionals for Makefiles
112212458b28SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
112312458b28SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
112412458b28SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
112512458b28SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
112612458b28Smrg]) # XORG_WITH_GROFF
1127d87830e5Smrg
112812458b28Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
112912458b28Smrg# ---------------------------------------
113012458b28Smrg# Minimum version: 1.6.0
113112458b28Smrg# Minimum version for optional DEFAULT argument: 1.11.0
113212458b28Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
113312458b28Smrg#
113412458b28Smrg# Documentation tools are not always available on all platforms and sometimes
113512458b28Smrg# not at the appropriate level. This macro enables a module to test for the
113612458b28Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
113712458b28Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
113812458b28Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
113912458b28Smrg# --with-fop assumes 'auto'.
114012458b28Smrg#
114112458b28Smrg# Interface to module:
114212458b28Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
114312458b28Smrg# FOP:	 	returns the path of the fop program found
114412458b28Smrg#		returns the path set by the user in the environment
114512458b28Smrg# --with-fop: 	'yes' user instructs the module to use fop
114612458b28Smrg#		'no' user instructs the module not to use fop
114712458b28Smrg#
114812458b28Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
114912458b28Smrg#
115012458b28SmrgAC_DEFUN([XORG_WITH_FOP],[
115112458b28SmrgAC_ARG_VAR([FOP], [Path to fop command])
115212458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
115312458b28SmrgAC_ARG_WITH(fop,
115412458b28Smrg	AS_HELP_STRING([--with-fop],
115512458b28Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
115612458b28Smrg	   [use_fop=$withval], [use_fop=]_defopt)
115712458b28Smrgm4_undefine([_defopt])
1158d87830e5Smrg
115912458b28Smrgif test "x$use_fop" = x"auto"; then
116012458b28Smrg   AC_PATH_PROG([FOP], [fop])
116112458b28Smrg   if test "x$FOP" = "x"; then
116212458b28Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
116312458b28Smrg	have_fop=no
116412458b28Smrg   else
116512458b28Smrg        have_fop=yes
116612458b28Smrg   fi
116712458b28Smrgelif test "x$use_fop" = x"yes" ; then
116812458b28Smrg   AC_PATH_PROG([FOP], [fop])
116912458b28Smrg   if test "x$FOP" = "x"; then
117012458b28Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
117112458b28Smrg   fi
117212458b28Smrg   have_fop=yes
117312458b28Smrgelif test "x$use_fop" = x"no" ; then
117412458b28Smrg   if test "x$FOP" != "x"; then
117512458b28Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
117612458b28Smrg   fi
117712458b28Smrg   have_fop=no
117812458b28Smrgelse
117912458b28Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
118012458b28Smrgfi
1181d87830e5Smrg
118212458b28Smrg# Test for a minimum version of fop, if provided.
118312458b28Smrgm4_ifval([$1],
118412458b28Smrg[if test "$have_fop" = yes; then
118512458b28Smrg    # scrape the fop version
118612458b28Smrg    AC_MSG_CHECKING([for fop minimum version])
118712458b28Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
118812458b28Smrg    AC_MSG_RESULT([$fop_version])
118912458b28Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
119012458b28Smrg        [if test "x$use_fop" = xauto; then
119112458b28Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
119212458b28Smrg            have_fop=no
119312458b28Smrg        else
119412458b28Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
119512458b28Smrg        fi])
119612458b28Smrgfi])
119712458b28SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
119812458b28Smrg]) # XORG_WITH_FOP
1199663cdc11Smrg
120012458b28Smrg# XORG_WITH_M4([MIN-VERSION])
120112458b28Smrg# ---------------------------
120212458b28Smrg# Minimum version: 1.19.0
120312458b28Smrg#
120412458b28Smrg# This macro attempts to locate an m4 macro processor which supports
120512458b28Smrg# -I option and is only useful for modules relying on M4 in order to
120612458b28Smrg# expand macros in source code files.
120712458b28Smrg#
120812458b28Smrg# Interface to module:
120912458b28Smrg# M4:	 	returns the path of the m4 program found
121012458b28Smrg#		returns the path set by the user in the environment
121112458b28Smrg#
121212458b28SmrgAC_DEFUN([XORG_WITH_M4], [
121312458b28SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
121412458b28Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
121512458b28Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
121612458b28Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
121712458b28Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
121812458b28Smrg   [$PATH:/usr/gnu/bin])])
1219ea6ae205Smrg
122012458b28SmrgAC_SUBST([M4], [$ac_cv_path_M4])
122112458b28Smrg]) # XORG_WITH_M4
122212458b28Smrg
122312458b28Smrg# XORG_WITH_PS2PDF([DEFAULT])
122412458b28Smrg# ----------------
122512458b28Smrg# Minimum version: 1.6.0
122612458b28Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12277978d3cdSmrg#
122812458b28Smrg# Documentation tools are not always available on all platforms and sometimes
122912458b28Smrg# not at the appropriate level. This macro enables a module to test for the
123012458b28Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
123112458b28Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
123212458b28Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
123312458b28Smrg# --with-ps2pdf assumes 'auto'.
12347978d3cdSmrg#
123512458b28Smrg# Interface to module:
123612458b28Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
123712458b28Smrg# PS2PDF:	returns the path of the ps2pdf program found
123812458b28Smrg#		returns the path set by the user in the environment
123912458b28Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
124012458b28Smrg#		 'no' user instructs the module not to use ps2pdf
12417978d3cdSmrg#
124212458b28Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12437978d3cdSmrg#
124412458b28SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
124512458b28SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
124612458b28Smrgm4_define([_defopt], m4_default([$1], [auto]))
124712458b28SmrgAC_ARG_WITH(ps2pdf,
124812458b28Smrg	AS_HELP_STRING([--with-ps2pdf],
124912458b28Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
125012458b28Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
125112458b28Smrgm4_undefine([_defopt])
1252ea6ae205Smrg
125312458b28Smrgif test "x$use_ps2pdf" = x"auto"; then
125412458b28Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
125512458b28Smrg   if test "x$PS2PDF" = "x"; then
125612458b28Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
125712458b28Smrg	have_ps2pdf=no
125812458b28Smrg   else
125912458b28Smrg        have_ps2pdf=yes
126012458b28Smrg   fi
126112458b28Smrgelif test "x$use_ps2pdf" = x"yes" ; then
126212458b28Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
126312458b28Smrg   if test "x$PS2PDF" = "x"; then
126412458b28Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
126512458b28Smrg   fi
126612458b28Smrg   have_ps2pdf=yes
126712458b28Smrgelif test "x$use_ps2pdf" = x"no" ; then
126812458b28Smrg   if test "x$PS2PDF" != "x"; then
126912458b28Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
127012458b28Smrg   fi
127112458b28Smrg   have_ps2pdf=no
12727978d3cdSmrgelse
127312458b28Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12747978d3cdSmrgfi
127512458b28SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
127612458b28Smrg]) # XORG_WITH_PS2PDF
1277ea6ae205Smrg
127812458b28Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
127912458b28Smrg# ----------------
128012458b28Smrg# Minimum version: 1.6.0
128112458b28Smrg#
128212458b28Smrg# Documentation tools are not always available on all platforms and sometimes
128312458b28Smrg# not at the appropriate level. This macro enables a builder to skip all
128412458b28Smrg# documentation targets except traditional man pages.
128512458b28Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
128612458b28Smrg# maximum flexibilty in controlling documentation building.
128712458b28Smrg# Refer to:
128812458b28Smrg# XORG_WITH_XMLTO         --with-xmlto
128912458b28Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
129012458b28Smrg# XORG_WITH_DOXYGEN       --with-doxygen
129112458b28Smrg# XORG_WITH_FOP           --with-fop
129212458b28Smrg# XORG_WITH_GROFF         --with-groff
129312458b28Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
129412458b28Smrg#
129512458b28Smrg# Interface to module:
129612458b28Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
129712458b28Smrg# --enable-docs: 'yes' user instructs the module to generate docs
129812458b28Smrg#		 'no' user instructs the module not to generate docs
129912458b28Smrg# parm1:	specify the default value, yes or no.
130012458b28Smrg#
130112458b28SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
130212458b28Smrgm4_define([docs_default], m4_default([$1], [yes]))
130312458b28SmrgAC_ARG_ENABLE(docs,
130412458b28Smrg	AS_HELP_STRING([--enable-docs],
130512458b28Smrg	   [Enable building the documentation (default: ]docs_default[)]),
130612458b28Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
130712458b28Smrgm4_undefine([docs_default])
130812458b28SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
130912458b28SmrgAC_MSG_CHECKING([whether to build documentation])
131012458b28SmrgAC_MSG_RESULT([$build_docs])
131112458b28Smrg]) # XORG_ENABLE_DOCS
1312ea6ae205Smrg
131312458b28Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
131412458b28Smrg# ----------------
131512458b28Smrg# Minimum version: 1.6.0
1316ea6ae205Smrg#
131712458b28Smrg# This macro enables a builder to skip all developer documentation.
131812458b28Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
131912458b28Smrg# maximum flexibilty in controlling documentation building.
132012458b28Smrg# Refer to:
132112458b28Smrg# XORG_WITH_XMLTO         --with-xmlto
132212458b28Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
132312458b28Smrg# XORG_WITH_DOXYGEN       --with-doxygen
132412458b28Smrg# XORG_WITH_FOP           --with-fop
132512458b28Smrg# XORG_WITH_GROFF         --with-groff
132612458b28Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
132712458b28Smrg#
132812458b28Smrg# Interface to module:
132912458b28Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
133012458b28Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
133112458b28Smrg#			'no' user instructs the module not to generate developer docs
133212458b28Smrg# parm1:		specify the default value, yes or no.
133312458b28Smrg#
133412458b28SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
133512458b28Smrgm4_define([devel_default], m4_default([$1], [yes]))
133612458b28SmrgAC_ARG_ENABLE(devel-docs,
133712458b28Smrg	AS_HELP_STRING([--enable-devel-docs],
133812458b28Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
133912458b28Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
134012458b28Smrgm4_undefine([devel_default])
134112458b28SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
134212458b28SmrgAC_MSG_CHECKING([whether to build developer documentation])
134312458b28SmrgAC_MSG_RESULT([$build_devel_docs])
134412458b28Smrg]) # XORG_ENABLE_DEVEL_DOCS
134512458b28Smrg
134612458b28Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
134712458b28Smrg# ----------------
134812458b28Smrg# Minimum version: 1.6.0
134912458b28Smrg#
135012458b28Smrg# This macro enables a builder to skip all functional specification targets.
135112458b28Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
135212458b28Smrg# maximum flexibilty in controlling documentation building.
135312458b28Smrg# Refer to:
135412458b28Smrg# XORG_WITH_XMLTO         --with-xmlto
135512458b28Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
135612458b28Smrg# XORG_WITH_DOXYGEN       --with-doxygen
135712458b28Smrg# XORG_WITH_FOP           --with-fop
135812458b28Smrg# XORG_WITH_GROFF         --with-groff
135912458b28Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
136012458b28Smrg#
136112458b28Smrg# Interface to module:
136212458b28Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
136312458b28Smrg# --enable-specs:	'yes' user instructs the module to generate specs
136412458b28Smrg#			'no' user instructs the module not to generate specs
136512458b28Smrg# parm1:		specify the default value, yes or no.
136612458b28Smrg#
136712458b28SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
136812458b28Smrgm4_define([spec_default], m4_default([$1], [yes]))
136912458b28SmrgAC_ARG_ENABLE(specs,
137012458b28Smrg	AS_HELP_STRING([--enable-specs],
137112458b28Smrg	   [Enable building the specs (default: ]spec_default[)]),
137212458b28Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
137312458b28Smrgm4_undefine([spec_default])
137412458b28SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
137512458b28SmrgAC_MSG_CHECKING([whether to build functional specifications])
137612458b28SmrgAC_MSG_RESULT([$build_specs])
137712458b28Smrg]) # XORG_ENABLE_SPECS
137812458b28Smrg
137912458b28Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
138012458b28Smrg# ----------------------------------------------
138112458b28Smrg# Minimum version: 1.13.0
138212458b28Smrg#
138312458b28Smrg# This macro enables a builder to enable/disable unit testing
138412458b28Smrg# It makes no assumption about the test cases implementation
138512458b28Smrg# Test cases may or may not use Automake "Support for test suites"
138612458b28Smrg# They may or may not use the software utility library GLib
138712458b28Smrg#
138812458b28Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
138912458b28Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
139012458b28Smrg# The variable enable_unit_tests is used by other macros in this file.
139112458b28Smrg#
139212458b28Smrg# Interface to module:
139312458b28Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
139412458b28Smrg# enable_unit_tests:    used in configure.ac for additional configuration
139512458b28Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
139612458b28Smrg#			'no' user instructs the module not to build tests
139712458b28Smrg# parm1:		specify the default value, yes or no.
139812458b28Smrg#
139912458b28SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
140012458b28SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
140112458b28SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
140212458b28SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
140312458b28Smrgm4_define([_defopt], m4_default([$1], [auto]))
140412458b28SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
140512458b28Smrg	[Enable building unit test cases (default: ]_defopt[)]),
140612458b28Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
140712458b28Smrgm4_undefine([_defopt])
140812458b28SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
140912458b28SmrgAC_MSG_CHECKING([whether to build unit test cases])
141012458b28SmrgAC_MSG_RESULT([$enable_unit_tests])
141112458b28Smrg]) # XORG_ENABLE_UNIT_TESTS
1412ea6ae205Smrg
141312458b28Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
141412458b28Smrg# ------------------------------------------------------
141512458b28Smrg# Minimum version: 1.17.0
141612458b28Smrg#
141712458b28Smrg# This macro enables a builder to enable/disable integration testing
141812458b28Smrg# It makes no assumption about the test cases' implementation
141912458b28Smrg# Test cases may or may not use Automake "Support for test suites"
142012458b28Smrg#
142112458b28Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
142212458b28Smrg# usually requires less dependencies and may be built and run under less
142312458b28Smrg# stringent environments than integration tests.
142412458b28Smrg#
142512458b28Smrg# Interface to module:
142612458b28Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
142712458b28Smrg# enable_integration_tests:   used in configure.ac for additional configuration
142812458b28Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
142912458b28Smrg#                             'no' user instructs the module not to build tests
143012458b28Smrg# parm1:                      specify the default value, yes or no.
143112458b28Smrg#
143212458b28SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
143312458b28SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
143412458b28Smrgm4_define([_defopt], m4_default([$1], [auto]))
143512458b28SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
143612458b28Smrg	[Enable building integration test cases (default: ]_defopt[)]),
143712458b28Smrg	[enable_integration_tests=$enableval],
143812458b28Smrg	[enable_integration_tests=]_defopt)
143912458b28Smrgm4_undefine([_defopt])
144012458b28SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
144112458b28Smrg	[test "x$enable_integration_tests" != xno])
144212458b28SmrgAC_MSG_CHECKING([whether to build unit test cases])
144312458b28SmrgAC_MSG_RESULT([$enable_integration_tests])
144412458b28Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445ea6ae205Smrg
144612458b28Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
144712458b28Smrg# ----------------------------------------
144812458b28Smrg# Minimum version: 1.13.0
144912458b28Smrg#
145012458b28Smrg# GLib is a library which provides advanced data structures and functions.
145112458b28Smrg# This macro enables a module to test for the presence of Glib.
145212458b28Smrg#
145312458b28Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
145412458b28Smrg# Otherwise the value of $enable_unit_tests is blank.
145512458b28Smrg#
145612458b28Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
145712458b28Smrg# test support usually requires less dependencies and may be built and run under
145812458b28Smrg# less stringent environments than integration tests.
145912458b28Smrg#
146012458b28Smrg# Interface to module:
146112458b28Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
146212458b28Smrg# with_glib: used in configure.ac to know if GLib has been found
146312458b28Smrg# --with-glib:	'yes' user instructs the module to use glib
146412458b28Smrg#		'no' user instructs the module not to use glib
146512458b28Smrg#
146612458b28SmrgAC_DEFUN([XORG_WITH_GLIB],[
146712458b28SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146812458b28Smrgm4_define([_defopt], m4_default([$2], [auto]))
146912458b28SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
147012458b28Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
147112458b28Smrg	[with_glib=$withval], [with_glib=]_defopt)
147212458b28Smrgm4_undefine([_defopt])
1473d87830e5Smrg
147412458b28Smrghave_glib=no
147512458b28Smrg# Do not probe GLib if user explicitly disabled unit testing
147612458b28Smrgif test "x$enable_unit_tests" != x"no"; then
147712458b28Smrg  # Do not probe GLib if user explicitly disabled it
147812458b28Smrg  if test "x$with_glib" != x"no"; then
147912458b28Smrg    m4_ifval(
148012458b28Smrg      [$1],
148112458b28Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
148212458b28Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
148312458b28Smrg    )
148412458b28Smrg  fi
1485ea6ae205Smrgfi
1486ea6ae205Smrg
148712458b28Smrg# Not having GLib when unit testing has been explicitly requested is an error
148812458b28Smrgif test "x$enable_unit_tests" = x"yes"; then
148912458b28Smrg  if test "x$have_glib" = x"no"; then
149012458b28Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149112458b28Smrg  fi
1492ea6ae205Smrgfi
1493ea6ae205Smrg
149412458b28Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
149512458b28Smrgif test "x$enable_unit_tests" = x"no"; then
149612458b28Smrg  if test "x$with_glib" = x"yes"; then
149712458b28Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149812458b28Smrg  fi
14997978d3cdSmrgfi
1500ea6ae205Smrg
150112458b28Smrg# Not having GLib when it has been explicitly requested is an error
150212458b28Smrgif test "x$with_glib" = x"yes"; then
150312458b28Smrg  if test "x$have_glib" = x"no"; then
150412458b28Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
150512458b28Smrg  fi
15067978d3cdSmrgfi
1507ea6ae205Smrg
150812458b28SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
150912458b28Smrg]) # XORG_WITH_GLIB
1510ea6ae205Smrg
151112458b28Smrg# XORG_LD_WRAP([required|optional])
151212458b28Smrg# ---------------------------------
151312458b28Smrg# Minimum version: 1.13.0
151412458b28Smrg#
151512458b28Smrg# Check if linker supports -wrap, passed via compiler flags
151612458b28Smrg#
151712458b28Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
151812458b28Smrg# Otherwise the value of $enable_unit_tests is blank.
151912458b28Smrg#
152012458b28Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
152112458b28Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
152212458b28Smrg# available, an argument of "optional" allows use when some unit tests require
152312458b28Smrg# ld -wrap and others do not.
152412458b28Smrg#
152512458b28SmrgAC_DEFUN([XORG_LD_WRAP],[
152612458b28SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
152712458b28Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
152812458b28Smrg                      void __wrap_exit(int status) { return; }],
152912458b28Smrg                     [exit(0);])])
153012458b28Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
153112458b28Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
153212458b28Smrg  if test "x$have_ld_wrap" = x"no"; then
153312458b28Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
153412458b28Smrg  fi
15357978d3cdSmrgfi
153612458b28SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1537b6f2c9ccSmrg#
153812458b28Smrg]) # XORG_LD_WRAP
1539b6f2c9ccSmrg
154012458b28Smrg# XORG_CHECK_LINKER_FLAGS
154112458b28Smrg# -----------------------
154212458b28Smrg# SYNOPSIS
154312458b28Smrg#
154412458b28Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
154512458b28Smrg#
154612458b28Smrg# DESCRIPTION
154712458b28Smrg#
154812458b28Smrg#   Check whether the given linker FLAGS work with the current language's
154912458b28Smrg#   linker, or whether they give an error.
155012458b28Smrg#
155112458b28Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
155212458b28Smrg#   success/failure.
155312458b28Smrg#
155412458b28Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
155512458b28Smrg#
155612458b28Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
155712458b28Smrg#
155812458b28Smrg# LICENSE
155912458b28Smrg#
156012458b28Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
156112458b28Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
156212458b28Smrg#   Copyright (c) 2009 Matteo Frigo
156312458b28Smrg#
156412458b28Smrg#   This program is free software: you can redistribute it and/or modify it
156512458b28Smrg#   under the terms of the GNU General Public License as published by the
156612458b28Smrg#   Free Software Foundation, either version 3 of the License, or (at your
156712458b28Smrg#   option) any later version.
156812458b28Smrg#
156912458b28Smrg#   This program is distributed in the hope that it will be useful, but
157012458b28Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
157112458b28Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
157212458b28Smrg#   Public License for more details.
157312458b28Smrg#
157412458b28Smrg#   You should have received a copy of the GNU General Public License along
157512458b28Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
157612458b28Smrg#
157712458b28Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
157812458b28Smrg#   gives unlimited permission to copy, distribute and modify the configure
157912458b28Smrg#   scripts that are the output of Autoconf when processing the Macro. You
158012458b28Smrg#   need not follow the terms of the GNU General Public License when using
158112458b28Smrg#   or distributing such scripts, even though portions of the text of the
158212458b28Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
158312458b28Smrg#   all other use of the material that constitutes the Autoconf Macro.
158412458b28Smrg#
158512458b28Smrg#   This special exception to the GPL applies to versions of the Autoconf
158612458b28Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
158712458b28Smrg#   modified version of the Autoconf Macro, you may extend this special
158812458b28Smrg#   exception to the GPL to apply to your modified version as well.#
158912458b28SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
159012458b28Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
159112458b28Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
159212458b28SmrgAS_LITERAL_IF([$1],
159312458b28Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
159412458b28Smrg      ax_save_FLAGS=$LDFLAGS
159512458b28Smrg      LDFLAGS="$1"
159612458b28Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
159712458b28Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
159812458b28Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
159912458b28Smrg      LDFLAGS=$ax_save_FLAGS])],
160012458b28Smrg  [ax_save_FLAGS=$LDFLAGS
160112458b28Smrg   LDFLAGS="$1"
160212458b28Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
160312458b28Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
160412458b28Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
160512458b28Smrg   LDFLAGS=$ax_save_FLAGS])
160612458b28Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
160712458b28SmrgAC_MSG_RESULT($xorg_check_linker_flags)
160812458b28Smrgif test "x$xorg_check_linker_flags" = xyes; then
160912458b28Smrg	m4_default([$2], :)
1610b6f2c9ccSmrgelse
161112458b28Smrg	m4_default([$3], :)
1612b6f2c9ccSmrgfi
161312458b28Smrg]) # XORG_CHECK_LINKER_FLAGS
1614b6f2c9ccSmrg
161512458b28Smrg# XORG_MEMORY_CHECK_FLAGS
161612458b28Smrg# -----------------------
161712458b28Smrg# Minimum version: 1.16.0
1618ea6ae205Smrg#
161912458b28Smrg# This macro attempts to find appropriate memory checking functionality
162012458b28Smrg# for various platforms which unit testing code may use to catch various
162112458b28Smrg# forms of memory allocation and access errors in testing.
162212458b28Smrg#
162312458b28Smrg# Interface to module:
162412458b28Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
162512458b28Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162612458b28Smrg#
162712458b28Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162812458b28Smrg#
162912458b28SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1630ea6ae205Smrg
163112458b28SmrgAC_REQUIRE([AC_CANONICAL_HOST])
163212458b28SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
163312458b28Smrg           [Environment variables to enable memory checking in tests])
1634ea6ae205Smrg
163512458b28Smrg# Check for different types of support on different platforms
163612458b28Smrgcase $host_os in
163712458b28Smrg    solaris*)
163812458b28Smrg        AC_CHECK_LIB([umem], [umem_alloc],
163912458b28Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
164012458b28Smrg        ;;
164112458b28Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
164212458b28Smrg        # both directly and inverted, so should not be 0 or 255.
164312458b28Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
164412458b28Smrg        ;;
164512458b28Smrg    darwin*)
164612458b28Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
164712458b28Smrg        ;;
164812458b28Smrg    *bsd*)
164912458b28Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
165012458b28Smrg        ;;
165112458b28Smrgesac
1652ea6ae205Smrg
165312458b28Smrg# User supplied flags override default flags
165412458b28Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
165512458b28Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1656ea6ae205Smrgfi
1657ea6ae205Smrg
165812458b28SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
165912458b28Smrg]) # XORG_WITH_LINT
1660ea6ae205Smrg
166112458b28Smrg# XORG_CHECK_MALLOC_ZERO
166212458b28Smrg# ----------------------
166312458b28Smrg# Minimum version: 1.0.0
166412458b28Smrg#
166512458b28Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
166612458b28Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
166712458b28Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
166812458b28SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
166912458b28SmrgAC_ARG_ENABLE(malloc0returnsnull,
167012458b28Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
167112458b28Smrg		       [malloc(0) returns NULL (default: auto)]),
167212458b28Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
167312458b28Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1674ea6ae205Smrg
167512458b28SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
167612458b28Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
167712458b28SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
167812458b28Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
167912458b28Smrg#include <stdlib.h>
168012458b28Smrg],[
168112458b28Smrg    char *m0, *r0, *c0, *p;
168212458b28Smrg    m0 = malloc(0);
168312458b28Smrg    p = malloc(10);
168412458b28Smrg    r0 = realloc(p,0);
168512458b28Smrg    c0 = calloc(0,10);
168612458b28Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
168712458b28Smrg])],
168812458b28Smrg		[xorg_cv_malloc0_returns_null=yes],
168912458b28Smrg		[xorg_cv_malloc0_returns_null=no])])
169012458b28SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
169112458b28Smrgfi
169212458b28SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1693ea6ae205Smrg
169412458b28Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
169512458b28Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
169612458b28Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
169712458b28Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16987978d3cdSmrgelse
169912458b28Smrg	MALLOC_ZERO_CFLAGS=""
170012458b28Smrg	XMALLOC_ZERO_CFLAGS=""
170112458b28Smrg	XTMALLOC_ZERO_CFLAGS=""
17027978d3cdSmrgfi
1703ea6ae205Smrg
170412458b28SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
170512458b28SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
170612458b28SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
170712458b28Smrg]) # XORG_CHECK_MALLOC_ZERO
1708ea6ae205Smrg
170912458b28Smrg# XORG_WITH_LINT()
171012458b28Smrg# ----------------
171112458b28Smrg# Minimum version: 1.1.0
17127978d3cdSmrg#
171312458b28Smrg# This macro enables the use of a tool that flags some suspicious and
171412458b28Smrg# non-portable constructs (likely to be bugs) in C language source code.
171512458b28Smrg# It will attempt to locate the tool and use appropriate options.
171612458b28Smrg# There are various lint type tools on different platforms.
171712458b28Smrg#
171812458b28Smrg# Interface to module:
171912458b28Smrg# LINT:		returns the path to the tool found on the platform
172012458b28Smrg#		or the value set to LINT on the configure cmd line
172112458b28Smrg#		also an Automake conditional
172212458b28Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
172312458b28Smrg#
172412458b28Smrg# --with-lint:	'yes' user instructs the module to use lint
172512458b28Smrg#		'no' user instructs the module not to use lint (default)
172612458b28Smrg#
172712458b28Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
172812458b28Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
172912458b28Smrg#
173012458b28SmrgAC_DEFUN([XORG_WITH_LINT],[
1731ea6ae205Smrg
173212458b28SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
173312458b28SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
173412458b28SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
173512458b28Smrg		[Use a lint-style source code checker (default: disabled)])],
173612458b28Smrg		[use_lint=$withval], [use_lint=no])
1737ea6ae205Smrg
173812458b28Smrg# Obtain platform specific info like program name and options
173912458b28Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
174012458b28Smrgcase $host_os in
174112458b28Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
174212458b28Smrg	lint_name=splint
174312458b28Smrg	lint_options="-badflag"
174412458b28Smrg	;;
174512458b28Smrg  *freebsd* | *netbsd*)
174612458b28Smrg	lint_name=lint
174712458b28Smrg	lint_options="-u -b"
174812458b28Smrg	;;
174912458b28Smrg  *solaris*)
175012458b28Smrg	lint_name=lint
175112458b28Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
175212458b28Smrg	;;
175312458b28Smrgesac
1754ea6ae205Smrg
175512458b28Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
175612458b28Smrgif test "x$use_lint" = x"yes" ; then
175712458b28Smrg   AC_PATH_PROG([LINT], [$lint_name])
175812458b28Smrg   if test "x$LINT" = "x"; then
175912458b28Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
176012458b28Smrg   fi
176112458b28Smrgelif test "x$use_lint" = x"no" ; then
176212458b28Smrg   if test "x$LINT" != "x"; then
176312458b28Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
176412458b28Smrg   fi
176512458b28Smrgelse
176612458b28Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17677978d3cdSmrgfi
1768ea6ae205Smrg
176912458b28Smrg# User supplied flags override default flags
177012458b28Smrgif test "x$LINT_FLAGS" != "x"; then
177112458b28Smrg   lint_options=$LINT_FLAGS
1772ea6ae205Smrgfi
1773ea6ae205Smrg
177412458b28SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
177512458b28SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776ea6ae205Smrg
177712458b28Smrg]) # XORG_WITH_LINT
1778ea6ae205Smrg
177912458b28Smrg# XORG_LINT_LIBRARY(LIBNAME)
178012458b28Smrg# --------------------------
178112458b28Smrg# Minimum version: 1.1.0
1782b6f2c9ccSmrg#
178312458b28Smrg# Sets up flags for building lint libraries for checking programs that call
178412458b28Smrg# functions in the library.
1785b6f2c9ccSmrg#
1786b6f2c9ccSmrg# Interface to module:
178712458b28Smrg# LINTLIB		- Automake variable with the name of lint library file to make
178812458b28Smrg# MAKE_LINT_LIB		- Automake conditional
1789b6f2c9ccSmrg#
179012458b28Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
179112458b28Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1792b6f2c9ccSmrg
179312458b28SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
179412458b28SmrgAC_REQUIRE([XORG_WITH_LINT])
179512458b28SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
179612458b28Smrg	[Create lint library (default: disabled)])],
179712458b28Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
179812458b28Smrg
179912458b28Smrgif test "x$make_lint_lib" = x"yes" ; then
180012458b28Smrg   LINTLIB=llib-l$1.ln
180112458b28Smrg   if test "x$LINT" = "x"; then
180212458b28Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1803b6f2c9ccSmrg   fi
180412458b28Smrgelif test "x$make_lint_lib" != x"no" ; then
180512458b28Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1806b6f2c9ccSmrgfi
1807b6f2c9ccSmrg
180812458b28SmrgAC_SUBST(LINTLIB)
180912458b28SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1810b6f2c9ccSmrg
181112458b28Smrg]) # XORG_LINT_LIBRARY
181212458b28Smrg
181312458b28Smrg# XORG_COMPILER_BRAND
181412458b28Smrg# -------------------
181512458b28Smrg# Minimum version: 1.14.0
1816d87830e5Smrg#
181712458b28Smrg# Checks for various brands of compilers and sets flags as appropriate:
181812458b28Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
181912458b28Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
182012458b28Smrg#   clang compiler - sets CLANGCC to "yes"
182112458b28Smrg#   Intel compiler - sets INTELCC to "yes"
182212458b28Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
182312458b28Smrg#
182412458b28SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
182512458b28SmrgAC_LANG_CASE(
182612458b28Smrg	[C], [
182712458b28Smrg		AC_REQUIRE([AC_PROG_CC_C99])
182812458b28Smrg	],
182912458b28Smrg	[C++], [
183012458b28Smrg		AC_REQUIRE([AC_PROG_CXX])
183112458b28Smrg	]
183212458b28Smrg)
183312458b28SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
183412458b28SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
183512458b28SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
183612458b28Smrg]) # XORG_COMPILER_BRAND
1837b6f2c9ccSmrg
183812458b28Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
183912458b28Smrg# ---------------
184012458b28Smrg# Minimum version: 1.16.0
1841245f6787Smrg#
184212458b28Smrg# Test if the compiler works when passed the given flag as a command line argument.
184312458b28Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
184412458b28Smrg# next flag in the list until there are no more options.
1845245f6787Smrg#
184612458b28Smrg# Note that this does not guarantee that the compiler supports the flag as some
184712458b28Smrg# compilers will simply ignore arguments that they do not understand, but we do
184812458b28Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
184912458b28Smrg# -Werror=unused-command-line-argument
185012458b28Smrg#
185112458b28SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
185212458b28Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185312458b28Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185412458b28Smrg
185512458b28SmrgAC_LANG_COMPILER_REQUIRE
185612458b28Smrg
185712458b28SmrgAC_LANG_CASE(
185812458b28Smrg	[C], [
185912458b28Smrg		AC_REQUIRE([AC_PROG_CC_C99])
186012458b28Smrg		define([PREFIX], [C])
186112458b28Smrg		define([CACHE_PREFIX], [cc])
186212458b28Smrg		define([COMPILER], [$CC])
186312458b28Smrg	],
186412458b28Smrg	[C++], [
186512458b28Smrg		define([PREFIX], [CXX])
186612458b28Smrg		define([CACHE_PREFIX], [cxx])
186712458b28Smrg		define([COMPILER], [$CXX])
186812458b28Smrg	]
186912458b28Smrg)
187012458b28Smrg
187112458b28Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
187212458b28Smrg
187312458b28Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
187412458b28Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
187512458b28Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
187612458b28Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
187712458b28Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
187812458b28Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
187912458b28Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
188012458b28Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
188112458b28Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
188212458b28Smrgfi
188312458b28Smrg
188412458b28Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
188512458b28Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
188612458b28Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
188712458b28Smrg	fi
188812458b28Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
188912458b28Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
189012458b28Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
189112458b28Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
189212458b28Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
189312458b28Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
189412458b28Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
189512458b28Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189612458b28Smrgfi
189712458b28Smrg
189812458b28Smrgfound="no"
189912458b28Smrgm4_foreach([flag], m4_cdr($@), [
190012458b28Smrg	if test $found = "no" ; then
190112458b28Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
190212458b28Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
190312458b28Smrg		fi
190412458b28Smrg
190512458b28Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
190612458b28Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
190712458b28Smrg		fi
190812458b28Smrg
190912458b28Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
191012458b28Smrg
191112458b28Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
191212458b28Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
191312458b28Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
191412458b28Smrg		AC_CACHE_VAL($cacheid,
191512458b28Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
191612458b28Smrg					     [eval $cacheid=yes],
191712458b28Smrg					     [eval $cacheid=no])])
191812458b28Smrg
191912458b28Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
192012458b28Smrg
192112458b28Smrg		eval supported=\$$cacheid
192212458b28Smrg		AC_MSG_RESULT([$supported])
192312458b28Smrg		if test "$supported" = "yes" ; then
192412458b28Smrg			$1="$$1 ]flag["
192512458b28Smrg			found="yes"
192612458b28Smrg		fi
192712458b28Smrg	fi
192812458b28Smrg])
192912458b28Smrg]) # XORG_TESTSET_CFLAG
193012458b28Smrg
193112458b28Smrg# XORG_COMPILER_FLAGS
193212458b28Smrg# ---------------
193312458b28Smrg# Minimum version: 1.16.0
1934245f6787Smrg#
193512458b28Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
193612458b28Smrg# arguments supported by the selected compiler which do NOT alter the generated
193712458b28Smrg# code.  These arguments will cause the compiler to print various warnings
193812458b28Smrg# during compilation AND turn a conservative set of warnings into errors.
1939245f6787Smrg#
194012458b28Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
194112458b28Smrg# future versions of util-macros as options are added to new compilers.
194212458b28Smrg#
194312458b28SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
194412458b28SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945245f6787Smrg
194612458b28SmrgAC_ARG_ENABLE(selective-werror,
194712458b28Smrg              AS_HELP_STRING([--disable-selective-werror],
194812458b28Smrg                             [Turn off selective compiler errors. (default: enabled)]),
194912458b28Smrg              [SELECTIVE_WERROR=$enableval],
195012458b28Smrg              [SELECTIVE_WERROR=yes])
195112458b28Smrg
195212458b28SmrgAC_LANG_CASE(
195312458b28Smrg        [C], [
195412458b28Smrg                define([PREFIX], [C])
195512458b28Smrg        ],
195612458b28Smrg        [C++], [
195712458b28Smrg                define([PREFIX], [CXX])
195812458b28Smrg        ]
195912458b28Smrg)
196012458b28Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
196112458b28Smrgif test "x$SUNCC" = "xyes"; then
196212458b28Smrg    [BASE_]PREFIX[FLAGS]="-v"
1963245f6787Smrgelse
196412458b28Smrg    [BASE_]PREFIX[FLAGS]=""
1965245f6787Smrgfi
1966245f6787Smrg
196712458b28Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
196812458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
196912458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
197012458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
197112458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972245f6787Smrg
197312458b28SmrgAC_LANG_CASE(
197412458b28Smrg	[C], [
197512458b28Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
197612458b28Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
197712458b28Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
197812458b28Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
197912458b28Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
198012458b28Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
198112458b28Smrg	]
198212458b28Smrg)
198312458b28Smrg
198412458b28Smrg# This chunk adds additional warnings that could catch undesired effects.
198512458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
198612458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
198712458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
198812458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
198912458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
199012458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
199112458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
199212458b28Smrg
199312458b28Smrg# These are currently disabled because they are noisy.  They will be enabled
199412458b28Smrg# in the future once the codebase is sufficiently modernized to silence
199512458b28Smrg# them.  For now, I don't want them to drown out the other warnings.
199612458b28Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
199712458b28Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
199812458b28Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
199912458b28Smrg
200012458b28Smrg# Turn some warnings into errors, so we don't accidently get successful builds
200112458b28Smrg# when there are problems that should be fixed.
200212458b28Smrg
200312458b28Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
200412458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
200512458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
200612458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
200712458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
200812458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
200912458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
201012458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
201112458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
201212458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
201312458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
201412458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
201512458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
201612458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201712458b28Smrgelse
201812458b28SmrgAC_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])
201912458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
202012458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
202112458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
202212458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
202312458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
202412458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
202512458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
202612458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
202712458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
202812458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
202912458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
203012458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
203112458b28SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203212458b28Smrgfi
203312458b28Smrg
203412458b28SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203512458b28Smrg]) # XORG_COMPILER_FLAGS
203612458b28Smrg
203712458b28Smrg# XORG_CWARNFLAGS
203812458b28Smrg# ---------------
203912458b28Smrg# Minimum version: 1.2.0
204012458b28Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041245f6787Smrg#
204212458b28Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2043245f6787Smrg#
204412458b28Smrg# This function is deprecated because it defines -fno-strict-aliasing
204512458b28Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
204612458b28Smrg# is needed, then it should be added explicitly in the module when
204712458b28Smrg# it is updated to use BASE_CFLAGS.
2048245f6787Smrg#
204912458b28SmrgAC_DEFUN([XORG_CWARNFLAGS], [
205012458b28SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
205112458b28SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
205212458b28SmrgAC_LANG_CASE(
205312458b28Smrg	[C], [
205412458b28Smrg		CWARNFLAGS="$BASE_CFLAGS"
205512458b28Smrg		if  test "x$GCC" = xyes ; then
205612458b28Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
205712458b28Smrg		fi
205812458b28Smrg		AC_SUBST(CWARNFLAGS)
205912458b28Smrg	]
206012458b28Smrg)
206112458b28Smrg]) # XORG_CWARNFLAGS
206212458b28Smrg
206312458b28Smrg# XORG_STRICT_OPTION
206412458b28Smrg# -----------------------
206512458b28Smrg# Minimum version: 1.3.0
2066245f6787Smrg#
206712458b28Smrg# Add configure option to enable strict compilation flags, such as treating
206812458b28Smrg# warnings as fatal errors.
206912458b28Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
207012458b28Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071245f6787Smrg#
207212458b28Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
207312458b28Smrg# when strict compilation is unconditionally desired.
207412458b28SmrgAC_DEFUN([XORG_STRICT_OPTION], [
207512458b28SmrgAC_REQUIRE([XORG_CWARNFLAGS])
207612458b28SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077245f6787Smrg
207812458b28SmrgAC_ARG_ENABLE(strict-compilation,
207912458b28Smrg			  AS_HELP_STRING([--enable-strict-compilation],
208012458b28Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
208112458b28Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
208212458b28Smrg
208312458b28SmrgAC_LANG_CASE(
208412458b28Smrg        [C], [
208512458b28Smrg                define([PREFIX], [C])
208612458b28Smrg        ],
208712458b28Smrg        [C++], [
208812458b28Smrg                define([PREFIX], [CXX])
208912458b28Smrg        ]
209012458b28Smrg)
209112458b28Smrg
209212458b28Smrg[STRICT_]PREFIX[FLAGS]=""
209312458b28SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
209412458b28SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209512458b28Smrg
209612458b28Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
209712458b28Smrg# activate it with -Werror, so we add it here explicitly.
209812458b28SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209912458b28Smrg
210012458b28Smrgif test "x$STRICT_COMPILE" = "xyes"; then
210112458b28Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
210212458b28Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2103245f6787Smrgfi
210412458b28SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
210512458b28SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
210612458b28SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
210712458b28Smrg]) # XORG_STRICT_OPTION
2108245f6787Smrg
210912458b28Smrg# XORG_DEFAULT_OPTIONS
211012458b28Smrg# --------------------
211112458b28Smrg# Minimum version: 1.3.0
211212458b28Smrg#
211312458b28Smrg# Defines default options for X.Org modules.
211412458b28Smrg#
211512458b28SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211612458b28SmrgAC_REQUIRE([AC_PROG_INSTALL])
211712458b28SmrgXORG_COMPILER_FLAGS
211812458b28SmrgXORG_CWARNFLAGS
211912458b28SmrgXORG_STRICT_OPTION
212012458b28SmrgXORG_RELEASE_VERSION
212112458b28SmrgXORG_CHANGELOG
212212458b28SmrgXORG_INSTALL
212312458b28SmrgXORG_MANPAGE_SECTIONS
212412458b28Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212512458b28Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212612458b28Smrg]) # XORG_DEFAULT_OPTIONS
2127245f6787Smrg
212812458b28Smrg# XORG_INSTALL()
2129b6f2c9ccSmrg# ----------------
213012458b28Smrg# Minimum version: 1.4.0
2131b6f2c9ccSmrg#
213212458b28Smrg# Defines the variable INSTALL_CMD as the command to copy
213312458b28Smrg# INSTALL from $prefix/share/util-macros.
2134b6f2c9ccSmrg#
213512458b28SmrgAC_DEFUN([XORG_INSTALL], [
213612458b28SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213712458b28Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
213812458b28SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
213912458b28Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214012458b28Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214112458b28Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214212458b28SmrgAC_SUBST([INSTALL_CMD])
214312458b28Smrg]) # XORG_INSTALL
214412458b28Smrgdnl Copyright 2005 Red Hat, Inc
214512458b28Smrgdnl
214612458b28Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
214712458b28Smrgdnl documentation for any purpose is hereby granted without fee, provided that
214812458b28Smrgdnl the above copyright notice appear in all copies and that both that
214912458b28Smrgdnl copyright notice and this permission notice appear in supporting
215012458b28Smrgdnl documentation.
215112458b28Smrgdnl
215212458b28Smrgdnl The above copyright notice and this permission notice shall be included
215312458b28Smrgdnl in all copies or substantial portions of the Software.
215412458b28Smrgdnl
215512458b28Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
215612458b28Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215712458b28Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
215812458b28Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
215912458b28Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
216012458b28Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
216112458b28Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
216212458b28Smrgdnl
216312458b28Smrgdnl Except as contained in this notice, the name of the copyright holders shall
216412458b28Smrgdnl not be used in advertising or otherwise to promote the sale, use or
216512458b28Smrgdnl other dealings in this Software without prior written authorization
216612458b28Smrgdnl from the copyright holders.
216712458b28Smrgdnl
2168b6f2c9ccSmrg
216912458b28Smrg# XORG_RELEASE_VERSION
217012458b28Smrg# --------------------
217112458b28Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172b6f2c9ccSmrg
217312458b28SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
217412458b28Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
217512458b28Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
217612458b28Smrg		[Major version of this package])
217712458b28Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
217812458b28Smrg	if test "x$PVM" = "x"; then
217912458b28Smrg		PVM="0"
218012458b28Smrg	fi
218112458b28Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
218212458b28Smrg		[$PVM],
218312458b28Smrg		[Minor version of this package])
218412458b28Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
218512458b28Smrg	if test "x$PVP" = "x"; then
218612458b28Smrg		PVP="0"
218712458b28Smrg	fi
218812458b28Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
218912458b28Smrg		[$PVP],
219012458b28Smrg		[Patch version of this package])
219112458b28Smrg])
219212458b28Smrg
219312458b28Smrg# XORG_CHANGELOG()
219412458b28Smrg# ----------------
219512458b28Smrg# Minimum version: 1.2.0
2196b6f2c9ccSmrg#
219712458b28Smrg# Defines the variable CHANGELOG_CMD as the command to generate
219812458b28Smrg# ChangeLog from git.
2199b6f2c9ccSmrg#
2200b6f2c9ccSmrg#
220112458b28SmrgAC_DEFUN([XORG_CHANGELOG], [
220212458b28SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220312458b28Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220412458b28Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220512458b28Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220612458b28SmrgAC_SUBST([CHANGELOG_CMD])
220712458b28Smrg]) # XORG_CHANGELOG
220812458b28Smrg
220912458b28Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210b6f2c9ccSmrg#
221112458b28Smrg# This file is free software; the Free Software Foundation
221212458b28Smrg# gives unlimited permission to copy and/or distribute it,
221312458b28Smrg# with or without modifications, as long as this notice is preserved.
2214b6f2c9ccSmrg
221512458b28Smrg# AM_AUTOMAKE_VERSION(VERSION)
221612458b28Smrg# ----------------------------
221712458b28Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
221812458b28Smrg# generated from the m4 files accompanying Automake X.Y.
221912458b28Smrg# (This private macro should not be called outside this file.)
222012458b28SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
222112458b28Smrg[am__api_version='1.15'
222212458b28Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
222312458b28Smrgdnl require some minimum version.  Point them to the right macro.
222412458b28Smrgm4_if([$1], [1.15], [],
222512458b28Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
222612458b28Smrg])
222748f45e26Smrg
222812458b28Smrg# _AM_AUTOCONF_VERSION(VERSION)
222912458b28Smrg# -----------------------------
223012458b28Smrg# aclocal traces this macro to find the Autoconf version.
223112458b28Smrg# This is a private macro too.  Using m4_define simplifies
223212458b28Smrg# the logic in aclocal, which can simply ignore this definition.
223312458b28Smrgm4_define([_AM_AUTOCONF_VERSION], [])
223448f45e26Smrg
223512458b28Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
223612458b28Smrg# -------------------------------
223712458b28Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
223812458b28Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
223912458b28SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
224012458b28Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
224112458b28Smrgm4_ifndef([AC_AUTOCONF_VERSION],
224212458b28Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
224312458b28Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244b6f2c9ccSmrg
224512458b28Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
224612458b28Smrg
224712458b28Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248b6f2c9ccSmrg#
224912458b28Smrg# This file is free software; the Free Software Foundation
225012458b28Smrg# gives unlimited permission to copy and/or distribute it,
225112458b28Smrg# with or without modifications, as long as this notice is preserved.
225212458b28Smrg
225312458b28Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
225412458b28Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
225512458b28Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256b6f2c9ccSmrg#
225712458b28Smrg# Of course, Automake must honor this variable whenever it calls a
225812458b28Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
225912458b28Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
226012458b28Smrg# depending on how configure is run.  This is pretty annoying, since
226112458b28Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
226212458b28Smrg# source directory, any form will work fine, but in subdirectories a
226312458b28Smrg# relative path needs to be adjusted first.
2264b6f2c9ccSmrg#
226512458b28Smrg# $ac_aux_dir/missing
226612458b28Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
226712458b28Smrg# $top_srcdir/$ac_aux_dir/missing
226812458b28Smrg#    fails if $ac_aux_dir is absolute,
226912458b28Smrg#    fails when called from a subdirectory in a VPATH build with
227012458b28Smrg#          a relative $ac_aux_dir
2271b6f2c9ccSmrg#
227212458b28Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
227312458b28Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
227412458b28Smrg# harmless because $srcdir is '.', but things will broke when you
227512458b28Smrg# start a VPATH build or use an absolute $srcdir.
2276b6f2c9ccSmrg#
227712458b28Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
227812458b28Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
227912458b28Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
228012458b28Smrg# and then we would define $MISSING as
228112458b28Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
228212458b28Smrg# This will work as long as MISSING is not called from configure, because
228312458b28Smrg# unfortunately $(top_srcdir) has no meaning in configure.
228412458b28Smrg# However there are other variables, like CC, which are often used in
228512458b28Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286b6f2c9ccSmrg#
228712458b28Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
228812458b28Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
228912458b28Smrg# configured tree to be moved without reconfiguration.
2290b6f2c9ccSmrg
229112458b28SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
229212458b28Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
229312458b28Smrg# Expand $ac_aux_dir to an absolute path.
229412458b28Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
229512458b28Smrg])
229612458b28Smrg
229712458b28Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
229812458b28Smrg
229912458b28Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230012458b28Smrg#
230112458b28Smrg# This file is free software; the Free Software Foundation
230212458b28Smrg# gives unlimited permission to copy and/or distribute it,
230312458b28Smrg# with or without modifications, as long as this notice is preserved.
230412458b28Smrg
230512458b28Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
230612458b28Smrg# -------------------------------------
230712458b28Smrg# Define a conditional.
230812458b28SmrgAC_DEFUN([AM_CONDITIONAL],
230912458b28Smrg[AC_PREREQ([2.52])dnl
231012458b28Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
231112458b28Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
231212458b28SmrgAC_SUBST([$1_TRUE])dnl
231312458b28SmrgAC_SUBST([$1_FALSE])dnl
231412458b28Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
231512458b28Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
231612458b28Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
231712458b28Smrgif $2; then
231812458b28Smrg  $1_TRUE=
231912458b28Smrg  $1_FALSE='#'
2320b6f2c9ccSmrgelse
232112458b28Smrg  $1_TRUE='#'
232212458b28Smrg  $1_FALSE=
2323b6f2c9ccSmrgfi
232412458b28SmrgAC_CONFIG_COMMANDS_PRE(
232512458b28Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
232612458b28Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
232712458b28SmrgUsually this means the macro was only invoked conditionally.]])
232812458b28Smrgfi])])
2329b6f2c9ccSmrg
233012458b28Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233112458b28Smrg#
233212458b28Smrg# This file is free software; the Free Software Foundation
233312458b28Smrg# gives unlimited permission to copy and/or distribute it,
233412458b28Smrg# with or without modifications, as long as this notice is preserved.
233512458b28Smrg
233612458b28Smrg
233712458b28Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
233812458b28Smrg# written in clear, in which case automake, when reading aclocal.m4,
233912458b28Smrg# will think it sees a *use*, and therefore will trigger all it's
234012458b28Smrg# C support machinery.  Also note that it means that autoscan, seeing
234112458b28Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
234212458b28Smrg
234312458b28Smrg
234412458b28Smrg# _AM_DEPENDENCIES(NAME)
234512458b28Smrg# ----------------------
234612458b28Smrg# See how the compiler implements dependency checking.
234712458b28Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
234812458b28Smrg# We try a few techniques and use that to set a single cache variable.
234912458b28Smrg#
235012458b28Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
235112458b28Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
235212458b28Smrg# dependency, and given that the user is not expected to run this macro,
235312458b28Smrg# just rely on AC_PROG_CC.
235412458b28SmrgAC_DEFUN([_AM_DEPENDENCIES],
235512458b28Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
235612458b28SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
235712458b28SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
235812458b28SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
235912458b28Smrg
236012458b28Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
236112458b28Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
236212458b28Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
236312458b28Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
236412458b28Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
236512458b28Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
236612458b28Smrg                    [depcc="$$1"   am_compiler_list=])
236712458b28Smrg
236812458b28SmrgAC_CACHE_CHECK([dependency style of $depcc],
236912458b28Smrg               [am_cv_$1_dependencies_compiler_type],
237012458b28Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
237112458b28Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
237212458b28Smrg  # making bogus files that we don't know about and never remove.  For
237312458b28Smrg  # instance it was reported that on HP-UX the gcc test will end up
237412458b28Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
237512458b28Smrg  # in D".
237612458b28Smrg  rm -rf conftest.dir
237712458b28Smrg  mkdir conftest.dir
237812458b28Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
237912458b28Smrg  # using a relative directory.
238012458b28Smrg  cp "$am_depcomp" conftest.dir
238112458b28Smrg  cd conftest.dir
238212458b28Smrg  # We will build objects and dependencies in a subdirectory because
238312458b28Smrg  # it helps to detect inapplicable dependency modes.  For instance
238412458b28Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
238512458b28Smrg  # side effect of compilation, but ICC will put the dependencies in
238612458b28Smrg  # the current directory while Tru64 will put them in the object
238712458b28Smrg  # directory.
238812458b28Smrg  mkdir sub
238912458b28Smrg
239012458b28Smrg  am_cv_$1_dependencies_compiler_type=none
239112458b28Smrg  if test "$am_compiler_list" = ""; then
239212458b28Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
239312458b28Smrg  fi
239412458b28Smrg  am__universal=false
239512458b28Smrg  m4_case([$1], [CC],
239612458b28Smrg    [case " $depcc " in #(
239712458b28Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
239812458b28Smrg     esac],
239912458b28Smrg    [CXX],
240012458b28Smrg    [case " $depcc " in #(
240112458b28Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
240212458b28Smrg     esac])
240312458b28Smrg
240412458b28Smrg  for depmode in $am_compiler_list; do
240512458b28Smrg    # Setup a source with many dependencies, because some compilers
240612458b28Smrg    # like to wrap large dependency lists on column 80 (with \), and
240712458b28Smrg    # we should not choose a depcomp mode which is confused by this.
240812458b28Smrg    #
240912458b28Smrg    # We need to recreate these files for each test, as the compiler may
241012458b28Smrg    # overwrite some of them when testing with obscure command lines.
241112458b28Smrg    # This happens at least with the AIX C compiler.
241212458b28Smrg    : > sub/conftest.c
241312458b28Smrg    for i in 1 2 3 4 5 6; do
241412458b28Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
241512458b28Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
241612458b28Smrg      # Solaris 10 /bin/sh.
241712458b28Smrg      echo '/* dummy */' > sub/conftst$i.h
241812458b28Smrg    done
241912458b28Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
242012458b28Smrg
242112458b28Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
242212458b28Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
242312458b28Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
242412458b28Smrg    # versions had trouble with output in subdirs.
242512458b28Smrg    am__obj=sub/conftest.${OBJEXT-o}
242612458b28Smrg    am__minus_obj="-o $am__obj"
242712458b28Smrg    case $depmode in
242812458b28Smrg    gcc)
242912458b28Smrg      # This depmode causes a compiler race in universal mode.
243012458b28Smrg      test "$am__universal" = false || continue
243112458b28Smrg      ;;
243212458b28Smrg    nosideeffect)
243312458b28Smrg      # After this tag, mechanisms are not by side-effect, so they'll
243412458b28Smrg      # only be used when explicitly requested.
243512458b28Smrg      if test "x$enable_dependency_tracking" = xyes; then
243612458b28Smrg	continue
243712458b28Smrg      else
243812458b28Smrg	break
243912458b28Smrg      fi
244012458b28Smrg      ;;
244112458b28Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
244212458b28Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
244312458b28Smrg      # not run yet.  These depmodes are late enough in the game, and
244412458b28Smrg      # so weak that their functioning should not be impacted.
244512458b28Smrg      am__obj=conftest.${OBJEXT-o}
244612458b28Smrg      am__minus_obj=
244712458b28Smrg      ;;
244812458b28Smrg    none) break ;;
244912458b28Smrg    esac
245012458b28Smrg    if depmode=$depmode \
245112458b28Smrg       source=sub/conftest.c object=$am__obj \
245212458b28Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
245312458b28Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
245412458b28Smrg         >/dev/null 2>conftest.err &&
245512458b28Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
245612458b28Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
245712458b28Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
245812458b28Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
245912458b28Smrg      # icc doesn't choke on unknown options, it will just issue warnings
246012458b28Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
246112458b28Smrg      # that says an option was ignored or not supported.
246212458b28Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
246312458b28Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
246412458b28Smrg      # The diagnosis changed in icc 8.0:
246512458b28Smrg      #   icc: Command line remark: option '-MP' not supported
246612458b28Smrg      if (grep 'ignoring option' conftest.err ||
246712458b28Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
246812458b28Smrg        am_cv_$1_dependencies_compiler_type=$depmode
246912458b28Smrg        break
247012458b28Smrg      fi
2471b6f2c9ccSmrg    fi
247212458b28Smrg  done
2473b6f2c9ccSmrg
247412458b28Smrg  cd ..
247512458b28Smrg  rm -rf conftest.dir
247612458b28Smrgelse
247712458b28Smrg  am_cv_$1_dependencies_compiler_type=none
2478b6f2c9ccSmrgfi
247912458b28Smrg])
248012458b28SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
248112458b28SmrgAM_CONDITIONAL([am__fastdep$1], [
248212458b28Smrg  test "x$enable_dependency_tracking" != xno \
248312458b28Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
248412458b28Smrg])
2485b6f2c9ccSmrg
2486b6f2c9ccSmrg
248712458b28Smrg# AM_SET_DEPDIR
248812458b28Smrg# -------------
248912458b28Smrg# Choose a directory name for dependency files.
249012458b28Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
249112458b28SmrgAC_DEFUN([AM_SET_DEPDIR],
249212458b28Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
249312458b28SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
249412458b28Smrg])
2495b6f2c9ccSmrg
249612458b28Smrg
249712458b28Smrg# AM_DEP_TRACK
249812458b28Smrg# ------------
249912458b28SmrgAC_DEFUN([AM_DEP_TRACK],
250012458b28Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
250112458b28SmrgAS_HELP_STRING(
250212458b28Smrg  [--enable-dependency-tracking],
250312458b28Smrg  [do not reject slow dependency extractors])
250412458b28SmrgAS_HELP_STRING(
250512458b28Smrg  [--disable-dependency-tracking],
250612458b28Smrg  [speeds up one-time build])])
250712458b28Smrgif test "x$enable_dependency_tracking" != xno; then
250812458b28Smrg  am_depcomp="$ac_aux_dir/depcomp"
250912458b28Smrg  AMDEPBACKSLASH='\'
251012458b28Smrg  am__nodep='_no'
2511b6f2c9ccSmrgfi
251212458b28SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
251312458b28SmrgAC_SUBST([AMDEPBACKSLASH])dnl
251412458b28Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
251512458b28SmrgAC_SUBST([am__nodep])dnl
251612458b28Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
251712458b28Smrg])
2518245f6787Smrg
251912458b28Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2520b6f2c9ccSmrg
252112458b28Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
252248f45e26Smrg#
252312458b28Smrg# This file is free software; the Free Software Foundation
252412458b28Smrg# gives unlimited permission to copy and/or distribute it,
252512458b28Smrg# with or without modifications, as long as this notice is preserved.
252648f45e26Smrg
2527b6f2c9ccSmrg
252812458b28Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
252912458b28Smrg# ------------------------------
253012458b28SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
253112458b28Smrg[{
253212458b28Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
253312458b28Smrg  # are listed without --file.  Let's play safe and only enable the eval
253412458b28Smrg  # if we detect the quoting.
253512458b28Smrg  case $CONFIG_FILES in
253612458b28Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
253712458b28Smrg  *)   set x $CONFIG_FILES ;;
253812458b28Smrg  esac
253912458b28Smrg  shift
254012458b28Smrg  for mf
254112458b28Smrg  do
254212458b28Smrg    # Strip MF so we end up with the name of the file.
254312458b28Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
254412458b28Smrg    # Check whether this is an Automake generated Makefile or not.
254512458b28Smrg    # We used to match only the files named 'Makefile.in', but
254612458b28Smrg    # some people rename them; so instead we look at the file content.
254712458b28Smrg    # Grep'ing the first line is not enough: some people post-process
254812458b28Smrg    # each Makefile.in and add a new line on top of each file to say so.
254912458b28Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
255012458b28Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
255112458b28Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
255212458b28Smrg      dirpart=`AS_DIRNAME("$mf")`
255312458b28Smrg    else
255412458b28Smrg      continue
255512458b28Smrg    fi
255612458b28Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
255712458b28Smrg    # from the Makefile without running 'make'.
255812458b28Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
255912458b28Smrg    test -z "$DEPDIR" && continue
256012458b28Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
256112458b28Smrg    test -z "$am__include" && continue
256212458b28Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
256312458b28Smrg    # Find all dependency output files, they are included files with
256412458b28Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
256512458b28Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
256612458b28Smrg    # expansion.
256712458b28Smrg    for file in `sed -n "
256812458b28Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
256912458b28Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
257012458b28Smrg      # Make sure the directory exists.
257112458b28Smrg      test -f "$dirpart/$file" && continue
257212458b28Smrg      fdir=`AS_DIRNAME(["$file"])`
257312458b28Smrg      AS_MKDIR_P([$dirpart/$fdir])
257412458b28Smrg      # echo "creating $dirpart/$file"
257512458b28Smrg      echo '# dummy' > "$dirpart/$file"
257612458b28Smrg    done
257712458b28Smrg  done
257812458b28Smrg}
257912458b28Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2580b6f2c9ccSmrg
2581b6f2c9ccSmrg
258212458b28Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
258312458b28Smrg# -----------------------------
258412458b28Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2585b6f2c9ccSmrg#
258612458b28Smrg# This code is only required when automatic dependency tracking
258712458b28Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
258812458b28Smrg# need in order to bootstrap the dependency handling code.
258912458b28SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
259012458b28Smrg[AC_CONFIG_COMMANDS([depfiles],
259112458b28Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
259212458b28Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
259312458b28Smrg])
2594b6f2c9ccSmrg
259512458b28Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2596b6f2c9ccSmrg
259712458b28Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
2598245f6787Smrg#
259912458b28Smrg# This file is free software; the Free Software Foundation
260012458b28Smrg# gives unlimited permission to copy and/or distribute it,
260112458b28Smrg# with or without modifications, as long as this notice is preserved.
2602245f6787Smrg
260312458b28Smrg# This macro actually does too much.  Some checks are only needed if
260412458b28Smrg# your package does certain things.  But this isn't really a big deal.
260587aef7c3Smrg
260612458b28Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
260712458b28Smrgm4_define([AC_PROG_CC],
260812458b28Smrgm4_defn([AC_PROG_CC])
260912458b28Smrg[_AM_PROG_CC_C_O
261012458b28Smrg])
2611245f6787Smrg
261212458b28Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
261312458b28Smrg# AM_INIT_AUTOMAKE([OPTIONS])
261412458b28Smrg# -----------------------------------------------
261512458b28Smrg# The call with PACKAGE and VERSION arguments is the old style
261612458b28Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
261712458b28Smrg# and VERSION should now be passed to AC_INIT and removed from
261812458b28Smrg# the call to AM_INIT_AUTOMAKE.
261912458b28Smrg# We support both call styles for the transition.  After
262012458b28Smrg# the next Automake release, Autoconf can make the AC_INIT
262112458b28Smrg# arguments mandatory, and then we can depend on a new Autoconf
262212458b28Smrg# release and drop the old call support.
262312458b28SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
262412458b28Smrg[AC_PREREQ([2.65])dnl
262512458b28Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
262612458b28Smrgdnl the ones we care about.
262712458b28Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
262812458b28SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
262912458b28SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
263012458b28Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
263112458b28Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
263212458b28Smrg  # is not polluted with repeated "-I."
263312458b28Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
263412458b28Smrg  # test to see if srcdir already configured
263512458b28Smrg  if test -f $srcdir/config.status; then
263612458b28Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637245f6787Smrg  fi
2638245f6787Smrgfi
2639245f6787Smrg
264012458b28Smrg# test whether we have cygpath
264112458b28Smrgif test -z "$CYGPATH_W"; then
264212458b28Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
264312458b28Smrg    CYGPATH_W='cygpath -w'
264412458b28Smrg  else
264512458b28Smrg    CYGPATH_W=echo
2646245f6787Smrg  fi
2647245f6787Smrgfi
264812458b28SmrgAC_SUBST([CYGPATH_W])
2649245f6787Smrg
265012458b28Smrg# Define the identity of the package.
265112458b28Smrgdnl Distinguish between old-style and new-style calls.
265212458b28Smrgm4_ifval([$2],
265312458b28Smrg[AC_DIAGNOSE([obsolete],
265412458b28Smrg             [$0: two- and three-arguments forms are deprecated.])
265512458b28Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
265612458b28Smrg AC_SUBST([PACKAGE], [$1])dnl
265712458b28Smrg AC_SUBST([VERSION], [$2])],
265812458b28Smrg[_AM_SET_OPTIONS([$1])dnl
265912458b28Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
266012458b28Smrgm4_if(
266112458b28Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
266212458b28Smrg  [ok:ok],,
266312458b28Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
266412458b28Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
266512458b28Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666245f6787Smrg
266712458b28Smrg_AM_IF_OPTION([no-define],,
266812458b28Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
266912458b28Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670245f6787Smrg
267112458b28Smrg# Some tools Automake needs.
267212458b28SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
267312458b28SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
267412458b28SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
267512458b28SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
267612458b28SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
267712458b28SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
267812458b28SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
267912458b28SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
268012458b28SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
268112458b28SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
268212458b28Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
268312458b28Smrg# dies out for good.  For more background, see:
268412458b28Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
268512458b28Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
268612458b28SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
268712458b28Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
268812458b28Smrg# system "awk" is bad on some platforms.
268912458b28SmrgAC_REQUIRE([AC_PROG_AWK])dnl
269012458b28SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
269112458b28SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
269212458b28Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
269312458b28Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
269412458b28Smrg			     [_AM_PROG_TAR([v7])])])
269512458b28Smrg_AM_IF_OPTION([no-dependencies],,
269612458b28Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
269712458b28Smrg		  [_AM_DEPENDENCIES([CC])],
269812458b28Smrg		  [m4_define([AC_PROG_CC],
269912458b28Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
270012458b28SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
270112458b28Smrg		  [_AM_DEPENDENCIES([CXX])],
270212458b28Smrg		  [m4_define([AC_PROG_CXX],
270312458b28Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
270412458b28SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
270512458b28Smrg		  [_AM_DEPENDENCIES([OBJC])],
270612458b28Smrg		  [m4_define([AC_PROG_OBJC],
270712458b28Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
270812458b28SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
270912458b28Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
271012458b28Smrg		  [m4_define([AC_PROG_OBJCXX],
271112458b28Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
271212458b28Smrg])
271312458b28SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
271412458b28Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
271512458b28Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
271612458b28Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
271712458b28SmrgAC_CONFIG_COMMANDS_PRE(dnl
271812458b28Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
271912458b28Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720245f6787Smrg
272112458b28Smrg# POSIX will say in a future version that running "rm -f" with no argument
272212458b28Smrg# is OK; and we want to be able to make that assumption in our Makefile
272312458b28Smrg# recipes.  So use an aggressive probe to check that the usage we want is
272412458b28Smrg# actually supported "in the wild" to an acceptable degree.
272512458b28Smrg# See automake bug#10828.
272612458b28Smrg# To make any issue more visible, cause the running configure to be aborted
272712458b28Smrg# by default if the 'rm' program in use doesn't match our expectations; the
272812458b28Smrg# user can still override this though.
272912458b28Smrgif rm -f && rm -fr && rm -rf; then : OK; else
273012458b28Smrg  cat >&2 <<'END'
273112458b28SmrgOops!
2732245f6787Smrg
273312458b28SmrgYour 'rm' program seems unable to run without file operands specified
273412458b28Smrgon the command line, even when the '-f' option is present.  This is contrary
273512458b28Smrgto the behaviour of most rm programs out there, and not conforming with
273612458b28Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737245f6787Smrg
273812458b28SmrgPlease tell bug-automake@gnu.org about your system, including the value
273912458b28Smrgof your $PATH and any error possibly output before this message.  This
274012458b28Smrgcan help us improve future automake versions.
2741663cdc11Smrg
274212458b28SmrgEND
274312458b28Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
274412458b28Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
274512458b28Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
274612458b28Smrg    echo >&2
274712458b28Smrg  else
274812458b28Smrg    cat >&2 <<'END'
274912458b28SmrgAborting the configuration process, to ensure you take notice of the issue.
275012458b28Smrg
275112458b28SmrgYou can download and install GNU coreutils to get an 'rm' implementation
275212458b28Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753663cdc11Smrg
275412458b28SmrgIf you want to complete the configuration process using your problematic
275512458b28Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
275612458b28Smrgto "yes", and re-run configure.
2757663cdc11Smrg
275812458b28SmrgEND
275912458b28Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
276012458b28Smrg  fi
2761663cdc11Smrgfi
276212458b28Smrgdnl The trailing newline in this macro's definition is deliberate, for
276312458b28Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
276412458b28Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
276512458b28Smrg])
2766663cdc11Smrg
276712458b28Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
276812458b28Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
276912458b28Smrgdnl mangled by Autoconf and run in a shell conditional statement.
277012458b28Smrgm4_define([_AC_COMPILER_EXEEXT],
277112458b28Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2772663cdc11Smrg
277312458b28Smrg# When config.status generates a header, we must update the stamp-h file.
277412458b28Smrg# This file resides in the same directory as the config header
277512458b28Smrg# that is generated.  The stamp files are numbered to have different names.
277612458b28Smrg
277712458b28Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
277812458b28Smrg# loop where config.status creates the headers, so we can generate
277912458b28Smrg# our stamp files there.
278012458b28SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
278112458b28Smrg[# Compute $1's index in $config_headers.
278212458b28Smrg_am_arg=$1
278312458b28Smrg_am_stamp_count=1
278412458b28Smrgfor _am_header in $config_headers :; do
278512458b28Smrg  case $_am_header in
278612458b28Smrg    $_am_arg | $_am_arg:* )
278712458b28Smrg      break ;;
278812458b28Smrg    * )
278912458b28Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
279012458b28Smrg  esac
279112458b28Smrgdone
279212458b28Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
279312458b28Smrg
279412458b28Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2795ea6ae205Smrg#
279612458b28Smrg# This file is free software; the Free Software Foundation
279712458b28Smrg# gives unlimited permission to copy and/or distribute it,
279812458b28Smrg# with or without modifications, as long as this notice is preserved.
2799ea6ae205Smrg
280012458b28Smrg# AM_PROG_INSTALL_SH
280112458b28Smrg# ------------------
280212458b28Smrg# Define $install_sh.
280312458b28SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
280412458b28Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
280512458b28Smrgif test x"${install_sh+set}" != xset; then
280612458b28Smrg  case $am_aux_dir in
280712458b28Smrg  *\ * | *\	*)
280812458b28Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
280912458b28Smrg  *)
281012458b28Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
281112458b28Smrg  esac
28127978d3cdSmrgfi
281312458b28SmrgAC_SUBST([install_sh])])
2814ea6ae205Smrg
281512458b28Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
281612458b28Smrg#
281712458b28Smrg# This file is free software; the Free Software Foundation
281812458b28Smrg# gives unlimited permission to copy and/or distribute it,
281912458b28Smrg# with or without modifications, as long as this notice is preserved.
282012458b28Smrg
282112458b28Smrg# Check whether the underlying file-system supports filenames
282212458b28Smrg# with a leading dot.  For instance MS-DOS doesn't.
282312458b28SmrgAC_DEFUN([AM_SET_LEADING_DOT],
282412458b28Smrg[rm -rf .tst 2>/dev/null
282512458b28Smrgmkdir .tst 2>/dev/null
282612458b28Smrgif test -d .tst; then
282712458b28Smrg  am__leading_dot=.
28287978d3cdSmrgelse
282912458b28Smrg  am__leading_dot=_
28307978d3cdSmrgfi
283112458b28Smrgrmdir .tst 2>/dev/null
283212458b28SmrgAC_SUBST([am__leading_dot])])
2833ea6ae205Smrg
283412458b28Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835ea6ae205Smrg
283612458b28Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
28377978d3cdSmrg#
283812458b28Smrg# This file is free software; the Free Software Foundation
283912458b28Smrg# gives unlimited permission to copy and/or distribute it,
284012458b28Smrg# with or without modifications, as long as this notice is preserved.
2841b6f2c9ccSmrg
284212458b28Smrg# AM_MAKE_INCLUDE()
284312458b28Smrg# -----------------
284412458b28Smrg# Check to see how make treats includes.
284512458b28SmrgAC_DEFUN([AM_MAKE_INCLUDE],
284612458b28Smrg[am_make=${MAKE-make}
284712458b28Smrgcat > confinc << 'END'
284812458b28Smrgam__doit:
284912458b28Smrg	@echo this is the am__doit target
285012458b28Smrg.PHONY: am__doit
285112458b28SmrgEND
285212458b28Smrg# If we don't find an include directive, just comment out the code.
285312458b28SmrgAC_MSG_CHECKING([for style of include used by $am_make])
285412458b28Smrgam__include="#"
285512458b28Smrgam__quote=
285612458b28Smrg_am_result=none
285712458b28Smrg# First try GNU make style include.
285812458b28Smrgecho "include confinc" > confmf
285912458b28Smrg# Ignore all kinds of additional output from 'make'.
286012458b28Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
286112458b28Smrg*the\ am__doit\ target*)
286212458b28Smrg  am__include=include
286312458b28Smrg  am__quote=
286412458b28Smrg  _am_result=GNU
286512458b28Smrg  ;;
2866b6f2c9ccSmrgesac
286712458b28Smrg# Now try BSD make style include.
286812458b28Smrgif test "$am__include" = "#"; then
286912458b28Smrg   echo '.include "confinc"' > confmf
287012458b28Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
287112458b28Smrg   *the\ am__doit\ target*)
287212458b28Smrg     am__include=.include
287312458b28Smrg     am__quote="\""
287412458b28Smrg     _am_result=BSD
287512458b28Smrg     ;;
287612458b28Smrg   esac
287712458b28Smrgfi
287812458b28SmrgAC_SUBST([am__include])
287912458b28SmrgAC_SUBST([am__quote])
288012458b28SmrgAC_MSG_RESULT([$_am_result])
288112458b28Smrgrm -f confinc confmf
288212458b28Smrg])
2883b6f2c9ccSmrg
288412458b28Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
288512458b28Smrg
288612458b28Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
288712458b28Smrg#
288812458b28Smrg# This file is free software; the Free Software Foundation
288912458b28Smrg# gives unlimited permission to copy and/or distribute it,
289012458b28Smrg# with or without modifications, as long as this notice is preserved.
289112458b28Smrg
289212458b28Smrg# AM_MISSING_PROG(NAME, PROGRAM)
289312458b28Smrg# ------------------------------
289412458b28SmrgAC_DEFUN([AM_MISSING_PROG],
289512458b28Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
289612458b28Smrg$1=${$1-"${am_missing_run}$2"}
289712458b28SmrgAC_SUBST($1)])
289812458b28Smrg
289912458b28Smrg# AM_MISSING_HAS_RUN
290012458b28Smrg# ------------------
290112458b28Smrg# Define MISSING if not defined so far and test if it is modern enough.
290212458b28Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
290312458b28SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
290412458b28Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
290512458b28SmrgAC_REQUIRE_AUX_FILE([missing])dnl
290612458b28Smrgif test x"${MISSING+set}" != xset; then
290712458b28Smrg  case $am_aux_dir in
290812458b28Smrg  *\ * | *\	*)
290912458b28Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
291012458b28Smrg  *)
291112458b28Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
291212458b28Smrg  esac
29137978d3cdSmrgfi
291412458b28Smrg# Use eval to expand $SHELL
291512458b28Smrgif eval "$MISSING --is-lightweight"; then
291612458b28Smrg  am_missing_run="$MISSING "
291712458b28Smrgelse
291812458b28Smrg  am_missing_run=
291912458b28Smrg  AC_MSG_WARN(['missing' script is too old or missing])
29207978d3cdSmrgfi
292112458b28Smrg])
2922ea6ae205Smrg
292312458b28Smrg# Helper functions for option handling.                     -*- Autoconf -*-
29247978d3cdSmrg
292512458b28Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2926b6f2c9ccSmrg#
292712458b28Smrg# This file is free software; the Free Software Foundation
292812458b28Smrg# gives unlimited permission to copy and/or distribute it,
292912458b28Smrg# with or without modifications, as long as this notice is preserved.
2930ea6ae205Smrg
293112458b28Smrg# _AM_MANGLE_OPTION(NAME)
293212458b28Smrg# -----------------------
293312458b28SmrgAC_DEFUN([_AM_MANGLE_OPTION],
293412458b28Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935b6f2c9ccSmrg
293612458b28Smrg# _AM_SET_OPTION(NAME)
293712458b28Smrg# --------------------
293812458b28Smrg# Set option NAME.  Presently that only means defining a flag for this option.
293912458b28SmrgAC_DEFUN([_AM_SET_OPTION],
294012458b28Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941b6f2c9ccSmrg
294212458b28Smrg# _AM_SET_OPTIONS(OPTIONS)
294312458b28Smrg# ------------------------
294412458b28Smrg# OPTIONS is a space-separated list of Automake options.
294512458b28SmrgAC_DEFUN([_AM_SET_OPTIONS],
294612458b28Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947ea6ae205Smrg
294812458b28Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
294912458b28Smrg# -------------------------------------------
295012458b28Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
295112458b28SmrgAC_DEFUN([_AM_IF_OPTION],
295212458b28Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
29537978d3cdSmrg
295412458b28Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955245f6787Smrg#
295612458b28Smrg# This file is free software; the Free Software Foundation
295712458b28Smrg# gives unlimited permission to copy and/or distribute it,
295812458b28Smrg# with or without modifications, as long as this notice is preserved.
2959245f6787Smrg
296012458b28Smrg# _AM_PROG_CC_C_O
2961663cdc11Smrg# ---------------
296212458b28Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
296312458b28Smrg# to automatically call this.
296412458b28SmrgAC_DEFUN([_AM_PROG_CC_C_O],
296512458b28Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
296612458b28SmrgAC_REQUIRE_AUX_FILE([compile])dnl
296712458b28SmrgAC_LANG_PUSH([C])dnl
296812458b28SmrgAC_CACHE_CHECK(
296912458b28Smrg  [whether $CC understands -c and -o together],
297012458b28Smrg  [am_cv_prog_cc_c_o],
297112458b28Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
297212458b28Smrg  # Make sure it works both with $CC and with simple cc.
297312458b28Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
297412458b28Smrg  # compilers refuse to overwrite an existing .o file with -o,
297512458b28Smrg  # though they will create one.
297612458b28Smrg  am_cv_prog_cc_c_o=yes
297712458b28Smrg  for am_i in 1 2; do
297812458b28Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
297912458b28Smrg         && test -f conftest2.$ac_objext; then
298012458b28Smrg      : OK
298112458b28Smrg    else
298212458b28Smrg      am_cv_prog_cc_c_o=no
298312458b28Smrg      break
298412458b28Smrg    fi
298512458b28Smrg  done
298612458b28Smrg  rm -f core conftest*
298712458b28Smrg  unset am_i])
298812458b28Smrgif test "$am_cv_prog_cc_c_o" != yes; then
298912458b28Smrg   # Losing compiler, so override with the script.
299012458b28Smrg   # FIXME: It is wrong to rewrite CC.
299112458b28Smrg   # But if we don't then we get into trouble of one sort or another.
299212458b28Smrg   # A longer-term fix would be to have automake use am__CC in this case,
299312458b28Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
299412458b28Smrg   CC="$am_aux_dir/compile $CC"
2995663cdc11Smrgfi
299612458b28SmrgAC_LANG_POP([C])])
2997663cdc11Smrg
299812458b28Smrg# For backward compatibility.
299912458b28SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3000663cdc11Smrg
300112458b28Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
300212458b28Smrg#
300312458b28Smrg# This file is free software; the Free Software Foundation
300412458b28Smrg# gives unlimited permission to copy and/or distribute it,
300512458b28Smrg# with or without modifications, as long as this notice is preserved.
3006663cdc11Smrg
300712458b28Smrg# AM_RUN_LOG(COMMAND)
300812458b28Smrg# -------------------
300912458b28Smrg# Run COMMAND, save the exit status in ac_status, and log it.
301012458b28Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
301112458b28SmrgAC_DEFUN([AM_RUN_LOG],
301212458b28Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
301312458b28Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
301412458b28Smrg   ac_status=$?
301512458b28Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
301612458b28Smrg   (exit $ac_status); }])
3017663cdc11Smrg
301812458b28Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019663cdc11Smrg
302012458b28Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
302112458b28Smrg#
302212458b28Smrg# This file is free software; the Free Software Foundation
302312458b28Smrg# gives unlimited permission to copy and/or distribute it,
302412458b28Smrg# with or without modifications, as long as this notice is preserved.
3025663cdc11Smrg
302612458b28Smrg# AM_SANITY_CHECK
302712458b28Smrg# ---------------
302812458b28SmrgAC_DEFUN([AM_SANITY_CHECK],
302912458b28Smrg[AC_MSG_CHECKING([whether build environment is sane])
303012458b28Smrg# Reject unsafe characters in $srcdir or the absolute working directory
303112458b28Smrg# name.  Accept space and tab only in the latter.
303212458b28Smrgam_lf='
303312458b28Smrg'
303412458b28Smrgcase `pwd` in
303512458b28Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
303612458b28Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
303712458b28Smrgesac
303812458b28Smrgcase $srcdir in
303912458b28Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
304012458b28Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
304112458b28Smrgesac
304212458b28Smrg
304312458b28Smrg# Do 'set' in a subshell so we don't clobber the current shell's
304412458b28Smrg# arguments.  Must try -L first in case configure is actually a
304512458b28Smrg# symlink; some systems play weird games with the mod time of symlinks
304612458b28Smrg# (eg FreeBSD returns the mod time of the symlink's containing
304712458b28Smrg# directory).
304812458b28Smrgif (
304912458b28Smrg   am_has_slept=no
305012458b28Smrg   for am_try in 1 2; do
305112458b28Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
305212458b28Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
305312458b28Smrg     if test "$[*]" = "X"; then
305412458b28Smrg	# -L didn't work.
305512458b28Smrg	set X `ls -t "$srcdir/configure" conftest.file`
305612458b28Smrg     fi
305712458b28Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
305812458b28Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059663cdc11Smrg
306012458b28Smrg	# If neither matched, then we have a broken ls.  This can happen
306112458b28Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
306212458b28Smrg	# broken ls alias from the environment.  This has actually
306312458b28Smrg	# happened.  Such a system could not be considered "sane".
306412458b28Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
306512458b28Smrg  alias in your environment])
306612458b28Smrg     fi
306712458b28Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
306812458b28Smrg       break
306912458b28Smrg     fi
307012458b28Smrg     # Just in case.
307112458b28Smrg     sleep 1
307212458b28Smrg     am_has_slept=yes
307312458b28Smrg   done
307412458b28Smrg   test "$[2]" = conftest.file
307512458b28Smrg   )
307612458b28Smrgthen
307712458b28Smrg   # Ok.
307812458b28Smrg   :
307912458b28Smrgelse
308012458b28Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
308112458b28SmrgCheck your system clock])
308212458b28Smrgfi
308312458b28SmrgAC_MSG_RESULT([yes])
308412458b28Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
308512458b28Smrg# generated files are strictly newer.
308612458b28Smrgam_sleep_pid=
308712458b28Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
308812458b28Smrg  ( sleep 1 ) &
308912458b28Smrg  am_sleep_pid=$!
309012458b28Smrgfi
309112458b28SmrgAC_CONFIG_COMMANDS_PRE(
309212458b28Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
309312458b28Smrg   if test -n "$am_sleep_pid"; then
309412458b28Smrg     # Hide warnings about reused PIDs.
309512458b28Smrg     wait $am_sleep_pid 2>/dev/null
309612458b28Smrg   fi
309712458b28Smrg   AC_MSG_RESULT([done])])
309812458b28Smrgrm -f conftest.file
3099663cdc11Smrg])
3100663cdc11Smrg
310112458b28Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102663cdc11Smrg#
310312458b28Smrg# This file is free software; the Free Software Foundation
310412458b28Smrg# gives unlimited permission to copy and/or distribute it,
310512458b28Smrg# with or without modifications, as long as this notice is preserved.
3106663cdc11Smrg
310712458b28Smrg# AM_SILENT_RULES([DEFAULT])
310812458b28Smrg# --------------------------
310912458b28Smrg# Enable less verbose build rules; with the default set to DEFAULT
311012458b28Smrg# ("yes" being less verbose, "no" or empty being verbose).
311112458b28SmrgAC_DEFUN([AM_SILENT_RULES],
311212458b28Smrg[AC_ARG_ENABLE([silent-rules], [dnl
311312458b28SmrgAS_HELP_STRING(
311412458b28Smrg  [--enable-silent-rules],
311512458b28Smrg  [less verbose build output (undo: "make V=1")])
311612458b28SmrgAS_HELP_STRING(
311712458b28Smrg  [--disable-silent-rules],
311812458b28Smrg  [verbose build output (undo: "make V=0")])dnl
311912458b28Smrg])
312012458b28Smrgcase $enable_silent_rules in @%:@ (((
312112458b28Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
312212458b28Smrg   no) AM_DEFAULT_VERBOSITY=1;;
312312458b28Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
312412458b28Smrgesac
312512458b28Smrgdnl
312612458b28Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
312712458b28Smrgdnl do not support nested variable expansions.
312812458b28Smrgdnl See automake bug#9928 and bug#10237.
312912458b28Smrgam_make=${MAKE-make}
313012458b28SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
313112458b28Smrg   [am_cv_make_support_nested_variables],
313212458b28Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
313312458b28SmrgBAR0=false
313412458b28SmrgBAR1=true
313512458b28SmrgV=1
313612458b28Smrgam__doit:
313712458b28Smrg	@$(TRUE)
313812458b28Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
313912458b28Smrg  am_cv_make_support_nested_variables=yes
3140663cdc11Smrgelse
314112458b28Smrg  am_cv_make_support_nested_variables=no
314212458b28Smrgfi])
314312458b28Smrgif test $am_cv_make_support_nested_variables = yes; then
314412458b28Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
314512458b28Smrg  AM_V='$(V)'
314612458b28Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
314712458b28Smrgelse
314812458b28Smrg  AM_V=$AM_DEFAULT_VERBOSITY
314912458b28Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3150663cdc11Smrgfi
315112458b28SmrgAC_SUBST([AM_V])dnl
315212458b28SmrgAM_SUBST_NOTMAKE([AM_V])dnl
315312458b28SmrgAC_SUBST([AM_DEFAULT_V])dnl
315412458b28SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
315512458b28SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
315612458b28SmrgAM_BACKSLASH='\'
315712458b28SmrgAC_SUBST([AM_BACKSLASH])dnl
315812458b28Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
315912458b28Smrg])
3160663cdc11Smrg
316112458b28Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
316212458b28Smrg#
316312458b28Smrg# This file is free software; the Free Software Foundation
316412458b28Smrg# gives unlimited permission to copy and/or distribute it,
316512458b28Smrg# with or without modifications, as long as this notice is preserved.
3166663cdc11Smrg
316712458b28Smrg# AM_PROG_INSTALL_STRIP
316812458b28Smrg# ---------------------
316912458b28Smrg# One issue with vendor 'install' (even GNU) is that you can't
317012458b28Smrg# specify the program used to strip binaries.  This is especially
317112458b28Smrg# annoying in cross-compiling environments, where the build's strip
317212458b28Smrg# is unlikely to handle the host's binaries.
317312458b28Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
317412458b28Smrg# always use install-sh in "make install-strip", and initialize
317512458b28Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
317612458b28SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
317712458b28Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
317812458b28Smrg# Installed binaries are usually stripped using 'strip' when the user
317912458b28Smrg# run "make install-strip".  However 'strip' might not be the right
318012458b28Smrg# tool to use in cross-compilation environments, therefore Automake
318112458b28Smrg# will honor the 'STRIP' environment variable to overrule this program.
318212458b28Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
318312458b28Smrgif test "$cross_compiling" != no; then
318412458b28Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
318512458b28Smrgfi
318612458b28SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
318712458b28SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188663cdc11Smrg
318912458b28Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
319012458b28Smrg#
319112458b28Smrg# This file is free software; the Free Software Foundation
319212458b28Smrg# gives unlimited permission to copy and/or distribute it,
319312458b28Smrg# with or without modifications, as long as this notice is preserved.
3194663cdc11Smrg
319512458b28Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
319612458b28Smrg# ---------------------------
319712458b28Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
319812458b28Smrg# This macro is traced by Automake.
319912458b28SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200663cdc11Smrg
320112458b28Smrg# AM_SUBST_NOTMAKE(VARIABLE)
320212458b28Smrg# --------------------------
320312458b28Smrg# Public sister of _AM_SUBST_NOTMAKE.
320412458b28SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
320587aef7c3Smrg
320612458b28Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3207663cdc11Smrg
320812458b28Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
3209663cdc11Smrg#
321012458b28Smrg# This file is free software; the Free Software Foundation
321112458b28Smrg# gives unlimited permission to copy and/or distribute it,
321212458b28Smrg# with or without modifications, as long as this notice is preserved.
3213e83ac88aSmrg
321412458b28Smrg# _AM_PROG_TAR(FORMAT)
321512458b28Smrg# --------------------
321612458b28Smrg# Check how to create a tarball in format FORMAT.
321712458b28Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218e83ac88aSmrg#
321912458b28Smrg# Substitute a variable $(am__tar) that is a command
322012458b28Smrg# writing to stdout a FORMAT-tarball containing the directory
322112458b28Smrg# $tardir.
322212458b28Smrg#     tardir=directory && $(am__tar) > result.tar
3223245f6787Smrg#
322412458b28Smrg# Substitute a variable $(am__untar) that extract such
322512458b28Smrg# a tarball read from stdin.
322612458b28Smrg#     $(am__untar) < result.tar
322712458b28Smrg#
322812458b28SmrgAC_DEFUN([_AM_PROG_TAR],
322912458b28Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
323012458b28Smrg# in the wild :-(  We should find a proper way to deprecate it ...
323112458b28SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232e83ac88aSmrg
323312458b28Smrg# We'll loop over all known methods to create a tar archive until one works.
323412458b28Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235663cdc11Smrg
323612458b28Smrgm4_if([$1], [v7],
323712458b28Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
323887aef7c3Smrg
323912458b28Smrg  [m4_case([$1],
324012458b28Smrg    [ustar],
324112458b28Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
324212458b28Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
324312458b28Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
324412458b28Smrg      # and bug#13588).
324512458b28Smrg      am_max_uid=2097151 # 2^21 - 1
324612458b28Smrg      am_max_gid=$am_max_uid
324712458b28Smrg      # The $UID and $GID variables are not portable, so we need to resort
324812458b28Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
324912458b28Smrg      # below are definitely unexpected, so allow the users to see them
325012458b28Smrg      # (that is, avoid stderr redirection).
325112458b28Smrg      am_uid=`id -u || echo unknown`
325212458b28Smrg      am_gid=`id -g || echo unknown`
325312458b28Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
325412458b28Smrg      if test $am_uid -le $am_max_uid; then
325512458b28Smrg         AC_MSG_RESULT([yes])
325612458b28Smrg      else
325712458b28Smrg         AC_MSG_RESULT([no])
325812458b28Smrg         _am_tools=none
325912458b28Smrg      fi
326012458b28Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
326112458b28Smrg      if test $am_gid -le $am_max_gid; then
326212458b28Smrg         AC_MSG_RESULT([yes])
326312458b28Smrg      else
326412458b28Smrg        AC_MSG_RESULT([no])
326512458b28Smrg        _am_tools=none
326612458b28Smrg      fi],
3267663cdc11Smrg
326812458b28Smrg  [pax],
326912458b28Smrg    [],
3270663cdc11Smrg
327112458b28Smrg  [m4_fatal([Unknown tar format])])
3272e83ac88aSmrg
327312458b28Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3274b6f2c9ccSmrg
327512458b28Smrg  # Go ahead even if we have the value already cached.  We do so because we
327612458b28Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
327712458b28Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3278ea6ae205Smrg
327912458b28Smrg  for _am_tool in $_am_tools; do
328012458b28Smrg    case $_am_tool in
328112458b28Smrg    gnutar)
328212458b28Smrg      for _am_tar in tar gnutar gtar; do
328312458b28Smrg        AM_RUN_LOG([$_am_tar --version]) && break
328412458b28Smrg      done
328512458b28Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
328612458b28Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
328712458b28Smrg      am__untar="$_am_tar -xf -"
328812458b28Smrg      ;;
328912458b28Smrg    plaintar)
329012458b28Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
329112458b28Smrg      # ustar tarball either.
329212458b28Smrg      (tar --version) >/dev/null 2>&1 && continue
329312458b28Smrg      am__tar='tar chf - "$$tardir"'
329412458b28Smrg      am__tar_='tar chf - "$tardir"'
329512458b28Smrg      am__untar='tar xf -'
329612458b28Smrg      ;;
329712458b28Smrg    pax)
329812458b28Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
329912458b28Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
330012458b28Smrg      am__untar='pax -r'
330112458b28Smrg      ;;
330212458b28Smrg    cpio)
330312458b28Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
330412458b28Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
330512458b28Smrg      am__untar='cpio -i -H $1 -d'
330612458b28Smrg      ;;
330712458b28Smrg    none)
330812458b28Smrg      am__tar=false
330912458b28Smrg      am__tar_=false
331012458b28Smrg      am__untar=false
331112458b28Smrg      ;;
331212458b28Smrg    esac
331348f45e26Smrg
331412458b28Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
331512458b28Smrg    # and am__untar set.
331612458b28Smrg    test -n "${am_cv_prog_tar_$1}" && break
3317ea6ae205Smrg
331812458b28Smrg    # tar/untar a dummy directory, and stop if the command works.
331912458b28Smrg    rm -rf conftest.dir
332012458b28Smrg    mkdir conftest.dir
332112458b28Smrg    echo GrepMe > conftest.dir/file
332212458b28Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
332312458b28Smrg    rm -rf conftest.dir
332412458b28Smrg    if test -s conftest.tar; then
332512458b28Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
332612458b28Smrg      AM_RUN_LOG([cat conftest.dir/file])
332712458b28Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
332812458b28Smrg    fi
332912458b28Smrg  done
333012458b28Smrg  rm -rf conftest.dir
333112458b28Smrg
333212458b28Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
333312458b28Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
333412458b28Smrg
333512458b28SmrgAC_SUBST([am__tar])
333612458b28SmrgAC_SUBST([am__untar])
333712458b28Smrg]) # _AM_PROG_TAR
3338ea6ae205Smrg
3339