aclocal.m4 revision 06ef0fec
106ef0fecSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
274a3f230Smrg
306ef0fecSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4b3307321Smrg
5b3307321Smrg# This file is free software; the Free Software Foundation
6b3307321Smrg# gives unlimited permission to copy and/or distribute it,
7b3307321Smrg# with or without modifications, as long as this notice is preserved.
8b3307321Smrg
9b3307321Smrg# This program is distributed in the hope that it will be useful,
10b3307321Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b3307321Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b3307321Smrg# PARTICULAR PURPOSE.
13b3307321Smrg
1474a3f230Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15afe13c8eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16afe13c8eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1706ef0fecSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1806ef0fecSmrg[m4_warning([this file was generated for autoconf 2.69.
19afe13c8eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20afe13c8eSmrgIf you have problems, you may need to regenerate the build system entirely.
2174a3f230SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22b3307321Smrg
2306ef0fecSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2406ef0fecSmrgdnl serial 11 (pkg-config-0.29)
2506ef0fecSmrgdnl
2606ef0fecSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2706ef0fecSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2806ef0fecSmrgdnl
2906ef0fecSmrgdnl This program is free software; you can redistribute it and/or modify
3006ef0fecSmrgdnl it under the terms of the GNU General Public License as published by
3106ef0fecSmrgdnl the Free Software Foundation; either version 2 of the License, or
3206ef0fecSmrgdnl (at your option) any later version.
3306ef0fecSmrgdnl
3406ef0fecSmrgdnl This program is distributed in the hope that it will be useful, but
3506ef0fecSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3606ef0fecSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3706ef0fecSmrgdnl General Public License for more details.
3806ef0fecSmrgdnl
3906ef0fecSmrgdnl You should have received a copy of the GNU General Public License
4006ef0fecSmrgdnl along with this program; if not, write to the Free Software
4106ef0fecSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4206ef0fecSmrgdnl 02111-1307, USA.
4306ef0fecSmrgdnl
4406ef0fecSmrgdnl As a special exception to the GNU General Public License, if you
4506ef0fecSmrgdnl distribute this file as part of a program that contains a
4606ef0fecSmrgdnl configuration script generated by Autoconf, you may include it under
4706ef0fecSmrgdnl the same distribution terms that you use for the rest of that
4806ef0fecSmrgdnl program.
4906ef0fecSmrg
5006ef0fecSmrgdnl PKG_PREREQ(MIN-VERSION)
5106ef0fecSmrgdnl -----------------------
5206ef0fecSmrgdnl Since: 0.29
5306ef0fecSmrgdnl
5406ef0fecSmrgdnl Verify that the version of the pkg-config macros are at least
5506ef0fecSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5606ef0fecSmrgdnl installed version of pkg-config, this checks the developer's version
5706ef0fecSmrgdnl of pkg.m4 when generating configure.
5806ef0fecSmrgdnl
5906ef0fecSmrgdnl To ensure that this macro is defined, also add:
6006ef0fecSmrgdnl m4_ifndef([PKG_PREREQ],
6106ef0fecSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6206ef0fecSmrgdnl
6306ef0fecSmrgdnl See the "Since" comment for each macro you use to see what version
6406ef0fecSmrgdnl of the macros you require.
6506ef0fecSmrgm4_defun([PKG_PREREQ],
6606ef0fecSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
6706ef0fecSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6806ef0fecSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6906ef0fecSmrg])dnl PKG_PREREQ
7006ef0fecSmrg
7106ef0fecSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7206ef0fecSmrgdnl ----------------------------------
7306ef0fecSmrgdnl Since: 0.16
7406ef0fecSmrgdnl
7506ef0fecSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7606ef0fecSmrgdnl first found in the path. Checks that the version of pkg-config found
7706ef0fecSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7806ef0fecSmrgdnl used since that's the first version where most current features of
7906ef0fecSmrgdnl pkg-config existed.
8006ef0fecSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8106ef0fecSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8206ef0fecSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8306ef0fecSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8406ef0fecSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8506ef0fecSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8606ef0fecSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87b3307321Smrg
8806ef0fecSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8906ef0fecSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9006ef0fecSmrgfi
9106ef0fecSmrgif test -n "$PKG_CONFIG"; then
9206ef0fecSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
9306ef0fecSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9406ef0fecSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9506ef0fecSmrg		AC_MSG_RESULT([yes])
9606ef0fecSmrg	else
9706ef0fecSmrg		AC_MSG_RESULT([no])
9806ef0fecSmrg		PKG_CONFIG=""
9906ef0fecSmrg	fi
10006ef0fecSmrgfi[]dnl
10106ef0fecSmrg])dnl PKG_PROG_PKG_CONFIG
102b3307321Smrg
10306ef0fecSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10406ef0fecSmrgdnl -------------------------------------------------------------------
10506ef0fecSmrgdnl Since: 0.18
10606ef0fecSmrgdnl
10706ef0fecSmrgdnl Check to see whether a particular set of modules exists. Similar to
10806ef0fecSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10906ef0fecSmrgdnl
11006ef0fecSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11106ef0fecSmrgdnl only at the first occurence in configure.ac, so if the first place
11206ef0fecSmrgdnl it's called might be skipped (such as if it is within an "if", you
11306ef0fecSmrgdnl have to call PKG_CHECK_EXISTS manually
11406ef0fecSmrgAC_DEFUN([PKG_CHECK_EXISTS],
11506ef0fecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11606ef0fecSmrgif test -n "$PKG_CONFIG" && \
11706ef0fecSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11806ef0fecSmrg  m4_default([$2], [:])
11906ef0fecSmrgm4_ifvaln([$3], [else
12006ef0fecSmrg  $3])dnl
12106ef0fecSmrgfi])
122b3307321Smrg
12306ef0fecSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12406ef0fecSmrgdnl ---------------------------------------------
12506ef0fecSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12606ef0fecSmrgdnl pkg_failed based on the result.
12706ef0fecSmrgm4_define([_PKG_CONFIG],
12806ef0fecSmrg[if test -n "$$1"; then
12906ef0fecSmrg    pkg_cv_[]$1="$$1"
13006ef0fecSmrg elif test -n "$PKG_CONFIG"; then
13106ef0fecSmrg    PKG_CHECK_EXISTS([$3],
13206ef0fecSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13306ef0fecSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
13406ef0fecSmrg		     [pkg_failed=yes])
13506ef0fecSmrg else
13606ef0fecSmrg    pkg_failed=untried
13706ef0fecSmrgfi[]dnl
13806ef0fecSmrg])dnl _PKG_CONFIG
139b3307321Smrg
14006ef0fecSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14106ef0fecSmrgdnl ---------------------------
14206ef0fecSmrgdnl Internal check to see if pkg-config supports short errors.
14306ef0fecSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14406ef0fecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14506ef0fecSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14606ef0fecSmrg        _pkg_short_errors_supported=yes
14706ef0fecSmrgelse
14806ef0fecSmrg        _pkg_short_errors_supported=no
14906ef0fecSmrgfi[]dnl
15006ef0fecSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151b3307321Smrg
152b3307321Smrg
15306ef0fecSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15406ef0fecSmrgdnl   [ACTION-IF-NOT-FOUND])
15506ef0fecSmrgdnl --------------------------------------------------------------
15606ef0fecSmrgdnl Since: 0.4.0
15706ef0fecSmrgdnl
15806ef0fecSmrgdnl Note that if there is a possibility the first call to
15906ef0fecSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16006ef0fecSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16106ef0fecSmrgAC_DEFUN([PKG_CHECK_MODULES],
16206ef0fecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16306ef0fecSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16406ef0fecSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165b3307321Smrg
16606ef0fecSmrgpkg_failed=no
16706ef0fecSmrgAC_MSG_CHECKING([for $1])
168b3307321Smrg
16906ef0fecSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17006ef0fecSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171b3307321Smrg
17206ef0fecSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17306ef0fecSmrgand $1[]_LIBS to avoid the need to call pkg-config.
17406ef0fecSmrgSee the pkg-config man page for more details.])
175b3307321Smrg
17606ef0fecSmrgif test $pkg_failed = yes; then
17706ef0fecSmrg   	AC_MSG_RESULT([no])
17806ef0fecSmrg        _PKG_SHORT_ERRORS_SUPPORTED
17906ef0fecSmrg        if test $_pkg_short_errors_supported = yes; then
18006ef0fecSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18106ef0fecSmrg        else 
18206ef0fecSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18306ef0fecSmrg        fi
18406ef0fecSmrg	# Put the nasty error message in config.log where it belongs
18506ef0fecSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186b3307321Smrg
18706ef0fecSmrg	m4_default([$4], [AC_MSG_ERROR(
18806ef0fecSmrg[Package requirements ($2) were not met:
189b3307321Smrg
19006ef0fecSmrg$$1_PKG_ERRORS
191b3307321Smrg
19206ef0fecSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19306ef0fecSmrginstalled software in a non-standard prefix.
194b3307321Smrg
19506ef0fecSmrg_PKG_TEXT])[]dnl
19606ef0fecSmrg        ])
19706ef0fecSmrgelif test $pkg_failed = untried; then
19806ef0fecSmrg     	AC_MSG_RESULT([no])
19906ef0fecSmrg	m4_default([$4], [AC_MSG_FAILURE(
20006ef0fecSmrg[The pkg-config script could not be found or is too old.  Make sure it
20106ef0fecSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
20206ef0fecSmrgpath to pkg-config.
203b3307321Smrg
20406ef0fecSmrg_PKG_TEXT
205b3307321Smrg
20606ef0fecSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20706ef0fecSmrg        ])
20806ef0fecSmrgelse
20906ef0fecSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21006ef0fecSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21106ef0fecSmrg        AC_MSG_RESULT([yes])
21206ef0fecSmrg	$3
21306ef0fecSmrgfi[]dnl
21406ef0fecSmrg])dnl PKG_CHECK_MODULES
215b3307321Smrg
2165e358ecaSmrg
21706ef0fecSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21806ef0fecSmrgdnl   [ACTION-IF-NOT-FOUND])
21906ef0fecSmrgdnl ---------------------------------------------------------------------
22006ef0fecSmrgdnl Since: 0.29
22106ef0fecSmrgdnl
22206ef0fecSmrgdnl Checks for existence of MODULES and gathers its build flags with
22306ef0fecSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22406ef0fecSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22506ef0fecSmrgdnl
22606ef0fecSmrgdnl Note that if there is a possibility the first call to
22706ef0fecSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22806ef0fecSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22906ef0fecSmrgdnl configure.ac.
23006ef0fecSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23106ef0fecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23206ef0fecSmrg_save_PKG_CONFIG=$PKG_CONFIG
23306ef0fecSmrgPKG_CONFIG="$PKG_CONFIG --static"
23406ef0fecSmrgPKG_CHECK_MODULES($@)
23506ef0fecSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23606ef0fecSmrg])dnl PKG_CHECK_MODULES_STATIC
2375e358ecaSmrg
2385e358ecaSmrg
23906ef0fecSmrgdnl PKG_INSTALLDIR([DIRECTORY])
24006ef0fecSmrgdnl -------------------------
24106ef0fecSmrgdnl Since: 0.27
24206ef0fecSmrgdnl
24306ef0fecSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
24406ef0fecSmrgdnl should install pkg-config .pc files. By default the directory is
24506ef0fecSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
24606ef0fecSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24706ef0fecSmrgdnl parameter.
24806ef0fecSmrgAC_DEFUN([PKG_INSTALLDIR],
24906ef0fecSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25006ef0fecSmrgm4_pushdef([pkg_description],
25106ef0fecSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25206ef0fecSmrgAC_ARG_WITH([pkgconfigdir],
25306ef0fecSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25406ef0fecSmrg    [with_pkgconfigdir=]pkg_default)
25506ef0fecSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25606ef0fecSmrgm4_popdef([pkg_default])
25706ef0fecSmrgm4_popdef([pkg_description])
25806ef0fecSmrg])dnl PKG_INSTALLDIR
25906ef0fecSmrg
26006ef0fecSmrg
26106ef0fecSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26206ef0fecSmrgdnl --------------------------------
26306ef0fecSmrgdnl Since: 0.27
26406ef0fecSmrgdnl
26506ef0fecSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26606ef0fecSmrgdnl module should install arch-independent pkg-config .pc files. By
26706ef0fecSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
26806ef0fecSmrgdnl changed by passing DIRECTORY. The user can override through the
26906ef0fecSmrgdnl --with-noarch-pkgconfigdir parameter.
27006ef0fecSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27106ef0fecSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27206ef0fecSmrgm4_pushdef([pkg_description],
27306ef0fecSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27406ef0fecSmrgAC_ARG_WITH([noarch-pkgconfigdir],
27506ef0fecSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27606ef0fecSmrg    [with_noarch_pkgconfigdir=]pkg_default)
27706ef0fecSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27806ef0fecSmrgm4_popdef([pkg_default])
27906ef0fecSmrgm4_popdef([pkg_description])
28006ef0fecSmrg])dnl PKG_NOARCH_INSTALLDIR
28106ef0fecSmrg
28206ef0fecSmrg
28306ef0fecSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28406ef0fecSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28506ef0fecSmrgdnl -------------------------------------------
28606ef0fecSmrgdnl Since: 0.28
28706ef0fecSmrgdnl
28806ef0fecSmrgdnl Retrieves the value of the pkg-config variable for the given module.
28906ef0fecSmrgAC_DEFUN([PKG_CHECK_VAR],
29006ef0fecSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29106ef0fecSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2925e358ecaSmrg
29306ef0fecSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29406ef0fecSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29506ef0fecSmrg
29606ef0fecSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29706ef0fecSmrg])dnl PKG_CHECK_VAR
29806ef0fecSmrg
29906ef0fecSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
30006ef0fecSmrgdnl
30106ef0fecSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
30206ef0fecSmrgdnl
30306ef0fecSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
30406ef0fecSmrgdnl copy of this software and associated documentation files (the "Software"),
30506ef0fecSmrgdnl to deal in the Software without restriction, including without limitation
30606ef0fecSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
30706ef0fecSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
30806ef0fecSmrgdnl Software is furnished to do so, subject to the following conditions:
30906ef0fecSmrgdnl
31006ef0fecSmrgdnl The above copyright notice and this permission notice (including the next
31106ef0fecSmrgdnl paragraph) shall be included in all copies or substantial portions of the
31206ef0fecSmrgdnl Software.
31306ef0fecSmrgdnl
31406ef0fecSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31506ef0fecSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31606ef0fecSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31706ef0fecSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31806ef0fecSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31906ef0fecSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32006ef0fecSmrgdnl DEALINGS IN THE SOFTWARE.
32106ef0fecSmrg
32206ef0fecSmrg# XORG_MACROS_VERSION(required-version)
32306ef0fecSmrg# -------------------------------------
32406ef0fecSmrg# Minimum version: 1.1.0
32506ef0fecSmrg#
32606ef0fecSmrg# If you're using a macro added in Version 1.1 or newer, include this in
32706ef0fecSmrg# your configure.ac with the minimum required version, such as:
32806ef0fecSmrg# XORG_MACROS_VERSION(1.1)
32906ef0fecSmrg#
33006ef0fecSmrg# To ensure that this macro is defined, also add:
33106ef0fecSmrg# m4_ifndef([XORG_MACROS_VERSION],
33206ef0fecSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
33306ef0fecSmrg#
33406ef0fecSmrg#
33506ef0fecSmrg# See the "minimum version" comment for each macro you use to see what
33606ef0fecSmrg# version you require.
33706ef0fecSmrgm4_defun([XORG_MACROS_VERSION],[
33806ef0fecSmrgm4_define([vers_have], [1.19.0])
33906ef0fecSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
34006ef0fecSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
34106ef0fecSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
34206ef0fecSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
34306ef0fecSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
34406ef0fecSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
34506ef0fecSmrgm4_undefine([vers_have])
34606ef0fecSmrgm4_undefine([maj_have])
34706ef0fecSmrgm4_undefine([maj_needed])
34806ef0fecSmrg]) # XORG_MACROS_VERSION
34906ef0fecSmrg
35006ef0fecSmrg# XORG_PROG_RAWCPP()
35106ef0fecSmrg# ------------------
35206ef0fecSmrg# Minimum version: 1.0.0
35306ef0fecSmrg#
35406ef0fecSmrg# Find cpp program and necessary flags for use in pre-processing text files
35506ef0fecSmrg# such as man pages and config files
35606ef0fecSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
35706ef0fecSmrgAC_REQUIRE([AC_PROG_CPP])
35806ef0fecSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
35906ef0fecSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
36006ef0fecSmrg
36106ef0fecSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
36206ef0fecSmrg# which is not the best choice for supporting other OS'es, but covers most
36306ef0fecSmrg# of the ones we need for now.
36406ef0fecSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
36506ef0fecSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
36606ef0fecSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
36706ef0fecSmrg	AC_MSG_RESULT([no])
368afe13c8eSmrgelse
36906ef0fecSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37006ef0fecSmrg		RAWCPPFLAGS=-undef
37106ef0fecSmrg		AC_MSG_RESULT([yes])
37206ef0fecSmrg	# under Cygwin unix is still defined even with -undef
37306ef0fecSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
37406ef0fecSmrg		RAWCPPFLAGS="-undef -ansi"
37506ef0fecSmrg		AC_MSG_RESULT([yes, with -ansi])
37606ef0fecSmrg	else
37706ef0fecSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
37806ef0fecSmrg	fi
379afe13c8eSmrgfi
38006ef0fecSmrgrm -f conftest.$ac_ext
381b3307321Smrg
38206ef0fecSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
38306ef0fecSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
38406ef0fecSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38506ef0fecSmrg	AC_MSG_RESULT([no])
38606ef0fecSmrgelse
38706ef0fecSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38806ef0fecSmrg		TRADITIONALCPPFLAGS="-traditional"
38906ef0fecSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
39006ef0fecSmrg		AC_MSG_RESULT([yes])
39106ef0fecSmrg	else
39206ef0fecSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
39306ef0fecSmrg	fi
39406ef0fecSmrgfi
39506ef0fecSmrgrm -f conftest.$ac_ext
39606ef0fecSmrgAC_SUBST(RAWCPPFLAGS)
39706ef0fecSmrgAC_SUBST(TRADITIONALCPPFLAGS)
39806ef0fecSmrg]) # XORG_PROG_RAWCPP
3995e358ecaSmrg
40006ef0fecSmrg# XORG_MANPAGE_SECTIONS()
40106ef0fecSmrg# -----------------------
40206ef0fecSmrg# Minimum version: 1.0.0
40306ef0fecSmrg#
40406ef0fecSmrg# Determine which sections man pages go in for the different man page types
40506ef0fecSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
40606ef0fecSmrg# Not sure if there's any better way than just hardcoding by OS name.
40706ef0fecSmrg# Override default settings by setting environment variables
40806ef0fecSmrg# Added MAN_SUBSTS in version 1.8
40906ef0fecSmrg# Added AC_PROG_SED in version 1.8
4105e358ecaSmrg
41106ef0fecSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
41206ef0fecSmrgAC_REQUIRE([AC_CANONICAL_HOST])
41306ef0fecSmrgAC_REQUIRE([AC_PROG_SED])
4145e358ecaSmrg
41506ef0fecSmrgif test x$APP_MAN_SUFFIX = x    ; then
41606ef0fecSmrg    APP_MAN_SUFFIX=1
41706ef0fecSmrgfi
41806ef0fecSmrgif test x$APP_MAN_DIR = x    ; then
41906ef0fecSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420afe13c8eSmrgfi
421b3307321Smrg
42206ef0fecSmrgif test x$LIB_MAN_SUFFIX = x    ; then
42306ef0fecSmrg    LIB_MAN_SUFFIX=3
42406ef0fecSmrgfi
42506ef0fecSmrgif test x$LIB_MAN_DIR = x    ; then
42606ef0fecSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
42706ef0fecSmrgfi
4285e358ecaSmrg
42906ef0fecSmrgif test x$FILE_MAN_SUFFIX = x    ; then
43006ef0fecSmrg    case $host_os in
43106ef0fecSmrg	# Solaris 2.0 - 11 use SysV man page sections
43206ef0fecSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
43306ef0fecSmrg	*)				FILE_MAN_SUFFIX=5  ;;
43406ef0fecSmrg    esac
43506ef0fecSmrgfi
43606ef0fecSmrgif test x$FILE_MAN_DIR = x    ; then
43706ef0fecSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
43806ef0fecSmrgfi
439b3307321Smrg
44006ef0fecSmrgif test x$MISC_MAN_SUFFIX = x    ; then
44106ef0fecSmrg    case $host_os in
44206ef0fecSmrg	# Solaris 2.0 - 11 use SysV man page sections
44306ef0fecSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
44406ef0fecSmrg	*)				MISC_MAN_SUFFIX=7  ;;
44506ef0fecSmrg    esac
44606ef0fecSmrgfi
44706ef0fecSmrgif test x$MISC_MAN_DIR = x    ; then
44806ef0fecSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
44906ef0fecSmrgfi
450b3307321Smrg
45106ef0fecSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
45206ef0fecSmrg    case $host_os in
45306ef0fecSmrg	# Solaris 2.0 - 11 use SysV man page sections
45406ef0fecSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
45506ef0fecSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
45606ef0fecSmrg    esac
45706ef0fecSmrgfi
45806ef0fecSmrgif test x$DRIVER_MAN_DIR = x    ; then
45906ef0fecSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
46006ef0fecSmrgfi
46106ef0fecSmrg
46206ef0fecSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
46306ef0fecSmrg    case $host_os in
46406ef0fecSmrg	# Solaris 2.0 - 11 use SysV man page sections
46506ef0fecSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
46606ef0fecSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
46706ef0fecSmrg    esac
46806ef0fecSmrgfi
46906ef0fecSmrgif test x$ADMIN_MAN_DIR = x    ; then
47006ef0fecSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
47106ef0fecSmrgfi
472b3307321Smrg
473b3307321Smrg
47406ef0fecSmrgAC_SUBST([APP_MAN_SUFFIX])
47506ef0fecSmrgAC_SUBST([LIB_MAN_SUFFIX])
47606ef0fecSmrgAC_SUBST([FILE_MAN_SUFFIX])
47706ef0fecSmrgAC_SUBST([MISC_MAN_SUFFIX])
47806ef0fecSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
47906ef0fecSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
48006ef0fecSmrgAC_SUBST([APP_MAN_DIR])
48106ef0fecSmrgAC_SUBST([LIB_MAN_DIR])
48206ef0fecSmrgAC_SUBST([FILE_MAN_DIR])
48306ef0fecSmrgAC_SUBST([MISC_MAN_DIR])
48406ef0fecSmrgAC_SUBST([DRIVER_MAN_DIR])
48506ef0fecSmrgAC_SUBST([ADMIN_MAN_DIR])
48606ef0fecSmrg
48706ef0fecSmrgXORG_MAN_PAGE="X Version 11"
48806ef0fecSmrgAC_SUBST([XORG_MAN_PAGE])
48906ef0fecSmrgMAN_SUBSTS="\
49006ef0fecSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49106ef0fecSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
49206ef0fecSmrg	-e 's|__xservername__|Xorg|g' \
49306ef0fecSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
49406ef0fecSmrg	-e 's|__projectroot__|\$(prefix)|g' \
49506ef0fecSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
49606ef0fecSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
49706ef0fecSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
49806ef0fecSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
49906ef0fecSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
50006ef0fecSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
50106ef0fecSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
50206ef0fecSmrgAC_SUBST([MAN_SUBSTS])
50306ef0fecSmrg
50406ef0fecSmrg]) # XORG_MANPAGE_SECTIONS
50506ef0fecSmrg
50606ef0fecSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
50706ef0fecSmrg# ------------------------
50806ef0fecSmrg# Minimum version: 1.7.0
5095e358ecaSmrg#
51006ef0fecSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
51106ef0fecSmrg# provided by xorg-sgml-doctools, if installed.
51206ef0fecSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
51306ef0fecSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
51406ef0fecSmrgXORG_SGML_PATH=
51506ef0fecSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
51606ef0fecSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
51706ef0fecSmrg    [m4_ifval([$1],[:],
51806ef0fecSmrg        [if test x"$cross_compiling" != x"yes" ; then
51906ef0fecSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
52006ef0fecSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
52106ef0fecSmrg         fi])
52206ef0fecSmrg    ])
523b3307321Smrg
52406ef0fecSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
52506ef0fecSmrg# the path and the name of the doc stylesheet
52606ef0fecSmrgif test "x$XORG_SGML_PATH" != "x" ; then
52706ef0fecSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
52806ef0fecSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
52906ef0fecSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
53006ef0fecSmrgelse
53106ef0fecSmrg   AC_MSG_RESULT([no])
53206ef0fecSmrgfi
5335e358ecaSmrg
53406ef0fecSmrgAC_SUBST(XORG_SGML_PATH)
53506ef0fecSmrgAC_SUBST(STYLESHEET_SRCDIR)
53606ef0fecSmrgAC_SUBST(XSL_STYLESHEET)
53706ef0fecSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
53806ef0fecSmrg]) # XORG_CHECK_SGML_DOCTOOLS
53906ef0fecSmrg
54006ef0fecSmrg# XORG_CHECK_LINUXDOC
54106ef0fecSmrg# -------------------
54206ef0fecSmrg# Minimum version: 1.0.0
5435e358ecaSmrg#
54406ef0fecSmrg# Defines the variable MAKE_TEXT if the necessary tools and
54506ef0fecSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
54606ef0fecSmrg# Whether or not the necessary tools and files are found can be checked
54706ef0fecSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
54806ef0fecSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
54906ef0fecSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
55006ef0fecSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5515e358ecaSmrg
55206ef0fecSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5535e358ecaSmrg
55406ef0fecSmrgAC_MSG_CHECKING([whether to build documentation])
55574a3f230Smrg
55606ef0fecSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
55706ef0fecSmrg   BUILDDOC=yes
55806ef0fecSmrgelse
55906ef0fecSmrg   BUILDDOC=no
560afe13c8eSmrgfi
5615e358ecaSmrg
56206ef0fecSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
56306ef0fecSmrg
56406ef0fecSmrgAC_MSG_RESULT([$BUILDDOC])
56506ef0fecSmrg
56606ef0fecSmrgAC_MSG_CHECKING([whether to build pdf documentation])
56706ef0fecSmrg
56806ef0fecSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
56906ef0fecSmrg   BUILDPDFDOC=yes
57006ef0fecSmrgelse
57106ef0fecSmrg   BUILDPDFDOC=no
572b3307321Smrgfi
573b3307321Smrg
57406ef0fecSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575b3307321Smrg
57606ef0fecSmrgAC_MSG_RESULT([$BUILDPDFDOC])
577b3307321Smrg
57806ef0fecSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
57906ef0fecSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
58006ef0fecSmrgMAKE_PDF="$PS2PDF"
58106ef0fecSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582b3307321Smrg
58306ef0fecSmrgAC_SUBST(MAKE_TEXT)
58406ef0fecSmrgAC_SUBST(MAKE_PS)
58506ef0fecSmrgAC_SUBST(MAKE_PDF)
58606ef0fecSmrgAC_SUBST(MAKE_HTML)
58706ef0fecSmrg]) # XORG_CHECK_LINUXDOC
58874a3f230Smrg
58906ef0fecSmrg# XORG_CHECK_DOCBOOK
59006ef0fecSmrg# -------------------
59106ef0fecSmrg# Minimum version: 1.0.0
59206ef0fecSmrg#
59306ef0fecSmrg# Checks for the ability to build output formats from SGML DocBook source.
59406ef0fecSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
59506ef0fecSmrg# indicates whether the necessary tools and files are found and, if set,
59606ef0fecSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
59706ef0fecSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
59806ef0fecSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
59974a3f230Smrg
60006ef0fecSmrgBUILDTXTDOC=no
60106ef0fecSmrgBUILDPDFDOC=no
60206ef0fecSmrgBUILDPSDOC=no
60306ef0fecSmrgBUILDHTMLDOC=no
60474a3f230Smrg
60506ef0fecSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
60606ef0fecSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
60706ef0fecSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
60806ef0fecSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
60974a3f230Smrg
61006ef0fecSmrgAC_MSG_CHECKING([whether to build text documentation])
61106ef0fecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
61206ef0fecSmrg   test x$BUILD_TXTDOC != xno; then
61306ef0fecSmrg	BUILDTXTDOC=yes
61406ef0fecSmrgfi
61506ef0fecSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
61606ef0fecSmrgAC_MSG_RESULT([$BUILDTXTDOC])
61774a3f230Smrg
61806ef0fecSmrgAC_MSG_CHECKING([whether to build PDF documentation])
61906ef0fecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
62006ef0fecSmrg   test x$BUILD_PDFDOC != xno; then
62106ef0fecSmrg	BUILDPDFDOC=yes
62206ef0fecSmrgfi
62306ef0fecSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
62406ef0fecSmrgAC_MSG_RESULT([$BUILDPDFDOC])
62574a3f230Smrg
62606ef0fecSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
62706ef0fecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
62806ef0fecSmrg   test x$BUILD_PSDOC != xno; then
62906ef0fecSmrg	BUILDPSDOC=yes
63006ef0fecSmrgfi
63106ef0fecSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
63206ef0fecSmrgAC_MSG_RESULT([$BUILDPSDOC])
63374a3f230Smrg
63406ef0fecSmrgAC_MSG_CHECKING([whether to build HTML documentation])
63506ef0fecSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
63606ef0fecSmrg   test x$BUILD_HTMLDOC != xno; then
63706ef0fecSmrg	BUILDHTMLDOC=yes
63806ef0fecSmrgfi
63906ef0fecSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
64006ef0fecSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641b3307321Smrg
64206ef0fecSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
64306ef0fecSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
64406ef0fecSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
64506ef0fecSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6465e358ecaSmrg
64706ef0fecSmrgAC_SUBST(MAKE_TEXT)
64806ef0fecSmrgAC_SUBST(MAKE_PS)
64906ef0fecSmrgAC_SUBST(MAKE_PDF)
65006ef0fecSmrgAC_SUBST(MAKE_HTML)
65106ef0fecSmrg]) # XORG_CHECK_DOCBOOK
6525e358ecaSmrg
65306ef0fecSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
65406ef0fecSmrg# ----------------
65506ef0fecSmrg# Minimum version: 1.5.0
65606ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
6575e358ecaSmrg#
65806ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
65906ef0fecSmrg# not at the appropriate level. This macro enables a module to test for the
66006ef0fecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
66106ef0fecSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
66206ef0fecSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
66306ef0fecSmrg# --with-xmlto assumes 'auto'.
6645e358ecaSmrg#
66506ef0fecSmrg# Interface to module:
66606ef0fecSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
66706ef0fecSmrg# XMLTO:	returns the path of the xmlto program found
66806ef0fecSmrg#		returns the path set by the user in the environment
66906ef0fecSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
67006ef0fecSmrg#		'no' user instructs the module not to use xmlto
67106ef0fecSmrg#
67206ef0fecSmrg# Added in version 1.10.0
67306ef0fecSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
67406ef0fecSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
67506ef0fecSmrg#
67606ef0fecSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
67706ef0fecSmrg#
67806ef0fecSmrgAC_DEFUN([XORG_WITH_XMLTO],[
67906ef0fecSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
68006ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
68106ef0fecSmrgAC_ARG_WITH(xmlto,
68206ef0fecSmrg	AS_HELP_STRING([--with-xmlto],
68306ef0fecSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
68406ef0fecSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
68506ef0fecSmrgm4_undefine([_defopt])
686b3307321Smrg
68706ef0fecSmrgif test "x$use_xmlto" = x"auto"; then
68806ef0fecSmrg   AC_PATH_PROG([XMLTO], [xmlto])
68906ef0fecSmrg   if test "x$XMLTO" = "x"; then
69006ef0fecSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
69106ef0fecSmrg	have_xmlto=no
69206ef0fecSmrg   else
69306ef0fecSmrg        have_xmlto=yes
69406ef0fecSmrg   fi
69506ef0fecSmrgelif test "x$use_xmlto" = x"yes" ; then
69606ef0fecSmrg   AC_PATH_PROG([XMLTO], [xmlto])
69706ef0fecSmrg   if test "x$XMLTO" = "x"; then
69806ef0fecSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
69906ef0fecSmrg   fi
70006ef0fecSmrg   have_xmlto=yes
70106ef0fecSmrgelif test "x$use_xmlto" = x"no" ; then
70206ef0fecSmrg   if test "x$XMLTO" != "x"; then
70306ef0fecSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
70406ef0fecSmrg   fi
70506ef0fecSmrg   have_xmlto=no
706b3307321Smrgelse
70706ef0fecSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
708b3307321Smrgfi
709b3307321Smrg
71006ef0fecSmrg# Test for a minimum version of xmlto, if provided.
71106ef0fecSmrgm4_ifval([$1],
71206ef0fecSmrg[if test "$have_xmlto" = yes; then
71306ef0fecSmrg    # scrape the xmlto version
71406ef0fecSmrg    AC_MSG_CHECKING([the xmlto version])
71506ef0fecSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
71606ef0fecSmrg    AC_MSG_RESULT([$xmlto_version])
71706ef0fecSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
71806ef0fecSmrg        [if test "x$use_xmlto" = xauto; then
71906ef0fecSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
72006ef0fecSmrg            have_xmlto=no
72106ef0fecSmrg        else
72206ef0fecSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
72306ef0fecSmrg        fi])
72406ef0fecSmrgfi])
725b3307321Smrg
72606ef0fecSmrg# Test for the ability of xmlto to generate a text target
7275e358ecaSmrg#
72806ef0fecSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
72906ef0fecSmrg# following test for empty XML docbook files.
73006ef0fecSmrg# For compatibility reasons use the following empty XML docbook file and if
73106ef0fecSmrg# it fails try it again with a non-empty XML file.
73206ef0fecSmrghave_xmlto_text=no
73306ef0fecSmrgcat > conftest.xml << "EOF"
73406ef0fecSmrgEOF
73506ef0fecSmrgAS_IF([test "$have_xmlto" = yes],
73606ef0fecSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
73706ef0fecSmrg             [have_xmlto_text=yes],
73806ef0fecSmrg             [# Try it again with a non-empty XML file.
73906ef0fecSmrg              cat > conftest.xml << "EOF"
74006ef0fecSmrg<x></x>
74106ef0fecSmrgEOF
74206ef0fecSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
74306ef0fecSmrg                    [have_xmlto_text=yes],
74406ef0fecSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
74506ef0fecSmrgrm -f conftest.xml
74606ef0fecSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
74706ef0fecSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
74806ef0fecSmrg]) # XORG_WITH_XMLTO
749afe13c8eSmrg
75006ef0fecSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
75106ef0fecSmrg# --------------------------------------------
75206ef0fecSmrg# Minimum version: 1.12.0
75306ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.12.0
7545e358ecaSmrg#
75506ef0fecSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
75606ef0fecSmrg# XML-based language used for the transformation of XML documents.
75706ef0fecSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
75806ef0fecSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
75906ef0fecSmrg# The XSLT processor is often used as a standalone tool for transformations.
76006ef0fecSmrg# It should not be assumed that this tool is used only to work with documnetation.
76106ef0fecSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7625e358ecaSmrg#
76306ef0fecSmrg# Interface to module:
76406ef0fecSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
76506ef0fecSmrg# XSLTPROC:	 returns the path of the xsltproc program found
76606ef0fecSmrg#		 returns the path set by the user in the environment
76706ef0fecSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
76806ef0fecSmrg#		  'no' user instructs the module not to use xsltproc
76906ef0fecSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
77006ef0fecSmrg#
77106ef0fecSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
77206ef0fecSmrg#
77306ef0fecSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
77406ef0fecSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
77506ef0fecSmrg# Preserves the interface, should it be implemented later
77606ef0fecSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
77706ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
77806ef0fecSmrgAC_ARG_WITH(xsltproc,
77906ef0fecSmrg	AS_HELP_STRING([--with-xsltproc],
78006ef0fecSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
78106ef0fecSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
78206ef0fecSmrgm4_undefine([_defopt])
783b3307321Smrg
78406ef0fecSmrgif test "x$use_xsltproc" = x"auto"; then
78506ef0fecSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
78606ef0fecSmrg   if test "x$XSLTPROC" = "x"; then
78706ef0fecSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
78806ef0fecSmrg	have_xsltproc=no
78906ef0fecSmrg   else
79006ef0fecSmrg        have_xsltproc=yes
79106ef0fecSmrg   fi
79206ef0fecSmrgelif test "x$use_xsltproc" = x"yes" ; then
79306ef0fecSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
79406ef0fecSmrg   if test "x$XSLTPROC" = "x"; then
79506ef0fecSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
79606ef0fecSmrg   fi
79706ef0fecSmrg   have_xsltproc=yes
79806ef0fecSmrgelif test "x$use_xsltproc" = x"no" ; then
79906ef0fecSmrg   if test "x$XSLTPROC" != "x"; then
80006ef0fecSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
80106ef0fecSmrg   fi
80206ef0fecSmrg   have_xsltproc=no
803afe13c8eSmrgelse
80406ef0fecSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805afe13c8eSmrgfi
806b3307321Smrg
80706ef0fecSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
80806ef0fecSmrg]) # XORG_WITH_XSLTPROC
809b3307321Smrg
81006ef0fecSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
81106ef0fecSmrg# ----------------------------------------
81206ef0fecSmrg# Minimum version: 1.15.0
813afe13c8eSmrg#
81406ef0fecSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
81506ef0fecSmrg# scanning arbitrary text files, extracting information from those text files,
81606ef0fecSmrg# and printing reports based on that information.
81774a3f230Smrg#
81806ef0fecSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
81906ef0fecSmrg#
82006ef0fecSmrg# Interface to module:
82106ef0fecSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
82206ef0fecSmrg# PERL:	     returns the path of the perl program found
82306ef0fecSmrg#	     returns the path set by the user in the environment
82406ef0fecSmrg# --with-perl: 'yes' user instructs the module to use perl
82506ef0fecSmrg#	       'no' user instructs the module not to use perl
82606ef0fecSmrg# have_perl: returns yes if perl found in PATH or no
82706ef0fecSmrg#
82806ef0fecSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
82906ef0fecSmrg#
83006ef0fecSmrgAC_DEFUN([XORG_WITH_PERL],[
83106ef0fecSmrgAC_ARG_VAR([PERL], [Path to perl command])
83206ef0fecSmrg# Preserves the interface, should it be implemented later
83306ef0fecSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
83406ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
83506ef0fecSmrgAC_ARG_WITH(perl,
83606ef0fecSmrg	AS_HELP_STRING([--with-perl],
83706ef0fecSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
83806ef0fecSmrg	   [use_perl=$withval], [use_perl=]_defopt)
83906ef0fecSmrgm4_undefine([_defopt])
8405e358ecaSmrg
84106ef0fecSmrgif test "x$use_perl" = x"auto"; then
84206ef0fecSmrg   AC_PATH_PROG([PERL], [perl])
84306ef0fecSmrg   if test "x$PERL" = "x"; then
84406ef0fecSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
84506ef0fecSmrg	have_perl=no
84606ef0fecSmrg   else
84706ef0fecSmrg        have_perl=yes
84806ef0fecSmrg   fi
84906ef0fecSmrgelif test "x$use_perl" = x"yes" ; then
85006ef0fecSmrg   AC_PATH_PROG([PERL], [perl])
85106ef0fecSmrg   if test "x$PERL" = "x"; then
85206ef0fecSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
85306ef0fecSmrg   fi
85406ef0fecSmrg   have_perl=yes
85506ef0fecSmrgelif test "x$use_perl" = x"no" ; then
85606ef0fecSmrg   if test "x$PERL" != "x"; then
85706ef0fecSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
85806ef0fecSmrg   fi
85906ef0fecSmrg   have_perl=no
86006ef0fecSmrgelse
86106ef0fecSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
86274a3f230Smrgfi
86374a3f230Smrg
86406ef0fecSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
86506ef0fecSmrg]) # XORG_WITH_PERL
86674a3f230Smrg
86706ef0fecSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
86806ef0fecSmrg# ----------------
86906ef0fecSmrg# Minimum version: 1.5.0
87006ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
871afe13c8eSmrg#
87206ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
87306ef0fecSmrg# not at the appropriate level. This macro enables a module to test for the
87406ef0fecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
87506ef0fecSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
87606ef0fecSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
87706ef0fecSmrg# --with-asciidoc assumes 'auto'.
87874a3f230Smrg#
87906ef0fecSmrg# Interface to module:
88006ef0fecSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
88106ef0fecSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
88206ef0fecSmrg#		 returns the path set by the user in the environment
88306ef0fecSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
88406ef0fecSmrg#		  'no' user instructs the module not to use asciidoc
88506ef0fecSmrg#
88606ef0fecSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
88706ef0fecSmrg#
88806ef0fecSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
88906ef0fecSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
89006ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
89106ef0fecSmrgAC_ARG_WITH(asciidoc,
89206ef0fecSmrg	AS_HELP_STRING([--with-asciidoc],
89306ef0fecSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
89406ef0fecSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
89506ef0fecSmrgm4_undefine([_defopt])
89674a3f230Smrg
89706ef0fecSmrgif test "x$use_asciidoc" = x"auto"; then
89806ef0fecSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
89906ef0fecSmrg   if test "x$ASCIIDOC" = "x"; then
90006ef0fecSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
90106ef0fecSmrg	have_asciidoc=no
90206ef0fecSmrg   else
90306ef0fecSmrg        have_asciidoc=yes
90406ef0fecSmrg   fi
90506ef0fecSmrgelif test "x$use_asciidoc" = x"yes" ; then
90606ef0fecSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
90706ef0fecSmrg   if test "x$ASCIIDOC" = "x"; then
90806ef0fecSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
90906ef0fecSmrg   fi
91006ef0fecSmrg   have_asciidoc=yes
91106ef0fecSmrgelif test "x$use_asciidoc" = x"no" ; then
91206ef0fecSmrg   if test "x$ASCIIDOC" != "x"; then
91306ef0fecSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
91406ef0fecSmrg   fi
91506ef0fecSmrg   have_asciidoc=no
9165e358ecaSmrgelse
91706ef0fecSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
91874a3f230Smrgfi
91906ef0fecSmrgm4_ifval([$1],
92006ef0fecSmrg[if test "$have_asciidoc" = yes; then
92106ef0fecSmrg    # scrape the asciidoc version
92206ef0fecSmrg    AC_MSG_CHECKING([the asciidoc version])
92306ef0fecSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
92406ef0fecSmrg    AC_MSG_RESULT([$asciidoc_version])
92506ef0fecSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
92606ef0fecSmrg        [if test "x$use_asciidoc" = xauto; then
92706ef0fecSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
92806ef0fecSmrg            have_asciidoc=no
92906ef0fecSmrg        else
93006ef0fecSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
93106ef0fecSmrg        fi])
93206ef0fecSmrgfi])
93306ef0fecSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
93406ef0fecSmrg]) # XORG_WITH_ASCIIDOC
9355e358ecaSmrg
93606ef0fecSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
93706ef0fecSmrg# -------------------------------------------
93806ef0fecSmrg# Minimum version: 1.5.0
93906ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
94006ef0fecSmrg# Minimum version for optional DOT checking: 1.18.0
941afe13c8eSmrg#
94206ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
94306ef0fecSmrg# not at the appropriate level. This macro enables a module to test for the
94406ef0fecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
94506ef0fecSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
94606ef0fecSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
94706ef0fecSmrg# --with-doxygen assumes 'auto'.
94806ef0fecSmrg#
94906ef0fecSmrg# Interface to module:
95006ef0fecSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
95106ef0fecSmrg# DOXYGEN:	 returns the path of the doxygen program found
95206ef0fecSmrg#		 returns the path set by the user in the environment
95306ef0fecSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
95406ef0fecSmrg#		  'no' user instructs the module not to use doxygen
95506ef0fecSmrg#
95606ef0fecSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
95706ef0fecSmrg#
95806ef0fecSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
95906ef0fecSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
96006ef0fecSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
96106ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
96206ef0fecSmrgAC_ARG_WITH(doxygen,
96306ef0fecSmrg	AS_HELP_STRING([--with-doxygen],
96406ef0fecSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
96506ef0fecSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
96606ef0fecSmrgm4_undefine([_defopt])
967b3307321Smrg
96806ef0fecSmrgif test "x$use_doxygen" = x"auto"; then
96906ef0fecSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97006ef0fecSmrg   if test "x$DOXYGEN" = "x"; then
97106ef0fecSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
97206ef0fecSmrg	have_doxygen=no
97306ef0fecSmrg   else
97406ef0fecSmrg        have_doxygen=yes
97506ef0fecSmrg   fi
97606ef0fecSmrgelif test "x$use_doxygen" = x"yes" ; then
97706ef0fecSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
97806ef0fecSmrg   if test "x$DOXYGEN" = "x"; then
97906ef0fecSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
98006ef0fecSmrg   fi
98106ef0fecSmrg   have_doxygen=yes
98206ef0fecSmrgelif test "x$use_doxygen" = x"no" ; then
98306ef0fecSmrg   if test "x$DOXYGEN" != "x"; then
98406ef0fecSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
98506ef0fecSmrg   fi
98606ef0fecSmrg   have_doxygen=no
98774a3f230Smrgelse
98806ef0fecSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
98906ef0fecSmrgfi
99006ef0fecSmrgm4_ifval([$1],
99106ef0fecSmrg[if test "$have_doxygen" = yes; then
99206ef0fecSmrg    # scrape the doxygen version
99306ef0fecSmrg    AC_MSG_CHECKING([the doxygen version])
99406ef0fecSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
99506ef0fecSmrg    AC_MSG_RESULT([$doxygen_version])
99606ef0fecSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
99706ef0fecSmrg        [if test "x$use_doxygen" = xauto; then
99806ef0fecSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
99906ef0fecSmrg            have_doxygen=no
100006ef0fecSmrg        else
100106ef0fecSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
100206ef0fecSmrg        fi])
100374a3f230Smrgfi])
100406ef0fecSmrg
100506ef0fecSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
100606ef0fecSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
100706ef0fecSmrgdnl 	HAVE_DOT = @HAVE_DOT@
100806ef0fecSmrgHAVE_DOT=no
100906ef0fecSmrgif test "x$have_doxygen" = "xyes"; then
101006ef0fecSmrg  AC_PATH_PROG([DOT], [dot])
101106ef0fecSmrg    if test "x$DOT" != "x"; then
101206ef0fecSmrg      HAVE_DOT=yes
101306ef0fecSmrg    fi
101474a3f230Smrgfi
1015afe13c8eSmrg
101606ef0fecSmrgAC_SUBST([HAVE_DOT])
101706ef0fecSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
101806ef0fecSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
101906ef0fecSmrg]) # XORG_WITH_DOXYGEN
102006ef0fecSmrg
102106ef0fecSmrg# XORG_WITH_GROFF([DEFAULT])
102206ef0fecSmrg# ----------------
102306ef0fecSmrg# Minimum version: 1.6.0
102406ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10255e358ecaSmrg#
102606ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
102706ef0fecSmrg# not at the appropriate level. This macro enables a module to test for the
102806ef0fecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
102906ef0fecSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
103006ef0fecSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
103106ef0fecSmrg# --with-groff assumes 'auto'.
103206ef0fecSmrg#
103306ef0fecSmrg# Interface to module:
103406ef0fecSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
103506ef0fecSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
103606ef0fecSmrg# HAVE_GROFF_MS: the -ms macros package
103706ef0fecSmrg# GROFF:	 returns the path of the groff program found
103806ef0fecSmrg#		 returns the path set by the user in the environment
103906ef0fecSmrg# --with-groff:	 'yes' user instructs the module to use groff
104006ef0fecSmrg#		 'no' user instructs the module not to use groff
104106ef0fecSmrg#
104206ef0fecSmrg# Added in version 1.9.0:
104306ef0fecSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
104406ef0fecSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
104506ef0fecSmrg#		   psselect from the psutils package.
104606ef0fecSmrg#		   the ghostcript package. Refer to the grohtml man pages
104706ef0fecSmrg#
104806ef0fecSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
104906ef0fecSmrg#
105006ef0fecSmrg# OS and distros often splits groff in a basic and full package, the former
105106ef0fecSmrg# having the groff program and the later having devices, fonts and macros
105206ef0fecSmrg# Checking for the groff executable is not enough.
105306ef0fecSmrg#
105406ef0fecSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
105506ef0fecSmrg# unset HAVE_GROFF or GROFF env variables.
105606ef0fecSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
105706ef0fecSmrg#
105806ef0fecSmrgAC_DEFUN([XORG_WITH_GROFF],[
105906ef0fecSmrgAC_ARG_VAR([GROFF], [Path to groff command])
106006ef0fecSmrgm4_define([_defopt], m4_default([$1], [auto]))
106106ef0fecSmrgAC_ARG_WITH(groff,
106206ef0fecSmrg	AS_HELP_STRING([--with-groff],
106306ef0fecSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
106406ef0fecSmrg	   [use_groff=$withval], [use_groff=]_defopt)
106506ef0fecSmrgm4_undefine([_defopt])
10665e358ecaSmrg
106706ef0fecSmrgif test "x$use_groff" = x"auto"; then
106806ef0fecSmrg   AC_PATH_PROG([GROFF], [groff])
106906ef0fecSmrg   if test "x$GROFF" = "x"; then
107006ef0fecSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
107106ef0fecSmrg	have_groff=no
107206ef0fecSmrg   else
107306ef0fecSmrg        have_groff=yes
107406ef0fecSmrg   fi
107506ef0fecSmrgelif test "x$use_groff" = x"yes" ; then
107606ef0fecSmrg   AC_PATH_PROG([GROFF], [groff])
107706ef0fecSmrg   if test "x$GROFF" = "x"; then
107806ef0fecSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
107906ef0fecSmrg   fi
108006ef0fecSmrg   have_groff=yes
108106ef0fecSmrgelif test "x$use_groff" = x"no" ; then
108206ef0fecSmrg   if test "x$GROFF" != "x"; then
108306ef0fecSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
108406ef0fecSmrg   fi
108506ef0fecSmrg   have_groff=no
108606ef0fecSmrgelse
108706ef0fecSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10885e358ecaSmrgfi
1089afe13c8eSmrg
109006ef0fecSmrg# We have groff, test for the presence of the macro packages
109106ef0fecSmrgif test "x$have_groff" = x"yes"; then
109206ef0fecSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
109306ef0fecSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
109406ef0fecSmrg        groff_ms_works=yes
109506ef0fecSmrg    else
109606ef0fecSmrg        groff_ms_works=no
109706ef0fecSmrg    fi
109806ef0fecSmrg    AC_MSG_RESULT([$groff_ms_works])
109906ef0fecSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
110006ef0fecSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
110106ef0fecSmrg        groff_mm_works=yes
110206ef0fecSmrg    else
110306ef0fecSmrg        groff_mm_works=no
110406ef0fecSmrg    fi
110506ef0fecSmrg    AC_MSG_RESULT([$groff_mm_works])
110606ef0fecSmrgfi
1107afe13c8eSmrg
110806ef0fecSmrg# We have groff, test for HTML dependencies, one command per package
110906ef0fecSmrgif test "x$have_groff" = x"yes"; then
111006ef0fecSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
111106ef0fecSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
111206ef0fecSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
111306ef0fecSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
111406ef0fecSmrg      have_groff_html=yes
111506ef0fecSmrg   else
111606ef0fecSmrg      have_groff_html=no
111706ef0fecSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
111806ef0fecSmrg   fi
111906ef0fecSmrgfi
11205e358ecaSmrg
112106ef0fecSmrg# Set Automake conditionals for Makefiles
112206ef0fecSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
112306ef0fecSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
112406ef0fecSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
112506ef0fecSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
112606ef0fecSmrg]) # XORG_WITH_GROFF
11275e358ecaSmrg
112806ef0fecSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
112906ef0fecSmrg# ---------------------------------------
113006ef0fecSmrg# Minimum version: 1.6.0
113106ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
113206ef0fecSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1133afe13c8eSmrg#
113406ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
113506ef0fecSmrg# not at the appropriate level. This macro enables a module to test for the
113606ef0fecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
113706ef0fecSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
113806ef0fecSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
113906ef0fecSmrg# --with-fop assumes 'auto'.
1140b3307321Smrg#
114106ef0fecSmrg# Interface to module:
114206ef0fecSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
114306ef0fecSmrg# FOP:	 	returns the path of the fop program found
114406ef0fecSmrg#		returns the path set by the user in the environment
114506ef0fecSmrg# --with-fop: 	'yes' user instructs the module to use fop
114606ef0fecSmrg#		'no' user instructs the module not to use fop
11475e358ecaSmrg#
114806ef0fecSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
114974a3f230Smrg#
115006ef0fecSmrgAC_DEFUN([XORG_WITH_FOP],[
115106ef0fecSmrgAC_ARG_VAR([FOP], [Path to fop command])
115206ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
115306ef0fecSmrgAC_ARG_WITH(fop,
115406ef0fecSmrg	AS_HELP_STRING([--with-fop],
115506ef0fecSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
115606ef0fecSmrg	   [use_fop=$withval], [use_fop=]_defopt)
115706ef0fecSmrgm4_undefine([_defopt])
115874a3f230Smrg
115906ef0fecSmrgif test "x$use_fop" = x"auto"; then
116006ef0fecSmrg   AC_PATH_PROG([FOP], [fop])
116106ef0fecSmrg   if test "x$FOP" = "x"; then
116206ef0fecSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
116306ef0fecSmrg	have_fop=no
116406ef0fecSmrg   else
116506ef0fecSmrg        have_fop=yes
116606ef0fecSmrg   fi
116706ef0fecSmrgelif test "x$use_fop" = x"yes" ; then
116806ef0fecSmrg   AC_PATH_PROG([FOP], [fop])
116906ef0fecSmrg   if test "x$FOP" = "x"; then
117006ef0fecSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
117106ef0fecSmrg   fi
117206ef0fecSmrg   have_fop=yes
117306ef0fecSmrgelif test "x$use_fop" = x"no" ; then
117406ef0fecSmrg   if test "x$FOP" != "x"; then
117506ef0fecSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
117606ef0fecSmrg   fi
117706ef0fecSmrg   have_fop=no
117806ef0fecSmrgelse
117906ef0fecSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
118006ef0fecSmrgfi
1181b3307321Smrg
118206ef0fecSmrg# Test for a minimum version of fop, if provided.
118306ef0fecSmrgm4_ifval([$1],
118406ef0fecSmrg[if test "$have_fop" = yes; then
118506ef0fecSmrg    # scrape the fop version
118606ef0fecSmrg    AC_MSG_CHECKING([for fop minimum version])
118706ef0fecSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
118806ef0fecSmrg    AC_MSG_RESULT([$fop_version])
118906ef0fecSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
119006ef0fecSmrg        [if test "x$use_fop" = xauto; then
119106ef0fecSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
119206ef0fecSmrg            have_fop=no
119306ef0fecSmrg        else
119406ef0fecSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
119506ef0fecSmrg        fi])
119606ef0fecSmrgfi])
119706ef0fecSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
119806ef0fecSmrg]) # XORG_WITH_FOP
119974a3f230Smrg
120006ef0fecSmrg# XORG_WITH_M4([MIN-VERSION])
120106ef0fecSmrg# ---------------------------
120206ef0fecSmrg# Minimum version: 1.19.0
120306ef0fecSmrg#
120406ef0fecSmrg# This macro attempts to locate an m4 macro processor which supports
120506ef0fecSmrg# -I option and is only useful for modules relying on M4 in order to
120606ef0fecSmrg# expand macros in source code files.
120706ef0fecSmrg#
120806ef0fecSmrg# Interface to module:
120906ef0fecSmrg# M4:	 	returns the path of the m4 program found
121006ef0fecSmrg#		returns the path set by the user in the environment
121106ef0fecSmrg#
121206ef0fecSmrgAC_DEFUN([XORG_WITH_M4], [
121306ef0fecSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
121406ef0fecSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
121506ef0fecSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
121606ef0fecSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
121706ef0fecSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
121806ef0fecSmrg   [$PATH:/usr/gnu/bin])])
121974a3f230Smrg
122006ef0fecSmrgAC_SUBST([M4], [$ac_cv_path_M4])
122106ef0fecSmrg]) # XORG_WITH_M4
1222b3307321Smrg
122306ef0fecSmrg# XORG_WITH_PS2PDF([DEFAULT])
122406ef0fecSmrg# ----------------
122506ef0fecSmrg# Minimum version: 1.6.0
122606ef0fecSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1227320e696bSmrg#
122806ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
122906ef0fecSmrg# not at the appropriate level. This macro enables a module to test for the
123006ef0fecSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
123106ef0fecSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
123206ef0fecSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
123306ef0fecSmrg# --with-ps2pdf assumes 'auto'.
1234320e696bSmrg#
123506ef0fecSmrg# Interface to module:
123606ef0fecSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
123706ef0fecSmrg# PS2PDF:	returns the path of the ps2pdf program found
123806ef0fecSmrg#		returns the path set by the user in the environment
123906ef0fecSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
124006ef0fecSmrg#		 'no' user instructs the module not to use ps2pdf
1241320e696bSmrg#
124206ef0fecSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243320e696bSmrg#
124406ef0fecSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
124506ef0fecSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
124606ef0fecSmrgm4_define([_defopt], m4_default([$1], [auto]))
124706ef0fecSmrgAC_ARG_WITH(ps2pdf,
124806ef0fecSmrg	AS_HELP_STRING([--with-ps2pdf],
124906ef0fecSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
125006ef0fecSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
125106ef0fecSmrgm4_undefine([_defopt])
1252320e696bSmrg
125306ef0fecSmrgif test "x$use_ps2pdf" = x"auto"; then
125406ef0fecSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
125506ef0fecSmrg   if test "x$PS2PDF" = "x"; then
125606ef0fecSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
125706ef0fecSmrg	have_ps2pdf=no
125806ef0fecSmrg   else
125906ef0fecSmrg        have_ps2pdf=yes
126006ef0fecSmrg   fi
126106ef0fecSmrgelif test "x$use_ps2pdf" = x"yes" ; then
126206ef0fecSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
126306ef0fecSmrg   if test "x$PS2PDF" = "x"; then
126406ef0fecSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
126506ef0fecSmrg   fi
126606ef0fecSmrg   have_ps2pdf=yes
126706ef0fecSmrgelif test "x$use_ps2pdf" = x"no" ; then
126806ef0fecSmrg   if test "x$PS2PDF" != "x"; then
126906ef0fecSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
127006ef0fecSmrg   fi
127106ef0fecSmrg   have_ps2pdf=no
127206ef0fecSmrgelse
127306ef0fecSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1274320e696bSmrgfi
127506ef0fecSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
127606ef0fecSmrg]) # XORG_WITH_PS2PDF
1277320e696bSmrg
127806ef0fecSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
127906ef0fecSmrg# ----------------
128006ef0fecSmrg# Minimum version: 1.6.0
1281320e696bSmrg#
128206ef0fecSmrg# Documentation tools are not always available on all platforms and sometimes
128306ef0fecSmrg# not at the appropriate level. This macro enables a builder to skip all
128406ef0fecSmrg# documentation targets except traditional man pages.
128506ef0fecSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
128606ef0fecSmrg# maximum flexibilty in controlling documentation building.
128706ef0fecSmrg# Refer to:
128806ef0fecSmrg# XORG_WITH_XMLTO         --with-xmlto
128906ef0fecSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
129006ef0fecSmrg# XORG_WITH_DOXYGEN       --with-doxygen
129106ef0fecSmrg# XORG_WITH_FOP           --with-fop
129206ef0fecSmrg# XORG_WITH_GROFF         --with-groff
129306ef0fecSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294320e696bSmrg#
129506ef0fecSmrg# Interface to module:
129606ef0fecSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
129706ef0fecSmrg# --enable-docs: 'yes' user instructs the module to generate docs
129806ef0fecSmrg#		 'no' user instructs the module not to generate docs
129906ef0fecSmrg# parm1:	specify the default value, yes or no.
1300320e696bSmrg#
130106ef0fecSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
130206ef0fecSmrgm4_define([docs_default], m4_default([$1], [yes]))
130306ef0fecSmrgAC_ARG_ENABLE(docs,
130406ef0fecSmrg	AS_HELP_STRING([--enable-docs],
130506ef0fecSmrg	   [Enable building the documentation (default: ]docs_default[)]),
130606ef0fecSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
130706ef0fecSmrgm4_undefine([docs_default])
130806ef0fecSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
130906ef0fecSmrgAC_MSG_CHECKING([whether to build documentation])
131006ef0fecSmrgAC_MSG_RESULT([$build_docs])
131106ef0fecSmrg]) # XORG_ENABLE_DOCS
1312320e696bSmrg
131306ef0fecSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
131406ef0fecSmrg# ----------------
131506ef0fecSmrg# Minimum version: 1.6.0
1316320e696bSmrg#
131706ef0fecSmrg# This macro enables a builder to skip all developer documentation.
131806ef0fecSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
131906ef0fecSmrg# maximum flexibilty in controlling documentation building.
132006ef0fecSmrg# Refer to:
132106ef0fecSmrg# XORG_WITH_XMLTO         --with-xmlto
132206ef0fecSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
132306ef0fecSmrg# XORG_WITH_DOXYGEN       --with-doxygen
132406ef0fecSmrg# XORG_WITH_FOP           --with-fop
132506ef0fecSmrg# XORG_WITH_GROFF         --with-groff
132606ef0fecSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1327320e696bSmrg#
132806ef0fecSmrg# Interface to module:
132906ef0fecSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
133006ef0fecSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
133106ef0fecSmrg#			'no' user instructs the module not to generate developer docs
133206ef0fecSmrg# parm1:		specify the default value, yes or no.
1333320e696bSmrg#
133406ef0fecSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
133506ef0fecSmrgm4_define([devel_default], m4_default([$1], [yes]))
133606ef0fecSmrgAC_ARG_ENABLE(devel-docs,
133706ef0fecSmrg	AS_HELP_STRING([--enable-devel-docs],
133806ef0fecSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
133906ef0fecSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
134006ef0fecSmrgm4_undefine([devel_default])
134106ef0fecSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
134206ef0fecSmrgAC_MSG_CHECKING([whether to build developer documentation])
134306ef0fecSmrgAC_MSG_RESULT([$build_devel_docs])
134406ef0fecSmrg]) # XORG_ENABLE_DEVEL_DOCS
1345320e696bSmrg
134606ef0fecSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
134706ef0fecSmrg# ----------------
134806ef0fecSmrg# Minimum version: 1.6.0
134906ef0fecSmrg#
135006ef0fecSmrg# This macro enables a builder to skip all functional specification targets.
135106ef0fecSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
135206ef0fecSmrg# maximum flexibilty in controlling documentation building.
135306ef0fecSmrg# Refer to:
135406ef0fecSmrg# XORG_WITH_XMLTO         --with-xmlto
135506ef0fecSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
135606ef0fecSmrg# XORG_WITH_DOXYGEN       --with-doxygen
135706ef0fecSmrg# XORG_WITH_FOP           --with-fop
135806ef0fecSmrg# XORG_WITH_GROFF         --with-groff
135906ef0fecSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
136006ef0fecSmrg#
136106ef0fecSmrg# Interface to module:
136206ef0fecSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
136306ef0fecSmrg# --enable-specs:	'yes' user instructs the module to generate specs
136406ef0fecSmrg#			'no' user instructs the module not to generate specs
136506ef0fecSmrg# parm1:		specify the default value, yes or no.
136606ef0fecSmrg#
136706ef0fecSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
136806ef0fecSmrgm4_define([spec_default], m4_default([$1], [yes]))
136906ef0fecSmrgAC_ARG_ENABLE(specs,
137006ef0fecSmrg	AS_HELP_STRING([--enable-specs],
137106ef0fecSmrg	   [Enable building the specs (default: ]spec_default[)]),
137206ef0fecSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
137306ef0fecSmrgm4_undefine([spec_default])
137406ef0fecSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
137506ef0fecSmrgAC_MSG_CHECKING([whether to build functional specifications])
137606ef0fecSmrgAC_MSG_RESULT([$build_specs])
137706ef0fecSmrg]) # XORG_ENABLE_SPECS
1378320e696bSmrg
137906ef0fecSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
138006ef0fecSmrg# ----------------------------------------------
138106ef0fecSmrg# Minimum version: 1.13.0
138206ef0fecSmrg#
138306ef0fecSmrg# This macro enables a builder to enable/disable unit testing
138406ef0fecSmrg# It makes no assumption about the test cases implementation
138506ef0fecSmrg# Test cases may or may not use Automake "Support for test suites"
138606ef0fecSmrg# They may or may not use the software utility library GLib
138706ef0fecSmrg#
138806ef0fecSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
138906ef0fecSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
139006ef0fecSmrg# The variable enable_unit_tests is used by other macros in this file.
139106ef0fecSmrg#
139206ef0fecSmrg# Interface to module:
139306ef0fecSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
139406ef0fecSmrg# enable_unit_tests:    used in configure.ac for additional configuration
139506ef0fecSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
139606ef0fecSmrg#			'no' user instructs the module not to build tests
139706ef0fecSmrg# parm1:		specify the default value, yes or no.
139806ef0fecSmrg#
139906ef0fecSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
140006ef0fecSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
140106ef0fecSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
140206ef0fecSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
140306ef0fecSmrgm4_define([_defopt], m4_default([$1], [auto]))
140406ef0fecSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
140506ef0fecSmrg	[Enable building unit test cases (default: ]_defopt[)]),
140606ef0fecSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
140706ef0fecSmrgm4_undefine([_defopt])
140806ef0fecSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
140906ef0fecSmrgAC_MSG_CHECKING([whether to build unit test cases])
141006ef0fecSmrgAC_MSG_RESULT([$enable_unit_tests])
141106ef0fecSmrg]) # XORG_ENABLE_UNIT_TESTS
1412b3307321Smrg
141306ef0fecSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
141406ef0fecSmrg# ------------------------------------------------------
141506ef0fecSmrg# Minimum version: 1.17.0
14165e358ecaSmrg#
141706ef0fecSmrg# This macro enables a builder to enable/disable integration testing
141806ef0fecSmrg# It makes no assumption about the test cases' implementation
141906ef0fecSmrg# Test cases may or may not use Automake "Support for test suites"
14205e358ecaSmrg#
142106ef0fecSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
142206ef0fecSmrg# usually requires less dependencies and may be built and run under less
142306ef0fecSmrg# stringent environments than integration tests.
14245e358ecaSmrg#
142506ef0fecSmrg# Interface to module:
142606ef0fecSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
142706ef0fecSmrg# enable_integration_tests:   used in configure.ac for additional configuration
142806ef0fecSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
142906ef0fecSmrg#                             'no' user instructs the module not to build tests
143006ef0fecSmrg# parm1:                      specify the default value, yes or no.
14315e358ecaSmrg#
143206ef0fecSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
143306ef0fecSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
143406ef0fecSmrgm4_define([_defopt], m4_default([$1], [auto]))
143506ef0fecSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
143606ef0fecSmrg	[Enable building integration test cases (default: ]_defopt[)]),
143706ef0fecSmrg	[enable_integration_tests=$enableval],
143806ef0fecSmrg	[enable_integration_tests=]_defopt)
143906ef0fecSmrgm4_undefine([_defopt])
144006ef0fecSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
144106ef0fecSmrg	[test "x$enable_integration_tests" != xno])
144206ef0fecSmrgAC_MSG_CHECKING([whether to build unit test cases])
144306ef0fecSmrgAC_MSG_RESULT([$enable_integration_tests])
144406ef0fecSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445b3307321Smrg
144606ef0fecSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
144706ef0fecSmrg# ----------------------------------------
144806ef0fecSmrg# Minimum version: 1.13.0
14495e358ecaSmrg#
145006ef0fecSmrg# GLib is a library which provides advanced data structures and functions.
145106ef0fecSmrg# This macro enables a module to test for the presence of Glib.
145206ef0fecSmrg#
145306ef0fecSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
145406ef0fecSmrg# Otherwise the value of $enable_unit_tests is blank.
145506ef0fecSmrg#
145606ef0fecSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
145706ef0fecSmrg# test support usually requires less dependencies and may be built and run under
145806ef0fecSmrg# less stringent environments than integration tests.
145906ef0fecSmrg#
146006ef0fecSmrg# Interface to module:
146106ef0fecSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
146206ef0fecSmrg# with_glib: used in configure.ac to know if GLib has been found
146306ef0fecSmrg# --with-glib:	'yes' user instructs the module to use glib
146406ef0fecSmrg#		'no' user instructs the module not to use glib
146506ef0fecSmrg#
146606ef0fecSmrgAC_DEFUN([XORG_WITH_GLIB],[
146706ef0fecSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
146806ef0fecSmrgm4_define([_defopt], m4_default([$2], [auto]))
146906ef0fecSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
147006ef0fecSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
147106ef0fecSmrg	[with_glib=$withval], [with_glib=]_defopt)
147206ef0fecSmrgm4_undefine([_defopt])
1473b3307321Smrg
147406ef0fecSmrghave_glib=no
147506ef0fecSmrg# Do not probe GLib if user explicitly disabled unit testing
147606ef0fecSmrgif test "x$enable_unit_tests" != x"no"; then
147706ef0fecSmrg  # Do not probe GLib if user explicitly disabled it
147806ef0fecSmrg  if test "x$with_glib" != x"no"; then
147906ef0fecSmrg    m4_ifval(
148006ef0fecSmrg      [$1],
148106ef0fecSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
148206ef0fecSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
148306ef0fecSmrg    )
148406ef0fecSmrg  fi
1485b3307321Smrgfi
1486b3307321Smrg
148706ef0fecSmrg# Not having GLib when unit testing has been explicitly requested is an error
148806ef0fecSmrgif test "x$enable_unit_tests" = x"yes"; then
148906ef0fecSmrg  if test "x$have_glib" = x"no"; then
149006ef0fecSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149106ef0fecSmrg  fi
14925e358ecaSmrgfi
1493b3307321Smrg
149406ef0fecSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
149506ef0fecSmrgif test "x$enable_unit_tests" = x"no"; then
149606ef0fecSmrg  if test "x$with_glib" = x"yes"; then
149706ef0fecSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
149806ef0fecSmrg  fi
149906ef0fecSmrgfi
1500b3307321Smrg
150106ef0fecSmrg# Not having GLib when it has been explicitly requested is an error
150206ef0fecSmrgif test "x$with_glib" = x"yes"; then
150306ef0fecSmrg  if test "x$have_glib" = x"no"; then
150406ef0fecSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
150506ef0fecSmrg  fi
15065e358ecaSmrgfi
1507b3307321Smrg
150806ef0fecSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
150906ef0fecSmrg]) # XORG_WITH_GLIB
1510b3307321Smrg
151106ef0fecSmrg# XORG_LD_WRAP([required|optional])
151206ef0fecSmrg# ---------------------------------
151306ef0fecSmrg# Minimum version: 1.13.0
151406ef0fecSmrg#
151506ef0fecSmrg# Check if linker supports -wrap, passed via compiler flags
151606ef0fecSmrg#
151706ef0fecSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
151806ef0fecSmrg# Otherwise the value of $enable_unit_tests is blank.
151906ef0fecSmrg#
152006ef0fecSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
152106ef0fecSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
152206ef0fecSmrg# available, an argument of "optional" allows use when some unit tests require
152306ef0fecSmrg# ld -wrap and others do not.
152406ef0fecSmrg#
152506ef0fecSmrgAC_DEFUN([XORG_LD_WRAP],[
152606ef0fecSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
152706ef0fecSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
152806ef0fecSmrg                      void __wrap_exit(int status) { return; }],
152906ef0fecSmrg                     [exit(0);])])
153006ef0fecSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
153106ef0fecSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
153206ef0fecSmrg  if test "x$have_ld_wrap" = x"no"; then
153306ef0fecSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
153406ef0fecSmrg  fi
15355e358ecaSmrgfi
153606ef0fecSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
153706ef0fecSmrg#
153806ef0fecSmrg]) # XORG_LD_WRAP
1539b3307321Smrg
154006ef0fecSmrg# XORG_CHECK_LINKER_FLAGS
154106ef0fecSmrg# -----------------------
154206ef0fecSmrg# SYNOPSIS
154306ef0fecSmrg#
154406ef0fecSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
154506ef0fecSmrg#
154606ef0fecSmrg# DESCRIPTION
154706ef0fecSmrg#
154806ef0fecSmrg#   Check whether the given linker FLAGS work with the current language's
154906ef0fecSmrg#   linker, or whether they give an error.
155006ef0fecSmrg#
155106ef0fecSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
155206ef0fecSmrg#   success/failure.
155306ef0fecSmrg#
155406ef0fecSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
155506ef0fecSmrg#
155606ef0fecSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
155706ef0fecSmrg#
155806ef0fecSmrg# LICENSE
155906ef0fecSmrg#
156006ef0fecSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
156106ef0fecSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
156206ef0fecSmrg#   Copyright (c) 2009 Matteo Frigo
156306ef0fecSmrg#
156406ef0fecSmrg#   This program is free software: you can redistribute it and/or modify it
156506ef0fecSmrg#   under the terms of the GNU General Public License as published by the
156606ef0fecSmrg#   Free Software Foundation, either version 3 of the License, or (at your
156706ef0fecSmrg#   option) any later version.
156806ef0fecSmrg#
156906ef0fecSmrg#   This program is distributed in the hope that it will be useful, but
157006ef0fecSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
157106ef0fecSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
157206ef0fecSmrg#   Public License for more details.
157306ef0fecSmrg#
157406ef0fecSmrg#   You should have received a copy of the GNU General Public License along
157506ef0fecSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
157606ef0fecSmrg#
157706ef0fecSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
157806ef0fecSmrg#   gives unlimited permission to copy, distribute and modify the configure
157906ef0fecSmrg#   scripts that are the output of Autoconf when processing the Macro. You
158006ef0fecSmrg#   need not follow the terms of the GNU General Public License when using
158106ef0fecSmrg#   or distributing such scripts, even though portions of the text of the
158206ef0fecSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
158306ef0fecSmrg#   all other use of the material that constitutes the Autoconf Macro.
158406ef0fecSmrg#
158506ef0fecSmrg#   This special exception to the GPL applies to versions of the Autoconf
158606ef0fecSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
158706ef0fecSmrg#   modified version of the Autoconf Macro, you may extend this special
158806ef0fecSmrg#   exception to the GPL to apply to your modified version as well.#
158906ef0fecSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
159006ef0fecSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
159106ef0fecSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
159206ef0fecSmrgAS_LITERAL_IF([$1],
159306ef0fecSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
159406ef0fecSmrg      ax_save_FLAGS=$LDFLAGS
159506ef0fecSmrg      LDFLAGS="$1"
159606ef0fecSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
159706ef0fecSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
159806ef0fecSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
159906ef0fecSmrg      LDFLAGS=$ax_save_FLAGS])],
160006ef0fecSmrg  [ax_save_FLAGS=$LDFLAGS
160106ef0fecSmrg   LDFLAGS="$1"
160206ef0fecSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
160306ef0fecSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
160406ef0fecSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
160506ef0fecSmrg   LDFLAGS=$ax_save_FLAGS])
160606ef0fecSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
160706ef0fecSmrgAC_MSG_RESULT($xorg_check_linker_flags)
160806ef0fecSmrgif test "x$xorg_check_linker_flags" = xyes; then
160906ef0fecSmrg	m4_default([$2], :)
161006ef0fecSmrgelse
161106ef0fecSmrg	m4_default([$3], :)
16125e358ecaSmrgfi
161306ef0fecSmrg]) # XORG_CHECK_LINKER_FLAGS
1614b3307321Smrg
161506ef0fecSmrg# XORG_MEMORY_CHECK_FLAGS
161606ef0fecSmrg# -----------------------
161706ef0fecSmrg# Minimum version: 1.16.0
161806ef0fecSmrg#
161906ef0fecSmrg# This macro attempts to find appropriate memory checking functionality
162006ef0fecSmrg# for various platforms which unit testing code may use to catch various
162106ef0fecSmrg# forms of memory allocation and access errors in testing.
162206ef0fecSmrg#
162306ef0fecSmrg# Interface to module:
162406ef0fecSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
162506ef0fecSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
162606ef0fecSmrg#
162706ef0fecSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
162806ef0fecSmrg#
162906ef0fecSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1630b3307321Smrg
163106ef0fecSmrgAC_REQUIRE([AC_CANONICAL_HOST])
163206ef0fecSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
163306ef0fecSmrg           [Environment variables to enable memory checking in tests])
16345e358ecaSmrg
163506ef0fecSmrg# Check for different types of support on different platforms
163606ef0fecSmrgcase $host_os in
163706ef0fecSmrg    solaris*)
163806ef0fecSmrg        AC_CHECK_LIB([umem], [umem_alloc],
163906ef0fecSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
164006ef0fecSmrg        ;;
164106ef0fecSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
164206ef0fecSmrg        # both directly and inverted, so should not be 0 or 255.
164306ef0fecSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
164406ef0fecSmrg        ;;
164506ef0fecSmrg    darwin*)
164606ef0fecSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
164706ef0fecSmrg        ;;
164806ef0fecSmrg    *bsd*)
164906ef0fecSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
165006ef0fecSmrg        ;;
165106ef0fecSmrgesac
165229cb5710Smrg
165306ef0fecSmrg# User supplied flags override default flags
165406ef0fecSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
165506ef0fecSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
165629cb5710Smrgfi
165729cb5710Smrg
165806ef0fecSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
165906ef0fecSmrg]) # XORG_WITH_LINT
166029cb5710Smrg
166106ef0fecSmrg# XORG_CHECK_MALLOC_ZERO
166206ef0fecSmrg# ----------------------
16635e358ecaSmrg# Minimum version: 1.0.0
1664afe13c8eSmrg#
166506ef0fecSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
166606ef0fecSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
166706ef0fecSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
166806ef0fecSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
166906ef0fecSmrgAC_ARG_ENABLE(malloc0returnsnull,
167006ef0fecSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
167106ef0fecSmrg		       [malloc(0) returns NULL (default: auto)]),
167206ef0fecSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
167306ef0fecSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1674afe13c8eSmrg
167506ef0fecSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
167606ef0fecSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
167706ef0fecSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
167806ef0fecSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
167906ef0fecSmrg#include <stdlib.h>
168006ef0fecSmrg],[
168106ef0fecSmrg    char *m0, *r0, *c0, *p;
168206ef0fecSmrg    m0 = malloc(0);
168306ef0fecSmrg    p = malloc(10);
168406ef0fecSmrg    r0 = realloc(p,0);
168506ef0fecSmrg    c0 = calloc(0,10);
168606ef0fecSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
168706ef0fecSmrg])],
168806ef0fecSmrg		[xorg_cv_malloc0_returns_null=yes],
168906ef0fecSmrg		[xorg_cv_malloc0_returns_null=no])])
169006ef0fecSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1691afe13c8eSmrgfi
169206ef0fecSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1693afe13c8eSmrg
169406ef0fecSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
169506ef0fecSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
169606ef0fecSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
169706ef0fecSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16985e358ecaSmrgelse
169906ef0fecSmrg	MALLOC_ZERO_CFLAGS=""
170006ef0fecSmrg	XMALLOC_ZERO_CFLAGS=""
170106ef0fecSmrg	XTMALLOC_ZERO_CFLAGS=""
17025e358ecaSmrgfi
1703afe13c8eSmrg
170406ef0fecSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
170506ef0fecSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
170606ef0fecSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
170706ef0fecSmrg]) # XORG_CHECK_MALLOC_ZERO
1708afe13c8eSmrg
170906ef0fecSmrg# XORG_WITH_LINT()
171006ef0fecSmrg# ----------------
171106ef0fecSmrg# Minimum version: 1.1.0
1712afe13c8eSmrg#
171306ef0fecSmrg# This macro enables the use of a tool that flags some suspicious and
171406ef0fecSmrg# non-portable constructs (likely to be bugs) in C language source code.
171506ef0fecSmrg# It will attempt to locate the tool and use appropriate options.
171606ef0fecSmrg# There are various lint type tools on different platforms.
171706ef0fecSmrg#
171806ef0fecSmrg# Interface to module:
171906ef0fecSmrg# LINT:		returns the path to the tool found on the platform
172006ef0fecSmrg#		or the value set to LINT on the configure cmd line
172106ef0fecSmrg#		also an Automake conditional
172206ef0fecSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
172306ef0fecSmrg#
172406ef0fecSmrg# --with-lint:	'yes' user instructs the module to use lint
172506ef0fecSmrg#		'no' user instructs the module not to use lint (default)
172606ef0fecSmrg#
172706ef0fecSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
172806ef0fecSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
172906ef0fecSmrg#
173006ef0fecSmrgAC_DEFUN([XORG_WITH_LINT],[
1731afe13c8eSmrg
173206ef0fecSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
173306ef0fecSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
173406ef0fecSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
173506ef0fecSmrg		[Use a lint-style source code checker (default: disabled)])],
173606ef0fecSmrg		[use_lint=$withval], [use_lint=no])
1737afe13c8eSmrg
173806ef0fecSmrg# Obtain platform specific info like program name and options
173906ef0fecSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
174006ef0fecSmrgcase $host_os in
174106ef0fecSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
174206ef0fecSmrg	lint_name=splint
174306ef0fecSmrg	lint_options="-badflag"
174406ef0fecSmrg	;;
174506ef0fecSmrg  *freebsd* | *netbsd*)
174606ef0fecSmrg	lint_name=lint
174706ef0fecSmrg	lint_options="-u -b"
174806ef0fecSmrg	;;
174906ef0fecSmrg  *solaris*)
175006ef0fecSmrg	lint_name=lint
175106ef0fecSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
175206ef0fecSmrg	;;
175306ef0fecSmrgesac
1754afe13c8eSmrg
175506ef0fecSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
175606ef0fecSmrgif test "x$use_lint" = x"yes" ; then
175706ef0fecSmrg   AC_PATH_PROG([LINT], [$lint_name])
175806ef0fecSmrg   if test "x$LINT" = "x"; then
175906ef0fecSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
176006ef0fecSmrg   fi
176106ef0fecSmrgelif test "x$use_lint" = x"no" ; then
176206ef0fecSmrg   if test "x$LINT" != "x"; then
176306ef0fecSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
176406ef0fecSmrg   fi
176506ef0fecSmrgelse
176606ef0fecSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17675e358ecaSmrgfi
1768afe13c8eSmrg
176906ef0fecSmrg# User supplied flags override default flags
177006ef0fecSmrgif test "x$LINT_FLAGS" != "x"; then
177106ef0fecSmrg   lint_options=$LINT_FLAGS
17725e358ecaSmrgfi
1773afe13c8eSmrg
177406ef0fecSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
177506ef0fecSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776afe13c8eSmrg
177706ef0fecSmrg]) # XORG_WITH_LINT
1778afe13c8eSmrg
177906ef0fecSmrg# XORG_LINT_LIBRARY(LIBNAME)
178006ef0fecSmrg# --------------------------
178106ef0fecSmrg# Minimum version: 1.1.0
178229cb5710Smrg#
178306ef0fecSmrg# Sets up flags for building lint libraries for checking programs that call
178406ef0fecSmrg# functions in the library.
178529cb5710Smrg#
178629cb5710Smrg# Interface to module:
178706ef0fecSmrg# LINTLIB		- Automake variable with the name of lint library file to make
178806ef0fecSmrg# MAKE_LINT_LIB		- Automake conditional
178929cb5710Smrg#
179006ef0fecSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
179106ef0fecSmrg#			  - 'no' user instructs the module not to create a lint library (default)
179229cb5710Smrg
179306ef0fecSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
179406ef0fecSmrgAC_REQUIRE([XORG_WITH_LINT])
179506ef0fecSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
179606ef0fecSmrg	[Create lint library (default: disabled)])],
179706ef0fecSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
179806ef0fecSmrg
179906ef0fecSmrgif test "x$make_lint_lib" = x"yes" ; then
180006ef0fecSmrg   LINTLIB=llib-l$1.ln
180106ef0fecSmrg   if test "x$LINT" = "x"; then
180206ef0fecSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
180329cb5710Smrg   fi
180406ef0fecSmrgelif test "x$make_lint_lib" != x"no" ; then
180506ef0fecSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
180629cb5710Smrgfi
180729cb5710Smrg
180806ef0fecSmrgAC_SUBST(LINTLIB)
180906ef0fecSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
181029cb5710Smrg
181106ef0fecSmrg]) # XORG_LINT_LIBRARY
181229cb5710Smrg
181306ef0fecSmrg# XORG_COMPILER_BRAND
181406ef0fecSmrg# -------------------
181506ef0fecSmrg# Minimum version: 1.14.0
1816320e696bSmrg#
181706ef0fecSmrg# Checks for various brands of compilers and sets flags as appropriate:
181806ef0fecSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
181906ef0fecSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
182006ef0fecSmrg#   clang compiler - sets CLANGCC to "yes"
182106ef0fecSmrg#   Intel compiler - sets INTELCC to "yes"
182206ef0fecSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823320e696bSmrg#
182406ef0fecSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
182506ef0fecSmrgAC_LANG_CASE(
182606ef0fecSmrg	[C], [
182706ef0fecSmrg		AC_REQUIRE([AC_PROG_CC_C99])
182806ef0fecSmrg	],
182906ef0fecSmrg	[C++], [
183006ef0fecSmrg		AC_REQUIRE([AC_PROG_CXX])
183106ef0fecSmrg	]
183206ef0fecSmrg)
183306ef0fecSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
183406ef0fecSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
183506ef0fecSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
183606ef0fecSmrg]) # XORG_COMPILER_BRAND
183706ef0fecSmrg
183806ef0fecSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
183906ef0fecSmrg# ---------------
184006ef0fecSmrg# Minimum version: 1.16.0
1841320e696bSmrg#
184206ef0fecSmrg# Test if the compiler works when passed the given flag as a command line argument.
184306ef0fecSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
184406ef0fecSmrg# next flag in the list until there are no more options.
1845320e696bSmrg#
184606ef0fecSmrg# Note that this does not guarantee that the compiler supports the flag as some
184706ef0fecSmrg# compilers will simply ignore arguments that they do not understand, but we do
184806ef0fecSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
184906ef0fecSmrg# -Werror=unused-command-line-argument
185006ef0fecSmrg#
185106ef0fecSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
185206ef0fecSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
185306ef0fecSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854320e696bSmrg
185506ef0fecSmrgAC_LANG_COMPILER_REQUIRE
1856320e696bSmrg
185706ef0fecSmrgAC_LANG_CASE(
185806ef0fecSmrg	[C], [
185906ef0fecSmrg		AC_REQUIRE([AC_PROG_CC_C99])
186006ef0fecSmrg		define([PREFIX], [C])
186106ef0fecSmrg		define([CACHE_PREFIX], [cc])
186206ef0fecSmrg		define([COMPILER], [$CC])
186306ef0fecSmrg	],
186406ef0fecSmrg	[C++], [
186506ef0fecSmrg		define([PREFIX], [CXX])
186606ef0fecSmrg		define([CACHE_PREFIX], [cxx])
186706ef0fecSmrg		define([COMPILER], [$CXX])
186806ef0fecSmrg	]
186906ef0fecSmrg)
1870320e696bSmrg
187106ef0fecSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1872320e696bSmrg
187306ef0fecSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
187406ef0fecSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
187506ef0fecSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
187606ef0fecSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
187706ef0fecSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
187806ef0fecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
187906ef0fecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
188006ef0fecSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
188106ef0fecSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882320e696bSmrgfi
1883320e696bSmrg
188406ef0fecSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
188506ef0fecSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
188606ef0fecSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
188706ef0fecSmrg	fi
188806ef0fecSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
188906ef0fecSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
189006ef0fecSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
189106ef0fecSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
189206ef0fecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
189306ef0fecSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
189406ef0fecSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
189506ef0fecSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189606ef0fecSmrgfi
1897320e696bSmrg
189806ef0fecSmrgfound="no"
189906ef0fecSmrgm4_foreach([flag], m4_cdr($@), [
190006ef0fecSmrg	if test $found = "no" ; then
190106ef0fecSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
190206ef0fecSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
190306ef0fecSmrg		fi
190406ef0fecSmrg
190506ef0fecSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
190606ef0fecSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
190706ef0fecSmrg		fi
190806ef0fecSmrg
190906ef0fecSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
191006ef0fecSmrg
191106ef0fecSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
191206ef0fecSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
191306ef0fecSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
191406ef0fecSmrg		AC_CACHE_VAL($cacheid,
191506ef0fecSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
191606ef0fecSmrg					     [eval $cacheid=yes],
191706ef0fecSmrg					     [eval $cacheid=no])])
191806ef0fecSmrg
191906ef0fecSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
192006ef0fecSmrg
192106ef0fecSmrg		eval supported=\$$cacheid
192206ef0fecSmrg		AC_MSG_RESULT([$supported])
192306ef0fecSmrg		if test "$supported" = "yes" ; then
192406ef0fecSmrg			$1="$$1 ]flag["
192506ef0fecSmrg			found="yes"
192606ef0fecSmrg		fi
192706ef0fecSmrg	fi
192806ef0fecSmrg])
192906ef0fecSmrg]) # XORG_TESTSET_CFLAG
193006ef0fecSmrg
193106ef0fecSmrg# XORG_COMPILER_FLAGS
193206ef0fecSmrg# ---------------
193306ef0fecSmrg# Minimum version: 1.16.0
193429cb5710Smrg#
193506ef0fecSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
193606ef0fecSmrg# arguments supported by the selected compiler which do NOT alter the generated
193706ef0fecSmrg# code.  These arguments will cause the compiler to print various warnings
193806ef0fecSmrg# during compilation AND turn a conservative set of warnings into errors.
193929cb5710Smrg#
194006ef0fecSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
194106ef0fecSmrg# future versions of util-macros as options are added to new compilers.
194229cb5710Smrg#
194306ef0fecSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
194406ef0fecSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
194529cb5710Smrg
194606ef0fecSmrgAC_ARG_ENABLE(selective-werror,
194706ef0fecSmrg              AS_HELP_STRING([--disable-selective-werror],
194806ef0fecSmrg                             [Turn off selective compiler errors. (default: enabled)]),
194906ef0fecSmrg              [SELECTIVE_WERROR=$enableval],
195006ef0fecSmrg              [SELECTIVE_WERROR=yes])
195106ef0fecSmrg
195206ef0fecSmrgAC_LANG_CASE(
195306ef0fecSmrg        [C], [
195406ef0fecSmrg                define([PREFIX], [C])
195506ef0fecSmrg        ],
195606ef0fecSmrg        [C++], [
195706ef0fecSmrg                define([PREFIX], [CXX])
195806ef0fecSmrg        ]
195906ef0fecSmrg)
196006ef0fecSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
196106ef0fecSmrgif test "x$SUNCC" = "xyes"; then
196206ef0fecSmrg    [BASE_]PREFIX[FLAGS]="-v"
196329cb5710Smrgelse
196406ef0fecSmrg    [BASE_]PREFIX[FLAGS]=""
196529cb5710Smrgfi
196629cb5710Smrg
196706ef0fecSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
196806ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
196906ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
197006ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
197106ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
197229cb5710Smrg
197306ef0fecSmrgAC_LANG_CASE(
197406ef0fecSmrg	[C], [
197506ef0fecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
197606ef0fecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
197706ef0fecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
197806ef0fecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
197906ef0fecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
198006ef0fecSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
198106ef0fecSmrg	]
198206ef0fecSmrg)
198306ef0fecSmrg
198406ef0fecSmrg# This chunk adds additional warnings that could catch undesired effects.
198506ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
198606ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
198706ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
198806ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
198906ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
199006ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
199106ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
199206ef0fecSmrg
199306ef0fecSmrg# These are currently disabled because they are noisy.  They will be enabled
199406ef0fecSmrg# in the future once the codebase is sufficiently modernized to silence
199506ef0fecSmrg# them.  For now, I don't want them to drown out the other warnings.
199606ef0fecSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
199706ef0fecSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
199806ef0fecSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
199906ef0fecSmrg
200006ef0fecSmrg# Turn some warnings into errors, so we don't accidently get successful builds
200106ef0fecSmrg# when there are problems that should be fixed.
200206ef0fecSmrg
200306ef0fecSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
200406ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
200506ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
200606ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
200706ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
200806ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
200906ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
201006ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
201106ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
201206ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
201306ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
201406ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
201506ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
201606ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201729cb5710Smrgelse
201806ef0fecSmrgAC_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])
201906ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
202006ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
202106ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
202206ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
202306ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
202406ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
202506ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
202606ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
202706ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
202806ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
202906ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
203006ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
203106ef0fecSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203229cb5710Smrgfi
203329cb5710Smrg
203406ef0fecSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203506ef0fecSmrg]) # XORG_COMPILER_FLAGS
203606ef0fecSmrg
203706ef0fecSmrg# XORG_CWARNFLAGS
203806ef0fecSmrg# ---------------
203906ef0fecSmrg# Minimum version: 1.2.0
204006ef0fecSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
204129cb5710Smrg#
204206ef0fecSmrg# Defines CWARNFLAGS to enable C compiler warnings.
204329cb5710Smrg#
204406ef0fecSmrg# This function is deprecated because it defines -fno-strict-aliasing
204506ef0fecSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
204606ef0fecSmrg# is needed, then it should be added explicitly in the module when
204706ef0fecSmrg# it is updated to use BASE_CFLAGS.
204829cb5710Smrg#
204906ef0fecSmrgAC_DEFUN([XORG_CWARNFLAGS], [
205006ef0fecSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
205106ef0fecSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
205206ef0fecSmrgAC_LANG_CASE(
205306ef0fecSmrg	[C], [
205406ef0fecSmrg		CWARNFLAGS="$BASE_CFLAGS"
205506ef0fecSmrg		if  test "x$GCC" = xyes ; then
205606ef0fecSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
205706ef0fecSmrg		fi
205806ef0fecSmrg		AC_SUBST(CWARNFLAGS)
205906ef0fecSmrg	]
206006ef0fecSmrg)
206106ef0fecSmrg]) # XORG_CWARNFLAGS
206206ef0fecSmrg
206306ef0fecSmrg# XORG_STRICT_OPTION
206406ef0fecSmrg# -----------------------
206506ef0fecSmrg# Minimum version: 1.3.0
206629cb5710Smrg#
206706ef0fecSmrg# Add configure option to enable strict compilation flags, such as treating
206806ef0fecSmrg# warnings as fatal errors.
206906ef0fecSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
207006ef0fecSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
207129cb5710Smrg#
207206ef0fecSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
207306ef0fecSmrg# when strict compilation is unconditionally desired.
207406ef0fecSmrgAC_DEFUN([XORG_STRICT_OPTION], [
207506ef0fecSmrgAC_REQUIRE([XORG_CWARNFLAGS])
207606ef0fecSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
207729cb5710Smrg
207806ef0fecSmrgAC_ARG_ENABLE(strict-compilation,
207906ef0fecSmrg			  AS_HELP_STRING([--enable-strict-compilation],
208006ef0fecSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
208106ef0fecSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
208229cb5710Smrg
208306ef0fecSmrgAC_LANG_CASE(
208406ef0fecSmrg        [C], [
208506ef0fecSmrg                define([PREFIX], [C])
208606ef0fecSmrg        ],
208706ef0fecSmrg        [C++], [
208806ef0fecSmrg                define([PREFIX], [CXX])
208906ef0fecSmrg        ]
209006ef0fecSmrg)
209129cb5710Smrg
209206ef0fecSmrg[STRICT_]PREFIX[FLAGS]=""
209306ef0fecSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
209406ef0fecSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209529cb5710Smrg
209606ef0fecSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
209706ef0fecSmrg# activate it with -Werror, so we add it here explicitly.
209806ef0fecSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209929cb5710Smrg
210006ef0fecSmrgif test "x$STRICT_COMPILE" = "xyes"; then
210106ef0fecSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
210206ef0fecSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
210306ef0fecSmrgfi
210406ef0fecSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
210506ef0fecSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
210606ef0fecSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
210706ef0fecSmrg]) # XORG_STRICT_OPTION
210806ef0fecSmrg
210906ef0fecSmrg# XORG_DEFAULT_OPTIONS
211006ef0fecSmrg# --------------------
211106ef0fecSmrg# Minimum version: 1.3.0
211229cb5710Smrg#
211306ef0fecSmrg# Defines default options for X.Org modules.
211429cb5710Smrg#
211506ef0fecSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211606ef0fecSmrgAC_REQUIRE([AC_PROG_INSTALL])
211706ef0fecSmrgXORG_COMPILER_FLAGS
211806ef0fecSmrgXORG_CWARNFLAGS
211906ef0fecSmrgXORG_STRICT_OPTION
212006ef0fecSmrgXORG_RELEASE_VERSION
212106ef0fecSmrgXORG_CHANGELOG
212206ef0fecSmrgXORG_INSTALL
212306ef0fecSmrgXORG_MANPAGE_SECTIONS
212406ef0fecSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212506ef0fecSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212606ef0fecSmrg]) # XORG_DEFAULT_OPTIONS
212706ef0fecSmrg
212806ef0fecSmrg# XORG_INSTALL()
212906ef0fecSmrg# ----------------
213006ef0fecSmrg# Minimum version: 1.4.0
213129cb5710Smrg#
213206ef0fecSmrg# Defines the variable INSTALL_CMD as the command to copy
213306ef0fecSmrg# INSTALL from $prefix/share/util-macros.
213429cb5710Smrg#
213506ef0fecSmrgAC_DEFUN([XORG_INSTALL], [
213606ef0fecSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213706ef0fecSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
213806ef0fecSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
213906ef0fecSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214006ef0fecSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214106ef0fecSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214206ef0fecSmrgAC_SUBST([INSTALL_CMD])
214306ef0fecSmrg]) # XORG_INSTALL
214406ef0fecSmrgdnl Copyright 2005 Red Hat, Inc
214506ef0fecSmrgdnl
214606ef0fecSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
214706ef0fecSmrgdnl documentation for any purpose is hereby granted without fee, provided that
214806ef0fecSmrgdnl the above copyright notice appear in all copies and that both that
214906ef0fecSmrgdnl copyright notice and this permission notice appear in supporting
215006ef0fecSmrgdnl documentation.
215106ef0fecSmrgdnl
215206ef0fecSmrgdnl The above copyright notice and this permission notice shall be included
215306ef0fecSmrgdnl in all copies or substantial portions of the Software.
215406ef0fecSmrgdnl
215506ef0fecSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
215606ef0fecSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215706ef0fecSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
215806ef0fecSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
215906ef0fecSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
216006ef0fecSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
216106ef0fecSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
216206ef0fecSmrgdnl
216306ef0fecSmrgdnl Except as contained in this notice, the name of the copyright holders shall
216406ef0fecSmrgdnl not be used in advertising or otherwise to promote the sale, use or
216506ef0fecSmrgdnl other dealings in this Software without prior written authorization
216606ef0fecSmrgdnl from the copyright holders.
216706ef0fecSmrgdnl
216829cb5710Smrg
216906ef0fecSmrg# XORG_RELEASE_VERSION
217006ef0fecSmrg# --------------------
217106ef0fecSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172320e696bSmrg
217306ef0fecSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
217406ef0fecSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
217506ef0fecSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
217606ef0fecSmrg		[Major version of this package])
217706ef0fecSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
217806ef0fecSmrg	if test "x$PVM" = "x"; then
217906ef0fecSmrg		PVM="0"
218006ef0fecSmrg	fi
218106ef0fecSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
218206ef0fecSmrg		[$PVM],
218306ef0fecSmrg		[Minor version of this package])
218406ef0fecSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
218506ef0fecSmrg	if test "x$PVP" = "x"; then
218606ef0fecSmrg		PVP="0"
218706ef0fecSmrg	fi
218806ef0fecSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
218906ef0fecSmrg		[$PVP],
219006ef0fecSmrg		[Patch version of this package])
219106ef0fecSmrg])
219229cb5710Smrg
219306ef0fecSmrg# XORG_CHANGELOG()
219429cb5710Smrg# ----------------
219506ef0fecSmrg# Minimum version: 1.2.0
219629cb5710Smrg#
219706ef0fecSmrg# Defines the variable CHANGELOG_CMD as the command to generate
219806ef0fecSmrg# ChangeLog from git.
219929cb5710Smrg#
220029cb5710Smrg#
220106ef0fecSmrgAC_DEFUN([XORG_CHANGELOG], [
220206ef0fecSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220306ef0fecSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220406ef0fecSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220506ef0fecSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220606ef0fecSmrgAC_SUBST([CHANGELOG_CMD])
220706ef0fecSmrg]) # XORG_CHANGELOG
220806ef0fecSmrg
220906ef0fecSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
221029cb5710Smrg#
221106ef0fecSmrg# This file is free software; the Free Software Foundation
221206ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
221306ef0fecSmrg# with or without modifications, as long as this notice is preserved.
221429cb5710Smrg
221506ef0fecSmrg# AM_AUTOMAKE_VERSION(VERSION)
221606ef0fecSmrg# ----------------------------
221706ef0fecSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
221806ef0fecSmrg# generated from the m4 files accompanying Automake X.Y.
221906ef0fecSmrg# (This private macro should not be called outside this file.)
222006ef0fecSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
222106ef0fecSmrg[am__api_version='1.15'
222206ef0fecSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
222306ef0fecSmrgdnl require some minimum version.  Point them to the right macro.
222406ef0fecSmrgm4_if([$1], [1.15], [],
222506ef0fecSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
222606ef0fecSmrg])
222729cb5710Smrg
222806ef0fecSmrg# _AM_AUTOCONF_VERSION(VERSION)
222906ef0fecSmrg# -----------------------------
223006ef0fecSmrg# aclocal traces this macro to find the Autoconf version.
223106ef0fecSmrg# This is a private macro too.  Using m4_define simplifies
223206ef0fecSmrg# the logic in aclocal, which can simply ignore this definition.
223306ef0fecSmrgm4_define([_AM_AUTOCONF_VERSION], [])
223406ef0fecSmrg
223506ef0fecSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
223606ef0fecSmrg# -------------------------------
223706ef0fecSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
223806ef0fecSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
223906ef0fecSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
224006ef0fecSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
224106ef0fecSmrgm4_ifndef([AC_AUTOCONF_VERSION],
224206ef0fecSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
224306ef0fecSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
224406ef0fecSmrg
224506ef0fecSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
224606ef0fecSmrg
224706ef0fecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
224829cb5710Smrg#
224906ef0fecSmrg# This file is free software; the Free Software Foundation
225006ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
225106ef0fecSmrg# with or without modifications, as long as this notice is preserved.
225206ef0fecSmrg
225306ef0fecSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
225406ef0fecSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
225506ef0fecSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
225629cb5710Smrg#
225706ef0fecSmrg# Of course, Automake must honor this variable whenever it calls a
225806ef0fecSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
225906ef0fecSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
226006ef0fecSmrg# depending on how configure is run.  This is pretty annoying, since
226106ef0fecSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
226206ef0fecSmrg# source directory, any form will work fine, but in subdirectories a
226306ef0fecSmrg# relative path needs to be adjusted first.
226429cb5710Smrg#
226506ef0fecSmrg# $ac_aux_dir/missing
226606ef0fecSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
226706ef0fecSmrg# $top_srcdir/$ac_aux_dir/missing
226806ef0fecSmrg#    fails if $ac_aux_dir is absolute,
226906ef0fecSmrg#    fails when called from a subdirectory in a VPATH build with
227006ef0fecSmrg#          a relative $ac_aux_dir
227129cb5710Smrg#
227206ef0fecSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
227306ef0fecSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
227406ef0fecSmrg# harmless because $srcdir is '.', but things will broke when you
227506ef0fecSmrg# start a VPATH build or use an absolute $srcdir.
227629cb5710Smrg#
227706ef0fecSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
227806ef0fecSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
227906ef0fecSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
228006ef0fecSmrg# and then we would define $MISSING as
228106ef0fecSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
228206ef0fecSmrg# This will work as long as MISSING is not called from configure, because
228306ef0fecSmrg# unfortunately $(top_srcdir) has no meaning in configure.
228406ef0fecSmrg# However there are other variables, like CC, which are often used in
228506ef0fecSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
228629cb5710Smrg#
228706ef0fecSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
228806ef0fecSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
228906ef0fecSmrg# configured tree to be moved without reconfiguration.
229029cb5710Smrg
229106ef0fecSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
229206ef0fecSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
229306ef0fecSmrg# Expand $ac_aux_dir to an absolute path.
229406ef0fecSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
229506ef0fecSmrg])
229606ef0fecSmrg
229706ef0fecSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
229806ef0fecSmrg
229906ef0fecSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230029cb5710Smrg#
230106ef0fecSmrg# This file is free software; the Free Software Foundation
230206ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
230306ef0fecSmrg# with or without modifications, as long as this notice is preserved.
230406ef0fecSmrg
230506ef0fecSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
230606ef0fecSmrg# -------------------------------------
230706ef0fecSmrg# Define a conditional.
230806ef0fecSmrgAC_DEFUN([AM_CONDITIONAL],
230906ef0fecSmrg[AC_PREREQ([2.52])dnl
231006ef0fecSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
231106ef0fecSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
231206ef0fecSmrgAC_SUBST([$1_TRUE])dnl
231306ef0fecSmrgAC_SUBST([$1_FALSE])dnl
231406ef0fecSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
231506ef0fecSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
231606ef0fecSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
231706ef0fecSmrgif $2; then
231806ef0fecSmrg  $1_TRUE=
231906ef0fecSmrg  $1_FALSE='#'
232006ef0fecSmrgelse
232106ef0fecSmrg  $1_TRUE='#'
232206ef0fecSmrg  $1_FALSE=
232306ef0fecSmrgfi
232406ef0fecSmrgAC_CONFIG_COMMANDS_PRE(
232506ef0fecSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
232606ef0fecSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
232706ef0fecSmrgUsually this means the macro was only invoked conditionally.]])
232806ef0fecSmrgfi])])
232906ef0fecSmrg
233006ef0fecSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233129cb5710Smrg#
233206ef0fecSmrg# This file is free software; the Free Software Foundation
233306ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
233406ef0fecSmrg# with or without modifications, as long as this notice is preserved.
233529cb5710Smrg
233606ef0fecSmrg
233706ef0fecSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
233806ef0fecSmrg# written in clear, in which case automake, when reading aclocal.m4,
233906ef0fecSmrg# will think it sees a *use*, and therefore will trigger all it's
234006ef0fecSmrg# C support machinery.  Also note that it means that autoscan, seeing
234106ef0fecSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
234206ef0fecSmrg
234306ef0fecSmrg
234406ef0fecSmrg# _AM_DEPENDENCIES(NAME)
234506ef0fecSmrg# ----------------------
234606ef0fecSmrg# See how the compiler implements dependency checking.
234706ef0fecSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
234806ef0fecSmrg# We try a few techniques and use that to set a single cache variable.
2349320e696bSmrg#
235006ef0fecSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
235106ef0fecSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
235206ef0fecSmrg# dependency, and given that the user is not expected to run this macro,
235306ef0fecSmrg# just rely on AC_PROG_CC.
235406ef0fecSmrgAC_DEFUN([_AM_DEPENDENCIES],
235506ef0fecSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
235606ef0fecSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
235706ef0fecSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
235806ef0fecSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359320e696bSmrg
236006ef0fecSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
236106ef0fecSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
236206ef0fecSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
236306ef0fecSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
236406ef0fecSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
236506ef0fecSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
236606ef0fecSmrg                    [depcc="$$1"   am_compiler_list=])
236774a3f230Smrg
236806ef0fecSmrgAC_CACHE_CHECK([dependency style of $depcc],
236906ef0fecSmrg               [am_cv_$1_dependencies_compiler_type],
237006ef0fecSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
237106ef0fecSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
237206ef0fecSmrg  # making bogus files that we don't know about and never remove.  For
237306ef0fecSmrg  # instance it was reported that on HP-UX the gcc test will end up
237406ef0fecSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
237506ef0fecSmrg  # in D".
237606ef0fecSmrg  rm -rf conftest.dir
237706ef0fecSmrg  mkdir conftest.dir
237806ef0fecSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
237906ef0fecSmrg  # using a relative directory.
238006ef0fecSmrg  cp "$am_depcomp" conftest.dir
238106ef0fecSmrg  cd conftest.dir
238206ef0fecSmrg  # We will build objects and dependencies in a subdirectory because
238306ef0fecSmrg  # it helps to detect inapplicable dependency modes.  For instance
238406ef0fecSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
238506ef0fecSmrg  # side effect of compilation, but ICC will put the dependencies in
238606ef0fecSmrg  # the current directory while Tru64 will put them in the object
238706ef0fecSmrg  # directory.
238806ef0fecSmrg  mkdir sub
2389320e696bSmrg
239006ef0fecSmrg  am_cv_$1_dependencies_compiler_type=none
239106ef0fecSmrg  if test "$am_compiler_list" = ""; then
239206ef0fecSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2393320e696bSmrg  fi
239406ef0fecSmrg  am__universal=false
239506ef0fecSmrg  m4_case([$1], [CC],
239606ef0fecSmrg    [case " $depcc " in #(
239706ef0fecSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
239806ef0fecSmrg     esac],
239906ef0fecSmrg    [CXX],
240006ef0fecSmrg    [case " $depcc " in #(
240106ef0fecSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
240206ef0fecSmrg     esac])
240306ef0fecSmrg
240406ef0fecSmrg  for depmode in $am_compiler_list; do
240506ef0fecSmrg    # Setup a source with many dependencies, because some compilers
240606ef0fecSmrg    # like to wrap large dependency lists on column 80 (with \), and
240706ef0fecSmrg    # we should not choose a depcomp mode which is confused by this.
240806ef0fecSmrg    #
240906ef0fecSmrg    # We need to recreate these files for each test, as the compiler may
241006ef0fecSmrg    # overwrite some of them when testing with obscure command lines.
241106ef0fecSmrg    # This happens at least with the AIX C compiler.
241206ef0fecSmrg    : > sub/conftest.c
241306ef0fecSmrg    for i in 1 2 3 4 5 6; do
241406ef0fecSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
241506ef0fecSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
241606ef0fecSmrg      # Solaris 10 /bin/sh.
241706ef0fecSmrg      echo '/* dummy */' > sub/conftst$i.h
241806ef0fecSmrg    done
241906ef0fecSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
242006ef0fecSmrg
242106ef0fecSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
242206ef0fecSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
242306ef0fecSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
242406ef0fecSmrg    # versions had trouble with output in subdirs.
242506ef0fecSmrg    am__obj=sub/conftest.${OBJEXT-o}
242606ef0fecSmrg    am__minus_obj="-o $am__obj"
242706ef0fecSmrg    case $depmode in
242806ef0fecSmrg    gcc)
242906ef0fecSmrg      # This depmode causes a compiler race in universal mode.
243006ef0fecSmrg      test "$am__universal" = false || continue
243106ef0fecSmrg      ;;
243206ef0fecSmrg    nosideeffect)
243306ef0fecSmrg      # After this tag, mechanisms are not by side-effect, so they'll
243406ef0fecSmrg      # only be used when explicitly requested.
243506ef0fecSmrg      if test "x$enable_dependency_tracking" = xyes; then
243606ef0fecSmrg	continue
243706ef0fecSmrg      else
243806ef0fecSmrg	break
243906ef0fecSmrg      fi
244006ef0fecSmrg      ;;
244106ef0fecSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
244206ef0fecSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
244306ef0fecSmrg      # not run yet.  These depmodes are late enough in the game, and
244406ef0fecSmrg      # so weak that their functioning should not be impacted.
244506ef0fecSmrg      am__obj=conftest.${OBJEXT-o}
244606ef0fecSmrg      am__minus_obj=
244706ef0fecSmrg      ;;
244806ef0fecSmrg    none) break ;;
244906ef0fecSmrg    esac
245006ef0fecSmrg    if depmode=$depmode \
245106ef0fecSmrg       source=sub/conftest.c object=$am__obj \
245206ef0fecSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
245306ef0fecSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
245406ef0fecSmrg         >/dev/null 2>conftest.err &&
245506ef0fecSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
245606ef0fecSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
245706ef0fecSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
245806ef0fecSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
245906ef0fecSmrg      # icc doesn't choke on unknown options, it will just issue warnings
246006ef0fecSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
246106ef0fecSmrg      # that says an option was ignored or not supported.
246206ef0fecSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
246306ef0fecSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
246406ef0fecSmrg      # The diagnosis changed in icc 8.0:
246506ef0fecSmrg      #   icc: Command line remark: option '-MP' not supported
246606ef0fecSmrg      if (grep 'ignoring option' conftest.err ||
246706ef0fecSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
246806ef0fecSmrg        am_cv_$1_dependencies_compiler_type=$depmode
246906ef0fecSmrg        break
247006ef0fecSmrg      fi
247106ef0fecSmrg    fi
247206ef0fecSmrg  done
247306ef0fecSmrg
247406ef0fecSmrg  cd ..
247506ef0fecSmrg  rm -rf conftest.dir
247606ef0fecSmrgelse
247706ef0fecSmrg  am_cv_$1_dependencies_compiler_type=none
2478320e696bSmrgfi
247906ef0fecSmrg])
248006ef0fecSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
248106ef0fecSmrgAM_CONDITIONAL([am__fastdep$1], [
248206ef0fecSmrg  test "x$enable_dependency_tracking" != xno \
248306ef0fecSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
248406ef0fecSmrg])
2485320e696bSmrg
248606ef0fecSmrg
248706ef0fecSmrg# AM_SET_DEPDIR
248806ef0fecSmrg# -------------
248906ef0fecSmrg# Choose a directory name for dependency files.
249006ef0fecSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
249106ef0fecSmrgAC_DEFUN([AM_SET_DEPDIR],
249206ef0fecSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
249306ef0fecSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
249406ef0fecSmrg])
249506ef0fecSmrg
249606ef0fecSmrg
249706ef0fecSmrg# AM_DEP_TRACK
249806ef0fecSmrg# ------------
249906ef0fecSmrgAC_DEFUN([AM_DEP_TRACK],
250006ef0fecSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
250106ef0fecSmrgAS_HELP_STRING(
250206ef0fecSmrg  [--enable-dependency-tracking],
250306ef0fecSmrg  [do not reject slow dependency extractors])
250406ef0fecSmrgAS_HELP_STRING(
250506ef0fecSmrg  [--disable-dependency-tracking],
250606ef0fecSmrg  [speeds up one-time build])])
250706ef0fecSmrgif test "x$enable_dependency_tracking" != xno; then
250806ef0fecSmrg  am_depcomp="$ac_aux_dir/depcomp"
250906ef0fecSmrg  AMDEPBACKSLASH='\'
251006ef0fecSmrg  am__nodep='_no'
2511320e696bSmrgfi
251206ef0fecSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
251306ef0fecSmrgAC_SUBST([AMDEPBACKSLASH])dnl
251406ef0fecSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
251506ef0fecSmrgAC_SUBST([am__nodep])dnl
251606ef0fecSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
251706ef0fecSmrg])
251806ef0fecSmrg
251906ef0fecSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
252006ef0fecSmrg
252106ef0fecSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
252206ef0fecSmrg#
252306ef0fecSmrg# This file is free software; the Free Software Foundation
252406ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
252506ef0fecSmrg# with or without modifications, as long as this notice is preserved.
252606ef0fecSmrg
252706ef0fecSmrg
252806ef0fecSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
252906ef0fecSmrg# ------------------------------
253006ef0fecSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
253106ef0fecSmrg[{
253206ef0fecSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
253306ef0fecSmrg  # are listed without --file.  Let's play safe and only enable the eval
253406ef0fecSmrg  # if we detect the quoting.
253506ef0fecSmrg  case $CONFIG_FILES in
253606ef0fecSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
253706ef0fecSmrg  *)   set x $CONFIG_FILES ;;
253806ef0fecSmrg  esac
253906ef0fecSmrg  shift
254006ef0fecSmrg  for mf
254106ef0fecSmrg  do
254206ef0fecSmrg    # Strip MF so we end up with the name of the file.
254306ef0fecSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
254406ef0fecSmrg    # Check whether this is an Automake generated Makefile or not.
254506ef0fecSmrg    # We used to match only the files named 'Makefile.in', but
254606ef0fecSmrg    # some people rename them; so instead we look at the file content.
254706ef0fecSmrg    # Grep'ing the first line is not enough: some people post-process
254806ef0fecSmrg    # each Makefile.in and add a new line on top of each file to say so.
254906ef0fecSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
255006ef0fecSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
255106ef0fecSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
255206ef0fecSmrg      dirpart=`AS_DIRNAME("$mf")`
255306ef0fecSmrg    else
255406ef0fecSmrg      continue
255506ef0fecSmrg    fi
255606ef0fecSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
255706ef0fecSmrg    # from the Makefile without running 'make'.
255806ef0fecSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
255906ef0fecSmrg    test -z "$DEPDIR" && continue
256006ef0fecSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
256106ef0fecSmrg    test -z "$am__include" && continue
256206ef0fecSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
256306ef0fecSmrg    # Find all dependency output files, they are included files with
256406ef0fecSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
256506ef0fecSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
256606ef0fecSmrg    # expansion.
256706ef0fecSmrg    for file in `sed -n "
256806ef0fecSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
256906ef0fecSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
257006ef0fecSmrg      # Make sure the directory exists.
257106ef0fecSmrg      test -f "$dirpart/$file" && continue
257206ef0fecSmrg      fdir=`AS_DIRNAME(["$file"])`
257306ef0fecSmrg      AS_MKDIR_P([$dirpart/$fdir])
257406ef0fecSmrg      # echo "creating $dirpart/$file"
257506ef0fecSmrg      echo '# dummy' > "$dirpart/$file"
257606ef0fecSmrg    done
257706ef0fecSmrg  done
257806ef0fecSmrg}
257906ef0fecSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
258006ef0fecSmrg
258106ef0fecSmrg
258206ef0fecSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
258306ef0fecSmrg# -----------------------------
258406ef0fecSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
258506ef0fecSmrg#
258606ef0fecSmrg# This code is only required when automatic dependency tracking
258706ef0fecSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
258806ef0fecSmrg# need in order to bootstrap the dependency handling code.
258906ef0fecSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
259006ef0fecSmrg[AC_CONFIG_COMMANDS([depfiles],
259106ef0fecSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
259206ef0fecSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
259306ef0fecSmrg])
259406ef0fecSmrg
259506ef0fecSmrg# Do all the work for Automake.                             -*- Autoconf -*-
259606ef0fecSmrg
259706ef0fecSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
259806ef0fecSmrg#
259906ef0fecSmrg# This file is free software; the Free Software Foundation
260006ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
260106ef0fecSmrg# with or without modifications, as long as this notice is preserved.
2602320e696bSmrg
260306ef0fecSmrg# This macro actually does too much.  Some checks are only needed if
260406ef0fecSmrg# your package does certain things.  But this isn't really a big deal.
2605320e696bSmrg
260606ef0fecSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
260706ef0fecSmrgm4_define([AC_PROG_CC],
260806ef0fecSmrgm4_defn([AC_PROG_CC])
260906ef0fecSmrg[_AM_PROG_CC_C_O
261006ef0fecSmrg])
261106ef0fecSmrg
261206ef0fecSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
261306ef0fecSmrg# AM_INIT_AUTOMAKE([OPTIONS])
261406ef0fecSmrg# -----------------------------------------------
261506ef0fecSmrg# The call with PACKAGE and VERSION arguments is the old style
261606ef0fecSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
261706ef0fecSmrg# and VERSION should now be passed to AC_INIT and removed from
261806ef0fecSmrg# the call to AM_INIT_AUTOMAKE.
261906ef0fecSmrg# We support both call styles for the transition.  After
262006ef0fecSmrg# the next Automake release, Autoconf can make the AC_INIT
262106ef0fecSmrg# arguments mandatory, and then we can depend on a new Autoconf
262206ef0fecSmrg# release and drop the old call support.
262306ef0fecSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
262406ef0fecSmrg[AC_PREREQ([2.65])dnl
262506ef0fecSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
262606ef0fecSmrgdnl the ones we care about.
262706ef0fecSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
262806ef0fecSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
262906ef0fecSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
263006ef0fecSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
263106ef0fecSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
263206ef0fecSmrg  # is not polluted with repeated "-I."
263306ef0fecSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
263406ef0fecSmrg  # test to see if srcdir already configured
263506ef0fecSmrg  if test -f $srcdir/config.status; then
263606ef0fecSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637320e696bSmrg  fi
2638320e696bSmrgfi
2639320e696bSmrg
264006ef0fecSmrg# test whether we have cygpath
264106ef0fecSmrgif test -z "$CYGPATH_W"; then
264206ef0fecSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
264306ef0fecSmrg    CYGPATH_W='cygpath -w'
264406ef0fecSmrg  else
264506ef0fecSmrg    CYGPATH_W=echo
2646320e696bSmrg  fi
2647320e696bSmrgfi
264806ef0fecSmrgAC_SUBST([CYGPATH_W])
2649320e696bSmrg
265006ef0fecSmrg# Define the identity of the package.
265106ef0fecSmrgdnl Distinguish between old-style and new-style calls.
265206ef0fecSmrgm4_ifval([$2],
265306ef0fecSmrg[AC_DIAGNOSE([obsolete],
265406ef0fecSmrg             [$0: two- and three-arguments forms are deprecated.])
265506ef0fecSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
265606ef0fecSmrg AC_SUBST([PACKAGE], [$1])dnl
265706ef0fecSmrg AC_SUBST([VERSION], [$2])],
265806ef0fecSmrg[_AM_SET_OPTIONS([$1])dnl
265906ef0fecSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
266006ef0fecSmrgm4_if(
266106ef0fecSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
266206ef0fecSmrg  [ok:ok],,
266306ef0fecSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
266406ef0fecSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
266506ef0fecSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666320e696bSmrg
266706ef0fecSmrg_AM_IF_OPTION([no-define],,
266806ef0fecSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
266906ef0fecSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670320e696bSmrg
267106ef0fecSmrg# Some tools Automake needs.
267206ef0fecSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
267306ef0fecSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
267406ef0fecSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
267506ef0fecSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
267606ef0fecSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
267706ef0fecSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
267806ef0fecSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
267906ef0fecSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
268006ef0fecSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
268106ef0fecSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
268206ef0fecSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
268306ef0fecSmrg# dies out for good.  For more background, see:
268406ef0fecSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
268506ef0fecSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
268606ef0fecSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
268706ef0fecSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
268806ef0fecSmrg# system "awk" is bad on some platforms.
268906ef0fecSmrgAC_REQUIRE([AC_PROG_AWK])dnl
269006ef0fecSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
269106ef0fecSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
269206ef0fecSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
269306ef0fecSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
269406ef0fecSmrg			     [_AM_PROG_TAR([v7])])])
269506ef0fecSmrg_AM_IF_OPTION([no-dependencies],,
269606ef0fecSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
269706ef0fecSmrg		  [_AM_DEPENDENCIES([CC])],
269806ef0fecSmrg		  [m4_define([AC_PROG_CC],
269906ef0fecSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
270006ef0fecSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
270106ef0fecSmrg		  [_AM_DEPENDENCIES([CXX])],
270206ef0fecSmrg		  [m4_define([AC_PROG_CXX],
270306ef0fecSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
270406ef0fecSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
270506ef0fecSmrg		  [_AM_DEPENDENCIES([OBJC])],
270606ef0fecSmrg		  [m4_define([AC_PROG_OBJC],
270706ef0fecSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
270806ef0fecSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
270906ef0fecSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
271006ef0fecSmrg		  [m4_define([AC_PROG_OBJCXX],
271106ef0fecSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
271206ef0fecSmrg])
271306ef0fecSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
271406ef0fecSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
271506ef0fecSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
271606ef0fecSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
271706ef0fecSmrgAC_CONFIG_COMMANDS_PRE(dnl
271806ef0fecSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
271906ef0fecSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720320e696bSmrg
272106ef0fecSmrg# POSIX will say in a future version that running "rm -f" with no argument
272206ef0fecSmrg# is OK; and we want to be able to make that assumption in our Makefile
272306ef0fecSmrg# recipes.  So use an aggressive probe to check that the usage we want is
272406ef0fecSmrg# actually supported "in the wild" to an acceptable degree.
272506ef0fecSmrg# See automake bug#10828.
272606ef0fecSmrg# To make any issue more visible, cause the running configure to be aborted
272706ef0fecSmrg# by default if the 'rm' program in use doesn't match our expectations; the
272806ef0fecSmrg# user can still override this though.
272906ef0fecSmrgif rm -f && rm -fr && rm -rf; then : OK; else
273006ef0fecSmrg  cat >&2 <<'END'
273106ef0fecSmrgOops!
2732320e696bSmrg
273306ef0fecSmrgYour 'rm' program seems unable to run without file operands specified
273406ef0fecSmrgon the command line, even when the '-f' option is present.  This is contrary
273506ef0fecSmrgto the behaviour of most rm programs out there, and not conforming with
273606ef0fecSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737320e696bSmrg
273806ef0fecSmrgPlease tell bug-automake@gnu.org about your system, including the value
273906ef0fecSmrgof your $PATH and any error possibly output before this message.  This
274006ef0fecSmrgcan help us improve future automake versions.
2741320e696bSmrg
274206ef0fecSmrgEND
274306ef0fecSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
274406ef0fecSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
274506ef0fecSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
274606ef0fecSmrg    echo >&2
274706ef0fecSmrg  else
274806ef0fecSmrg    cat >&2 <<'END'
274906ef0fecSmrgAborting the configuration process, to ensure you take notice of the issue.
2750afe13c8eSmrg
275106ef0fecSmrgYou can download and install GNU coreutils to get an 'rm' implementation
275206ef0fecSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
27535e358ecaSmrg
275406ef0fecSmrgIf you want to complete the configuration process using your problematic
275506ef0fecSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
275606ef0fecSmrgto "yes", and re-run configure.
275706ef0fecSmrg
275806ef0fecSmrgEND
275906ef0fecSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
276006ef0fecSmrg  fi
2761b3307321Smrgfi
276206ef0fecSmrgdnl The trailing newline in this macro's definition is deliberate, for
276306ef0fecSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
276406ef0fecSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
276506ef0fecSmrg])
2766b3307321Smrg
276706ef0fecSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
276806ef0fecSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
276906ef0fecSmrgdnl mangled by Autoconf and run in a shell conditional statement.
277006ef0fecSmrgm4_define([_AC_COMPILER_EXEEXT],
277106ef0fecSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27725e358ecaSmrg
277306ef0fecSmrg# When config.status generates a header, we must update the stamp-h file.
277406ef0fecSmrg# This file resides in the same directory as the config header
277506ef0fecSmrg# that is generated.  The stamp files are numbered to have different names.
2776b3307321Smrg
277706ef0fecSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
277806ef0fecSmrg# loop where config.status creates the headers, so we can generate
277906ef0fecSmrg# our stamp files there.
278006ef0fecSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
278106ef0fecSmrg[# Compute $1's index in $config_headers.
278206ef0fecSmrg_am_arg=$1
278306ef0fecSmrg_am_stamp_count=1
278406ef0fecSmrgfor _am_header in $config_headers :; do
278506ef0fecSmrg  case $_am_header in
278606ef0fecSmrg    $_am_arg | $_am_arg:* )
278706ef0fecSmrg      break ;;
278806ef0fecSmrg    * )
278906ef0fecSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
279006ef0fecSmrg  esac
279106ef0fecSmrgdone
279206ef0fecSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
279329cb5710Smrg
279406ef0fecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
279506ef0fecSmrg#
279606ef0fecSmrg# This file is free software; the Free Software Foundation
279706ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
279806ef0fecSmrg# with or without modifications, as long as this notice is preserved.
279929cb5710Smrg
280006ef0fecSmrg# AM_PROG_INSTALL_SH
280106ef0fecSmrg# ------------------
280206ef0fecSmrg# Define $install_sh.
280306ef0fecSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
280406ef0fecSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
280506ef0fecSmrgif test x"${install_sh+set}" != xset; then
280606ef0fecSmrg  case $am_aux_dir in
280706ef0fecSmrg  *\ * | *\	*)
280806ef0fecSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
280906ef0fecSmrg  *)
281006ef0fecSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
281106ef0fecSmrg  esac
28125e358ecaSmrgfi
281306ef0fecSmrgAC_SUBST([install_sh])])
281429cb5710Smrg
281506ef0fecSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
281606ef0fecSmrg#
281706ef0fecSmrg# This file is free software; the Free Software Foundation
281806ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
281906ef0fecSmrg# with or without modifications, as long as this notice is preserved.
2820b3307321Smrg
282106ef0fecSmrg# Check whether the underlying file-system supports filenames
282206ef0fecSmrg# with a leading dot.  For instance MS-DOS doesn't.
282306ef0fecSmrgAC_DEFUN([AM_SET_LEADING_DOT],
282406ef0fecSmrg[rm -rf .tst 2>/dev/null
282506ef0fecSmrgmkdir .tst 2>/dev/null
282606ef0fecSmrgif test -d .tst; then
282706ef0fecSmrg  am__leading_dot=.
282806ef0fecSmrgelse
282906ef0fecSmrg  am__leading_dot=_
283006ef0fecSmrgfi
283106ef0fecSmrgrmdir .tst 2>/dev/null
283206ef0fecSmrgAC_SUBST([am__leading_dot])])
2833b3307321Smrg
283406ef0fecSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835b3307321Smrg
283606ef0fecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
28375e358ecaSmrg#
283806ef0fecSmrg# This file is free software; the Free Software Foundation
283906ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
284006ef0fecSmrg# with or without modifications, as long as this notice is preserved.
284129cb5710Smrg
284206ef0fecSmrg# AM_MAKE_INCLUDE()
284306ef0fecSmrg# -----------------
284406ef0fecSmrg# Check to see how make treats includes.
284506ef0fecSmrgAC_DEFUN([AM_MAKE_INCLUDE],
284606ef0fecSmrg[am_make=${MAKE-make}
284706ef0fecSmrgcat > confinc << 'END'
284806ef0fecSmrgam__doit:
284906ef0fecSmrg	@echo this is the am__doit target
285006ef0fecSmrg.PHONY: am__doit
285106ef0fecSmrgEND
285206ef0fecSmrg# If we don't find an include directive, just comment out the code.
285306ef0fecSmrgAC_MSG_CHECKING([for style of include used by $am_make])
285406ef0fecSmrgam__include="#"
285506ef0fecSmrgam__quote=
285606ef0fecSmrg_am_result=none
285706ef0fecSmrg# First try GNU make style include.
285806ef0fecSmrgecho "include confinc" > confmf
285906ef0fecSmrg# Ignore all kinds of additional output from 'make'.
286006ef0fecSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
286106ef0fecSmrg*the\ am__doit\ target*)
286206ef0fecSmrg  am__include=include
286306ef0fecSmrg  am__quote=
286406ef0fecSmrg  _am_result=GNU
286506ef0fecSmrg  ;;
286606ef0fecSmrgesac
286706ef0fecSmrg# Now try BSD make style include.
286806ef0fecSmrgif test "$am__include" = "#"; then
286906ef0fecSmrg   echo '.include "confinc"' > confmf
287006ef0fecSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
287106ef0fecSmrg   *the\ am__doit\ target*)
287206ef0fecSmrg     am__include=.include
287306ef0fecSmrg     am__quote="\""
287406ef0fecSmrg     _am_result=BSD
287506ef0fecSmrg     ;;
287606ef0fecSmrg   esac
28775e358ecaSmrgfi
287806ef0fecSmrgAC_SUBST([am__include])
287906ef0fecSmrgAC_SUBST([am__quote])
288006ef0fecSmrgAC_MSG_RESULT([$_am_result])
288106ef0fecSmrgrm -f confinc confmf
288206ef0fecSmrg])
288329cb5710Smrg
288406ef0fecSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885320e696bSmrg
288606ef0fecSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887320e696bSmrg#
288806ef0fecSmrg# This file is free software; the Free Software Foundation
288906ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
289006ef0fecSmrg# with or without modifications, as long as this notice is preserved.
289174a3f230Smrg
289206ef0fecSmrg# AM_MISSING_PROG(NAME, PROGRAM)
289306ef0fecSmrg# ------------------------------
289406ef0fecSmrgAC_DEFUN([AM_MISSING_PROG],
289506ef0fecSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
289606ef0fecSmrg$1=${$1-"${am_missing_run}$2"}
289706ef0fecSmrgAC_SUBST($1)])
2898320e696bSmrg
289906ef0fecSmrg# AM_MISSING_HAS_RUN
290006ef0fecSmrg# ------------------
290106ef0fecSmrg# Define MISSING if not defined so far and test if it is modern enough.
290206ef0fecSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
290306ef0fecSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
290406ef0fecSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
290506ef0fecSmrgAC_REQUIRE_AUX_FILE([missing])dnl
290606ef0fecSmrgif test x"${MISSING+set}" != xset; then
290706ef0fecSmrg  case $am_aux_dir in
290806ef0fecSmrg  *\ * | *\	*)
290906ef0fecSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
291006ef0fecSmrg  *)
291106ef0fecSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
291206ef0fecSmrg  esac
2913320e696bSmrgfi
291406ef0fecSmrg# Use eval to expand $SHELL
291506ef0fecSmrgif eval "$MISSING --is-lightweight"; then
291606ef0fecSmrg  am_missing_run="$MISSING "
291706ef0fecSmrgelse
291806ef0fecSmrg  am_missing_run=
291906ef0fecSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2920320e696bSmrgfi
292106ef0fecSmrg])
2922320e696bSmrg
292306ef0fecSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2924320e696bSmrg
292506ef0fecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292606ef0fecSmrg#
292706ef0fecSmrg# This file is free software; the Free Software Foundation
292806ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
292906ef0fecSmrg# with or without modifications, as long as this notice is preserved.
2930320e696bSmrg
293106ef0fecSmrg# _AM_MANGLE_OPTION(NAME)
293206ef0fecSmrg# -----------------------
293306ef0fecSmrgAC_DEFUN([_AM_MANGLE_OPTION],
293406ef0fecSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935320e696bSmrg
293606ef0fecSmrg# _AM_SET_OPTION(NAME)
293706ef0fecSmrg# --------------------
293806ef0fecSmrg# Set option NAME.  Presently that only means defining a flag for this option.
293906ef0fecSmrgAC_DEFUN([_AM_SET_OPTION],
294006ef0fecSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941320e696bSmrg
294206ef0fecSmrg# _AM_SET_OPTIONS(OPTIONS)
294306ef0fecSmrg# ------------------------
294406ef0fecSmrg# OPTIONS is a space-separated list of Automake options.
294506ef0fecSmrgAC_DEFUN([_AM_SET_OPTIONS],
294606ef0fecSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947320e696bSmrg
294806ef0fecSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
294906ef0fecSmrg# -------------------------------------------
295006ef0fecSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
295106ef0fecSmrgAC_DEFUN([_AM_IF_OPTION],
295206ef0fecSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953320e696bSmrg
295406ef0fecSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955320e696bSmrg#
295606ef0fecSmrg# This file is free software; the Free Software Foundation
295706ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
295806ef0fecSmrg# with or without modifications, as long as this notice is preserved.
2959320e696bSmrg
296006ef0fecSmrg# _AM_PROG_CC_C_O
296106ef0fecSmrg# ---------------
296206ef0fecSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
296306ef0fecSmrg# to automatically call this.
296406ef0fecSmrgAC_DEFUN([_AM_PROG_CC_C_O],
296506ef0fecSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
296606ef0fecSmrgAC_REQUIRE_AUX_FILE([compile])dnl
296706ef0fecSmrgAC_LANG_PUSH([C])dnl
296806ef0fecSmrgAC_CACHE_CHECK(
296906ef0fecSmrg  [whether $CC understands -c and -o together],
297006ef0fecSmrg  [am_cv_prog_cc_c_o],
297106ef0fecSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
297206ef0fecSmrg  # Make sure it works both with $CC and with simple cc.
297306ef0fecSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
297406ef0fecSmrg  # compilers refuse to overwrite an existing .o file with -o,
297506ef0fecSmrg  # though they will create one.
297606ef0fecSmrg  am_cv_prog_cc_c_o=yes
297706ef0fecSmrg  for am_i in 1 2; do
297806ef0fecSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
297906ef0fecSmrg         && test -f conftest2.$ac_objext; then
298006ef0fecSmrg      : OK
298106ef0fecSmrg    else
298206ef0fecSmrg      am_cv_prog_cc_c_o=no
298306ef0fecSmrg      break
298406ef0fecSmrg    fi
298506ef0fecSmrg  done
298606ef0fecSmrg  rm -f core conftest*
298706ef0fecSmrg  unset am_i])
298806ef0fecSmrgif test "$am_cv_prog_cc_c_o" != yes; then
298906ef0fecSmrg   # Losing compiler, so override with the script.
299006ef0fecSmrg   # FIXME: It is wrong to rewrite CC.
299106ef0fecSmrg   # But if we don't then we get into trouble of one sort or another.
299206ef0fecSmrg   # A longer-term fix would be to have automake use am__CC in this case,
299306ef0fecSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
299406ef0fecSmrg   CC="$am_aux_dir/compile $CC"
2995320e696bSmrgfi
299606ef0fecSmrgAC_LANG_POP([C])])
2997320e696bSmrg
299806ef0fecSmrg# For backward compatibility.
299906ef0fecSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
300006ef0fecSmrg
300106ef0fecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
300206ef0fecSmrg#
300306ef0fecSmrg# This file is free software; the Free Software Foundation
300406ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
300506ef0fecSmrg# with or without modifications, as long as this notice is preserved.
300606ef0fecSmrg
300706ef0fecSmrg# AM_RUN_LOG(COMMAND)
300806ef0fecSmrg# -------------------
300906ef0fecSmrg# Run COMMAND, save the exit status in ac_status, and log it.
301006ef0fecSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
301106ef0fecSmrgAC_DEFUN([AM_RUN_LOG],
301206ef0fecSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
301306ef0fecSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
301406ef0fecSmrg   ac_status=$?
301506ef0fecSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
301606ef0fecSmrg   (exit $ac_status); }])
301774a3f230Smrg
301806ef0fecSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019320e696bSmrg
302006ef0fecSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
302106ef0fecSmrg#
302206ef0fecSmrg# This file is free software; the Free Software Foundation
302306ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
302406ef0fecSmrg# with or without modifications, as long as this notice is preserved.
3025320e696bSmrg
302606ef0fecSmrg# AM_SANITY_CHECK
302706ef0fecSmrg# ---------------
302806ef0fecSmrgAC_DEFUN([AM_SANITY_CHECK],
302906ef0fecSmrg[AC_MSG_CHECKING([whether build environment is sane])
303006ef0fecSmrg# Reject unsafe characters in $srcdir or the absolute working directory
303106ef0fecSmrg# name.  Accept space and tab only in the latter.
303206ef0fecSmrgam_lf='
303306ef0fecSmrg'
303406ef0fecSmrgcase `pwd` in
303506ef0fecSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
303606ef0fecSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
303706ef0fecSmrgesac
303806ef0fecSmrgcase $srcdir in
303906ef0fecSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
304006ef0fecSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
304106ef0fecSmrgesac
3042320e696bSmrg
304306ef0fecSmrg# Do 'set' in a subshell so we don't clobber the current shell's
304406ef0fecSmrg# arguments.  Must try -L first in case configure is actually a
304506ef0fecSmrg# symlink; some systems play weird games with the mod time of symlinks
304606ef0fecSmrg# (eg FreeBSD returns the mod time of the symlink's containing
304706ef0fecSmrg# directory).
304806ef0fecSmrgif (
304906ef0fecSmrg   am_has_slept=no
305006ef0fecSmrg   for am_try in 1 2; do
305106ef0fecSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
305206ef0fecSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
305306ef0fecSmrg     if test "$[*]" = "X"; then
305406ef0fecSmrg	# -L didn't work.
305506ef0fecSmrg	set X `ls -t "$srcdir/configure" conftest.file`
305606ef0fecSmrg     fi
305706ef0fecSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
305806ef0fecSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059320e696bSmrg
306006ef0fecSmrg	# If neither matched, then we have a broken ls.  This can happen
306106ef0fecSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
306206ef0fecSmrg	# broken ls alias from the environment.  This has actually
306306ef0fecSmrg	# happened.  Such a system could not be considered "sane".
306406ef0fecSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
306506ef0fecSmrg  alias in your environment])
306606ef0fecSmrg     fi
306706ef0fecSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
306806ef0fecSmrg       break
306906ef0fecSmrg     fi
307006ef0fecSmrg     # Just in case.
307106ef0fecSmrg     sleep 1
307206ef0fecSmrg     am_has_slept=yes
307306ef0fecSmrg   done
307406ef0fecSmrg   test "$[2]" = conftest.file
307506ef0fecSmrg   )
307606ef0fecSmrgthen
307706ef0fecSmrg   # Ok.
307806ef0fecSmrg   :
3079320e696bSmrgelse
308006ef0fecSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
308106ef0fecSmrgCheck your system clock])
308274a3f230Smrgfi
308306ef0fecSmrgAC_MSG_RESULT([yes])
308406ef0fecSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
308506ef0fecSmrg# generated files are strictly newer.
308606ef0fecSmrgam_sleep_pid=
308706ef0fecSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
308806ef0fecSmrg  ( sleep 1 ) &
308906ef0fecSmrg  am_sleep_pid=$!
309006ef0fecSmrgfi
309106ef0fecSmrgAC_CONFIG_COMMANDS_PRE(
309206ef0fecSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
309306ef0fecSmrg   if test -n "$am_sleep_pid"; then
309406ef0fecSmrg     # Hide warnings about reused PIDs.
309506ef0fecSmrg     wait $am_sleep_pid 2>/dev/null
309606ef0fecSmrg   fi
309706ef0fecSmrg   AC_MSG_RESULT([done])])
309806ef0fecSmrgrm -f conftest.file
309906ef0fecSmrg])
310074a3f230Smrg
310106ef0fecSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102320e696bSmrg#
310306ef0fecSmrg# This file is free software; the Free Software Foundation
310406ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
310506ef0fecSmrg# with or without modifications, as long as this notice is preserved.
3106b3307321Smrg
310706ef0fecSmrg# AM_SILENT_RULES([DEFAULT])
310806ef0fecSmrg# --------------------------
310906ef0fecSmrg# Enable less verbose build rules; with the default set to DEFAULT
311006ef0fecSmrg# ("yes" being less verbose, "no" or empty being verbose).
311106ef0fecSmrgAC_DEFUN([AM_SILENT_RULES],
311206ef0fecSmrg[AC_ARG_ENABLE([silent-rules], [dnl
311306ef0fecSmrgAS_HELP_STRING(
311406ef0fecSmrg  [--enable-silent-rules],
311506ef0fecSmrg  [less verbose build output (undo: "make V=1")])
311606ef0fecSmrgAS_HELP_STRING(
311706ef0fecSmrg  [--disable-silent-rules],
311806ef0fecSmrg  [verbose build output (undo: "make V=0")])dnl
311906ef0fecSmrg])
312006ef0fecSmrgcase $enable_silent_rules in @%:@ (((
312106ef0fecSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
312206ef0fecSmrg   no) AM_DEFAULT_VERBOSITY=1;;
312306ef0fecSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
312406ef0fecSmrgesac
312506ef0fecSmrgdnl
312606ef0fecSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
312706ef0fecSmrgdnl do not support nested variable expansions.
312806ef0fecSmrgdnl See automake bug#9928 and bug#10237.
312906ef0fecSmrgam_make=${MAKE-make}
313006ef0fecSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
313106ef0fecSmrg   [am_cv_make_support_nested_variables],
313206ef0fecSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
313306ef0fecSmrgBAR0=false
313406ef0fecSmrgBAR1=true
313506ef0fecSmrgV=1
313606ef0fecSmrgam__doit:
313706ef0fecSmrg	@$(TRUE)
313806ef0fecSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
313906ef0fecSmrg  am_cv_make_support_nested_variables=yes
314006ef0fecSmrgelse
314106ef0fecSmrg  am_cv_make_support_nested_variables=no
314206ef0fecSmrgfi])
314306ef0fecSmrgif test $am_cv_make_support_nested_variables = yes; then
314406ef0fecSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
314506ef0fecSmrg  AM_V='$(V)'
314606ef0fecSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
314706ef0fecSmrgelse
314806ef0fecSmrg  AM_V=$AM_DEFAULT_VERBOSITY
314906ef0fecSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
315006ef0fecSmrgfi
315106ef0fecSmrgAC_SUBST([AM_V])dnl
315206ef0fecSmrgAM_SUBST_NOTMAKE([AM_V])dnl
315306ef0fecSmrgAC_SUBST([AM_DEFAULT_V])dnl
315406ef0fecSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
315506ef0fecSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
315606ef0fecSmrgAM_BACKSLASH='\'
315706ef0fecSmrgAC_SUBST([AM_BACKSLASH])dnl
315806ef0fecSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
315906ef0fecSmrg])
316006ef0fecSmrg
316106ef0fecSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162320e696bSmrg#
316306ef0fecSmrg# This file is free software; the Free Software Foundation
316406ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
316506ef0fecSmrg# with or without modifications, as long as this notice is preserved.
316606ef0fecSmrg
316706ef0fecSmrg# AM_PROG_INSTALL_STRIP
316806ef0fecSmrg# ---------------------
316906ef0fecSmrg# One issue with vendor 'install' (even GNU) is that you can't
317006ef0fecSmrg# specify the program used to strip binaries.  This is especially
317106ef0fecSmrg# annoying in cross-compiling environments, where the build's strip
317206ef0fecSmrg# is unlikely to handle the host's binaries.
317306ef0fecSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
317406ef0fecSmrg# always use install-sh in "make install-strip", and initialize
317506ef0fecSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
317606ef0fecSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
317706ef0fecSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
317806ef0fecSmrg# Installed binaries are usually stripped using 'strip' when the user
317906ef0fecSmrg# run "make install-strip".  However 'strip' might not be the right
318006ef0fecSmrg# tool to use in cross-compilation environments, therefore Automake
318106ef0fecSmrg# will honor the 'STRIP' environment variable to overrule this program.
318206ef0fecSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
318306ef0fecSmrgif test "$cross_compiling" != no; then
318406ef0fecSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
318506ef0fecSmrgfi
318606ef0fecSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
318706ef0fecSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31885e358ecaSmrg
318906ef0fecSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
319006ef0fecSmrg#
319106ef0fecSmrg# This file is free software; the Free Software Foundation
319206ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
319306ef0fecSmrg# with or without modifications, as long as this notice is preserved.
3194320e696bSmrg
319506ef0fecSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
319606ef0fecSmrg# ---------------------------
319706ef0fecSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
319806ef0fecSmrg# This macro is traced by Automake.
319906ef0fecSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
320074a3f230Smrg
320106ef0fecSmrg# AM_SUBST_NOTMAKE(VARIABLE)
320206ef0fecSmrg# --------------------------
320306ef0fecSmrg# Public sister of _AM_SUBST_NOTMAKE.
320406ef0fecSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205320e696bSmrg
320606ef0fecSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3207320e696bSmrg
320806ef0fecSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
320906ef0fecSmrg#
321006ef0fecSmrg# This file is free software; the Free Software Foundation
321106ef0fecSmrg# gives unlimited permission to copy and/or distribute it,
321206ef0fecSmrg# with or without modifications, as long as this notice is preserved.
3213b3307321Smrg
321406ef0fecSmrg# _AM_PROG_TAR(FORMAT)
32155e358ecaSmrg# --------------------
321606ef0fecSmrg# Check how to create a tarball in format FORMAT.
321706ef0fecSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32185e358ecaSmrg#
321906ef0fecSmrg# Substitute a variable $(am__tar) that is a command
322006ef0fecSmrg# writing to stdout a FORMAT-tarball containing the directory
322106ef0fecSmrg# $tardir.
322206ef0fecSmrg#     tardir=directory && $(am__tar) > result.tar
322329cb5710Smrg#
322406ef0fecSmrg# Substitute a variable $(am__untar) that extract such
322506ef0fecSmrg# a tarball read from stdin.
322606ef0fecSmrg#     $(am__untar) < result.tar
322729cb5710Smrg#
322806ef0fecSmrgAC_DEFUN([_AM_PROG_TAR],
322906ef0fecSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
323006ef0fecSmrg# in the wild :-(  We should find a proper way to deprecate it ...
323106ef0fecSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232b3307321Smrg
323306ef0fecSmrg# We'll loop over all known methods to create a tar archive until one works.
323406ef0fecSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235b3307321Smrg
323606ef0fecSmrgm4_if([$1], [v7],
323706ef0fecSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
323806ef0fecSmrg
323906ef0fecSmrg  [m4_case([$1],
324006ef0fecSmrg    [ustar],
324106ef0fecSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
324206ef0fecSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
324306ef0fecSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
324406ef0fecSmrg      # and bug#13588).
324506ef0fecSmrg      am_max_uid=2097151 # 2^21 - 1
324606ef0fecSmrg      am_max_gid=$am_max_uid
324706ef0fecSmrg      # The $UID and $GID variables are not portable, so we need to resort
324806ef0fecSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
324906ef0fecSmrg      # below are definitely unexpected, so allow the users to see them
325006ef0fecSmrg      # (that is, avoid stderr redirection).
325106ef0fecSmrg      am_uid=`id -u || echo unknown`
325206ef0fecSmrg      am_gid=`id -g || echo unknown`
325306ef0fecSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
325406ef0fecSmrg      if test $am_uid -le $am_max_uid; then
325506ef0fecSmrg         AC_MSG_RESULT([yes])
325606ef0fecSmrg      else
325706ef0fecSmrg         AC_MSG_RESULT([no])
325806ef0fecSmrg         _am_tools=none
325906ef0fecSmrg      fi
326006ef0fecSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
326106ef0fecSmrg      if test $am_gid -le $am_max_gid; then
326206ef0fecSmrg         AC_MSG_RESULT([yes])
326306ef0fecSmrg      else
326406ef0fecSmrg        AC_MSG_RESULT([no])
326506ef0fecSmrg        _am_tools=none
326606ef0fecSmrg      fi],
326706ef0fecSmrg
326806ef0fecSmrg  [pax],
326906ef0fecSmrg    [],
327006ef0fecSmrg
327106ef0fecSmrg  [m4_fatal([Unknown tar format])])
327206ef0fecSmrg
327306ef0fecSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
327406ef0fecSmrg
327506ef0fecSmrg  # Go ahead even if we have the value already cached.  We do so because we
327606ef0fecSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
327706ef0fecSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
327806ef0fecSmrg
327906ef0fecSmrg  for _am_tool in $_am_tools; do
328006ef0fecSmrg    case $_am_tool in
328106ef0fecSmrg    gnutar)
328206ef0fecSmrg      for _am_tar in tar gnutar gtar; do
328306ef0fecSmrg        AM_RUN_LOG([$_am_tar --version]) && break
328406ef0fecSmrg      done
328506ef0fecSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
328606ef0fecSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
328706ef0fecSmrg      am__untar="$_am_tar -xf -"
328806ef0fecSmrg      ;;
328906ef0fecSmrg    plaintar)
329006ef0fecSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
329106ef0fecSmrg      # ustar tarball either.
329206ef0fecSmrg      (tar --version) >/dev/null 2>&1 && continue
329306ef0fecSmrg      am__tar='tar chf - "$$tardir"'
329406ef0fecSmrg      am__tar_='tar chf - "$tardir"'
329506ef0fecSmrg      am__untar='tar xf -'
329606ef0fecSmrg      ;;
329706ef0fecSmrg    pax)
329806ef0fecSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
329906ef0fecSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
330006ef0fecSmrg      am__untar='pax -r'
330106ef0fecSmrg      ;;
330206ef0fecSmrg    cpio)
330306ef0fecSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
330406ef0fecSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
330506ef0fecSmrg      am__untar='cpio -i -H $1 -d'
330606ef0fecSmrg      ;;
330706ef0fecSmrg    none)
330806ef0fecSmrg      am__tar=false
330906ef0fecSmrg      am__tar_=false
331006ef0fecSmrg      am__untar=false
331106ef0fecSmrg      ;;
331206ef0fecSmrg    esac
331306ef0fecSmrg
331406ef0fecSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
331506ef0fecSmrg    # and am__untar set.
331606ef0fecSmrg    test -n "${am_cv_prog_tar_$1}" && break
331706ef0fecSmrg
331806ef0fecSmrg    # tar/untar a dummy directory, and stop if the command works.
331906ef0fecSmrg    rm -rf conftest.dir
332006ef0fecSmrg    mkdir conftest.dir
332106ef0fecSmrg    echo GrepMe > conftest.dir/file
332206ef0fecSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
332306ef0fecSmrg    rm -rf conftest.dir
332406ef0fecSmrg    if test -s conftest.tar; then
332506ef0fecSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
332606ef0fecSmrg      AM_RUN_LOG([cat conftest.dir/file])
332706ef0fecSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
332806ef0fecSmrg    fi
332906ef0fecSmrg  done
333006ef0fecSmrg  rm -rf conftest.dir
333106ef0fecSmrg
333206ef0fecSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
333306ef0fecSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
333406ef0fecSmrg
333506ef0fecSmrgAC_SUBST([am__tar])
333606ef0fecSmrgAC_SUBST([am__untar])
333706ef0fecSmrg]) # _AM_PROG_TAR
3338b3307321Smrg
3339