aclocal.m4 revision 11a95ff3
1b91640d3Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2b91640d3Smrg
3b91640d3Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4a6d9b409Smrg
5a6d9b409Smrg# This file is free software; the Free Software Foundation
6a6d9b409Smrg# gives unlimited permission to copy and/or distribute it,
7a6d9b409Smrg# with or without modifications, as long as this notice is preserved.
8a6d9b409Smrg
9a6d9b409Smrg# This program is distributed in the hope that it will be useful,
10a6d9b409Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a6d9b409Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a6d9b409Smrg# PARTICULAR PURPOSE.
13a6d9b409Smrg
14b91640d3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15efda2da8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16efda2da8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17b91640d3Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18b91640d3Smrg[m4_warning([this file was generated for autoconf 2.69.
19efda2da8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20efda2da8SmrgIf you have problems, you may need to regenerate the build system entirely.
21b91640d3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a6d9b409Smrg
2311a95ff3Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2411a95ff3Smrg# serial 1 (pkg-config-0.24)
2511a95ff3Smrg# 
2611a95ff3Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27a6d9b409Smrg#
2811a95ff3Smrg# This program is free software; you can redistribute it and/or modify
2911a95ff3Smrg# it under the terms of the GNU General Public License as published by
3011a95ff3Smrg# the Free Software Foundation; either version 2 of the License, or
3111a95ff3Smrg# (at your option) any later version.
3211a95ff3Smrg#
3311a95ff3Smrg# This program is distributed in the hope that it will be useful, but
3411a95ff3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
3511a95ff3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3611a95ff3Smrg# General Public License for more details.
3711a95ff3Smrg#
3811a95ff3Smrg# You should have received a copy of the GNU General Public License
3911a95ff3Smrg# along with this program; if not, write to the Free Software
4011a95ff3Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4111a95ff3Smrg#
4211a95ff3Smrg# As a special exception to the GNU General Public License, if you
4311a95ff3Smrg# distribute this file as part of a program that contains a
4411a95ff3Smrg# configuration script generated by Autoconf, you may include it under
4511a95ff3Smrg# the same distribution terms that you use for the rest of that program.
46a6d9b409Smrg
4711a95ff3Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
4811a95ff3Smrg# ----------------------------------
4911a95ff3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
5011a95ff3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
5111a95ff3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
5211a95ff3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
5311a95ff3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
5411a95ff3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
5511a95ff3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
56a6d9b409Smrg
5711a95ff3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
5811a95ff3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
5911a95ff3Smrgfi
6011a95ff3Smrgif test -n "$PKG_CONFIG"; then
6111a95ff3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
6211a95ff3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
6311a95ff3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
6411a95ff3Smrg		AC_MSG_RESULT([yes])
6511a95ff3Smrg	else
6611a95ff3Smrg		AC_MSG_RESULT([no])
6711a95ff3Smrg		PKG_CONFIG=""
6811a95ff3Smrg	fi
6911a95ff3Smrgfi[]dnl
7011a95ff3Smrg])# PKG_PROG_PKG_CONFIG
71a6d9b409Smrg
7211a95ff3Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
7311a95ff3Smrg#
7411a95ff3Smrg# Check to see whether a particular set of modules exists.  Similar
7511a95ff3Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
7611a95ff3Smrg#
7711a95ff3Smrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
7811a95ff3Smrg# only at the first occurence in configure.ac, so if the first place
7911a95ff3Smrg# it's called might be skipped (such as if it is within an "if", you
8011a95ff3Smrg# have to call PKG_CHECK_EXISTS manually
8111a95ff3Smrg# --------------------------------------------------------------
8211a95ff3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
8311a95ff3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
8411a95ff3Smrgif test -n "$PKG_CONFIG" && \
8511a95ff3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
8611a95ff3Smrg  m4_default([$2], [:])
8711a95ff3Smrgm4_ifvaln([$3], [else
8811a95ff3Smrg  $3])dnl
8911a95ff3Smrgfi])
90a6d9b409Smrg
9111a95ff3Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
9211a95ff3Smrg# ---------------------------------------------
9311a95ff3Smrgm4_define([_PKG_CONFIG],
9411a95ff3Smrg[if test -n "$$1"; then
9511a95ff3Smrg    pkg_cv_[]$1="$$1"
9611a95ff3Smrg elif test -n "$PKG_CONFIG"; then
9711a95ff3Smrg    PKG_CHECK_EXISTS([$3],
9811a95ff3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
9911a95ff3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
10011a95ff3Smrg		     [pkg_failed=yes])
10111a95ff3Smrg else
10211a95ff3Smrg    pkg_failed=untried
10311a95ff3Smrgfi[]dnl
10411a95ff3Smrg])# _PKG_CONFIG
105a6d9b409Smrg
10611a95ff3Smrg# _PKG_SHORT_ERRORS_SUPPORTED
10711a95ff3Smrg# -----------------------------
10811a95ff3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
10911a95ff3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11011a95ff3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11111a95ff3Smrg        _pkg_short_errors_supported=yes
11211a95ff3Smrgelse
11311a95ff3Smrg        _pkg_short_errors_supported=no
11411a95ff3Smrgfi[]dnl
11511a95ff3Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
116a6d9b409Smrg
11711a95ff3Smrg
11811a95ff3Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11911a95ff3Smrg# [ACTION-IF-NOT-FOUND])
120a6d9b409Smrg#
121a6d9b409Smrg#
12211a95ff3Smrg# Note that if there is a possibility the first call to
12311a95ff3Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12411a95ff3Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125a6d9b409Smrg#
126a6d9b409Smrg#
12711a95ff3Smrg# --------------------------------------------------------------
12811a95ff3SmrgAC_DEFUN([PKG_CHECK_MODULES],
12911a95ff3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13011a95ff3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
13111a95ff3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
132a6d9b409Smrg
13311a95ff3Smrgpkg_failed=no
13411a95ff3SmrgAC_MSG_CHECKING([for $1])
135a6d9b409Smrg
13611a95ff3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
13711a95ff3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138a6d9b409Smrg
13911a95ff3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
14011a95ff3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
14111a95ff3SmrgSee the pkg-config man page for more details.])
142a6d9b409Smrg
14311a95ff3Smrgif test $pkg_failed = yes; then
14411a95ff3Smrg   	AC_MSG_RESULT([no])
14511a95ff3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
14611a95ff3Smrg        if test $_pkg_short_errors_supported = yes; then
14711a95ff3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
14811a95ff3Smrg        else 
14911a95ff3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
15011a95ff3Smrg        fi
15111a95ff3Smrg	# Put the nasty error message in config.log where it belongs
15211a95ff3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
153a6d9b409Smrg
15411a95ff3Smrg	m4_default([$4], [AC_MSG_ERROR(
15511a95ff3Smrg[Package requirements ($2) were not met:
156a6d9b409Smrg
15711a95ff3Smrg$$1_PKG_ERRORS
158a6d9b409Smrg
15911a95ff3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
16011a95ff3Smrginstalled software in a non-standard prefix.
161a6d9b409Smrg
16211a95ff3Smrg_PKG_TEXT])[]dnl
16311a95ff3Smrg        ])
16411a95ff3Smrgelif test $pkg_failed = untried; then
16511a95ff3Smrg     	AC_MSG_RESULT([no])
16611a95ff3Smrg	m4_default([$4], [AC_MSG_FAILURE(
16711a95ff3Smrg[The pkg-config script could not be found or is too old.  Make sure it
16811a95ff3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
16911a95ff3Smrgpath to pkg-config.
170a6d9b409Smrg
17111a95ff3Smrg_PKG_TEXT
172a6d9b409Smrg
17311a95ff3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
17411a95ff3Smrg        ])
17511a95ff3Smrgelse
17611a95ff3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
17711a95ff3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
17811a95ff3Smrg        AC_MSG_RESULT([yes])
17911a95ff3Smrg	$3
18011a95ff3Smrgfi[]dnl
18111a95ff3Smrg])# PKG_CHECK_MODULES
182a6d9b409Smrg
183a6d9b409Smrg
18411a95ff3Smrg# PKG_INSTALLDIR(DIRECTORY)
18511a95ff3Smrg# -------------------------
18611a95ff3Smrg# Substitutes the variable pkgconfigdir as the location where a module
18711a95ff3Smrg# should install pkg-config .pc files. By default the directory is
18811a95ff3Smrg# $libdir/pkgconfig, but the default can be changed by passing
18911a95ff3Smrg# DIRECTORY. The user can override through the --with-pkgconfigdir
19011a95ff3Smrg# parameter.
19111a95ff3SmrgAC_DEFUN([PKG_INSTALLDIR],
19211a95ff3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
19311a95ff3Smrgm4_pushdef([pkg_description],
19411a95ff3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
19511a95ff3SmrgAC_ARG_WITH([pkgconfigdir],
19611a95ff3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
19711a95ff3Smrg    [with_pkgconfigdir=]pkg_default)
19811a95ff3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
19911a95ff3Smrgm4_popdef([pkg_default])
20011a95ff3Smrgm4_popdef([pkg_description])
20111a95ff3Smrg]) dnl PKG_INSTALLDIR
20211a95ff3Smrg
20311a95ff3Smrg
20411a95ff3Smrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
20511a95ff3Smrg# -------------------------
20611a95ff3Smrg# Substitutes the variable noarch_pkgconfigdir as the location where a
20711a95ff3Smrg# module should install arch-independent pkg-config .pc files. By
20811a95ff3Smrg# default the directory is $datadir/pkgconfig, but the default can be
20911a95ff3Smrg# changed by passing DIRECTORY. The user can override through the
21011a95ff3Smrg# --with-noarch-pkgconfigdir parameter.
21111a95ff3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
21211a95ff3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
21311a95ff3Smrgm4_pushdef([pkg_description],
21411a95ff3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
21511a95ff3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
21611a95ff3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
21711a95ff3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
21811a95ff3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
21911a95ff3Smrgm4_popdef([pkg_default])
22011a95ff3Smrgm4_popdef([pkg_description])
22111a95ff3Smrg]) dnl PKG_NOARCH_INSTALLDIR
22211a95ff3Smrg
22311a95ff3Smrg
22411a95ff3Smrg# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
22511a95ff3Smrg# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
22611a95ff3Smrg# -------------------------------------------
22711a95ff3Smrg# Retrieves the value of the pkg-config variable for the given module.
22811a95ff3SmrgAC_DEFUN([PKG_CHECK_VAR],
22911a95ff3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23011a95ff3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
231a6d9b409Smrg
23211a95ff3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
23311a95ff3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
234a6d9b409Smrg
23511a95ff3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
23611a95ff3Smrg])# PKG_CHECK_VAR
237a6d9b409Smrg
23811a95ff3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
23911a95ff3Smrgdnl
24011a95ff3Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
24111a95ff3Smrgdnl
24211a95ff3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
24311a95ff3Smrgdnl copy of this software and associated documentation files (the "Software"),
24411a95ff3Smrgdnl to deal in the Software without restriction, including without limitation
24511a95ff3Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
24611a95ff3Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
24711a95ff3Smrgdnl Software is furnished to do so, subject to the following conditions:
24811a95ff3Smrgdnl
24911a95ff3Smrgdnl The above copyright notice and this permission notice (including the next
25011a95ff3Smrgdnl paragraph) shall be included in all copies or substantial portions of the
25111a95ff3Smrgdnl Software.
25211a95ff3Smrgdnl
25311a95ff3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25411a95ff3Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25511a95ff3Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
25611a95ff3Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25711a95ff3Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25811a95ff3Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25911a95ff3Smrgdnl DEALINGS IN THE SOFTWARE.
260a6d9b409Smrg
26111a95ff3Smrg# XORG_MACROS_VERSION(required-version)
26211a95ff3Smrg# -------------------------------------
26311a95ff3Smrg# Minimum version: 1.1.0
26411a95ff3Smrg#
26511a95ff3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
26611a95ff3Smrg# your configure.ac with the minimum required version, such as:
26711a95ff3Smrg# XORG_MACROS_VERSION(1.1)
26811a95ff3Smrg#
26911a95ff3Smrg# To ensure that this macro is defined, also add:
27011a95ff3Smrg# m4_ifndef([XORG_MACROS_VERSION],
27111a95ff3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
27211a95ff3Smrg#
27311a95ff3Smrg#
27411a95ff3Smrg# See the "minimum version" comment for each macro you use to see what
27511a95ff3Smrg# version you require.
27611a95ff3Smrgm4_defun([XORG_MACROS_VERSION],[
27711a95ff3Smrgm4_define([vers_have], [1.19.0])
27811a95ff3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
27911a95ff3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
28011a95ff3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
28111a95ff3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
28211a95ff3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
28311a95ff3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
28411a95ff3Smrgm4_undefine([vers_have])
28511a95ff3Smrgm4_undefine([maj_have])
28611a95ff3Smrgm4_undefine([maj_needed])
28711a95ff3Smrg]) # XORG_MACROS_VERSION
288a6d9b409Smrg
28911a95ff3Smrg# XORG_PROG_RAWCPP()
29011a95ff3Smrg# ------------------
29111a95ff3Smrg# Minimum version: 1.0.0
29211a95ff3Smrg#
29311a95ff3Smrg# Find cpp program and necessary flags for use in pre-processing text files
29411a95ff3Smrg# such as man pages and config files
29511a95ff3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
29611a95ff3SmrgAC_REQUIRE([AC_PROG_CPP])
29711a95ff3SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
29811a95ff3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
299a6d9b409Smrg
30011a95ff3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
30111a95ff3Smrg# which is not the best choice for supporting other OS'es, but covers most
30211a95ff3Smrg# of the ones we need for now.
30311a95ff3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
30411a95ff3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
30511a95ff3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
30611a95ff3Smrg	AC_MSG_RESULT([no])
30711a95ff3Smrgelse
30811a95ff3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
30911a95ff3Smrg		RAWCPPFLAGS=-undef
31011a95ff3Smrg		AC_MSG_RESULT([yes])
31111a95ff3Smrg	# under Cygwin unix is still defined even with -undef
31211a95ff3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
31311a95ff3Smrg		RAWCPPFLAGS="-undef -ansi"
31411a95ff3Smrg		AC_MSG_RESULT([yes, with -ansi])
31511a95ff3Smrg	else
31611a95ff3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
31711a95ff3Smrg	fi
318a6d9b409Smrgfi
31911a95ff3Smrgrm -f conftest.$ac_ext
320a6d9b409Smrg
32111a95ff3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
32211a95ff3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
32311a95ff3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
32411a95ff3Smrg	AC_MSG_RESULT([no])
32511a95ff3Smrgelse
32611a95ff3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
32711a95ff3Smrg		TRADITIONALCPPFLAGS="-traditional"
32811a95ff3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
32911a95ff3Smrg		AC_MSG_RESULT([yes])
33011a95ff3Smrg	else
33111a95ff3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
33211a95ff3Smrg	fi
33311a95ff3Smrgfi
33411a95ff3Smrgrm -f conftest.$ac_ext
33511a95ff3SmrgAC_SUBST(RAWCPPFLAGS)
33611a95ff3SmrgAC_SUBST(TRADITIONALCPPFLAGS)
33711a95ff3Smrg]) # XORG_PROG_RAWCPP
338a6d9b409Smrg
33911a95ff3Smrg# XORG_MANPAGE_SECTIONS()
34011a95ff3Smrg# -----------------------
34111a95ff3Smrg# Minimum version: 1.0.0
342a6d9b409Smrg#
34311a95ff3Smrg# Determine which sections man pages go in for the different man page types
34411a95ff3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
34511a95ff3Smrg# Not sure if there's any better way than just hardcoding by OS name.
34611a95ff3Smrg# Override default settings by setting environment variables
34711a95ff3Smrg# Added MAN_SUBSTS in version 1.8
34811a95ff3Smrg# Added AC_PROG_SED in version 1.8
349a6d9b409Smrg
35011a95ff3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
35111a95ff3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
35211a95ff3SmrgAC_REQUIRE([AC_PROG_SED])
353a6d9b409Smrg
35411a95ff3Smrgif test x$APP_MAN_SUFFIX = x    ; then
35511a95ff3Smrg    APP_MAN_SUFFIX=1
35611a95ff3Smrgfi
35711a95ff3Smrgif test x$APP_MAN_DIR = x    ; then
35811a95ff3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
35911a95ff3Smrgfi
360a6d9b409Smrg
36111a95ff3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
36211a95ff3Smrg    LIB_MAN_SUFFIX=3
36311a95ff3Smrgfi
36411a95ff3Smrgif test x$LIB_MAN_DIR = x    ; then
36511a95ff3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
36611a95ff3Smrgfi
367a6d9b409Smrg
36811a95ff3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
36911a95ff3Smrg    case $host_os in
37011a95ff3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
37111a95ff3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
37211a95ff3Smrg    esac
37311a95ff3Smrgfi
37411a95ff3Smrgif test x$FILE_MAN_DIR = x    ; then
37511a95ff3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
37611a95ff3Smrgfi
37711a95ff3Smrg
37811a95ff3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
37911a95ff3Smrg    case $host_os in
38011a95ff3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
38111a95ff3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
38211a95ff3Smrg    esac
38311a95ff3Smrgfi
38411a95ff3Smrgif test x$MISC_MAN_DIR = x    ; then
38511a95ff3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
38611a95ff3Smrgfi
38711a95ff3Smrg
38811a95ff3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
38911a95ff3Smrg    case $host_os in
39011a95ff3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
39111a95ff3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
39211a95ff3Smrg    esac
39311a95ff3Smrgfi
39411a95ff3Smrgif test x$DRIVER_MAN_DIR = x    ; then
39511a95ff3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
39611a95ff3Smrgfi
39711a95ff3Smrg
39811a95ff3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
39911a95ff3Smrg    case $host_os in
40011a95ff3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
40111a95ff3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
40211a95ff3Smrg    esac
40311a95ff3Smrgfi
40411a95ff3Smrgif test x$ADMIN_MAN_DIR = x    ; then
40511a95ff3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
40611a95ff3Smrgfi
40711a95ff3Smrg
40811a95ff3Smrg
40911a95ff3SmrgAC_SUBST([APP_MAN_SUFFIX])
41011a95ff3SmrgAC_SUBST([LIB_MAN_SUFFIX])
41111a95ff3SmrgAC_SUBST([FILE_MAN_SUFFIX])
41211a95ff3SmrgAC_SUBST([MISC_MAN_SUFFIX])
41311a95ff3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
41411a95ff3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
41511a95ff3SmrgAC_SUBST([APP_MAN_DIR])
41611a95ff3SmrgAC_SUBST([LIB_MAN_DIR])
41711a95ff3SmrgAC_SUBST([FILE_MAN_DIR])
41811a95ff3SmrgAC_SUBST([MISC_MAN_DIR])
41911a95ff3SmrgAC_SUBST([DRIVER_MAN_DIR])
42011a95ff3SmrgAC_SUBST([ADMIN_MAN_DIR])
42111a95ff3Smrg
42211a95ff3SmrgXORG_MAN_PAGE="X Version 11"
42311a95ff3SmrgAC_SUBST([XORG_MAN_PAGE])
42411a95ff3SmrgMAN_SUBSTS="\
42511a95ff3Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
42611a95ff3Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
42711a95ff3Smrg	-e 's|__xservername__|Xorg|g' \
42811a95ff3Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
42911a95ff3Smrg	-e 's|__projectroot__|\$(prefix)|g' \
43011a95ff3Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
43111a95ff3Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
43211a95ff3Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
43311a95ff3Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
43411a95ff3Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
43511a95ff3Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
43611a95ff3Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
43711a95ff3SmrgAC_SUBST([MAN_SUBSTS])
43811a95ff3Smrg
43911a95ff3Smrg]) # XORG_MANPAGE_SECTIONS
44011a95ff3Smrg
44111a95ff3Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
44211a95ff3Smrg# ------------------------
44311a95ff3Smrg# Minimum version: 1.7.0
444a6d9b409Smrg#
44511a95ff3Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
44611a95ff3Smrg# provided by xorg-sgml-doctools, if installed.
44711a95ff3SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
44811a95ff3SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
44911a95ff3SmrgXORG_SGML_PATH=
45011a95ff3SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
45111a95ff3Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
45211a95ff3Smrg    [m4_ifval([$1],[:],
45311a95ff3Smrg        [if test x"$cross_compiling" != x"yes" ; then
45411a95ff3Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
45511a95ff3Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
45611a95ff3Smrg         fi])
45711a95ff3Smrg    ])
458a6d9b409Smrg
45911a95ff3Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
46011a95ff3Smrg# the path and the name of the doc stylesheet
46111a95ff3Smrgif test "x$XORG_SGML_PATH" != "x" ; then
46211a95ff3Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
46311a95ff3Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
46411a95ff3Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
46511a95ff3Smrgelse
46611a95ff3Smrg   AC_MSG_RESULT([no])
46711a95ff3Smrgfi
468a6d9b409Smrg
46911a95ff3SmrgAC_SUBST(XORG_SGML_PATH)
47011a95ff3SmrgAC_SUBST(STYLESHEET_SRCDIR)
47111a95ff3SmrgAC_SUBST(XSL_STYLESHEET)
47211a95ff3SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
47311a95ff3Smrg]) # XORG_CHECK_SGML_DOCTOOLS
47411a95ff3Smrg
47511a95ff3Smrg# XORG_CHECK_LINUXDOC
47611a95ff3Smrg# -------------------
47711a95ff3Smrg# Minimum version: 1.0.0
478a6d9b409Smrg#
47911a95ff3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
48011a95ff3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
48111a95ff3Smrg# Whether or not the necessary tools and files are found can be checked
48211a95ff3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
48311a95ff3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
48411a95ff3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
48511a95ff3SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
486a6d9b409Smrg
48711a95ff3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
488a6d9b409Smrg
48911a95ff3SmrgAC_MSG_CHECKING([whether to build documentation])
490b91640d3Smrg
49111a95ff3Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
49211a95ff3Smrg   BUILDDOC=yes
49311a95ff3Smrgelse
49411a95ff3Smrg   BUILDDOC=no
495a6d9b409Smrgfi
496a6d9b409Smrg
49711a95ff3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
498a6d9b409Smrg
49911a95ff3SmrgAC_MSG_RESULT([$BUILDDOC])
500a6d9b409Smrg
50111a95ff3SmrgAC_MSG_CHECKING([whether to build pdf documentation])
502b91640d3Smrg
50311a95ff3Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
50411a95ff3Smrg   BUILDPDFDOC=yes
50511a95ff3Smrgelse
50611a95ff3Smrg   BUILDPDFDOC=no
50711a95ff3Smrgfi
508b91640d3Smrg
50911a95ff3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
510b91640d3Smrg
51111a95ff3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
512b91640d3Smrg
51311a95ff3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
51411a95ff3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
51511a95ff3SmrgMAKE_PDF="$PS2PDF"
51611a95ff3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
517b91640d3Smrg
51811a95ff3SmrgAC_SUBST(MAKE_TEXT)
51911a95ff3SmrgAC_SUBST(MAKE_PS)
52011a95ff3SmrgAC_SUBST(MAKE_PDF)
52111a95ff3SmrgAC_SUBST(MAKE_HTML)
52211a95ff3Smrg]) # XORG_CHECK_LINUXDOC
523a6d9b409Smrg
52411a95ff3Smrg# XORG_CHECK_DOCBOOK
52511a95ff3Smrg# -------------------
52611a95ff3Smrg# Minimum version: 1.0.0
52711a95ff3Smrg#
52811a95ff3Smrg# Checks for the ability to build output formats from SGML DocBook source.
52911a95ff3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
53011a95ff3Smrg# indicates whether the necessary tools and files are found and, if set,
53111a95ff3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
53211a95ff3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
53311a95ff3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
534efda2da8Smrg
53511a95ff3SmrgBUILDTXTDOC=no
53611a95ff3SmrgBUILDPDFDOC=no
53711a95ff3SmrgBUILDPSDOC=no
53811a95ff3SmrgBUILDHTMLDOC=no
539a6d9b409Smrg
54011a95ff3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
54111a95ff3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
54211a95ff3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
54311a95ff3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
544a6d9b409Smrg
54511a95ff3SmrgAC_MSG_CHECKING([whether to build text documentation])
54611a95ff3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
54711a95ff3Smrg   test x$BUILD_TXTDOC != xno; then
54811a95ff3Smrg	BUILDTXTDOC=yes
54911a95ff3Smrgfi
55011a95ff3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
55111a95ff3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
552a6d9b409Smrg
55311a95ff3SmrgAC_MSG_CHECKING([whether to build PDF documentation])
55411a95ff3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
55511a95ff3Smrg   test x$BUILD_PDFDOC != xno; then
55611a95ff3Smrg	BUILDPDFDOC=yes
557efda2da8Smrgfi
55811a95ff3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
55911a95ff3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
560a6d9b409Smrg
56111a95ff3SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
56211a95ff3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
56311a95ff3Smrg   test x$BUILD_PSDOC != xno; then
56411a95ff3Smrg	BUILDPSDOC=yes
56511a95ff3Smrgfi
56611a95ff3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
56711a95ff3SmrgAC_MSG_RESULT([$BUILDPSDOC])
568a6d9b409Smrg
56911a95ff3SmrgAC_MSG_CHECKING([whether to build HTML documentation])
57011a95ff3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
57111a95ff3Smrg   test x$BUILD_HTMLDOC != xno; then
57211a95ff3Smrg	BUILDHTMLDOC=yes
573a6d9b409Smrgfi
57411a95ff3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
57511a95ff3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
576a6d9b409Smrg
57711a95ff3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
57811a95ff3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
57911a95ff3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
58011a95ff3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
581a6d9b409Smrg
58211a95ff3SmrgAC_SUBST(MAKE_TEXT)
58311a95ff3SmrgAC_SUBST(MAKE_PS)
58411a95ff3SmrgAC_SUBST(MAKE_PDF)
58511a95ff3SmrgAC_SUBST(MAKE_HTML)
58611a95ff3Smrg]) # XORG_CHECK_DOCBOOK
587a6d9b409Smrg
58811a95ff3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
58911a95ff3Smrg# ----------------
59011a95ff3Smrg# Minimum version: 1.5.0
59111a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
592a6d9b409Smrg#
59311a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
59411a95ff3Smrg# not at the appropriate level. This macro enables a module to test for the
59511a95ff3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
59611a95ff3Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
59711a95ff3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
59811a95ff3Smrg# --with-xmlto assumes 'auto'.
59911a95ff3Smrg#
60011a95ff3Smrg# Interface to module:
60111a95ff3Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
60211a95ff3Smrg# XMLTO:	returns the path of the xmlto program found
60311a95ff3Smrg#		returns the path set by the user in the environment
60411a95ff3Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
60511a95ff3Smrg#		'no' user instructs the module not to use xmlto
60611a95ff3Smrg#
60711a95ff3Smrg# Added in version 1.10.0
60811a95ff3Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
60911a95ff3Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
61011a95ff3Smrg#
61111a95ff3Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
61211a95ff3Smrg#
61311a95ff3SmrgAC_DEFUN([XORG_WITH_XMLTO],[
61411a95ff3SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
61511a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
61611a95ff3SmrgAC_ARG_WITH(xmlto,
61711a95ff3Smrg	AS_HELP_STRING([--with-xmlto],
61811a95ff3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
61911a95ff3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
62011a95ff3Smrgm4_undefine([_defopt])
621a6d9b409Smrg
62211a95ff3Smrgif test "x$use_xmlto" = x"auto"; then
62311a95ff3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
62411a95ff3Smrg   if test "x$XMLTO" = "x"; then
62511a95ff3Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
62611a95ff3Smrg	have_xmlto=no
62711a95ff3Smrg   else
62811a95ff3Smrg        have_xmlto=yes
62911a95ff3Smrg   fi
63011a95ff3Smrgelif test "x$use_xmlto" = x"yes" ; then
63111a95ff3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
63211a95ff3Smrg   if test "x$XMLTO" = "x"; then
63311a95ff3Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
63411a95ff3Smrg   fi
63511a95ff3Smrg   have_xmlto=yes
63611a95ff3Smrgelif test "x$use_xmlto" = x"no" ; then
63711a95ff3Smrg   if test "x$XMLTO" != "x"; then
63811a95ff3Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
63911a95ff3Smrg   fi
64011a95ff3Smrg   have_xmlto=no
641a6d9b409Smrgelse
64211a95ff3Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
643a6d9b409Smrgfi
644a6d9b409Smrg
64511a95ff3Smrg# Test for a minimum version of xmlto, if provided.
64611a95ff3Smrgm4_ifval([$1],
64711a95ff3Smrg[if test "$have_xmlto" = yes; then
64811a95ff3Smrg    # scrape the xmlto version
64911a95ff3Smrg    AC_MSG_CHECKING([the xmlto version])
65011a95ff3Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
65111a95ff3Smrg    AC_MSG_RESULT([$xmlto_version])
65211a95ff3Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
65311a95ff3Smrg        [if test "x$use_xmlto" = xauto; then
65411a95ff3Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
65511a95ff3Smrg            have_xmlto=no
65611a95ff3Smrg        else
65711a95ff3Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
65811a95ff3Smrg        fi])
65911a95ff3Smrgfi])
660a6d9b409Smrg
66111a95ff3Smrg# Test for the ability of xmlto to generate a text target
66211a95ff3Smrghave_xmlto_text=no
66311a95ff3Smrgcat > conftest.xml << "EOF"
66411a95ff3SmrgEOF
66511a95ff3SmrgAS_IF([test "$have_xmlto" = yes],
66611a95ff3Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
66711a95ff3Smrg             [have_xmlto_text=yes],
66811a95ff3Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
66911a95ff3Smrgrm -f conftest.xml
67011a95ff3SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
67111a95ff3SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
67211a95ff3Smrg]) # XORG_WITH_XMLTO
673a6d9b409Smrg
67411a95ff3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
67511a95ff3Smrg# --------------------------------------------
67611a95ff3Smrg# Minimum version: 1.12.0
67711a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
678b91640d3Smrg#
67911a95ff3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
68011a95ff3Smrg# XML-based language used for the transformation of XML documents.
68111a95ff3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
68211a95ff3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
68311a95ff3Smrg# The XSLT processor is often used as a standalone tool for transformations.
68411a95ff3Smrg# It should not be assumed that this tool is used only to work with documnetation.
68511a95ff3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
68611a95ff3Smrg#
68711a95ff3Smrg# Interface to module:
68811a95ff3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
68911a95ff3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
69011a95ff3Smrg#		 returns the path set by the user in the environment
69111a95ff3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
69211a95ff3Smrg#		  'no' user instructs the module not to use xsltproc
69311a95ff3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
69411a95ff3Smrg#
69511a95ff3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
69611a95ff3Smrg#
69711a95ff3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
69811a95ff3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
69911a95ff3Smrg# Preserves the interface, should it be implemented later
70011a95ff3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
70111a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
70211a95ff3SmrgAC_ARG_WITH(xsltproc,
70311a95ff3Smrg	AS_HELP_STRING([--with-xsltproc],
70411a95ff3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
70511a95ff3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
70611a95ff3Smrgm4_undefine([_defopt])
707a6d9b409Smrg
70811a95ff3Smrgif test "x$use_xsltproc" = x"auto"; then
70911a95ff3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
71011a95ff3Smrg   if test "x$XSLTPROC" = "x"; then
71111a95ff3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
71211a95ff3Smrg	have_xsltproc=no
71311a95ff3Smrg   else
71411a95ff3Smrg        have_xsltproc=yes
71511a95ff3Smrg   fi
71611a95ff3Smrgelif test "x$use_xsltproc" = x"yes" ; then
71711a95ff3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
71811a95ff3Smrg   if test "x$XSLTPROC" = "x"; then
71911a95ff3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
72011a95ff3Smrg   fi
72111a95ff3Smrg   have_xsltproc=yes
72211a95ff3Smrgelif test "x$use_xsltproc" = x"no" ; then
72311a95ff3Smrg   if test "x$XSLTPROC" != "x"; then
72411a95ff3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
72511a95ff3Smrg   fi
72611a95ff3Smrg   have_xsltproc=no
72711a95ff3Smrgelse
72811a95ff3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
729b91640d3Smrgfi
730b91640d3Smrg
73111a95ff3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
73211a95ff3Smrg]) # XORG_WITH_XSLTPROC
733b91640d3Smrg
73411a95ff3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
73511a95ff3Smrg# ----------------------------------------
73611a95ff3Smrg# Minimum version: 1.15.0
737a6d9b409Smrg#
73811a95ff3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
73911a95ff3Smrg# scanning arbitrary text files, extracting information from those text files,
74011a95ff3Smrg# and printing reports based on that information.
74111a95ff3Smrg#
74211a95ff3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
74311a95ff3Smrg#
74411a95ff3Smrg# Interface to module:
74511a95ff3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
74611a95ff3Smrg# PERL:	     returns the path of the perl program found
74711a95ff3Smrg#	     returns the path set by the user in the environment
74811a95ff3Smrg# --with-perl: 'yes' user instructs the module to use perl
74911a95ff3Smrg#	       'no' user instructs the module not to use perl
75011a95ff3Smrg# have_perl: returns yes if perl found in PATH or no
75111a95ff3Smrg#
75211a95ff3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
75311a95ff3Smrg#
75411a95ff3SmrgAC_DEFUN([XORG_WITH_PERL],[
75511a95ff3SmrgAC_ARG_VAR([PERL], [Path to perl command])
75611a95ff3Smrg# Preserves the interface, should it be implemented later
75711a95ff3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
75811a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
75911a95ff3SmrgAC_ARG_WITH(perl,
76011a95ff3Smrg	AS_HELP_STRING([--with-perl],
76111a95ff3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
76211a95ff3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
76311a95ff3Smrgm4_undefine([_defopt])
764a6d9b409Smrg
76511a95ff3Smrgif test "x$use_perl" = x"auto"; then
76611a95ff3Smrg   AC_PATH_PROG([PERL], [perl])
76711a95ff3Smrg   if test "x$PERL" = "x"; then
76811a95ff3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
76911a95ff3Smrg	have_perl=no
77011a95ff3Smrg   else
77111a95ff3Smrg        have_perl=yes
77211a95ff3Smrg   fi
77311a95ff3Smrgelif test "x$use_perl" = x"yes" ; then
77411a95ff3Smrg   AC_PATH_PROG([PERL], [perl])
77511a95ff3Smrg   if test "x$PERL" = "x"; then
77611a95ff3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
77711a95ff3Smrg   fi
77811a95ff3Smrg   have_perl=yes
77911a95ff3Smrgelif test "x$use_perl" = x"no" ; then
78011a95ff3Smrg   if test "x$PERL" != "x"; then
78111a95ff3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
78211a95ff3Smrg   fi
78311a95ff3Smrg   have_perl=no
78411a95ff3Smrgelse
78511a95ff3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
78611a95ff3Smrgfi
787b91640d3Smrg
78811a95ff3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
78911a95ff3Smrg]) # XORG_WITH_PERL
790b91640d3Smrg
79111a95ff3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
79211a95ff3Smrg# ----------------
79311a95ff3Smrg# Minimum version: 1.5.0
79411a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
795b91640d3Smrg#
79611a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
79711a95ff3Smrg# not at the appropriate level. This macro enables a module to test for the
79811a95ff3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
79911a95ff3Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
80011a95ff3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
80111a95ff3Smrg# --with-asciidoc assumes 'auto'.
80211a95ff3Smrg#
80311a95ff3Smrg# Interface to module:
80411a95ff3Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
80511a95ff3Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
80611a95ff3Smrg#		 returns the path set by the user in the environment
80711a95ff3Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
80811a95ff3Smrg#		  'no' user instructs the module not to use asciidoc
80911a95ff3Smrg#
81011a95ff3Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
81111a95ff3Smrg#
81211a95ff3SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
81311a95ff3SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
81411a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
81511a95ff3SmrgAC_ARG_WITH(asciidoc,
81611a95ff3Smrg	AS_HELP_STRING([--with-asciidoc],
81711a95ff3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
81811a95ff3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
81911a95ff3Smrgm4_undefine([_defopt])
820b91640d3Smrg
82111a95ff3Smrgif test "x$use_asciidoc" = x"auto"; then
82211a95ff3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
82311a95ff3Smrg   if test "x$ASCIIDOC" = "x"; then
82411a95ff3Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
82511a95ff3Smrg	have_asciidoc=no
82611a95ff3Smrg   else
82711a95ff3Smrg        have_asciidoc=yes
82811a95ff3Smrg   fi
82911a95ff3Smrgelif test "x$use_asciidoc" = x"yes" ; then
83011a95ff3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
83111a95ff3Smrg   if test "x$ASCIIDOC" = "x"; then
83211a95ff3Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
83311a95ff3Smrg   fi
83411a95ff3Smrg   have_asciidoc=yes
83511a95ff3Smrgelif test "x$use_asciidoc" = x"no" ; then
83611a95ff3Smrg   if test "x$ASCIIDOC" != "x"; then
83711a95ff3Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
83811a95ff3Smrg   fi
83911a95ff3Smrg   have_asciidoc=no
840a6d9b409Smrgelse
84111a95ff3Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
842b91640d3Smrgfi
84311a95ff3Smrgm4_ifval([$1],
84411a95ff3Smrg[if test "$have_asciidoc" = yes; then
84511a95ff3Smrg    # scrape the asciidoc version
84611a95ff3Smrg    AC_MSG_CHECKING([the asciidoc version])
84711a95ff3Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
84811a95ff3Smrg    AC_MSG_RESULT([$asciidoc_version])
84911a95ff3Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
85011a95ff3Smrg        [if test "x$use_asciidoc" = xauto; then
85111a95ff3Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
85211a95ff3Smrg            have_asciidoc=no
85311a95ff3Smrg        else
85411a95ff3Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
85511a95ff3Smrg        fi])
85611a95ff3Smrgfi])
85711a95ff3SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
85811a95ff3Smrg]) # XORG_WITH_ASCIIDOC
859a6d9b409Smrg
86011a95ff3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
86111a95ff3Smrg# -------------------------------------------
86211a95ff3Smrg# Minimum version: 1.5.0
86311a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
86411a95ff3Smrg# Minimum version for optional DOT checking: 1.18.0
865efda2da8Smrg#
86611a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
86711a95ff3Smrg# not at the appropriate level. This macro enables a module to test for the
86811a95ff3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
86911a95ff3Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
87011a95ff3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
87111a95ff3Smrg# --with-doxygen assumes 'auto'.
87211a95ff3Smrg#
87311a95ff3Smrg# Interface to module:
87411a95ff3Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
87511a95ff3Smrg# DOXYGEN:	 returns the path of the doxygen program found
87611a95ff3Smrg#		 returns the path set by the user in the environment
87711a95ff3Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
87811a95ff3Smrg#		  'no' user instructs the module not to use doxygen
87911a95ff3Smrg#
88011a95ff3Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
88111a95ff3Smrg#
88211a95ff3SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
88311a95ff3SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
88411a95ff3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
88511a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
88611a95ff3SmrgAC_ARG_WITH(doxygen,
88711a95ff3Smrg	AS_HELP_STRING([--with-doxygen],
88811a95ff3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
88911a95ff3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
89011a95ff3Smrgm4_undefine([_defopt])
891efda2da8Smrg
89211a95ff3Smrgif test "x$use_doxygen" = x"auto"; then
89311a95ff3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
89411a95ff3Smrg   if test "x$DOXYGEN" = "x"; then
89511a95ff3Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
89611a95ff3Smrg	have_doxygen=no
89711a95ff3Smrg   else
89811a95ff3Smrg        have_doxygen=yes
89911a95ff3Smrg   fi
90011a95ff3Smrgelif test "x$use_doxygen" = x"yes" ; then
90111a95ff3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
90211a95ff3Smrg   if test "x$DOXYGEN" = "x"; then
90311a95ff3Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
90411a95ff3Smrg   fi
90511a95ff3Smrg   have_doxygen=yes
90611a95ff3Smrgelif test "x$use_doxygen" = x"no" ; then
90711a95ff3Smrg   if test "x$DOXYGEN" != "x"; then
90811a95ff3Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
90911a95ff3Smrg   fi
91011a95ff3Smrg   have_doxygen=no
911b91640d3Smrgelse
91211a95ff3Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
91311a95ff3Smrgfi
91411a95ff3Smrgm4_ifval([$1],
91511a95ff3Smrg[if test "$have_doxygen" = yes; then
91611a95ff3Smrg    # scrape the doxygen version
91711a95ff3Smrg    AC_MSG_CHECKING([the doxygen version])
91811a95ff3Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
91911a95ff3Smrg    AC_MSG_RESULT([$doxygen_version])
92011a95ff3Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
92111a95ff3Smrg        [if test "x$use_doxygen" = xauto; then
92211a95ff3Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
92311a95ff3Smrg            have_doxygen=no
92411a95ff3Smrg        else
92511a95ff3Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
92611a95ff3Smrg        fi])
927b91640d3Smrgfi])
92811a95ff3Smrg
92911a95ff3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
93011a95ff3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
93111a95ff3Smrgdnl 	HAVE_DOT = @HAVE_DOT@
93211a95ff3SmrgHAVE_DOT=no
93311a95ff3Smrgif test "x$have_doxygen" = "xyes"; then
93411a95ff3Smrg  AC_PATH_PROG([DOT], [dot])
93511a95ff3Smrg    if test "x$DOT" != "x"; then
93611a95ff3Smrg      HAVE_DOT=yes
93711a95ff3Smrg    fi
938b91640d3Smrgfi
939efda2da8Smrg
94011a95ff3SmrgAC_SUBST([HAVE_DOT])
94111a95ff3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
94211a95ff3SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
94311a95ff3Smrg]) # XORG_WITH_DOXYGEN
94411a95ff3Smrg
94511a95ff3Smrg# XORG_WITH_GROFF([DEFAULT])
94611a95ff3Smrg# ----------------
94711a95ff3Smrg# Minimum version: 1.6.0
94811a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
949a6d9b409Smrg#
95011a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
95111a95ff3Smrg# not at the appropriate level. This macro enables a module to test for the
95211a95ff3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
95311a95ff3Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
95411a95ff3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
95511a95ff3Smrg# --with-groff assumes 'auto'.
95611a95ff3Smrg#
95711a95ff3Smrg# Interface to module:
95811a95ff3Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
95911a95ff3Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
96011a95ff3Smrg# HAVE_GROFF_MS: the -ms macros package
96111a95ff3Smrg# GROFF:	 returns the path of the groff program found
96211a95ff3Smrg#		 returns the path set by the user in the environment
96311a95ff3Smrg# --with-groff:	 'yes' user instructs the module to use groff
96411a95ff3Smrg#		 'no' user instructs the module not to use groff
96511a95ff3Smrg#
96611a95ff3Smrg# Added in version 1.9.0:
96711a95ff3Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
96811a95ff3Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
96911a95ff3Smrg#		   psselect from the psutils package.
97011a95ff3Smrg#		   the ghostcript package. Refer to the grohtml man pages
97111a95ff3Smrg#
97211a95ff3Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
97311a95ff3Smrg#
97411a95ff3Smrg# OS and distros often splits groff in a basic and full package, the former
97511a95ff3Smrg# having the groff program and the later having devices, fonts and macros
97611a95ff3Smrg# Checking for the groff executable is not enough.
97711a95ff3Smrg#
97811a95ff3Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
97911a95ff3Smrg# unset HAVE_GROFF or GROFF env variables.
98011a95ff3Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
98111a95ff3Smrg#
98211a95ff3SmrgAC_DEFUN([XORG_WITH_GROFF],[
98311a95ff3SmrgAC_ARG_VAR([GROFF], [Path to groff command])
98411a95ff3Smrgm4_define([_defopt], m4_default([$1], [auto]))
98511a95ff3SmrgAC_ARG_WITH(groff,
98611a95ff3Smrg	AS_HELP_STRING([--with-groff],
98711a95ff3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
98811a95ff3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
98911a95ff3Smrgm4_undefine([_defopt])
990a6d9b409Smrg
99111a95ff3Smrgif test "x$use_groff" = x"auto"; then
99211a95ff3Smrg   AC_PATH_PROG([GROFF], [groff])
99311a95ff3Smrg   if test "x$GROFF" = "x"; then
99411a95ff3Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
99511a95ff3Smrg	have_groff=no
99611a95ff3Smrg   else
99711a95ff3Smrg        have_groff=yes
99811a95ff3Smrg   fi
99911a95ff3Smrgelif test "x$use_groff" = x"yes" ; then
100011a95ff3Smrg   AC_PATH_PROG([GROFF], [groff])
100111a95ff3Smrg   if test "x$GROFF" = "x"; then
100211a95ff3Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
100311a95ff3Smrg   fi
100411a95ff3Smrg   have_groff=yes
100511a95ff3Smrgelif test "x$use_groff" = x"no" ; then
100611a95ff3Smrg   if test "x$GROFF" != "x"; then
100711a95ff3Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
100811a95ff3Smrg   fi
100911a95ff3Smrg   have_groff=no
101011a95ff3Smrgelse
101111a95ff3Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1012a6d9b409Smrgfi
1013a6d9b409Smrg
101411a95ff3Smrg# We have groff, test for the presence of the macro packages
101511a95ff3Smrgif test "x$have_groff" = x"yes"; then
101611a95ff3Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
101711a95ff3Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
101811a95ff3Smrg        groff_ms_works=yes
101911a95ff3Smrg    else
102011a95ff3Smrg        groff_ms_works=no
102111a95ff3Smrg    fi
102211a95ff3Smrg    AC_MSG_RESULT([$groff_ms_works])
102311a95ff3Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
102411a95ff3Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
102511a95ff3Smrg        groff_mm_works=yes
102611a95ff3Smrg    else
102711a95ff3Smrg        groff_mm_works=no
102811a95ff3Smrg    fi
102911a95ff3Smrg    AC_MSG_RESULT([$groff_mm_works])
103011a95ff3Smrgfi
1031a6d9b409Smrg
103211a95ff3Smrg# We have groff, test for HTML dependencies, one command per package
103311a95ff3Smrgif test "x$have_groff" = x"yes"; then
103411a95ff3Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
103511a95ff3Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
103611a95ff3Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
103711a95ff3Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
103811a95ff3Smrg      have_groff_html=yes
103911a95ff3Smrg   else
104011a95ff3Smrg      have_groff_html=no
104111a95ff3Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
104211a95ff3Smrg   fi
104311a95ff3Smrgfi
1044efda2da8Smrg
104511a95ff3Smrg# Set Automake conditionals for Makefiles
104611a95ff3SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
104711a95ff3SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
104811a95ff3SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
104911a95ff3SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
105011a95ff3Smrg]) # XORG_WITH_GROFF
1051a6d9b409Smrg
105211a95ff3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
105311a95ff3Smrg# ---------------------------------------
105411a95ff3Smrg# Minimum version: 1.6.0
105511a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
105611a95ff3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1057a6d9b409Smrg#
105811a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
105911a95ff3Smrg# not at the appropriate level. This macro enables a module to test for the
106011a95ff3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
106111a95ff3Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
106211a95ff3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
106311a95ff3Smrg# --with-fop assumes 'auto'.
1064a6d9b409Smrg#
106511a95ff3Smrg# Interface to module:
106611a95ff3Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
106711a95ff3Smrg# FOP:	 	returns the path of the fop program found
106811a95ff3Smrg#		returns the path set by the user in the environment
106911a95ff3Smrg# --with-fop: 	'yes' user instructs the module to use fop
107011a95ff3Smrg#		'no' user instructs the module not to use fop
1071a6d9b409Smrg#
107211a95ff3Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1073b91640d3Smrg#
107411a95ff3SmrgAC_DEFUN([XORG_WITH_FOP],[
107511a95ff3SmrgAC_ARG_VAR([FOP], [Path to fop command])
107611a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
107711a95ff3SmrgAC_ARG_WITH(fop,
107811a95ff3Smrg	AS_HELP_STRING([--with-fop],
107911a95ff3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
108011a95ff3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
108111a95ff3Smrgm4_undefine([_defopt])
1082a6d9b409Smrg
108311a95ff3Smrgif test "x$use_fop" = x"auto"; then
108411a95ff3Smrg   AC_PATH_PROG([FOP], [fop])
108511a95ff3Smrg   if test "x$FOP" = "x"; then
108611a95ff3Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
108711a95ff3Smrg	have_fop=no
108811a95ff3Smrg   else
108911a95ff3Smrg        have_fop=yes
109011a95ff3Smrg   fi
109111a95ff3Smrgelif test "x$use_fop" = x"yes" ; then
109211a95ff3Smrg   AC_PATH_PROG([FOP], [fop])
109311a95ff3Smrg   if test "x$FOP" = "x"; then
109411a95ff3Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
109511a95ff3Smrg   fi
109611a95ff3Smrg   have_fop=yes
109711a95ff3Smrgelif test "x$use_fop" = x"no" ; then
109811a95ff3Smrg   if test "x$FOP" != "x"; then
109911a95ff3Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
110011a95ff3Smrg   fi
110111a95ff3Smrg   have_fop=no
110211a95ff3Smrgelse
110311a95ff3Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
110411a95ff3Smrgfi
1105b91640d3Smrg
110611a95ff3Smrg# Test for a minimum version of fop, if provided.
110711a95ff3Smrgm4_ifval([$1],
110811a95ff3Smrg[if test "$have_fop" = yes; then
110911a95ff3Smrg    # scrape the fop version
111011a95ff3Smrg    AC_MSG_CHECKING([for fop minimum version])
111111a95ff3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
111211a95ff3Smrg    AC_MSG_RESULT([$fop_version])
111311a95ff3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
111411a95ff3Smrg        [if test "x$use_fop" = xauto; then
111511a95ff3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
111611a95ff3Smrg            have_fop=no
111711a95ff3Smrg        else
111811a95ff3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
111911a95ff3Smrg        fi])
112011a95ff3Smrgfi])
112111a95ff3SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
112211a95ff3Smrg]) # XORG_WITH_FOP
1123a6d9b409Smrg
112411a95ff3Smrg# XORG_WITH_M4([MIN-VERSION])
112511a95ff3Smrg# ---------------------------
112611a95ff3Smrg# Minimum version: 1.19.0
1127a097bd00Smrg#
112811a95ff3Smrg# This macro attempts to locate an m4 macro processor which supports
112911a95ff3Smrg# -I option and is only useful for modules relying on M4 in order to
113011a95ff3Smrg# expand macros in source code files.
1131a097bd00Smrg#
113211a95ff3Smrg# Interface to module:
113311a95ff3Smrg# M4:	 	returns the path of the m4 program found
113411a95ff3Smrg#		returns the path set by the user in the environment
1135a097bd00Smrg#
113611a95ff3SmrgAC_DEFUN([XORG_WITH_M4], [
113711a95ff3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
113811a95ff3Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
113911a95ff3Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
114011a95ff3Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
114111a95ff3Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
114211a95ff3Smrg   [$PATH:/usr/gnu/bin])])
1143a097bd00Smrg
114411a95ff3SmrgAC_SUBST([M4], [$ac_cv_path_M4])
114511a95ff3Smrg]) # XORG_WITH_M4
1146a097bd00Smrg
114711a95ff3Smrg# XORG_WITH_PS2PDF([DEFAULT])
114811a95ff3Smrg# ----------------
114911a95ff3Smrg# Minimum version: 1.6.0
115011a95ff3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1151a097bd00Smrg#
115211a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
115311a95ff3Smrg# not at the appropriate level. This macro enables a module to test for the
115411a95ff3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
115511a95ff3Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
115611a95ff3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
115711a95ff3Smrg# --with-ps2pdf assumes 'auto'.
115811a95ff3Smrg#
115911a95ff3Smrg# Interface to module:
116011a95ff3Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
116111a95ff3Smrg# PS2PDF:	returns the path of the ps2pdf program found
116211a95ff3Smrg#		returns the path set by the user in the environment
116311a95ff3Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
116411a95ff3Smrg#		 'no' user instructs the module not to use ps2pdf
1165a097bd00Smrg#
116611a95ff3Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1167a097bd00Smrg#
116811a95ff3SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
116911a95ff3SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
117011a95ff3Smrgm4_define([_defopt], m4_default([$1], [auto]))
117111a95ff3SmrgAC_ARG_WITH(ps2pdf,
117211a95ff3Smrg	AS_HELP_STRING([--with-ps2pdf],
117311a95ff3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
117411a95ff3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
117511a95ff3Smrgm4_undefine([_defopt])
1176a097bd00Smrg
117711a95ff3Smrgif test "x$use_ps2pdf" = x"auto"; then
117811a95ff3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
117911a95ff3Smrg   if test "x$PS2PDF" = "x"; then
118011a95ff3Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
118111a95ff3Smrg	have_ps2pdf=no
118211a95ff3Smrg   else
118311a95ff3Smrg        have_ps2pdf=yes
118411a95ff3Smrg   fi
118511a95ff3Smrgelif test "x$use_ps2pdf" = x"yes" ; then
118611a95ff3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
118711a95ff3Smrg   if test "x$PS2PDF" = "x"; then
118811a95ff3Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
118911a95ff3Smrg   fi
119011a95ff3Smrg   have_ps2pdf=yes
119111a95ff3Smrgelif test "x$use_ps2pdf" = x"no" ; then
119211a95ff3Smrg   if test "x$PS2PDF" != "x"; then
119311a95ff3Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
119411a95ff3Smrg   fi
119511a95ff3Smrg   have_ps2pdf=no
1196a097bd00Smrgelse
119711a95ff3Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
119811a95ff3Smrgfi
119911a95ff3SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
120011a95ff3Smrg]) # XORG_WITH_PS2PDF
1201a097bd00Smrg
120211a95ff3Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
120311a95ff3Smrg# ----------------
120411a95ff3Smrg# Minimum version: 1.6.0
1205a097bd00Smrg#
120611a95ff3Smrg# Documentation tools are not always available on all platforms and sometimes
120711a95ff3Smrg# not at the appropriate level. This macro enables a builder to skip all
120811a95ff3Smrg# documentation targets except traditional man pages.
120911a95ff3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
121011a95ff3Smrg# maximum flexibilty in controlling documentation building.
121111a95ff3Smrg# Refer to:
121211a95ff3Smrg# XORG_WITH_XMLTO         --with-xmlto
121311a95ff3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
121411a95ff3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
121511a95ff3Smrg# XORG_WITH_FOP           --with-fop
121611a95ff3Smrg# XORG_WITH_GROFF         --with-groff
121711a95ff3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1218a097bd00Smrg#
121911a95ff3Smrg# Interface to module:
122011a95ff3Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
122111a95ff3Smrg# --enable-docs: 'yes' user instructs the module to generate docs
122211a95ff3Smrg#		 'no' user instructs the module not to generate docs
122311a95ff3Smrg# parm1:	specify the default value, yes or no.
1224a097bd00Smrg#
122511a95ff3SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
122611a95ff3Smrgm4_define([docs_default], m4_default([$1], [yes]))
122711a95ff3SmrgAC_ARG_ENABLE(docs,
122811a95ff3Smrg	AS_HELP_STRING([--enable-docs],
122911a95ff3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
123011a95ff3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
123111a95ff3Smrgm4_undefine([docs_default])
123211a95ff3SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
123311a95ff3SmrgAC_MSG_CHECKING([whether to build documentation])
123411a95ff3SmrgAC_MSG_RESULT([$build_docs])
123511a95ff3Smrg]) # XORG_ENABLE_DOCS
1236a6d9b409Smrg
123711a95ff3Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
123811a95ff3Smrg# ----------------
123911a95ff3Smrg# Minimum version: 1.6.0
1240a6d9b409Smrg#
124111a95ff3Smrg# This macro enables a builder to skip all developer documentation.
124211a95ff3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
124311a95ff3Smrg# maximum flexibilty in controlling documentation building.
124411a95ff3Smrg# Refer to:
124511a95ff3Smrg# XORG_WITH_XMLTO         --with-xmlto
124611a95ff3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
124711a95ff3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
124811a95ff3Smrg# XORG_WITH_FOP           --with-fop
124911a95ff3Smrg# XORG_WITH_GROFF         --with-groff
125011a95ff3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1251a6d9b409Smrg#
125211a95ff3Smrg# Interface to module:
125311a95ff3Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
125411a95ff3Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
125511a95ff3Smrg#			'no' user instructs the module not to generate developer docs
125611a95ff3Smrg# parm1:		specify the default value, yes or no.
1257a6d9b409Smrg#
125811a95ff3SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
125911a95ff3Smrgm4_define([devel_default], m4_default([$1], [yes]))
126011a95ff3SmrgAC_ARG_ENABLE(devel-docs,
126111a95ff3Smrg	AS_HELP_STRING([--enable-devel-docs],
126211a95ff3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
126311a95ff3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
126411a95ff3Smrgm4_undefine([devel_default])
126511a95ff3SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
126611a95ff3SmrgAC_MSG_CHECKING([whether to build developer documentation])
126711a95ff3SmrgAC_MSG_RESULT([$build_devel_docs])
126811a95ff3Smrg]) # XORG_ENABLE_DEVEL_DOCS
1269a6d9b409Smrg
127011a95ff3Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
127111a95ff3Smrg# ----------------
127211a95ff3Smrg# Minimum version: 1.6.0
1273a6d9b409Smrg#
127411a95ff3Smrg# This macro enables a builder to skip all functional specification targets.
127511a95ff3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
127611a95ff3Smrg# maximum flexibilty in controlling documentation building.
127711a95ff3Smrg# Refer to:
127811a95ff3Smrg# XORG_WITH_XMLTO         --with-xmlto
127911a95ff3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
128011a95ff3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
128111a95ff3Smrg# XORG_WITH_FOP           --with-fop
128211a95ff3Smrg# XORG_WITH_GROFF         --with-groff
128311a95ff3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
128411a95ff3Smrg#
128511a95ff3Smrg# Interface to module:
128611a95ff3Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
128711a95ff3Smrg# --enable-specs:	'yes' user instructs the module to generate specs
128811a95ff3Smrg#			'no' user instructs the module not to generate specs
128911a95ff3Smrg# parm1:		specify the default value, yes or no.
129011a95ff3Smrg#
129111a95ff3SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
129211a95ff3Smrgm4_define([spec_default], m4_default([$1], [yes]))
129311a95ff3SmrgAC_ARG_ENABLE(specs,
129411a95ff3Smrg	AS_HELP_STRING([--enable-specs],
129511a95ff3Smrg	   [Enable building the specs (default: ]spec_default[)]),
129611a95ff3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
129711a95ff3Smrgm4_undefine([spec_default])
129811a95ff3SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
129911a95ff3SmrgAC_MSG_CHECKING([whether to build functional specifications])
130011a95ff3SmrgAC_MSG_RESULT([$build_specs])
130111a95ff3Smrg]) # XORG_ENABLE_SPECS
1302a6d9b409Smrg
130311a95ff3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
130411a95ff3Smrg# ----------------------------------------------
130511a95ff3Smrg# Minimum version: 1.13.0
130611a95ff3Smrg#
130711a95ff3Smrg# This macro enables a builder to enable/disable unit testing
130811a95ff3Smrg# It makes no assumption about the test cases implementation
130911a95ff3Smrg# Test cases may or may not use Automake "Support for test suites"
131011a95ff3Smrg# They may or may not use the software utility library GLib
131111a95ff3Smrg#
131211a95ff3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
131311a95ff3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
131411a95ff3Smrg# The variable enable_unit_tests is used by other macros in this file.
131511a95ff3Smrg#
131611a95ff3Smrg# Interface to module:
131711a95ff3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
131811a95ff3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
131911a95ff3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
132011a95ff3Smrg#			'no' user instructs the module not to build tests
132111a95ff3Smrg# parm1:		specify the default value, yes or no.
132211a95ff3Smrg#
132311a95ff3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
132411a95ff3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
132511a95ff3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
132611a95ff3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
132711a95ff3Smrgm4_define([_defopt], m4_default([$1], [auto]))
132811a95ff3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
132911a95ff3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
133011a95ff3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
133111a95ff3Smrgm4_undefine([_defopt])
133211a95ff3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
133311a95ff3SmrgAC_MSG_CHECKING([whether to build unit test cases])
133411a95ff3SmrgAC_MSG_RESULT([$enable_unit_tests])
133511a95ff3Smrg]) # XORG_ENABLE_UNIT_TESTS
1336a6d9b409Smrg
133711a95ff3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
133811a95ff3Smrg# ------------------------------------------------------
133911a95ff3Smrg# Minimum version: 1.17.0
1340a6d9b409Smrg#
134111a95ff3Smrg# This macro enables a builder to enable/disable integration testing
134211a95ff3Smrg# It makes no assumption about the test cases' implementation
134311a95ff3Smrg# Test cases may or may not use Automake "Support for test suites"
134411a95ff3Smrg#
134511a95ff3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
134611a95ff3Smrg# usually requires less dependencies and may be built and run under less
134711a95ff3Smrg# stringent environments than integration tests.
134811a95ff3Smrg#
134911a95ff3Smrg# Interface to module:
135011a95ff3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
135111a95ff3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
135211a95ff3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
135311a95ff3Smrg#                             'no' user instructs the module not to build tests
135411a95ff3Smrg# parm1:                      specify the default value, yes or no.
135511a95ff3Smrg#
135611a95ff3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
135711a95ff3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
135811a95ff3Smrgm4_define([_defopt], m4_default([$1], [auto]))
135911a95ff3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
136011a95ff3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
136111a95ff3Smrg	[enable_integration_tests=$enableval],
136211a95ff3Smrg	[enable_integration_tests=]_defopt)
136311a95ff3Smrgm4_undefine([_defopt])
136411a95ff3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
136511a95ff3Smrg	[test "x$enable_integration_tests" != xno])
136611a95ff3SmrgAC_MSG_CHECKING([whether to build unit test cases])
136711a95ff3SmrgAC_MSG_RESULT([$enable_integration_tests])
136811a95ff3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1369a6d9b409Smrg
137011a95ff3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
137111a95ff3Smrg# ----------------------------------------
137211a95ff3Smrg# Minimum version: 1.13.0
137311a95ff3Smrg#
137411a95ff3Smrg# GLib is a library which provides advanced data structures and functions.
137511a95ff3Smrg# This macro enables a module to test for the presence of Glib.
137611a95ff3Smrg#
137711a95ff3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
137811a95ff3Smrg# Otherwise the value of $enable_unit_tests is blank.
137911a95ff3Smrg#
138011a95ff3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
138111a95ff3Smrg# test support usually requires less dependencies and may be built and run under
138211a95ff3Smrg# less stringent environments than integration tests.
138311a95ff3Smrg#
138411a95ff3Smrg# Interface to module:
138511a95ff3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
138611a95ff3Smrg# with_glib: used in configure.ac to know if GLib has been found
138711a95ff3Smrg# --with-glib:	'yes' user instructs the module to use glib
138811a95ff3Smrg#		'no' user instructs the module not to use glib
138911a95ff3Smrg#
139011a95ff3SmrgAC_DEFUN([XORG_WITH_GLIB],[
139111a95ff3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
139211a95ff3Smrgm4_define([_defopt], m4_default([$2], [auto]))
139311a95ff3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
139411a95ff3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
139511a95ff3Smrg	[with_glib=$withval], [with_glib=]_defopt)
139611a95ff3Smrgm4_undefine([_defopt])
1397a6d9b409Smrg
139811a95ff3Smrghave_glib=no
139911a95ff3Smrg# Do not probe GLib if user explicitly disabled unit testing
140011a95ff3Smrgif test "x$enable_unit_tests" != x"no"; then
140111a95ff3Smrg  # Do not probe GLib if user explicitly disabled it
140211a95ff3Smrg  if test "x$with_glib" != x"no"; then
140311a95ff3Smrg    m4_ifval(
140411a95ff3Smrg      [$1],
140511a95ff3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
140611a95ff3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
140711a95ff3Smrg    )
140811a95ff3Smrg  fi
1409a6d9b409Smrgfi
1410a6d9b409Smrg
141111a95ff3Smrg# Not having GLib when unit testing has been explicitly requested is an error
141211a95ff3Smrgif test "x$enable_unit_tests" = x"yes"; then
141311a95ff3Smrg  if test "x$have_glib" = x"no"; then
141411a95ff3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
141511a95ff3Smrg  fi
1416a6d9b409Smrgfi
1417a6d9b409Smrg
141811a95ff3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
141911a95ff3Smrgif test "x$enable_unit_tests" = x"no"; then
142011a95ff3Smrg  if test "x$with_glib" = x"yes"; then
142111a95ff3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
142211a95ff3Smrg  fi
1423a6d9b409Smrgfi
1424a6d9b409Smrg
142511a95ff3Smrg# Not having GLib when it has been explicitly requested is an error
142611a95ff3Smrgif test "x$with_glib" = x"yes"; then
142711a95ff3Smrg  if test "x$have_glib" = x"no"; then
142811a95ff3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
142911a95ff3Smrg  fi
1430a6d9b409Smrgfi
1431a6d9b409Smrg
143211a95ff3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
143311a95ff3Smrg]) # XORG_WITH_GLIB
1434a6d9b409Smrg
143511a95ff3Smrg# XORG_LD_WRAP([required|optional])
143611a95ff3Smrg# ---------------------------------
143711a95ff3Smrg# Minimum version: 1.13.0
143811a95ff3Smrg#
143911a95ff3Smrg# Check if linker supports -wrap, passed via compiler flags
144011a95ff3Smrg#
144111a95ff3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
144211a95ff3Smrg# Otherwise the value of $enable_unit_tests is blank.
144311a95ff3Smrg#
144411a95ff3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
144511a95ff3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
144611a95ff3Smrg# available, an argument of "optional" allows use when some unit tests require
144711a95ff3Smrg# ld -wrap and others do not.
144811a95ff3Smrg#
144911a95ff3SmrgAC_DEFUN([XORG_LD_WRAP],[
145011a95ff3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
145111a95ff3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
145211a95ff3Smrg                      void __wrap_exit(int status) { return; }],
145311a95ff3Smrg                     [exit(0);])])
145411a95ff3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
145511a95ff3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
145611a95ff3Smrg  if test "x$have_ld_wrap" = x"no"; then
145711a95ff3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
145811a95ff3Smrg  fi
1459a6d9b409Smrgfi
146011a95ff3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
14611e5fa1c5Smrg#
146211a95ff3Smrg]) # XORG_LD_WRAP
14631e5fa1c5Smrg
146411a95ff3Smrg# XORG_CHECK_LINKER_FLAGS
146511a95ff3Smrg# -----------------------
146611a95ff3Smrg# SYNOPSIS
146711a95ff3Smrg#
146811a95ff3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
146911a95ff3Smrg#
147011a95ff3Smrg# DESCRIPTION
147111a95ff3Smrg#
147211a95ff3Smrg#   Check whether the given linker FLAGS work with the current language's
147311a95ff3Smrg#   linker, or whether they give an error.
147411a95ff3Smrg#
147511a95ff3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
147611a95ff3Smrg#   success/failure.
147711a95ff3Smrg#
147811a95ff3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
147911a95ff3Smrg#
148011a95ff3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
148111a95ff3Smrg#
148211a95ff3Smrg# LICENSE
148311a95ff3Smrg#
148411a95ff3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
148511a95ff3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
148611a95ff3Smrg#   Copyright (c) 2009 Matteo Frigo
148711a95ff3Smrg#
148811a95ff3Smrg#   This program is free software: you can redistribute it and/or modify it
148911a95ff3Smrg#   under the terms of the GNU General Public License as published by the
149011a95ff3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
149111a95ff3Smrg#   option) any later version.
149211a95ff3Smrg#
149311a95ff3Smrg#   This program is distributed in the hope that it will be useful, but
149411a95ff3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
149511a95ff3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
149611a95ff3Smrg#   Public License for more details.
149711a95ff3Smrg#
149811a95ff3Smrg#   You should have received a copy of the GNU General Public License along
149911a95ff3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
150011a95ff3Smrg#
150111a95ff3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
150211a95ff3Smrg#   gives unlimited permission to copy, distribute and modify the configure
150311a95ff3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
150411a95ff3Smrg#   need not follow the terms of the GNU General Public License when using
150511a95ff3Smrg#   or distributing such scripts, even though portions of the text of the
150611a95ff3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
150711a95ff3Smrg#   all other use of the material that constitutes the Autoconf Macro.
150811a95ff3Smrg#
150911a95ff3Smrg#   This special exception to the GPL applies to versions of the Autoconf
151011a95ff3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
151111a95ff3Smrg#   modified version of the Autoconf Macro, you may extend this special
151211a95ff3Smrg#   exception to the GPL to apply to your modified version as well.#
151311a95ff3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
151411a95ff3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
151511a95ff3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
151611a95ff3SmrgAS_LITERAL_IF([$1],
151711a95ff3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
151811a95ff3Smrg      ax_save_FLAGS=$LDFLAGS
151911a95ff3Smrg      LDFLAGS="$1"
152011a95ff3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
152111a95ff3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
152211a95ff3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
152311a95ff3Smrg      LDFLAGS=$ax_save_FLAGS])],
152411a95ff3Smrg  [ax_save_FLAGS=$LDFLAGS
152511a95ff3Smrg   LDFLAGS="$1"
152611a95ff3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
152711a95ff3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
152811a95ff3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
152911a95ff3Smrg   LDFLAGS=$ax_save_FLAGS])
153011a95ff3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
153111a95ff3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
153211a95ff3Smrgif test "x$xorg_check_linker_flags" = xyes; then
153311a95ff3Smrg	m4_default([$2], :)
15341e5fa1c5Smrgelse
153511a95ff3Smrg	m4_default([$3], :)
15361e5fa1c5Smrgfi
153711a95ff3Smrg]) # XORG_CHECK_LINKER_FLAGS
15381e5fa1c5Smrg
153911a95ff3Smrg# XORG_MEMORY_CHECK_FLAGS
154011a95ff3Smrg# -----------------------
154111a95ff3Smrg# Minimum version: 1.16.0
1542a6d9b409Smrg#
154311a95ff3Smrg# This macro attempts to find appropriate memory checking functionality
154411a95ff3Smrg# for various platforms which unit testing code may use to catch various
154511a95ff3Smrg# forms of memory allocation and access errors in testing.
154611a95ff3Smrg#
154711a95ff3Smrg# Interface to module:
154811a95ff3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
154911a95ff3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
155011a95ff3Smrg#
155111a95ff3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
155211a95ff3Smrg#
155311a95ff3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1554a6d9b409Smrg
155511a95ff3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
155611a95ff3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
155711a95ff3Smrg           [Environment variables to enable memory checking in tests])
1558a6d9b409Smrg
155911a95ff3Smrg# Check for different types of support on different platforms
156011a95ff3Smrgcase $host_os in
156111a95ff3Smrg    solaris*)
156211a95ff3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
156311a95ff3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
156411a95ff3Smrg        ;;
156511a95ff3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
156611a95ff3Smrg        # both directly and inverted, so should not be 0 or 255.
156711a95ff3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
156811a95ff3Smrg        ;;
156911a95ff3Smrg    darwin*)
157011a95ff3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
157111a95ff3Smrg        ;;
157211a95ff3Smrg    *bsd*)
157311a95ff3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
157411a95ff3Smrg        ;;
157511a95ff3Smrgesac
1576a6d9b409Smrg
157711a95ff3Smrg# User supplied flags override default flags
157811a95ff3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
157911a95ff3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1580a6d9b409Smrgfi
1581a6d9b409Smrg
158211a95ff3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
158311a95ff3Smrg]) # XORG_WITH_LINT
1584a6d9b409Smrg
158511a95ff3Smrg# XORG_CHECK_MALLOC_ZERO
158611a95ff3Smrg# ----------------------
158711a95ff3Smrg# Minimum version: 1.0.0
158811a95ff3Smrg#
158911a95ff3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
159011a95ff3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
159111a95ff3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
159211a95ff3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
159311a95ff3SmrgAC_ARG_ENABLE(malloc0returnsnull,
159411a95ff3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
159511a95ff3Smrg		       [malloc(0) returns NULL (default: auto)]),
159611a95ff3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
159711a95ff3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1598a6d9b409Smrg
159911a95ff3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
160011a95ff3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
160111a95ff3SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
160211a95ff3Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
160311a95ff3Smrg#include <stdlib.h>
160411a95ff3Smrg],[
160511a95ff3Smrg    char *m0, *r0, *c0, *p;
160611a95ff3Smrg    m0 = malloc(0);
160711a95ff3Smrg    p = malloc(10);
160811a95ff3Smrg    r0 = realloc(p,0);
160911a95ff3Smrg    c0 = calloc(0,10);
161011a95ff3Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
161111a95ff3Smrg])],
161211a95ff3Smrg		[xorg_cv_malloc0_returns_null=yes],
161311a95ff3Smrg		[xorg_cv_malloc0_returns_null=no])])
161411a95ff3SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
161511a95ff3Smrgfi
161611a95ff3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1617a6d9b409Smrg
161811a95ff3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
161911a95ff3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
162011a95ff3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
162111a95ff3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1622a6d9b409Smrgelse
162311a95ff3Smrg	MALLOC_ZERO_CFLAGS=""
162411a95ff3Smrg	XMALLOC_ZERO_CFLAGS=""
162511a95ff3Smrg	XTMALLOC_ZERO_CFLAGS=""
1626a6d9b409Smrgfi
1627a6d9b409Smrg
162811a95ff3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
162911a95ff3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
163011a95ff3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
163111a95ff3Smrg]) # XORG_CHECK_MALLOC_ZERO
1632a6d9b409Smrg
163311a95ff3Smrg# XORG_WITH_LINT()
163411a95ff3Smrg# ----------------
163511a95ff3Smrg# Minimum version: 1.1.0
1636a6d9b409Smrg#
163711a95ff3Smrg# This macro enables the use of a tool that flags some suspicious and
163811a95ff3Smrg# non-portable constructs (likely to be bugs) in C language source code.
163911a95ff3Smrg# It will attempt to locate the tool and use appropriate options.
164011a95ff3Smrg# There are various lint type tools on different platforms.
164111a95ff3Smrg#
164211a95ff3Smrg# Interface to module:
164311a95ff3Smrg# LINT:		returns the path to the tool found on the platform
164411a95ff3Smrg#		or the value set to LINT on the configure cmd line
164511a95ff3Smrg#		also an Automake conditional
164611a95ff3Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
164711a95ff3Smrg#
164811a95ff3Smrg# --with-lint:	'yes' user instructs the module to use lint
164911a95ff3Smrg#		'no' user instructs the module not to use lint (default)
165011a95ff3Smrg#
165111a95ff3Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
165211a95ff3Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
165311a95ff3Smrg#
165411a95ff3SmrgAC_DEFUN([XORG_WITH_LINT],[
16551e5fa1c5Smrg
165611a95ff3SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
165711a95ff3SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
165811a95ff3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
165911a95ff3Smrg		[Use a lint-style source code checker (default: disabled)])],
166011a95ff3Smrg		[use_lint=$withval], [use_lint=no])
1661a6d9b409Smrg
166211a95ff3Smrg# Obtain platform specific info like program name and options
166311a95ff3Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
166411a95ff3Smrgcase $host_os in
166511a95ff3Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
166611a95ff3Smrg	lint_name=splint
166711a95ff3Smrg	lint_options="-badflag"
166811a95ff3Smrg	;;
166911a95ff3Smrg  *freebsd* | *netbsd*)
167011a95ff3Smrg	lint_name=lint
167111a95ff3Smrg	lint_options="-u -b"
167211a95ff3Smrg	;;
167311a95ff3Smrg  *solaris*)
167411a95ff3Smrg	lint_name=lint
167511a95ff3Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
167611a95ff3Smrg	;;
167711a95ff3Smrgesac
1678a6d9b409Smrg
167911a95ff3Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
168011a95ff3Smrgif test "x$use_lint" = x"yes" ; then
168111a95ff3Smrg   AC_PATH_PROG([LINT], [$lint_name])
168211a95ff3Smrg   if test "x$LINT" = "x"; then
168311a95ff3Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
168411a95ff3Smrg   fi
168511a95ff3Smrgelif test "x$use_lint" = x"no" ; then
168611a95ff3Smrg   if test "x$LINT" != "x"; then
168711a95ff3Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
168811a95ff3Smrg   fi
168911a95ff3Smrgelse
169011a95ff3Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1691a6d9b409Smrgfi
1692a6d9b409Smrg
169311a95ff3Smrg# User supplied flags override default flags
169411a95ff3Smrgif test "x$LINT_FLAGS" != "x"; then
169511a95ff3Smrg   lint_options=$LINT_FLAGS
1696a6d9b409Smrgfi
1697a6d9b409Smrg
169811a95ff3SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
169911a95ff3SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1700a6d9b409Smrg
170111a95ff3Smrg]) # XORG_WITH_LINT
1702a6d9b409Smrg
170311a95ff3Smrg# XORG_LINT_LIBRARY(LIBNAME)
170411a95ff3Smrg# --------------------------
170511a95ff3Smrg# Minimum version: 1.1.0
17061e5fa1c5Smrg#
170711a95ff3Smrg# Sets up flags for building lint libraries for checking programs that call
170811a95ff3Smrg# functions in the library.
17091e5fa1c5Smrg#
17101e5fa1c5Smrg# Interface to module:
171111a95ff3Smrg# LINTLIB		- Automake variable with the name of lint library file to make
171211a95ff3Smrg# MAKE_LINT_LIB		- Automake conditional
17131e5fa1c5Smrg#
171411a95ff3Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
171511a95ff3Smrg#			  - 'no' user instructs the module not to create a lint library (default)
17161e5fa1c5Smrg
171711a95ff3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
171811a95ff3SmrgAC_REQUIRE([XORG_WITH_LINT])
171911a95ff3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
172011a95ff3Smrg	[Create lint library (default: disabled)])],
172111a95ff3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
172211a95ff3Smrg
172311a95ff3Smrgif test "x$make_lint_lib" = x"yes" ; then
172411a95ff3Smrg   LINTLIB=llib-l$1.ln
172511a95ff3Smrg   if test "x$LINT" = "x"; then
172611a95ff3Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
17271e5fa1c5Smrg   fi
172811a95ff3Smrgelif test "x$make_lint_lib" != x"no" ; then
172911a95ff3Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
17301e5fa1c5Smrgfi
1731a097bd00Smrg
173211a95ff3SmrgAC_SUBST(LINTLIB)
173311a95ff3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1734a097bd00Smrg
173511a95ff3Smrg]) # XORG_LINT_LIBRARY
17361e5fa1c5Smrg
173711a95ff3Smrg# XORG_COMPILER_BRAND
173811a95ff3Smrg# -------------------
173911a95ff3Smrg# Minimum version: 1.14.0
1740a097bd00Smrg#
174111a95ff3Smrg# Checks for various brands of compilers and sets flags as appropriate:
174211a95ff3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
174311a95ff3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
174411a95ff3Smrg#   clang compiler - sets CLANGCC to "yes"
174511a95ff3Smrg#   Intel compiler - sets INTELCC to "yes"
174611a95ff3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1747a097bd00Smrg#
174811a95ff3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
174911a95ff3SmrgAC_LANG_CASE(
175011a95ff3Smrg	[C], [
175111a95ff3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
175211a95ff3Smrg	],
175311a95ff3Smrg	[C++], [
175411a95ff3Smrg		AC_REQUIRE([AC_PROG_CXX])
175511a95ff3Smrg	]
175611a95ff3Smrg)
175711a95ff3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
175811a95ff3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
175911a95ff3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
176011a95ff3Smrg]) # XORG_COMPILER_BRAND
176111a95ff3Smrg
176211a95ff3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
176311a95ff3Smrg# ---------------
176411a95ff3Smrg# Minimum version: 1.16.0
1765a097bd00Smrg#
176611a95ff3Smrg# Test if the compiler works when passed the given flag as a command line argument.
176711a95ff3Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
176811a95ff3Smrg# next flag in the list until there are no more options.
1769a097bd00Smrg#
177011a95ff3Smrg# Note that this does not guarantee that the compiler supports the flag as some
177111a95ff3Smrg# compilers will simply ignore arguments that they do not understand, but we do
177211a95ff3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
177311a95ff3Smrg# -Werror=unused-command-line-argument
177411a95ff3Smrg#
177511a95ff3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
177611a95ff3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
177711a95ff3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1778a097bd00Smrg
177911a95ff3SmrgAC_LANG_COMPILER_REQUIRE
1780a097bd00Smrg
178111a95ff3SmrgAC_LANG_CASE(
178211a95ff3Smrg	[C], [
178311a95ff3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
178411a95ff3Smrg		define([PREFIX], [C])
178511a95ff3Smrg		define([CACHE_PREFIX], [cc])
178611a95ff3Smrg		define([COMPILER], [$CC])
178711a95ff3Smrg	],
178811a95ff3Smrg	[C++], [
178911a95ff3Smrg		define([PREFIX], [CXX])
179011a95ff3Smrg		define([CACHE_PREFIX], [cxx])
179111a95ff3Smrg		define([COMPILER], [$CXX])
179211a95ff3Smrg	]
179311a95ff3Smrg)
1794a097bd00Smrg
179511a95ff3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1796a097bd00Smrg
179711a95ff3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
179811a95ff3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
179911a95ff3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
180011a95ff3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
180111a95ff3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
180211a95ff3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
180311a95ff3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
180411a95ff3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
180511a95ff3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1806a097bd00Smrgfi
1807a097bd00Smrg
180811a95ff3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
180911a95ff3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
181011a95ff3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
181111a95ff3Smrg	fi
181211a95ff3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
181311a95ff3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
181411a95ff3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
181511a95ff3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
181611a95ff3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
181711a95ff3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
181811a95ff3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
181911a95ff3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
182011a95ff3Smrgfi
1821a097bd00Smrg
182211a95ff3Smrgfound="no"
182311a95ff3Smrgm4_foreach([flag], m4_cdr($@), [
182411a95ff3Smrg	if test $found = "no" ; then
182511a95ff3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
182611a95ff3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
182711a95ff3Smrg		fi
182811a95ff3Smrg
182911a95ff3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
183011a95ff3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
183111a95ff3Smrg		fi
183211a95ff3Smrg
183311a95ff3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
183411a95ff3Smrg
183511a95ff3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
183611a95ff3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
183711a95ff3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
183811a95ff3Smrg		AC_CACHE_VAL($cacheid,
183911a95ff3Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
184011a95ff3Smrg					     [eval $cacheid=yes],
184111a95ff3Smrg					     [eval $cacheid=no])])
184211a95ff3Smrg
184311a95ff3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
184411a95ff3Smrg
184511a95ff3Smrg		eval supported=\$$cacheid
184611a95ff3Smrg		AC_MSG_RESULT([$supported])
184711a95ff3Smrg		if test "$supported" = "yes" ; then
184811a95ff3Smrg			$1="$$1 ]flag["
184911a95ff3Smrg			found="yes"
185011a95ff3Smrg		fi
185111a95ff3Smrg	fi
185211a95ff3Smrg])
185311a95ff3Smrg]) # XORG_TESTSET_CFLAG
185411a95ff3Smrg
185511a95ff3Smrg# XORG_COMPILER_FLAGS
185611a95ff3Smrg# ---------------
185711a95ff3Smrg# Minimum version: 1.16.0
18581e5fa1c5Smrg#
185911a95ff3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
186011a95ff3Smrg# arguments supported by the selected compiler which do NOT alter the generated
186111a95ff3Smrg# code.  These arguments will cause the compiler to print various warnings
186211a95ff3Smrg# during compilation AND turn a conservative set of warnings into errors.
18631e5fa1c5Smrg#
186411a95ff3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
186511a95ff3Smrg# future versions of util-macros as options are added to new compilers.
18661e5fa1c5Smrg#
186711a95ff3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
186811a95ff3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
18691e5fa1c5Smrg
187011a95ff3SmrgAC_ARG_ENABLE(selective-werror,
187111a95ff3Smrg              AS_HELP_STRING([--disable-selective-werror],
187211a95ff3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
187311a95ff3Smrg              [SELECTIVE_WERROR=$enableval],
187411a95ff3Smrg              [SELECTIVE_WERROR=yes])
187511a95ff3Smrg
187611a95ff3SmrgAC_LANG_CASE(
187711a95ff3Smrg        [C], [
187811a95ff3Smrg                define([PREFIX], [C])
187911a95ff3Smrg        ],
188011a95ff3Smrg        [C++], [
188111a95ff3Smrg                define([PREFIX], [CXX])
188211a95ff3Smrg        ]
188311a95ff3Smrg)
188411a95ff3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
188511a95ff3Smrgif test "x$SUNCC" = "xyes"; then
188611a95ff3Smrg    [BASE_]PREFIX[FLAGS]="-v"
18871e5fa1c5Smrgelse
188811a95ff3Smrg    [BASE_]PREFIX[FLAGS]=""
18891e5fa1c5Smrgfi
18901e5fa1c5Smrg
189111a95ff3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
189211a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
189311a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
189411a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
189511a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
18961e5fa1c5Smrg
189711a95ff3SmrgAC_LANG_CASE(
189811a95ff3Smrg	[C], [
189911a95ff3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
190011a95ff3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
190111a95ff3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
190211a95ff3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
190311a95ff3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
190411a95ff3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
190511a95ff3Smrg	]
190611a95ff3Smrg)
1907b91640d3Smrg
190811a95ff3Smrg# This chunk adds additional warnings that could catch undesired effects.
190911a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
191011a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
191111a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
191211a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
191311a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
191411a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
191511a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
191611a95ff3Smrg
191711a95ff3Smrg# These are currently disabled because they are noisy.  They will be enabled
191811a95ff3Smrg# in the future once the codebase is sufficiently modernized to silence
191911a95ff3Smrg# them.  For now, I don't want them to drown out the other warnings.
192011a95ff3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
192111a95ff3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
192211a95ff3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
192311a95ff3Smrg
192411a95ff3Smrg# Turn some warnings into errors, so we don't accidently get successful builds
192511a95ff3Smrg# when there are problems that should be fixed.
192611a95ff3Smrg
192711a95ff3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
192811a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
192911a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
193011a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
193111a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
193211a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
193311a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
193411a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
193511a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
193611a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
193711a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
193811a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
193911a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
194011a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
194111a95ff3Smrgelse
194211a95ff3SmrgAC_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])
194311a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
194411a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
194511a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
194611a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
194711a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
194811a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
194911a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
195011a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
195111a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
195211a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
195311a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
195411a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
195511a95ff3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
1956b91640d3Smrgfi
1957b91640d3Smrg
195811a95ff3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
195911a95ff3Smrg]) # XORG_COMPILER_FLAGS
19601e5fa1c5Smrg
196111a95ff3Smrg# XORG_CWARNFLAGS
196211a95ff3Smrg# ---------------
196311a95ff3Smrg# Minimum version: 1.2.0
196411a95ff3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
19651e5fa1c5Smrg#
196611a95ff3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
1967a097bd00Smrg#
196811a95ff3Smrg# This function is deprecated because it defines -fno-strict-aliasing
196911a95ff3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
197011a95ff3Smrg# is needed, then it should be added explicitly in the module when
197111a95ff3Smrg# it is updated to use BASE_CFLAGS.
19721e5fa1c5Smrg#
197311a95ff3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
197411a95ff3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
197511a95ff3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
197611a95ff3SmrgAC_LANG_CASE(
197711a95ff3Smrg	[C], [
197811a95ff3Smrg		CWARNFLAGS="$BASE_CFLAGS"
197911a95ff3Smrg		if  test "x$GCC" = xyes ; then
198011a95ff3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
198111a95ff3Smrg		fi
198211a95ff3Smrg		AC_SUBST(CWARNFLAGS)
198311a95ff3Smrg	]
198411a95ff3Smrg)
198511a95ff3Smrg]) # XORG_CWARNFLAGS
198611a95ff3Smrg
198711a95ff3Smrg# XORG_STRICT_OPTION
198811a95ff3Smrg# -----------------------
198911a95ff3Smrg# Minimum version: 1.3.0
19901e5fa1c5Smrg#
199111a95ff3Smrg# Add configure option to enable strict compilation flags, such as treating
199211a95ff3Smrg# warnings as fatal errors.
199311a95ff3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
199411a95ff3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
19951e5fa1c5Smrg#
199611a95ff3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
199711a95ff3Smrg# when strict compilation is unconditionally desired.
199811a95ff3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
199911a95ff3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
200011a95ff3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20011e5fa1c5Smrg
200211a95ff3SmrgAC_ARG_ENABLE(strict-compilation,
200311a95ff3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
200411a95ff3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
200511a95ff3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2006a097bd00Smrg
200711a95ff3SmrgAC_LANG_CASE(
200811a95ff3Smrg        [C], [
200911a95ff3Smrg                define([PREFIX], [C])
201011a95ff3Smrg        ],
201111a95ff3Smrg        [C++], [
201211a95ff3Smrg                define([PREFIX], [CXX])
201311a95ff3Smrg        ]
201411a95ff3Smrg)
2015a097bd00Smrg
201611a95ff3Smrg[STRICT_]PREFIX[FLAGS]=""
201711a95ff3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
201811a95ff3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2019a097bd00Smrg
202011a95ff3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
202111a95ff3Smrg# activate it with -Werror, so we add it here explicitly.
202211a95ff3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20231e5fa1c5Smrg
202411a95ff3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
202511a95ff3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
202611a95ff3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
202711a95ff3Smrgfi
202811a95ff3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
202911a95ff3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203011a95ff3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
203111a95ff3Smrg]) # XORG_STRICT_OPTION
203211a95ff3Smrg
203311a95ff3Smrg# XORG_DEFAULT_OPTIONS
203411a95ff3Smrg# --------------------
203511a95ff3Smrg# Minimum version: 1.3.0
20361e5fa1c5Smrg#
203711a95ff3Smrg# Defines default options for X.Org modules.
20381e5fa1c5Smrg#
203911a95ff3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
204011a95ff3SmrgAC_REQUIRE([AC_PROG_INSTALL])
204111a95ff3SmrgXORG_COMPILER_FLAGS
204211a95ff3SmrgXORG_CWARNFLAGS
204311a95ff3SmrgXORG_STRICT_OPTION
204411a95ff3SmrgXORG_RELEASE_VERSION
204511a95ff3SmrgXORG_CHANGELOG
204611a95ff3SmrgXORG_INSTALL
204711a95ff3SmrgXORG_MANPAGE_SECTIONS
204811a95ff3Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
204911a95ff3Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
205011a95ff3Smrg]) # XORG_DEFAULT_OPTIONS
205111a95ff3Smrg
205211a95ff3Smrg# XORG_INSTALL()
205311a95ff3Smrg# ----------------
205411a95ff3Smrg# Minimum version: 1.4.0
20551e5fa1c5Smrg#
205611a95ff3Smrg# Defines the variable INSTALL_CMD as the command to copy
205711a95ff3Smrg# INSTALL from $prefix/share/util-macros.
20581e5fa1c5Smrg#
205911a95ff3SmrgAC_DEFUN([XORG_INSTALL], [
206011a95ff3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
206111a95ff3Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
206211a95ff3SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
206311a95ff3Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
206411a95ff3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
206511a95ff3Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
206611a95ff3SmrgAC_SUBST([INSTALL_CMD])
206711a95ff3Smrg]) # XORG_INSTALL
206811a95ff3Smrgdnl Copyright 2005 Red Hat, Inc
206911a95ff3Smrgdnl
207011a95ff3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
207111a95ff3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
207211a95ff3Smrgdnl the above copyright notice appear in all copies and that both that
207311a95ff3Smrgdnl copyright notice and this permission notice appear in supporting
207411a95ff3Smrgdnl documentation.
207511a95ff3Smrgdnl
207611a95ff3Smrgdnl The above copyright notice and this permission notice shall be included
207711a95ff3Smrgdnl in all copies or substantial portions of the Software.
207811a95ff3Smrgdnl
207911a95ff3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
208011a95ff3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
208111a95ff3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
208211a95ff3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
208311a95ff3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
208411a95ff3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208511a95ff3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
208611a95ff3Smrgdnl
208711a95ff3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
208811a95ff3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
208911a95ff3Smrgdnl other dealings in this Software without prior written authorization
209011a95ff3Smrgdnl from the copyright holders.
209111a95ff3Smrgdnl
20921e5fa1c5Smrg
209311a95ff3Smrg# XORG_RELEASE_VERSION
209411a95ff3Smrg# --------------------
209511a95ff3Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2096a097bd00Smrg
209711a95ff3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
209811a95ff3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
209911a95ff3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
210011a95ff3Smrg		[Major version of this package])
210111a95ff3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
210211a95ff3Smrg	if test "x$PVM" = "x"; then
210311a95ff3Smrg		PVM="0"
210411a95ff3Smrg	fi
210511a95ff3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
210611a95ff3Smrg		[$PVM],
210711a95ff3Smrg		[Minor version of this package])
210811a95ff3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
210911a95ff3Smrg	if test "x$PVP" = "x"; then
211011a95ff3Smrg		PVP="0"
211111a95ff3Smrg	fi
211211a95ff3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
211311a95ff3Smrg		[$PVP],
211411a95ff3Smrg		[Patch version of this package])
211511a95ff3Smrg])
21161e5fa1c5Smrg
211711a95ff3Smrg# XORG_CHANGELOG()
211811a95ff3Smrg# ----------------
211911a95ff3Smrg# Minimum version: 1.2.0
2120b91640d3Smrg#
212111a95ff3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
212211a95ff3Smrg# ChangeLog from git.
2123b91640d3Smrg#
2124b91640d3Smrg#
212511a95ff3SmrgAC_DEFUN([XORG_CHANGELOG], [
212611a95ff3SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
212711a95ff3Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
212811a95ff3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
212911a95ff3Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
213011a95ff3SmrgAC_SUBST([CHANGELOG_CMD])
213111a95ff3Smrg]) # XORG_CHANGELOG
2132b91640d3Smrg
213311a95ff3Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
21341e5fa1c5Smrg#
213511a95ff3Smrg# This file is free software; the Free Software Foundation
213611a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
213711a95ff3Smrg# with or without modifications, as long as this notice is preserved.
213811a95ff3Smrg
213911a95ff3Smrg# AM_AUTOMAKE_VERSION(VERSION)
214011a95ff3Smrg# ----------------------------
214111a95ff3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
214211a95ff3Smrg# generated from the m4 files accompanying Automake X.Y.
214311a95ff3Smrg# (This private macro should not be called outside this file.)
214411a95ff3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
214511a95ff3Smrg[am__api_version='1.15'
214611a95ff3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
214711a95ff3Smrgdnl require some minimum version.  Point them to the right macro.
214811a95ff3Smrgm4_if([$1], [1.15], [],
214911a95ff3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
215011a95ff3Smrg])
215111a95ff3Smrg
215211a95ff3Smrg# _AM_AUTOCONF_VERSION(VERSION)
215311a95ff3Smrg# -----------------------------
215411a95ff3Smrg# aclocal traces this macro to find the Autoconf version.
215511a95ff3Smrg# This is a private macro too.  Using m4_define simplifies
215611a95ff3Smrg# the logic in aclocal, which can simply ignore this definition.
215711a95ff3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
215811a95ff3Smrg
215911a95ff3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
216011a95ff3Smrg# -------------------------------
216111a95ff3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
216211a95ff3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
216311a95ff3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
216411a95ff3Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
216511a95ff3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
216611a95ff3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
216711a95ff3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
216811a95ff3Smrg
216911a95ff3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
217011a95ff3Smrg
217111a95ff3Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
21721e5fa1c5Smrg#
217311a95ff3Smrg# This file is free software; the Free Software Foundation
217411a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
217511a95ff3Smrg# with or without modifications, as long as this notice is preserved.
217611a95ff3Smrg
217711a95ff3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
217811a95ff3Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
217911a95ff3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
21801e5fa1c5Smrg#
218111a95ff3Smrg# Of course, Automake must honor this variable whenever it calls a
218211a95ff3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
218311a95ff3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
218411a95ff3Smrg# depending on how configure is run.  This is pretty annoying, since
218511a95ff3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
218611a95ff3Smrg# source directory, any form will work fine, but in subdirectories a
218711a95ff3Smrg# relative path needs to be adjusted first.
21881e5fa1c5Smrg#
218911a95ff3Smrg# $ac_aux_dir/missing
219011a95ff3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
219111a95ff3Smrg# $top_srcdir/$ac_aux_dir/missing
219211a95ff3Smrg#    fails if $ac_aux_dir is absolute,
219311a95ff3Smrg#    fails when called from a subdirectory in a VPATH build with
219411a95ff3Smrg#          a relative $ac_aux_dir
21951e5fa1c5Smrg#
219611a95ff3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
219711a95ff3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
219811a95ff3Smrg# harmless because $srcdir is '.', but things will broke when you
219911a95ff3Smrg# start a VPATH build or use an absolute $srcdir.
22001e5fa1c5Smrg#
220111a95ff3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
220211a95ff3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
220311a95ff3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
220411a95ff3Smrg# and then we would define $MISSING as
220511a95ff3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
220611a95ff3Smrg# This will work as long as MISSING is not called from configure, because
220711a95ff3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
220811a95ff3Smrg# However there are other variables, like CC, which are often used in
220911a95ff3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
22101e5fa1c5Smrg#
221111a95ff3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
221211a95ff3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
221311a95ff3Smrg# configured tree to be moved without reconfiguration.
22141e5fa1c5Smrg
221511a95ff3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
221611a95ff3Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
221711a95ff3Smrg# Expand $ac_aux_dir to an absolute path.
221811a95ff3Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
221911a95ff3Smrg])
222011a95ff3Smrg
222111a95ff3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
222211a95ff3Smrg
222311a95ff3Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
22241e5fa1c5Smrg#
222511a95ff3Smrg# This file is free software; the Free Software Foundation
222611a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
222711a95ff3Smrg# with or without modifications, as long as this notice is preserved.
222811a95ff3Smrg
222911a95ff3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
223011a95ff3Smrg# -------------------------------------
223111a95ff3Smrg# Define a conditional.
223211a95ff3SmrgAC_DEFUN([AM_CONDITIONAL],
223311a95ff3Smrg[AC_PREREQ([2.52])dnl
223411a95ff3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
223511a95ff3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
223611a95ff3SmrgAC_SUBST([$1_TRUE])dnl
223711a95ff3SmrgAC_SUBST([$1_FALSE])dnl
223811a95ff3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
223911a95ff3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
224011a95ff3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
224111a95ff3Smrgif $2; then
224211a95ff3Smrg  $1_TRUE=
224311a95ff3Smrg  $1_FALSE='#'
224411a95ff3Smrgelse
224511a95ff3Smrg  $1_TRUE='#'
224611a95ff3Smrg  $1_FALSE=
224711a95ff3Smrgfi
224811a95ff3SmrgAC_CONFIG_COMMANDS_PRE(
224911a95ff3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
225011a95ff3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
225111a95ff3SmrgUsually this means the macro was only invoked conditionally.]])
225211a95ff3Smrgfi])])
225311a95ff3Smrg
225411a95ff3Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
22551e5fa1c5Smrg#
225611a95ff3Smrg# This file is free software; the Free Software Foundation
225711a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
225811a95ff3Smrg# with or without modifications, as long as this notice is preserved.
225911a95ff3Smrg
226011a95ff3Smrg
226111a95ff3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
226211a95ff3Smrg# written in clear, in which case automake, when reading aclocal.m4,
226311a95ff3Smrg# will think it sees a *use*, and therefore will trigger all it's
226411a95ff3Smrg# C support machinery.  Also note that it means that autoscan, seeing
226511a95ff3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
226611a95ff3Smrg
226711a95ff3Smrg
226811a95ff3Smrg# _AM_DEPENDENCIES(NAME)
226911a95ff3Smrg# ----------------------
227011a95ff3Smrg# See how the compiler implements dependency checking.
227111a95ff3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
227211a95ff3Smrg# We try a few techniques and use that to set a single cache variable.
22731e5fa1c5Smrg#
227411a95ff3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
227511a95ff3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
227611a95ff3Smrg# dependency, and given that the user is not expected to run this macro,
227711a95ff3Smrg# just rely on AC_PROG_CC.
227811a95ff3SmrgAC_DEFUN([_AM_DEPENDENCIES],
227911a95ff3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
228011a95ff3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
228111a95ff3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
228211a95ff3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
228311a95ff3Smrg
228411a95ff3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
228511a95ff3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
228611a95ff3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
228711a95ff3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
228811a95ff3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
228911a95ff3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
229011a95ff3Smrg                    [depcc="$$1"   am_compiler_list=])
229111a95ff3Smrg
229211a95ff3SmrgAC_CACHE_CHECK([dependency style of $depcc],
229311a95ff3Smrg               [am_cv_$1_dependencies_compiler_type],
229411a95ff3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
229511a95ff3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
229611a95ff3Smrg  # making bogus files that we don't know about and never remove.  For
229711a95ff3Smrg  # instance it was reported that on HP-UX the gcc test will end up
229811a95ff3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
229911a95ff3Smrg  # in D".
230011a95ff3Smrg  rm -rf conftest.dir
230111a95ff3Smrg  mkdir conftest.dir
230211a95ff3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
230311a95ff3Smrg  # using a relative directory.
230411a95ff3Smrg  cp "$am_depcomp" conftest.dir
230511a95ff3Smrg  cd conftest.dir
230611a95ff3Smrg  # We will build objects and dependencies in a subdirectory because
230711a95ff3Smrg  # it helps to detect inapplicable dependency modes.  For instance
230811a95ff3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
230911a95ff3Smrg  # side effect of compilation, but ICC will put the dependencies in
231011a95ff3Smrg  # the current directory while Tru64 will put them in the object
231111a95ff3Smrg  # directory.
231211a95ff3Smrg  mkdir sub
231311a95ff3Smrg
231411a95ff3Smrg  am_cv_$1_dependencies_compiler_type=none
231511a95ff3Smrg  if test "$am_compiler_list" = ""; then
231611a95ff3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
231711a95ff3Smrg  fi
231811a95ff3Smrg  am__universal=false
231911a95ff3Smrg  m4_case([$1], [CC],
232011a95ff3Smrg    [case " $depcc " in #(
232111a95ff3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
232211a95ff3Smrg     esac],
232311a95ff3Smrg    [CXX],
232411a95ff3Smrg    [case " $depcc " in #(
232511a95ff3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
232611a95ff3Smrg     esac])
232711a95ff3Smrg
232811a95ff3Smrg  for depmode in $am_compiler_list; do
232911a95ff3Smrg    # Setup a source with many dependencies, because some compilers
233011a95ff3Smrg    # like to wrap large dependency lists on column 80 (with \), and
233111a95ff3Smrg    # we should not choose a depcomp mode which is confused by this.
233211a95ff3Smrg    #
233311a95ff3Smrg    # We need to recreate these files for each test, as the compiler may
233411a95ff3Smrg    # overwrite some of them when testing with obscure command lines.
233511a95ff3Smrg    # This happens at least with the AIX C compiler.
233611a95ff3Smrg    : > sub/conftest.c
233711a95ff3Smrg    for i in 1 2 3 4 5 6; do
233811a95ff3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
233911a95ff3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
234011a95ff3Smrg      # Solaris 10 /bin/sh.
234111a95ff3Smrg      echo '/* dummy */' > sub/conftst$i.h
234211a95ff3Smrg    done
234311a95ff3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234411a95ff3Smrg
234511a95ff3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
234611a95ff3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
234711a95ff3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
234811a95ff3Smrg    # versions had trouble with output in subdirs.
234911a95ff3Smrg    am__obj=sub/conftest.${OBJEXT-o}
235011a95ff3Smrg    am__minus_obj="-o $am__obj"
235111a95ff3Smrg    case $depmode in
235211a95ff3Smrg    gcc)
235311a95ff3Smrg      # This depmode causes a compiler race in universal mode.
235411a95ff3Smrg      test "$am__universal" = false || continue
235511a95ff3Smrg      ;;
235611a95ff3Smrg    nosideeffect)
235711a95ff3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
235811a95ff3Smrg      # only be used when explicitly requested.
235911a95ff3Smrg      if test "x$enable_dependency_tracking" = xyes; then
236011a95ff3Smrg	continue
236111a95ff3Smrg      else
236211a95ff3Smrg	break
236311a95ff3Smrg      fi
236411a95ff3Smrg      ;;
236511a95ff3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
236611a95ff3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
236711a95ff3Smrg      # not run yet.  These depmodes are late enough in the game, and
236811a95ff3Smrg      # so weak that their functioning should not be impacted.
236911a95ff3Smrg      am__obj=conftest.${OBJEXT-o}
237011a95ff3Smrg      am__minus_obj=
237111a95ff3Smrg      ;;
237211a95ff3Smrg    none) break ;;
237311a95ff3Smrg    esac
237411a95ff3Smrg    if depmode=$depmode \
237511a95ff3Smrg       source=sub/conftest.c object=$am__obj \
237611a95ff3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
237711a95ff3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
237811a95ff3Smrg         >/dev/null 2>conftest.err &&
237911a95ff3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
238011a95ff3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
238111a95ff3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
238211a95ff3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
238311a95ff3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
238411a95ff3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
238511a95ff3Smrg      # that says an option was ignored or not supported.
238611a95ff3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
238711a95ff3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
238811a95ff3Smrg      # The diagnosis changed in icc 8.0:
238911a95ff3Smrg      #   icc: Command line remark: option '-MP' not supported
239011a95ff3Smrg      if (grep 'ignoring option' conftest.err ||
239111a95ff3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
239211a95ff3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
239311a95ff3Smrg        break
239411a95ff3Smrg      fi
239511a95ff3Smrg    fi
239611a95ff3Smrg  done
239711a95ff3Smrg
239811a95ff3Smrg  cd ..
239911a95ff3Smrg  rm -rf conftest.dir
240011a95ff3Smrgelse
240111a95ff3Smrg  am_cv_$1_dependencies_compiler_type=none
240211a95ff3Smrgfi
240311a95ff3Smrg])
240411a95ff3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
240511a95ff3SmrgAM_CONDITIONAL([am__fastdep$1], [
240611a95ff3Smrg  test "x$enable_dependency_tracking" != xno \
240711a95ff3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
240811a95ff3Smrg])
240911a95ff3Smrg
241011a95ff3Smrg
241111a95ff3Smrg# AM_SET_DEPDIR
241211a95ff3Smrg# -------------
241311a95ff3Smrg# Choose a directory name for dependency files.
241411a95ff3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
241511a95ff3SmrgAC_DEFUN([AM_SET_DEPDIR],
241611a95ff3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
241711a95ff3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
241811a95ff3Smrg])
241911a95ff3Smrg
242011a95ff3Smrg
242111a95ff3Smrg# AM_DEP_TRACK
242211a95ff3Smrg# ------------
242311a95ff3SmrgAC_DEFUN([AM_DEP_TRACK],
242411a95ff3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
242511a95ff3SmrgAS_HELP_STRING(
242611a95ff3Smrg  [--enable-dependency-tracking],
242711a95ff3Smrg  [do not reject slow dependency extractors])
242811a95ff3SmrgAS_HELP_STRING(
242911a95ff3Smrg  [--disable-dependency-tracking],
243011a95ff3Smrg  [speeds up one-time build])])
243111a95ff3Smrgif test "x$enable_dependency_tracking" != xno; then
243211a95ff3Smrg  am_depcomp="$ac_aux_dir/depcomp"
243311a95ff3Smrg  AMDEPBACKSLASH='\'
243411a95ff3Smrg  am__nodep='_no'
243511a95ff3Smrgfi
243611a95ff3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
243711a95ff3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
243811a95ff3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
243911a95ff3SmrgAC_SUBST([am__nodep])dnl
244011a95ff3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
244111a95ff3Smrg])
24421e5fa1c5Smrg
244311a95ff3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
24441e5fa1c5Smrg
244511a95ff3Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2446a097bd00Smrg#
244711a95ff3Smrg# This file is free software; the Free Software Foundation
244811a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
244911a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2450a097bd00Smrg
2451a097bd00Smrg
245211a95ff3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
245311a95ff3Smrg# ------------------------------
245411a95ff3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
245511a95ff3Smrg[{
245611a95ff3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
245711a95ff3Smrg  # are listed without --file.  Let's play safe and only enable the eval
245811a95ff3Smrg  # if we detect the quoting.
245911a95ff3Smrg  case $CONFIG_FILES in
246011a95ff3Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
246111a95ff3Smrg  *)   set x $CONFIG_FILES ;;
246211a95ff3Smrg  esac
246311a95ff3Smrg  shift
246411a95ff3Smrg  for mf
246511a95ff3Smrg  do
246611a95ff3Smrg    # Strip MF so we end up with the name of the file.
246711a95ff3Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
246811a95ff3Smrg    # Check whether this is an Automake generated Makefile or not.
246911a95ff3Smrg    # We used to match only the files named 'Makefile.in', but
247011a95ff3Smrg    # some people rename them; so instead we look at the file content.
247111a95ff3Smrg    # Grep'ing the first line is not enough: some people post-process
247211a95ff3Smrg    # each Makefile.in and add a new line on top of each file to say so.
247311a95ff3Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
247411a95ff3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
247511a95ff3Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
247611a95ff3Smrg      dirpart=`AS_DIRNAME("$mf")`
247711a95ff3Smrg    else
247811a95ff3Smrg      continue
247911a95ff3Smrg    fi
248011a95ff3Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
248111a95ff3Smrg    # from the Makefile without running 'make'.
248211a95ff3Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
248311a95ff3Smrg    test -z "$DEPDIR" && continue
248411a95ff3Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
248511a95ff3Smrg    test -z "$am__include" && continue
248611a95ff3Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
248711a95ff3Smrg    # Find all dependency output files, they are included files with
248811a95ff3Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
248911a95ff3Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
249011a95ff3Smrg    # expansion.
249111a95ff3Smrg    for file in `sed -n "
249211a95ff3Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
249311a95ff3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
249411a95ff3Smrg      # Make sure the directory exists.
249511a95ff3Smrg      test -f "$dirpart/$file" && continue
249611a95ff3Smrg      fdir=`AS_DIRNAME(["$file"])`
249711a95ff3Smrg      AS_MKDIR_P([$dirpart/$fdir])
249811a95ff3Smrg      # echo "creating $dirpart/$file"
249911a95ff3Smrg      echo '# dummy' > "$dirpart/$file"
250011a95ff3Smrg    done
250111a95ff3Smrg  done
250211a95ff3Smrg}
250311a95ff3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
250411a95ff3Smrg
250511a95ff3Smrg
250611a95ff3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
250711a95ff3Smrg# -----------------------------
250811a95ff3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2509a097bd00Smrg#
251011a95ff3Smrg# This code is only required when automatic dependency tracking
251111a95ff3Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
251211a95ff3Smrg# need in order to bootstrap the dependency handling code.
251311a95ff3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
251411a95ff3Smrg[AC_CONFIG_COMMANDS([depfiles],
251511a95ff3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
251611a95ff3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
251711a95ff3Smrg])
251811a95ff3Smrg
251911a95ff3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
252011a95ff3Smrg
252111a95ff3Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
2522a097bd00Smrg#
252311a95ff3Smrg# This file is free software; the Free Software Foundation
252411a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
252511a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2526a097bd00Smrg
252711a95ff3Smrg# This macro actually does too much.  Some checks are only needed if
252811a95ff3Smrg# your package does certain things.  But this isn't really a big deal.
2529a097bd00Smrg
253011a95ff3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
253111a95ff3Smrgm4_define([AC_PROG_CC],
253211a95ff3Smrgm4_defn([AC_PROG_CC])
253311a95ff3Smrg[_AM_PROG_CC_C_O
253411a95ff3Smrg])
2535a097bd00Smrg
253611a95ff3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
253711a95ff3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
253811a95ff3Smrg# -----------------------------------------------
253911a95ff3Smrg# The call with PACKAGE and VERSION arguments is the old style
254011a95ff3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
254111a95ff3Smrg# and VERSION should now be passed to AC_INIT and removed from
254211a95ff3Smrg# the call to AM_INIT_AUTOMAKE.
254311a95ff3Smrg# We support both call styles for the transition.  After
254411a95ff3Smrg# the next Automake release, Autoconf can make the AC_INIT
254511a95ff3Smrg# arguments mandatory, and then we can depend on a new Autoconf
254611a95ff3Smrg# release and drop the old call support.
254711a95ff3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
254811a95ff3Smrg[AC_PREREQ([2.65])dnl
254911a95ff3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
255011a95ff3Smrgdnl the ones we care about.
255111a95ff3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
255211a95ff3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
255311a95ff3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
255411a95ff3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
255511a95ff3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
255611a95ff3Smrg  # is not polluted with repeated "-I."
255711a95ff3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
255811a95ff3Smrg  # test to see if srcdir already configured
255911a95ff3Smrg  if test -f $srcdir/config.status; then
256011a95ff3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2561a097bd00Smrg  fi
2562a097bd00Smrgfi
2563a097bd00Smrg
256411a95ff3Smrg# test whether we have cygpath
256511a95ff3Smrgif test -z "$CYGPATH_W"; then
256611a95ff3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
256711a95ff3Smrg    CYGPATH_W='cygpath -w'
256811a95ff3Smrg  else
256911a95ff3Smrg    CYGPATH_W=echo
2570a097bd00Smrg  fi
2571a097bd00Smrgfi
257211a95ff3SmrgAC_SUBST([CYGPATH_W])
2573a097bd00Smrg
257411a95ff3Smrg# Define the identity of the package.
257511a95ff3Smrgdnl Distinguish between old-style and new-style calls.
257611a95ff3Smrgm4_ifval([$2],
257711a95ff3Smrg[AC_DIAGNOSE([obsolete],
257811a95ff3Smrg             [$0: two- and three-arguments forms are deprecated.])
257911a95ff3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
258011a95ff3Smrg AC_SUBST([PACKAGE], [$1])dnl
258111a95ff3Smrg AC_SUBST([VERSION], [$2])],
258211a95ff3Smrg[_AM_SET_OPTIONS([$1])dnl
258311a95ff3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
258411a95ff3Smrgm4_if(
258511a95ff3Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
258611a95ff3Smrg  [ok:ok],,
258711a95ff3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
258811a95ff3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
258911a95ff3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2590a097bd00Smrg
259111a95ff3Smrg_AM_IF_OPTION([no-define],,
259211a95ff3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
259311a95ff3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2594a097bd00Smrg
259511a95ff3Smrg# Some tools Automake needs.
259611a95ff3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
259711a95ff3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
259811a95ff3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
259911a95ff3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
260011a95ff3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
260111a95ff3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
260211a95ff3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
260311a95ff3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
260411a95ff3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
260511a95ff3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
260611a95ff3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
260711a95ff3Smrg# dies out for good.  For more background, see:
260811a95ff3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
260911a95ff3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
261011a95ff3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
261111a95ff3Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
261211a95ff3Smrg# system "awk" is bad on some platforms.
261311a95ff3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
261411a95ff3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
261511a95ff3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
261611a95ff3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
261711a95ff3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
261811a95ff3Smrg			     [_AM_PROG_TAR([v7])])])
261911a95ff3Smrg_AM_IF_OPTION([no-dependencies],,
262011a95ff3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
262111a95ff3Smrg		  [_AM_DEPENDENCIES([CC])],
262211a95ff3Smrg		  [m4_define([AC_PROG_CC],
262311a95ff3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
262411a95ff3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
262511a95ff3Smrg		  [_AM_DEPENDENCIES([CXX])],
262611a95ff3Smrg		  [m4_define([AC_PROG_CXX],
262711a95ff3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
262811a95ff3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
262911a95ff3Smrg		  [_AM_DEPENDENCIES([OBJC])],
263011a95ff3Smrg		  [m4_define([AC_PROG_OBJC],
263111a95ff3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
263211a95ff3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
263311a95ff3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
263411a95ff3Smrg		  [m4_define([AC_PROG_OBJCXX],
263511a95ff3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
263611a95ff3Smrg])
263711a95ff3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
263811a95ff3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
263911a95ff3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
264011a95ff3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
264111a95ff3SmrgAC_CONFIG_COMMANDS_PRE(dnl
264211a95ff3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
264311a95ff3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2644a097bd00Smrg
264511a95ff3Smrg# POSIX will say in a future version that running "rm -f" with no argument
264611a95ff3Smrg# is OK; and we want to be able to make that assumption in our Makefile
264711a95ff3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
264811a95ff3Smrg# actually supported "in the wild" to an acceptable degree.
264911a95ff3Smrg# See automake bug#10828.
265011a95ff3Smrg# To make any issue more visible, cause the running configure to be aborted
265111a95ff3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
265211a95ff3Smrg# user can still override this though.
265311a95ff3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
265411a95ff3Smrg  cat >&2 <<'END'
265511a95ff3SmrgOops!
2656a097bd00Smrg
265711a95ff3SmrgYour 'rm' program seems unable to run without file operands specified
265811a95ff3Smrgon the command line, even when the '-f' option is present.  This is contrary
265911a95ff3Smrgto the behaviour of most rm programs out there, and not conforming with
266011a95ff3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2661a097bd00Smrg
266211a95ff3SmrgPlease tell bug-automake@gnu.org about your system, including the value
266311a95ff3Smrgof your $PATH and any error possibly output before this message.  This
266411a95ff3Smrgcan help us improve future automake versions.
2665a097bd00Smrg
266611a95ff3SmrgEND
266711a95ff3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
266811a95ff3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
266911a95ff3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
267011a95ff3Smrg    echo >&2
267111a95ff3Smrg  else
267211a95ff3Smrg    cat >&2 <<'END'
267311a95ff3SmrgAborting the configuration process, to ensure you take notice of the issue.
2674a097bd00Smrg
267511a95ff3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
267611a95ff3Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2677a097bd00Smrg
267811a95ff3SmrgIf you want to complete the configuration process using your problematic
267911a95ff3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
268011a95ff3Smrgto "yes", and re-run configure.
2681a6d9b409Smrg
268211a95ff3SmrgEND
268311a95ff3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
268411a95ff3Smrg  fi
2685a6d9b409Smrgfi
268611a95ff3Smrgdnl The trailing newline in this macro's definition is deliberate, for
268711a95ff3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
268811a95ff3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
268911a95ff3Smrg])
2690a6d9b409Smrg
269111a95ff3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
269211a95ff3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
269311a95ff3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
269411a95ff3Smrgm4_define([_AC_COMPILER_EXEEXT],
269511a95ff3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2696a6d9b409Smrg
269711a95ff3Smrg# When config.status generates a header, we must update the stamp-h file.
269811a95ff3Smrg# This file resides in the same directory as the config header
269911a95ff3Smrg# that is generated.  The stamp files are numbered to have different names.
2700a6d9b409Smrg
270111a95ff3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
270211a95ff3Smrg# loop where config.status creates the headers, so we can generate
270311a95ff3Smrg# our stamp files there.
270411a95ff3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
270511a95ff3Smrg[# Compute $1's index in $config_headers.
270611a95ff3Smrg_am_arg=$1
270711a95ff3Smrg_am_stamp_count=1
270811a95ff3Smrgfor _am_header in $config_headers :; do
270911a95ff3Smrg  case $_am_header in
271011a95ff3Smrg    $_am_arg | $_am_arg:* )
271111a95ff3Smrg      break ;;
271211a95ff3Smrg    * )
271311a95ff3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
271411a95ff3Smrg  esac
271511a95ff3Smrgdone
271611a95ff3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
271711a95ff3Smrg
271811a95ff3Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2719a6d9b409Smrg#
272011a95ff3Smrg# This file is free software; the Free Software Foundation
272111a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
272211a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2723a6d9b409Smrg
272411a95ff3Smrg# AM_PROG_INSTALL_SH
272511a95ff3Smrg# ------------------
272611a95ff3Smrg# Define $install_sh.
272711a95ff3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
272811a95ff3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
272911a95ff3Smrgif test x"${install_sh+set}" != xset; then
273011a95ff3Smrg  case $am_aux_dir in
273111a95ff3Smrg  *\ * | *\	*)
273211a95ff3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
273311a95ff3Smrg  *)
273411a95ff3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
273511a95ff3Smrg  esac
273611a95ff3Smrgfi
273711a95ff3SmrgAC_SUBST([install_sh])])
2738a097bd00Smrg
273911a95ff3Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
274011a95ff3Smrg#
274111a95ff3Smrg# This file is free software; the Free Software Foundation
274211a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
274311a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2744a097bd00Smrg
274511a95ff3Smrg# Check whether the underlying file-system supports filenames
274611a95ff3Smrg# with a leading dot.  For instance MS-DOS doesn't.
274711a95ff3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
274811a95ff3Smrg[rm -rf .tst 2>/dev/null
274911a95ff3Smrgmkdir .tst 2>/dev/null
275011a95ff3Smrgif test -d .tst; then
275111a95ff3Smrg  am__leading_dot=.
2752a6d9b409Smrgelse
275311a95ff3Smrg  am__leading_dot=_
2754a6d9b409Smrgfi
275511a95ff3Smrgrmdir .tst 2>/dev/null
275611a95ff3SmrgAC_SUBST([am__leading_dot])])
2757a6d9b409Smrg
275811a95ff3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2759a6d9b409Smrg
276011a95ff3Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2761a097bd00Smrg#
276211a95ff3Smrg# This file is free software; the Free Software Foundation
276311a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
276411a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2765a097bd00Smrg
276611a95ff3Smrg# AM_MAKE_INCLUDE()
276711a95ff3Smrg# -----------------
276811a95ff3Smrg# Check to see how make treats includes.
276911a95ff3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
277011a95ff3Smrg[am_make=${MAKE-make}
277111a95ff3Smrgcat > confinc << 'END'
277211a95ff3Smrgam__doit:
277311a95ff3Smrg	@echo this is the am__doit target
277411a95ff3Smrg.PHONY: am__doit
277511a95ff3SmrgEND
277611a95ff3Smrg# If we don't find an include directive, just comment out the code.
277711a95ff3SmrgAC_MSG_CHECKING([for style of include used by $am_make])
277811a95ff3Smrgam__include="#"
277911a95ff3Smrgam__quote=
278011a95ff3Smrg_am_result=none
278111a95ff3Smrg# First try GNU make style include.
278211a95ff3Smrgecho "include confinc" > confmf
278311a95ff3Smrg# Ignore all kinds of additional output from 'make'.
278411a95ff3Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
278511a95ff3Smrg*the\ am__doit\ target*)
278611a95ff3Smrg  am__include=include
278711a95ff3Smrg  am__quote=
278811a95ff3Smrg  _am_result=GNU
278911a95ff3Smrg  ;;
279011a95ff3Smrgesac
279111a95ff3Smrg# Now try BSD make style include.
279211a95ff3Smrgif test "$am__include" = "#"; then
279311a95ff3Smrg   echo '.include "confinc"' > confmf
279411a95ff3Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
279511a95ff3Smrg   *the\ am__doit\ target*)
279611a95ff3Smrg     am__include=.include
279711a95ff3Smrg     am__quote="\""
279811a95ff3Smrg     _am_result=BSD
279911a95ff3Smrg     ;;
280011a95ff3Smrg   esac
2801a6d9b409Smrgfi
280211a95ff3SmrgAC_SUBST([am__include])
280311a95ff3SmrgAC_SUBST([am__quote])
280411a95ff3SmrgAC_MSG_RESULT([$_am_result])
280511a95ff3Smrgrm -f confinc confmf
280611a95ff3Smrg])
2807a097bd00Smrg
280811a95ff3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2809a097bd00Smrg
281011a95ff3Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2811a097bd00Smrg#
281211a95ff3Smrg# This file is free software; the Free Software Foundation
281311a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
281411a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2815a097bd00Smrg
281611a95ff3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
281711a95ff3Smrg# ------------------------------
281811a95ff3SmrgAC_DEFUN([AM_MISSING_PROG],
281911a95ff3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
282011a95ff3Smrg$1=${$1-"${am_missing_run}$2"}
282111a95ff3SmrgAC_SUBST($1)])
2822a097bd00Smrg
282311a95ff3Smrg# AM_MISSING_HAS_RUN
282411a95ff3Smrg# ------------------
282511a95ff3Smrg# Define MISSING if not defined so far and test if it is modern enough.
282611a95ff3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
282711a95ff3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
282811a95ff3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
282911a95ff3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
283011a95ff3Smrgif test x"${MISSING+set}" != xset; then
283111a95ff3Smrg  case $am_aux_dir in
283211a95ff3Smrg  *\ * | *\	*)
283311a95ff3Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
283411a95ff3Smrg  *)
283511a95ff3Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
283611a95ff3Smrg  esac
2837a097bd00Smrgfi
283811a95ff3Smrg# Use eval to expand $SHELL
283911a95ff3Smrgif eval "$MISSING --is-lightweight"; then
284011a95ff3Smrg  am_missing_run="$MISSING "
284111a95ff3Smrgelse
284211a95ff3Smrg  am_missing_run=
284311a95ff3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
2844a097bd00Smrgfi
284511a95ff3Smrg])
2846a097bd00Smrg
284711a95ff3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2848a097bd00Smrg
284911a95ff3Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
285011a95ff3Smrg#
285111a95ff3Smrg# This file is free software; the Free Software Foundation
285211a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
285311a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2854a097bd00Smrg
285511a95ff3Smrg# _AM_MANGLE_OPTION(NAME)
285611a95ff3Smrg# -----------------------
285711a95ff3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
285811a95ff3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2859a097bd00Smrg
286011a95ff3Smrg# _AM_SET_OPTION(NAME)
286111a95ff3Smrg# --------------------
286211a95ff3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
286311a95ff3SmrgAC_DEFUN([_AM_SET_OPTION],
286411a95ff3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2865a097bd00Smrg
286611a95ff3Smrg# _AM_SET_OPTIONS(OPTIONS)
286711a95ff3Smrg# ------------------------
286811a95ff3Smrg# OPTIONS is a space-separated list of Automake options.
286911a95ff3SmrgAC_DEFUN([_AM_SET_OPTIONS],
287011a95ff3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2871a097bd00Smrg
287211a95ff3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
287311a95ff3Smrg# -------------------------------------------
287411a95ff3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
287511a95ff3SmrgAC_DEFUN([_AM_IF_OPTION],
287611a95ff3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2877a097bd00Smrg
287811a95ff3Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2879a097bd00Smrg#
288011a95ff3Smrg# This file is free software; the Free Software Foundation
288111a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
288211a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2883a097bd00Smrg
288411a95ff3Smrg# _AM_PROG_CC_C_O
288511a95ff3Smrg# ---------------
288611a95ff3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
288711a95ff3Smrg# to automatically call this.
288811a95ff3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
288911a95ff3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
289011a95ff3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
289111a95ff3SmrgAC_LANG_PUSH([C])dnl
289211a95ff3SmrgAC_CACHE_CHECK(
289311a95ff3Smrg  [whether $CC understands -c and -o together],
289411a95ff3Smrg  [am_cv_prog_cc_c_o],
289511a95ff3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
289611a95ff3Smrg  # Make sure it works both with $CC and with simple cc.
289711a95ff3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
289811a95ff3Smrg  # compilers refuse to overwrite an existing .o file with -o,
289911a95ff3Smrg  # though they will create one.
290011a95ff3Smrg  am_cv_prog_cc_c_o=yes
290111a95ff3Smrg  for am_i in 1 2; do
290211a95ff3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
290311a95ff3Smrg         && test -f conftest2.$ac_objext; then
290411a95ff3Smrg      : OK
290511a95ff3Smrg    else
290611a95ff3Smrg      am_cv_prog_cc_c_o=no
290711a95ff3Smrg      break
290811a95ff3Smrg    fi
290911a95ff3Smrg  done
291011a95ff3Smrg  rm -f core conftest*
291111a95ff3Smrg  unset am_i])
291211a95ff3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
291311a95ff3Smrg   # Losing compiler, so override with the script.
291411a95ff3Smrg   # FIXME: It is wrong to rewrite CC.
291511a95ff3Smrg   # But if we don't then we get into trouble of one sort or another.
291611a95ff3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
291711a95ff3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
291811a95ff3Smrg   CC="$am_aux_dir/compile $CC"
2919a097bd00Smrgfi
292011a95ff3SmrgAC_LANG_POP([C])])
2921a097bd00Smrg
292211a95ff3Smrg# For backward compatibility.
292311a95ff3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
292411a95ff3Smrg
292511a95ff3Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292611a95ff3Smrg#
292711a95ff3Smrg# This file is free software; the Free Software Foundation
292811a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
292911a95ff3Smrg# with or without modifications, as long as this notice is preserved.
293011a95ff3Smrg
293111a95ff3Smrg# AM_RUN_LOG(COMMAND)
293211a95ff3Smrg# -------------------
293311a95ff3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
293411a95ff3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
293511a95ff3SmrgAC_DEFUN([AM_RUN_LOG],
293611a95ff3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
293711a95ff3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
293811a95ff3Smrg   ac_status=$?
293911a95ff3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
294011a95ff3Smrg   (exit $ac_status); }])
2941a097bd00Smrg
294211a95ff3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
2943a097bd00Smrg
294411a95ff3Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
294511a95ff3Smrg#
294611a95ff3Smrg# This file is free software; the Free Software Foundation
294711a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
294811a95ff3Smrg# with or without modifications, as long as this notice is preserved.
2949a097bd00Smrg
295011a95ff3Smrg# AM_SANITY_CHECK
295111a95ff3Smrg# ---------------
295211a95ff3SmrgAC_DEFUN([AM_SANITY_CHECK],
295311a95ff3Smrg[AC_MSG_CHECKING([whether build environment is sane])
295411a95ff3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
295511a95ff3Smrg# name.  Accept space and tab only in the latter.
295611a95ff3Smrgam_lf='
295711a95ff3Smrg'
295811a95ff3Smrgcase `pwd` in
295911a95ff3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
296011a95ff3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
296111a95ff3Smrgesac
296211a95ff3Smrgcase $srcdir in
296311a95ff3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
296411a95ff3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
296511a95ff3Smrgesac
2966a097bd00Smrg
296711a95ff3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
296811a95ff3Smrg# arguments.  Must try -L first in case configure is actually a
296911a95ff3Smrg# symlink; some systems play weird games with the mod time of symlinks
297011a95ff3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
297111a95ff3Smrg# directory).
297211a95ff3Smrgif (
297311a95ff3Smrg   am_has_slept=no
297411a95ff3Smrg   for am_try in 1 2; do
297511a95ff3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
297611a95ff3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
297711a95ff3Smrg     if test "$[*]" = "X"; then
297811a95ff3Smrg	# -L didn't work.
297911a95ff3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
298011a95ff3Smrg     fi
298111a95ff3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
298211a95ff3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
2983a097bd00Smrg
298411a95ff3Smrg	# If neither matched, then we have a broken ls.  This can happen
298511a95ff3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
298611a95ff3Smrg	# broken ls alias from the environment.  This has actually
298711a95ff3Smrg	# happened.  Such a system could not be considered "sane".
298811a95ff3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
298911a95ff3Smrg  alias in your environment])
299011a95ff3Smrg     fi
299111a95ff3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
299211a95ff3Smrg       break
299311a95ff3Smrg     fi
299411a95ff3Smrg     # Just in case.
299511a95ff3Smrg     sleep 1
299611a95ff3Smrg     am_has_slept=yes
299711a95ff3Smrg   done
299811a95ff3Smrg   test "$[2]" = conftest.file
299911a95ff3Smrg   )
300011a95ff3Smrgthen
300111a95ff3Smrg   # Ok.
300211a95ff3Smrg   :
3003a097bd00Smrgelse
300411a95ff3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
300511a95ff3SmrgCheck your system clock])
3006a097bd00Smrgfi
300711a95ff3SmrgAC_MSG_RESULT([yes])
300811a95ff3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
300911a95ff3Smrg# generated files are strictly newer.
301011a95ff3Smrgam_sleep_pid=
301111a95ff3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
301211a95ff3Smrg  ( sleep 1 ) &
301311a95ff3Smrg  am_sleep_pid=$!
301411a95ff3Smrgfi
301511a95ff3SmrgAC_CONFIG_COMMANDS_PRE(
301611a95ff3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
301711a95ff3Smrg   if test -n "$am_sleep_pid"; then
301811a95ff3Smrg     # Hide warnings about reused PIDs.
301911a95ff3Smrg     wait $am_sleep_pid 2>/dev/null
302011a95ff3Smrg   fi
302111a95ff3Smrg   AC_MSG_RESULT([done])])
302211a95ff3Smrgrm -f conftest.file
302311a95ff3Smrg])
3024a097bd00Smrg
302511a95ff3Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3026a097bd00Smrg#
302711a95ff3Smrg# This file is free software; the Free Software Foundation
302811a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
302911a95ff3Smrg# with or without modifications, as long as this notice is preserved.
3030efda2da8Smrg
303111a95ff3Smrg# AM_SILENT_RULES([DEFAULT])
303211a95ff3Smrg# --------------------------
303311a95ff3Smrg# Enable less verbose build rules; with the default set to DEFAULT
303411a95ff3Smrg# ("yes" being less verbose, "no" or empty being verbose).
303511a95ff3SmrgAC_DEFUN([AM_SILENT_RULES],
303611a95ff3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
303711a95ff3SmrgAS_HELP_STRING(
303811a95ff3Smrg  [--enable-silent-rules],
303911a95ff3Smrg  [less verbose build output (undo: "make V=1")])
304011a95ff3SmrgAS_HELP_STRING(
304111a95ff3Smrg  [--disable-silent-rules],
304211a95ff3Smrg  [verbose build output (undo: "make V=0")])dnl
304311a95ff3Smrg])
304411a95ff3Smrgcase $enable_silent_rules in @%:@ (((
304511a95ff3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
304611a95ff3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
304711a95ff3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
304811a95ff3Smrgesac
304911a95ff3Smrgdnl
305011a95ff3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
305111a95ff3Smrgdnl do not support nested variable expansions.
305211a95ff3Smrgdnl See automake bug#9928 and bug#10237.
305311a95ff3Smrgam_make=${MAKE-make}
305411a95ff3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
305511a95ff3Smrg   [am_cv_make_support_nested_variables],
305611a95ff3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
305711a95ff3SmrgBAR0=false
305811a95ff3SmrgBAR1=true
305911a95ff3SmrgV=1
306011a95ff3Smrgam__doit:
306111a95ff3Smrg	@$(TRUE)
306211a95ff3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
306311a95ff3Smrg  am_cv_make_support_nested_variables=yes
306411a95ff3Smrgelse
306511a95ff3Smrg  am_cv_make_support_nested_variables=no
306611a95ff3Smrgfi])
306711a95ff3Smrgif test $am_cv_make_support_nested_variables = yes; then
306811a95ff3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
306911a95ff3Smrg  AM_V='$(V)'
307011a95ff3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
307111a95ff3Smrgelse
307211a95ff3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
307311a95ff3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
307411a95ff3Smrgfi
307511a95ff3SmrgAC_SUBST([AM_V])dnl
307611a95ff3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
307711a95ff3SmrgAC_SUBST([AM_DEFAULT_V])dnl
307811a95ff3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
307911a95ff3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
308011a95ff3SmrgAM_BACKSLASH='\'
308111a95ff3SmrgAC_SUBST([AM_BACKSLASH])dnl
308211a95ff3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
308311a95ff3Smrg])
308411a95ff3Smrg
308511a95ff3Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3086a097bd00Smrg#
308711a95ff3Smrg# This file is free software; the Free Software Foundation
308811a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
308911a95ff3Smrg# with or without modifications, as long as this notice is preserved.
309011a95ff3Smrg
309111a95ff3Smrg# AM_PROG_INSTALL_STRIP
309211a95ff3Smrg# ---------------------
309311a95ff3Smrg# One issue with vendor 'install' (even GNU) is that you can't
309411a95ff3Smrg# specify the program used to strip binaries.  This is especially
309511a95ff3Smrg# annoying in cross-compiling environments, where the build's strip
309611a95ff3Smrg# is unlikely to handle the host's binaries.
309711a95ff3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
309811a95ff3Smrg# always use install-sh in "make install-strip", and initialize
309911a95ff3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
310011a95ff3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
310111a95ff3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
310211a95ff3Smrg# Installed binaries are usually stripped using 'strip' when the user
310311a95ff3Smrg# run "make install-strip".  However 'strip' might not be the right
310411a95ff3Smrg# tool to use in cross-compilation environments, therefore Automake
310511a95ff3Smrg# will honor the 'STRIP' environment variable to overrule this program.
310611a95ff3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
310711a95ff3Smrgif test "$cross_compiling" != no; then
310811a95ff3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
310911a95ff3Smrgfi
311011a95ff3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
311111a95ff3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3112efda2da8Smrg
311311a95ff3Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
311411a95ff3Smrg#
311511a95ff3Smrg# This file is free software; the Free Software Foundation
311611a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
311711a95ff3Smrg# with or without modifications, as long as this notice is preserved.
3118a097bd00Smrg
311911a95ff3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
312011a95ff3Smrg# ---------------------------
312111a95ff3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
312211a95ff3Smrg# This macro is traced by Automake.
312311a95ff3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3124a097bd00Smrg
312511a95ff3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
312611a95ff3Smrg# --------------------------
312711a95ff3Smrg# Public sister of _AM_SUBST_NOTMAKE.
312811a95ff3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3129a097bd00Smrg
313011a95ff3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3131a097bd00Smrg
313211a95ff3Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
313311a95ff3Smrg#
313411a95ff3Smrg# This file is free software; the Free Software Foundation
313511a95ff3Smrg# gives unlimited permission to copy and/or distribute it,
313611a95ff3Smrg# with or without modifications, as long as this notice is preserved.
3137efda2da8Smrg
313811a95ff3Smrg# _AM_PROG_TAR(FORMAT)
3139efda2da8Smrg# --------------------
314011a95ff3Smrg# Check how to create a tarball in format FORMAT.
314111a95ff3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3142efda2da8Smrg#
314311a95ff3Smrg# Substitute a variable $(am__tar) that is a command
314411a95ff3Smrg# writing to stdout a FORMAT-tarball containing the directory
314511a95ff3Smrg# $tardir.
314611a95ff3Smrg#     tardir=directory && $(am__tar) > result.tar
31471e5fa1c5Smrg#
314811a95ff3Smrg# Substitute a variable $(am__untar) that extract such
314911a95ff3Smrg# a tarball read from stdin.
315011a95ff3Smrg#     $(am__untar) < result.tar
31511e5fa1c5Smrg#
315211a95ff3SmrgAC_DEFUN([_AM_PROG_TAR],
315311a95ff3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
315411a95ff3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
315511a95ff3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3156a6d9b409Smrg
315711a95ff3Smrg# We'll loop over all known methods to create a tar archive until one works.
315811a95ff3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3159b91640d3Smrg
316011a95ff3Smrgm4_if([$1], [v7],
316111a95ff3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3162a6d9b409Smrg
316311a95ff3Smrg  [m4_case([$1],
316411a95ff3Smrg    [ustar],
316511a95ff3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
316611a95ff3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
316711a95ff3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
316811a95ff3Smrg      # and bug#13588).
316911a95ff3Smrg      am_max_uid=2097151 # 2^21 - 1
317011a95ff3Smrg      am_max_gid=$am_max_uid
317111a95ff3Smrg      # The $UID and $GID variables are not portable, so we need to resort
317211a95ff3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
317311a95ff3Smrg      # below are definitely unexpected, so allow the users to see them
317411a95ff3Smrg      # (that is, avoid stderr redirection).
317511a95ff3Smrg      am_uid=`id -u || echo unknown`
317611a95ff3Smrg      am_gid=`id -g || echo unknown`
317711a95ff3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
317811a95ff3Smrg      if test $am_uid -le $am_max_uid; then
317911a95ff3Smrg         AC_MSG_RESULT([yes])
318011a95ff3Smrg      else
318111a95ff3Smrg         AC_MSG_RESULT([no])
318211a95ff3Smrg         _am_tools=none
318311a95ff3Smrg      fi
318411a95ff3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
318511a95ff3Smrg      if test $am_gid -le $am_max_gid; then
318611a95ff3Smrg         AC_MSG_RESULT([yes])
318711a95ff3Smrg      else
318811a95ff3Smrg        AC_MSG_RESULT([no])
318911a95ff3Smrg        _am_tools=none
319011a95ff3Smrg      fi],
319111a95ff3Smrg
319211a95ff3Smrg  [pax],
319311a95ff3Smrg    [],
319411a95ff3Smrg
319511a95ff3Smrg  [m4_fatal([Unknown tar format])])
319611a95ff3Smrg
319711a95ff3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
319811a95ff3Smrg
319911a95ff3Smrg  # Go ahead even if we have the value already cached.  We do so because we
320011a95ff3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
320111a95ff3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
320211a95ff3Smrg
320311a95ff3Smrg  for _am_tool in $_am_tools; do
320411a95ff3Smrg    case $_am_tool in
320511a95ff3Smrg    gnutar)
320611a95ff3Smrg      for _am_tar in tar gnutar gtar; do
320711a95ff3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
320811a95ff3Smrg      done
320911a95ff3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
321011a95ff3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
321111a95ff3Smrg      am__untar="$_am_tar -xf -"
321211a95ff3Smrg      ;;
321311a95ff3Smrg    plaintar)
321411a95ff3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
321511a95ff3Smrg      # ustar tarball either.
321611a95ff3Smrg      (tar --version) >/dev/null 2>&1 && continue
321711a95ff3Smrg      am__tar='tar chf - "$$tardir"'
321811a95ff3Smrg      am__tar_='tar chf - "$tardir"'
321911a95ff3Smrg      am__untar='tar xf -'
322011a95ff3Smrg      ;;
322111a95ff3Smrg    pax)
322211a95ff3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
322311a95ff3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
322411a95ff3Smrg      am__untar='pax -r'
322511a95ff3Smrg      ;;
322611a95ff3Smrg    cpio)
322711a95ff3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
322811a95ff3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
322911a95ff3Smrg      am__untar='cpio -i -H $1 -d'
323011a95ff3Smrg      ;;
323111a95ff3Smrg    none)
323211a95ff3Smrg      am__tar=false
323311a95ff3Smrg      am__tar_=false
323411a95ff3Smrg      am__untar=false
323511a95ff3Smrg      ;;
323611a95ff3Smrg    esac
323711a95ff3Smrg
323811a95ff3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
323911a95ff3Smrg    # and am__untar set.
324011a95ff3Smrg    test -n "${am_cv_prog_tar_$1}" && break
324111a95ff3Smrg
324211a95ff3Smrg    # tar/untar a dummy directory, and stop if the command works.
324311a95ff3Smrg    rm -rf conftest.dir
324411a95ff3Smrg    mkdir conftest.dir
324511a95ff3Smrg    echo GrepMe > conftest.dir/file
324611a95ff3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
324711a95ff3Smrg    rm -rf conftest.dir
324811a95ff3Smrg    if test -s conftest.tar; then
324911a95ff3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
325011a95ff3Smrg      AM_RUN_LOG([cat conftest.dir/file])
325111a95ff3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
325211a95ff3Smrg    fi
325311a95ff3Smrg  done
325411a95ff3Smrg  rm -rf conftest.dir
325511a95ff3Smrg
325611a95ff3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
325711a95ff3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
325811a95ff3Smrg
325911a95ff3SmrgAC_SUBST([am__tar])
326011a95ff3SmrgAC_SUBST([am__untar])
326111a95ff3Smrg]) # _AM_PROG_TAR
3262efda2da8Smrg
3263