16abeab63Snia# generated automatically by aclocal 1.15 -*- Autoconf -*-
26abeab63Snia
36abeab63Snia# Copyright (C) 1996-2014 Free Software Foundation, Inc.
46abeab63Snia
56abeab63Snia# This file is free software; the Free Software Foundation
66abeab63Snia# gives unlimited permission to copy and/or distribute it,
76abeab63Snia# with or without modifications, as long as this notice is preserved.
86abeab63Snia
96abeab63Snia# This program is distributed in the hope that it will be useful,
106abeab63Snia# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
116abeab63Snia# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
126abeab63Snia# PARTICULAR PURPOSE.
136abeab63Snia
146abeab63Sniam4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
156abeab63Sniam4_ifndef([AC_AUTOCONF_VERSION],
166abeab63Snia  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176abeab63Sniam4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
186abeab63Snia[m4_warning([this file was generated for autoconf 2.69.
196abeab63SniaYou have another version of autoconf.  It may work, but is not guaranteed to.
206abeab63SniaIf you have problems, you may need to regenerate the build system entirely.
216abeab63SniaTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
226abeab63Snia
236abeab63Sniadnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
246abeab63Sniadnl serial 11 (pkg-config-0.29)
256abeab63Sniadnl
266abeab63Sniadnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
276abeab63Sniadnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
286abeab63Sniadnl
296abeab63Sniadnl This program is free software; you can redistribute it and/or modify
306abeab63Sniadnl it under the terms of the GNU General Public License as published by
316abeab63Sniadnl the Free Software Foundation; either version 2 of the License, or
326abeab63Sniadnl (at your option) any later version.
336abeab63Sniadnl
346abeab63Sniadnl This program is distributed in the hope that it will be useful, but
356abeab63Sniadnl WITHOUT ANY WARRANTY; without even the implied warranty of
366abeab63Sniadnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376abeab63Sniadnl General Public License for more details.
386abeab63Sniadnl
396abeab63Sniadnl You should have received a copy of the GNU General Public License
406abeab63Sniadnl along with this program; if not, write to the Free Software
416abeab63Sniadnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
426abeab63Sniadnl 02111-1307, USA.
436abeab63Sniadnl
446abeab63Sniadnl As a special exception to the GNU General Public License, if you
456abeab63Sniadnl distribute this file as part of a program that contains a
466abeab63Sniadnl configuration script generated by Autoconf, you may include it under
476abeab63Sniadnl the same distribution terms that you use for the rest of that
486abeab63Sniadnl program.
496abeab63Snia
506abeab63Sniadnl PKG_PREREQ(MIN-VERSION)
516abeab63Sniadnl -----------------------
526abeab63Sniadnl Since: 0.29
536abeab63Sniadnl
546abeab63Sniadnl Verify that the version of the pkg-config macros are at least
556abeab63Sniadnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
566abeab63Sniadnl installed version of pkg-config, this checks the developer's version
576abeab63Sniadnl of pkg.m4 when generating configure.
586abeab63Sniadnl
596abeab63Sniadnl To ensure that this macro is defined, also add:
606abeab63Sniadnl m4_ifndef([PKG_PREREQ],
616abeab63Sniadnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
626abeab63Sniadnl
636abeab63Sniadnl See the "Since" comment for each macro you use to see what version
646abeab63Sniadnl of the macros you require.
656abeab63Sniam4_defun([PKG_PREREQ],
666abeab63Snia[m4_define([PKG_MACROS_VERSION], [0.29])
676abeab63Sniam4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
686abeab63Snia    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
696abeab63Snia])dnl PKG_PREREQ
706abeab63Snia
716abeab63Sniadnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
726abeab63Sniadnl ----------------------------------
736abeab63Sniadnl Since: 0.16
746abeab63Sniadnl
756abeab63Sniadnl Search for the pkg-config tool and set the PKG_CONFIG variable to
766abeab63Sniadnl first found in the path. Checks that the version of pkg-config found
776abeab63Sniadnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
786abeab63Sniadnl used since that's the first version where most current features of
796abeab63Sniadnl pkg-config existed.
806abeab63SniaAC_DEFUN([PKG_PROG_PKG_CONFIG],
816abeab63Snia[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
826abeab63Sniam4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
836abeab63Sniam4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
846abeab63SniaAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
856abeab63SniaAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
866abeab63SniaAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
876abeab63Snia
886abeab63Sniaif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
896abeab63Snia	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
906abeab63Sniafi
916abeab63Sniaif test -n "$PKG_CONFIG"; then
926abeab63Snia	_pkg_min_version=m4_default([$1], [0.9.0])
936abeab63Snia	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
946abeab63Snia	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
956abeab63Snia		AC_MSG_RESULT([yes])
966abeab63Snia	else
976abeab63Snia		AC_MSG_RESULT([no])
986abeab63Snia		PKG_CONFIG=""
996abeab63Snia	fi
1006abeab63Sniafi[]dnl
1016abeab63Snia])dnl PKG_PROG_PKG_CONFIG
1026abeab63Snia
1036abeab63Sniadnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1046abeab63Sniadnl -------------------------------------------------------------------
1056abeab63Sniadnl Since: 0.18
1066abeab63Sniadnl
1076abeab63Sniadnl Check to see whether a particular set of modules exists. Similar to
1086abeab63Sniadnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1096abeab63Sniadnl
1106abeab63Sniadnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1116abeab63Sniadnl only at the first occurence in configure.ac, so if the first place
1126abeab63Sniadnl it's called might be skipped (such as if it is within an "if", you
1136abeab63Sniadnl have to call PKG_CHECK_EXISTS manually
1146abeab63SniaAC_DEFUN([PKG_CHECK_EXISTS],
1156abeab63Snia[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1166abeab63Sniaif test -n "$PKG_CONFIG" && \
1176abeab63Snia    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1186abeab63Snia  m4_default([$2], [:])
1196abeab63Sniam4_ifvaln([$3], [else
1206abeab63Snia  $3])dnl
1216abeab63Sniafi])
1226abeab63Snia
1236abeab63Sniadnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1246abeab63Sniadnl ---------------------------------------------
1256abeab63Sniadnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1266abeab63Sniadnl pkg_failed based on the result.
1276abeab63Sniam4_define([_PKG_CONFIG],
1286abeab63Snia[if test -n "$$1"; then
1296abeab63Snia    pkg_cv_[]$1="$$1"
1306abeab63Snia elif test -n "$PKG_CONFIG"; then
1316abeab63Snia    PKG_CHECK_EXISTS([$3],
1326abeab63Snia                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1336abeab63Snia		      test "x$?" != "x0" && pkg_failed=yes ],
1346abeab63Snia		     [pkg_failed=yes])
1356abeab63Snia else
1366abeab63Snia    pkg_failed=untried
1376abeab63Sniafi[]dnl
1386abeab63Snia])dnl _PKG_CONFIG
1396abeab63Snia
1406abeab63Sniadnl _PKG_SHORT_ERRORS_SUPPORTED
1416abeab63Sniadnl ---------------------------
1426abeab63Sniadnl Internal check to see if pkg-config supports short errors.
1436abeab63SniaAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1446abeab63Snia[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1456abeab63Sniaif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1466abeab63Snia        _pkg_short_errors_supported=yes
1476abeab63Sniaelse
1486abeab63Snia        _pkg_short_errors_supported=no
1496abeab63Sniafi[]dnl
1506abeab63Snia])dnl _PKG_SHORT_ERRORS_SUPPORTED
1516abeab63Snia
1526abeab63Snia
1536abeab63Sniadnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1546abeab63Sniadnl   [ACTION-IF-NOT-FOUND])
1556abeab63Sniadnl --------------------------------------------------------------
1566abeab63Sniadnl Since: 0.4.0
1576abeab63Sniadnl
1586abeab63Sniadnl Note that if there is a possibility the first call to
1596abeab63Sniadnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1606abeab63Sniadnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1616abeab63SniaAC_DEFUN([PKG_CHECK_MODULES],
1626abeab63Snia[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1636abeab63SniaAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1646abeab63SniaAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1656abeab63Snia
1666abeab63Sniapkg_failed=no
1676abeab63SniaAC_MSG_CHECKING([for $1])
1686abeab63Snia
1696abeab63Snia_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1706abeab63Snia_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1716abeab63Snia
1726abeab63Sniam4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1736abeab63Sniaand $1[]_LIBS to avoid the need to call pkg-config.
1746abeab63SniaSee the pkg-config man page for more details.])
1756abeab63Snia
1766abeab63Sniaif test $pkg_failed = yes; then
1776abeab63Snia   	AC_MSG_RESULT([no])
1786abeab63Snia        _PKG_SHORT_ERRORS_SUPPORTED
1796abeab63Snia        if test $_pkg_short_errors_supported = yes; then
1806abeab63Snia	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1816abeab63Snia        else 
1826abeab63Snia	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1836abeab63Snia        fi
1846abeab63Snia	# Put the nasty error message in config.log where it belongs
1856abeab63Snia	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1866abeab63Snia
1876abeab63Snia	m4_default([$4], [AC_MSG_ERROR(
1886abeab63Snia[Package requirements ($2) were not met:
1896abeab63Snia
1906abeab63Snia$$1_PKG_ERRORS
1916abeab63Snia
1926abeab63SniaConsider adjusting the PKG_CONFIG_PATH environment variable if you
1936abeab63Sniainstalled software in a non-standard prefix.
1946abeab63Snia
1956abeab63Snia_PKG_TEXT])[]dnl
1966abeab63Snia        ])
1976abeab63Sniaelif test $pkg_failed = untried; then
1986abeab63Snia     	AC_MSG_RESULT([no])
1996abeab63Snia	m4_default([$4], [AC_MSG_FAILURE(
2006abeab63Snia[The pkg-config script could not be found or is too old.  Make sure it
2016abeab63Sniais in your PATH or set the PKG_CONFIG environment variable to the full
2026abeab63Sniapath to pkg-config.
2036abeab63Snia
2046abeab63Snia_PKG_TEXT
2056abeab63Snia
2066abeab63SniaTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2076abeab63Snia        ])
2086abeab63Sniaelse
2096abeab63Snia	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2106abeab63Snia	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2116abeab63Snia        AC_MSG_RESULT([yes])
2126abeab63Snia	$3
2136abeab63Sniafi[]dnl
2146abeab63Snia])dnl PKG_CHECK_MODULES
2156abeab63Snia
2166abeab63Snia
2176abeab63Sniadnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2186abeab63Sniadnl   [ACTION-IF-NOT-FOUND])
2196abeab63Sniadnl ---------------------------------------------------------------------
2206abeab63Sniadnl Since: 0.29
2216abeab63Sniadnl
2226abeab63Sniadnl Checks for existence of MODULES and gathers its build flags with
2236abeab63Sniadnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2246abeab63Sniadnl and VARIABLE-PREFIX_LIBS from --libs.
2256abeab63Sniadnl
2266abeab63Sniadnl Note that if there is a possibility the first call to
2276abeab63Sniadnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2286abeab63Sniadnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2296abeab63Sniadnl configure.ac.
2306abeab63SniaAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2316abeab63Snia[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2326abeab63Snia_save_PKG_CONFIG=$PKG_CONFIG
2336abeab63SniaPKG_CONFIG="$PKG_CONFIG --static"
2346abeab63SniaPKG_CHECK_MODULES($@)
2356abeab63SniaPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2366abeab63Snia])dnl PKG_CHECK_MODULES_STATIC
2376abeab63Snia
2386abeab63Snia
2396abeab63Sniadnl PKG_INSTALLDIR([DIRECTORY])
2406abeab63Sniadnl -------------------------
2416abeab63Sniadnl Since: 0.27
2426abeab63Sniadnl
2436abeab63Sniadnl Substitutes the variable pkgconfigdir as the location where a module
2446abeab63Sniadnl should install pkg-config .pc files. By default the directory is
2456abeab63Sniadnl $libdir/pkgconfig, but the default can be changed by passing
2466abeab63Sniadnl DIRECTORY. The user can override through the --with-pkgconfigdir
2476abeab63Sniadnl parameter.
2486abeab63SniaAC_DEFUN([PKG_INSTALLDIR],
2496abeab63Snia[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2506abeab63Sniam4_pushdef([pkg_description],
2516abeab63Snia    [pkg-config installation directory @<:@]pkg_default[@:>@])
2526abeab63SniaAC_ARG_WITH([pkgconfigdir],
2536abeab63Snia    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2546abeab63Snia    [with_pkgconfigdir=]pkg_default)
2556abeab63SniaAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2566abeab63Sniam4_popdef([pkg_default])
2576abeab63Sniam4_popdef([pkg_description])
2586abeab63Snia])dnl PKG_INSTALLDIR
2596abeab63Snia
2606abeab63Snia
2616abeab63Sniadnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2626abeab63Sniadnl --------------------------------
2636abeab63Sniadnl Since: 0.27
2646abeab63Sniadnl
2656abeab63Sniadnl Substitutes the variable noarch_pkgconfigdir as the location where a
2666abeab63Sniadnl module should install arch-independent pkg-config .pc files. By
2676abeab63Sniadnl default the directory is $datadir/pkgconfig, but the default can be
2686abeab63Sniadnl changed by passing DIRECTORY. The user can override through the
2696abeab63Sniadnl --with-noarch-pkgconfigdir parameter.
2706abeab63SniaAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2716abeab63Snia[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2726abeab63Sniam4_pushdef([pkg_description],
2736abeab63Snia    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2746abeab63SniaAC_ARG_WITH([noarch-pkgconfigdir],
2756abeab63Snia    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2766abeab63Snia    [with_noarch_pkgconfigdir=]pkg_default)
2776abeab63SniaAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2786abeab63Sniam4_popdef([pkg_default])
2796abeab63Sniam4_popdef([pkg_description])
2806abeab63Snia])dnl PKG_NOARCH_INSTALLDIR
2816abeab63Snia
2826abeab63Snia
2836abeab63Sniadnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2846abeab63Sniadnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2856abeab63Sniadnl -------------------------------------------
2866abeab63Sniadnl Since: 0.28
2876abeab63Sniadnl
2886abeab63Sniadnl Retrieves the value of the pkg-config variable for the given module.
2896abeab63SniaAC_DEFUN([PKG_CHECK_VAR],
2906abeab63Snia[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2916abeab63SniaAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2926abeab63Snia
2936abeab63Snia_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2946abeab63SniaAS_VAR_COPY([$1], [pkg_cv_][$1])
2956abeab63Snia
2966abeab63SniaAS_VAR_IF([$1], [""], [$5], [$4])dnl
2976abeab63Snia])dnl PKG_CHECK_VAR
2986abeab63Snia
2996abeab63Sniadnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3006abeab63Sniadnl
3016abeab63Sniadnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3026abeab63Sniadnl
3036abeab63Sniadnl Permission is hereby granted, free of charge, to any person obtaining a
3046abeab63Sniadnl copy of this software and associated documentation files (the "Software"),
3056abeab63Sniadnl to deal in the Software without restriction, including without limitation
3066abeab63Sniadnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3076abeab63Sniadnl and/or sell copies of the Software, and to permit persons to whom the
3086abeab63Sniadnl Software is furnished to do so, subject to the following conditions:
3096abeab63Sniadnl
3106abeab63Sniadnl The above copyright notice and this permission notice (including the next
3116abeab63Sniadnl paragraph) shall be included in all copies or substantial portions of the
3126abeab63Sniadnl Software.
3136abeab63Sniadnl
3146abeab63Sniadnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3156abeab63Sniadnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3166abeab63Sniadnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3176abeab63Sniadnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3186abeab63Sniadnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3196abeab63Sniadnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3206abeab63Sniadnl DEALINGS IN THE SOFTWARE.
3216abeab63Snia
3226abeab63Snia# XORG_MACROS_VERSION(required-version)
3236abeab63Snia# -------------------------------------
3246abeab63Snia# Minimum version: 1.1.0
3256abeab63Snia#
3266abeab63Snia# If you're using a macro added in Version 1.1 or newer, include this in
3276abeab63Snia# your configure.ac with the minimum required version, such as:
3286abeab63Snia# XORG_MACROS_VERSION(1.1)
3296abeab63Snia#
3306abeab63Snia# To ensure that this macro is defined, also add:
3316abeab63Snia# m4_ifndef([XORG_MACROS_VERSION],
3326abeab63Snia#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3336abeab63Snia#
3346abeab63Snia#
3356abeab63Snia# See the "minimum version" comment for each macro you use to see what
3366abeab63Snia# version you require.
3376abeab63Sniam4_defun([XORG_MACROS_VERSION],[
3386abeab63Sniam4_define([vers_have], [1.19.0])
3396abeab63Sniam4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3406abeab63Sniam4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3416abeab63Sniam4_if(m4_cmp(maj_have, maj_needed), 0,,
3426abeab63Snia    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3436abeab63Sniam4_if(m4_version_compare(vers_have, [$1]), -1,
3446abeab63Snia    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3456abeab63Sniam4_undefine([vers_have])
3466abeab63Sniam4_undefine([maj_have])
3476abeab63Sniam4_undefine([maj_needed])
3486abeab63Snia]) # XORG_MACROS_VERSION
3496abeab63Snia
3506abeab63Snia# XORG_PROG_RAWCPP()
3516abeab63Snia# ------------------
3526abeab63Snia# Minimum version: 1.0.0
3536abeab63Snia#
3546abeab63Snia# Find cpp program and necessary flags for use in pre-processing text files
3556abeab63Snia# such as man pages and config files
3566abeab63SniaAC_DEFUN([XORG_PROG_RAWCPP],[
3576abeab63SniaAC_REQUIRE([AC_PROG_CPP])
3586abeab63SniaAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3596abeab63Snia   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3606abeab63Snia
3616abeab63Snia# Check for flag to avoid builtin definitions - assumes unix is predefined,
3626abeab63Snia# which is not the best choice for supporting other OS'es, but covers most
3636abeab63Snia# of the ones we need for now.
3646abeab63SniaAC_MSG_CHECKING([if $RAWCPP requires -undef])
3656abeab63SniaAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3666abeab63Sniaif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3676abeab63Snia	AC_MSG_RESULT([no])
3686abeab63Sniaelse
3696abeab63Snia	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3706abeab63Snia		RAWCPPFLAGS=-undef
3716abeab63Snia		AC_MSG_RESULT([yes])
3726abeab63Snia	# under Cygwin unix is still defined even with -undef
3736abeab63Snia	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3746abeab63Snia		RAWCPPFLAGS="-undef -ansi"
3756abeab63Snia		AC_MSG_RESULT([yes, with -ansi])
3766abeab63Snia	else
3776abeab63Snia		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3786abeab63Snia	fi
3796abeab63Sniafi
3806abeab63Sniarm -f conftest.$ac_ext
3816abeab63Snia
3826abeab63SniaAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3836abeab63SniaAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3846abeab63Sniaif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3856abeab63Snia	AC_MSG_RESULT([no])
3866abeab63Sniaelse
3876abeab63Snia	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3886abeab63Snia		TRADITIONALCPPFLAGS="-traditional"
3896abeab63Snia		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3906abeab63Snia		AC_MSG_RESULT([yes])
3916abeab63Snia	else
3926abeab63Snia		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3936abeab63Snia	fi
3946abeab63Sniafi
3956abeab63Sniarm -f conftest.$ac_ext
3966abeab63SniaAC_SUBST(RAWCPPFLAGS)
3976abeab63SniaAC_SUBST(TRADITIONALCPPFLAGS)
3986abeab63Snia]) # XORG_PROG_RAWCPP
3996abeab63Snia
4006abeab63Snia# XORG_MANPAGE_SECTIONS()
4016abeab63Snia# -----------------------
4026abeab63Snia# Minimum version: 1.0.0
4036abeab63Snia#
4046abeab63Snia# Determine which sections man pages go in for the different man page types
4056abeab63Snia# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4066abeab63Snia# Not sure if there's any better way than just hardcoding by OS name.
4076abeab63Snia# Override default settings by setting environment variables
4086abeab63Snia# Added MAN_SUBSTS in version 1.8
4096abeab63Snia# Added AC_PROG_SED in version 1.8
4106abeab63Snia
4116abeab63SniaAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4126abeab63SniaAC_REQUIRE([AC_CANONICAL_HOST])
4136abeab63SniaAC_REQUIRE([AC_PROG_SED])
4146abeab63Snia
4156abeab63Sniaif test x$APP_MAN_SUFFIX = x    ; then
4166abeab63Snia    APP_MAN_SUFFIX=1
4176abeab63Sniafi
4186abeab63Sniaif test x$APP_MAN_DIR = x    ; then
4196abeab63Snia    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4206abeab63Sniafi
4216abeab63Snia
4226abeab63Sniaif test x$LIB_MAN_SUFFIX = x    ; then
4236abeab63Snia    LIB_MAN_SUFFIX=3
4246abeab63Sniafi
4256abeab63Sniaif test x$LIB_MAN_DIR = x    ; then
4266abeab63Snia    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4276abeab63Sniafi
4286abeab63Snia
4296abeab63Sniaif test x$FILE_MAN_SUFFIX = x    ; then
4306abeab63Snia    case $host_os in
4316abeab63Snia	# Solaris 2.0 - 11 use SysV man page sections
4326abeab63Snia	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4336abeab63Snia	*)				FILE_MAN_SUFFIX=5  ;;
4346abeab63Snia    esac
4356abeab63Sniafi
4366abeab63Sniaif test x$FILE_MAN_DIR = x    ; then
4376abeab63Snia    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4386abeab63Sniafi
4396abeab63Snia
4406abeab63Sniaif test x$MISC_MAN_SUFFIX = x    ; then
4416abeab63Snia    case $host_os in
4426abeab63Snia	# Solaris 2.0 - 11 use SysV man page sections
4436abeab63Snia	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4446abeab63Snia	*)				MISC_MAN_SUFFIX=7  ;;
4456abeab63Snia    esac
4466abeab63Sniafi
4476abeab63Sniaif test x$MISC_MAN_DIR = x    ; then
4486abeab63Snia    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4496abeab63Sniafi
4506abeab63Snia
4516abeab63Sniaif test x$DRIVER_MAN_SUFFIX = x    ; then
4526abeab63Snia    case $host_os in
4536abeab63Snia	# Solaris 2.0 - 11 use SysV man page sections
4546abeab63Snia	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4556abeab63Snia	*)				DRIVER_MAN_SUFFIX=4  ;;
4566abeab63Snia    esac
4576abeab63Sniafi
4586abeab63Sniaif test x$DRIVER_MAN_DIR = x    ; then
4596abeab63Snia    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4606abeab63Sniafi
4616abeab63Snia
4626abeab63Sniaif test x$ADMIN_MAN_SUFFIX = x    ; then
4636abeab63Snia    case $host_os in
4646abeab63Snia	# Solaris 2.0 - 11 use SysV man page sections
4656abeab63Snia	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4666abeab63Snia	*)				ADMIN_MAN_SUFFIX=8  ;;
4676abeab63Snia    esac
4686abeab63Sniafi
4696abeab63Sniaif test x$ADMIN_MAN_DIR = x    ; then
4706abeab63Snia    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4716abeab63Sniafi
4726abeab63Snia
4736abeab63Snia
4746abeab63SniaAC_SUBST([APP_MAN_SUFFIX])
4756abeab63SniaAC_SUBST([LIB_MAN_SUFFIX])
4766abeab63SniaAC_SUBST([FILE_MAN_SUFFIX])
4776abeab63SniaAC_SUBST([MISC_MAN_SUFFIX])
4786abeab63SniaAC_SUBST([DRIVER_MAN_SUFFIX])
4796abeab63SniaAC_SUBST([ADMIN_MAN_SUFFIX])
4806abeab63SniaAC_SUBST([APP_MAN_DIR])
4816abeab63SniaAC_SUBST([LIB_MAN_DIR])
4826abeab63SniaAC_SUBST([FILE_MAN_DIR])
4836abeab63SniaAC_SUBST([MISC_MAN_DIR])
4846abeab63SniaAC_SUBST([DRIVER_MAN_DIR])
4856abeab63SniaAC_SUBST([ADMIN_MAN_DIR])
4866abeab63Snia
4876abeab63SniaXORG_MAN_PAGE="X Version 11"
4886abeab63SniaAC_SUBST([XORG_MAN_PAGE])
4896abeab63SniaMAN_SUBSTS="\
4906abeab63Snia	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4916abeab63Snia	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4926abeab63Snia	-e 's|__xservername__|Xorg|g' \
4936abeab63Snia	-e 's|__xconfigfile__|xorg.conf|g' \
4946abeab63Snia	-e 's|__projectroot__|\$(prefix)|g' \
4956abeab63Snia	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4966abeab63Snia	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4976abeab63Snia	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4986abeab63Snia	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4996abeab63Snia	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5006abeab63Snia	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5016abeab63Snia	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5026abeab63SniaAC_SUBST([MAN_SUBSTS])
5036abeab63Snia
5046abeab63Snia]) # XORG_MANPAGE_SECTIONS
5056abeab63Snia
5066abeab63Snia# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5076abeab63Snia# ------------------------
5086abeab63Snia# Minimum version: 1.7.0
5096abeab63Snia#
5106abeab63Snia# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5116abeab63Snia# provided by xorg-sgml-doctools, if installed.
5126abeab63SniaAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5136abeab63SniaAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5146abeab63SniaXORG_SGML_PATH=
5156abeab63SniaPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5166abeab63Snia    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5176abeab63Snia    [m4_ifval([$1],[:],
5186abeab63Snia        [if test x"$cross_compiling" != x"yes" ; then
5196abeab63Snia            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5206abeab63Snia                          [XORG_SGML_PATH=$prefix/share/sgml])
5216abeab63Snia         fi])
5226abeab63Snia    ])
5236abeab63Snia
5246abeab63Snia# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5256abeab63Snia# the path and the name of the doc stylesheet
5266abeab63Sniaif test "x$XORG_SGML_PATH" != "x" ; then
5276abeab63Snia   AC_MSG_RESULT([$XORG_SGML_PATH])
5286abeab63Snia   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5296abeab63Snia   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5306abeab63Sniaelse
5316abeab63Snia   AC_MSG_RESULT([no])
5326abeab63Sniafi
5336abeab63Snia
5346abeab63SniaAC_SUBST(XORG_SGML_PATH)
5356abeab63SniaAC_SUBST(STYLESHEET_SRCDIR)
5366abeab63SniaAC_SUBST(XSL_STYLESHEET)
5376abeab63SniaAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5386abeab63Snia]) # XORG_CHECK_SGML_DOCTOOLS
5396abeab63Snia
5406abeab63Snia# XORG_CHECK_LINUXDOC
5416abeab63Snia# -------------------
5426abeab63Snia# Minimum version: 1.0.0
5436abeab63Snia#
5446abeab63Snia# Defines the variable MAKE_TEXT if the necessary tools and
5456abeab63Snia# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5466abeab63Snia# Whether or not the necessary tools and files are found can be checked
5476abeab63Snia# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5486abeab63SniaAC_DEFUN([XORG_CHECK_LINUXDOC],[
5496abeab63SniaAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5506abeab63SniaAC_REQUIRE([XORG_WITH_PS2PDF])
5516abeab63Snia
5526abeab63SniaAC_PATH_PROG(LINUXDOC, linuxdoc)
5536abeab63Snia
5546abeab63SniaAC_MSG_CHECKING([whether to build documentation])
5556abeab63Snia
5566abeab63Sniaif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5576abeab63Snia   BUILDDOC=yes
5586abeab63Sniaelse
5596abeab63Snia   BUILDDOC=no
5606abeab63Sniafi
5616abeab63Snia
5626abeab63SniaAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5636abeab63Snia
5646abeab63SniaAC_MSG_RESULT([$BUILDDOC])
5656abeab63Snia
5666abeab63SniaAC_MSG_CHECKING([whether to build pdf documentation])
5676abeab63Snia
5686abeab63Sniaif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5696abeab63Snia   BUILDPDFDOC=yes
5706abeab63Sniaelse
5716abeab63Snia   BUILDPDFDOC=no
5726abeab63Sniafi
5736abeab63Snia
5746abeab63SniaAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5756abeab63Snia
5766abeab63SniaAC_MSG_RESULT([$BUILDPDFDOC])
5776abeab63Snia
5786abeab63SniaMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5796abeab63SniaMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5806abeab63SniaMAKE_PDF="$PS2PDF"
5816abeab63SniaMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5826abeab63Snia
5836abeab63SniaAC_SUBST(MAKE_TEXT)
5846abeab63SniaAC_SUBST(MAKE_PS)
5856abeab63SniaAC_SUBST(MAKE_PDF)
5866abeab63SniaAC_SUBST(MAKE_HTML)
5876abeab63Snia]) # XORG_CHECK_LINUXDOC
5886abeab63Snia
5896abeab63Snia# XORG_CHECK_DOCBOOK
5906abeab63Snia# -------------------
5916abeab63Snia# Minimum version: 1.0.0
5926abeab63Snia#
5936abeab63Snia# Checks for the ability to build output formats from SGML DocBook source.
5946abeab63Snia# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5956abeab63Snia# indicates whether the necessary tools and files are found and, if set,
5966abeab63Snia# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5976abeab63SniaAC_DEFUN([XORG_CHECK_DOCBOOK],[
5986abeab63SniaAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5996abeab63Snia
6006abeab63SniaBUILDTXTDOC=no
6016abeab63SniaBUILDPDFDOC=no
6026abeab63SniaBUILDPSDOC=no
6036abeab63SniaBUILDHTMLDOC=no
6046abeab63Snia
6056abeab63SniaAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6066abeab63SniaAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6076abeab63SniaAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6086abeab63SniaAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6096abeab63Snia
6106abeab63SniaAC_MSG_CHECKING([whether to build text documentation])
6116abeab63Sniaif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6126abeab63Snia   test x$BUILD_TXTDOC != xno; then
6136abeab63Snia	BUILDTXTDOC=yes
6146abeab63Sniafi
6156abeab63SniaAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6166abeab63SniaAC_MSG_RESULT([$BUILDTXTDOC])
6176abeab63Snia
6186abeab63SniaAC_MSG_CHECKING([whether to build PDF documentation])
6196abeab63Sniaif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6206abeab63Snia   test x$BUILD_PDFDOC != xno; then
6216abeab63Snia	BUILDPDFDOC=yes
6226abeab63Sniafi
6236abeab63SniaAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6246abeab63SniaAC_MSG_RESULT([$BUILDPDFDOC])
6256abeab63Snia
6266abeab63SniaAC_MSG_CHECKING([whether to build PostScript documentation])
6276abeab63Sniaif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6286abeab63Snia   test x$BUILD_PSDOC != xno; then
6296abeab63Snia	BUILDPSDOC=yes
6306abeab63Sniafi
6316abeab63SniaAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6326abeab63SniaAC_MSG_RESULT([$BUILDPSDOC])
6336abeab63Snia
6346abeab63SniaAC_MSG_CHECKING([whether to build HTML documentation])
6356abeab63Sniaif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6366abeab63Snia   test x$BUILD_HTMLDOC != xno; then
6376abeab63Snia	BUILDHTMLDOC=yes
6386abeab63Sniafi
6396abeab63SniaAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6406abeab63SniaAC_MSG_RESULT([$BUILDHTMLDOC])
6416abeab63Snia
6426abeab63SniaMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6436abeab63SniaMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6446abeab63SniaMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6456abeab63SniaMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6466abeab63Snia
6476abeab63SniaAC_SUBST(MAKE_TEXT)
6486abeab63SniaAC_SUBST(MAKE_PS)
6496abeab63SniaAC_SUBST(MAKE_PDF)
6506abeab63SniaAC_SUBST(MAKE_HTML)
6516abeab63Snia]) # XORG_CHECK_DOCBOOK
6526abeab63Snia
6536abeab63Snia# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6546abeab63Snia# ----------------
6556abeab63Snia# Minimum version: 1.5.0
6566abeab63Snia# Minimum version for optional DEFAULT argument: 1.11.0
6576abeab63Snia#
6586abeab63Snia# Documentation tools are not always available on all platforms and sometimes
6596abeab63Snia# not at the appropriate level. This macro enables a module to test for the
6606abeab63Snia# presence of the tool and obtain it's path in separate variables. Coupled with
6616abeab63Snia# the --with-xmlto option, it allows maximum flexibilty in making decisions
6626abeab63Snia# as whether or not to use the xmlto package. When DEFAULT is not specified,
6636abeab63Snia# --with-xmlto assumes 'auto'.
6646abeab63Snia#
6656abeab63Snia# Interface to module:
6666abeab63Snia# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6676abeab63Snia# XMLTO:	returns the path of the xmlto program found
6686abeab63Snia#		returns the path set by the user in the environment
6696abeab63Snia# --with-xmlto:	'yes' user instructs the module to use xmlto
6706abeab63Snia#		'no' user instructs the module not to use xmlto
6716abeab63Snia#
6726abeab63Snia# Added in version 1.10.0
6736abeab63Snia# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6746abeab63Snia#                  xmlto for text output requires either lynx, links, or w3m browsers
6756abeab63Snia#
6766abeab63Snia# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6776abeab63Snia#
6786abeab63SniaAC_DEFUN([XORG_WITH_XMLTO],[
6796abeab63SniaAC_ARG_VAR([XMLTO], [Path to xmlto command])
6806abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
6816abeab63SniaAC_ARG_WITH(xmlto,
6826abeab63Snia	AS_HELP_STRING([--with-xmlto],
6836abeab63Snia	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6846abeab63Snia	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6856abeab63Sniam4_undefine([_defopt])
6866abeab63Snia
6876abeab63Sniaif test "x$use_xmlto" = x"auto"; then
6886abeab63Snia   AC_PATH_PROG([XMLTO], [xmlto])
6896abeab63Snia   if test "x$XMLTO" = "x"; then
6906abeab63Snia        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6916abeab63Snia	have_xmlto=no
6926abeab63Snia   else
6936abeab63Snia        have_xmlto=yes
6946abeab63Snia   fi
6956abeab63Sniaelif test "x$use_xmlto" = x"yes" ; then
6966abeab63Snia   AC_PATH_PROG([XMLTO], [xmlto])
6976abeab63Snia   if test "x$XMLTO" = "x"; then
6986abeab63Snia        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6996abeab63Snia   fi
7006abeab63Snia   have_xmlto=yes
7016abeab63Sniaelif test "x$use_xmlto" = x"no" ; then
7026abeab63Snia   if test "x$XMLTO" != "x"; then
7036abeab63Snia      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7046abeab63Snia   fi
7056abeab63Snia   have_xmlto=no
7066abeab63Sniaelse
7076abeab63Snia   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7086abeab63Sniafi
7096abeab63Snia
7106abeab63Snia# Test for a minimum version of xmlto, if provided.
7116abeab63Sniam4_ifval([$1],
7126abeab63Snia[if test "$have_xmlto" = yes; then
7136abeab63Snia    # scrape the xmlto version
7146abeab63Snia    AC_MSG_CHECKING([the xmlto version])
7156abeab63Snia    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7166abeab63Snia    AC_MSG_RESULT([$xmlto_version])
7176abeab63Snia    AS_VERSION_COMPARE([$xmlto_version], [$1],
7186abeab63Snia        [if test "x$use_xmlto" = xauto; then
7196abeab63Snia            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7206abeab63Snia            have_xmlto=no
7216abeab63Snia        else
7226abeab63Snia            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7236abeab63Snia        fi])
7246abeab63Sniafi])
7256abeab63Snia
7266abeab63Snia# Test for the ability of xmlto to generate a text target
7276abeab63Snia#
7286abeab63Snia# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7296abeab63Snia# following test for empty XML docbook files.
7306abeab63Snia# For compatibility reasons use the following empty XML docbook file and if
7316abeab63Snia# it fails try it again with a non-empty XML file.
7326abeab63Sniahave_xmlto_text=no
7336abeab63Sniacat > conftest.xml << "EOF"
7346abeab63SniaEOF
7356abeab63SniaAS_IF([test "$have_xmlto" = yes],
7366abeab63Snia      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7376abeab63Snia             [have_xmlto_text=yes],
7386abeab63Snia             [# Try it again with a non-empty XML file.
7396abeab63Snia              cat > conftest.xml << "EOF"
7406abeab63Snia<x></x>
7416abeab63SniaEOF
7426abeab63Snia              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7436abeab63Snia                    [have_xmlto_text=yes],
7446abeab63Snia                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7456abeab63Sniarm -f conftest.xml
7466abeab63SniaAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7476abeab63SniaAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7486abeab63Snia]) # XORG_WITH_XMLTO
7496abeab63Snia
7506abeab63Snia# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7516abeab63Snia# --------------------------------------------
7526abeab63Snia# Minimum version: 1.12.0
7536abeab63Snia# Minimum version for optional DEFAULT argument: 1.12.0
7546abeab63Snia#
7556abeab63Snia# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7566abeab63Snia# XML-based language used for the transformation of XML documents.
7576abeab63Snia# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7586abeab63Snia# It is used under the cover by xmlto to generate html files from DocBook/XML.
7596abeab63Snia# The XSLT processor is often used as a standalone tool for transformations.
7606abeab63Snia# It should not be assumed that this tool is used only to work with documnetation.
7616abeab63Snia# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7626abeab63Snia#
7636abeab63Snia# Interface to module:
7646abeab63Snia# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7656abeab63Snia# XSLTPROC:	 returns the path of the xsltproc program found
7666abeab63Snia#		 returns the path set by the user in the environment
7676abeab63Snia# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7686abeab63Snia#		  'no' user instructs the module not to use xsltproc
7696abeab63Snia# have_xsltproc: returns yes if xsltproc found in PATH or no
7706abeab63Snia#
7716abeab63Snia# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7726abeab63Snia#
7736abeab63SniaAC_DEFUN([XORG_WITH_XSLTPROC],[
7746abeab63SniaAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7756abeab63Snia# Preserves the interface, should it be implemented later
7766abeab63Sniam4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7776abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
7786abeab63SniaAC_ARG_WITH(xsltproc,
7796abeab63Snia	AS_HELP_STRING([--with-xsltproc],
7806abeab63Snia	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7816abeab63Snia	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7826abeab63Sniam4_undefine([_defopt])
7836abeab63Snia
7846abeab63Sniaif test "x$use_xsltproc" = x"auto"; then
7856abeab63Snia   AC_PATH_PROG([XSLTPROC], [xsltproc])
7866abeab63Snia   if test "x$XSLTPROC" = "x"; then
7876abeab63Snia        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7886abeab63Snia	have_xsltproc=no
7896abeab63Snia   else
7906abeab63Snia        have_xsltproc=yes
7916abeab63Snia   fi
7926abeab63Sniaelif test "x$use_xsltproc" = x"yes" ; then
7936abeab63Snia   AC_PATH_PROG([XSLTPROC], [xsltproc])
7946abeab63Snia   if test "x$XSLTPROC" = "x"; then
7956abeab63Snia        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7966abeab63Snia   fi
7976abeab63Snia   have_xsltproc=yes
7986abeab63Sniaelif test "x$use_xsltproc" = x"no" ; then
7996abeab63Snia   if test "x$XSLTPROC" != "x"; then
8006abeab63Snia      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8016abeab63Snia   fi
8026abeab63Snia   have_xsltproc=no
8036abeab63Sniaelse
8046abeab63Snia   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8056abeab63Sniafi
8066abeab63Snia
8076abeab63SniaAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8086abeab63Snia]) # XORG_WITH_XSLTPROC
8096abeab63Snia
8106abeab63Snia# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8116abeab63Snia# ----------------------------------------
8126abeab63Snia# Minimum version: 1.15.0
8136abeab63Snia#
8146abeab63Snia# PERL (Practical Extraction and Report Language) is a language optimized for
8156abeab63Snia# scanning arbitrary text files, extracting information from those text files,
8166abeab63Snia# and printing reports based on that information.
8176abeab63Snia#
8186abeab63Snia# When DEFAULT is not specified, --with-perl assumes 'auto'.
8196abeab63Snia#
8206abeab63Snia# Interface to module:
8216abeab63Snia# HAVE_PERL: used in makefiles to conditionally scan text files
8226abeab63Snia# PERL:	     returns the path of the perl program found
8236abeab63Snia#	     returns the path set by the user in the environment
8246abeab63Snia# --with-perl: 'yes' user instructs the module to use perl
8256abeab63Snia#	       'no' user instructs the module not to use perl
8266abeab63Snia# have_perl: returns yes if perl found in PATH or no
8276abeab63Snia#
8286abeab63Snia# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8296abeab63Snia#
8306abeab63SniaAC_DEFUN([XORG_WITH_PERL],[
8316abeab63SniaAC_ARG_VAR([PERL], [Path to perl command])
8326abeab63Snia# Preserves the interface, should it be implemented later
8336abeab63Sniam4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8346abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
8356abeab63SniaAC_ARG_WITH(perl,
8366abeab63Snia	AS_HELP_STRING([--with-perl],
8376abeab63Snia	   [Use perl for extracting information from files (default: ]_defopt[)]),
8386abeab63Snia	   [use_perl=$withval], [use_perl=]_defopt)
8396abeab63Sniam4_undefine([_defopt])
8406abeab63Snia
8416abeab63Sniaif test "x$use_perl" = x"auto"; then
8426abeab63Snia   AC_PATH_PROG([PERL], [perl])
8436abeab63Snia   if test "x$PERL" = "x"; then
8446abeab63Snia        AC_MSG_WARN([perl not found - cannot extract information and report])
8456abeab63Snia	have_perl=no
8466abeab63Snia   else
8476abeab63Snia        have_perl=yes
8486abeab63Snia   fi
8496abeab63Sniaelif test "x$use_perl" = x"yes" ; then
8506abeab63Snia   AC_PATH_PROG([PERL], [perl])
8516abeab63Snia   if test "x$PERL" = "x"; then
8526abeab63Snia        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8536abeab63Snia   fi
8546abeab63Snia   have_perl=yes
8556abeab63Sniaelif test "x$use_perl" = x"no" ; then
8566abeab63Snia   if test "x$PERL" != "x"; then
8576abeab63Snia      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8586abeab63Snia   fi
8596abeab63Snia   have_perl=no
8606abeab63Sniaelse
8616abeab63Snia   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8626abeab63Sniafi
8636abeab63Snia
8646abeab63SniaAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8656abeab63Snia]) # XORG_WITH_PERL
8666abeab63Snia
8676abeab63Snia# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8686abeab63Snia# ----------------
8696abeab63Snia# Minimum version: 1.5.0
8706abeab63Snia# Minimum version for optional DEFAULT argument: 1.11.0
8716abeab63Snia#
8726abeab63Snia# Documentation tools are not always available on all platforms and sometimes
8736abeab63Snia# not at the appropriate level. This macro enables a module to test for the
8746abeab63Snia# presence of the tool and obtain it's path in separate variables. Coupled with
8756abeab63Snia# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8766abeab63Snia# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8776abeab63Snia# --with-asciidoc assumes 'auto'.
8786abeab63Snia#
8796abeab63Snia# Interface to module:
8806abeab63Snia# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8816abeab63Snia# ASCIIDOC:	 returns the path of the asciidoc program found
8826abeab63Snia#		 returns the path set by the user in the environment
8836abeab63Snia# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8846abeab63Snia#		  'no' user instructs the module not to use asciidoc
8856abeab63Snia#
8866abeab63Snia# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8876abeab63Snia#
8886abeab63SniaAC_DEFUN([XORG_WITH_ASCIIDOC],[
8896abeab63SniaAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8906abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
8916abeab63SniaAC_ARG_WITH(asciidoc,
8926abeab63Snia	AS_HELP_STRING([--with-asciidoc],
8936abeab63Snia	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8946abeab63Snia	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8956abeab63Sniam4_undefine([_defopt])
8966abeab63Snia
8976abeab63Sniaif test "x$use_asciidoc" = x"auto"; then
8986abeab63Snia   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8996abeab63Snia   if test "x$ASCIIDOC" = "x"; then
9006abeab63Snia        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9016abeab63Snia	have_asciidoc=no
9026abeab63Snia   else
9036abeab63Snia        have_asciidoc=yes
9046abeab63Snia   fi
9056abeab63Sniaelif test "x$use_asciidoc" = x"yes" ; then
9066abeab63Snia   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9076abeab63Snia   if test "x$ASCIIDOC" = "x"; then
9086abeab63Snia        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9096abeab63Snia   fi
9106abeab63Snia   have_asciidoc=yes
9116abeab63Sniaelif test "x$use_asciidoc" = x"no" ; then
9126abeab63Snia   if test "x$ASCIIDOC" != "x"; then
9136abeab63Snia      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9146abeab63Snia   fi
9156abeab63Snia   have_asciidoc=no
9166abeab63Sniaelse
9176abeab63Snia   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9186abeab63Sniafi
9196abeab63Sniam4_ifval([$1],
9206abeab63Snia[if test "$have_asciidoc" = yes; then
9216abeab63Snia    # scrape the asciidoc version
9226abeab63Snia    AC_MSG_CHECKING([the asciidoc version])
9236abeab63Snia    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9246abeab63Snia    AC_MSG_RESULT([$asciidoc_version])
9256abeab63Snia    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9266abeab63Snia        [if test "x$use_asciidoc" = xauto; then
9276abeab63Snia            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9286abeab63Snia            have_asciidoc=no
9296abeab63Snia        else
9306abeab63Snia            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9316abeab63Snia        fi])
9326abeab63Sniafi])
9336abeab63SniaAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9346abeab63Snia]) # XORG_WITH_ASCIIDOC
9356abeab63Snia
9366abeab63Snia# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9376abeab63Snia# -------------------------------------------
9386abeab63Snia# Minimum version: 1.5.0
9396abeab63Snia# Minimum version for optional DEFAULT argument: 1.11.0
9406abeab63Snia# Minimum version for optional DOT checking: 1.18.0
9416abeab63Snia#
9426abeab63Snia# Documentation tools are not always available on all platforms and sometimes
9436abeab63Snia# not at the appropriate level. This macro enables a module to test for the
9446abeab63Snia# presence of the tool and obtain it's path in separate variables. Coupled with
9456abeab63Snia# the --with-doxygen option, it allows maximum flexibilty in making decisions
9466abeab63Snia# as whether or not to use the doxygen package. When DEFAULT is not specified,
9476abeab63Snia# --with-doxygen assumes 'auto'.
9486abeab63Snia#
9496abeab63Snia# Interface to module:
9506abeab63Snia# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9516abeab63Snia# DOXYGEN:	 returns the path of the doxygen program found
9526abeab63Snia#		 returns the path set by the user in the environment
9536abeab63Snia# --with-doxygen: 'yes' user instructs the module to use doxygen
9546abeab63Snia#		  'no' user instructs the module not to use doxygen
9556abeab63Snia#
9566abeab63Snia# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9576abeab63Snia#
9586abeab63SniaAC_DEFUN([XORG_WITH_DOXYGEN],[
9596abeab63SniaAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9606abeab63SniaAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9616abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
9626abeab63SniaAC_ARG_WITH(doxygen,
9636abeab63Snia	AS_HELP_STRING([--with-doxygen],
9646abeab63Snia	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9656abeab63Snia	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9666abeab63Sniam4_undefine([_defopt])
9676abeab63Snia
9686abeab63Sniaif test "x$use_doxygen" = x"auto"; then
9696abeab63Snia   AC_PATH_PROG([DOXYGEN], [doxygen])
9706abeab63Snia   if test "x$DOXYGEN" = "x"; then
9716abeab63Snia        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9726abeab63Snia	have_doxygen=no
9736abeab63Snia   else
9746abeab63Snia        have_doxygen=yes
9756abeab63Snia   fi
9766abeab63Sniaelif test "x$use_doxygen" = x"yes" ; then
9776abeab63Snia   AC_PATH_PROG([DOXYGEN], [doxygen])
9786abeab63Snia   if test "x$DOXYGEN" = "x"; then
9796abeab63Snia        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9806abeab63Snia   fi
9816abeab63Snia   have_doxygen=yes
9826abeab63Sniaelif test "x$use_doxygen" = x"no" ; then
9836abeab63Snia   if test "x$DOXYGEN" != "x"; then
9846abeab63Snia      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9856abeab63Snia   fi
9866abeab63Snia   have_doxygen=no
9876abeab63Sniaelse
9886abeab63Snia   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9896abeab63Sniafi
9906abeab63Sniam4_ifval([$1],
9916abeab63Snia[if test "$have_doxygen" = yes; then
9926abeab63Snia    # scrape the doxygen version
9936abeab63Snia    AC_MSG_CHECKING([the doxygen version])
9946abeab63Snia    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9956abeab63Snia    AC_MSG_RESULT([$doxygen_version])
9966abeab63Snia    AS_VERSION_COMPARE([$doxygen_version], [$1],
9976abeab63Snia        [if test "x$use_doxygen" = xauto; then
9986abeab63Snia            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9996abeab63Snia            have_doxygen=no
10006abeab63Snia        else
10016abeab63Snia            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10026abeab63Snia        fi])
10036abeab63Sniafi])
10046abeab63Snia
10056abeab63Sniadnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10066abeab63Sniadnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10076abeab63Sniadnl 	HAVE_DOT = @HAVE_DOT@
10086abeab63SniaHAVE_DOT=no
10096abeab63Sniaif test "x$have_doxygen" = "xyes"; then
10106abeab63Snia  AC_PATH_PROG([DOT], [dot])
10116abeab63Snia    if test "x$DOT" != "x"; then
10126abeab63Snia      HAVE_DOT=yes
10136abeab63Snia    fi
10146abeab63Sniafi
10156abeab63Snia
10166abeab63SniaAC_SUBST([HAVE_DOT])
10176abeab63SniaAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10186abeab63SniaAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10196abeab63Snia]) # XORG_WITH_DOXYGEN
10206abeab63Snia
10216abeab63Snia# XORG_WITH_GROFF([DEFAULT])
10226abeab63Snia# ----------------
10236abeab63Snia# Minimum version: 1.6.0
10246abeab63Snia# Minimum version for optional DEFAULT argument: 1.11.0
10256abeab63Snia#
10266abeab63Snia# Documentation tools are not always available on all platforms and sometimes
10276abeab63Snia# not at the appropriate level. This macro enables a module to test for the
10286abeab63Snia# presence of the tool and obtain it's path in separate variables. Coupled with
10296abeab63Snia# the --with-groff option, it allows maximum flexibilty in making decisions
10306abeab63Snia# as whether or not to use the groff package. When DEFAULT is not specified,
10316abeab63Snia# --with-groff assumes 'auto'.
10326abeab63Snia#
10336abeab63Snia# Interface to module:
10346abeab63Snia# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10356abeab63Snia# HAVE_GROFF_MM: the memorandum macros (-mm) package
10366abeab63Snia# HAVE_GROFF_MS: the -ms macros package
10376abeab63Snia# GROFF:	 returns the path of the groff program found
10386abeab63Snia#		 returns the path set by the user in the environment
10396abeab63Snia# --with-groff:	 'yes' user instructs the module to use groff
10406abeab63Snia#		 'no' user instructs the module not to use groff
10416abeab63Snia#
10426abeab63Snia# Added in version 1.9.0:
10436abeab63Snia# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10446abeab63Snia#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10456abeab63Snia#		   psselect from the psutils package.
10466abeab63Snia#		   the ghostcript package. Refer to the grohtml man pages
10476abeab63Snia#
10486abeab63Snia# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10496abeab63Snia#
10506abeab63Snia# OS and distros often splits groff in a basic and full package, the former
10516abeab63Snia# having the groff program and the later having devices, fonts and macros
10526abeab63Snia# Checking for the groff executable is not enough.
10536abeab63Snia#
10546abeab63Snia# If macros are missing, we cannot assume that groff is useless, so we don't
10556abeab63Snia# unset HAVE_GROFF or GROFF env variables.
10566abeab63Snia# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10576abeab63Snia#
10586abeab63SniaAC_DEFUN([XORG_WITH_GROFF],[
10596abeab63SniaAC_ARG_VAR([GROFF], [Path to groff command])
10606abeab63Sniam4_define([_defopt], m4_default([$1], [auto]))
10616abeab63SniaAC_ARG_WITH(groff,
10626abeab63Snia	AS_HELP_STRING([--with-groff],
10636abeab63Snia	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10646abeab63Snia	   [use_groff=$withval], [use_groff=]_defopt)
10656abeab63Sniam4_undefine([_defopt])
10666abeab63Snia
10676abeab63Sniaif test "x$use_groff" = x"auto"; then
10686abeab63Snia   AC_PATH_PROG([GROFF], [groff])
10696abeab63Snia   if test "x$GROFF" = "x"; then
10706abeab63Snia        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10716abeab63Snia	have_groff=no
10726abeab63Snia   else
10736abeab63Snia        have_groff=yes
10746abeab63Snia   fi
10756abeab63Sniaelif test "x$use_groff" = x"yes" ; then
10766abeab63Snia   AC_PATH_PROG([GROFF], [groff])
10776abeab63Snia   if test "x$GROFF" = "x"; then
10786abeab63Snia        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10796abeab63Snia   fi
10806abeab63Snia   have_groff=yes
10816abeab63Sniaelif test "x$use_groff" = x"no" ; then
10826abeab63Snia   if test "x$GROFF" != "x"; then
10836abeab63Snia      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10846abeab63Snia   fi
10856abeab63Snia   have_groff=no
10866abeab63Sniaelse
10876abeab63Snia   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10886abeab63Sniafi
10896abeab63Snia
10906abeab63Snia# We have groff, test for the presence of the macro packages
10916abeab63Sniaif test "x$have_groff" = x"yes"; then
10926abeab63Snia    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10936abeab63Snia    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10946abeab63Snia        groff_ms_works=yes
10956abeab63Snia    else
10966abeab63Snia        groff_ms_works=no
10976abeab63Snia    fi
10986abeab63Snia    AC_MSG_RESULT([$groff_ms_works])
10996abeab63Snia    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11006abeab63Snia    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11016abeab63Snia        groff_mm_works=yes
11026abeab63Snia    else
11036abeab63Snia        groff_mm_works=no
11046abeab63Snia    fi
11056abeab63Snia    AC_MSG_RESULT([$groff_mm_works])
11066abeab63Sniafi
11076abeab63Snia
11086abeab63Snia# We have groff, test for HTML dependencies, one command per package
11096abeab63Sniaif test "x$have_groff" = x"yes"; then
11106abeab63Snia   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11116abeab63Snia   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11126abeab63Snia   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11136abeab63Snia   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11146abeab63Snia      have_groff_html=yes
11156abeab63Snia   else
11166abeab63Snia      have_groff_html=no
11176abeab63Snia      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11186abeab63Snia   fi
11196abeab63Sniafi
11206abeab63Snia
11216abeab63Snia# Set Automake conditionals for Makefiles
11226abeab63SniaAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11236abeab63SniaAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11246abeab63SniaAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11256abeab63SniaAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11266abeab63Snia]) # XORG_WITH_GROFF
11276abeab63Snia
11286abeab63Snia# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11296abeab63Snia# ---------------------------------------
11306abeab63Snia# Minimum version: 1.6.0
11316abeab63Snia# Minimum version for optional DEFAULT argument: 1.11.0
11326abeab63Snia# Minimum version for optional MIN-VERSION argument: 1.15.0
11336abeab63Snia#
11346abeab63Snia# Documentation tools are not always available on all platforms and sometimes
11356abeab63Snia# not at the appropriate level. This macro enables a module to test for the
11366abeab63Snia# presence of the tool and obtain it's path in separate variables. Coupled with
11376abeab63Snia# the --with-fop option, it allows maximum flexibilty in making decisions
11386abeab63Snia# as whether or not to use the fop package. When DEFAULT is not specified,
11396abeab63Snia# --with-fop assumes 'auto'.
11406abeab63Snia#
11416abeab63Snia# Interface to module:
11426abeab63Snia# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11436abeab63Snia# FOP:	 	returns the path of the fop program found
11446abeab63Snia#		returns the path set by the user in the environment
11456abeab63Snia# --with-fop: 	'yes' user instructs the module to use fop
11466abeab63Snia#		'no' user instructs the module not to use fop
11476abeab63Snia#
11486abeab63Snia# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
11496abeab63Snia#
11506abeab63SniaAC_DEFUN([XORG_WITH_FOP],[
11516abeab63SniaAC_ARG_VAR([FOP], [Path to fop command])
11526abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
11536abeab63SniaAC_ARG_WITH(fop,
11546abeab63Snia	AS_HELP_STRING([--with-fop],
11556abeab63Snia	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11566abeab63Snia	   [use_fop=$withval], [use_fop=]_defopt)
11576abeab63Sniam4_undefine([_defopt])
11586abeab63Snia
11596abeab63Sniaif test "x$use_fop" = x"auto"; then
11606abeab63Snia   AC_PATH_PROG([FOP], [fop])
11616abeab63Snia   if test "x$FOP" = "x"; then
11626abeab63Snia        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11636abeab63Snia	have_fop=no
11646abeab63Snia   else
11656abeab63Snia        have_fop=yes
11666abeab63Snia   fi
11676abeab63Sniaelif test "x$use_fop" = x"yes" ; then
11686abeab63Snia   AC_PATH_PROG([FOP], [fop])
11696abeab63Snia   if test "x$FOP" = "x"; then
11706abeab63Snia        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11716abeab63Snia   fi
11726abeab63Snia   have_fop=yes
11736abeab63Sniaelif test "x$use_fop" = x"no" ; then
11746abeab63Snia   if test "x$FOP" != "x"; then
11756abeab63Snia      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11766abeab63Snia   fi
11776abeab63Snia   have_fop=no
11786abeab63Sniaelse
11796abeab63Snia   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11806abeab63Sniafi
11816abeab63Snia
11826abeab63Snia# Test for a minimum version of fop, if provided.
11836abeab63Sniam4_ifval([$1],
11846abeab63Snia[if test "$have_fop" = yes; then
11856abeab63Snia    # scrape the fop version
11866abeab63Snia    AC_MSG_CHECKING([for fop minimum version])
11876abeab63Snia    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11886abeab63Snia    AC_MSG_RESULT([$fop_version])
11896abeab63Snia    AS_VERSION_COMPARE([$fop_version], [$1],
11906abeab63Snia        [if test "x$use_fop" = xauto; then
11916abeab63Snia            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11926abeab63Snia            have_fop=no
11936abeab63Snia        else
11946abeab63Snia            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11956abeab63Snia        fi])
11966abeab63Sniafi])
11976abeab63SniaAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11986abeab63Snia]) # XORG_WITH_FOP
11996abeab63Snia
12006abeab63Snia# XORG_WITH_M4([MIN-VERSION])
12016abeab63Snia# ---------------------------
12026abeab63Snia# Minimum version: 1.19.0
12036abeab63Snia#
12046abeab63Snia# This macro attempts to locate an m4 macro processor which supports
12056abeab63Snia# -I option and is only useful for modules relying on M4 in order to
12066abeab63Snia# expand macros in source code files.
12076abeab63Snia#
12086abeab63Snia# Interface to module:
12096abeab63Snia# M4:	 	returns the path of the m4 program found
12106abeab63Snia#		returns the path set by the user in the environment
12116abeab63Snia#
12126abeab63SniaAC_DEFUN([XORG_WITH_M4], [
12136abeab63SniaAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12146abeab63Snia   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12156abeab63Snia       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12166abeab63Snia         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12176abeab63Snia   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12186abeab63Snia   [$PATH:/usr/gnu/bin])])
12196abeab63Snia
12206abeab63SniaAC_SUBST([M4], [$ac_cv_path_M4])
12216abeab63Snia]) # XORG_WITH_M4
12226abeab63Snia
12236abeab63Snia# XORG_WITH_PS2PDF([DEFAULT])
12246abeab63Snia# ----------------
12256abeab63Snia# Minimum version: 1.6.0
12266abeab63Snia# Minimum version for optional DEFAULT argument: 1.11.0
12276abeab63Snia#
12286abeab63Snia# Documentation tools are not always available on all platforms and sometimes
12296abeab63Snia# not at the appropriate level. This macro enables a module to test for the
12306abeab63Snia# presence of the tool and obtain it's path in separate variables. Coupled with
12316abeab63Snia# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12326abeab63Snia# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12336abeab63Snia# --with-ps2pdf assumes 'auto'.
12346abeab63Snia#
12356abeab63Snia# Interface to module:
12366abeab63Snia# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12376abeab63Snia# PS2PDF:	returns the path of the ps2pdf program found
12386abeab63Snia#		returns the path set by the user in the environment
12396abeab63Snia# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12406abeab63Snia#		 'no' user instructs the module not to use ps2pdf
12416abeab63Snia#
12426abeab63Snia# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12436abeab63Snia#
12446abeab63SniaAC_DEFUN([XORG_WITH_PS2PDF],[
12456abeab63SniaAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12466abeab63Sniam4_define([_defopt], m4_default([$1], [auto]))
12476abeab63SniaAC_ARG_WITH(ps2pdf,
12486abeab63Snia	AS_HELP_STRING([--with-ps2pdf],
12496abeab63Snia	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12506abeab63Snia	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12516abeab63Sniam4_undefine([_defopt])
12526abeab63Snia
12536abeab63Sniaif test "x$use_ps2pdf" = x"auto"; then
12546abeab63Snia   AC_PATH_PROG([PS2PDF], [ps2pdf])
12556abeab63Snia   if test "x$PS2PDF" = "x"; then
12566abeab63Snia        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12576abeab63Snia	have_ps2pdf=no
12586abeab63Snia   else
12596abeab63Snia        have_ps2pdf=yes
12606abeab63Snia   fi
12616abeab63Sniaelif test "x$use_ps2pdf" = x"yes" ; then
12626abeab63Snia   AC_PATH_PROG([PS2PDF], [ps2pdf])
12636abeab63Snia   if test "x$PS2PDF" = "x"; then
12646abeab63Snia        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12656abeab63Snia   fi
12666abeab63Snia   have_ps2pdf=yes
12676abeab63Sniaelif test "x$use_ps2pdf" = x"no" ; then
12686abeab63Snia   if test "x$PS2PDF" != "x"; then
12696abeab63Snia      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12706abeab63Snia   fi
12716abeab63Snia   have_ps2pdf=no
12726abeab63Sniaelse
12736abeab63Snia   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12746abeab63Sniafi
12756abeab63SniaAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12766abeab63Snia]) # XORG_WITH_PS2PDF
12776abeab63Snia
12786abeab63Snia# XORG_ENABLE_DOCS (enable_docs=yes)
12796abeab63Snia# ----------------
12806abeab63Snia# Minimum version: 1.6.0
12816abeab63Snia#
12826abeab63Snia# Documentation tools are not always available on all platforms and sometimes
12836abeab63Snia# not at the appropriate level. This macro enables a builder to skip all
12846abeab63Snia# documentation targets except traditional man pages.
12856abeab63Snia# Combined with the specific tool checking macros XORG_WITH_*, it provides
12866abeab63Snia# maximum flexibilty in controlling documentation building.
12876abeab63Snia# Refer to:
12886abeab63Snia# XORG_WITH_XMLTO         --with-xmlto
12896abeab63Snia# XORG_WITH_ASCIIDOC      --with-asciidoc
12906abeab63Snia# XORG_WITH_DOXYGEN       --with-doxygen
12916abeab63Snia# XORG_WITH_FOP           --with-fop
12926abeab63Snia# XORG_WITH_GROFF         --with-groff
12936abeab63Snia# XORG_WITH_PS2PDF        --with-ps2pdf
12946abeab63Snia#
12956abeab63Snia# Interface to module:
12966abeab63Snia# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12976abeab63Snia# --enable-docs: 'yes' user instructs the module to generate docs
12986abeab63Snia#		 'no' user instructs the module not to generate docs
12996abeab63Snia# parm1:	specify the default value, yes or no.
13006abeab63Snia#
13016abeab63SniaAC_DEFUN([XORG_ENABLE_DOCS],[
13026abeab63Sniam4_define([docs_default], m4_default([$1], [yes]))
13036abeab63SniaAC_ARG_ENABLE(docs,
13046abeab63Snia	AS_HELP_STRING([--enable-docs],
13056abeab63Snia	   [Enable building the documentation (default: ]docs_default[)]),
13066abeab63Snia	   [build_docs=$enableval], [build_docs=]docs_default)
13076abeab63Sniam4_undefine([docs_default])
13086abeab63SniaAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13096abeab63SniaAC_MSG_CHECKING([whether to build documentation])
13106abeab63SniaAC_MSG_RESULT([$build_docs])
13116abeab63Snia]) # XORG_ENABLE_DOCS
13126abeab63Snia
13136abeab63Snia# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13146abeab63Snia# ----------------
13156abeab63Snia# Minimum version: 1.6.0
13166abeab63Snia#
13176abeab63Snia# This macro enables a builder to skip all developer documentation.
13186abeab63Snia# Combined with the specific tool checking macros XORG_WITH_*, it provides
13196abeab63Snia# maximum flexibilty in controlling documentation building.
13206abeab63Snia# Refer to:
13216abeab63Snia# XORG_WITH_XMLTO         --with-xmlto
13226abeab63Snia# XORG_WITH_ASCIIDOC      --with-asciidoc
13236abeab63Snia# XORG_WITH_DOXYGEN       --with-doxygen
13246abeab63Snia# XORG_WITH_FOP           --with-fop
13256abeab63Snia# XORG_WITH_GROFF         --with-groff
13266abeab63Snia# XORG_WITH_PS2PDF        --with-ps2pdf
13276abeab63Snia#
13286abeab63Snia# Interface to module:
13296abeab63Snia# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13306abeab63Snia# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13316abeab63Snia#			'no' user instructs the module not to generate developer docs
13326abeab63Snia# parm1:		specify the default value, yes or no.
13336abeab63Snia#
13346abeab63SniaAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13356abeab63Sniam4_define([devel_default], m4_default([$1], [yes]))
13366abeab63SniaAC_ARG_ENABLE(devel-docs,
13376abeab63Snia	AS_HELP_STRING([--enable-devel-docs],
13386abeab63Snia	   [Enable building the developer documentation (default: ]devel_default[)]),
13396abeab63Snia	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13406abeab63Sniam4_undefine([devel_default])
13416abeab63SniaAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13426abeab63SniaAC_MSG_CHECKING([whether to build developer documentation])
13436abeab63SniaAC_MSG_RESULT([$build_devel_docs])
13446abeab63Snia]) # XORG_ENABLE_DEVEL_DOCS
13456abeab63Snia
13466abeab63Snia# XORG_ENABLE_SPECS (enable_specs=yes)
13476abeab63Snia# ----------------
13486abeab63Snia# Minimum version: 1.6.0
13496abeab63Snia#
13506abeab63Snia# This macro enables a builder to skip all functional specification targets.
13516abeab63Snia# Combined with the specific tool checking macros XORG_WITH_*, it provides
13526abeab63Snia# maximum flexibilty in controlling documentation building.
13536abeab63Snia# Refer to:
13546abeab63Snia# XORG_WITH_XMLTO         --with-xmlto
13556abeab63Snia# XORG_WITH_ASCIIDOC      --with-asciidoc
13566abeab63Snia# XORG_WITH_DOXYGEN       --with-doxygen
13576abeab63Snia# XORG_WITH_FOP           --with-fop
13586abeab63Snia# XORG_WITH_GROFF         --with-groff
13596abeab63Snia# XORG_WITH_PS2PDF        --with-ps2pdf
13606abeab63Snia#
13616abeab63Snia# Interface to module:
13626abeab63Snia# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13636abeab63Snia# --enable-specs:	'yes' user instructs the module to generate specs
13646abeab63Snia#			'no' user instructs the module not to generate specs
13656abeab63Snia# parm1:		specify the default value, yes or no.
13666abeab63Snia#
13676abeab63SniaAC_DEFUN([XORG_ENABLE_SPECS],[
13686abeab63Sniam4_define([spec_default], m4_default([$1], [yes]))
13696abeab63SniaAC_ARG_ENABLE(specs,
13706abeab63Snia	AS_HELP_STRING([--enable-specs],
13716abeab63Snia	   [Enable building the specs (default: ]spec_default[)]),
13726abeab63Snia	   [build_specs=$enableval], [build_specs=]spec_default)
13736abeab63Sniam4_undefine([spec_default])
13746abeab63SniaAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13756abeab63SniaAC_MSG_CHECKING([whether to build functional specifications])
13766abeab63SniaAC_MSG_RESULT([$build_specs])
13776abeab63Snia]) # XORG_ENABLE_SPECS
13786abeab63Snia
13796abeab63Snia# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13806abeab63Snia# ----------------------------------------------
13816abeab63Snia# Minimum version: 1.13.0
13826abeab63Snia#
13836abeab63Snia# This macro enables a builder to enable/disable unit testing
13846abeab63Snia# It makes no assumption about the test cases implementation
13856abeab63Snia# Test cases may or may not use Automake "Support for test suites"
13866abeab63Snia# They may or may not use the software utility library GLib
13876abeab63Snia#
13886abeab63Snia# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13896abeab63Snia# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13906abeab63Snia# The variable enable_unit_tests is used by other macros in this file.
13916abeab63Snia#
13926abeab63Snia# Interface to module:
13936abeab63Snia# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13946abeab63Snia# enable_unit_tests:    used in configure.ac for additional configuration
13956abeab63Snia# --enable-unit-tests:	'yes' user instructs the module to build tests
13966abeab63Snia#			'no' user instructs the module not to build tests
13976abeab63Snia# parm1:		specify the default value, yes or no.
13986abeab63Snia#
13996abeab63SniaAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14006abeab63SniaAC_BEFORE([$0], [XORG_WITH_GLIB])
14016abeab63SniaAC_BEFORE([$0], [XORG_LD_WRAP])
14026abeab63SniaAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14036abeab63Sniam4_define([_defopt], m4_default([$1], [auto]))
14046abeab63SniaAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14056abeab63Snia	[Enable building unit test cases (default: ]_defopt[)]),
14066abeab63Snia	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14076abeab63Sniam4_undefine([_defopt])
14086abeab63SniaAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14096abeab63SniaAC_MSG_CHECKING([whether to build unit test cases])
14106abeab63SniaAC_MSG_RESULT([$enable_unit_tests])
14116abeab63Snia]) # XORG_ENABLE_UNIT_TESTS
14126abeab63Snia
14136abeab63Snia# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14146abeab63Snia# ------------------------------------------------------
14156abeab63Snia# Minimum version: 1.17.0
14166abeab63Snia#
14176abeab63Snia# This macro enables a builder to enable/disable integration testing
14186abeab63Snia# It makes no assumption about the test cases' implementation
14196abeab63Snia# Test cases may or may not use Automake "Support for test suites"
14206abeab63Snia#
14216abeab63Snia# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14226abeab63Snia# usually requires less dependencies and may be built and run under less
14236abeab63Snia# stringent environments than integration tests.
14246abeab63Snia#
14256abeab63Snia# Interface to module:
14266abeab63Snia# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14276abeab63Snia# enable_integration_tests:   used in configure.ac for additional configuration
14286abeab63Snia# --enable-integration-tests: 'yes' user instructs the module to build tests
14296abeab63Snia#                             'no' user instructs the module not to build tests
14306abeab63Snia# parm1:                      specify the default value, yes or no.
14316abeab63Snia#
14326abeab63SniaAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14336abeab63SniaAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14346abeab63Sniam4_define([_defopt], m4_default([$1], [auto]))
14356abeab63SniaAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14366abeab63Snia	[Enable building integration test cases (default: ]_defopt[)]),
14376abeab63Snia	[enable_integration_tests=$enableval],
14386abeab63Snia	[enable_integration_tests=]_defopt)
14396abeab63Sniam4_undefine([_defopt])
14406abeab63SniaAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14416abeab63Snia	[test "x$enable_integration_tests" != xno])
14426abeab63SniaAC_MSG_CHECKING([whether to build unit test cases])
14436abeab63SniaAC_MSG_RESULT([$enable_integration_tests])
14446abeab63Snia]) # XORG_ENABLE_INTEGRATION_TESTS
14456abeab63Snia
14466abeab63Snia# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14476abeab63Snia# ----------------------------------------
14486abeab63Snia# Minimum version: 1.13.0
14496abeab63Snia#
14506abeab63Snia# GLib is a library which provides advanced data structures and functions.
14516abeab63Snia# This macro enables a module to test for the presence of Glib.
14526abeab63Snia#
14536abeab63Snia# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14546abeab63Snia# Otherwise the value of $enable_unit_tests is blank.
14556abeab63Snia#
14566abeab63Snia# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14576abeab63Snia# test support usually requires less dependencies and may be built and run under
14586abeab63Snia# less stringent environments than integration tests.
14596abeab63Snia#
14606abeab63Snia# Interface to module:
14616abeab63Snia# HAVE_GLIB: used in makefiles to conditionally build targets
14626abeab63Snia# with_glib: used in configure.ac to know if GLib has been found
14636abeab63Snia# --with-glib:	'yes' user instructs the module to use glib
14646abeab63Snia#		'no' user instructs the module not to use glib
14656abeab63Snia#
14666abeab63SniaAC_DEFUN([XORG_WITH_GLIB],[
14676abeab63SniaAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14686abeab63Sniam4_define([_defopt], m4_default([$2], [auto]))
14696abeab63SniaAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14706abeab63Snia	[Use GLib library for unit testing (default: ]_defopt[)]),
14716abeab63Snia	[with_glib=$withval], [with_glib=]_defopt)
14726abeab63Sniam4_undefine([_defopt])
14736abeab63Snia
14746abeab63Sniahave_glib=no
14756abeab63Snia# Do not probe GLib if user explicitly disabled unit testing
14766abeab63Sniaif test "x$enable_unit_tests" != x"no"; then
14776abeab63Snia  # Do not probe GLib if user explicitly disabled it
14786abeab63Snia  if test "x$with_glib" != x"no"; then
14796abeab63Snia    m4_ifval(
14806abeab63Snia      [$1],
14816abeab63Snia      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14826abeab63Snia      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14836abeab63Snia    )
14846abeab63Snia  fi
14856abeab63Sniafi
14866abeab63Snia
14876abeab63Snia# Not having GLib when unit testing has been explicitly requested is an error
14886abeab63Sniaif test "x$enable_unit_tests" = x"yes"; then
14896abeab63Snia  if test "x$have_glib" = x"no"; then
14906abeab63Snia    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14916abeab63Snia  fi
14926abeab63Sniafi
14936abeab63Snia
14946abeab63Snia# Having unit testing disabled when GLib has been explicitly requested is an error
14956abeab63Sniaif test "x$enable_unit_tests" = x"no"; then
14966abeab63Snia  if test "x$with_glib" = x"yes"; then
14976abeab63Snia    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14986abeab63Snia  fi
14996abeab63Sniafi
15006abeab63Snia
15016abeab63Snia# Not having GLib when it has been explicitly requested is an error
15026abeab63Sniaif test "x$with_glib" = x"yes"; then
15036abeab63Snia  if test "x$have_glib" = x"no"; then
15046abeab63Snia    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15056abeab63Snia  fi
15066abeab63Sniafi
15076abeab63Snia
15086abeab63SniaAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15096abeab63Snia]) # XORG_WITH_GLIB
15106abeab63Snia
15116abeab63Snia# XORG_LD_WRAP([required|optional])
15126abeab63Snia# ---------------------------------
15136abeab63Snia# Minimum version: 1.13.0
15146abeab63Snia#
15156abeab63Snia# Check if linker supports -wrap, passed via compiler flags
15166abeab63Snia#
15176abeab63Snia# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15186abeab63Snia# Otherwise the value of $enable_unit_tests is blank.
15196abeab63Snia#
15206abeab63Snia# Argument added in 1.16.0 - default is "required", to match existing behavior
15216abeab63Snia# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15226abeab63Snia# available, an argument of "optional" allows use when some unit tests require
15236abeab63Snia# ld -wrap and others do not.
15246abeab63Snia#
15256abeab63SniaAC_DEFUN([XORG_LD_WRAP],[
15266abeab63SniaXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15276abeab63Snia    [AC_LANG_PROGRAM([#include <stdlib.h>
15286abeab63Snia                      void __wrap_exit(int status) { return; }],
15296abeab63Snia                     [exit(0);])])
15306abeab63Snia# Not having ld wrap when unit testing has been explicitly requested is an error
15316abeab63Sniaif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15326abeab63Snia  if test "x$have_ld_wrap" = x"no"; then
15336abeab63Snia    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15346abeab63Snia  fi
15356abeab63Sniafi
15366abeab63SniaAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15376abeab63Snia#
15386abeab63Snia]) # XORG_LD_WRAP
15396abeab63Snia
15406abeab63Snia# XORG_CHECK_LINKER_FLAGS
15416abeab63Snia# -----------------------
15426abeab63Snia# SYNOPSIS
15436abeab63Snia#
15446abeab63Snia#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15456abeab63Snia#
15466abeab63Snia# DESCRIPTION
15476abeab63Snia#
15486abeab63Snia#   Check whether the given linker FLAGS work with the current language's
15496abeab63Snia#   linker, or whether they give an error.
15506abeab63Snia#
15516abeab63Snia#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15526abeab63Snia#   success/failure.
15536abeab63Snia#
15546abeab63Snia#   PROGRAM-SOURCE is the program source to link with, if needed
15556abeab63Snia#
15566abeab63Snia#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15576abeab63Snia#
15586abeab63Snia# LICENSE
15596abeab63Snia#
15606abeab63Snia#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15616abeab63Snia#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15626abeab63Snia#   Copyright (c) 2009 Matteo Frigo
15636abeab63Snia#
15646abeab63Snia#   This program is free software: you can redistribute it and/or modify it
15656abeab63Snia#   under the terms of the GNU General Public License as published by the
15666abeab63Snia#   Free Software Foundation, either version 3 of the License, or (at your
15676abeab63Snia#   option) any later version.
15686abeab63Snia#
15696abeab63Snia#   This program is distributed in the hope that it will be useful, but
15706abeab63Snia#   WITHOUT ANY WARRANTY; without even the implied warranty of
15716abeab63Snia#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15726abeab63Snia#   Public License for more details.
15736abeab63Snia#
15746abeab63Snia#   You should have received a copy of the GNU General Public License along
15756abeab63Snia#   with this program. If not, see <http://www.gnu.org/licenses/>.
15766abeab63Snia#
15776abeab63Snia#   As a special exception, the respective Autoconf Macro's copyright owner
15786abeab63Snia#   gives unlimited permission to copy, distribute and modify the configure
15796abeab63Snia#   scripts that are the output of Autoconf when processing the Macro. You
15806abeab63Snia#   need not follow the terms of the GNU General Public License when using
15816abeab63Snia#   or distributing such scripts, even though portions of the text of the
15826abeab63Snia#   Macro appear in them. The GNU General Public License (GPL) does govern
15836abeab63Snia#   all other use of the material that constitutes the Autoconf Macro.
15846abeab63Snia#
15856abeab63Snia#   This special exception to the GPL applies to versions of the Autoconf
15866abeab63Snia#   Macro released by the Autoconf Archive. When you make and distribute a
15876abeab63Snia#   modified version of the Autoconf Macro, you may extend this special
15886abeab63Snia#   exception to the GPL to apply to your modified version as well.#
15896abeab63SniaAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15906abeab63Snia[AC_MSG_CHECKING([whether the linker accepts $1])
15916abeab63Sniadnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15926abeab63SniaAS_LITERAL_IF([$1],
15936abeab63Snia  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15946abeab63Snia      ax_save_FLAGS=$LDFLAGS
15956abeab63Snia      LDFLAGS="$1"
15966abeab63Snia      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15976abeab63Snia        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15986abeab63Snia        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15996abeab63Snia      LDFLAGS=$ax_save_FLAGS])],
16006abeab63Snia  [ax_save_FLAGS=$LDFLAGS
16016abeab63Snia   LDFLAGS="$1"
16026abeab63Snia   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16036abeab63Snia     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16046abeab63Snia     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16056abeab63Snia   LDFLAGS=$ax_save_FLAGS])
16066abeab63Sniaeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16076abeab63SniaAC_MSG_RESULT($xorg_check_linker_flags)
16086abeab63Sniaif test "x$xorg_check_linker_flags" = xyes; then
16096abeab63Snia	m4_default([$2], :)
16106abeab63Sniaelse
16116abeab63Snia	m4_default([$3], :)
16126abeab63Sniafi
16136abeab63Snia]) # XORG_CHECK_LINKER_FLAGS
16146abeab63Snia
16156abeab63Snia# XORG_MEMORY_CHECK_FLAGS
16166abeab63Snia# -----------------------
16176abeab63Snia# Minimum version: 1.16.0
16186abeab63Snia#
16196abeab63Snia# This macro attempts to find appropriate memory checking functionality
16206abeab63Snia# for various platforms which unit testing code may use to catch various
16216abeab63Snia# forms of memory allocation and access errors in testing.
16226abeab63Snia#
16236abeab63Snia# Interface to module:
16246abeab63Snia# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16256abeab63Snia#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16266abeab63Snia#
16276abeab63Snia# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16286abeab63Snia#
16296abeab63SniaAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16306abeab63Snia
16316abeab63SniaAC_REQUIRE([AC_CANONICAL_HOST])
16326abeab63SniaAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16336abeab63Snia           [Environment variables to enable memory checking in tests])
16346abeab63Snia
16356abeab63Snia# Check for different types of support on different platforms
16366abeab63Sniacase $host_os in
16376abeab63Snia    solaris*)
16386abeab63Snia        AC_CHECK_LIB([umem], [umem_alloc],
16396abeab63Snia            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16406abeab63Snia        ;;
16416abeab63Snia    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16426abeab63Snia        # both directly and inverted, so should not be 0 or 255.
16436abeab63Snia        malloc_debug_env='MALLOC_PERTURB_=15'
16446abeab63Snia        ;;
16456abeab63Snia    darwin*)
16466abeab63Snia        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16476abeab63Snia        ;;
16486abeab63Snia    *bsd*)
16496abeab63Snia        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16506abeab63Snia        ;;
16516abeab63Sniaesac
16526abeab63Snia
16536abeab63Snia# User supplied flags override default flags
16546abeab63Sniaif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16556abeab63Snia    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16566abeab63Sniafi
16576abeab63Snia
16586abeab63SniaAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16596abeab63Snia]) # XORG_WITH_LINT
16606abeab63Snia
16616abeab63Snia# XORG_CHECK_MALLOC_ZERO
16626abeab63Snia# ----------------------
16636abeab63Snia# Minimum version: 1.0.0
16646abeab63Snia#
16656abeab63Snia# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16666abeab63Snia# malloc(0) returns NULL.  Packages should add one of these cflags to
16676abeab63Snia# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16686abeab63SniaAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16696abeab63SniaAC_ARG_ENABLE(malloc0returnsnull,
16706abeab63Snia	AS_HELP_STRING([--enable-malloc0returnsnull],
16716abeab63Snia		       [malloc(0) returns NULL (default: auto)]),
16726abeab63Snia	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16736abeab63Snia	[MALLOC_ZERO_RETURNS_NULL=auto])
16746abeab63Snia
16756abeab63SniaAC_MSG_CHECKING([whether malloc(0) returns NULL])
16766abeab63Sniaif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16776abeab63SniaAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16786abeab63Snia	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16796abeab63Snia#include <stdlib.h>
16806abeab63Snia],[
16816abeab63Snia    char *m0, *r0, *c0, *p;
16826abeab63Snia    m0 = malloc(0);
16836abeab63Snia    p = malloc(10);
16846abeab63Snia    r0 = realloc(p,0);
16856abeab63Snia    c0 = calloc(0,10);
16866abeab63Snia    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16876abeab63Snia])],
16886abeab63Snia		[xorg_cv_malloc0_returns_null=yes],
16896abeab63Snia		[xorg_cv_malloc0_returns_null=no])])
16906abeab63SniaMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16916abeab63Sniafi
16926abeab63SniaAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16936abeab63Snia
16946abeab63Sniaif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16956abeab63Snia	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16966abeab63Snia	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16976abeab63Snia	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16986abeab63Sniaelse
16996abeab63Snia	MALLOC_ZERO_CFLAGS=""
17006abeab63Snia	XMALLOC_ZERO_CFLAGS=""
17016abeab63Snia	XTMALLOC_ZERO_CFLAGS=""
17026abeab63Sniafi
17036abeab63Snia
17046abeab63SniaAC_SUBST([MALLOC_ZERO_CFLAGS])
17056abeab63SniaAC_SUBST([XMALLOC_ZERO_CFLAGS])
17066abeab63SniaAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17076abeab63Snia]) # XORG_CHECK_MALLOC_ZERO
17086abeab63Snia
17096abeab63Snia# XORG_WITH_LINT()
17106abeab63Snia# ----------------
17116abeab63Snia# Minimum version: 1.1.0
17126abeab63Snia#
17136abeab63Snia# This macro enables the use of a tool that flags some suspicious and
17146abeab63Snia# non-portable constructs (likely to be bugs) in C language source code.
17156abeab63Snia# It will attempt to locate the tool and use appropriate options.
17166abeab63Snia# There are various lint type tools on different platforms.
17176abeab63Snia#
17186abeab63Snia# Interface to module:
17196abeab63Snia# LINT:		returns the path to the tool found on the platform
17206abeab63Snia#		or the value set to LINT on the configure cmd line
17216abeab63Snia#		also an Automake conditional
17226abeab63Snia# LINT_FLAGS:	an Automake variable with appropriate flags
17236abeab63Snia#
17246abeab63Snia# --with-lint:	'yes' user instructs the module to use lint
17256abeab63Snia#		'no' user instructs the module not to use lint (default)
17266abeab63Snia#
17276abeab63Snia# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17286abeab63Snia# If the user sets the value of LINT_FLAGS, they are used verbatim.
17296abeab63Snia#
17306abeab63SniaAC_DEFUN([XORG_WITH_LINT],[
17316abeab63Snia
17326abeab63SniaAC_ARG_VAR([LINT], [Path to a lint-style command])
17336abeab63SniaAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17346abeab63SniaAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17356abeab63Snia		[Use a lint-style source code checker (default: disabled)])],
17366abeab63Snia		[use_lint=$withval], [use_lint=no])
17376abeab63Snia
17386abeab63Snia# Obtain platform specific info like program name and options
17396abeab63Snia# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17406abeab63Sniacase $host_os in
17416abeab63Snia  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17426abeab63Snia	lint_name=splint
17436abeab63Snia	lint_options="-badflag"
17446abeab63Snia	;;
17456abeab63Snia  *freebsd* | *netbsd*)
17466abeab63Snia	lint_name=lint
17476abeab63Snia	lint_options="-u -b"
17486abeab63Snia	;;
17496abeab63Snia  *solaris*)
17506abeab63Snia	lint_name=lint
17516abeab63Snia	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17526abeab63Snia	;;
17536abeab63Sniaesac
17546abeab63Snia
17556abeab63Snia# Test for the presence of the program (either guessed by the code or spelled out by the user)
17566abeab63Sniaif test "x$use_lint" = x"yes" ; then
17576abeab63Snia   AC_PATH_PROG([LINT], [$lint_name])
17586abeab63Snia   if test "x$LINT" = "x"; then
17596abeab63Snia        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17606abeab63Snia   fi
17616abeab63Sniaelif test "x$use_lint" = x"no" ; then
17626abeab63Snia   if test "x$LINT" != "x"; then
17636abeab63Snia      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17646abeab63Snia   fi
17656abeab63Sniaelse
17666abeab63Snia   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17676abeab63Sniafi
17686abeab63Snia
17696abeab63Snia# User supplied flags override default flags
17706abeab63Sniaif test "x$LINT_FLAGS" != "x"; then
17716abeab63Snia   lint_options=$LINT_FLAGS
17726abeab63Sniafi
17736abeab63Snia
17746abeab63SniaAC_SUBST([LINT_FLAGS],[$lint_options])
17756abeab63SniaAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17766abeab63Snia
17776abeab63Snia]) # XORG_WITH_LINT
17786abeab63Snia
17796abeab63Snia# XORG_LINT_LIBRARY(LIBNAME)
17806abeab63Snia# --------------------------
17816abeab63Snia# Minimum version: 1.1.0
17826abeab63Snia#
17836abeab63Snia# Sets up flags for building lint libraries for checking programs that call
17846abeab63Snia# functions in the library.
17856abeab63Snia#
17866abeab63Snia# Interface to module:
17876abeab63Snia# LINTLIB		- Automake variable with the name of lint library file to make
17886abeab63Snia# MAKE_LINT_LIB		- Automake conditional
17896abeab63Snia#
17906abeab63Snia# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17916abeab63Snia#			  - 'no' user instructs the module not to create a lint library (default)
17926abeab63Snia
17936abeab63SniaAC_DEFUN([XORG_LINT_LIBRARY],[
17946abeab63SniaAC_REQUIRE([XORG_WITH_LINT])
17956abeab63SniaAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17966abeab63Snia	[Create lint library (default: disabled)])],
17976abeab63Snia	[make_lint_lib=$enableval], [make_lint_lib=no])
17986abeab63Snia
17996abeab63Sniaif test "x$make_lint_lib" = x"yes" ; then
18006abeab63Snia   LINTLIB=llib-l$1.ln
18016abeab63Snia   if test "x$LINT" = "x"; then
18026abeab63Snia        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18036abeab63Snia   fi
18046abeab63Sniaelif test "x$make_lint_lib" != x"no" ; then
18056abeab63Snia   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18066abeab63Sniafi
18076abeab63Snia
18086abeab63SniaAC_SUBST(LINTLIB)
18096abeab63SniaAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18106abeab63Snia
18116abeab63Snia]) # XORG_LINT_LIBRARY
18126abeab63Snia
18136abeab63Snia# XORG_COMPILER_BRAND
18146abeab63Snia# -------------------
18156abeab63Snia# Minimum version: 1.14.0
18166abeab63Snia#
18176abeab63Snia# Checks for various brands of compilers and sets flags as appropriate:
18186abeab63Snia#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18196abeab63Snia#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18206abeab63Snia#   clang compiler - sets CLANGCC to "yes"
18216abeab63Snia#   Intel compiler - sets INTELCC to "yes"
18226abeab63Snia#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18236abeab63Snia#
18246abeab63SniaAC_DEFUN([XORG_COMPILER_BRAND], [
18256abeab63SniaAC_LANG_CASE(
18266abeab63Snia	[C], [
18276abeab63Snia		AC_REQUIRE([AC_PROG_CC_C99])
18286abeab63Snia	],
18296abeab63Snia	[C++], [
18306abeab63Snia		AC_REQUIRE([AC_PROG_CXX])
18316abeab63Snia	]
18326abeab63Snia)
18336abeab63SniaAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18346abeab63SniaAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18356abeab63SniaAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18366abeab63Snia]) # XORG_COMPILER_BRAND
18376abeab63Snia
18386abeab63Snia# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18396abeab63Snia# ---------------
18406abeab63Snia# Minimum version: 1.16.0
18416abeab63Snia#
18426abeab63Snia# Test if the compiler works when passed the given flag as a command line argument.
18436abeab63Snia# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18446abeab63Snia# next flag in the list until there are no more options.
18456abeab63Snia#
18466abeab63Snia# Note that this does not guarantee that the compiler supports the flag as some
18476abeab63Snia# compilers will simply ignore arguments that they do not understand, but we do
18486abeab63Snia# attempt to weed out false positives by using -Werror=unknown-warning-option and
18496abeab63Snia# -Werror=unused-command-line-argument
18506abeab63Snia#
18516abeab63SniaAC_DEFUN([XORG_TESTSET_CFLAG], [
18526abeab63Sniam4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18536abeab63Sniam4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18546abeab63Snia
18556abeab63SniaAC_LANG_COMPILER_REQUIRE
18566abeab63Snia
18576abeab63SniaAC_LANG_CASE(
18586abeab63Snia	[C], [
18596abeab63Snia		AC_REQUIRE([AC_PROG_CC_C99])
18606abeab63Snia		define([PREFIX], [C])
18616abeab63Snia		define([CACHE_PREFIX], [cc])
18626abeab63Snia		define([COMPILER], [$CC])
18636abeab63Snia	],
18646abeab63Snia	[C++], [
18656abeab63Snia		define([PREFIX], [CXX])
18666abeab63Snia		define([CACHE_PREFIX], [cxx])
18676abeab63Snia		define([COMPILER], [$CXX])
18686abeab63Snia	]
18696abeab63Snia)
18706abeab63Snia
18716abeab63Snia[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18726abeab63Snia
18736abeab63Sniaif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18746abeab63Snia	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18756abeab63Snia	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18766abeab63Snia			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18776abeab63Snia			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18786abeab63Snia					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18796abeab63Snia					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18806abeab63Snia	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18816abeab63Snia	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18826abeab63Sniafi
18836abeab63Snia
18846abeab63Sniaif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18856abeab63Snia	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18866abeab63Snia		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18876abeab63Snia	fi
18886abeab63Snia	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18896abeab63Snia	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18906abeab63Snia			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18916abeab63Snia			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18926abeab63Snia					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18936abeab63Snia					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18946abeab63Snia	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18956abeab63Snia	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18966abeab63Sniafi
18976abeab63Snia
18986abeab63Sniafound="no"
18996abeab63Sniam4_foreach([flag], m4_cdr($@), [
19006abeab63Snia	if test $found = "no" ; then
19016abeab63Snia		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19026abeab63Snia			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19036abeab63Snia		fi
19046abeab63Snia
19056abeab63Snia		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19066abeab63Snia			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19076abeab63Snia		fi
19086abeab63Snia
19096abeab63Snia		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19106abeab63Snia
19116abeab63Sniadnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19126abeab63Snia		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19136abeab63Snia		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19146abeab63Snia		AC_CACHE_VAL($cacheid,
19156abeab63Snia			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19166abeab63Snia					     [eval $cacheid=yes],
19176abeab63Snia					     [eval $cacheid=no])])
19186abeab63Snia
19196abeab63Snia		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19206abeab63Snia
19216abeab63Snia		eval supported=\$$cacheid
19226abeab63Snia		AC_MSG_RESULT([$supported])
19236abeab63Snia		if test "$supported" = "yes" ; then
19246abeab63Snia			$1="$$1 ]flag["
19256abeab63Snia			found="yes"
19266abeab63Snia		fi
19276abeab63Snia	fi
19286abeab63Snia])
19296abeab63Snia]) # XORG_TESTSET_CFLAG
19306abeab63Snia
19316abeab63Snia# XORG_COMPILER_FLAGS
19326abeab63Snia# ---------------
19336abeab63Snia# Minimum version: 1.16.0
19346abeab63Snia#
19356abeab63Snia# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19366abeab63Snia# arguments supported by the selected compiler which do NOT alter the generated
19376abeab63Snia# code.  These arguments will cause the compiler to print various warnings
19386abeab63Snia# during compilation AND turn a conservative set of warnings into errors.
19396abeab63Snia#
19406abeab63Snia# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19416abeab63Snia# future versions of util-macros as options are added to new compilers.
19426abeab63Snia#
19436abeab63SniaAC_DEFUN([XORG_COMPILER_FLAGS], [
19446abeab63SniaAC_REQUIRE([XORG_COMPILER_BRAND])
19456abeab63Snia
19466abeab63SniaAC_ARG_ENABLE(selective-werror,
19476abeab63Snia              AS_HELP_STRING([--disable-selective-werror],
19486abeab63Snia                             [Turn off selective compiler errors. (default: enabled)]),
19496abeab63Snia              [SELECTIVE_WERROR=$enableval],
19506abeab63Snia              [SELECTIVE_WERROR=yes])
19516abeab63Snia
19526abeab63SniaAC_LANG_CASE(
19536abeab63Snia        [C], [
19546abeab63Snia                define([PREFIX], [C])
19556abeab63Snia        ],
19566abeab63Snia        [C++], [
19576abeab63Snia                define([PREFIX], [CXX])
19586abeab63Snia        ]
19596abeab63Snia)
19606abeab63Snia# -v is too short to test reliably with XORG_TESTSET_CFLAG
19616abeab63Sniaif test "x$SUNCC" = "xyes"; then
19626abeab63Snia    [BASE_]PREFIX[FLAGS]="-v"
19636abeab63Sniaelse
19646abeab63Snia    [BASE_]PREFIX[FLAGS]=""
19656abeab63Sniafi
19666abeab63Snia
19676abeab63Snia# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19686abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19696abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19706abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19716abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19726abeab63Snia
19736abeab63SniaAC_LANG_CASE(
19746abeab63Snia	[C], [
19756abeab63Snia		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19766abeab63Snia		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19776abeab63Snia		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19786abeab63Snia		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19796abeab63Snia		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19806abeab63Snia		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19816abeab63Snia	]
19826abeab63Snia)
19836abeab63Snia
19846abeab63Snia# This chunk adds additional warnings that could catch undesired effects.
19856abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19866abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19876abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19886abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19896abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19906abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19916abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19926abeab63Snia
19936abeab63Snia# These are currently disabled because they are noisy.  They will be enabled
19946abeab63Snia# in the future once the codebase is sufficiently modernized to silence
19956abeab63Snia# them.  For now, I don't want them to drown out the other warnings.
19966abeab63Snia# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19976abeab63Snia# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19986abeab63Snia# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19996abeab63Snia
20006abeab63Snia# Turn some warnings into errors, so we don't accidently get successful builds
20016abeab63Snia# when there are problems that should be fixed.
20026abeab63Snia
20036abeab63Sniaif test "x$SELECTIVE_WERROR" = "xyes" ; then
20046abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20056abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20066abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20076abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20086abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20096abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20106abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20116abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20126abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20136abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20146abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20156abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20166abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20176abeab63Sniaelse
20186abeab63SniaAC_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])
20196abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20206abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20216abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20226abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20236abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20246abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20256abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20266abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20276abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20286abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20296abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20306abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20316abeab63SniaXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20326abeab63Sniafi
20336abeab63Snia
20346abeab63SniaAC_SUBST([BASE_]PREFIX[FLAGS])
20356abeab63Snia]) # XORG_COMPILER_FLAGS
20366abeab63Snia
20376abeab63Snia# XORG_CWARNFLAGS
20386abeab63Snia# ---------------
20396abeab63Snia# Minimum version: 1.2.0
20406abeab63Snia# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20416abeab63Snia#
20426abeab63Snia# Defines CWARNFLAGS to enable C compiler warnings.
20436abeab63Snia#
20446abeab63Snia# This function is deprecated because it defines -fno-strict-aliasing
20456abeab63Snia# which alters the code generated by the compiler.  If -fno-strict-aliasing
20466abeab63Snia# is needed, then it should be added explicitly in the module when
20476abeab63Snia# it is updated to use BASE_CFLAGS.
20486abeab63Snia#
20496abeab63SniaAC_DEFUN([XORG_CWARNFLAGS], [
20506abeab63SniaAC_REQUIRE([XORG_COMPILER_FLAGS])
20516abeab63SniaAC_REQUIRE([XORG_COMPILER_BRAND])
20526abeab63SniaAC_LANG_CASE(
20536abeab63Snia	[C], [
20546abeab63Snia		CWARNFLAGS="$BASE_CFLAGS"
20556abeab63Snia		if  test "x$GCC" = xyes ; then
20566abeab63Snia		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20576abeab63Snia		fi
20586abeab63Snia		AC_SUBST(CWARNFLAGS)
20596abeab63Snia	]
20606abeab63Snia)
20616abeab63Snia]) # XORG_CWARNFLAGS
20626abeab63Snia
20636abeab63Snia# XORG_STRICT_OPTION
20646abeab63Snia# -----------------------
20656abeab63Snia# Minimum version: 1.3.0
20666abeab63Snia#
20676abeab63Snia# Add configure option to enable strict compilation flags, such as treating
20686abeab63Snia# warnings as fatal errors.
20696abeab63Snia# If --enable-strict-compilation is passed to configure, adds strict flags to
20706abeab63Snia# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20716abeab63Snia#
20726abeab63Snia# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20736abeab63Snia# when strict compilation is unconditionally desired.
20746abeab63SniaAC_DEFUN([XORG_STRICT_OPTION], [
20756abeab63SniaAC_REQUIRE([XORG_CWARNFLAGS])
20766abeab63SniaAC_REQUIRE([XORG_COMPILER_FLAGS])
20776abeab63Snia
20786abeab63SniaAC_ARG_ENABLE(strict-compilation,
20796abeab63Snia			  AS_HELP_STRING([--enable-strict-compilation],
20806abeab63Snia			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20816abeab63Snia			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20826abeab63Snia
20836abeab63SniaAC_LANG_CASE(
20846abeab63Snia        [C], [
20856abeab63Snia                define([PREFIX], [C])
20866abeab63Snia        ],
20876abeab63Snia        [C++], [
20886abeab63Snia                define([PREFIX], [CXX])
20896abeab63Snia        ]
20906abeab63Snia)
20916abeab63Snia
20926abeab63Snia[STRICT_]PREFIX[FLAGS]=""
20936abeab63SniaXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20946abeab63SniaXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
20956abeab63Snia
20966abeab63Snia# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20976abeab63Snia# activate it with -Werror, so we add it here explicitly.
20986abeab63SniaXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20996abeab63Snia
21006abeab63Sniaif test "x$STRICT_COMPILE" = "xyes"; then
21016abeab63Snia    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21026abeab63Snia    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21036abeab63Sniafi
21046abeab63SniaAC_SUBST([STRICT_]PREFIX[FLAGS])
21056abeab63SniaAC_SUBST([BASE_]PREFIX[FLAGS])
21066abeab63SniaAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21076abeab63Snia]) # XORG_STRICT_OPTION
21086abeab63Snia
21096abeab63Snia# XORG_DEFAULT_OPTIONS
21106abeab63Snia# --------------------
21116abeab63Snia# Minimum version: 1.3.0
21126abeab63Snia#
21136abeab63Snia# Defines default options for X.Org modules.
21146abeab63Snia#
21156abeab63SniaAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21166abeab63SniaAC_REQUIRE([AC_PROG_INSTALL])
21176abeab63SniaXORG_COMPILER_FLAGS
21186abeab63SniaXORG_CWARNFLAGS
21196abeab63SniaXORG_STRICT_OPTION
21206abeab63SniaXORG_RELEASE_VERSION
21216abeab63SniaXORG_CHANGELOG
21226abeab63SniaXORG_INSTALL
21236abeab63SniaXORG_MANPAGE_SECTIONS
21246abeab63Sniam4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21256abeab63Snia    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21266abeab63Snia]) # XORG_DEFAULT_OPTIONS
21276abeab63Snia
21286abeab63Snia# XORG_INSTALL()
21296abeab63Snia# ----------------
21306abeab63Snia# Minimum version: 1.4.0
21316abeab63Snia#
21326abeab63Snia# Defines the variable INSTALL_CMD as the command to copy
21336abeab63Snia# INSTALL from $prefix/share/util-macros.
21346abeab63Snia#
21356abeab63SniaAC_DEFUN([XORG_INSTALL], [
21366abeab63SniaAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21376abeab63Sniamacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21386abeab63SniaINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21396abeab63Sniamv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21406abeab63Snia|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21416abeab63Sniaecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21426abeab63SniaAC_SUBST([INSTALL_CMD])
21436abeab63Snia]) # XORG_INSTALL
21446abeab63Sniadnl Copyright 2005 Red Hat, Inc
21456abeab63Sniadnl
21466abeab63Sniadnl Permission to use, copy, modify, distribute, and sell this software and its
21476abeab63Sniadnl documentation for any purpose is hereby granted without fee, provided that
21486abeab63Sniadnl the above copyright notice appear in all copies and that both that
21496abeab63Sniadnl copyright notice and this permission notice appear in supporting
21506abeab63Sniadnl documentation.
21516abeab63Sniadnl
21526abeab63Sniadnl The above copyright notice and this permission notice shall be included
21536abeab63Sniadnl in all copies or substantial portions of the Software.
21546abeab63Sniadnl
21556abeab63Sniadnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21566abeab63Sniadnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21576abeab63Sniadnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21586abeab63Sniadnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21596abeab63Sniadnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21606abeab63Sniadnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21616abeab63Sniadnl OTHER DEALINGS IN THE SOFTWARE.
21626abeab63Sniadnl
21636abeab63Sniadnl Except as contained in this notice, the name of the copyright holders shall
21646abeab63Sniadnl not be used in advertising or otherwise to promote the sale, use or
21656abeab63Sniadnl other dealings in this Software without prior written authorization
21666abeab63Sniadnl from the copyright holders.
21676abeab63Sniadnl
21686abeab63Snia
21696abeab63Snia# XORG_RELEASE_VERSION
21706abeab63Snia# --------------------
21716abeab63Snia# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
21726abeab63Snia
21736abeab63SniaAC_DEFUN([XORG_RELEASE_VERSION],[
21746abeab63Snia	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21756abeab63Snia		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21766abeab63Snia		[Major version of this package])
21776abeab63Snia	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21786abeab63Snia	if test "x$PVM" = "x"; then
21796abeab63Snia		PVM="0"
21806abeab63Snia	fi
21816abeab63Snia	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21826abeab63Snia		[$PVM],
21836abeab63Snia		[Minor version of this package])
21846abeab63Snia	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21856abeab63Snia	if test "x$PVP" = "x"; then
21866abeab63Snia		PVP="0"
21876abeab63Snia	fi
21886abeab63Snia	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21896abeab63Snia		[$PVP],
21906abeab63Snia		[Patch version of this package])
21916abeab63Snia])
21926abeab63Snia
21936abeab63Snia# XORG_CHANGELOG()
21946abeab63Snia# ----------------
21956abeab63Snia# Minimum version: 1.2.0
21966abeab63Snia#
21976abeab63Snia# Defines the variable CHANGELOG_CMD as the command to generate
21986abeab63Snia# ChangeLog from git.
21996abeab63Snia#
22006abeab63Snia#
22016abeab63SniaAC_DEFUN([XORG_CHANGELOG], [
22026abeab63SniaCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22036abeab63Sniamv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22046abeab63Snia|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22056abeab63Sniaecho 'git directory not found: installing possibly empty changelog.' >&2)"
22066abeab63SniaAC_SUBST([CHANGELOG_CMD])
22076abeab63Snia]) # XORG_CHANGELOG
22086abeab63Snia
22096abeab63Snia# Copyright (C) 2002-2014 Free Software Foundation, Inc.
22106abeab63Snia#
22116abeab63Snia# This file is free software; the Free Software Foundation
22126abeab63Snia# gives unlimited permission to copy and/or distribute it,
22136abeab63Snia# with or without modifications, as long as this notice is preserved.
22146abeab63Snia
22156abeab63Snia# AM_AUTOMAKE_VERSION(VERSION)
22166abeab63Snia# ----------------------------
22176abeab63Snia# Automake X.Y traces this macro to ensure aclocal.m4 has been
22186abeab63Snia# generated from the m4 files accompanying Automake X.Y.
22196abeab63Snia# (This private macro should not be called outside this file.)
22206abeab63SniaAC_DEFUN([AM_AUTOMAKE_VERSION],
22216abeab63Snia[am__api_version='1.15'
22226abeab63Sniadnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22236abeab63Sniadnl require some minimum version.  Point them to the right macro.
22246abeab63Sniam4_if([$1], [1.15], [],
22256abeab63Snia      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22266abeab63Snia])
22276abeab63Snia
22286abeab63Snia# _AM_AUTOCONF_VERSION(VERSION)
22296abeab63Snia# -----------------------------
22306abeab63Snia# aclocal traces this macro to find the Autoconf version.
22316abeab63Snia# This is a private macro too.  Using m4_define simplifies
22326abeab63Snia# the logic in aclocal, which can simply ignore this definition.
22336abeab63Sniam4_define([_AM_AUTOCONF_VERSION], [])
22346abeab63Snia
22356abeab63Snia# AM_SET_CURRENT_AUTOMAKE_VERSION
22366abeab63Snia# -------------------------------
22376abeab63Snia# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22386abeab63Snia# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22396abeab63SniaAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22406abeab63Snia[AM_AUTOMAKE_VERSION([1.15])dnl
22416abeab63Sniam4_ifndef([AC_AUTOCONF_VERSION],
22426abeab63Snia  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22436abeab63Snia_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
22446abeab63Snia
22456abeab63Snia# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22466abeab63Snia
22476abeab63Snia# Copyright (C) 2001-2014 Free Software Foundation, Inc.
22486abeab63Snia#
22496abeab63Snia# This file is free software; the Free Software Foundation
22506abeab63Snia# gives unlimited permission to copy and/or distribute it,
22516abeab63Snia# with or without modifications, as long as this notice is preserved.
22526abeab63Snia
22536abeab63Snia# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22546abeab63Snia# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22556abeab63Snia# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
22566abeab63Snia#
22576abeab63Snia# Of course, Automake must honor this variable whenever it calls a
22586abeab63Snia# tool from the auxiliary directory.  The problem is that $srcdir (and
22596abeab63Snia# therefore $ac_aux_dir as well) can be either absolute or relative,
22606abeab63Snia# depending on how configure is run.  This is pretty annoying, since
22616abeab63Snia# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22626abeab63Snia# source directory, any form will work fine, but in subdirectories a
22636abeab63Snia# relative path needs to be adjusted first.
22646abeab63Snia#
22656abeab63Snia# $ac_aux_dir/missing
22666abeab63Snia#    fails when called from a subdirectory if $ac_aux_dir is relative
22676abeab63Snia# $top_srcdir/$ac_aux_dir/missing
22686abeab63Snia#    fails if $ac_aux_dir is absolute,
22696abeab63Snia#    fails when called from a subdirectory in a VPATH build with
22706abeab63Snia#          a relative $ac_aux_dir
22716abeab63Snia#
22726abeab63Snia# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22736abeab63Snia# are both prefixed by $srcdir.  In an in-source build this is usually
22746abeab63Snia# harmless because $srcdir is '.', but things will broke when you
22756abeab63Snia# start a VPATH build or use an absolute $srcdir.
22766abeab63Snia#
22776abeab63Snia# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22786abeab63Snia# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22796abeab63Snia#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22806abeab63Snia# and then we would define $MISSING as
22816abeab63Snia#   MISSING="\${SHELL} $am_aux_dir/missing"
22826abeab63Snia# This will work as long as MISSING is not called from configure, because
22836abeab63Snia# unfortunately $(top_srcdir) has no meaning in configure.
22846abeab63Snia# However there are other variables, like CC, which are often used in
22856abeab63Snia# configure, and could therefore not use this "fixed" $ac_aux_dir.
22866abeab63Snia#
22876abeab63Snia# Another solution, used here, is to always expand $ac_aux_dir to an
22886abeab63Snia# absolute PATH.  The drawback is that using absolute paths prevent a
22896abeab63Snia# configured tree to be moved without reconfiguration.
22906abeab63Snia
22916abeab63SniaAC_DEFUN([AM_AUX_DIR_EXPAND],
22926abeab63Snia[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22936abeab63Snia# Expand $ac_aux_dir to an absolute path.
22946abeab63Sniaam_aux_dir=`cd "$ac_aux_dir" && pwd`
22956abeab63Snia])
22966abeab63Snia
22976abeab63Snia# AM_CONDITIONAL                                            -*- Autoconf -*-
22986abeab63Snia
22996abeab63Snia# Copyright (C) 1997-2014 Free Software Foundation, Inc.
23006abeab63Snia#
23016abeab63Snia# This file is free software; the Free Software Foundation
23026abeab63Snia# gives unlimited permission to copy and/or distribute it,
23036abeab63Snia# with or without modifications, as long as this notice is preserved.
23046abeab63Snia
23056abeab63Snia# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23066abeab63Snia# -------------------------------------
23076abeab63Snia# Define a conditional.
23086abeab63SniaAC_DEFUN([AM_CONDITIONAL],
23096abeab63Snia[AC_PREREQ([2.52])dnl
23106abeab63Snia m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23116abeab63Snia       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23126abeab63SniaAC_SUBST([$1_TRUE])dnl
23136abeab63SniaAC_SUBST([$1_FALSE])dnl
23146abeab63Snia_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23156abeab63Snia_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23166abeab63Sniam4_define([_AM_COND_VALUE_$1], [$2])dnl
23176abeab63Sniaif $2; then
23186abeab63Snia  $1_TRUE=
23196abeab63Snia  $1_FALSE='#'
23206abeab63Sniaelse
23216abeab63Snia  $1_TRUE='#'
23226abeab63Snia  $1_FALSE=
23236abeab63Sniafi
23246abeab63SniaAC_CONFIG_COMMANDS_PRE(
23256abeab63Snia[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23266abeab63Snia  AC_MSG_ERROR([[conditional "$1" was never defined.
23276abeab63SniaUsually this means the macro was only invoked conditionally.]])
23286abeab63Sniafi])])
23296abeab63Snia
23306abeab63Snia# Copyright (C) 1999-2014 Free Software Foundation, Inc.
23316abeab63Snia#
23326abeab63Snia# This file is free software; the Free Software Foundation
23336abeab63Snia# gives unlimited permission to copy and/or distribute it,
23346abeab63Snia# with or without modifications, as long as this notice is preserved.
23356abeab63Snia
23366abeab63Snia
23376abeab63Snia# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23386abeab63Snia# written in clear, in which case automake, when reading aclocal.m4,
23396abeab63Snia# will think it sees a *use*, and therefore will trigger all it's
23406abeab63Snia# C support machinery.  Also note that it means that autoscan, seeing
23416abeab63Snia# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23426abeab63Snia
23436abeab63Snia
23446abeab63Snia# _AM_DEPENDENCIES(NAME)
23456abeab63Snia# ----------------------
23466abeab63Snia# See how the compiler implements dependency checking.
23476abeab63Snia# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23486abeab63Snia# We try a few techniques and use that to set a single cache variable.
23496abeab63Snia#
23506abeab63Snia# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23516abeab63Snia# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23526abeab63Snia# dependency, and given that the user is not expected to run this macro,
23536abeab63Snia# just rely on AC_PROG_CC.
23546abeab63SniaAC_DEFUN([_AM_DEPENDENCIES],
23556abeab63Snia[AC_REQUIRE([AM_SET_DEPDIR])dnl
23566abeab63SniaAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23576abeab63SniaAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23586abeab63SniaAC_REQUIRE([AM_DEP_TRACK])dnl
23596abeab63Snia
23606abeab63Sniam4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23616abeab63Snia      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23626abeab63Snia      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23636abeab63Snia      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23646abeab63Snia      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23656abeab63Snia      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23666abeab63Snia                    [depcc="$$1"   am_compiler_list=])
23676abeab63Snia
23686abeab63SniaAC_CACHE_CHECK([dependency style of $depcc],
23696abeab63Snia               [am_cv_$1_dependencies_compiler_type],
23706abeab63Snia[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23716abeab63Snia  # We make a subdir and do the tests there.  Otherwise we can end up
23726abeab63Snia  # making bogus files that we don't know about and never remove.  For
23736abeab63Snia  # instance it was reported that on HP-UX the gcc test will end up
23746abeab63Snia  # making a dummy file named 'D' -- because '-MD' means "put the output
23756abeab63Snia  # in D".
23766abeab63Snia  rm -rf conftest.dir
23776abeab63Snia  mkdir conftest.dir
23786abeab63Snia  # Copy depcomp to subdir because otherwise we won't find it if we're
23796abeab63Snia  # using a relative directory.
23806abeab63Snia  cp "$am_depcomp" conftest.dir
23816abeab63Snia  cd conftest.dir
23826abeab63Snia  # We will build objects and dependencies in a subdirectory because
23836abeab63Snia  # it helps to detect inapplicable dependency modes.  For instance
23846abeab63Snia  # both Tru64's cc and ICC support -MD to output dependencies as a
23856abeab63Snia  # side effect of compilation, but ICC will put the dependencies in
23866abeab63Snia  # the current directory while Tru64 will put them in the object
23876abeab63Snia  # directory.
23886abeab63Snia  mkdir sub
23896abeab63Snia
23906abeab63Snia  am_cv_$1_dependencies_compiler_type=none
23916abeab63Snia  if test "$am_compiler_list" = ""; then
23926abeab63Snia     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
23936abeab63Snia  fi
23946abeab63Snia  am__universal=false
23956abeab63Snia  m4_case([$1], [CC],
23966abeab63Snia    [case " $depcc " in #(
23976abeab63Snia     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23986abeab63Snia     esac],
23996abeab63Snia    [CXX],
24006abeab63Snia    [case " $depcc " in #(
24016abeab63Snia     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24026abeab63Snia     esac])
24036abeab63Snia
24046abeab63Snia  for depmode in $am_compiler_list; do
24056abeab63Snia    # Setup a source with many dependencies, because some compilers
24066abeab63Snia    # like to wrap large dependency lists on column 80 (with \), and
24076abeab63Snia    # we should not choose a depcomp mode which is confused by this.
24086abeab63Snia    #
24096abeab63Snia    # We need to recreate these files for each test, as the compiler may
24106abeab63Snia    # overwrite some of them when testing with obscure command lines.
24116abeab63Snia    # This happens at least with the AIX C compiler.
24126abeab63Snia    : > sub/conftest.c
24136abeab63Snia    for i in 1 2 3 4 5 6; do
24146abeab63Snia      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24156abeab63Snia      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24166abeab63Snia      # Solaris 10 /bin/sh.
24176abeab63Snia      echo '/* dummy */' > sub/conftst$i.h
24186abeab63Snia    done
24196abeab63Snia    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24206abeab63Snia
24216abeab63Snia    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24226abeab63Snia    # mode.  It turns out that the SunPro C++ compiler does not properly
24236abeab63Snia    # handle '-M -o', and we need to detect this.  Also, some Intel
24246abeab63Snia    # versions had trouble with output in subdirs.
24256abeab63Snia    am__obj=sub/conftest.${OBJEXT-o}
24266abeab63Snia    am__minus_obj="-o $am__obj"
24276abeab63Snia    case $depmode in
24286abeab63Snia    gcc)
24296abeab63Snia      # This depmode causes a compiler race in universal mode.
24306abeab63Snia      test "$am__universal" = false || continue
24316abeab63Snia      ;;
24326abeab63Snia    nosideeffect)
24336abeab63Snia      # After this tag, mechanisms are not by side-effect, so they'll
24346abeab63Snia      # only be used when explicitly requested.
24356abeab63Snia      if test "x$enable_dependency_tracking" = xyes; then
24366abeab63Snia	continue
24376abeab63Snia      else
24386abeab63Snia	break
24396abeab63Snia      fi
24406abeab63Snia      ;;
24416abeab63Snia    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24426abeab63Snia      # This compiler won't grok '-c -o', but also, the minuso test has
24436abeab63Snia      # not run yet.  These depmodes are late enough in the game, and
24446abeab63Snia      # so weak that their functioning should not be impacted.
24456abeab63Snia      am__obj=conftest.${OBJEXT-o}
24466abeab63Snia      am__minus_obj=
24476abeab63Snia      ;;
24486abeab63Snia    none) break ;;
24496abeab63Snia    esac
24506abeab63Snia    if depmode=$depmode \
24516abeab63Snia       source=sub/conftest.c object=$am__obj \
24526abeab63Snia       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24536abeab63Snia       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24546abeab63Snia         >/dev/null 2>conftest.err &&
24556abeab63Snia       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24566abeab63Snia       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24576abeab63Snia       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24586abeab63Snia       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24596abeab63Snia      # icc doesn't choke on unknown options, it will just issue warnings
24606abeab63Snia      # or remarks (even with -Werror).  So we grep stderr for any message
24616abeab63Snia      # that says an option was ignored or not supported.
24626abeab63Snia      # When given -MP, icc 7.0 and 7.1 complain thusly:
24636abeab63Snia      #   icc: Command line warning: ignoring option '-M'; no argument required
24646abeab63Snia      # The diagnosis changed in icc 8.0:
24656abeab63Snia      #   icc: Command line remark: option '-MP' not supported
24666abeab63Snia      if (grep 'ignoring option' conftest.err ||
24676abeab63Snia          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24686abeab63Snia        am_cv_$1_dependencies_compiler_type=$depmode
24696abeab63Snia        break
24706abeab63Snia      fi
24716abeab63Snia    fi
24726abeab63Snia  done
24736abeab63Snia
24746abeab63Snia  cd ..
24756abeab63Snia  rm -rf conftest.dir
24766abeab63Sniaelse
24776abeab63Snia  am_cv_$1_dependencies_compiler_type=none
24786abeab63Sniafi
24796abeab63Snia])
24806abeab63SniaAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24816abeab63SniaAM_CONDITIONAL([am__fastdep$1], [
24826abeab63Snia  test "x$enable_dependency_tracking" != xno \
24836abeab63Snia  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24846abeab63Snia])
24856abeab63Snia
24866abeab63Snia
24876abeab63Snia# AM_SET_DEPDIR
24886abeab63Snia# -------------
24896abeab63Snia# Choose a directory name for dependency files.
24906abeab63Snia# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24916abeab63SniaAC_DEFUN([AM_SET_DEPDIR],
24926abeab63Snia[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24936abeab63SniaAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24946abeab63Snia])
24956abeab63Snia
24966abeab63Snia
24976abeab63Snia# AM_DEP_TRACK
24986abeab63Snia# ------------
24996abeab63SniaAC_DEFUN([AM_DEP_TRACK],
25006abeab63Snia[AC_ARG_ENABLE([dependency-tracking], [dnl
25016abeab63SniaAS_HELP_STRING(
25026abeab63Snia  [--enable-dependency-tracking],
25036abeab63Snia  [do not reject slow dependency extractors])
25046abeab63SniaAS_HELP_STRING(
25056abeab63Snia  [--disable-dependency-tracking],
25066abeab63Snia  [speeds up one-time build])])
25076abeab63Sniaif test "x$enable_dependency_tracking" != xno; then
25086abeab63Snia  am_depcomp="$ac_aux_dir/depcomp"
25096abeab63Snia  AMDEPBACKSLASH='\'
25106abeab63Snia  am__nodep='_no'
25116abeab63Sniafi
25126abeab63SniaAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25136abeab63SniaAC_SUBST([AMDEPBACKSLASH])dnl
25146abeab63Snia_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25156abeab63SniaAC_SUBST([am__nodep])dnl
25166abeab63Snia_AM_SUBST_NOTMAKE([am__nodep])dnl
25176abeab63Snia])
25186abeab63Snia
25196abeab63Snia# Generate code to set up dependency tracking.              -*- Autoconf -*-
25206abeab63Snia
25216abeab63Snia# Copyright (C) 1999-2014 Free Software Foundation, Inc.
25226abeab63Snia#
25236abeab63Snia# This file is free software; the Free Software Foundation
25246abeab63Snia# gives unlimited permission to copy and/or distribute it,
25256abeab63Snia# with or without modifications, as long as this notice is preserved.
25266abeab63Snia
25276abeab63Snia
25286abeab63Snia# _AM_OUTPUT_DEPENDENCY_COMMANDS
25296abeab63Snia# ------------------------------
25306abeab63SniaAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25316abeab63Snia[{
25326abeab63Snia  # Older Autoconf quotes --file arguments for eval, but not when files
25336abeab63Snia  # are listed without --file.  Let's play safe and only enable the eval
25346abeab63Snia  # if we detect the quoting.
25356abeab63Snia  case $CONFIG_FILES in
25366abeab63Snia  *\'*) eval set x "$CONFIG_FILES" ;;
25376abeab63Snia  *)   set x $CONFIG_FILES ;;
25386abeab63Snia  esac
25396abeab63Snia  shift
25406abeab63Snia  for mf
25416abeab63Snia  do
25426abeab63Snia    # Strip MF so we end up with the name of the file.
25436abeab63Snia    mf=`echo "$mf" | sed -e 's/:.*$//'`
25446abeab63Snia    # Check whether this is an Automake generated Makefile or not.
25456abeab63Snia    # We used to match only the files named 'Makefile.in', but
25466abeab63Snia    # some people rename them; so instead we look at the file content.
25476abeab63Snia    # Grep'ing the first line is not enough: some people post-process
25486abeab63Snia    # each Makefile.in and add a new line on top of each file to say so.
25496abeab63Snia    # Grep'ing the whole file is not good either: AIX grep has a line
25506abeab63Snia    # limit of 2048, but all sed's we know have understand at least 4000.
25516abeab63Snia    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25526abeab63Snia      dirpart=`AS_DIRNAME("$mf")`
25536abeab63Snia    else
25546abeab63Snia      continue
25556abeab63Snia    fi
25566abeab63Snia    # Extract the definition of DEPDIR, am__include, and am__quote
25576abeab63Snia    # from the Makefile without running 'make'.
25586abeab63Snia    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25596abeab63Snia    test -z "$DEPDIR" && continue
25606abeab63Snia    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25616abeab63Snia    test -z "$am__include" && continue
25626abeab63Snia    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25636abeab63Snia    # Find all dependency output files, they are included files with
25646abeab63Snia    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25656abeab63Snia    # simplest approach to changing $(DEPDIR) to its actual value in the
25666abeab63Snia    # expansion.
25676abeab63Snia    for file in `sed -n "
25686abeab63Snia      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25696abeab63Snia	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25706abeab63Snia      # Make sure the directory exists.
25716abeab63Snia      test -f "$dirpart/$file" && continue
25726abeab63Snia      fdir=`AS_DIRNAME(["$file"])`
25736abeab63Snia      AS_MKDIR_P([$dirpart/$fdir])
25746abeab63Snia      # echo "creating $dirpart/$file"
25756abeab63Snia      echo '# dummy' > "$dirpart/$file"
25766abeab63Snia    done
25776abeab63Snia  done
25786abeab63Snia}
25796abeab63Snia])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25806abeab63Snia
25816abeab63Snia
25826abeab63Snia# AM_OUTPUT_DEPENDENCY_COMMANDS
25836abeab63Snia# -----------------------------
25846abeab63Snia# This macro should only be invoked once -- use via AC_REQUIRE.
25856abeab63Snia#
25866abeab63Snia# This code is only required when automatic dependency tracking
25876abeab63Snia# is enabled.  FIXME.  This creates each '.P' file that we will
25886abeab63Snia# need in order to bootstrap the dependency handling code.
25896abeab63SniaAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25906abeab63Snia[AC_CONFIG_COMMANDS([depfiles],
25916abeab63Snia     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25926abeab63Snia     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25936abeab63Snia])
25946abeab63Snia
25956abeab63Snia# Do all the work for Automake.                             -*- Autoconf -*-
25966abeab63Snia
25976abeab63Snia# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25986abeab63Snia#
25996abeab63Snia# This file is free software; the Free Software Foundation
26006abeab63Snia# gives unlimited permission to copy and/or distribute it,
26016abeab63Snia# with or without modifications, as long as this notice is preserved.
26026abeab63Snia
26036abeab63Snia# This macro actually does too much.  Some checks are only needed if
26046abeab63Snia# your package does certain things.  But this isn't really a big deal.
26056abeab63Snia
26066abeab63Sniadnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26076abeab63Sniam4_define([AC_PROG_CC],
26086abeab63Sniam4_defn([AC_PROG_CC])
26096abeab63Snia[_AM_PROG_CC_C_O
26106abeab63Snia])
26116abeab63Snia
26126abeab63Snia# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26136abeab63Snia# AM_INIT_AUTOMAKE([OPTIONS])
26146abeab63Snia# -----------------------------------------------
26156abeab63Snia# The call with PACKAGE and VERSION arguments is the old style
26166abeab63Snia# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26176abeab63Snia# and VERSION should now be passed to AC_INIT and removed from
26186abeab63Snia# the call to AM_INIT_AUTOMAKE.
26196abeab63Snia# We support both call styles for the transition.  After
26206abeab63Snia# the next Automake release, Autoconf can make the AC_INIT
26216abeab63Snia# arguments mandatory, and then we can depend on a new Autoconf
26226abeab63Snia# release and drop the old call support.
26236abeab63SniaAC_DEFUN([AM_INIT_AUTOMAKE],
26246abeab63Snia[AC_PREREQ([2.65])dnl
26256abeab63Sniadnl Autoconf wants to disallow AM_ names.  We explicitly allow
26266abeab63Sniadnl the ones we care about.
26276abeab63Sniam4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26286abeab63SniaAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26296abeab63SniaAC_REQUIRE([AC_PROG_INSTALL])dnl
26306abeab63Sniaif test "`cd $srcdir && pwd`" != "`pwd`"; then
26316abeab63Snia  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26326abeab63Snia  # is not polluted with repeated "-I."
26336abeab63Snia  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26346abeab63Snia  # test to see if srcdir already configured
26356abeab63Snia  if test -f $srcdir/config.status; then
26366abeab63Snia    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
26376abeab63Snia  fi
26386abeab63Sniafi
26396abeab63Snia
26406abeab63Snia# test whether we have cygpath
26416abeab63Sniaif test -z "$CYGPATH_W"; then
26426abeab63Snia  if (cygpath --version) >/dev/null 2>/dev/null; then
26436abeab63Snia    CYGPATH_W='cygpath -w'
26446abeab63Snia  else
26456abeab63Snia    CYGPATH_W=echo
26466abeab63Snia  fi
26476abeab63Sniafi
26486abeab63SniaAC_SUBST([CYGPATH_W])
26496abeab63Snia
26506abeab63Snia# Define the identity of the package.
26516abeab63Sniadnl Distinguish between old-style and new-style calls.
26526abeab63Sniam4_ifval([$2],
26536abeab63Snia[AC_DIAGNOSE([obsolete],
26546abeab63Snia             [$0: two- and three-arguments forms are deprecated.])
26556abeab63Sniam4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26566abeab63Snia AC_SUBST([PACKAGE], [$1])dnl
26576abeab63Snia AC_SUBST([VERSION], [$2])],
26586abeab63Snia[_AM_SET_OPTIONS([$1])dnl
26596abeab63Sniadnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26606abeab63Sniam4_if(
26616abeab63Snia  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26626abeab63Snia  [ok:ok],,
26636abeab63Snia  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26646abeab63Snia AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26656abeab63Snia AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
26666abeab63Snia
26676abeab63Snia_AM_IF_OPTION([no-define],,
26686abeab63Snia[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26696abeab63Snia AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
26706abeab63Snia
26716abeab63Snia# Some tools Automake needs.
26726abeab63SniaAC_REQUIRE([AM_SANITY_CHECK])dnl
26736abeab63SniaAC_REQUIRE([AC_ARG_PROGRAM])dnl
26746abeab63SniaAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26756abeab63SniaAM_MISSING_PROG([AUTOCONF], [autoconf])
26766abeab63SniaAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26776abeab63SniaAM_MISSING_PROG([AUTOHEADER], [autoheader])
26786abeab63SniaAM_MISSING_PROG([MAKEINFO], [makeinfo])
26796abeab63SniaAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26806abeab63SniaAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26816abeab63SniaAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26826abeab63Snia# For better backward compatibility.  To be removed once Automake 1.9.x
26836abeab63Snia# dies out for good.  For more background, see:
26846abeab63Snia# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26856abeab63Snia# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26866abeab63SniaAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26876abeab63Snia# We need awk for the "check" target (and possibly the TAP driver).  The
26886abeab63Snia# system "awk" is bad on some platforms.
26896abeab63SniaAC_REQUIRE([AC_PROG_AWK])dnl
26906abeab63SniaAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26916abeab63SniaAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26926abeab63Snia_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26936abeab63Snia	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26946abeab63Snia			     [_AM_PROG_TAR([v7])])])
26956abeab63Snia_AM_IF_OPTION([no-dependencies],,
26966abeab63Snia[AC_PROVIDE_IFELSE([AC_PROG_CC],
26976abeab63Snia		  [_AM_DEPENDENCIES([CC])],
26986abeab63Snia		  [m4_define([AC_PROG_CC],
26996abeab63Snia			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27006abeab63SniaAC_PROVIDE_IFELSE([AC_PROG_CXX],
27016abeab63Snia		  [_AM_DEPENDENCIES([CXX])],
27026abeab63Snia		  [m4_define([AC_PROG_CXX],
27036abeab63Snia			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27046abeab63SniaAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27056abeab63Snia		  [_AM_DEPENDENCIES([OBJC])],
27066abeab63Snia		  [m4_define([AC_PROG_OBJC],
27076abeab63Snia			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27086abeab63SniaAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27096abeab63Snia		  [_AM_DEPENDENCIES([OBJCXX])],
27106abeab63Snia		  [m4_define([AC_PROG_OBJCXX],
27116abeab63Snia			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27126abeab63Snia])
27136abeab63SniaAC_REQUIRE([AM_SILENT_RULES])dnl
27146abeab63Sniadnl The testsuite driver may need to know about EXEEXT, so add the
27156abeab63Sniadnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27166abeab63Sniadnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27176abeab63SniaAC_CONFIG_COMMANDS_PRE(dnl
27186abeab63Snia[m4_provide_if([_AM_COMPILER_EXEEXT],
27196abeab63Snia  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27206abeab63Snia
27216abeab63Snia# POSIX will say in a future version that running "rm -f" with no argument
27226abeab63Snia# is OK; and we want to be able to make that assumption in our Makefile
27236abeab63Snia# recipes.  So use an aggressive probe to check that the usage we want is
27246abeab63Snia# actually supported "in the wild" to an acceptable degree.
27256abeab63Snia# See automake bug#10828.
27266abeab63Snia# To make any issue more visible, cause the running configure to be aborted
27276abeab63Snia# by default if the 'rm' program in use doesn't match our expectations; the
27286abeab63Snia# user can still override this though.
27296abeab63Sniaif rm -f && rm -fr && rm -rf; then : OK; else
27306abeab63Snia  cat >&2 <<'END'
27316abeab63SniaOops!
27326abeab63Snia
27336abeab63SniaYour 'rm' program seems unable to run without file operands specified
27346abeab63Sniaon the command line, even when the '-f' option is present.  This is contrary
27356abeab63Sniato the behaviour of most rm programs out there, and not conforming with
27366abeab63Sniathe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27376abeab63Snia
27386abeab63SniaPlease tell bug-automake@gnu.org about your system, including the value
27396abeab63Sniaof your $PATH and any error possibly output before this message.  This
27406abeab63Sniacan help us improve future automake versions.
27416abeab63Snia
27426abeab63SniaEND
27436abeab63Snia  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27446abeab63Snia    echo 'Configuration will proceed anyway, since you have set the' >&2
27456abeab63Snia    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27466abeab63Snia    echo >&2
27476abeab63Snia  else
27486abeab63Snia    cat >&2 <<'END'
27496abeab63SniaAborting the configuration process, to ensure you take notice of the issue.
27506abeab63Snia
27516abeab63SniaYou can download and install GNU coreutils to get an 'rm' implementation
27526abeab63Sniathat behaves properly: <http://www.gnu.org/software/coreutils/>.
27536abeab63Snia
27546abeab63SniaIf you want to complete the configuration process using your problematic
27556abeab63Snia'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27566abeab63Sniato "yes", and re-run configure.
27576abeab63Snia
27586abeab63SniaEND
27596abeab63Snia    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27606abeab63Snia  fi
27616abeab63Sniafi
27626abeab63Sniadnl The trailing newline in this macro's definition is deliberate, for
27636abeab63Sniadnl backward compatibility and to allow trailing 'dnl'-style comments
27646abeab63Sniadnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27656abeab63Snia])
27666abeab63Snia
27676abeab63Sniadnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27686abeab63Sniadnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27696abeab63Sniadnl mangled by Autoconf and run in a shell conditional statement.
27706abeab63Sniam4_define([_AC_COMPILER_EXEEXT],
27716abeab63Sniam4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27726abeab63Snia
27736abeab63Snia# When config.status generates a header, we must update the stamp-h file.
27746abeab63Snia# This file resides in the same directory as the config header
27756abeab63Snia# that is generated.  The stamp files are numbered to have different names.
27766abeab63Snia
27776abeab63Snia# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27786abeab63Snia# loop where config.status creates the headers, so we can generate
27796abeab63Snia# our stamp files there.
27806abeab63SniaAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27816abeab63Snia[# Compute $1's index in $config_headers.
27826abeab63Snia_am_arg=$1
27836abeab63Snia_am_stamp_count=1
27846abeab63Sniafor _am_header in $config_headers :; do
27856abeab63Snia  case $_am_header in
27866abeab63Snia    $_am_arg | $_am_arg:* )
27876abeab63Snia      break ;;
27886abeab63Snia    * )
27896abeab63Snia      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27906abeab63Snia  esac
27916abeab63Sniadone
27926abeab63Sniaecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
27936abeab63Snia
27946abeab63Snia# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27956abeab63Snia#
27966abeab63Snia# This file is free software; the Free Software Foundation
27976abeab63Snia# gives unlimited permission to copy and/or distribute it,
27986abeab63Snia# with or without modifications, as long as this notice is preserved.
27996abeab63Snia
28006abeab63Snia# AM_PROG_INSTALL_SH
28016abeab63Snia# ------------------
28026abeab63Snia# Define $install_sh.
28036abeab63SniaAC_DEFUN([AM_PROG_INSTALL_SH],
28046abeab63Snia[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28056abeab63Sniaif test x"${install_sh+set}" != xset; then
28066abeab63Snia  case $am_aux_dir in
28076abeab63Snia  *\ * | *\	*)
28086abeab63Snia    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28096abeab63Snia  *)
28106abeab63Snia    install_sh="\${SHELL} $am_aux_dir/install-sh"
28116abeab63Snia  esac
28126abeab63Sniafi
28136abeab63SniaAC_SUBST([install_sh])])
28146abeab63Snia
28156abeab63Snia# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28166abeab63Snia#
28176abeab63Snia# This file is free software; the Free Software Foundation
28186abeab63Snia# gives unlimited permission to copy and/or distribute it,
28196abeab63Snia# with or without modifications, as long as this notice is preserved.
28206abeab63Snia
28216abeab63Snia# Check whether the underlying file-system supports filenames
28226abeab63Snia# with a leading dot.  For instance MS-DOS doesn't.
28236abeab63SniaAC_DEFUN([AM_SET_LEADING_DOT],
28246abeab63Snia[rm -rf .tst 2>/dev/null
28256abeab63Sniamkdir .tst 2>/dev/null
28266abeab63Sniaif test -d .tst; then
28276abeab63Snia  am__leading_dot=.
28286abeab63Sniaelse
28296abeab63Snia  am__leading_dot=_
28306abeab63Sniafi
28316abeab63Sniarmdir .tst 2>/dev/null
28326abeab63SniaAC_SUBST([am__leading_dot])])
28336abeab63Snia
28346abeab63Snia# Check to see how 'make' treats includes.	            -*- Autoconf -*-
28356abeab63Snia
28366abeab63Snia# Copyright (C) 2001-2014 Free Software Foundation, Inc.
28376abeab63Snia#
28386abeab63Snia# This file is free software; the Free Software Foundation
28396abeab63Snia# gives unlimited permission to copy and/or distribute it,
28406abeab63Snia# with or without modifications, as long as this notice is preserved.
28416abeab63Snia
28426abeab63Snia# AM_MAKE_INCLUDE()
28436abeab63Snia# -----------------
28446abeab63Snia# Check to see how make treats includes.
28456abeab63SniaAC_DEFUN([AM_MAKE_INCLUDE],
28466abeab63Snia[am_make=${MAKE-make}
28476abeab63Sniacat > confinc << 'END'
28486abeab63Sniaam__doit:
28496abeab63Snia	@echo this is the am__doit target
28506abeab63Snia.PHONY: am__doit
28516abeab63SniaEND
28526abeab63Snia# If we don't find an include directive, just comment out the code.
28536abeab63SniaAC_MSG_CHECKING([for style of include used by $am_make])
28546abeab63Sniaam__include="#"
28556abeab63Sniaam__quote=
28566abeab63Snia_am_result=none
28576abeab63Snia# First try GNU make style include.
28586abeab63Sniaecho "include confinc" > confmf
28596abeab63Snia# Ignore all kinds of additional output from 'make'.
28606abeab63Sniacase `$am_make -s -f confmf 2> /dev/null` in #(
28616abeab63Snia*the\ am__doit\ target*)
28626abeab63Snia  am__include=include
28636abeab63Snia  am__quote=
28646abeab63Snia  _am_result=GNU
28656abeab63Snia  ;;
28666abeab63Sniaesac
28676abeab63Snia# Now try BSD make style include.
28686abeab63Sniaif test "$am__include" = "#"; then
28696abeab63Snia   echo '.include "confinc"' > confmf
28706abeab63Snia   case `$am_make -s -f confmf 2> /dev/null` in #(
28716abeab63Snia   *the\ am__doit\ target*)
28726abeab63Snia     am__include=.include
28736abeab63Snia     am__quote="\""
28746abeab63Snia     _am_result=BSD
28756abeab63Snia     ;;
28766abeab63Snia   esac
28776abeab63Sniafi
28786abeab63SniaAC_SUBST([am__include])
28796abeab63SniaAC_SUBST([am__quote])
28806abeab63SniaAC_MSG_RESULT([$_am_result])
28816abeab63Sniarm -f confinc confmf
28826abeab63Snia])
28836abeab63Snia
28846abeab63Snia# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
28856abeab63Snia
28866abeab63Snia# Copyright (C) 1997-2014 Free Software Foundation, Inc.
28876abeab63Snia#
28886abeab63Snia# This file is free software; the Free Software Foundation
28896abeab63Snia# gives unlimited permission to copy and/or distribute it,
28906abeab63Snia# with or without modifications, as long as this notice is preserved.
28916abeab63Snia
28926abeab63Snia# AM_MISSING_PROG(NAME, PROGRAM)
28936abeab63Snia# ------------------------------
28946abeab63SniaAC_DEFUN([AM_MISSING_PROG],
28956abeab63Snia[AC_REQUIRE([AM_MISSING_HAS_RUN])
28966abeab63Snia$1=${$1-"${am_missing_run}$2"}
28976abeab63SniaAC_SUBST($1)])
28986abeab63Snia
28996abeab63Snia# AM_MISSING_HAS_RUN
29006abeab63Snia# ------------------
29016abeab63Snia# Define MISSING if not defined so far and test if it is modern enough.
29026abeab63Snia# If it is, set am_missing_run to use it, otherwise, to nothing.
29036abeab63SniaAC_DEFUN([AM_MISSING_HAS_RUN],
29046abeab63Snia[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29056abeab63SniaAC_REQUIRE_AUX_FILE([missing])dnl
29066abeab63Sniaif test x"${MISSING+set}" != xset; then
29076abeab63Snia  case $am_aux_dir in
29086abeab63Snia  *\ * | *\	*)
29096abeab63Snia    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29106abeab63Snia  *)
29116abeab63Snia    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29126abeab63Snia  esac
29136abeab63Sniafi
29146abeab63Snia# Use eval to expand $SHELL
29156abeab63Sniaif eval "$MISSING --is-lightweight"; then
29166abeab63Snia  am_missing_run="$MISSING "
29176abeab63Sniaelse
29186abeab63Snia  am_missing_run=
29196abeab63Snia  AC_MSG_WARN(['missing' script is too old or missing])
29206abeab63Sniafi
29216abeab63Snia])
29226abeab63Snia
29236abeab63Snia# Helper functions for option handling.                     -*- Autoconf -*-
29246abeab63Snia
29256abeab63Snia# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29266abeab63Snia#
29276abeab63Snia# This file is free software; the Free Software Foundation
29286abeab63Snia# gives unlimited permission to copy and/or distribute it,
29296abeab63Snia# with or without modifications, as long as this notice is preserved.
29306abeab63Snia
29316abeab63Snia# _AM_MANGLE_OPTION(NAME)
29326abeab63Snia# -----------------------
29336abeab63SniaAC_DEFUN([_AM_MANGLE_OPTION],
29346abeab63Snia[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
29356abeab63Snia
29366abeab63Snia# _AM_SET_OPTION(NAME)
29376abeab63Snia# --------------------
29386abeab63Snia# Set option NAME.  Presently that only means defining a flag for this option.
29396abeab63SniaAC_DEFUN([_AM_SET_OPTION],
29406abeab63Snia[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
29416abeab63Snia
29426abeab63Snia# _AM_SET_OPTIONS(OPTIONS)
29436abeab63Snia# ------------------------
29446abeab63Snia# OPTIONS is a space-separated list of Automake options.
29456abeab63SniaAC_DEFUN([_AM_SET_OPTIONS],
29466abeab63Snia[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
29476abeab63Snia
29486abeab63Snia# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29496abeab63Snia# -------------------------------------------
29506abeab63Snia# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29516abeab63SniaAC_DEFUN([_AM_IF_OPTION],
29526abeab63Snia[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
29536abeab63Snia
29546abeab63Snia# Copyright (C) 1999-2014 Free Software Foundation, Inc.
29556abeab63Snia#
29566abeab63Snia# This file is free software; the Free Software Foundation
29576abeab63Snia# gives unlimited permission to copy and/or distribute it,
29586abeab63Snia# with or without modifications, as long as this notice is preserved.
29596abeab63Snia
29606abeab63Snia# _AM_PROG_CC_C_O
29616abeab63Snia# ---------------
29626abeab63Snia# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29636abeab63Snia# to automatically call this.
29646abeab63SniaAC_DEFUN([_AM_PROG_CC_C_O],
29656abeab63Snia[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29666abeab63SniaAC_REQUIRE_AUX_FILE([compile])dnl
29676abeab63SniaAC_LANG_PUSH([C])dnl
29686abeab63SniaAC_CACHE_CHECK(
29696abeab63Snia  [whether $CC understands -c and -o together],
29706abeab63Snia  [am_cv_prog_cc_c_o],
29716abeab63Snia  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29726abeab63Snia  # Make sure it works both with $CC and with simple cc.
29736abeab63Snia  # Following AC_PROG_CC_C_O, we do the test twice because some
29746abeab63Snia  # compilers refuse to overwrite an existing .o file with -o,
29756abeab63Snia  # though they will create one.
29766abeab63Snia  am_cv_prog_cc_c_o=yes
29776abeab63Snia  for am_i in 1 2; do
29786abeab63Snia    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29796abeab63Snia         && test -f conftest2.$ac_objext; then
29806abeab63Snia      : OK
29816abeab63Snia    else
29826abeab63Snia      am_cv_prog_cc_c_o=no
29836abeab63Snia      break
29846abeab63Snia    fi
29856abeab63Snia  done
29866abeab63Snia  rm -f core conftest*
29876abeab63Snia  unset am_i])
29886abeab63Sniaif test "$am_cv_prog_cc_c_o" != yes; then
29896abeab63Snia   # Losing compiler, so override with the script.
29906abeab63Snia   # FIXME: It is wrong to rewrite CC.
29916abeab63Snia   # But if we don't then we get into trouble of one sort or another.
29926abeab63Snia   # A longer-term fix would be to have automake use am__CC in this case,
29936abeab63Snia   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29946abeab63Snia   CC="$am_aux_dir/compile $CC"
29956abeab63Sniafi
29966abeab63SniaAC_LANG_POP([C])])
29976abeab63Snia
29986abeab63Snia# For backward compatibility.
29996abeab63SniaAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30006abeab63Snia
30016abeab63Snia# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30026abeab63Snia#
30036abeab63Snia# This file is free software; the Free Software Foundation
30046abeab63Snia# gives unlimited permission to copy and/or distribute it,
30056abeab63Snia# with or without modifications, as long as this notice is preserved.
30066abeab63Snia
30076abeab63Snia# AM_RUN_LOG(COMMAND)
30086abeab63Snia# -------------------
30096abeab63Snia# Run COMMAND, save the exit status in ac_status, and log it.
30106abeab63Snia# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30116abeab63SniaAC_DEFUN([AM_RUN_LOG],
30126abeab63Snia[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30136abeab63Snia   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30146abeab63Snia   ac_status=$?
30156abeab63Snia   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30166abeab63Snia   (exit $ac_status); }])
30176abeab63Snia
30186abeab63Snia# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30196abeab63Snia
30206abeab63Snia# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30216abeab63Snia#
30226abeab63Snia# This file is free software; the Free Software Foundation
30236abeab63Snia# gives unlimited permission to copy and/or distribute it,
30246abeab63Snia# with or without modifications, as long as this notice is preserved.
30256abeab63Snia
30266abeab63Snia# AM_SANITY_CHECK
30276abeab63Snia# ---------------
30286abeab63SniaAC_DEFUN([AM_SANITY_CHECK],
30296abeab63Snia[AC_MSG_CHECKING([whether build environment is sane])
30306abeab63Snia# Reject unsafe characters in $srcdir or the absolute working directory
30316abeab63Snia# name.  Accept space and tab only in the latter.
30326abeab63Sniaam_lf='
30336abeab63Snia'
30346abeab63Sniacase `pwd` in
30356abeab63Snia  *[[\\\"\#\$\&\'\`$am_lf]]*)
30366abeab63Snia    AC_MSG_ERROR([unsafe absolute working directory name]);;
30376abeab63Sniaesac
30386abeab63Sniacase $srcdir in
30396abeab63Snia  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30406abeab63Snia    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30416abeab63Sniaesac
30426abeab63Snia
30436abeab63Snia# Do 'set' in a subshell so we don't clobber the current shell's
30446abeab63Snia# arguments.  Must try -L first in case configure is actually a
30456abeab63Snia# symlink; some systems play weird games with the mod time of symlinks
30466abeab63Snia# (eg FreeBSD returns the mod time of the symlink's containing
30476abeab63Snia# directory).
30486abeab63Sniaif (
30496abeab63Snia   am_has_slept=no
30506abeab63Snia   for am_try in 1 2; do
30516abeab63Snia     echo "timestamp, slept: $am_has_slept" > conftest.file
30526abeab63Snia     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30536abeab63Snia     if test "$[*]" = "X"; then
30546abeab63Snia	# -L didn't work.
30556abeab63Snia	set X `ls -t "$srcdir/configure" conftest.file`
30566abeab63Snia     fi
30576abeab63Snia     if test "$[*]" != "X $srcdir/configure conftest.file" \
30586abeab63Snia	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
30596abeab63Snia
30606abeab63Snia	# If neither matched, then we have a broken ls.  This can happen
30616abeab63Snia	# if, for instance, CONFIG_SHELL is bash and it inherits a
30626abeab63Snia	# broken ls alias from the environment.  This has actually
30636abeab63Snia	# happened.  Such a system could not be considered "sane".
30646abeab63Snia	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30656abeab63Snia  alias in your environment])
30666abeab63Snia     fi
30676abeab63Snia     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30686abeab63Snia       break
30696abeab63Snia     fi
30706abeab63Snia     # Just in case.
30716abeab63Snia     sleep 1
30726abeab63Snia     am_has_slept=yes
30736abeab63Snia   done
30746abeab63Snia   test "$[2]" = conftest.file
30756abeab63Snia   )
30766abeab63Sniathen
30776abeab63Snia   # Ok.
30786abeab63Snia   :
30796abeab63Sniaelse
30806abeab63Snia   AC_MSG_ERROR([newly created file is older than distributed files!
30816abeab63SniaCheck your system clock])
30826abeab63Sniafi
30836abeab63SniaAC_MSG_RESULT([yes])
30846abeab63Snia# If we didn't sleep, we still need to ensure time stamps of config.status and
30856abeab63Snia# generated files are strictly newer.
30866abeab63Sniaam_sleep_pid=
30876abeab63Sniaif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30886abeab63Snia  ( sleep 1 ) &
30896abeab63Snia  am_sleep_pid=$!
30906abeab63Sniafi
30916abeab63SniaAC_CONFIG_COMMANDS_PRE(
30926abeab63Snia  [AC_MSG_CHECKING([that generated files are newer than configure])
30936abeab63Snia   if test -n "$am_sleep_pid"; then
30946abeab63Snia     # Hide warnings about reused PIDs.
30956abeab63Snia     wait $am_sleep_pid 2>/dev/null
30966abeab63Snia   fi
30976abeab63Snia   AC_MSG_RESULT([done])])
30986abeab63Sniarm -f conftest.file
30996abeab63Snia])
31006abeab63Snia
31016abeab63Snia# Copyright (C) 2009-2014 Free Software Foundation, Inc.
31026abeab63Snia#
31036abeab63Snia# This file is free software; the Free Software Foundation
31046abeab63Snia# gives unlimited permission to copy and/or distribute it,
31056abeab63Snia# with or without modifications, as long as this notice is preserved.
31066abeab63Snia
31076abeab63Snia# AM_SILENT_RULES([DEFAULT])
31086abeab63Snia# --------------------------
31096abeab63Snia# Enable less verbose build rules; with the default set to DEFAULT
31106abeab63Snia# ("yes" being less verbose, "no" or empty being verbose).
31116abeab63SniaAC_DEFUN([AM_SILENT_RULES],
31126abeab63Snia[AC_ARG_ENABLE([silent-rules], [dnl
31136abeab63SniaAS_HELP_STRING(
31146abeab63Snia  [--enable-silent-rules],
31156abeab63Snia  [less verbose build output (undo: "make V=1")])
31166abeab63SniaAS_HELP_STRING(
31176abeab63Snia  [--disable-silent-rules],
31186abeab63Snia  [verbose build output (undo: "make V=0")])dnl
31196abeab63Snia])
31206abeab63Sniacase $enable_silent_rules in @%:@ (((
31216abeab63Snia  yes) AM_DEFAULT_VERBOSITY=0;;
31226abeab63Snia   no) AM_DEFAULT_VERBOSITY=1;;
31236abeab63Snia    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31246abeab63Sniaesac
31256abeab63Sniadnl
31266abeab63Sniadnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31276abeab63Sniadnl do not support nested variable expansions.
31286abeab63Sniadnl See automake bug#9928 and bug#10237.
31296abeab63Sniaam_make=${MAKE-make}
31306abeab63SniaAC_CACHE_CHECK([whether $am_make supports nested variables],
31316abeab63Snia   [am_cv_make_support_nested_variables],
31326abeab63Snia   [if AS_ECHO([['TRUE=$(BAR$(V))
31336abeab63SniaBAR0=false
31346abeab63SniaBAR1=true
31356abeab63SniaV=1
31366abeab63Sniaam__doit:
31376abeab63Snia	@$(TRUE)
31386abeab63Snia.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31396abeab63Snia  am_cv_make_support_nested_variables=yes
31406abeab63Sniaelse
31416abeab63Snia  am_cv_make_support_nested_variables=no
31426abeab63Sniafi])
31436abeab63Sniaif test $am_cv_make_support_nested_variables = yes; then
31446abeab63Snia  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31456abeab63Snia  AM_V='$(V)'
31466abeab63Snia  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31476abeab63Sniaelse
31486abeab63Snia  AM_V=$AM_DEFAULT_VERBOSITY
31496abeab63Snia  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31506abeab63Sniafi
31516abeab63SniaAC_SUBST([AM_V])dnl
31526abeab63SniaAM_SUBST_NOTMAKE([AM_V])dnl
31536abeab63SniaAC_SUBST([AM_DEFAULT_V])dnl
31546abeab63SniaAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31556abeab63SniaAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31566abeab63SniaAM_BACKSLASH='\'
31576abeab63SniaAC_SUBST([AM_BACKSLASH])dnl
31586abeab63Snia_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31596abeab63Snia])
31606abeab63Snia
31616abeab63Snia# Copyright (C) 2001-2014 Free Software Foundation, Inc.
31626abeab63Snia#
31636abeab63Snia# This file is free software; the Free Software Foundation
31646abeab63Snia# gives unlimited permission to copy and/or distribute it,
31656abeab63Snia# with or without modifications, as long as this notice is preserved.
31666abeab63Snia
31676abeab63Snia# AM_PROG_INSTALL_STRIP
31686abeab63Snia# ---------------------
31696abeab63Snia# One issue with vendor 'install' (even GNU) is that you can't
31706abeab63Snia# specify the program used to strip binaries.  This is especially
31716abeab63Snia# annoying in cross-compiling environments, where the build's strip
31726abeab63Snia# is unlikely to handle the host's binaries.
31736abeab63Snia# Fortunately install-sh will honor a STRIPPROG variable, so we
31746abeab63Snia# always use install-sh in "make install-strip", and initialize
31756abeab63Snia# STRIPPROG with the value of the STRIP variable (set by the user).
31766abeab63SniaAC_DEFUN([AM_PROG_INSTALL_STRIP],
31776abeab63Snia[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31786abeab63Snia# Installed binaries are usually stripped using 'strip' when the user
31796abeab63Snia# run "make install-strip".  However 'strip' might not be the right
31806abeab63Snia# tool to use in cross-compilation environments, therefore Automake
31816abeab63Snia# will honor the 'STRIP' environment variable to overrule this program.
31826abeab63Sniadnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31836abeab63Sniaif test "$cross_compiling" != no; then
31846abeab63Snia  AC_CHECK_TOOL([STRIP], [strip], :)
31856abeab63Sniafi
31866abeab63SniaINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31876abeab63SniaAC_SUBST([INSTALL_STRIP_PROGRAM])])
31886abeab63Snia
31896abeab63Snia# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31906abeab63Snia#
31916abeab63Snia# This file is free software; the Free Software Foundation
31926abeab63Snia# gives unlimited permission to copy and/or distribute it,
31936abeab63Snia# with or without modifications, as long as this notice is preserved.
31946abeab63Snia
31956abeab63Snia# _AM_SUBST_NOTMAKE(VARIABLE)
31966abeab63Snia# ---------------------------
31976abeab63Snia# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31986abeab63Snia# This macro is traced by Automake.
31996abeab63SniaAC_DEFUN([_AM_SUBST_NOTMAKE])
32006abeab63Snia
32016abeab63Snia# AM_SUBST_NOTMAKE(VARIABLE)
32026abeab63Snia# --------------------------
32036abeab63Snia# Public sister of _AM_SUBST_NOTMAKE.
32046abeab63SniaAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32056abeab63Snia
32066abeab63Snia# Check how to create a tarball.                            -*- Autoconf -*-
32076abeab63Snia
32086abeab63Snia# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32096abeab63Snia#
32106abeab63Snia# This file is free software; the Free Software Foundation
32116abeab63Snia# gives unlimited permission to copy and/or distribute it,
32126abeab63Snia# with or without modifications, as long as this notice is preserved.
32136abeab63Snia
32146abeab63Snia# _AM_PROG_TAR(FORMAT)
32156abeab63Snia# --------------------
32166abeab63Snia# Check how to create a tarball in format FORMAT.
32176abeab63Snia# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32186abeab63Snia#
32196abeab63Snia# Substitute a variable $(am__tar) that is a command
32206abeab63Snia# writing to stdout a FORMAT-tarball containing the directory
32216abeab63Snia# $tardir.
32226abeab63Snia#     tardir=directory && $(am__tar) > result.tar
32236abeab63Snia#
32246abeab63Snia# Substitute a variable $(am__untar) that extract such
32256abeab63Snia# a tarball read from stdin.
32266abeab63Snia#     $(am__untar) < result.tar
32276abeab63Snia#
32286abeab63SniaAC_DEFUN([_AM_PROG_TAR],
32296abeab63Snia[# Always define AMTAR for backward compatibility.  Yes, it's still used
32306abeab63Snia# in the wild :-(  We should find a proper way to deprecate it ...
32316abeab63SniaAC_SUBST([AMTAR], ['$${TAR-tar}'])
32326abeab63Snia
32336abeab63Snia# We'll loop over all known methods to create a tar archive until one works.
32346abeab63Snia_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32356abeab63Snia
32366abeab63Sniam4_if([$1], [v7],
32376abeab63Snia  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32386abeab63Snia
32396abeab63Snia  [m4_case([$1],
32406abeab63Snia    [ustar],
32416abeab63Snia     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32426abeab63Snia      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32436abeab63Snia      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32446abeab63Snia      # and bug#13588).
32456abeab63Snia      am_max_uid=2097151 # 2^21 - 1
32466abeab63Snia      am_max_gid=$am_max_uid
32476abeab63Snia      # The $UID and $GID variables are not portable, so we need to resort
32486abeab63Snia      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32496abeab63Snia      # below are definitely unexpected, so allow the users to see them
32506abeab63Snia      # (that is, avoid stderr redirection).
32516abeab63Snia      am_uid=`id -u || echo unknown`
32526abeab63Snia      am_gid=`id -g || echo unknown`
32536abeab63Snia      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32546abeab63Snia      if test $am_uid -le $am_max_uid; then
32556abeab63Snia         AC_MSG_RESULT([yes])
32566abeab63Snia      else
32576abeab63Snia         AC_MSG_RESULT([no])
32586abeab63Snia         _am_tools=none
32596abeab63Snia      fi
32606abeab63Snia      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32616abeab63Snia      if test $am_gid -le $am_max_gid; then
32626abeab63Snia         AC_MSG_RESULT([yes])
32636abeab63Snia      else
32646abeab63Snia        AC_MSG_RESULT([no])
32656abeab63Snia        _am_tools=none
32666abeab63Snia      fi],
32676abeab63Snia
32686abeab63Snia  [pax],
32696abeab63Snia    [],
32706abeab63Snia
32716abeab63Snia  [m4_fatal([Unknown tar format])])
32726abeab63Snia
32736abeab63Snia  AC_MSG_CHECKING([how to create a $1 tar archive])
32746abeab63Snia
32756abeab63Snia  # Go ahead even if we have the value already cached.  We do so because we
32766abeab63Snia  # need to set the values for the 'am__tar' and 'am__untar' variables.
32776abeab63Snia  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32786abeab63Snia
32796abeab63Snia  for _am_tool in $_am_tools; do
32806abeab63Snia    case $_am_tool in
32816abeab63Snia    gnutar)
32826abeab63Snia      for _am_tar in tar gnutar gtar; do
32836abeab63Snia        AM_RUN_LOG([$_am_tar --version]) && break
32846abeab63Snia      done
32856abeab63Snia      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32866abeab63Snia      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32876abeab63Snia      am__untar="$_am_tar -xf -"
32886abeab63Snia      ;;
32896abeab63Snia    plaintar)
32906abeab63Snia      # Must skip GNU tar: if it does not support --format= it doesn't create
32916abeab63Snia      # ustar tarball either.
32926abeab63Snia      (tar --version) >/dev/null 2>&1 && continue
32936abeab63Snia      am__tar='tar chf - "$$tardir"'
32946abeab63Snia      am__tar_='tar chf - "$tardir"'
32956abeab63Snia      am__untar='tar xf -'
32966abeab63Snia      ;;
32976abeab63Snia    pax)
32986abeab63Snia      am__tar='pax -L -x $1 -w "$$tardir"'
32996abeab63Snia      am__tar_='pax -L -x $1 -w "$tardir"'
33006abeab63Snia      am__untar='pax -r'
33016abeab63Snia      ;;
33026abeab63Snia    cpio)
33036abeab63Snia      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33046abeab63Snia      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33056abeab63Snia      am__untar='cpio -i -H $1 -d'
33066abeab63Snia      ;;
33076abeab63Snia    none)
33086abeab63Snia      am__tar=false
33096abeab63Snia      am__tar_=false
33106abeab63Snia      am__untar=false
33116abeab63Snia      ;;
33126abeab63Snia    esac
33136abeab63Snia
33146abeab63Snia    # If the value was cached, stop now.  We just wanted to have am__tar
33156abeab63Snia    # and am__untar set.
33166abeab63Snia    test -n "${am_cv_prog_tar_$1}" && break
33176abeab63Snia
33186abeab63Snia    # tar/untar a dummy directory, and stop if the command works.
33196abeab63Snia    rm -rf conftest.dir
33206abeab63Snia    mkdir conftest.dir
33216abeab63Snia    echo GrepMe > conftest.dir/file
33226abeab63Snia    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33236abeab63Snia    rm -rf conftest.dir
33246abeab63Snia    if test -s conftest.tar; then
33256abeab63Snia      AM_RUN_LOG([$am__untar <conftest.tar])
33266abeab63Snia      AM_RUN_LOG([cat conftest.dir/file])
33276abeab63Snia      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33286abeab63Snia    fi
33296abeab63Snia  done
33306abeab63Snia  rm -rf conftest.dir
33316abeab63Snia
33326abeab63Snia  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33336abeab63Snia  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33346abeab63Snia
33356abeab63SniaAC_SUBST([am__tar])
33366abeab63SniaAC_SUBST([am__untar])
33376abeab63Snia]) # _AM_PROG_TAR
33386abeab63Snia
3339