aclocal.m4 revision 8846b520
18846b520Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2953c684bSmrg
38846b520Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4fd0c672fSmrg
5fd0c672fSmrg# This file is free software; the Free Software Foundation
6fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
7fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
8fd0c672fSmrg
9fd0c672fSmrg# This program is distributed in the hope that it will be useful,
10fd0c672fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fd0c672fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fd0c672fSmrg# PARTICULAR PURPOSE.
13fd0c672fSmrg
14953c684bSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1548e69166Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1648e69166Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178846b520Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
188846b520Smrg[m4_warning([this file was generated for autoconf 2.69.
1948e69166SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2048e69166SmrgIf you have problems, you may need to regenerate the build system entirely.
21953c684bSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2248e69166Smrg
238846b520Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
248846b520Smrgdnl serial 11 (pkg-config-0.29)
258846b520Smrgdnl
268846b520Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
278846b520Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
288846b520Smrgdnl
298846b520Smrgdnl This program is free software; you can redistribute it and/or modify
308846b520Smrgdnl it under the terms of the GNU General Public License as published by
318846b520Smrgdnl the Free Software Foundation; either version 2 of the License, or
328846b520Smrgdnl (at your option) any later version.
338846b520Smrgdnl
348846b520Smrgdnl This program is distributed in the hope that it will be useful, but
358846b520Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
368846b520Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
378846b520Smrgdnl General Public License for more details.
388846b520Smrgdnl
398846b520Smrgdnl You should have received a copy of the GNU General Public License
408846b520Smrgdnl along with this program; if not, write to the Free Software
418846b520Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
428846b520Smrgdnl 02111-1307, USA.
438846b520Smrgdnl
448846b520Smrgdnl As a special exception to the GNU General Public License, if you
458846b520Smrgdnl distribute this file as part of a program that contains a
468846b520Smrgdnl configuration script generated by Autoconf, you may include it under
478846b520Smrgdnl the same distribution terms that you use for the rest of that
488846b520Smrgdnl program.
498846b520Smrg
508846b520Smrgdnl PKG_PREREQ(MIN-VERSION)
518846b520Smrgdnl -----------------------
528846b520Smrgdnl Since: 0.29
538846b520Smrgdnl
548846b520Smrgdnl Verify that the version of the pkg-config macros are at least
558846b520Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
568846b520Smrgdnl installed version of pkg-config, this checks the developer's version
578846b520Smrgdnl of pkg.m4 when generating configure.
588846b520Smrgdnl
598846b520Smrgdnl To ensure that this macro is defined, also add:
608846b520Smrgdnl m4_ifndef([PKG_PREREQ],
618846b520Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
628846b520Smrgdnl
638846b520Smrgdnl See the "Since" comment for each macro you use to see what version
648846b520Smrgdnl of the macros you require.
658846b520Smrgm4_defun([PKG_PREREQ],
668846b520Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
678846b520Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
688846b520Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
698846b520Smrg])dnl PKG_PREREQ
708846b520Smrg
718846b520Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
728846b520Smrgdnl ----------------------------------
738846b520Smrgdnl Since: 0.16
748846b520Smrgdnl
758846b520Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
768846b520Smrgdnl first found in the path. Checks that the version of pkg-config found
778846b520Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
788846b520Smrgdnl used since that's the first version where most current features of
798846b520Smrgdnl pkg-config existed.
808846b520SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
818846b520Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
828846b520Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
838846b520Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
848846b520SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
858846b520SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
868846b520SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87fd0c672fSmrg
888846b520Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
898846b520Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
908846b520Smrgfi
918846b520Smrgif test -n "$PKG_CONFIG"; then
928846b520Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
938846b520Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
948846b520Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
958846b520Smrg		AC_MSG_RESULT([yes])
968846b520Smrg	else
978846b520Smrg		AC_MSG_RESULT([no])
988846b520Smrg		PKG_CONFIG=""
998846b520Smrg	fi
1008846b520Smrgfi[]dnl
1018846b520Smrg])dnl PKG_PROG_PKG_CONFIG
10248e69166Smrg
1038846b520Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1048846b520Smrgdnl -------------------------------------------------------------------
1058846b520Smrgdnl Since: 0.18
1068846b520Smrgdnl
1078846b520Smrgdnl Check to see whether a particular set of modules exists. Similar to
1088846b520Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1098846b520Smrgdnl
1108846b520Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1118846b520Smrgdnl only at the first occurence in configure.ac, so if the first place
1128846b520Smrgdnl it's called might be skipped (such as if it is within an "if", you
1138846b520Smrgdnl have to call PKG_CHECK_EXISTS manually
1148846b520SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1158846b520Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1168846b520Smrgif test -n "$PKG_CONFIG" && \
1178846b520Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1188846b520Smrg  m4_default([$2], [:])
1198846b520Smrgm4_ifvaln([$3], [else
1208846b520Smrg  $3])dnl
1218846b520Smrgfi])
122fd0c672fSmrg
1238846b520Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1248846b520Smrgdnl ---------------------------------------------
1258846b520Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1268846b520Smrgdnl pkg_failed based on the result.
1278846b520Smrgm4_define([_PKG_CONFIG],
1288846b520Smrg[if test -n "$$1"; then
1298846b520Smrg    pkg_cv_[]$1="$$1"
1308846b520Smrg elif test -n "$PKG_CONFIG"; then
1318846b520Smrg    PKG_CHECK_EXISTS([$3],
1328846b520Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1338846b520Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1348846b520Smrg		     [pkg_failed=yes])
1358846b520Smrg else
1368846b520Smrg    pkg_failed=untried
1378846b520Smrgfi[]dnl
1388846b520Smrg])dnl _PKG_CONFIG
139fd0c672fSmrg
1408846b520Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1418846b520Smrgdnl ---------------------------
1428846b520Smrgdnl Internal check to see if pkg-config supports short errors.
1438846b520SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1448846b520Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1458846b520Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1468846b520Smrg        _pkg_short_errors_supported=yes
1478846b520Smrgelse
1488846b520Smrg        _pkg_short_errors_supported=no
1498846b520Smrgfi[]dnl
1508846b520Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151fd0c672fSmrg
152fd0c672fSmrg
1538846b520Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1548846b520Smrgdnl   [ACTION-IF-NOT-FOUND])
1558846b520Smrgdnl --------------------------------------------------------------
1568846b520Smrgdnl Since: 0.4.0
1578846b520Smrgdnl
1588846b520Smrgdnl Note that if there is a possibility the first call to
1598846b520Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1608846b520Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1618846b520SmrgAC_DEFUN([PKG_CHECK_MODULES],
1628846b520Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1638846b520SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1648846b520SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165fd0c672fSmrg
1668846b520Smrgpkg_failed=no
1678846b520SmrgAC_MSG_CHECKING([for $1])
168fd0c672fSmrg
1698846b520Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1708846b520Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171fd0c672fSmrg
1728846b520Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1738846b520Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1748846b520SmrgSee the pkg-config man page for more details.])
175fd0c672fSmrg
1768846b520Smrgif test $pkg_failed = yes; then
1778846b520Smrg   	AC_MSG_RESULT([no])
1788846b520Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1798846b520Smrg        if test $_pkg_short_errors_supported = yes; then
1808846b520Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1818846b520Smrg        else 
1828846b520Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1838846b520Smrg        fi
1848846b520Smrg	# Put the nasty error message in config.log where it belongs
1858846b520Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186fd0c672fSmrg
1878846b520Smrg	m4_default([$4], [AC_MSG_ERROR(
1888846b520Smrg[Package requirements ($2) were not met:
189fd0c672fSmrg
1908846b520Smrg$$1_PKG_ERRORS
191fd0c672fSmrg
1928846b520SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1938846b520Smrginstalled software in a non-standard prefix.
194fd0c672fSmrg
1958846b520Smrg_PKG_TEXT])[]dnl
1968846b520Smrg        ])
1978846b520Smrgelif test $pkg_failed = untried; then
1988846b520Smrg     	AC_MSG_RESULT([no])
1998846b520Smrg	m4_default([$4], [AC_MSG_FAILURE(
2008846b520Smrg[The pkg-config script could not be found or is too old.  Make sure it
2018846b520Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2028846b520Smrgpath to pkg-config.
203fd0c672fSmrg
2048846b520Smrg_PKG_TEXT
205fd0c672fSmrg
2068846b520SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2078846b520Smrg        ])
2088846b520Smrgelse
2098846b520Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2108846b520Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2118846b520Smrg        AC_MSG_RESULT([yes])
2128846b520Smrg	$3
2138846b520Smrgfi[]dnl
2148846b520Smrg])dnl PKG_CHECK_MODULES
215fd0c672fSmrg
216fd0c672fSmrg
2178846b520Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2188846b520Smrgdnl   [ACTION-IF-NOT-FOUND])
2198846b520Smrgdnl ---------------------------------------------------------------------
2208846b520Smrgdnl Since: 0.29
2218846b520Smrgdnl
2228846b520Smrgdnl Checks for existence of MODULES and gathers its build flags with
2238846b520Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2248846b520Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2258846b520Smrgdnl
2268846b520Smrgdnl Note that if there is a possibility the first call to
2278846b520Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2288846b520Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2298846b520Smrgdnl configure.ac.
2308846b520SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2318846b520Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2328846b520Smrg_save_PKG_CONFIG=$PKG_CONFIG
2338846b520SmrgPKG_CONFIG="$PKG_CONFIG --static"
2348846b520SmrgPKG_CHECK_MODULES($@)
2358846b520SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2368846b520Smrg])dnl PKG_CHECK_MODULES_STATIC
23748e69166Smrg
238fd0c672fSmrg
2398846b520Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2408846b520Smrgdnl -------------------------
2418846b520Smrgdnl Since: 0.27
2428846b520Smrgdnl
2438846b520Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2448846b520Smrgdnl should install pkg-config .pc files. By default the directory is
2458846b520Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2468846b520Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2478846b520Smrgdnl parameter.
2488846b520SmrgAC_DEFUN([PKG_INSTALLDIR],
2498846b520Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2508846b520Smrgm4_pushdef([pkg_description],
2518846b520Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2528846b520SmrgAC_ARG_WITH([pkgconfigdir],
2538846b520Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2548846b520Smrg    [with_pkgconfigdir=]pkg_default)
2558846b520SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2568846b520Smrgm4_popdef([pkg_default])
2578846b520Smrgm4_popdef([pkg_description])
2588846b520Smrg])dnl PKG_INSTALLDIR
2598846b520Smrg
2608846b520Smrg
2618846b520Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2628846b520Smrgdnl --------------------------------
2638846b520Smrgdnl Since: 0.27
2648846b520Smrgdnl
2658846b520Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2668846b520Smrgdnl module should install arch-independent pkg-config .pc files. By
2678846b520Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2688846b520Smrgdnl changed by passing DIRECTORY. The user can override through the
2698846b520Smrgdnl --with-noarch-pkgconfigdir parameter.
2708846b520SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2718846b520Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2728846b520Smrgm4_pushdef([pkg_description],
2738846b520Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2748846b520SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2758846b520Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2768846b520Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2778846b520SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2788846b520Smrgm4_popdef([pkg_default])
2798846b520Smrgm4_popdef([pkg_description])
2808846b520Smrg])dnl PKG_NOARCH_INSTALLDIR
2818846b520Smrg
2828846b520Smrg
2838846b520Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2848846b520Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2858846b520Smrgdnl -------------------------------------------
2868846b520Smrgdnl Since: 0.28
2878846b520Smrgdnl
2888846b520Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2898846b520SmrgAC_DEFUN([PKG_CHECK_VAR],
2908846b520Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2918846b520SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292fd0c672fSmrg
2938846b520Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2948846b520SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2958846b520Smrg
2968846b520SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2978846b520Smrg])dnl PKG_CHECK_VAR
2988846b520Smrg
2998846b520Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3008846b520Smrgdnl
3018846b520Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3028846b520Smrgdnl
3038846b520Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3048846b520Smrgdnl copy of this software and associated documentation files (the "Software"),
3058846b520Smrgdnl to deal in the Software without restriction, including without limitation
3068846b520Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3078846b520Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3088846b520Smrgdnl Software is furnished to do so, subject to the following conditions:
3098846b520Smrgdnl
3108846b520Smrgdnl The above copyright notice and this permission notice (including the next
3118846b520Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3128846b520Smrgdnl Software.
3138846b520Smrgdnl
3148846b520Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3158846b520Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3168846b520Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3178846b520Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3188846b520Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3198846b520Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3208846b520Smrgdnl DEALINGS IN THE SOFTWARE.
3218846b520Smrg
3228846b520Smrg# XORG_MACROS_VERSION(required-version)
3238846b520Smrg# -------------------------------------
3248846b520Smrg# Minimum version: 1.1.0
3258846b520Smrg#
3268846b520Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3278846b520Smrg# your configure.ac with the minimum required version, such as:
3288846b520Smrg# XORG_MACROS_VERSION(1.1)
3298846b520Smrg#
3308846b520Smrg# To ensure that this macro is defined, also add:
3318846b520Smrg# m4_ifndef([XORG_MACROS_VERSION],
3328846b520Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3338846b520Smrg#
3348846b520Smrg#
3358846b520Smrg# See the "minimum version" comment for each macro you use to see what
3368846b520Smrg# version you require.
3378846b520Smrgm4_defun([XORG_MACROS_VERSION],[
3388846b520Smrgm4_define([vers_have], [1.19.0])
3398846b520Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3408846b520Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3418846b520Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3428846b520Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3438846b520Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3448846b520Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3458846b520Smrgm4_undefine([vers_have])
3468846b520Smrgm4_undefine([maj_have])
3478846b520Smrgm4_undefine([maj_needed])
3488846b520Smrg]) # XORG_MACROS_VERSION
3498846b520Smrg
3508846b520Smrg# XORG_PROG_RAWCPP()
3518846b520Smrg# ------------------
3528846b520Smrg# Minimum version: 1.0.0
3538846b520Smrg#
3548846b520Smrg# Find cpp program and necessary flags for use in pre-processing text files
3558846b520Smrg# such as man pages and config files
3568846b520SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3578846b520SmrgAC_REQUIRE([AC_PROG_CPP])
3588846b520SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3598846b520Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3608846b520Smrg
3618846b520Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3628846b520Smrg# which is not the best choice for supporting other OS'es, but covers most
3638846b520Smrg# of the ones we need for now.
3648846b520SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3658846b520SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3668846b520Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3678846b520Smrg	AC_MSG_RESULT([no])
368fd0c672fSmrgelse
3698846b520Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3708846b520Smrg		RAWCPPFLAGS=-undef
3718846b520Smrg		AC_MSG_RESULT([yes])
3728846b520Smrg	# under Cygwin unix is still defined even with -undef
3738846b520Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3748846b520Smrg		RAWCPPFLAGS="-undef -ansi"
3758846b520Smrg		AC_MSG_RESULT([yes, with -ansi])
3768846b520Smrg	else
3778846b520Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3788846b520Smrg	fi
379fd0c672fSmrgfi
3808846b520Smrgrm -f conftest.$ac_ext
381fd0c672fSmrg
3828846b520SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3838846b520SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3848846b520Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3858846b520Smrg	AC_MSG_RESULT([no])
3868846b520Smrgelse
3878846b520Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3888846b520Smrg		TRADITIONALCPPFLAGS="-traditional"
3898846b520Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3908846b520Smrg		AC_MSG_RESULT([yes])
3918846b520Smrg	else
3928846b520Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3938846b520Smrg	fi
3948846b520Smrgfi
3958846b520Smrgrm -f conftest.$ac_ext
3968846b520SmrgAC_SUBST(RAWCPPFLAGS)
3978846b520SmrgAC_SUBST(TRADITIONALCPPFLAGS)
3988846b520Smrg]) # XORG_PROG_RAWCPP
399fd0c672fSmrg
4008846b520Smrg# XORG_MANPAGE_SECTIONS()
4018846b520Smrg# -----------------------
4028846b520Smrg# Minimum version: 1.0.0
4038846b520Smrg#
4048846b520Smrg# Determine which sections man pages go in for the different man page types
4058846b520Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4068846b520Smrg# Not sure if there's any better way than just hardcoding by OS name.
4078846b520Smrg# Override default settings by setting environment variables
4088846b520Smrg# Added MAN_SUBSTS in version 1.8
4098846b520Smrg# Added AC_PROG_SED in version 1.8
410fd0c672fSmrg
4118846b520SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4128846b520SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4138846b520SmrgAC_REQUIRE([AC_PROG_SED])
414fd0c672fSmrg
4158846b520Smrgif test x$APP_MAN_SUFFIX = x    ; then
4168846b520Smrg    APP_MAN_SUFFIX=1
4178846b520Smrgfi
4188846b520Smrgif test x$APP_MAN_DIR = x    ; then
4198846b520Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420fd0c672fSmrgfi
421fd0c672fSmrg
4228846b520Smrgif test x$LIB_MAN_SUFFIX = x    ; then
4238846b520Smrg    LIB_MAN_SUFFIX=3
4248846b520Smrgfi
4258846b520Smrgif test x$LIB_MAN_DIR = x    ; then
4268846b520Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4278846b520Smrgfi
428fd0c672fSmrg
4298846b520Smrgif test x$FILE_MAN_SUFFIX = x    ; then
4308846b520Smrg    case $host_os in
4318846b520Smrg	# Solaris 2.0 - 11 use SysV man page sections
4328846b520Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4338846b520Smrg	*)				FILE_MAN_SUFFIX=5  ;;
4348846b520Smrg    esac
4358846b520Smrgfi
4368846b520Smrgif test x$FILE_MAN_DIR = x    ; then
4378846b520Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4388846b520Smrgfi
439fd0c672fSmrg
4408846b520Smrgif test x$MISC_MAN_SUFFIX = x    ; then
4418846b520Smrg    case $host_os in
4428846b520Smrg	# Solaris 2.0 - 11 use SysV man page sections
4438846b520Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4448846b520Smrg	*)				MISC_MAN_SUFFIX=7  ;;
4458846b520Smrg    esac
4468846b520Smrgfi
4478846b520Smrgif test x$MISC_MAN_DIR = x    ; then
4488846b520Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4498846b520Smrgfi
450fd0c672fSmrg
4518846b520Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4528846b520Smrg    case $host_os in
4538846b520Smrg	# Solaris 2.0 - 11 use SysV man page sections
4548846b520Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4558846b520Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4568846b520Smrg    esac
4578846b520Smrgfi
4588846b520Smrgif test x$DRIVER_MAN_DIR = x    ; then
4598846b520Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4608846b520Smrgfi
4618846b520Smrg
4628846b520Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4638846b520Smrg    case $host_os in
4648846b520Smrg	# Solaris 2.0 - 11 use SysV man page sections
4658846b520Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4668846b520Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4678846b520Smrg    esac
4688846b520Smrgfi
4698846b520Smrgif test x$ADMIN_MAN_DIR = x    ; then
4708846b520Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4718846b520Smrgfi
472fd0c672fSmrg
473fd0c672fSmrg
4748846b520SmrgAC_SUBST([APP_MAN_SUFFIX])
4758846b520SmrgAC_SUBST([LIB_MAN_SUFFIX])
4768846b520SmrgAC_SUBST([FILE_MAN_SUFFIX])
4778846b520SmrgAC_SUBST([MISC_MAN_SUFFIX])
4788846b520SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4798846b520SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4808846b520SmrgAC_SUBST([APP_MAN_DIR])
4818846b520SmrgAC_SUBST([LIB_MAN_DIR])
4828846b520SmrgAC_SUBST([FILE_MAN_DIR])
4838846b520SmrgAC_SUBST([MISC_MAN_DIR])
4848846b520SmrgAC_SUBST([DRIVER_MAN_DIR])
4858846b520SmrgAC_SUBST([ADMIN_MAN_DIR])
4868846b520Smrg
4878846b520SmrgXORG_MAN_PAGE="X Version 11"
4888846b520SmrgAC_SUBST([XORG_MAN_PAGE])
4898846b520SmrgMAN_SUBSTS="\
4908846b520Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4918846b520Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4928846b520Smrg	-e 's|__xservername__|Xorg|g' \
4938846b520Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
4948846b520Smrg	-e 's|__projectroot__|\$(prefix)|g' \
4958846b520Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4968846b520Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4978846b520Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4988846b520Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4998846b520Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5008846b520Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5018846b520Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5028846b520SmrgAC_SUBST([MAN_SUBSTS])
5038846b520Smrg
5048846b520Smrg]) # XORG_MANPAGE_SECTIONS
5058846b520Smrg
5068846b520Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5078846b520Smrg# ------------------------
5088846b520Smrg# Minimum version: 1.7.0
509fd0c672fSmrg#
5108846b520Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5118846b520Smrg# provided by xorg-sgml-doctools, if installed.
5128846b520SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5138846b520SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5148846b520SmrgXORG_SGML_PATH=
5158846b520SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5168846b520Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5178846b520Smrg    [m4_ifval([$1],[:],
5188846b520Smrg        [if test x"$cross_compiling" != x"yes" ; then
5198846b520Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5208846b520Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5218846b520Smrg         fi])
5228846b520Smrg    ])
523fd0c672fSmrg
5248846b520Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5258846b520Smrg# the path and the name of the doc stylesheet
5268846b520Smrgif test "x$XORG_SGML_PATH" != "x" ; then
5278846b520Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5288846b520Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5298846b520Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5308846b520Smrgelse
5318846b520Smrg   AC_MSG_RESULT([no])
5328846b520Smrgfi
533fd0c672fSmrg
5348846b520SmrgAC_SUBST(XORG_SGML_PATH)
5358846b520SmrgAC_SUBST(STYLESHEET_SRCDIR)
5368846b520SmrgAC_SUBST(XSL_STYLESHEET)
5378846b520SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5388846b520Smrg]) # XORG_CHECK_SGML_DOCTOOLS
5398846b520Smrg
5408846b520Smrg# XORG_CHECK_LINUXDOC
5418846b520Smrg# -------------------
5428846b520Smrg# Minimum version: 1.0.0
543fd0c672fSmrg#
5448846b520Smrg# Defines the variable MAKE_TEXT if the necessary tools and
5458846b520Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5468846b520Smrg# Whether or not the necessary tools and files are found can be checked
5478846b520Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5488846b520SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5498846b520SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5508846b520SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551fd0c672fSmrg
5528846b520SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553fd0c672fSmrg
5548846b520SmrgAC_MSG_CHECKING([whether to build documentation])
555953c684bSmrg
5568846b520Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5578846b520Smrg   BUILDDOC=yes
5588846b520Smrgelse
5598846b520Smrg   BUILDDOC=no
560fd0c672fSmrgfi
561fd0c672fSmrg
5628846b520SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5638846b520Smrg
5648846b520SmrgAC_MSG_RESULT([$BUILDDOC])
5658846b520Smrg
5668846b520SmrgAC_MSG_CHECKING([whether to build pdf documentation])
5678846b520Smrg
5688846b520Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5698846b520Smrg   BUILDPDFDOC=yes
5708846b520Smrgelse
5718846b520Smrg   BUILDPDFDOC=no
572fd0c672fSmrgfi
573fd0c672fSmrg
5748846b520SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575fd0c672fSmrg
5768846b520SmrgAC_MSG_RESULT([$BUILDPDFDOC])
577fd0c672fSmrg
5788846b520SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5798846b520SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5808846b520SmrgMAKE_PDF="$PS2PDF"
5818846b520SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582fd0c672fSmrg
5838846b520SmrgAC_SUBST(MAKE_TEXT)
5848846b520SmrgAC_SUBST(MAKE_PS)
5858846b520SmrgAC_SUBST(MAKE_PDF)
5868846b520SmrgAC_SUBST(MAKE_HTML)
5878846b520Smrg]) # XORG_CHECK_LINUXDOC
588953c684bSmrg
5898846b520Smrg# XORG_CHECK_DOCBOOK
5908846b520Smrg# -------------------
5918846b520Smrg# Minimum version: 1.0.0
5928846b520Smrg#
5938846b520Smrg# Checks for the ability to build output formats from SGML DocBook source.
5948846b520Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5958846b520Smrg# indicates whether the necessary tools and files are found and, if set,
5968846b520Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5978846b520SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5988846b520SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599953c684bSmrg
6008846b520SmrgBUILDTXTDOC=no
6018846b520SmrgBUILDPDFDOC=no
6028846b520SmrgBUILDPSDOC=no
6038846b520SmrgBUILDHTMLDOC=no
604953c684bSmrg
6058846b520SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6068846b520SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6078846b520SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6088846b520SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609953c684bSmrg
6108846b520SmrgAC_MSG_CHECKING([whether to build text documentation])
6118846b520Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6128846b520Smrg   test x$BUILD_TXTDOC != xno; then
6138846b520Smrg	BUILDTXTDOC=yes
6148846b520Smrgfi
6158846b520SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6168846b520SmrgAC_MSG_RESULT([$BUILDTXTDOC])
617953c684bSmrg
6188846b520SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6198846b520Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6208846b520Smrg   test x$BUILD_PDFDOC != xno; then
6218846b520Smrg	BUILDPDFDOC=yes
6228846b520Smrgfi
6238846b520SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6248846b520SmrgAC_MSG_RESULT([$BUILDPDFDOC])
625953c684bSmrg
6268846b520SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6278846b520Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6288846b520Smrg   test x$BUILD_PSDOC != xno; then
6298846b520Smrg	BUILDPSDOC=yes
6308846b520Smrgfi
6318846b520SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6328846b520SmrgAC_MSG_RESULT([$BUILDPSDOC])
633953c684bSmrg
6348846b520SmrgAC_MSG_CHECKING([whether to build HTML documentation])
6358846b520Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6368846b520Smrg   test x$BUILD_HTMLDOC != xno; then
6378846b520Smrg	BUILDHTMLDOC=yes
6388846b520Smrgfi
6398846b520SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6408846b520SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
64148e69166Smrg
6428846b520SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6438846b520SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6448846b520SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6458846b520SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
646fd0c672fSmrg
6478846b520SmrgAC_SUBST(MAKE_TEXT)
6488846b520SmrgAC_SUBST(MAKE_PS)
6498846b520SmrgAC_SUBST(MAKE_PDF)
6508846b520SmrgAC_SUBST(MAKE_HTML)
6518846b520Smrg]) # XORG_CHECK_DOCBOOK
652fd0c672fSmrg
6538846b520Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6548846b520Smrg# ----------------
6558846b520Smrg# Minimum version: 1.5.0
6568846b520Smrg# Minimum version for optional DEFAULT argument: 1.11.0
657fd0c672fSmrg#
6588846b520Smrg# Documentation tools are not always available on all platforms and sometimes
6598846b520Smrg# not at the appropriate level. This macro enables a module to test for the
6608846b520Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
6618846b520Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6628846b520Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6638846b520Smrg# --with-xmlto assumes 'auto'.
664fd0c672fSmrg#
6658846b520Smrg# Interface to module:
6668846b520Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6678846b520Smrg# XMLTO:	returns the path of the xmlto program found
6688846b520Smrg#		returns the path set by the user in the environment
6698846b520Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6708846b520Smrg#		'no' user instructs the module not to use xmlto
6718846b520Smrg#
6728846b520Smrg# Added in version 1.10.0
6738846b520Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6748846b520Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6758846b520Smrg#
6768846b520Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6778846b520Smrg#
6788846b520SmrgAC_DEFUN([XORG_WITH_XMLTO],[
6798846b520SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6808846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
6818846b520SmrgAC_ARG_WITH(xmlto,
6828846b520Smrg	AS_HELP_STRING([--with-xmlto],
6838846b520Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6848846b520Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6858846b520Smrgm4_undefine([_defopt])
686fd0c672fSmrg
6878846b520Smrgif test "x$use_xmlto" = x"auto"; then
6888846b520Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6898846b520Smrg   if test "x$XMLTO" = "x"; then
6908846b520Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6918846b520Smrg	have_xmlto=no
6928846b520Smrg   else
6938846b520Smrg        have_xmlto=yes
6948846b520Smrg   fi
6958846b520Smrgelif test "x$use_xmlto" = x"yes" ; then
6968846b520Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6978846b520Smrg   if test "x$XMLTO" = "x"; then
6988846b520Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6998846b520Smrg   fi
7008846b520Smrg   have_xmlto=yes
7018846b520Smrgelif test "x$use_xmlto" = x"no" ; then
7028846b520Smrg   if test "x$XMLTO" != "x"; then
7038846b520Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7048846b520Smrg   fi
7058846b520Smrg   have_xmlto=no
706fd0c672fSmrgelse
7078846b520Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
708fd0c672fSmrgfi
709fd0c672fSmrg
7108846b520Smrg# Test for a minimum version of xmlto, if provided.
7118846b520Smrgm4_ifval([$1],
7128846b520Smrg[if test "$have_xmlto" = yes; then
7138846b520Smrg    # scrape the xmlto version
7148846b520Smrg    AC_MSG_CHECKING([the xmlto version])
7158846b520Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7168846b520Smrg    AC_MSG_RESULT([$xmlto_version])
7178846b520Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7188846b520Smrg        [if test "x$use_xmlto" = xauto; then
7198846b520Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7208846b520Smrg            have_xmlto=no
7218846b520Smrg        else
7228846b520Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7238846b520Smrg        fi])
7248846b520Smrgfi])
725fd0c672fSmrg
7268846b520Smrg# Test for the ability of xmlto to generate a text target
727fd0c672fSmrg#
7288846b520Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7298846b520Smrg# following test for empty XML docbook files.
7308846b520Smrg# For compatibility reasons use the following empty XML docbook file and if
7318846b520Smrg# it fails try it again with a non-empty XML file.
7328846b520Smrghave_xmlto_text=no
7338846b520Smrgcat > conftest.xml << "EOF"
7348846b520SmrgEOF
7358846b520SmrgAS_IF([test "$have_xmlto" = yes],
7368846b520Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7378846b520Smrg             [have_xmlto_text=yes],
7388846b520Smrg             [# Try it again with a non-empty XML file.
7398846b520Smrg              cat > conftest.xml << "EOF"
7408846b520Smrg<x></x>
7418846b520SmrgEOF
7428846b520Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7438846b520Smrg                    [have_xmlto_text=yes],
7448846b520Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7458846b520Smrgrm -f conftest.xml
7468846b520SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7478846b520SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7488846b520Smrg]) # XORG_WITH_XMLTO
749fd0c672fSmrg
7508846b520Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7518846b520Smrg# --------------------------------------------
7528846b520Smrg# Minimum version: 1.12.0
7538846b520Smrg# Minimum version for optional DEFAULT argument: 1.12.0
754fd0c672fSmrg#
7558846b520Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7568846b520Smrg# XML-based language used for the transformation of XML documents.
7578846b520Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7588846b520Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7598846b520Smrg# The XSLT processor is often used as a standalone tool for transformations.
7608846b520Smrg# It should not be assumed that this tool is used only to work with documnetation.
7618846b520Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
762fd0c672fSmrg#
7638846b520Smrg# Interface to module:
7648846b520Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7658846b520Smrg# XSLTPROC:	 returns the path of the xsltproc program found
7668846b520Smrg#		 returns the path set by the user in the environment
7678846b520Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7688846b520Smrg#		  'no' user instructs the module not to use xsltproc
7698846b520Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7708846b520Smrg#
7718846b520Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7728846b520Smrg#
7738846b520SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7748846b520SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7758846b520Smrg# Preserves the interface, should it be implemented later
7768846b520Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7778846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
7788846b520SmrgAC_ARG_WITH(xsltproc,
7798846b520Smrg	AS_HELP_STRING([--with-xsltproc],
7808846b520Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7818846b520Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7828846b520Smrgm4_undefine([_defopt])
783fd0c672fSmrg
7848846b520Smrgif test "x$use_xsltproc" = x"auto"; then
7858846b520Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7868846b520Smrg   if test "x$XSLTPROC" = "x"; then
7878846b520Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7888846b520Smrg	have_xsltproc=no
7898846b520Smrg   else
7908846b520Smrg        have_xsltproc=yes
7918846b520Smrg   fi
7928846b520Smrgelif test "x$use_xsltproc" = x"yes" ; then
7938846b520Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7948846b520Smrg   if test "x$XSLTPROC" = "x"; then
7958846b520Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7968846b520Smrg   fi
7978846b520Smrg   have_xsltproc=yes
7988846b520Smrgelif test "x$use_xsltproc" = x"no" ; then
7998846b520Smrg   if test "x$XSLTPROC" != "x"; then
8008846b520Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8018846b520Smrg   fi
8028846b520Smrg   have_xsltproc=no
803fd0c672fSmrgelse
8048846b520Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805fd0c672fSmrgfi
806fd0c672fSmrg
8078846b520SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8088846b520Smrg]) # XORG_WITH_XSLTPROC
809fd0c672fSmrg
8108846b520Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8118846b520Smrg# ----------------------------------------
8128846b520Smrg# Minimum version: 1.15.0
813fd0c672fSmrg#
8148846b520Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8158846b520Smrg# scanning arbitrary text files, extracting information from those text files,
8168846b520Smrg# and printing reports based on that information.
817953c684bSmrg#
8188846b520Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8198846b520Smrg#
8208846b520Smrg# Interface to module:
8218846b520Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8228846b520Smrg# PERL:	     returns the path of the perl program found
8238846b520Smrg#	     returns the path set by the user in the environment
8248846b520Smrg# --with-perl: 'yes' user instructs the module to use perl
8258846b520Smrg#	       'no' user instructs the module not to use perl
8268846b520Smrg# have_perl: returns yes if perl found in PATH or no
8278846b520Smrg#
8288846b520Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8298846b520Smrg#
8308846b520SmrgAC_DEFUN([XORG_WITH_PERL],[
8318846b520SmrgAC_ARG_VAR([PERL], [Path to perl command])
8328846b520Smrg# Preserves the interface, should it be implemented later
8338846b520Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8348846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
8358846b520SmrgAC_ARG_WITH(perl,
8368846b520Smrg	AS_HELP_STRING([--with-perl],
8378846b520Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8388846b520Smrg	   [use_perl=$withval], [use_perl=]_defopt)
8398846b520Smrgm4_undefine([_defopt])
840953c684bSmrg
8418846b520Smrgif test "x$use_perl" = x"auto"; then
8428846b520Smrg   AC_PATH_PROG([PERL], [perl])
8438846b520Smrg   if test "x$PERL" = "x"; then
8448846b520Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8458846b520Smrg	have_perl=no
8468846b520Smrg   else
8478846b520Smrg        have_perl=yes
8488846b520Smrg   fi
8498846b520Smrgelif test "x$use_perl" = x"yes" ; then
8508846b520Smrg   AC_PATH_PROG([PERL], [perl])
8518846b520Smrg   if test "x$PERL" = "x"; then
8528846b520Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8538846b520Smrg   fi
8548846b520Smrg   have_perl=yes
8558846b520Smrgelif test "x$use_perl" = x"no" ; then
8568846b520Smrg   if test "x$PERL" != "x"; then
8578846b520Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8588846b520Smrg   fi
8598846b520Smrg   have_perl=no
8608846b520Smrgelse
8618846b520Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
862953c684bSmrgfi
863953c684bSmrg
8648846b520SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8658846b520Smrg]) # XORG_WITH_PERL
866fd0c672fSmrg
8678846b520Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8688846b520Smrg# ----------------
8698846b520Smrg# Minimum version: 1.5.0
8708846b520Smrg# Minimum version for optional DEFAULT argument: 1.11.0
871fd0c672fSmrg#
8728846b520Smrg# Documentation tools are not always available on all platforms and sometimes
8738846b520Smrg# not at the appropriate level. This macro enables a module to test for the
8748846b520Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
8758846b520Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8768846b520Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8778846b520Smrg# --with-asciidoc assumes 'auto'.
878953c684bSmrg#
8798846b520Smrg# Interface to module:
8808846b520Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8818846b520Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
8828846b520Smrg#		 returns the path set by the user in the environment
8838846b520Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8848846b520Smrg#		  'no' user instructs the module not to use asciidoc
8858846b520Smrg#
8868846b520Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8878846b520Smrg#
8888846b520SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8898846b520SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8908846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
8918846b520SmrgAC_ARG_WITH(asciidoc,
8928846b520Smrg	AS_HELP_STRING([--with-asciidoc],
8938846b520Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8948846b520Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8958846b520Smrgm4_undefine([_defopt])
896953c684bSmrg
8978846b520Smrgif test "x$use_asciidoc" = x"auto"; then
8988846b520Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8998846b520Smrg   if test "x$ASCIIDOC" = "x"; then
9008846b520Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9018846b520Smrg	have_asciidoc=no
9028846b520Smrg   else
9038846b520Smrg        have_asciidoc=yes
9048846b520Smrg   fi
9058846b520Smrgelif test "x$use_asciidoc" = x"yes" ; then
9068846b520Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9078846b520Smrg   if test "x$ASCIIDOC" = "x"; then
9088846b520Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9098846b520Smrg   fi
9108846b520Smrg   have_asciidoc=yes
9118846b520Smrgelif test "x$use_asciidoc" = x"no" ; then
9128846b520Smrg   if test "x$ASCIIDOC" != "x"; then
9138846b520Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9148846b520Smrg   fi
9158846b520Smrg   have_asciidoc=no
916fd0c672fSmrgelse
9178846b520Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918953c684bSmrgfi
9198846b520Smrgm4_ifval([$1],
9208846b520Smrg[if test "$have_asciidoc" = yes; then
9218846b520Smrg    # scrape the asciidoc version
9228846b520Smrg    AC_MSG_CHECKING([the asciidoc version])
9238846b520Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9248846b520Smrg    AC_MSG_RESULT([$asciidoc_version])
9258846b520Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9268846b520Smrg        [if test "x$use_asciidoc" = xauto; then
9278846b520Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9288846b520Smrg            have_asciidoc=no
9298846b520Smrg        else
9308846b520Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9318846b520Smrg        fi])
9328846b520Smrgfi])
9338846b520SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9348846b520Smrg]) # XORG_WITH_ASCIIDOC
935fd0c672fSmrg
9368846b520Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9378846b520Smrg# -------------------------------------------
9388846b520Smrg# Minimum version: 1.5.0
9398846b520Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9408846b520Smrg# Minimum version for optional DOT checking: 1.18.0
94148e69166Smrg#
9428846b520Smrg# Documentation tools are not always available on all platforms and sometimes
9438846b520Smrg# not at the appropriate level. This macro enables a module to test for the
9448846b520Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9458846b520Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9468846b520Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9478846b520Smrg# --with-doxygen assumes 'auto'.
9488846b520Smrg#
9498846b520Smrg# Interface to module:
9508846b520Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9518846b520Smrg# DOXYGEN:	 returns the path of the doxygen program found
9528846b520Smrg#		 returns the path set by the user in the environment
9538846b520Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9548846b520Smrg#		  'no' user instructs the module not to use doxygen
9558846b520Smrg#
9568846b520Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9578846b520Smrg#
9588846b520SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9598846b520SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9608846b520SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9618846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
9628846b520SmrgAC_ARG_WITH(doxygen,
9638846b520Smrg	AS_HELP_STRING([--with-doxygen],
9648846b520Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9658846b520Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9668846b520Smrgm4_undefine([_defopt])
96748e69166Smrg
9688846b520Smrgif test "x$use_doxygen" = x"auto"; then
9698846b520Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9708846b520Smrg   if test "x$DOXYGEN" = "x"; then
9718846b520Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9728846b520Smrg	have_doxygen=no
9738846b520Smrg   else
9748846b520Smrg        have_doxygen=yes
9758846b520Smrg   fi
9768846b520Smrgelif test "x$use_doxygen" = x"yes" ; then
9778846b520Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9788846b520Smrg   if test "x$DOXYGEN" = "x"; then
9798846b520Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9808846b520Smrg   fi
9818846b520Smrg   have_doxygen=yes
9828846b520Smrgelif test "x$use_doxygen" = x"no" ; then
9838846b520Smrg   if test "x$DOXYGEN" != "x"; then
9848846b520Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9858846b520Smrg   fi
9868846b520Smrg   have_doxygen=no
987953c684bSmrgelse
9888846b520Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9898846b520Smrgfi
9908846b520Smrgm4_ifval([$1],
9918846b520Smrg[if test "$have_doxygen" = yes; then
9928846b520Smrg    # scrape the doxygen version
9938846b520Smrg    AC_MSG_CHECKING([the doxygen version])
9948846b520Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9958846b520Smrg    AC_MSG_RESULT([$doxygen_version])
9968846b520Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9978846b520Smrg        [if test "x$use_doxygen" = xauto; then
9988846b520Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9998846b520Smrg            have_doxygen=no
10008846b520Smrg        else
10018846b520Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10028846b520Smrg        fi])
1003953c684bSmrgfi])
10048846b520Smrg
10058846b520Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10068846b520Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10078846b520Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10088846b520SmrgHAVE_DOT=no
10098846b520Smrgif test "x$have_doxygen" = "xyes"; then
10108846b520Smrg  AC_PATH_PROG([DOT], [dot])
10118846b520Smrg    if test "x$DOT" != "x"; then
10128846b520Smrg      HAVE_DOT=yes
10138846b520Smrg    fi
1014953c684bSmrgfi
101548e69166Smrg
10168846b520SmrgAC_SUBST([HAVE_DOT])
10178846b520SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10188846b520SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10198846b520Smrg]) # XORG_WITH_DOXYGEN
10208846b520Smrg
10218846b520Smrg# XORG_WITH_GROFF([DEFAULT])
10228846b520Smrg# ----------------
10238846b520Smrg# Minimum version: 1.6.0
10248846b520Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1025fd0c672fSmrg#
10268846b520Smrg# Documentation tools are not always available on all platforms and sometimes
10278846b520Smrg# not at the appropriate level. This macro enables a module to test for the
10288846b520Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10298846b520Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
10308846b520Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
10318846b520Smrg# --with-groff assumes 'auto'.
10328846b520Smrg#
10338846b520Smrg# Interface to module:
10348846b520Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10358846b520Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10368846b520Smrg# HAVE_GROFF_MS: the -ms macros package
10378846b520Smrg# GROFF:	 returns the path of the groff program found
10388846b520Smrg#		 returns the path set by the user in the environment
10398846b520Smrg# --with-groff:	 'yes' user instructs the module to use groff
10408846b520Smrg#		 'no' user instructs the module not to use groff
10418846b520Smrg#
10428846b520Smrg# Added in version 1.9.0:
10438846b520Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10448846b520Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10458846b520Smrg#		   psselect from the psutils package.
10468846b520Smrg#		   the ghostcript package. Refer to the grohtml man pages
10478846b520Smrg#
10488846b520Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10498846b520Smrg#
10508846b520Smrg# OS and distros often splits groff in a basic and full package, the former
10518846b520Smrg# having the groff program and the later having devices, fonts and macros
10528846b520Smrg# Checking for the groff executable is not enough.
10538846b520Smrg#
10548846b520Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
10558846b520Smrg# unset HAVE_GROFF or GROFF env variables.
10568846b520Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10578846b520Smrg#
10588846b520SmrgAC_DEFUN([XORG_WITH_GROFF],[
10598846b520SmrgAC_ARG_VAR([GROFF], [Path to groff command])
10608846b520Smrgm4_define([_defopt], m4_default([$1], [auto]))
10618846b520SmrgAC_ARG_WITH(groff,
10628846b520Smrg	AS_HELP_STRING([--with-groff],
10638846b520Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10648846b520Smrg	   [use_groff=$withval], [use_groff=]_defopt)
10658846b520Smrgm4_undefine([_defopt])
1066fd0c672fSmrg
10678846b520Smrgif test "x$use_groff" = x"auto"; then
10688846b520Smrg   AC_PATH_PROG([GROFF], [groff])
10698846b520Smrg   if test "x$GROFF" = "x"; then
10708846b520Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10718846b520Smrg	have_groff=no
10728846b520Smrg   else
10738846b520Smrg        have_groff=yes
10748846b520Smrg   fi
10758846b520Smrgelif test "x$use_groff" = x"yes" ; then
10768846b520Smrg   AC_PATH_PROG([GROFF], [groff])
10778846b520Smrg   if test "x$GROFF" = "x"; then
10788846b520Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10798846b520Smrg   fi
10808846b520Smrg   have_groff=yes
10818846b520Smrgelif test "x$use_groff" = x"no" ; then
10828846b520Smrg   if test "x$GROFF" != "x"; then
10838846b520Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10848846b520Smrg   fi
10858846b520Smrg   have_groff=no
10868846b520Smrgelse
10878846b520Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1088fd0c672fSmrgfi
108948e69166Smrg
10908846b520Smrg# We have groff, test for the presence of the macro packages
10918846b520Smrgif test "x$have_groff" = x"yes"; then
10928846b520Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10938846b520Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10948846b520Smrg        groff_ms_works=yes
10958846b520Smrg    else
10968846b520Smrg        groff_ms_works=no
10978846b520Smrg    fi
10988846b520Smrg    AC_MSG_RESULT([$groff_ms_works])
10998846b520Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11008846b520Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11018846b520Smrg        groff_mm_works=yes
11028846b520Smrg    else
11038846b520Smrg        groff_mm_works=no
11048846b520Smrg    fi
11058846b520Smrg    AC_MSG_RESULT([$groff_mm_works])
11068846b520Smrgfi
110748e69166Smrg
11088846b520Smrg# We have groff, test for HTML dependencies, one command per package
11098846b520Smrgif test "x$have_groff" = x"yes"; then
11108846b520Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11118846b520Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11128846b520Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11138846b520Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11148846b520Smrg      have_groff_html=yes
11158846b520Smrg   else
11168846b520Smrg      have_groff_html=no
11178846b520Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11188846b520Smrg   fi
11198846b520Smrgfi
112048e69166Smrg
11218846b520Smrg# Set Automake conditionals for Makefiles
11228846b520SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11238846b520SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11248846b520SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11258846b520SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11268846b520Smrg]) # XORG_WITH_GROFF
1127fd0c672fSmrg
11288846b520Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11298846b520Smrg# ---------------------------------------
11308846b520Smrg# Minimum version: 1.6.0
11318846b520Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11328846b520Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1133fd0c672fSmrg#
11348846b520Smrg# Documentation tools are not always available on all platforms and sometimes
11358846b520Smrg# not at the appropriate level. This macro enables a module to test for the
11368846b520Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11378846b520Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
11388846b520Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
11398846b520Smrg# --with-fop assumes 'auto'.
1140fd0c672fSmrg#
11418846b520Smrg# Interface to module:
11428846b520Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11438846b520Smrg# FOP:	 	returns the path of the fop program found
11448846b520Smrg#		returns the path set by the user in the environment
11458846b520Smrg# --with-fop: 	'yes' user instructs the module to use fop
11468846b520Smrg#		'no' user instructs the module not to use fop
1147fd0c672fSmrg#
11488846b520Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149953c684bSmrg#
11508846b520SmrgAC_DEFUN([XORG_WITH_FOP],[
11518846b520SmrgAC_ARG_VAR([FOP], [Path to fop command])
11528846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
11538846b520SmrgAC_ARG_WITH(fop,
11548846b520Smrg	AS_HELP_STRING([--with-fop],
11558846b520Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11568846b520Smrg	   [use_fop=$withval], [use_fop=]_defopt)
11578846b520Smrgm4_undefine([_defopt])
1158953c684bSmrg
11598846b520Smrgif test "x$use_fop" = x"auto"; then
11608846b520Smrg   AC_PATH_PROG([FOP], [fop])
11618846b520Smrg   if test "x$FOP" = "x"; then
11628846b520Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11638846b520Smrg	have_fop=no
11648846b520Smrg   else
11658846b520Smrg        have_fop=yes
11668846b520Smrg   fi
11678846b520Smrgelif test "x$use_fop" = x"yes" ; then
11688846b520Smrg   AC_PATH_PROG([FOP], [fop])
11698846b520Smrg   if test "x$FOP" = "x"; then
11708846b520Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11718846b520Smrg   fi
11728846b520Smrg   have_fop=yes
11738846b520Smrgelif test "x$use_fop" = x"no" ; then
11748846b520Smrg   if test "x$FOP" != "x"; then
11758846b520Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11768846b520Smrg   fi
11778846b520Smrg   have_fop=no
11788846b520Smrgelse
11798846b520Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11808846b520Smrgfi
1181fd0c672fSmrg
11828846b520Smrg# Test for a minimum version of fop, if provided.
11838846b520Smrgm4_ifval([$1],
11848846b520Smrg[if test "$have_fop" = yes; then
11858846b520Smrg    # scrape the fop version
11868846b520Smrg    AC_MSG_CHECKING([for fop minimum version])
11878846b520Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11888846b520Smrg    AC_MSG_RESULT([$fop_version])
11898846b520Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
11908846b520Smrg        [if test "x$use_fop" = xauto; then
11918846b520Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11928846b520Smrg            have_fop=no
11938846b520Smrg        else
11948846b520Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11958846b520Smrg        fi])
11968846b520Smrgfi])
11978846b520SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11988846b520Smrg]) # XORG_WITH_FOP
1199953c684bSmrg
12008846b520Smrg# XORG_WITH_M4([MIN-VERSION])
12018846b520Smrg# ---------------------------
12028846b520Smrg# Minimum version: 1.19.0
1203a8bb11d0Smrg#
12048846b520Smrg# This macro attempts to locate an m4 macro processor which supports
12058846b520Smrg# -I option and is only useful for modules relying on M4 in order to
12068846b520Smrg# expand macros in source code files.
1207a8bb11d0Smrg#
12088846b520Smrg# Interface to module:
12098846b520Smrg# M4:	 	returns the path of the m4 program found
12108846b520Smrg#		returns the path set by the user in the environment
1211a8bb11d0Smrg#
12128846b520SmrgAC_DEFUN([XORG_WITH_M4], [
12138846b520SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12148846b520Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12158846b520Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12168846b520Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12178846b520Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12188846b520Smrg   [$PATH:/usr/gnu/bin])])
1219a8bb11d0Smrg
12208846b520SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12218846b520Smrg]) # XORG_WITH_M4
1222a8bb11d0Smrg
12238846b520Smrg# XORG_WITH_PS2PDF([DEFAULT])
12248846b520Smrg# ----------------
12258846b520Smrg# Minimum version: 1.6.0
12268846b520Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1227a8bb11d0Smrg#
12288846b520Smrg# Documentation tools are not always available on all platforms and sometimes
12298846b520Smrg# not at the appropriate level. This macro enables a module to test for the
12308846b520Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12318846b520Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12328846b520Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12338846b520Smrg# --with-ps2pdf assumes 'auto'.
1234a8bb11d0Smrg#
12358846b520Smrg# Interface to module:
12368846b520Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12378846b520Smrg# PS2PDF:	returns the path of the ps2pdf program found
12388846b520Smrg#		returns the path set by the user in the environment
12398846b520Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12408846b520Smrg#		 'no' user instructs the module not to use ps2pdf
1241a8bb11d0Smrg#
12428846b520Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243a8bb11d0Smrg#
12448846b520SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12458846b520SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12468846b520Smrgm4_define([_defopt], m4_default([$1], [auto]))
12478846b520SmrgAC_ARG_WITH(ps2pdf,
12488846b520Smrg	AS_HELP_STRING([--with-ps2pdf],
12498846b520Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12508846b520Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12518846b520Smrgm4_undefine([_defopt])
1252a8bb11d0Smrg
12538846b520Smrgif test "x$use_ps2pdf" = x"auto"; then
12548846b520Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12558846b520Smrg   if test "x$PS2PDF" = "x"; then
12568846b520Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12578846b520Smrg	have_ps2pdf=no
12588846b520Smrg   else
12598846b520Smrg        have_ps2pdf=yes
12608846b520Smrg   fi
12618846b520Smrgelif test "x$use_ps2pdf" = x"yes" ; then
12628846b520Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12638846b520Smrg   if test "x$PS2PDF" = "x"; then
12648846b520Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12658846b520Smrg   fi
12668846b520Smrg   have_ps2pdf=yes
12678846b520Smrgelif test "x$use_ps2pdf" = x"no" ; then
12688846b520Smrg   if test "x$PS2PDF" != "x"; then
12698846b520Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12708846b520Smrg   fi
12718846b520Smrg   have_ps2pdf=no
1272a8bb11d0Smrgelse
12738846b520Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12748846b520Smrgfi
12758846b520SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12768846b520Smrg]) # XORG_WITH_PS2PDF
1277fd0c672fSmrg
12788846b520Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
12798846b520Smrg# ----------------
12808846b520Smrg# Minimum version: 1.6.0
1281fd0c672fSmrg#
12828846b520Smrg# Documentation tools are not always available on all platforms and sometimes
12838846b520Smrg# not at the appropriate level. This macro enables a builder to skip all
12848846b520Smrg# documentation targets except traditional man pages.
12858846b520Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12868846b520Smrg# maximum flexibilty in controlling documentation building.
12878846b520Smrg# Refer to:
12888846b520Smrg# XORG_WITH_XMLTO         --with-xmlto
12898846b520Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12908846b520Smrg# XORG_WITH_DOXYGEN       --with-doxygen
12918846b520Smrg# XORG_WITH_FOP           --with-fop
12928846b520Smrg# XORG_WITH_GROFF         --with-groff
12938846b520Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294fd0c672fSmrg#
12958846b520Smrg# Interface to module:
12968846b520Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12978846b520Smrg# --enable-docs: 'yes' user instructs the module to generate docs
12988846b520Smrg#		 'no' user instructs the module not to generate docs
12998846b520Smrg# parm1:	specify the default value, yes or no.
1300fd0c672fSmrg#
13018846b520SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13028846b520Smrgm4_define([docs_default], m4_default([$1], [yes]))
13038846b520SmrgAC_ARG_ENABLE(docs,
13048846b520Smrg	AS_HELP_STRING([--enable-docs],
13058846b520Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13068846b520Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13078846b520Smrgm4_undefine([docs_default])
13088846b520SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13098846b520SmrgAC_MSG_CHECKING([whether to build documentation])
13108846b520SmrgAC_MSG_RESULT([$build_docs])
13118846b520Smrg]) # XORG_ENABLE_DOCS
1312fd0c672fSmrg
13138846b520Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13148846b520Smrg# ----------------
13158846b520Smrg# Minimum version: 1.6.0
1316fd0c672fSmrg#
13178846b520Smrg# This macro enables a builder to skip all developer documentation.
13188846b520Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13198846b520Smrg# maximum flexibilty in controlling documentation building.
13208846b520Smrg# Refer to:
13218846b520Smrg# XORG_WITH_XMLTO         --with-xmlto
13228846b520Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13238846b520Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13248846b520Smrg# XORG_WITH_FOP           --with-fop
13258846b520Smrg# XORG_WITH_GROFF         --with-groff
13268846b520Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13278846b520Smrg#
13288846b520Smrg# Interface to module:
13298846b520Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13308846b520Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13318846b520Smrg#			'no' user instructs the module not to generate developer docs
13328846b520Smrg# parm1:		specify the default value, yes or no.
13338846b520Smrg#
13348846b520SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13358846b520Smrgm4_define([devel_default], m4_default([$1], [yes]))
13368846b520SmrgAC_ARG_ENABLE(devel-docs,
13378846b520Smrg	AS_HELP_STRING([--enable-devel-docs],
13388846b520Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13398846b520Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13408846b520Smrgm4_undefine([devel_default])
13418846b520SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13428846b520SmrgAC_MSG_CHECKING([whether to build developer documentation])
13438846b520SmrgAC_MSG_RESULT([$build_devel_docs])
13448846b520Smrg]) # XORG_ENABLE_DEVEL_DOCS
1345fd0c672fSmrg
13468846b520Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
13478846b520Smrg# ----------------
13488846b520Smrg# Minimum version: 1.6.0
13498846b520Smrg#
13508846b520Smrg# This macro enables a builder to skip all functional specification targets.
13518846b520Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13528846b520Smrg# maximum flexibilty in controlling documentation building.
13538846b520Smrg# Refer to:
13548846b520Smrg# XORG_WITH_XMLTO         --with-xmlto
13558846b520Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13568846b520Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13578846b520Smrg# XORG_WITH_FOP           --with-fop
13588846b520Smrg# XORG_WITH_GROFF         --with-groff
13598846b520Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13608846b520Smrg#
13618846b520Smrg# Interface to module:
13628846b520Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13638846b520Smrg# --enable-specs:	'yes' user instructs the module to generate specs
13648846b520Smrg#			'no' user instructs the module not to generate specs
13658846b520Smrg# parm1:		specify the default value, yes or no.
13668846b520Smrg#
13678846b520SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13688846b520Smrgm4_define([spec_default], m4_default([$1], [yes]))
13698846b520SmrgAC_ARG_ENABLE(specs,
13708846b520Smrg	AS_HELP_STRING([--enable-specs],
13718846b520Smrg	   [Enable building the specs (default: ]spec_default[)]),
13728846b520Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
13738846b520Smrgm4_undefine([spec_default])
13748846b520SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13758846b520SmrgAC_MSG_CHECKING([whether to build functional specifications])
13768846b520SmrgAC_MSG_RESULT([$build_specs])
13778846b520Smrg]) # XORG_ENABLE_SPECS
1378fd0c672fSmrg
13798846b520Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13808846b520Smrg# ----------------------------------------------
13818846b520Smrg# Minimum version: 1.13.0
13828846b520Smrg#
13838846b520Smrg# This macro enables a builder to enable/disable unit testing
13848846b520Smrg# It makes no assumption about the test cases implementation
13858846b520Smrg# Test cases may or may not use Automake "Support for test suites"
13868846b520Smrg# They may or may not use the software utility library GLib
13878846b520Smrg#
13888846b520Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13898846b520Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13908846b520Smrg# The variable enable_unit_tests is used by other macros in this file.
13918846b520Smrg#
13928846b520Smrg# Interface to module:
13938846b520Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13948846b520Smrg# enable_unit_tests:    used in configure.ac for additional configuration
13958846b520Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13968846b520Smrg#			'no' user instructs the module not to build tests
13978846b520Smrg# parm1:		specify the default value, yes or no.
13988846b520Smrg#
13998846b520SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14008846b520SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14018846b520SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14028846b520SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14038846b520Smrgm4_define([_defopt], m4_default([$1], [auto]))
14048846b520SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14058846b520Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14068846b520Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14078846b520Smrgm4_undefine([_defopt])
14088846b520SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14098846b520SmrgAC_MSG_CHECKING([whether to build unit test cases])
14108846b520SmrgAC_MSG_RESULT([$enable_unit_tests])
14118846b520Smrg]) # XORG_ENABLE_UNIT_TESTS
1412fd0c672fSmrg
14138846b520Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14148846b520Smrg# ------------------------------------------------------
14158846b520Smrg# Minimum version: 1.17.0
1416fd0c672fSmrg#
14178846b520Smrg# This macro enables a builder to enable/disable integration testing
14188846b520Smrg# It makes no assumption about the test cases' implementation
14198846b520Smrg# Test cases may or may not use Automake "Support for test suites"
14208846b520Smrg#
14218846b520Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14228846b520Smrg# usually requires less dependencies and may be built and run under less
14238846b520Smrg# stringent environments than integration tests.
14248846b520Smrg#
14258846b520Smrg# Interface to module:
14268846b520Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14278846b520Smrg# enable_integration_tests:   used in configure.ac for additional configuration
14288846b520Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14298846b520Smrg#                             'no' user instructs the module not to build tests
14308846b520Smrg# parm1:                      specify the default value, yes or no.
14318846b520Smrg#
14328846b520SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14338846b520SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14348846b520Smrgm4_define([_defopt], m4_default([$1], [auto]))
14358846b520SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14368846b520Smrg	[Enable building integration test cases (default: ]_defopt[)]),
14378846b520Smrg	[enable_integration_tests=$enableval],
14388846b520Smrg	[enable_integration_tests=]_defopt)
14398846b520Smrgm4_undefine([_defopt])
14408846b520SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14418846b520Smrg	[test "x$enable_integration_tests" != xno])
14428846b520SmrgAC_MSG_CHECKING([whether to build unit test cases])
14438846b520SmrgAC_MSG_RESULT([$enable_integration_tests])
14448846b520Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445fd0c672fSmrg
14468846b520Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14478846b520Smrg# ----------------------------------------
14488846b520Smrg# Minimum version: 1.13.0
14498846b520Smrg#
14508846b520Smrg# GLib is a library which provides advanced data structures and functions.
14518846b520Smrg# This macro enables a module to test for the presence of Glib.
14528846b520Smrg#
14538846b520Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14548846b520Smrg# Otherwise the value of $enable_unit_tests is blank.
14558846b520Smrg#
14568846b520Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14578846b520Smrg# test support usually requires less dependencies and may be built and run under
14588846b520Smrg# less stringent environments than integration tests.
14598846b520Smrg#
14608846b520Smrg# Interface to module:
14618846b520Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
14628846b520Smrg# with_glib: used in configure.ac to know if GLib has been found
14638846b520Smrg# --with-glib:	'yes' user instructs the module to use glib
14648846b520Smrg#		'no' user instructs the module not to use glib
14658846b520Smrg#
14668846b520SmrgAC_DEFUN([XORG_WITH_GLIB],[
14678846b520SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14688846b520Smrgm4_define([_defopt], m4_default([$2], [auto]))
14698846b520SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14708846b520Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14718846b520Smrg	[with_glib=$withval], [with_glib=]_defopt)
14728846b520Smrgm4_undefine([_defopt])
1473fd0c672fSmrg
14748846b520Smrghave_glib=no
14758846b520Smrg# Do not probe GLib if user explicitly disabled unit testing
14768846b520Smrgif test "x$enable_unit_tests" != x"no"; then
14778846b520Smrg  # Do not probe GLib if user explicitly disabled it
14788846b520Smrg  if test "x$with_glib" != x"no"; then
14798846b520Smrg    m4_ifval(
14808846b520Smrg      [$1],
14818846b520Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14828846b520Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14838846b520Smrg    )
14848846b520Smrg  fi
1485fd0c672fSmrgfi
1486fd0c672fSmrg
14878846b520Smrg# Not having GLib when unit testing has been explicitly requested is an error
14888846b520Smrgif test "x$enable_unit_tests" = x"yes"; then
14898846b520Smrg  if test "x$have_glib" = x"no"; then
14908846b520Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14918846b520Smrg  fi
1492fd0c672fSmrgfi
1493fd0c672fSmrg
14948846b520Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
14958846b520Smrgif test "x$enable_unit_tests" = x"no"; then
14968846b520Smrg  if test "x$with_glib" = x"yes"; then
14978846b520Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14988846b520Smrg  fi
1499fd0c672fSmrgfi
1500fd0c672fSmrg
15018846b520Smrg# Not having GLib when it has been explicitly requested is an error
15028846b520Smrgif test "x$with_glib" = x"yes"; then
15038846b520Smrg  if test "x$have_glib" = x"no"; then
15048846b520Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15058846b520Smrg  fi
1506fd0c672fSmrgfi
1507fd0c672fSmrg
15088846b520SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15098846b520Smrg]) # XORG_WITH_GLIB
1510fd0c672fSmrg
15118846b520Smrg# XORG_LD_WRAP([required|optional])
15128846b520Smrg# ---------------------------------
15138846b520Smrg# Minimum version: 1.13.0
15148846b520Smrg#
15158846b520Smrg# Check if linker supports -wrap, passed via compiler flags
15168846b520Smrg#
15178846b520Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15188846b520Smrg# Otherwise the value of $enable_unit_tests is blank.
15198846b520Smrg#
15208846b520Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15218846b520Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15228846b520Smrg# available, an argument of "optional" allows use when some unit tests require
15238846b520Smrg# ld -wrap and others do not.
15248846b520Smrg#
15258846b520SmrgAC_DEFUN([XORG_LD_WRAP],[
15268846b520SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15278846b520Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15288846b520Smrg                      void __wrap_exit(int status) { return; }],
15298846b520Smrg                     [exit(0);])])
15308846b520Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
15318846b520Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15328846b520Smrg  if test "x$have_ld_wrap" = x"no"; then
15338846b520Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15348846b520Smrg  fi
1535fd0c672fSmrgfi
15368846b520SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15378846b520Smrg#
15388846b520Smrg]) # XORG_LD_WRAP
1539fd0c672fSmrg
15408846b520Smrg# XORG_CHECK_LINKER_FLAGS
15418846b520Smrg# -----------------------
15428846b520Smrg# SYNOPSIS
15438846b520Smrg#
15448846b520Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15458846b520Smrg#
15468846b520Smrg# DESCRIPTION
15478846b520Smrg#
15488846b520Smrg#   Check whether the given linker FLAGS work with the current language's
15498846b520Smrg#   linker, or whether they give an error.
15508846b520Smrg#
15518846b520Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15528846b520Smrg#   success/failure.
15538846b520Smrg#
15548846b520Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
15558846b520Smrg#
15568846b520Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15578846b520Smrg#
15588846b520Smrg# LICENSE
15598846b520Smrg#
15608846b520Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15618846b520Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15628846b520Smrg#   Copyright (c) 2009 Matteo Frigo
15638846b520Smrg#
15648846b520Smrg#   This program is free software: you can redistribute it and/or modify it
15658846b520Smrg#   under the terms of the GNU General Public License as published by the
15668846b520Smrg#   Free Software Foundation, either version 3 of the License, or (at your
15678846b520Smrg#   option) any later version.
15688846b520Smrg#
15698846b520Smrg#   This program is distributed in the hope that it will be useful, but
15708846b520Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15718846b520Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15728846b520Smrg#   Public License for more details.
15738846b520Smrg#
15748846b520Smrg#   You should have received a copy of the GNU General Public License along
15758846b520Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15768846b520Smrg#
15778846b520Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
15788846b520Smrg#   gives unlimited permission to copy, distribute and modify the configure
15798846b520Smrg#   scripts that are the output of Autoconf when processing the Macro. You
15808846b520Smrg#   need not follow the terms of the GNU General Public License when using
15818846b520Smrg#   or distributing such scripts, even though portions of the text of the
15828846b520Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15838846b520Smrg#   all other use of the material that constitutes the Autoconf Macro.
15848846b520Smrg#
15858846b520Smrg#   This special exception to the GPL applies to versions of the Autoconf
15868846b520Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
15878846b520Smrg#   modified version of the Autoconf Macro, you may extend this special
15888846b520Smrg#   exception to the GPL to apply to your modified version as well.#
15898846b520SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15908846b520Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
15918846b520Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15928846b520SmrgAS_LITERAL_IF([$1],
15938846b520Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15948846b520Smrg      ax_save_FLAGS=$LDFLAGS
15958846b520Smrg      LDFLAGS="$1"
15968846b520Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15978846b520Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15988846b520Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15998846b520Smrg      LDFLAGS=$ax_save_FLAGS])],
16008846b520Smrg  [ax_save_FLAGS=$LDFLAGS
16018846b520Smrg   LDFLAGS="$1"
16028846b520Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16038846b520Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16048846b520Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16058846b520Smrg   LDFLAGS=$ax_save_FLAGS])
16068846b520Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16078846b520SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16088846b520Smrgif test "x$xorg_check_linker_flags" = xyes; then
16098846b520Smrg	m4_default([$2], :)
16108846b520Smrgelse
16118846b520Smrg	m4_default([$3], :)
16128846b520Smrgfi
16138846b520Smrg]) # XORG_CHECK_LINKER_FLAGS
1614fd0c672fSmrg
16158846b520Smrg# XORG_MEMORY_CHECK_FLAGS
16168846b520Smrg# -----------------------
16178846b520Smrg# Minimum version: 1.16.0
16188846b520Smrg#
16198846b520Smrg# This macro attempts to find appropriate memory checking functionality
16208846b520Smrg# for various platforms which unit testing code may use to catch various
16218846b520Smrg# forms of memory allocation and access errors in testing.
16228846b520Smrg#
16238846b520Smrg# Interface to module:
16248846b520Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16258846b520Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16268846b520Smrg#
16278846b520Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16288846b520Smrg#
16298846b520SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
163048e69166Smrg
16318846b520SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16328846b520SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16338846b520Smrg           [Environment variables to enable memory checking in tests])
1634fd0c672fSmrg
16358846b520Smrg# Check for different types of support on different platforms
16368846b520Smrgcase $host_os in
16378846b520Smrg    solaris*)
16388846b520Smrg        AC_CHECK_LIB([umem], [umem_alloc],
16398846b520Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16408846b520Smrg        ;;
16418846b520Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16428846b520Smrg        # both directly and inverted, so should not be 0 or 255.
16438846b520Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
16448846b520Smrg        ;;
16458846b520Smrg    darwin*)
16468846b520Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16478846b520Smrg        ;;
16488846b520Smrg    *bsd*)
16498846b520Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16508846b520Smrg        ;;
16518846b520Smrgesac
165248e69166Smrg
16538846b520Smrg# User supplied flags override default flags
16548846b520Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16558846b520Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
165648e69166Smrgfi
165748e69166Smrg
16588846b520SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16598846b520Smrg]) # XORG_WITH_LINT
166048e69166Smrg
16618846b520Smrg# XORG_CHECK_MALLOC_ZERO
16628846b520Smrg# ----------------------
1663fd0c672fSmrg# Minimum version: 1.0.0
1664fd0c672fSmrg#
16658846b520Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16668846b520Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16678846b520Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16688846b520SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16698846b520SmrgAC_ARG_ENABLE(malloc0returnsnull,
16708846b520Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16718846b520Smrg		       [malloc(0) returns NULL (default: auto)]),
16728846b520Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16738846b520Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1674fd0c672fSmrg
16758846b520SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16768846b520Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16778846b520SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16788846b520Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16798846b520Smrg#include <stdlib.h>
16808846b520Smrg],[
16818846b520Smrg    char *m0, *r0, *c0, *p;
16828846b520Smrg    m0 = malloc(0);
16838846b520Smrg    p = malloc(10);
16848846b520Smrg    r0 = realloc(p,0);
16858846b520Smrg    c0 = calloc(0,10);
16868846b520Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16878846b520Smrg])],
16888846b520Smrg		[xorg_cv_malloc0_returns_null=yes],
16898846b520Smrg		[xorg_cv_malloc0_returns_null=no])])
16908846b520SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1691fd0c672fSmrgfi
16928846b520SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1693fd0c672fSmrg
16948846b520Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16958846b520Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16968846b520Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16978846b520Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1698fd0c672fSmrgelse
16998846b520Smrg	MALLOC_ZERO_CFLAGS=""
17008846b520Smrg	XMALLOC_ZERO_CFLAGS=""
17018846b520Smrg	XTMALLOC_ZERO_CFLAGS=""
1702fd0c672fSmrgfi
1703fd0c672fSmrg
17048846b520SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17058846b520SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17068846b520SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17078846b520Smrg]) # XORG_CHECK_MALLOC_ZERO
1708fd0c672fSmrg
17098846b520Smrg# XORG_WITH_LINT()
17108846b520Smrg# ----------------
17118846b520Smrg# Minimum version: 1.1.0
1712fd0c672fSmrg#
17138846b520Smrg# This macro enables the use of a tool that flags some suspicious and
17148846b520Smrg# non-portable constructs (likely to be bugs) in C language source code.
17158846b520Smrg# It will attempt to locate the tool and use appropriate options.
17168846b520Smrg# There are various lint type tools on different platforms.
17178846b520Smrg#
17188846b520Smrg# Interface to module:
17198846b520Smrg# LINT:		returns the path to the tool found on the platform
17208846b520Smrg#		or the value set to LINT on the configure cmd line
17218846b520Smrg#		also an Automake conditional
17228846b520Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17238846b520Smrg#
17248846b520Smrg# --with-lint:	'yes' user instructs the module to use lint
17258846b520Smrg#		'no' user instructs the module not to use lint (default)
17268846b520Smrg#
17278846b520Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17288846b520Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17298846b520Smrg#
17308846b520SmrgAC_DEFUN([XORG_WITH_LINT],[
1731fd0c672fSmrg
17328846b520SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17338846b520SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17348846b520SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17358846b520Smrg		[Use a lint-style source code checker (default: disabled)])],
17368846b520Smrg		[use_lint=$withval], [use_lint=no])
1737fd0c672fSmrg
17388846b520Smrg# Obtain platform specific info like program name and options
17398846b520Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17408846b520Smrgcase $host_os in
17418846b520Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17428846b520Smrg	lint_name=splint
17438846b520Smrg	lint_options="-badflag"
17448846b520Smrg	;;
17458846b520Smrg  *freebsd* | *netbsd*)
17468846b520Smrg	lint_name=lint
17478846b520Smrg	lint_options="-u -b"
17488846b520Smrg	;;
17498846b520Smrg  *solaris*)
17508846b520Smrg	lint_name=lint
17518846b520Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17528846b520Smrg	;;
17538846b520Smrgesac
1754fd0c672fSmrg
17558846b520Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17568846b520Smrgif test "x$use_lint" = x"yes" ; then
17578846b520Smrg   AC_PATH_PROG([LINT], [$lint_name])
17588846b520Smrg   if test "x$LINT" = "x"; then
17598846b520Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17608846b520Smrg   fi
17618846b520Smrgelif test "x$use_lint" = x"no" ; then
17628846b520Smrg   if test "x$LINT" != "x"; then
17638846b520Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17648846b520Smrg   fi
17658846b520Smrgelse
17668846b520Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1767fd0c672fSmrgfi
1768fd0c672fSmrg
17698846b520Smrg# User supplied flags override default flags
17708846b520Smrgif test "x$LINT_FLAGS" != "x"; then
17718846b520Smrg   lint_options=$LINT_FLAGS
1772fd0c672fSmrgfi
1773fd0c672fSmrg
17748846b520SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17758846b520SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776fd0c672fSmrg
17778846b520Smrg]) # XORG_WITH_LINT
1778fd0c672fSmrg
17798846b520Smrg# XORG_LINT_LIBRARY(LIBNAME)
17808846b520Smrg# --------------------------
17818846b520Smrg# Minimum version: 1.1.0
178248e69166Smrg#
17838846b520Smrg# Sets up flags for building lint libraries for checking programs that call
17848846b520Smrg# functions in the library.
178548e69166Smrg#
178648e69166Smrg# Interface to module:
17878846b520Smrg# LINTLIB		- Automake variable with the name of lint library file to make
17888846b520Smrg# MAKE_LINT_LIB		- Automake conditional
178948e69166Smrg#
17908846b520Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17918846b520Smrg#			  - 'no' user instructs the module not to create a lint library (default)
179248e69166Smrg
17938846b520SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17948846b520SmrgAC_REQUIRE([XORG_WITH_LINT])
17958846b520SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17968846b520Smrg	[Create lint library (default: disabled)])],
17978846b520Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17988846b520Smrg
17998846b520Smrgif test "x$make_lint_lib" = x"yes" ; then
18008846b520Smrg   LINTLIB=llib-l$1.ln
18018846b520Smrg   if test "x$LINT" = "x"; then
18028846b520Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
180348e69166Smrg   fi
18048846b520Smrgelif test "x$make_lint_lib" != x"no" ; then
18058846b520Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
180648e69166Smrgfi
180748e69166Smrg
18088846b520SmrgAC_SUBST(LINTLIB)
18098846b520SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
181048e69166Smrg
18118846b520Smrg]) # XORG_LINT_LIBRARY
181248e69166Smrg
18138846b520Smrg# XORG_COMPILER_BRAND
18148846b520Smrg# -------------------
18158846b520Smrg# Minimum version: 1.14.0
1816a8bb11d0Smrg#
18178846b520Smrg# Checks for various brands of compilers and sets flags as appropriate:
18188846b520Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18198846b520Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18208846b520Smrg#   clang compiler - sets CLANGCC to "yes"
18218846b520Smrg#   Intel compiler - sets INTELCC to "yes"
18228846b520Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823a8bb11d0Smrg#
18248846b520SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18258846b520SmrgAC_LANG_CASE(
18268846b520Smrg	[C], [
18278846b520Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18288846b520Smrg	],
18298846b520Smrg	[C++], [
18308846b520Smrg		AC_REQUIRE([AC_PROG_CXX])
18318846b520Smrg	]
18328846b520Smrg)
18338846b520SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18348846b520SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18358846b520SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18368846b520Smrg]) # XORG_COMPILER_BRAND
18378846b520Smrg
18388846b520Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18398846b520Smrg# ---------------
18408846b520Smrg# Minimum version: 1.16.0
1841a8bb11d0Smrg#
18428846b520Smrg# Test if the compiler works when passed the given flag as a command line argument.
18438846b520Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18448846b520Smrg# next flag in the list until there are no more options.
1845a8bb11d0Smrg#
18468846b520Smrg# Note that this does not guarantee that the compiler supports the flag as some
18478846b520Smrg# compilers will simply ignore arguments that they do not understand, but we do
18488846b520Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18498846b520Smrg# -Werror=unused-command-line-argument
18508846b520Smrg#
18518846b520SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18528846b520Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18538846b520Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854a8bb11d0Smrg
18558846b520SmrgAC_LANG_COMPILER_REQUIRE
1856a8bb11d0Smrg
18578846b520SmrgAC_LANG_CASE(
18588846b520Smrg	[C], [
18598846b520Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18608846b520Smrg		define([PREFIX], [C])
18618846b520Smrg		define([CACHE_PREFIX], [cc])
18628846b520Smrg		define([COMPILER], [$CC])
18638846b520Smrg	],
18648846b520Smrg	[C++], [
18658846b520Smrg		define([PREFIX], [CXX])
18668846b520Smrg		define([CACHE_PREFIX], [cxx])
18678846b520Smrg		define([COMPILER], [$CXX])
18688846b520Smrg	]
18698846b520Smrg)
1870a8bb11d0Smrg
18718846b520Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1872a8bb11d0Smrg
18738846b520Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18748846b520Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18758846b520Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18768846b520Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18778846b520Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18788846b520Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18798846b520Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18808846b520Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18818846b520Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882a8bb11d0Smrgfi
1883a8bb11d0Smrg
18848846b520Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18858846b520Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18868846b520Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18878846b520Smrg	fi
18888846b520Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18898846b520Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18908846b520Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18918846b520Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18928846b520Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18938846b520Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18948846b520Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18958846b520Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18968846b520Smrgfi
1897a8bb11d0Smrg
18988846b520Smrgfound="no"
18998846b520Smrgm4_foreach([flag], m4_cdr($@), [
19008846b520Smrg	if test $found = "no" ; then
19018846b520Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19028846b520Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19038846b520Smrg		fi
19048846b520Smrg
19058846b520Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19068846b520Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19078846b520Smrg		fi
19088846b520Smrg
19098846b520Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19108846b520Smrg
19118846b520Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19128846b520Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19138846b520Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19148846b520Smrg		AC_CACHE_VAL($cacheid,
19158846b520Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19168846b520Smrg					     [eval $cacheid=yes],
19178846b520Smrg					     [eval $cacheid=no])])
19188846b520Smrg
19198846b520Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19208846b520Smrg
19218846b520Smrg		eval supported=\$$cacheid
19228846b520Smrg		AC_MSG_RESULT([$supported])
19238846b520Smrg		if test "$supported" = "yes" ; then
19248846b520Smrg			$1="$$1 ]flag["
19258846b520Smrg			found="yes"
19268846b520Smrg		fi
19278846b520Smrg	fi
19288846b520Smrg])
19298846b520Smrg]) # XORG_TESTSET_CFLAG
19308846b520Smrg
19318846b520Smrg# XORG_COMPILER_FLAGS
19328846b520Smrg# ---------------
19338846b520Smrg# Minimum version: 1.16.0
193448e69166Smrg#
19358846b520Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19368846b520Smrg# arguments supported by the selected compiler which do NOT alter the generated
19378846b520Smrg# code.  These arguments will cause the compiler to print various warnings
19388846b520Smrg# during compilation AND turn a conservative set of warnings into errors.
193948e69166Smrg#
19408846b520Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19418846b520Smrg# future versions of util-macros as options are added to new compilers.
194248e69166Smrg#
19438846b520SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19448846b520SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
194548e69166Smrg
19468846b520SmrgAC_ARG_ENABLE(selective-werror,
19478846b520Smrg              AS_HELP_STRING([--disable-selective-werror],
19488846b520Smrg                             [Turn off selective compiler errors. (default: enabled)]),
19498846b520Smrg              [SELECTIVE_WERROR=$enableval],
19508846b520Smrg              [SELECTIVE_WERROR=yes])
19518846b520Smrg
19528846b520SmrgAC_LANG_CASE(
19538846b520Smrg        [C], [
19548846b520Smrg                define([PREFIX], [C])
19558846b520Smrg        ],
19568846b520Smrg        [C++], [
19578846b520Smrg                define([PREFIX], [CXX])
19588846b520Smrg        ]
19598846b520Smrg)
19608846b520Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19618846b520Smrgif test "x$SUNCC" = "xyes"; then
19628846b520Smrg    [BASE_]PREFIX[FLAGS]="-v"
196348e69166Smrgelse
19648846b520Smrg    [BASE_]PREFIX[FLAGS]=""
196548e69166Smrgfi
196648e69166Smrg
19678846b520Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19688846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19698846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19708846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19718846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
197248e69166Smrg
19738846b520SmrgAC_LANG_CASE(
19748846b520Smrg	[C], [
19758846b520Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19768846b520Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19778846b520Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19788846b520Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19798846b520Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19808846b520Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19818846b520Smrg	]
19828846b520Smrg)
19838846b520Smrg
19848846b520Smrg# This chunk adds additional warnings that could catch undesired effects.
19858846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19868846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19878846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19888846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19898846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19908846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19918846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19928846b520Smrg
19938846b520Smrg# These are currently disabled because they are noisy.  They will be enabled
19948846b520Smrg# in the future once the codebase is sufficiently modernized to silence
19958846b520Smrg# them.  For now, I don't want them to drown out the other warnings.
19968846b520Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19978846b520Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19988846b520Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19998846b520Smrg
20008846b520Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20018846b520Smrg# when there are problems that should be fixed.
20028846b520Smrg
20038846b520Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20048846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20058846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20068846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20078846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20088846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20098846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20108846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20118846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20128846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20138846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20148846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20158846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20168846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201748e69166Smrgelse
20188846b520SmrgAC_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])
20198846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20208846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20218846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20228846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20238846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20248846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20258846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20268846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20278846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20288846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20298846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20308846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20318846b520SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203248e69166Smrgfi
203348e69166Smrg
20348846b520SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20358846b520Smrg]) # XORG_COMPILER_FLAGS
20368846b520Smrg
20378846b520Smrg# XORG_CWARNFLAGS
20388846b520Smrg# ---------------
20398846b520Smrg# Minimum version: 1.2.0
20408846b520Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
204148e69166Smrg#
20428846b520Smrg# Defines CWARNFLAGS to enable C compiler warnings.
204348e69166Smrg#
20448846b520Smrg# This function is deprecated because it defines -fno-strict-aliasing
20458846b520Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20468846b520Smrg# is needed, then it should be added explicitly in the module when
20478846b520Smrg# it is updated to use BASE_CFLAGS.
204848e69166Smrg#
20498846b520SmrgAC_DEFUN([XORG_CWARNFLAGS], [
20508846b520SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20518846b520SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20528846b520SmrgAC_LANG_CASE(
20538846b520Smrg	[C], [
20548846b520Smrg		CWARNFLAGS="$BASE_CFLAGS"
20558846b520Smrg		if  test "x$GCC" = xyes ; then
20568846b520Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20578846b520Smrg		fi
20588846b520Smrg		AC_SUBST(CWARNFLAGS)
20598846b520Smrg	]
20608846b520Smrg)
20618846b520Smrg]) # XORG_CWARNFLAGS
20628846b520Smrg
20638846b520Smrg# XORG_STRICT_OPTION
20648846b520Smrg# -----------------------
20658846b520Smrg# Minimum version: 1.3.0
206648e69166Smrg#
20678846b520Smrg# Add configure option to enable strict compilation flags, such as treating
20688846b520Smrg# warnings as fatal errors.
20698846b520Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20708846b520Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
207148e69166Smrg#
20728846b520Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20738846b520Smrg# when strict compilation is unconditionally desired.
20748846b520SmrgAC_DEFUN([XORG_STRICT_OPTION], [
20758846b520SmrgAC_REQUIRE([XORG_CWARNFLAGS])
20768846b520SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
207748e69166Smrg
20788846b520SmrgAC_ARG_ENABLE(strict-compilation,
20798846b520Smrg			  AS_HELP_STRING([--enable-strict-compilation],
20808846b520Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20818846b520Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
208248e69166Smrg
20838846b520SmrgAC_LANG_CASE(
20848846b520Smrg        [C], [
20858846b520Smrg                define([PREFIX], [C])
20868846b520Smrg        ],
20878846b520Smrg        [C++], [
20888846b520Smrg                define([PREFIX], [CXX])
20898846b520Smrg        ]
20908846b520Smrg)
209148e69166Smrg
20928846b520Smrg[STRICT_]PREFIX[FLAGS]=""
20938846b520SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20948846b520SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
209548e69166Smrg
20968846b520Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20978846b520Smrg# activate it with -Werror, so we add it here explicitly.
20988846b520SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
209948e69166Smrg
21008846b520Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21018846b520Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21028846b520Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21038846b520Smrgfi
21048846b520SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21058846b520SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21068846b520SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21078846b520Smrg]) # XORG_STRICT_OPTION
21088846b520Smrg
21098846b520Smrg# XORG_DEFAULT_OPTIONS
21108846b520Smrg# --------------------
21118846b520Smrg# Minimum version: 1.3.0
211248e69166Smrg#
21138846b520Smrg# Defines default options for X.Org modules.
211448e69166Smrg#
21158846b520SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21168846b520SmrgAC_REQUIRE([AC_PROG_INSTALL])
21178846b520SmrgXORG_COMPILER_FLAGS
21188846b520SmrgXORG_CWARNFLAGS
21198846b520SmrgXORG_STRICT_OPTION
21208846b520SmrgXORG_RELEASE_VERSION
21218846b520SmrgXORG_CHANGELOG
21228846b520SmrgXORG_INSTALL
21238846b520SmrgXORG_MANPAGE_SECTIONS
21248846b520Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21258846b520Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21268846b520Smrg]) # XORG_DEFAULT_OPTIONS
21278846b520Smrg
21288846b520Smrg# XORG_INSTALL()
21298846b520Smrg# ----------------
21308846b520Smrg# Minimum version: 1.4.0
213148e69166Smrg#
21328846b520Smrg# Defines the variable INSTALL_CMD as the command to copy
21338846b520Smrg# INSTALL from $prefix/share/util-macros.
213448e69166Smrg#
21358846b520SmrgAC_DEFUN([XORG_INSTALL], [
21368846b520SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21378846b520Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21388846b520SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21398846b520Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21408846b520Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21418846b520Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21428846b520SmrgAC_SUBST([INSTALL_CMD])
21438846b520Smrg]) # XORG_INSTALL
21448846b520Smrgdnl Copyright 2005 Red Hat, Inc
21458846b520Smrgdnl
21468846b520Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21478846b520Smrgdnl documentation for any purpose is hereby granted without fee, provided that
21488846b520Smrgdnl the above copyright notice appear in all copies and that both that
21498846b520Smrgdnl copyright notice and this permission notice appear in supporting
21508846b520Smrgdnl documentation.
21518846b520Smrgdnl
21528846b520Smrgdnl The above copyright notice and this permission notice shall be included
21538846b520Smrgdnl in all copies or substantial portions of the Software.
21548846b520Smrgdnl
21558846b520Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21568846b520Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21578846b520Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21588846b520Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21598846b520Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21608846b520Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21618846b520Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
21628846b520Smrgdnl
21638846b520Smrgdnl Except as contained in this notice, the name of the copyright holders shall
21648846b520Smrgdnl not be used in advertising or otherwise to promote the sale, use or
21658846b520Smrgdnl other dealings in this Software without prior written authorization
21668846b520Smrgdnl from the copyright holders.
21678846b520Smrgdnl
216848e69166Smrg
21698846b520Smrg# XORG_RELEASE_VERSION
21708846b520Smrg# --------------------
21718846b520Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172a8bb11d0Smrg
21738846b520SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21748846b520Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21758846b520Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21768846b520Smrg		[Major version of this package])
21778846b520Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21788846b520Smrg	if test "x$PVM" = "x"; then
21798846b520Smrg		PVM="0"
21808846b520Smrg	fi
21818846b520Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21828846b520Smrg		[$PVM],
21838846b520Smrg		[Minor version of this package])
21848846b520Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21858846b520Smrg	if test "x$PVP" = "x"; then
21868846b520Smrg		PVP="0"
21878846b520Smrg	fi
21888846b520Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21898846b520Smrg		[$PVP],
21908846b520Smrg		[Patch version of this package])
21918846b520Smrg])
219248e69166Smrg
21938846b520Smrg# XORG_CHANGELOG()
219448e69166Smrg# ----------------
21958846b520Smrg# Minimum version: 1.2.0
219648e69166Smrg#
21978846b520Smrg# Defines the variable CHANGELOG_CMD as the command to generate
21988846b520Smrg# ChangeLog from git.
219948e69166Smrg#
220048e69166Smrg#
22018846b520SmrgAC_DEFUN([XORG_CHANGELOG], [
22028846b520SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22038846b520Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22048846b520Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22058846b520Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22068846b520SmrgAC_SUBST([CHANGELOG_CMD])
22078846b520Smrg]) # XORG_CHANGELOG
22088846b520Smrg
22098846b520Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
221048e69166Smrg#
22118846b520Smrg# This file is free software; the Free Software Foundation
22128846b520Smrg# gives unlimited permission to copy and/or distribute it,
22138846b520Smrg# with or without modifications, as long as this notice is preserved.
221448e69166Smrg
22158846b520Smrg# AM_AUTOMAKE_VERSION(VERSION)
22168846b520Smrg# ----------------------------
22178846b520Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22188846b520Smrg# generated from the m4 files accompanying Automake X.Y.
22198846b520Smrg# (This private macro should not be called outside this file.)
22208846b520SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22218846b520Smrg[am__api_version='1.15'
22228846b520Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22238846b520Smrgdnl require some minimum version.  Point them to the right macro.
22248846b520Smrgm4_if([$1], [1.15], [],
22258846b520Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22268846b520Smrg])
222748e69166Smrg
22288846b520Smrg# _AM_AUTOCONF_VERSION(VERSION)
22298846b520Smrg# -----------------------------
22308846b520Smrg# aclocal traces this macro to find the Autoconf version.
22318846b520Smrg# This is a private macro too.  Using m4_define simplifies
22328846b520Smrg# the logic in aclocal, which can simply ignore this definition.
22338846b520Smrgm4_define([_AM_AUTOCONF_VERSION], [])
22348846b520Smrg
22358846b520Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22368846b520Smrg# -------------------------------
22378846b520Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22388846b520Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22398846b520SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22408846b520Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
22418846b520Smrgm4_ifndef([AC_AUTOCONF_VERSION],
22428846b520Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22438846b520Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
22448846b520Smrg
22458846b520Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22468846b520Smrg
22478846b520Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
224848e69166Smrg#
22498846b520Smrg# This file is free software; the Free Software Foundation
22508846b520Smrg# gives unlimited permission to copy and/or distribute it,
22518846b520Smrg# with or without modifications, as long as this notice is preserved.
22528846b520Smrg
22538846b520Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22548846b520Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22558846b520Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
225648e69166Smrg#
22578846b520Smrg# Of course, Automake must honor this variable whenever it calls a
22588846b520Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22598846b520Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22608846b520Smrg# depending on how configure is run.  This is pretty annoying, since
22618846b520Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22628846b520Smrg# source directory, any form will work fine, but in subdirectories a
22638846b520Smrg# relative path needs to be adjusted first.
226448e69166Smrg#
22658846b520Smrg# $ac_aux_dir/missing
22668846b520Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22678846b520Smrg# $top_srcdir/$ac_aux_dir/missing
22688846b520Smrg#    fails if $ac_aux_dir is absolute,
22698846b520Smrg#    fails when called from a subdirectory in a VPATH build with
22708846b520Smrg#          a relative $ac_aux_dir
227148e69166Smrg#
22728846b520Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22738846b520Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
22748846b520Smrg# harmless because $srcdir is '.', but things will broke when you
22758846b520Smrg# start a VPATH build or use an absolute $srcdir.
227648e69166Smrg#
22778846b520Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22788846b520Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22798846b520Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22808846b520Smrg# and then we would define $MISSING as
22818846b520Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22828846b520Smrg# This will work as long as MISSING is not called from configure, because
22838846b520Smrg# unfortunately $(top_srcdir) has no meaning in configure.
22848846b520Smrg# However there are other variables, like CC, which are often used in
22858846b520Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
228648e69166Smrg#
22878846b520Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
22888846b520Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
22898846b520Smrg# configured tree to be moved without reconfiguration.
229048e69166Smrg
22918846b520SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22928846b520Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22938846b520Smrg# Expand $ac_aux_dir to an absolute path.
22948846b520Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
22958846b520Smrg])
22968846b520Smrg
22978846b520Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
22988846b520Smrg
22998846b520Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230048e69166Smrg#
23018846b520Smrg# This file is free software; the Free Software Foundation
23028846b520Smrg# gives unlimited permission to copy and/or distribute it,
23038846b520Smrg# with or without modifications, as long as this notice is preserved.
23048846b520Smrg
23058846b520Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23068846b520Smrg# -------------------------------------
23078846b520Smrg# Define a conditional.
23088846b520SmrgAC_DEFUN([AM_CONDITIONAL],
23098846b520Smrg[AC_PREREQ([2.52])dnl
23108846b520Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23118846b520Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23128846b520SmrgAC_SUBST([$1_TRUE])dnl
23138846b520SmrgAC_SUBST([$1_FALSE])dnl
23148846b520Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23158846b520Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23168846b520Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23178846b520Smrgif $2; then
23188846b520Smrg  $1_TRUE=
23198846b520Smrg  $1_FALSE='#'
23208846b520Smrgelse
23218846b520Smrg  $1_TRUE='#'
23228846b520Smrg  $1_FALSE=
23238846b520Smrgfi
23248846b520SmrgAC_CONFIG_COMMANDS_PRE(
23258846b520Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23268846b520Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23278846b520SmrgUsually this means the macro was only invoked conditionally.]])
23288846b520Smrgfi])])
23298846b520Smrg
23308846b520Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233148e69166Smrg#
23328846b520Smrg# This file is free software; the Free Software Foundation
23338846b520Smrg# gives unlimited permission to copy and/or distribute it,
23348846b520Smrg# with or without modifications, as long as this notice is preserved.
233548e69166Smrg
23368846b520Smrg
23378846b520Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23388846b520Smrg# written in clear, in which case automake, when reading aclocal.m4,
23398846b520Smrg# will think it sees a *use*, and therefore will trigger all it's
23408846b520Smrg# C support machinery.  Also note that it means that autoscan, seeing
23418846b520Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23428846b520Smrg
23438846b520Smrg
23448846b520Smrg# _AM_DEPENDENCIES(NAME)
23458846b520Smrg# ----------------------
23468846b520Smrg# See how the compiler implements dependency checking.
23478846b520Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23488846b520Smrg# We try a few techniques and use that to set a single cache variable.
2349a8bb11d0Smrg#
23508846b520Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23518846b520Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23528846b520Smrg# dependency, and given that the user is not expected to run this macro,
23538846b520Smrg# just rely on AC_PROG_CC.
23548846b520SmrgAC_DEFUN([_AM_DEPENDENCIES],
23558846b520Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23568846b520SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23578846b520SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23588846b520SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359a8bb11d0Smrg
23608846b520Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23618846b520Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23628846b520Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23638846b520Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23648846b520Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23658846b520Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23668846b520Smrg                    [depcc="$$1"   am_compiler_list=])
2367a8bb11d0Smrg
23688846b520SmrgAC_CACHE_CHECK([dependency style of $depcc],
23698846b520Smrg               [am_cv_$1_dependencies_compiler_type],
23708846b520Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23718846b520Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
23728846b520Smrg  # making bogus files that we don't know about and never remove.  For
23738846b520Smrg  # instance it was reported that on HP-UX the gcc test will end up
23748846b520Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23758846b520Smrg  # in D".
23768846b520Smrg  rm -rf conftest.dir
23778846b520Smrg  mkdir conftest.dir
23788846b520Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23798846b520Smrg  # using a relative directory.
23808846b520Smrg  cp "$am_depcomp" conftest.dir
23818846b520Smrg  cd conftest.dir
23828846b520Smrg  # We will build objects and dependencies in a subdirectory because
23838846b520Smrg  # it helps to detect inapplicable dependency modes.  For instance
23848846b520Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23858846b520Smrg  # side effect of compilation, but ICC will put the dependencies in
23868846b520Smrg  # the current directory while Tru64 will put them in the object
23878846b520Smrg  # directory.
23888846b520Smrg  mkdir sub
2389a8bb11d0Smrg
23908846b520Smrg  am_cv_$1_dependencies_compiler_type=none
23918846b520Smrg  if test "$am_compiler_list" = ""; then
23928846b520Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2393a8bb11d0Smrg  fi
23948846b520Smrg  am__universal=false
23958846b520Smrg  m4_case([$1], [CC],
23968846b520Smrg    [case " $depcc " in #(
23978846b520Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23988846b520Smrg     esac],
23998846b520Smrg    [CXX],
24008846b520Smrg    [case " $depcc " in #(
24018846b520Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24028846b520Smrg     esac])
24038846b520Smrg
24048846b520Smrg  for depmode in $am_compiler_list; do
24058846b520Smrg    # Setup a source with many dependencies, because some compilers
24068846b520Smrg    # like to wrap large dependency lists on column 80 (with \), and
24078846b520Smrg    # we should not choose a depcomp mode which is confused by this.
24088846b520Smrg    #
24098846b520Smrg    # We need to recreate these files for each test, as the compiler may
24108846b520Smrg    # overwrite some of them when testing with obscure command lines.
24118846b520Smrg    # This happens at least with the AIX C compiler.
24128846b520Smrg    : > sub/conftest.c
24138846b520Smrg    for i in 1 2 3 4 5 6; do
24148846b520Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24158846b520Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24168846b520Smrg      # Solaris 10 /bin/sh.
24178846b520Smrg      echo '/* dummy */' > sub/conftst$i.h
24188846b520Smrg    done
24198846b520Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24208846b520Smrg
24218846b520Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24228846b520Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24238846b520Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24248846b520Smrg    # versions had trouble with output in subdirs.
24258846b520Smrg    am__obj=sub/conftest.${OBJEXT-o}
24268846b520Smrg    am__minus_obj="-o $am__obj"
24278846b520Smrg    case $depmode in
24288846b520Smrg    gcc)
24298846b520Smrg      # This depmode causes a compiler race in universal mode.
24308846b520Smrg      test "$am__universal" = false || continue
24318846b520Smrg      ;;
24328846b520Smrg    nosideeffect)
24338846b520Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24348846b520Smrg      # only be used when explicitly requested.
24358846b520Smrg      if test "x$enable_dependency_tracking" = xyes; then
24368846b520Smrg	continue
24378846b520Smrg      else
24388846b520Smrg	break
24398846b520Smrg      fi
24408846b520Smrg      ;;
24418846b520Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24428846b520Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
24438846b520Smrg      # not run yet.  These depmodes are late enough in the game, and
24448846b520Smrg      # so weak that their functioning should not be impacted.
24458846b520Smrg      am__obj=conftest.${OBJEXT-o}
24468846b520Smrg      am__minus_obj=
24478846b520Smrg      ;;
24488846b520Smrg    none) break ;;
24498846b520Smrg    esac
24508846b520Smrg    if depmode=$depmode \
24518846b520Smrg       source=sub/conftest.c object=$am__obj \
24528846b520Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24538846b520Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24548846b520Smrg         >/dev/null 2>conftest.err &&
24558846b520Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24568846b520Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24578846b520Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24588846b520Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24598846b520Smrg      # icc doesn't choke on unknown options, it will just issue warnings
24608846b520Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
24618846b520Smrg      # that says an option was ignored or not supported.
24628846b520Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24638846b520Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24648846b520Smrg      # The diagnosis changed in icc 8.0:
24658846b520Smrg      #   icc: Command line remark: option '-MP' not supported
24668846b520Smrg      if (grep 'ignoring option' conftest.err ||
24678846b520Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24688846b520Smrg        am_cv_$1_dependencies_compiler_type=$depmode
24698846b520Smrg        break
24708846b520Smrg      fi
24718846b520Smrg    fi
24728846b520Smrg  done
24738846b520Smrg
24748846b520Smrg  cd ..
24758846b520Smrg  rm -rf conftest.dir
24768846b520Smrgelse
24778846b520Smrg  am_cv_$1_dependencies_compiler_type=none
2478a8bb11d0Smrgfi
24798846b520Smrg])
24808846b520SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24818846b520SmrgAM_CONDITIONAL([am__fastdep$1], [
24828846b520Smrg  test "x$enable_dependency_tracking" != xno \
24838846b520Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24848846b520Smrg])
2485a8bb11d0Smrg
24868846b520Smrg
24878846b520Smrg# AM_SET_DEPDIR
24888846b520Smrg# -------------
24898846b520Smrg# Choose a directory name for dependency files.
24908846b520Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24918846b520SmrgAC_DEFUN([AM_SET_DEPDIR],
24928846b520Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24938846b520SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24948846b520Smrg])
24958846b520Smrg
24968846b520Smrg
24978846b520Smrg# AM_DEP_TRACK
24988846b520Smrg# ------------
24998846b520SmrgAC_DEFUN([AM_DEP_TRACK],
25008846b520Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25018846b520SmrgAS_HELP_STRING(
25028846b520Smrg  [--enable-dependency-tracking],
25038846b520Smrg  [do not reject slow dependency extractors])
25048846b520SmrgAS_HELP_STRING(
25058846b520Smrg  [--disable-dependency-tracking],
25068846b520Smrg  [speeds up one-time build])])
25078846b520Smrgif test "x$enable_dependency_tracking" != xno; then
25088846b520Smrg  am_depcomp="$ac_aux_dir/depcomp"
25098846b520Smrg  AMDEPBACKSLASH='\'
25108846b520Smrg  am__nodep='_no'
2511a8bb11d0Smrgfi
25128846b520SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25138846b520SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25148846b520Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25158846b520SmrgAC_SUBST([am__nodep])dnl
25168846b520Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25178846b520Smrg])
25188846b520Smrg
25198846b520Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25208846b520Smrg
25218846b520Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
25228846b520Smrg#
25238846b520Smrg# This file is free software; the Free Software Foundation
25248846b520Smrg# gives unlimited permission to copy and/or distribute it,
25258846b520Smrg# with or without modifications, as long as this notice is preserved.
25268846b520Smrg
25278846b520Smrg
25288846b520Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25298846b520Smrg# ------------------------------
25308846b520SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25318846b520Smrg[{
25328846b520Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
25338846b520Smrg  # are listed without --file.  Let's play safe and only enable the eval
25348846b520Smrg  # if we detect the quoting.
25358846b520Smrg  case $CONFIG_FILES in
25368846b520Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
25378846b520Smrg  *)   set x $CONFIG_FILES ;;
25388846b520Smrg  esac
25398846b520Smrg  shift
25408846b520Smrg  for mf
25418846b520Smrg  do
25428846b520Smrg    # Strip MF so we end up with the name of the file.
25438846b520Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25448846b520Smrg    # Check whether this is an Automake generated Makefile or not.
25458846b520Smrg    # We used to match only the files named 'Makefile.in', but
25468846b520Smrg    # some people rename them; so instead we look at the file content.
25478846b520Smrg    # Grep'ing the first line is not enough: some people post-process
25488846b520Smrg    # each Makefile.in and add a new line on top of each file to say so.
25498846b520Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
25508846b520Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
25518846b520Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25528846b520Smrg      dirpart=`AS_DIRNAME("$mf")`
25538846b520Smrg    else
25548846b520Smrg      continue
25558846b520Smrg    fi
25568846b520Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
25578846b520Smrg    # from the Makefile without running 'make'.
25588846b520Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25598846b520Smrg    test -z "$DEPDIR" && continue
25608846b520Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25618846b520Smrg    test -z "$am__include" && continue
25628846b520Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25638846b520Smrg    # Find all dependency output files, they are included files with
25648846b520Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25658846b520Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25668846b520Smrg    # expansion.
25678846b520Smrg    for file in `sed -n "
25688846b520Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25698846b520Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25708846b520Smrg      # Make sure the directory exists.
25718846b520Smrg      test -f "$dirpart/$file" && continue
25728846b520Smrg      fdir=`AS_DIRNAME(["$file"])`
25738846b520Smrg      AS_MKDIR_P([$dirpart/$fdir])
25748846b520Smrg      # echo "creating $dirpart/$file"
25758846b520Smrg      echo '# dummy' > "$dirpart/$file"
25768846b520Smrg    done
25778846b520Smrg  done
25788846b520Smrg}
25798846b520Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25808846b520Smrg
25818846b520Smrg
25828846b520Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25838846b520Smrg# -----------------------------
25848846b520Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
25858846b520Smrg#
25868846b520Smrg# This code is only required when automatic dependency tracking
25878846b520Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
25888846b520Smrg# need in order to bootstrap the dependency handling code.
25898846b520SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25908846b520Smrg[AC_CONFIG_COMMANDS([depfiles],
25918846b520Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25928846b520Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25938846b520Smrg])
25948846b520Smrg
25958846b520Smrg# Do all the work for Automake.                             -*- Autoconf -*-
25968846b520Smrg
25978846b520Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25988846b520Smrg#
25998846b520Smrg# This file is free software; the Free Software Foundation
26008846b520Smrg# gives unlimited permission to copy and/or distribute it,
26018846b520Smrg# with or without modifications, as long as this notice is preserved.
26028846b520Smrg
26038846b520Smrg# This macro actually does too much.  Some checks are only needed if
26048846b520Smrg# your package does certain things.  But this isn't really a big deal.
2605a8bb11d0Smrg
26068846b520Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26078846b520Smrgm4_define([AC_PROG_CC],
26088846b520Smrgm4_defn([AC_PROG_CC])
26098846b520Smrg[_AM_PROG_CC_C_O
26108846b520Smrg])
2611a8bb11d0Smrg
26128846b520Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26138846b520Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26148846b520Smrg# -----------------------------------------------
26158846b520Smrg# The call with PACKAGE and VERSION arguments is the old style
26168846b520Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26178846b520Smrg# and VERSION should now be passed to AC_INIT and removed from
26188846b520Smrg# the call to AM_INIT_AUTOMAKE.
26198846b520Smrg# We support both call styles for the transition.  After
26208846b520Smrg# the next Automake release, Autoconf can make the AC_INIT
26218846b520Smrg# arguments mandatory, and then we can depend on a new Autoconf
26228846b520Smrg# release and drop the old call support.
26238846b520SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26248846b520Smrg[AC_PREREQ([2.65])dnl
26258846b520Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26268846b520Smrgdnl the ones we care about.
26278846b520Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26288846b520SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26298846b520SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26308846b520Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26318846b520Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26328846b520Smrg  # is not polluted with repeated "-I."
26338846b520Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26348846b520Smrg  # test to see if srcdir already configured
26358846b520Smrg  if test -f $srcdir/config.status; then
26368846b520Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637a8bb11d0Smrg  fi
2638a8bb11d0Smrgfi
2639a8bb11d0Smrg
26408846b520Smrg# test whether we have cygpath
26418846b520Smrgif test -z "$CYGPATH_W"; then
26428846b520Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26438846b520Smrg    CYGPATH_W='cygpath -w'
26448846b520Smrg  else
26458846b520Smrg    CYGPATH_W=echo
2646a8bb11d0Smrg  fi
2647a8bb11d0Smrgfi
26488846b520SmrgAC_SUBST([CYGPATH_W])
2649a8bb11d0Smrg
26508846b520Smrg# Define the identity of the package.
26518846b520Smrgdnl Distinguish between old-style and new-style calls.
26528846b520Smrgm4_ifval([$2],
26538846b520Smrg[AC_DIAGNOSE([obsolete],
26548846b520Smrg             [$0: two- and three-arguments forms are deprecated.])
26558846b520Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26568846b520Smrg AC_SUBST([PACKAGE], [$1])dnl
26578846b520Smrg AC_SUBST([VERSION], [$2])],
26588846b520Smrg[_AM_SET_OPTIONS([$1])dnl
26598846b520Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26608846b520Smrgm4_if(
26618846b520Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26628846b520Smrg  [ok:ok],,
26638846b520Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26648846b520Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26658846b520Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666a8bb11d0Smrg
26678846b520Smrg_AM_IF_OPTION([no-define],,
26688846b520Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26698846b520Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670a8bb11d0Smrg
26718846b520Smrg# Some tools Automake needs.
26728846b520SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26738846b520SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26748846b520SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26758846b520SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26768846b520SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26778846b520SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26788846b520SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26798846b520SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26808846b520SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26818846b520SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26828846b520Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
26838846b520Smrg# dies out for good.  For more background, see:
26848846b520Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26858846b520Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26868846b520SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26878846b520Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
26888846b520Smrg# system "awk" is bad on some platforms.
26898846b520SmrgAC_REQUIRE([AC_PROG_AWK])dnl
26908846b520SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26918846b520SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26928846b520Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26938846b520Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26948846b520Smrg			     [_AM_PROG_TAR([v7])])])
26958846b520Smrg_AM_IF_OPTION([no-dependencies],,
26968846b520Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26978846b520Smrg		  [_AM_DEPENDENCIES([CC])],
26988846b520Smrg		  [m4_define([AC_PROG_CC],
26998846b520Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27008846b520SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27018846b520Smrg		  [_AM_DEPENDENCIES([CXX])],
27028846b520Smrg		  [m4_define([AC_PROG_CXX],
27038846b520Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27048846b520SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27058846b520Smrg		  [_AM_DEPENDENCIES([OBJC])],
27068846b520Smrg		  [m4_define([AC_PROG_OBJC],
27078846b520Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27088846b520SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27098846b520Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27108846b520Smrg		  [m4_define([AC_PROG_OBJCXX],
27118846b520Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27128846b520Smrg])
27138846b520SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27148846b520Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27158846b520Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27168846b520Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27178846b520SmrgAC_CONFIG_COMMANDS_PRE(dnl
27188846b520Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27198846b520Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720a8bb11d0Smrg
27218846b520Smrg# POSIX will say in a future version that running "rm -f" with no argument
27228846b520Smrg# is OK; and we want to be able to make that assumption in our Makefile
27238846b520Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27248846b520Smrg# actually supported "in the wild" to an acceptable degree.
27258846b520Smrg# See automake bug#10828.
27268846b520Smrg# To make any issue more visible, cause the running configure to be aborted
27278846b520Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27288846b520Smrg# user can still override this though.
27298846b520Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27308846b520Smrg  cat >&2 <<'END'
27318846b520SmrgOops!
2732a8bb11d0Smrg
27338846b520SmrgYour 'rm' program seems unable to run without file operands specified
27348846b520Smrgon the command line, even when the '-f' option is present.  This is contrary
27358846b520Smrgto the behaviour of most rm programs out there, and not conforming with
27368846b520Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737a8bb11d0Smrg
27388846b520SmrgPlease tell bug-automake@gnu.org about your system, including the value
27398846b520Smrgof your $PATH and any error possibly output before this message.  This
27408846b520Smrgcan help us improve future automake versions.
2741a8bb11d0Smrg
27428846b520SmrgEND
27438846b520Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27448846b520Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27458846b520Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27468846b520Smrg    echo >&2
27478846b520Smrg  else
27488846b520Smrg    cat >&2 <<'END'
27498846b520SmrgAborting the configuration process, to ensure you take notice of the issue.
2750fd0c672fSmrg
27518846b520SmrgYou can download and install GNU coreutils to get an 'rm' implementation
27528846b520Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753fd0c672fSmrg
27548846b520SmrgIf you want to complete the configuration process using your problematic
27558846b520Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27568846b520Smrgto "yes", and re-run configure.
27578846b520Smrg
27588846b520SmrgEND
27598846b520Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27608846b520Smrg  fi
2761fd0c672fSmrgfi
27628846b520Smrgdnl The trailing newline in this macro's definition is deliberate, for
27638846b520Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27648846b520Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27658846b520Smrg])
2766fd0c672fSmrg
27678846b520Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27688846b520Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27698846b520Smrgdnl mangled by Autoconf and run in a shell conditional statement.
27708846b520Smrgm4_define([_AC_COMPILER_EXEEXT],
27718846b520Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2772fd0c672fSmrg
27738846b520Smrg# When config.status generates a header, we must update the stamp-h file.
27748846b520Smrg# This file resides in the same directory as the config header
27758846b520Smrg# that is generated.  The stamp files are numbered to have different names.
2776fd0c672fSmrg
27778846b520Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27788846b520Smrg# loop where config.status creates the headers, so we can generate
27798846b520Smrg# our stamp files there.
27808846b520SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27818846b520Smrg[# Compute $1's index in $config_headers.
27828846b520Smrg_am_arg=$1
27838846b520Smrg_am_stamp_count=1
27848846b520Smrgfor _am_header in $config_headers :; do
27858846b520Smrg  case $_am_header in
27868846b520Smrg    $_am_arg | $_am_arg:* )
27878846b520Smrg      break ;;
27888846b520Smrg    * )
27898846b520Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27908846b520Smrg  esac
27918846b520Smrgdone
27928846b520Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
279348e69166Smrg
27948846b520Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27958846b520Smrg#
27968846b520Smrg# This file is free software; the Free Software Foundation
27978846b520Smrg# gives unlimited permission to copy and/or distribute it,
27988846b520Smrg# with or without modifications, as long as this notice is preserved.
279948e69166Smrg
28008846b520Smrg# AM_PROG_INSTALL_SH
28018846b520Smrg# ------------------
28028846b520Smrg# Define $install_sh.
28038846b520SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28048846b520Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28058846b520Smrgif test x"${install_sh+set}" != xset; then
28068846b520Smrg  case $am_aux_dir in
28078846b520Smrg  *\ * | *\	*)
28088846b520Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28098846b520Smrg  *)
28108846b520Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28118846b520Smrg  esac
2812fd0c672fSmrgfi
28138846b520SmrgAC_SUBST([install_sh])])
281448e69166Smrg
28158846b520Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28168846b520Smrg#
28178846b520Smrg# This file is free software; the Free Software Foundation
28188846b520Smrg# gives unlimited permission to copy and/or distribute it,
28198846b520Smrg# with or without modifications, as long as this notice is preserved.
2820fd0c672fSmrg
28218846b520Smrg# Check whether the underlying file-system supports filenames
28228846b520Smrg# with a leading dot.  For instance MS-DOS doesn't.
28238846b520SmrgAC_DEFUN([AM_SET_LEADING_DOT],
28248846b520Smrg[rm -rf .tst 2>/dev/null
28258846b520Smrgmkdir .tst 2>/dev/null
28268846b520Smrgif test -d .tst; then
28278846b520Smrg  am__leading_dot=.
28288846b520Smrgelse
28298846b520Smrg  am__leading_dot=_
28308846b520Smrgfi
28318846b520Smrgrmdir .tst 2>/dev/null
28328846b520SmrgAC_SUBST([am__leading_dot])])
2833fd0c672fSmrg
28348846b520Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835fd0c672fSmrg
28368846b520Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
283748e69166Smrg#
28388846b520Smrg# This file is free software; the Free Software Foundation
28398846b520Smrg# gives unlimited permission to copy and/or distribute it,
28408846b520Smrg# with or without modifications, as long as this notice is preserved.
284148e69166Smrg
28428846b520Smrg# AM_MAKE_INCLUDE()
28438846b520Smrg# -----------------
28448846b520Smrg# Check to see how make treats includes.
28458846b520SmrgAC_DEFUN([AM_MAKE_INCLUDE],
28468846b520Smrg[am_make=${MAKE-make}
28478846b520Smrgcat > confinc << 'END'
28488846b520Smrgam__doit:
28498846b520Smrg	@echo this is the am__doit target
28508846b520Smrg.PHONY: am__doit
28518846b520SmrgEND
28528846b520Smrg# If we don't find an include directive, just comment out the code.
28538846b520SmrgAC_MSG_CHECKING([for style of include used by $am_make])
28548846b520Smrgam__include="#"
28558846b520Smrgam__quote=
28568846b520Smrg_am_result=none
28578846b520Smrg# First try GNU make style include.
28588846b520Smrgecho "include confinc" > confmf
28598846b520Smrg# Ignore all kinds of additional output from 'make'.
28608846b520Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28618846b520Smrg*the\ am__doit\ target*)
28628846b520Smrg  am__include=include
28638846b520Smrg  am__quote=
28648846b520Smrg  _am_result=GNU
28658846b520Smrg  ;;
28668846b520Smrgesac
28678846b520Smrg# Now try BSD make style include.
28688846b520Smrgif test "$am__include" = "#"; then
28698846b520Smrg   echo '.include "confinc"' > confmf
28708846b520Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28718846b520Smrg   *the\ am__doit\ target*)
28728846b520Smrg     am__include=.include
28738846b520Smrg     am__quote="\""
28748846b520Smrg     _am_result=BSD
28758846b520Smrg     ;;
28768846b520Smrg   esac
2877fd0c672fSmrgfi
28788846b520SmrgAC_SUBST([am__include])
28798846b520SmrgAC_SUBST([am__quote])
28808846b520SmrgAC_MSG_RESULT([$_am_result])
28818846b520Smrgrm -f confinc confmf
28828846b520Smrg])
288348e69166Smrg
28848846b520Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885a8bb11d0Smrg
28868846b520Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887a8bb11d0Smrg#
28888846b520Smrg# This file is free software; the Free Software Foundation
28898846b520Smrg# gives unlimited permission to copy and/or distribute it,
28908846b520Smrg# with or without modifications, as long as this notice is preserved.
2891a8bb11d0Smrg
28928846b520Smrg# AM_MISSING_PROG(NAME, PROGRAM)
28938846b520Smrg# ------------------------------
28948846b520SmrgAC_DEFUN([AM_MISSING_PROG],
28958846b520Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28968846b520Smrg$1=${$1-"${am_missing_run}$2"}
28978846b520SmrgAC_SUBST($1)])
2898a8bb11d0Smrg
28998846b520Smrg# AM_MISSING_HAS_RUN
29008846b520Smrg# ------------------
29018846b520Smrg# Define MISSING if not defined so far and test if it is modern enough.
29028846b520Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29038846b520SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29048846b520Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29058846b520SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29068846b520Smrgif test x"${MISSING+set}" != xset; then
29078846b520Smrg  case $am_aux_dir in
29088846b520Smrg  *\ * | *\	*)
29098846b520Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29108846b520Smrg  *)
29118846b520Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29128846b520Smrg  esac
2913a8bb11d0Smrgfi
29148846b520Smrg# Use eval to expand $SHELL
29158846b520Smrgif eval "$MISSING --is-lightweight"; then
29168846b520Smrg  am_missing_run="$MISSING "
29178846b520Smrgelse
29188846b520Smrg  am_missing_run=
29198846b520Smrg  AC_MSG_WARN(['missing' script is too old or missing])
2920a8bb11d0Smrgfi
29218846b520Smrg])
2922a8bb11d0Smrg
29238846b520Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2924a8bb11d0Smrg
29258846b520Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29268846b520Smrg#
29278846b520Smrg# This file is free software; the Free Software Foundation
29288846b520Smrg# gives unlimited permission to copy and/or distribute it,
29298846b520Smrg# with or without modifications, as long as this notice is preserved.
2930a8bb11d0Smrg
29318846b520Smrg# _AM_MANGLE_OPTION(NAME)
29328846b520Smrg# -----------------------
29338846b520SmrgAC_DEFUN([_AM_MANGLE_OPTION],
29348846b520Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935a8bb11d0Smrg
29368846b520Smrg# _AM_SET_OPTION(NAME)
29378846b520Smrg# --------------------
29388846b520Smrg# Set option NAME.  Presently that only means defining a flag for this option.
29398846b520SmrgAC_DEFUN([_AM_SET_OPTION],
29408846b520Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941a8bb11d0Smrg
29428846b520Smrg# _AM_SET_OPTIONS(OPTIONS)
29438846b520Smrg# ------------------------
29448846b520Smrg# OPTIONS is a space-separated list of Automake options.
29458846b520SmrgAC_DEFUN([_AM_SET_OPTIONS],
29468846b520Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947a8bb11d0Smrg
29488846b520Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29498846b520Smrg# -------------------------------------------
29508846b520Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29518846b520SmrgAC_DEFUN([_AM_IF_OPTION],
29528846b520Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953a8bb11d0Smrg
29548846b520Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955a8bb11d0Smrg#
29568846b520Smrg# This file is free software; the Free Software Foundation
29578846b520Smrg# gives unlimited permission to copy and/or distribute it,
29588846b520Smrg# with or without modifications, as long as this notice is preserved.
2959a8bb11d0Smrg
29608846b520Smrg# _AM_PROG_CC_C_O
29618846b520Smrg# ---------------
29628846b520Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29638846b520Smrg# to automatically call this.
29648846b520SmrgAC_DEFUN([_AM_PROG_CC_C_O],
29658846b520Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29668846b520SmrgAC_REQUIRE_AUX_FILE([compile])dnl
29678846b520SmrgAC_LANG_PUSH([C])dnl
29688846b520SmrgAC_CACHE_CHECK(
29698846b520Smrg  [whether $CC understands -c and -o together],
29708846b520Smrg  [am_cv_prog_cc_c_o],
29718846b520Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29728846b520Smrg  # Make sure it works both with $CC and with simple cc.
29738846b520Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29748846b520Smrg  # compilers refuse to overwrite an existing .o file with -o,
29758846b520Smrg  # though they will create one.
29768846b520Smrg  am_cv_prog_cc_c_o=yes
29778846b520Smrg  for am_i in 1 2; do
29788846b520Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29798846b520Smrg         && test -f conftest2.$ac_objext; then
29808846b520Smrg      : OK
29818846b520Smrg    else
29828846b520Smrg      am_cv_prog_cc_c_o=no
29838846b520Smrg      break
29848846b520Smrg    fi
29858846b520Smrg  done
29868846b520Smrg  rm -f core conftest*
29878846b520Smrg  unset am_i])
29888846b520Smrgif test "$am_cv_prog_cc_c_o" != yes; then
29898846b520Smrg   # Losing compiler, so override with the script.
29908846b520Smrg   # FIXME: It is wrong to rewrite CC.
29918846b520Smrg   # But if we don't then we get into trouble of one sort or another.
29928846b520Smrg   # A longer-term fix would be to have automake use am__CC in this case,
29938846b520Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29948846b520Smrg   CC="$am_aux_dir/compile $CC"
2995a8bb11d0Smrgfi
29968846b520SmrgAC_LANG_POP([C])])
2997a8bb11d0Smrg
29988846b520Smrg# For backward compatibility.
29998846b520SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30008846b520Smrg
30018846b520Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30028846b520Smrg#
30038846b520Smrg# This file is free software; the Free Software Foundation
30048846b520Smrg# gives unlimited permission to copy and/or distribute it,
30058846b520Smrg# with or without modifications, as long as this notice is preserved.
30068846b520Smrg
30078846b520Smrg# AM_RUN_LOG(COMMAND)
30088846b520Smrg# -------------------
30098846b520Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30108846b520Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30118846b520SmrgAC_DEFUN([AM_RUN_LOG],
30128846b520Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30138846b520Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30148846b520Smrg   ac_status=$?
30158846b520Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30168846b520Smrg   (exit $ac_status); }])
3017a8bb11d0Smrg
30188846b520Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019a8bb11d0Smrg
30208846b520Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30218846b520Smrg#
30228846b520Smrg# This file is free software; the Free Software Foundation
30238846b520Smrg# gives unlimited permission to copy and/or distribute it,
30248846b520Smrg# with or without modifications, as long as this notice is preserved.
3025a8bb11d0Smrg
30268846b520Smrg# AM_SANITY_CHECK
30278846b520Smrg# ---------------
30288846b520SmrgAC_DEFUN([AM_SANITY_CHECK],
30298846b520Smrg[AC_MSG_CHECKING([whether build environment is sane])
30308846b520Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30318846b520Smrg# name.  Accept space and tab only in the latter.
30328846b520Smrgam_lf='
30338846b520Smrg'
30348846b520Smrgcase `pwd` in
30358846b520Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30368846b520Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30378846b520Smrgesac
30388846b520Smrgcase $srcdir in
30398846b520Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30408846b520Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30418846b520Smrgesac
3042a8bb11d0Smrg
30438846b520Smrg# Do 'set' in a subshell so we don't clobber the current shell's
30448846b520Smrg# arguments.  Must try -L first in case configure is actually a
30458846b520Smrg# symlink; some systems play weird games with the mod time of symlinks
30468846b520Smrg# (eg FreeBSD returns the mod time of the symlink's containing
30478846b520Smrg# directory).
30488846b520Smrgif (
30498846b520Smrg   am_has_slept=no
30508846b520Smrg   for am_try in 1 2; do
30518846b520Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30528846b520Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30538846b520Smrg     if test "$[*]" = "X"; then
30548846b520Smrg	# -L didn't work.
30558846b520Smrg	set X `ls -t "$srcdir/configure" conftest.file`
30568846b520Smrg     fi
30578846b520Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30588846b520Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059a8bb11d0Smrg
30608846b520Smrg	# If neither matched, then we have a broken ls.  This can happen
30618846b520Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30628846b520Smrg	# broken ls alias from the environment.  This has actually
30638846b520Smrg	# happened.  Such a system could not be considered "sane".
30648846b520Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30658846b520Smrg  alias in your environment])
30668846b520Smrg     fi
30678846b520Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30688846b520Smrg       break
30698846b520Smrg     fi
30708846b520Smrg     # Just in case.
30718846b520Smrg     sleep 1
30728846b520Smrg     am_has_slept=yes
30738846b520Smrg   done
30748846b520Smrg   test "$[2]" = conftest.file
30758846b520Smrg   )
30768846b520Smrgthen
30778846b520Smrg   # Ok.
30788846b520Smrg   :
3079a8bb11d0Smrgelse
30808846b520Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
30818846b520SmrgCheck your system clock])
3082a8bb11d0Smrgfi
30838846b520SmrgAC_MSG_RESULT([yes])
30848846b520Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30858846b520Smrg# generated files are strictly newer.
30868846b520Smrgam_sleep_pid=
30878846b520Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30888846b520Smrg  ( sleep 1 ) &
30898846b520Smrg  am_sleep_pid=$!
30908846b520Smrgfi
30918846b520SmrgAC_CONFIG_COMMANDS_PRE(
30928846b520Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30938846b520Smrg   if test -n "$am_sleep_pid"; then
30948846b520Smrg     # Hide warnings about reused PIDs.
30958846b520Smrg     wait $am_sleep_pid 2>/dev/null
30968846b520Smrg   fi
30978846b520Smrg   AC_MSG_RESULT([done])])
30988846b520Smrgrm -f conftest.file
30998846b520Smrg])
3100a8bb11d0Smrg
31018846b520Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
310248e69166Smrg#
31038846b520Smrg# This file is free software; the Free Software Foundation
31048846b520Smrg# gives unlimited permission to copy and/or distribute it,
31058846b520Smrg# with or without modifications, as long as this notice is preserved.
310648e69166Smrg
31078846b520Smrg# AM_SILENT_RULES([DEFAULT])
31088846b520Smrg# --------------------------
31098846b520Smrg# Enable less verbose build rules; with the default set to DEFAULT
31108846b520Smrg# ("yes" being less verbose, "no" or empty being verbose).
31118846b520SmrgAC_DEFUN([AM_SILENT_RULES],
31128846b520Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31138846b520SmrgAS_HELP_STRING(
31148846b520Smrg  [--enable-silent-rules],
31158846b520Smrg  [less verbose build output (undo: "make V=1")])
31168846b520SmrgAS_HELP_STRING(
31178846b520Smrg  [--disable-silent-rules],
31188846b520Smrg  [verbose build output (undo: "make V=0")])dnl
31198846b520Smrg])
31208846b520Smrgcase $enable_silent_rules in @%:@ (((
31218846b520Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31228846b520Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31238846b520Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31248846b520Smrgesac
31258846b520Smrgdnl
31268846b520Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31278846b520Smrgdnl do not support nested variable expansions.
31288846b520Smrgdnl See automake bug#9928 and bug#10237.
31298846b520Smrgam_make=${MAKE-make}
31308846b520SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31318846b520Smrg   [am_cv_make_support_nested_variables],
31328846b520Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31338846b520SmrgBAR0=false
31348846b520SmrgBAR1=true
31358846b520SmrgV=1
31368846b520Smrgam__doit:
31378846b520Smrg	@$(TRUE)
31388846b520Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31398846b520Smrg  am_cv_make_support_nested_variables=yes
31408846b520Smrgelse
31418846b520Smrg  am_cv_make_support_nested_variables=no
31428846b520Smrgfi])
31438846b520Smrgif test $am_cv_make_support_nested_variables = yes; then
31448846b520Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31458846b520Smrg  AM_V='$(V)'
31468846b520Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31478846b520Smrgelse
31488846b520Smrg  AM_V=$AM_DEFAULT_VERBOSITY
31498846b520Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31508846b520Smrgfi
31518846b520SmrgAC_SUBST([AM_V])dnl
31528846b520SmrgAM_SUBST_NOTMAKE([AM_V])dnl
31538846b520SmrgAC_SUBST([AM_DEFAULT_V])dnl
31548846b520SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31558846b520SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31568846b520SmrgAM_BACKSLASH='\'
31578846b520SmrgAC_SUBST([AM_BACKSLASH])dnl
31588846b520Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31598846b520Smrg])
31608846b520Smrg
31618846b520Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162a8bb11d0Smrg#
31638846b520Smrg# This file is free software; the Free Software Foundation
31648846b520Smrg# gives unlimited permission to copy and/or distribute it,
31658846b520Smrg# with or without modifications, as long as this notice is preserved.
31668846b520Smrg
31678846b520Smrg# AM_PROG_INSTALL_STRIP
31688846b520Smrg# ---------------------
31698846b520Smrg# One issue with vendor 'install' (even GNU) is that you can't
31708846b520Smrg# specify the program used to strip binaries.  This is especially
31718846b520Smrg# annoying in cross-compiling environments, where the build's strip
31728846b520Smrg# is unlikely to handle the host's binaries.
31738846b520Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31748846b520Smrg# always use install-sh in "make install-strip", and initialize
31758846b520Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
31768846b520SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31778846b520Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31788846b520Smrg# Installed binaries are usually stripped using 'strip' when the user
31798846b520Smrg# run "make install-strip".  However 'strip' might not be the right
31808846b520Smrg# tool to use in cross-compilation environments, therefore Automake
31818846b520Smrg# will honor the 'STRIP' environment variable to overrule this program.
31828846b520Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31838846b520Smrgif test "$cross_compiling" != no; then
31848846b520Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
31858846b520Smrgfi
31868846b520SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31878846b520SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
318848e69166Smrg
31898846b520Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31908846b520Smrg#
31918846b520Smrg# This file is free software; the Free Software Foundation
31928846b520Smrg# gives unlimited permission to copy and/or distribute it,
31938846b520Smrg# with or without modifications, as long as this notice is preserved.
3194a8bb11d0Smrg
31958846b520Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
31968846b520Smrg# ---------------------------
31978846b520Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31988846b520Smrg# This macro is traced by Automake.
31998846b520SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200a8bb11d0Smrg
32018846b520Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32028846b520Smrg# --------------------------
32038846b520Smrg# Public sister of _AM_SUBST_NOTMAKE.
32048846b520SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205a8bb11d0Smrg
32068846b520Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3207a8bb11d0Smrg
32088846b520Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32098846b520Smrg#
32108846b520Smrg# This file is free software; the Free Software Foundation
32118846b520Smrg# gives unlimited permission to copy and/or distribute it,
32128846b520Smrg# with or without modifications, as long as this notice is preserved.
321348e69166Smrg
32148846b520Smrg# _AM_PROG_TAR(FORMAT)
321548e69166Smrg# --------------------
32168846b520Smrg# Check how to create a tarball in format FORMAT.
32178846b520Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
321848e69166Smrg#
32198846b520Smrg# Substitute a variable $(am__tar) that is a command
32208846b520Smrg# writing to stdout a FORMAT-tarball containing the directory
32218846b520Smrg# $tardir.
32228846b520Smrg#     tardir=directory && $(am__tar) > result.tar
322348e69166Smrg#
32248846b520Smrg# Substitute a variable $(am__untar) that extract such
32258846b520Smrg# a tarball read from stdin.
32268846b520Smrg#     $(am__untar) < result.tar
322748e69166Smrg#
32288846b520SmrgAC_DEFUN([_AM_PROG_TAR],
32298846b520Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32308846b520Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32318846b520SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232fd0c672fSmrg
32338846b520Smrg# We'll loop over all known methods to create a tar archive until one works.
32348846b520Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235fd0c672fSmrg
32368846b520Smrgm4_if([$1], [v7],
32378846b520Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32388846b520Smrg
32398846b520Smrg  [m4_case([$1],
32408846b520Smrg    [ustar],
32418846b520Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32428846b520Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32438846b520Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32448846b520Smrg      # and bug#13588).
32458846b520Smrg      am_max_uid=2097151 # 2^21 - 1
32468846b520Smrg      am_max_gid=$am_max_uid
32478846b520Smrg      # The $UID and $GID variables are not portable, so we need to resort
32488846b520Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32498846b520Smrg      # below are definitely unexpected, so allow the users to see them
32508846b520Smrg      # (that is, avoid stderr redirection).
32518846b520Smrg      am_uid=`id -u || echo unknown`
32528846b520Smrg      am_gid=`id -g || echo unknown`
32538846b520Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32548846b520Smrg      if test $am_uid -le $am_max_uid; then
32558846b520Smrg         AC_MSG_RESULT([yes])
32568846b520Smrg      else
32578846b520Smrg         AC_MSG_RESULT([no])
32588846b520Smrg         _am_tools=none
32598846b520Smrg      fi
32608846b520Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32618846b520Smrg      if test $am_gid -le $am_max_gid; then
32628846b520Smrg         AC_MSG_RESULT([yes])
32638846b520Smrg      else
32648846b520Smrg        AC_MSG_RESULT([no])
32658846b520Smrg        _am_tools=none
32668846b520Smrg      fi],
32678846b520Smrg
32688846b520Smrg  [pax],
32698846b520Smrg    [],
32708846b520Smrg
32718846b520Smrg  [m4_fatal([Unknown tar format])])
32728846b520Smrg
32738846b520Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
32748846b520Smrg
32758846b520Smrg  # Go ahead even if we have the value already cached.  We do so because we
32768846b520Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32778846b520Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32788846b520Smrg
32798846b520Smrg  for _am_tool in $_am_tools; do
32808846b520Smrg    case $_am_tool in
32818846b520Smrg    gnutar)
32828846b520Smrg      for _am_tar in tar gnutar gtar; do
32838846b520Smrg        AM_RUN_LOG([$_am_tar --version]) && break
32848846b520Smrg      done
32858846b520Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32868846b520Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32878846b520Smrg      am__untar="$_am_tar -xf -"
32888846b520Smrg      ;;
32898846b520Smrg    plaintar)
32908846b520Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32918846b520Smrg      # ustar tarball either.
32928846b520Smrg      (tar --version) >/dev/null 2>&1 && continue
32938846b520Smrg      am__tar='tar chf - "$$tardir"'
32948846b520Smrg      am__tar_='tar chf - "$tardir"'
32958846b520Smrg      am__untar='tar xf -'
32968846b520Smrg      ;;
32978846b520Smrg    pax)
32988846b520Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
32998846b520Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33008846b520Smrg      am__untar='pax -r'
33018846b520Smrg      ;;
33028846b520Smrg    cpio)
33038846b520Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33048846b520Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33058846b520Smrg      am__untar='cpio -i -H $1 -d'
33068846b520Smrg      ;;
33078846b520Smrg    none)
33088846b520Smrg      am__tar=false
33098846b520Smrg      am__tar_=false
33108846b520Smrg      am__untar=false
33118846b520Smrg      ;;
33128846b520Smrg    esac
33138846b520Smrg
33148846b520Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33158846b520Smrg    # and am__untar set.
33168846b520Smrg    test -n "${am_cv_prog_tar_$1}" && break
33178846b520Smrg
33188846b520Smrg    # tar/untar a dummy directory, and stop if the command works.
33198846b520Smrg    rm -rf conftest.dir
33208846b520Smrg    mkdir conftest.dir
33218846b520Smrg    echo GrepMe > conftest.dir/file
33228846b520Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33238846b520Smrg    rm -rf conftest.dir
33248846b520Smrg    if test -s conftest.tar; then
33258846b520Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33268846b520Smrg      AM_RUN_LOG([cat conftest.dir/file])
33278846b520Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33288846b520Smrg    fi
33298846b520Smrg  done
33308846b520Smrg  rm -rf conftest.dir
333148e69166Smrg
33328846b520Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33338846b520Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33348846b520Smrg
33358846b520SmrgAC_SUBST([am__tar])
33368846b520SmrgAC_SUBST([am__untar])
33378846b520Smrg]) # _AM_PROG_TAR
33388846b520Smrg
33398846b520Smrgm4_include([m4/ax_define_dir.m4])
3340