aclocal.m4 revision 8a355152
18a355152Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
28a355152Smrg
38a355152Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
48108eb18Smrg
58108eb18Smrg# This file is free software; the Free Software Foundation
68108eb18Smrg# gives unlimited permission to copy and/or distribute it,
78108eb18Smrg# with or without modifications, as long as this notice is preserved.
88108eb18Smrg
98108eb18Smrg# This program is distributed in the hope that it will be useful,
108108eb18Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
118108eb18Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
128108eb18Smrg# PARTICULAR PURPOSE.
138108eb18Smrg
148a355152Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151a650d1eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
161a650d1eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178a355152Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
188a355152Smrg[m4_warning([this file was generated for autoconf 2.69.
191a650d1eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201a650d1eSmrgIf you have problems, you may need to regenerate the build system entirely.
218a355152SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
228108eb18Smrg
238a355152Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
248a355152Smrgdnl serial 11 (pkg-config-0.29)
258a355152Smrgdnl
268a355152Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
278a355152Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
288a355152Smrgdnl
298a355152Smrgdnl This program is free software; you can redistribute it and/or modify
308a355152Smrgdnl it under the terms of the GNU General Public License as published by
318a355152Smrgdnl the Free Software Foundation; either version 2 of the License, or
328a355152Smrgdnl (at your option) any later version.
338a355152Smrgdnl
348a355152Smrgdnl This program is distributed in the hope that it will be useful, but
358a355152Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
368a355152Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
378a355152Smrgdnl General Public License for more details.
388a355152Smrgdnl
398a355152Smrgdnl You should have received a copy of the GNU General Public License
408a355152Smrgdnl along with this program; if not, write to the Free Software
418a355152Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
428a355152Smrgdnl 02111-1307, USA.
438a355152Smrgdnl
448a355152Smrgdnl As a special exception to the GNU General Public License, if you
458a355152Smrgdnl distribute this file as part of a program that contains a
468a355152Smrgdnl configuration script generated by Autoconf, you may include it under
478a355152Smrgdnl the same distribution terms that you use for the rest of that
488a355152Smrgdnl program.
498a355152Smrg
508a355152Smrgdnl PKG_PREREQ(MIN-VERSION)
518a355152Smrgdnl -----------------------
528a355152Smrgdnl Since: 0.29
538a355152Smrgdnl
548a355152Smrgdnl Verify that the version of the pkg-config macros are at least
558a355152Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
568a355152Smrgdnl installed version of pkg-config, this checks the developer's version
578a355152Smrgdnl of pkg.m4 when generating configure.
588a355152Smrgdnl
598a355152Smrgdnl To ensure that this macro is defined, also add:
608a355152Smrgdnl m4_ifndef([PKG_PREREQ],
618a355152Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
628a355152Smrgdnl
638a355152Smrgdnl See the "Since" comment for each macro you use to see what version
648a355152Smrgdnl of the macros you require.
658a355152Smrgm4_defun([PKG_PREREQ],
668a355152Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
678a355152Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
688a355152Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
698a355152Smrg])dnl PKG_PREREQ
708a355152Smrg
718a355152Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
728a355152Smrgdnl ----------------------------------
738a355152Smrgdnl Since: 0.16
748a355152Smrgdnl
758a355152Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
768a355152Smrgdnl first found in the path. Checks that the version of pkg-config found
778a355152Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
788a355152Smrgdnl used since that's the first version where most current features of
798a355152Smrgdnl pkg-config existed.
808a355152SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
818a355152Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
828a355152Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
838a355152Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
848a355152SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
858a355152SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
868a355152SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
878108eb18Smrg
888a355152Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
898a355152Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
908a355152Smrgfi
918a355152Smrgif test -n "$PKG_CONFIG"; then
928a355152Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
938a355152Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
948a355152Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
958a355152Smrg		AC_MSG_RESULT([yes])
968a355152Smrg	else
978a355152Smrg		AC_MSG_RESULT([no])
988a355152Smrg		PKG_CONFIG=""
998a355152Smrg	fi
1008a355152Smrgfi[]dnl
1018a355152Smrg])dnl PKG_PROG_PKG_CONFIG
1025977a007Smrg
1038a355152Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1048a355152Smrgdnl -------------------------------------------------------------------
1058a355152Smrgdnl Since: 0.18
1068a355152Smrgdnl
1078a355152Smrgdnl Check to see whether a particular set of modules exists. Similar to
1088a355152Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1098a355152Smrgdnl
1108a355152Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1118a355152Smrgdnl only at the first occurence in configure.ac, so if the first place
1128a355152Smrgdnl it's called might be skipped (such as if it is within an "if", you
1138a355152Smrgdnl have to call PKG_CHECK_EXISTS manually
1148a355152SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1158a355152Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1168a355152Smrgif test -n "$PKG_CONFIG" && \
1178a355152Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1188a355152Smrg  m4_default([$2], [:])
1198a355152Smrgm4_ifvaln([$3], [else
1208a355152Smrg  $3])dnl
1218a355152Smrgfi])
1221a650d1eSmrg
1238a355152Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1248a355152Smrgdnl ---------------------------------------------
1258a355152Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1268a355152Smrgdnl pkg_failed based on the result.
1278a355152Smrgm4_define([_PKG_CONFIG],
1288a355152Smrg[if test -n "$$1"; then
1298a355152Smrg    pkg_cv_[]$1="$$1"
1308a355152Smrg elif test -n "$PKG_CONFIG"; then
1318a355152Smrg    PKG_CHECK_EXISTS([$3],
1328a355152Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1338a355152Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1348a355152Smrg		     [pkg_failed=yes])
1358a355152Smrg else
1368a355152Smrg    pkg_failed=untried
1378a355152Smrgfi[]dnl
1388a355152Smrg])dnl _PKG_CONFIG
1398108eb18Smrg
1408a355152Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1418a355152Smrgdnl ---------------------------
1428a355152Smrgdnl Internal check to see if pkg-config supports short errors.
1438a355152SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1448a355152Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1458a355152Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1468a355152Smrg        _pkg_short_errors_supported=yes
1478a355152Smrgelse
1488a355152Smrg        _pkg_short_errors_supported=no
1498a355152Smrgfi[]dnl
1508a355152Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1518108eb18Smrg
1528108eb18Smrg
1538a355152Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1548a355152Smrgdnl   [ACTION-IF-NOT-FOUND])
1558a355152Smrgdnl --------------------------------------------------------------
1568a355152Smrgdnl Since: 0.4.0
1578a355152Smrgdnl
1588a355152Smrgdnl Note that if there is a possibility the first call to
1598a355152Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1608a355152Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1618a355152SmrgAC_DEFUN([PKG_CHECK_MODULES],
1628a355152Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1638a355152SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1648a355152SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1658108eb18Smrg
1668a355152Smrgpkg_failed=no
1678a355152SmrgAC_MSG_CHECKING([for $1])
1685977a007Smrg
1698a355152Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1708a355152Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1718108eb18Smrg
1728a355152Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1738a355152Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1748a355152SmrgSee the pkg-config man page for more details.])
1758108eb18Smrg
1768a355152Smrgif test $pkg_failed = yes; then
1778a355152Smrg   	AC_MSG_RESULT([no])
1788a355152Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1798a355152Smrg        if test $_pkg_short_errors_supported = yes; then
1808a355152Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1818a355152Smrg        else 
1828a355152Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1838a355152Smrg        fi
1848a355152Smrg	# Put the nasty error message in config.log where it belongs
1858a355152Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1868108eb18Smrg
1878a355152Smrg	m4_default([$4], [AC_MSG_ERROR(
1888a355152Smrg[Package requirements ($2) were not met:
1898108eb18Smrg
1908a355152Smrg$$1_PKG_ERRORS
1918108eb18Smrg
1928a355152SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1938a355152Smrginstalled software in a non-standard prefix.
1948108eb18Smrg
1958a355152Smrg_PKG_TEXT])[]dnl
1968a355152Smrg        ])
1978a355152Smrgelif test $pkg_failed = untried; then
1988a355152Smrg     	AC_MSG_RESULT([no])
1998a355152Smrg	m4_default([$4], [AC_MSG_FAILURE(
2008a355152Smrg[The pkg-config script could not be found or is too old.  Make sure it
2018a355152Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2028a355152Smrgpath to pkg-config.
2038108eb18Smrg
2048a355152Smrg_PKG_TEXT
2058108eb18Smrg
2068a355152SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2078a355152Smrg        ])
2088a355152Smrgelse
2098a355152Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2108a355152Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2118a355152Smrg        AC_MSG_RESULT([yes])
2128a355152Smrg	$3
2138a355152Smrgfi[]dnl
2148a355152Smrg])dnl PKG_CHECK_MODULES
2158108eb18Smrg
2168108eb18Smrg
2178a355152Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2188a355152Smrgdnl   [ACTION-IF-NOT-FOUND])
2198a355152Smrgdnl ---------------------------------------------------------------------
2208a355152Smrgdnl Since: 0.29
2218a355152Smrgdnl
2228a355152Smrgdnl Checks for existence of MODULES and gathers its build flags with
2238a355152Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2248a355152Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2258a355152Smrgdnl
2268a355152Smrgdnl Note that if there is a possibility the first call to
2278a355152Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2288a355152Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2298a355152Smrgdnl configure.ac.
2308a355152SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2318a355152Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2328a355152Smrg_save_PKG_CONFIG=$PKG_CONFIG
2338a355152SmrgPKG_CONFIG="$PKG_CONFIG --static"
2348a355152SmrgPKG_CHECK_MODULES($@)
2358a355152SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2368a355152Smrg])dnl PKG_CHECK_MODULES_STATIC
2378108eb18Smrg
2388108eb18Smrg
2398a355152Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2408a355152Smrgdnl -------------------------
2418a355152Smrgdnl Since: 0.27
2428a355152Smrgdnl
2438a355152Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2448a355152Smrgdnl should install pkg-config .pc files. By default the directory is
2458a355152Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2468a355152Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2478a355152Smrgdnl parameter.
2488a355152SmrgAC_DEFUN([PKG_INSTALLDIR],
2498a355152Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2508a355152Smrgm4_pushdef([pkg_description],
2518a355152Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2528a355152SmrgAC_ARG_WITH([pkgconfigdir],
2538a355152Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2548a355152Smrg    [with_pkgconfigdir=]pkg_default)
2558a355152SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2568a355152Smrgm4_popdef([pkg_default])
2578a355152Smrgm4_popdef([pkg_description])
2588a355152Smrg])dnl PKG_INSTALLDIR
2598a355152Smrg
2608a355152Smrg
2618a355152Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2628a355152Smrgdnl --------------------------------
2638a355152Smrgdnl Since: 0.27
2648a355152Smrgdnl
2658a355152Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2668a355152Smrgdnl module should install arch-independent pkg-config .pc files. By
2678a355152Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2688a355152Smrgdnl changed by passing DIRECTORY. The user can override through the
2698a355152Smrgdnl --with-noarch-pkgconfigdir parameter.
2708a355152SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2718a355152Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2728a355152Smrgm4_pushdef([pkg_description],
2738a355152Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2748a355152SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2758a355152Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2768a355152Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2778a355152SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2788a355152Smrgm4_popdef([pkg_default])
2798a355152Smrgm4_popdef([pkg_description])
2808a355152Smrg])dnl PKG_NOARCH_INSTALLDIR
2818a355152Smrg
2828a355152Smrg
2838a355152Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2848a355152Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2858a355152Smrgdnl -------------------------------------------
2868a355152Smrgdnl Since: 0.28
2878a355152Smrgdnl
2888a355152Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2898a355152SmrgAC_DEFUN([PKG_CHECK_VAR],
2908a355152Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2918a355152SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2928108eb18Smrg
2938a355152Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2948a355152SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2951a650d1eSmrg
2968a355152SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2978a355152Smrg])dnl PKG_CHECK_VAR
2988108eb18Smrg
2998a355152Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3008a355152Smrgdnl
3018a355152Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3028a355152Smrgdnl
3038a355152Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3048a355152Smrgdnl copy of this software and associated documentation files (the "Software"),
3058a355152Smrgdnl to deal in the Software without restriction, including without limitation
3068a355152Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3078a355152Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3088a355152Smrgdnl Software is furnished to do so, subject to the following conditions:
3098a355152Smrgdnl
3108a355152Smrgdnl The above copyright notice and this permission notice (including the next
3118a355152Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3128a355152Smrgdnl Software.
3138a355152Smrgdnl
3148a355152Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3158a355152Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3168a355152Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3178a355152Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3188a355152Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3198a355152Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3208a355152Smrgdnl DEALINGS IN THE SOFTWARE.
3218108eb18Smrg
3228a355152Smrg# XORG_MACROS_VERSION(required-version)
3238a355152Smrg# -------------------------------------
3248a355152Smrg# Minimum version: 1.1.0
3258a355152Smrg#
3268a355152Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3278a355152Smrg# your configure.ac with the minimum required version, such as:
3288a355152Smrg# XORG_MACROS_VERSION(1.1)
3298a355152Smrg#
3308a355152Smrg# To ensure that this macro is defined, also add:
3318a355152Smrg# m4_ifndef([XORG_MACROS_VERSION],
3328a355152Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3338a355152Smrg#
3348a355152Smrg#
3358a355152Smrg# See the "minimum version" comment for each macro you use to see what
3368a355152Smrg# version you require.
3378a355152Smrgm4_defun([XORG_MACROS_VERSION],[
3388a355152Smrgm4_define([vers_have], [1.19.0])
3398a355152Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3408a355152Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3418a355152Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3428a355152Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3438a355152Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3448a355152Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3458a355152Smrgm4_undefine([vers_have])
3468a355152Smrgm4_undefine([maj_have])
3478a355152Smrgm4_undefine([maj_needed])
3488a355152Smrg]) # XORG_MACROS_VERSION
3498a355152Smrg
3508a355152Smrg# XORG_PROG_RAWCPP()
3518a355152Smrg# ------------------
3528a355152Smrg# Minimum version: 1.0.0
3538a355152Smrg#
3548a355152Smrg# Find cpp program and necessary flags for use in pre-processing text files
3558a355152Smrg# such as man pages and config files
3568a355152SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3578a355152SmrgAC_REQUIRE([AC_PROG_CPP])
3588a355152SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3598a355152Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3608a355152Smrg
3618a355152Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3628a355152Smrg# which is not the best choice for supporting other OS'es, but covers most
3638a355152Smrg# of the ones we need for now.
3648a355152SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3658a355152SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3668a355152Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3678a355152Smrg	AC_MSG_RESULT([no])
3688108eb18Smrgelse
3698a355152Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3708a355152Smrg		RAWCPPFLAGS=-undef
3718a355152Smrg		AC_MSG_RESULT([yes])
3728a355152Smrg	# under Cygwin unix is still defined even with -undef
3738a355152Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3748a355152Smrg		RAWCPPFLAGS="-undef -ansi"
3758a355152Smrg		AC_MSG_RESULT([yes, with -ansi])
3768a355152Smrg	else
3778a355152Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3788a355152Smrg	fi
3798108eb18Smrgfi
3808a355152Smrgrm -f conftest.$ac_ext
3818108eb18Smrg
3828a355152SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3838a355152SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3848a355152Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3858a355152Smrg	AC_MSG_RESULT([no])
3868a355152Smrgelse
3878a355152Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3888a355152Smrg		TRADITIONALCPPFLAGS="-traditional"
3898a355152Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3908a355152Smrg		AC_MSG_RESULT([yes])
3918a355152Smrg	else
3928a355152Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3938a355152Smrg	fi
3948a355152Smrgfi
3958a355152Smrgrm -f conftest.$ac_ext
3968a355152SmrgAC_SUBST(RAWCPPFLAGS)
3978a355152SmrgAC_SUBST(TRADITIONALCPPFLAGS)
3988a355152Smrg]) # XORG_PROG_RAWCPP
3998108eb18Smrg
4008a355152Smrg# XORG_MANPAGE_SECTIONS()
4018a355152Smrg# -----------------------
4028a355152Smrg# Minimum version: 1.0.0
4038a355152Smrg#
4048a355152Smrg# Determine which sections man pages go in for the different man page types
4058a355152Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4068a355152Smrg# Not sure if there's any better way than just hardcoding by OS name.
4078a355152Smrg# Override default settings by setting environment variables
4088a355152Smrg# Added MAN_SUBSTS in version 1.8
4098a355152Smrg# Added AC_PROG_SED in version 1.8
4108108eb18Smrg
4118a355152SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4128a355152SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4138a355152SmrgAC_REQUIRE([AC_PROG_SED])
4148108eb18Smrg
4158a355152Smrgif test x$APP_MAN_SUFFIX = x    ; then
4168a355152Smrg    APP_MAN_SUFFIX=1
4178a355152Smrgfi
4188a355152Smrgif test x$APP_MAN_DIR = x    ; then
4198a355152Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4208108eb18Smrgfi
4218108eb18Smrg
4228a355152Smrgif test x$LIB_MAN_SUFFIX = x    ; then
4238a355152Smrg    LIB_MAN_SUFFIX=3
4248a355152Smrgfi
4258a355152Smrgif test x$LIB_MAN_DIR = x    ; then
4268a355152Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4278a355152Smrgfi
4288108eb18Smrg
4298a355152Smrgif test x$FILE_MAN_SUFFIX = x    ; then
4308a355152Smrg    case $host_os in
4318a355152Smrg	# Solaris 2.0 - 11 use SysV man page sections
4328a355152Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4338a355152Smrg	*)				FILE_MAN_SUFFIX=5  ;;
4348a355152Smrg    esac
4358a355152Smrgfi
4368a355152Smrgif test x$FILE_MAN_DIR = x    ; then
4378a355152Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4388a355152Smrgfi
4398108eb18Smrg
4408a355152Smrgif test x$MISC_MAN_SUFFIX = x    ; then
4418a355152Smrg    case $host_os in
4428a355152Smrg	# Solaris 2.0 - 11 use SysV man page sections
4438a355152Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4448a355152Smrg	*)				MISC_MAN_SUFFIX=7  ;;
4458a355152Smrg    esac
4468a355152Smrgfi
4478a355152Smrgif test x$MISC_MAN_DIR = x    ; then
4488a355152Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4498a355152Smrgfi
4508108eb18Smrg
4518a355152Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4528a355152Smrg    case $host_os in
4538a355152Smrg	# Solaris 2.0 - 11 use SysV man page sections
4548a355152Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4558a355152Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4568a355152Smrg    esac
4578a355152Smrgfi
4588a355152Smrgif test x$DRIVER_MAN_DIR = x    ; then
4598a355152Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4601a650d1eSmrgfi
4611a650d1eSmrg
4628a355152Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4638a355152Smrg    case $host_os in
4648a355152Smrg	# Solaris 2.0 - 11 use SysV man page sections
4658a355152Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4668a355152Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4678a355152Smrg    esac
4688a355152Smrgfi
4698a355152Smrgif test x$ADMIN_MAN_DIR = x    ; then
4708a355152Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4711a650d1eSmrgfi
4721a650d1eSmrg
4731a650d1eSmrg
4748a355152SmrgAC_SUBST([APP_MAN_SUFFIX])
4758a355152SmrgAC_SUBST([LIB_MAN_SUFFIX])
4768a355152SmrgAC_SUBST([FILE_MAN_SUFFIX])
4778a355152SmrgAC_SUBST([MISC_MAN_SUFFIX])
4788a355152SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4798a355152SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4808a355152SmrgAC_SUBST([APP_MAN_DIR])
4818a355152SmrgAC_SUBST([LIB_MAN_DIR])
4828a355152SmrgAC_SUBST([FILE_MAN_DIR])
4838a355152SmrgAC_SUBST([MISC_MAN_DIR])
4848a355152SmrgAC_SUBST([DRIVER_MAN_DIR])
4858a355152SmrgAC_SUBST([ADMIN_MAN_DIR])
4861a650d1eSmrg
4878a355152SmrgXORG_MAN_PAGE="X Version 11"
4888a355152SmrgAC_SUBST([XORG_MAN_PAGE])
4898a355152SmrgMAN_SUBSTS="\
4908a355152Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4918a355152Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4928a355152Smrg	-e 's|__xservername__|Xorg|g' \
4938a355152Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
4948a355152Smrg	-e 's|__projectroot__|\$(prefix)|g' \
4958a355152Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4968a355152Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4978a355152Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4988a355152Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4998a355152Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5008a355152Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5018a355152Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5028a355152SmrgAC_SUBST([MAN_SUBSTS])
5031a650d1eSmrg
5048a355152Smrg]) # XORG_MANPAGE_SECTIONS
5051a650d1eSmrg
5068a355152Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5078a355152Smrg# ------------------------
5088a355152Smrg# Minimum version: 1.7.0
5098a355152Smrg#
5108a355152Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5118a355152Smrg# provided by xorg-sgml-doctools, if installed.
5128a355152SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5138a355152SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5148a355152SmrgXORG_SGML_PATH=
5158a355152SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5168a355152Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5178a355152Smrg    [m4_ifval([$1],[:],
5188a355152Smrg        [if test x"$cross_compiling" != x"yes" ; then
5198a355152Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5208a355152Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5218a355152Smrg         fi])
5228a355152Smrg    ])
5231a650d1eSmrg
5248a355152Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5258a355152Smrg# the path and the name of the doc stylesheet
5268a355152Smrgif test "x$XORG_SGML_PATH" != "x" ; then
5278a355152Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5288a355152Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5298a355152Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5308a355152Smrgelse
5318a355152Smrg   AC_MSG_RESULT([no])
5328a355152Smrgfi
5331a650d1eSmrg
5348a355152SmrgAC_SUBST(XORG_SGML_PATH)
5358a355152SmrgAC_SUBST(STYLESHEET_SRCDIR)
5368a355152SmrgAC_SUBST(XSL_STYLESHEET)
5378a355152SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5388a355152Smrg]) # XORG_CHECK_SGML_DOCTOOLS
5391a650d1eSmrg
5408a355152Smrg# XORG_CHECK_LINUXDOC
5418a355152Smrg# -------------------
5428a355152Smrg# Minimum version: 1.0.0
5431a650d1eSmrg#
5448a355152Smrg# Defines the variable MAKE_TEXT if the necessary tools and
5458a355152Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5468a355152Smrg# Whether or not the necessary tools and files are found can be checked
5478a355152Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5488a355152SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5498a355152SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5508a355152SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5511a650d1eSmrg
5528a355152SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5535977a007Smrg
5548a355152SmrgAC_MSG_CHECKING([whether to build documentation])
5558a355152Smrg
5568a355152Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5578a355152Smrg   BUILDDOC=yes
5588a355152Smrgelse
5598a355152Smrg   BUILDDOC=no
5601a650d1eSmrgfi
5611a650d1eSmrg
5628a355152SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5638108eb18Smrg
5648a355152SmrgAC_MSG_RESULT([$BUILDDOC])
5658108eb18Smrg
5668a355152SmrgAC_MSG_CHECKING([whether to build pdf documentation])
5678a355152Smrg
5688a355152Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5698a355152Smrg   BUILDPDFDOC=yes
5701a650d1eSmrgelse
5718a355152Smrg   BUILDPDFDOC=no
5721a650d1eSmrgfi
5731a650d1eSmrg
5748a355152SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5751a650d1eSmrg
5768a355152SmrgAC_MSG_RESULT([$BUILDPDFDOC])
5771a650d1eSmrg
5788a355152SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5798a355152SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5808a355152SmrgMAKE_PDF="$PS2PDF"
5818a355152SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5821a650d1eSmrg
5838a355152SmrgAC_SUBST(MAKE_TEXT)
5848a355152SmrgAC_SUBST(MAKE_PS)
5858a355152SmrgAC_SUBST(MAKE_PDF)
5868a355152SmrgAC_SUBST(MAKE_HTML)
5878a355152Smrg]) # XORG_CHECK_LINUXDOC
5881a650d1eSmrg
5898a355152Smrg# XORG_CHECK_DOCBOOK
5908a355152Smrg# -------------------
5918a355152Smrg# Minimum version: 1.0.0
5921a650d1eSmrg#
5938a355152Smrg# Checks for the ability to build output formats from SGML DocBook source.
5948a355152Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5958a355152Smrg# indicates whether the necessary tools and files are found and, if set,
5968a355152Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5978a355152SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5988a355152SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5998108eb18Smrg
6008a355152SmrgBUILDTXTDOC=no
6018a355152SmrgBUILDPDFDOC=no
6028a355152SmrgBUILDPSDOC=no
6038a355152SmrgBUILDHTMLDOC=no
6048108eb18Smrg
6058a355152SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6068a355152SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6078a355152SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6088a355152SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6098108eb18Smrg
6108a355152SmrgAC_MSG_CHECKING([whether to build text documentation])
6118a355152Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6128a355152Smrg   test x$BUILD_TXTDOC != xno; then
6138a355152Smrg	BUILDTXTDOC=yes
6141a650d1eSmrgfi
6158a355152SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6168a355152SmrgAC_MSG_RESULT([$BUILDTXTDOC])
6178a355152Smrg
6188a355152SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6198a355152Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6208a355152Smrg   test x$BUILD_PDFDOC != xno; then
6218a355152Smrg	BUILDPDFDOC=yes
6228108eb18Smrgfi
6238a355152SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6248a355152SmrgAC_MSG_RESULT([$BUILDPDFDOC])
6258108eb18Smrg
6268a355152SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6278a355152Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6288a355152Smrg   test x$BUILD_PSDOC != xno; then
6298a355152Smrg	BUILDPSDOC=yes
6308a355152Smrgfi
6318a355152SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6328a355152SmrgAC_MSG_RESULT([$BUILDPSDOC])
6338108eb18Smrg
6348a355152SmrgAC_MSG_CHECKING([whether to build HTML documentation])
6358a355152Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6368a355152Smrg   test x$BUILD_HTMLDOC != xno; then
6378a355152Smrg	BUILDHTMLDOC=yes
6388a355152Smrgfi
6398a355152SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6408a355152SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6415977a007Smrg
6428a355152SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6438a355152SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6448a355152SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6458a355152SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6468108eb18Smrg
6478a355152SmrgAC_SUBST(MAKE_TEXT)
6488a355152SmrgAC_SUBST(MAKE_PS)
6498a355152SmrgAC_SUBST(MAKE_PDF)
6508a355152SmrgAC_SUBST(MAKE_HTML)
6518a355152Smrg]) # XORG_CHECK_DOCBOOK
6528108eb18Smrg
6538a355152Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6548a355152Smrg# ----------------
6558a355152Smrg# Minimum version: 1.5.0
6568a355152Smrg# Minimum version for optional DEFAULT argument: 1.11.0
6571a650d1eSmrg#
6588a355152Smrg# Documentation tools are not always available on all platforms and sometimes
6598a355152Smrg# not at the appropriate level. This macro enables a module to test for the
6608a355152Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
6618a355152Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6628a355152Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6638a355152Smrg# --with-xmlto assumes 'auto'.
6648108eb18Smrg#
6658a355152Smrg# Interface to module:
6668a355152Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6678a355152Smrg# XMLTO:	returns the path of the xmlto program found
6688a355152Smrg#		returns the path set by the user in the environment
6698a355152Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6708a355152Smrg#		'no' user instructs the module not to use xmlto
6718a355152Smrg#
6728a355152Smrg# Added in version 1.10.0
6738a355152Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6748a355152Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6758a355152Smrg#
6768a355152Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6778a355152Smrg#
6788a355152SmrgAC_DEFUN([XORG_WITH_XMLTO],[
6798a355152SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6808a355152Smrgm4_define([_defopt], m4_default([$2], [auto]))
6818a355152SmrgAC_ARG_WITH(xmlto,
6828a355152Smrg	AS_HELP_STRING([--with-xmlto],
6838a355152Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6848a355152Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6858a355152Smrgm4_undefine([_defopt])
6868108eb18Smrg
6878a355152Smrgif test "x$use_xmlto" = x"auto"; then
6888a355152Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6898a355152Smrg   if test "x$XMLTO" = "x"; then
6908a355152Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6918a355152Smrg	have_xmlto=no
6928a355152Smrg   else
6938a355152Smrg        have_xmlto=yes
6948a355152Smrg   fi
6958a355152Smrgelif test "x$use_xmlto" = x"yes" ; then
6968a355152Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6978a355152Smrg   if test "x$XMLTO" = "x"; then
6988a355152Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6991a650d1eSmrg   fi
7008a355152Smrg   have_xmlto=yes
7018a355152Smrgelif test "x$use_xmlto" = x"no" ; then
7028a355152Smrg   if test "x$XMLTO" != "x"; then
7038a355152Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7041a650d1eSmrg   fi
7058a355152Smrg   have_xmlto=no
7068108eb18Smrgelse
7078a355152Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7081a650d1eSmrgfi
7098108eb18Smrg
7108a355152Smrg# Test for a minimum version of xmlto, if provided.
7118a355152Smrgm4_ifval([$1],
7128a355152Smrg[if test "$have_xmlto" = yes; then
7138a355152Smrg    # scrape the xmlto version
7148a355152Smrg    AC_MSG_CHECKING([the xmlto version])
7158a355152Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7168a355152Smrg    AC_MSG_RESULT([$xmlto_version])
7178a355152Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7188a355152Smrg        [if test "x$use_xmlto" = xauto; then
7198a355152Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7208a355152Smrg            have_xmlto=no
7218a355152Smrg        else
7228a355152Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7238a355152Smrg        fi])
7248a355152Smrgfi])
7251a650d1eSmrg
7268a355152Smrg# Test for the ability of xmlto to generate a text target
7278108eb18Smrg#
7288a355152Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7298a355152Smrg# following test for empty XML docbook files.
7308a355152Smrg# For compatibility reasons use the following empty XML docbook file and if
7318a355152Smrg# it fails try it again with a non-empty XML file.
7328a355152Smrghave_xmlto_text=no
7338a355152Smrgcat > conftest.xml << "EOF"
7348a355152SmrgEOF
7358a355152SmrgAS_IF([test "$have_xmlto" = yes],
7368a355152Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7378a355152Smrg             [have_xmlto_text=yes],
7388a355152Smrg             [# Try it again with a non-empty XML file.
7398a355152Smrg              cat > conftest.xml << "EOF"
7408a355152Smrg<x></x>
7418a355152SmrgEOF
7428a355152Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7438a355152Smrg                    [have_xmlto_text=yes],
7448a355152Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7458a355152Smrgrm -f conftest.xml
7468a355152SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7478a355152SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7488a355152Smrg]) # XORG_WITH_XMLTO
7491a650d1eSmrg
7508a355152Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7518a355152Smrg# --------------------------------------------
7528a355152Smrg# Minimum version: 1.12.0
7538a355152Smrg# Minimum version for optional DEFAULT argument: 1.12.0
7548108eb18Smrg#
7558a355152Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7568a355152Smrg# XML-based language used for the transformation of XML documents.
7578a355152Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7588a355152Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7598a355152Smrg# The XSLT processor is often used as a standalone tool for transformations.
7608a355152Smrg# It should not be assumed that this tool is used only to work with documnetation.
7618a355152Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7621a650d1eSmrg#
7638a355152Smrg# Interface to module:
7648a355152Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7658a355152Smrg# XSLTPROC:	 returns the path of the xsltproc program found
7668a355152Smrg#		 returns the path set by the user in the environment
7678a355152Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7688a355152Smrg#		  'no' user instructs the module not to use xsltproc
7698a355152Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7701a650d1eSmrg#
7718a355152Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7721a650d1eSmrg#
7738a355152SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7748a355152SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7758a355152Smrg# Preserves the interface, should it be implemented later
7768a355152Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7778a355152Smrgm4_define([_defopt], m4_default([$2], [auto]))
7788a355152SmrgAC_ARG_WITH(xsltproc,
7798a355152Smrg	AS_HELP_STRING([--with-xsltproc],
7808a355152Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7818a355152Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7828a355152Smrgm4_undefine([_defopt])
7838108eb18Smrg
7848a355152Smrgif test "x$use_xsltproc" = x"auto"; then
7858a355152Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7868a355152Smrg   if test "x$XSLTPROC" = "x"; then
7878a355152Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7888a355152Smrg	have_xsltproc=no
7898a355152Smrg   else
7908a355152Smrg        have_xsltproc=yes
7918a355152Smrg   fi
7928a355152Smrgelif test "x$use_xsltproc" = x"yes" ; then
7938a355152Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7948a355152Smrg   if test "x$XSLTPROC" = "x"; then
7958a355152Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7968a355152Smrg   fi
7978a355152Smrg   have_xsltproc=yes
7988a355152Smrgelif test "x$use_xsltproc" = x"no" ; then
7998a355152Smrg   if test "x$XSLTPROC" != "x"; then
8008a355152Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8018a355152Smrg   fi
8028a355152Smrg   have_xsltproc=no
8038a355152Smrgelse
8048a355152Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8058a355152Smrgfi
8068108eb18Smrg
8078a355152SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8088a355152Smrg]) # XORG_WITH_XSLTPROC
8098108eb18Smrg
8108a355152Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8118a355152Smrg# ----------------------------------------
8128a355152Smrg# Minimum version: 1.15.0
8135977a007Smrg#
8148a355152Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8158a355152Smrg# scanning arbitrary text files, extracting information from those text files,
8168a355152Smrg# and printing reports based on that information.
8175977a007Smrg#
8188a355152Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8195977a007Smrg#
8208a355152Smrg# Interface to module:
8218a355152Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8228a355152Smrg# PERL:	     returns the path of the perl program found
8238a355152Smrg#	     returns the path set by the user in the environment
8248a355152Smrg# --with-perl: 'yes' user instructs the module to use perl
8258a355152Smrg#	       'no' user instructs the module not to use perl
8268a355152Smrg# have_perl: returns yes if perl found in PATH or no
8275977a007Smrg#
8288a355152Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8295977a007Smrg#
8308a355152SmrgAC_DEFUN([XORG_WITH_PERL],[
8318a355152SmrgAC_ARG_VAR([PERL], [Path to perl command])
8328a355152Smrg# Preserves the interface, should it be implemented later
8338a355152Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8348a355152Smrgm4_define([_defopt], m4_default([$2], [auto]))
8358a355152SmrgAC_ARG_WITH(perl,
8368a355152Smrg	AS_HELP_STRING([--with-perl],
8378a355152Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8388a355152Smrg	   [use_perl=$withval], [use_perl=]_defopt)
8398a355152Smrgm4_undefine([_defopt])
8405977a007Smrg
8418a355152Smrgif test "x$use_perl" = x"auto"; then
8428a355152Smrg   AC_PATH_PROG([PERL], [perl])
8438a355152Smrg   if test "x$PERL" = "x"; then
8448a355152Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8458a355152Smrg	have_perl=no
8468a355152Smrg   else
8478a355152Smrg        have_perl=yes
8488a355152Smrg   fi
8498a355152Smrgelif test "x$use_perl" = x"yes" ; then
8508a355152Smrg   AC_PATH_PROG([PERL], [perl])
8518a355152Smrg   if test "x$PERL" = "x"; then
8528a355152Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8538a355152Smrg   fi
8548a355152Smrg   have_perl=yes
8558a355152Smrgelif test "x$use_perl" = x"no" ; then
8568a355152Smrg   if test "x$PERL" != "x"; then
8578a355152Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8588a355152Smrg   fi
8598a355152Smrg   have_perl=no
8605977a007Smrgelse
8618a355152Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8628a355152Smrgfi
8635977a007Smrg
8648a355152SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8658a355152Smrg]) # XORG_WITH_PERL
8665977a007Smrg
8678a355152Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8688a355152Smrg# ----------------
8698a355152Smrg# Minimum version: 1.5.0
8708a355152Smrg# Minimum version for optional DEFAULT argument: 1.11.0
8715977a007Smrg#
8728a355152Smrg# Documentation tools are not always available on all platforms and sometimes
8738a355152Smrg# not at the appropriate level. This macro enables a module to test for the
8748a355152Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
8758a355152Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8768a355152Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8778a355152Smrg# --with-asciidoc assumes 'auto'.
8785977a007Smrg#
8798a355152Smrg# Interface to module:
8808a355152Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8818a355152Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
8828a355152Smrg#		 returns the path set by the user in the environment
8838a355152Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8848a355152Smrg#		  'no' user instructs the module not to use asciidoc
8855977a007Smrg#
8868a355152Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8875977a007Smrg#
8888a355152SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8898a355152SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8908a355152Smrgm4_define([_defopt], m4_default([$2], [auto]))
8918a355152SmrgAC_ARG_WITH(asciidoc,
8928a355152Smrg	AS_HELP_STRING([--with-asciidoc],
8938a355152Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8948a355152Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8958a355152Smrgm4_undefine([_defopt])
8965977a007Smrg
8978a355152Smrgif test "x$use_asciidoc" = x"auto"; then
8988a355152Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8998a355152Smrg   if test "x$ASCIIDOC" = "x"; then
9008a355152Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9018a355152Smrg	have_asciidoc=no
9028a355152Smrg   else
9038a355152Smrg        have_asciidoc=yes
9048a355152Smrg   fi
9058a355152Smrgelif test "x$use_asciidoc" = x"yes" ; then
9068a355152Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9078a355152Smrg   if test "x$ASCIIDOC" = "x"; then
9088a355152Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9098a355152Smrg   fi
9108a355152Smrg   have_asciidoc=yes
9118a355152Smrgelif test "x$use_asciidoc" = x"no" ; then
9128a355152Smrg   if test "x$ASCIIDOC" != "x"; then
9138a355152Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9148a355152Smrg   fi
9158a355152Smrg   have_asciidoc=no
9165977a007Smrgelse
9178a355152Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9188a355152Smrgfi
9198a355152Smrgm4_ifval([$1],
9208a355152Smrg[if test "$have_asciidoc" = yes; then
9218a355152Smrg    # scrape the asciidoc version
9228a355152Smrg    AC_MSG_CHECKING([the asciidoc version])
9238a355152Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9248a355152Smrg    AC_MSG_RESULT([$asciidoc_version])
9258a355152Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9268a355152Smrg        [if test "x$use_asciidoc" = xauto; then
9278a355152Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9288a355152Smrg            have_asciidoc=no
9298a355152Smrg        else
9308a355152Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9318a355152Smrg        fi])
9328a355152Smrgfi])
9338a355152SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9348a355152Smrg]) # XORG_WITH_ASCIIDOC
9351a650d1eSmrg
9368a355152Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9378a355152Smrg# -------------------------------------------
9388a355152Smrg# Minimum version: 1.5.0
9398a355152Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9408a355152Smrg# Minimum version for optional DOT checking: 1.18.0
9411a650d1eSmrg#
9428a355152Smrg# Documentation tools are not always available on all platforms and sometimes
9438a355152Smrg# not at the appropriate level. This macro enables a module to test for the
9448a355152Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9458a355152Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9468a355152Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9478a355152Smrg# --with-doxygen assumes 'auto'.
9481a650d1eSmrg#
9498a355152Smrg# Interface to module:
9508a355152Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9518a355152Smrg# DOXYGEN:	 returns the path of the doxygen program found
9528a355152Smrg#		 returns the path set by the user in the environment
9538a355152Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9548a355152Smrg#		  'no' user instructs the module not to use doxygen
9551a650d1eSmrg#
9568a355152Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9571a650d1eSmrg#
9588a355152SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9598a355152SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9608a355152SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9618a355152Smrgm4_define([_defopt], m4_default([$2], [auto]))
9628a355152SmrgAC_ARG_WITH(doxygen,
9638a355152Smrg	AS_HELP_STRING([--with-doxygen],
9648a355152Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9658a355152Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9668a355152Smrgm4_undefine([_defopt])
9678108eb18Smrg
9688a355152Smrgif test "x$use_doxygen" = x"auto"; then
9698a355152Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9708a355152Smrg   if test "x$DOXYGEN" = "x"; then
9718a355152Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9728a355152Smrg	have_doxygen=no
9738a355152Smrg   else
9748a355152Smrg        have_doxygen=yes
9758a355152Smrg   fi
9768a355152Smrgelif test "x$use_doxygen" = x"yes" ; then
9778a355152Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9788a355152Smrg   if test "x$DOXYGEN" = "x"; then
9798a355152Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9808a355152Smrg   fi
9818a355152Smrg   have_doxygen=yes
9828a355152Smrgelif test "x$use_doxygen" = x"no" ; then
9838a355152Smrg   if test "x$DOXYGEN" != "x"; then
9848a355152Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9858a355152Smrg   fi
9868a355152Smrg   have_doxygen=no
9878108eb18Smrgelse
9888a355152Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9898108eb18Smrgfi
9908a355152Smrgm4_ifval([$1],
9918a355152Smrg[if test "$have_doxygen" = yes; then
9928a355152Smrg    # scrape the doxygen version
9938a355152Smrg    AC_MSG_CHECKING([the doxygen version])
9948a355152Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9958a355152Smrg    AC_MSG_RESULT([$doxygen_version])
9968a355152Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9978a355152Smrg        [if test "x$use_doxygen" = xauto; then
9988a355152Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9998a355152Smrg            have_doxygen=no
10008a355152Smrg        else
10018a355152Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10028a355152Smrg        fi])
10038a355152Smrgfi])
10048108eb18Smrg
10058a355152Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10068a355152Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10078a355152Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10088a355152SmrgHAVE_DOT=no
10098a355152Smrgif test "x$have_doxygen" = "xyes"; then
10108a355152Smrg  AC_PATH_PROG([DOT], [dot])
10118a355152Smrg    if test "x$DOT" != "x"; then
10128a355152Smrg      HAVE_DOT=yes
10138a355152Smrg    fi
10148108eb18Smrgfi
10158108eb18Smrg
10168a355152SmrgAC_SUBST([HAVE_DOT])
10178a355152SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10188a355152SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10198a355152Smrg]) # XORG_WITH_DOXYGEN
10208108eb18Smrg
10218a355152Smrg# XORG_WITH_GROFF([DEFAULT])
10228a355152Smrg# ----------------
10238a355152Smrg# Minimum version: 1.6.0
10248a355152Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10258a355152Smrg#
10268a355152Smrg# Documentation tools are not always available on all platforms and sometimes
10278a355152Smrg# not at the appropriate level. This macro enables a module to test for the
10288a355152Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10298a355152Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
10308a355152Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
10318a355152Smrg# --with-groff assumes 'auto'.
10328a355152Smrg#
10338a355152Smrg# Interface to module:
10348a355152Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10358a355152Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10368a355152Smrg# HAVE_GROFF_MS: the -ms macros package
10378a355152Smrg# GROFF:	 returns the path of the groff program found
10388a355152Smrg#		 returns the path set by the user in the environment
10398a355152Smrg# --with-groff:	 'yes' user instructs the module to use groff
10408a355152Smrg#		 'no' user instructs the module not to use groff
10418a355152Smrg#
10428a355152Smrg# Added in version 1.9.0:
10438a355152Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10448a355152Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10458a355152Smrg#		   psselect from the psutils package.
10468a355152Smrg#		   the ghostcript package. Refer to the grohtml man pages
10478a355152Smrg#
10488a355152Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10498a355152Smrg#
10508a355152Smrg# OS and distros often splits groff in a basic and full package, the former
10518a355152Smrg# having the groff program and the later having devices, fonts and macros
10528a355152Smrg# Checking for the groff executable is not enough.
10538a355152Smrg#
10548a355152Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
10558a355152Smrg# unset HAVE_GROFF or GROFF env variables.
10568a355152Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10578a355152Smrg#
10588a355152SmrgAC_DEFUN([XORG_WITH_GROFF],[
10598a355152SmrgAC_ARG_VAR([GROFF], [Path to groff command])
10608a355152Smrgm4_define([_defopt], m4_default([$1], [auto]))
10618a355152SmrgAC_ARG_WITH(groff,
10628a355152Smrg	AS_HELP_STRING([--with-groff],
10638a355152Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10648a355152Smrg	   [use_groff=$withval], [use_groff=]_defopt)
10658a355152Smrgm4_undefine([_defopt])
10668108eb18Smrg
10678a355152Smrgif test "x$use_groff" = x"auto"; then
10688a355152Smrg   AC_PATH_PROG([GROFF], [groff])
10698a355152Smrg   if test "x$GROFF" = "x"; then
10708a355152Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10718a355152Smrg	have_groff=no
10728a355152Smrg   else
10738a355152Smrg        have_groff=yes
10748a355152Smrg   fi
10758a355152Smrgelif test "x$use_groff" = x"yes" ; then
10768a355152Smrg   AC_PATH_PROG([GROFF], [groff])
10778a355152Smrg   if test "x$GROFF" = "x"; then
10788a355152Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10798a355152Smrg   fi
10808a355152Smrg   have_groff=yes
10818a355152Smrgelif test "x$use_groff" = x"no" ; then
10828a355152Smrg   if test "x$GROFF" != "x"; then
10838a355152Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10848a355152Smrg   fi
10858a355152Smrg   have_groff=no
10868a355152Smrgelse
10878a355152Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10888108eb18Smrgfi
10898108eb18Smrg
10908a355152Smrg# We have groff, test for the presence of the macro packages
10918a355152Smrgif test "x$have_groff" = x"yes"; then
10928a355152Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10938a355152Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10948a355152Smrg        groff_ms_works=yes
10958a355152Smrg    else
10968a355152Smrg        groff_ms_works=no
10978a355152Smrg    fi
10988a355152Smrg    AC_MSG_RESULT([$groff_ms_works])
10998a355152Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11008a355152Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11018a355152Smrg        groff_mm_works=yes
11028a355152Smrg    else
11038a355152Smrg        groff_mm_works=no
11048a355152Smrg    fi
11058a355152Smrg    AC_MSG_RESULT([$groff_mm_works])
11068108eb18Smrgfi
11078108eb18Smrg
11088a355152Smrg# We have groff, test for HTML dependencies, one command per package
11098a355152Smrgif test "x$have_groff" = x"yes"; then
11108a355152Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11118a355152Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11128a355152Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11138a355152Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11148a355152Smrg      have_groff_html=yes
11158a355152Smrg   else
11168a355152Smrg      have_groff_html=no
11178a355152Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11188a355152Smrg   fi
11198108eb18Smrgfi
11208108eb18Smrg
11218a355152Smrg# Set Automake conditionals for Makefiles
11228a355152SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11238a355152SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11248a355152SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11258a355152SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11268a355152Smrg]) # XORG_WITH_GROFF
11278108eb18Smrg
11288a355152Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11298a355152Smrg# ---------------------------------------
11308a355152Smrg# Minimum version: 1.6.0
11318a355152Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11328a355152Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11331a650d1eSmrg#
11348a355152Smrg# Documentation tools are not always available on all platforms and sometimes
11358a355152Smrg# not at the appropriate level. This macro enables a module to test for the
11368a355152Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11378a355152Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
11388a355152Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
11398a355152Smrg# --with-fop assumes 'auto'.
11408a355152Smrg#
11418a355152Smrg# Interface to module:
11428a355152Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11438a355152Smrg# FOP:	 	returns the path of the fop program found
11448a355152Smrg#		returns the path set by the user in the environment
11458a355152Smrg# --with-fop: 	'yes' user instructs the module to use fop
11468a355152Smrg#		'no' user instructs the module not to use fop
11478a355152Smrg#
11488a355152Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
11498a355152Smrg#
11508a355152SmrgAC_DEFUN([XORG_WITH_FOP],[
11518a355152SmrgAC_ARG_VAR([FOP], [Path to fop command])
11528a355152Smrgm4_define([_defopt], m4_default([$2], [auto]))
11538a355152SmrgAC_ARG_WITH(fop,
11548a355152Smrg	AS_HELP_STRING([--with-fop],
11558a355152Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11568a355152Smrg	   [use_fop=$withval], [use_fop=]_defopt)
11578a355152Smrgm4_undefine([_defopt])
11581a650d1eSmrg
11598a355152Smrgif test "x$use_fop" = x"auto"; then
11608a355152Smrg   AC_PATH_PROG([FOP], [fop])
11618a355152Smrg   if test "x$FOP" = "x"; then
11628a355152Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11638a355152Smrg	have_fop=no
11648a355152Smrg   else
11658a355152Smrg        have_fop=yes
11668a355152Smrg   fi
11678a355152Smrgelif test "x$use_fop" = x"yes" ; then
11688a355152Smrg   AC_PATH_PROG([FOP], [fop])
11698a355152Smrg   if test "x$FOP" = "x"; then
11708a355152Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11718a355152Smrg   fi
11728a355152Smrg   have_fop=yes
11738a355152Smrgelif test "x$use_fop" = x"no" ; then
11748a355152Smrg   if test "x$FOP" != "x"; then
11758a355152Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11768a355152Smrg   fi
11778a355152Smrg   have_fop=no
11781a650d1eSmrgelse
11798a355152Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11801a650d1eSmrgfi
11811a650d1eSmrg
11828a355152Smrg# Test for a minimum version of fop, if provided.
11838a355152Smrgm4_ifval([$1],
11848a355152Smrg[if test "$have_fop" = yes; then
11858a355152Smrg    # scrape the fop version
11868a355152Smrg    AC_MSG_CHECKING([for fop minimum version])
11878a355152Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11888a355152Smrg    AC_MSG_RESULT([$fop_version])
11898a355152Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
11908a355152Smrg        [if test "x$use_fop" = xauto; then
11918a355152Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11928a355152Smrg            have_fop=no
11938a355152Smrg        else
11948a355152Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11958a355152Smrg        fi])
11968a355152Smrgfi])
11978a355152SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11988a355152Smrg]) # XORG_WITH_FOP
11991a650d1eSmrg
12008a355152Smrg# XORG_WITH_M4([MIN-VERSION])
12018a355152Smrg# ---------------------------
12028a355152Smrg# Minimum version: 1.19.0
12031a650d1eSmrg#
12048a355152Smrg# This macro attempts to locate an m4 macro processor which supports
12058a355152Smrg# -I option and is only useful for modules relying on M4 in order to
12068a355152Smrg# expand macros in source code files.
12071a650d1eSmrg#
12088a355152Smrg# Interface to module:
12098a355152Smrg# M4:	 	returns the path of the m4 program found
12108a355152Smrg#		returns the path set by the user in the environment
12118a355152Smrg#
12128a355152SmrgAC_DEFUN([XORG_WITH_M4], [
12138a355152SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12148a355152Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12158a355152Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12168a355152Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12178a355152Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12188a355152Smrg   [$PATH:/usr/gnu/bin])])
12191a650d1eSmrg
12208a355152SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12218a355152Smrg]) # XORG_WITH_M4
12221a650d1eSmrg
12238a355152Smrg# XORG_WITH_PS2PDF([DEFAULT])
12241a650d1eSmrg# ----------------
12258a355152Smrg# Minimum version: 1.6.0
12265977a007Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12271a650d1eSmrg#
12281a650d1eSmrg# Documentation tools are not always available on all platforms and sometimes
12291a650d1eSmrg# not at the appropriate level. This macro enables a module to test for the
12301a650d1eSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12318a355152Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12328a355152Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12338a355152Smrg# --with-ps2pdf assumes 'auto'.
12341a650d1eSmrg#
12351a650d1eSmrg# Interface to module:
12368a355152Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12378a355152Smrg# PS2PDF:	returns the path of the ps2pdf program found
12381a650d1eSmrg#		returns the path set by the user in the environment
12398a355152Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12408a355152Smrg#		 'no' user instructs the module not to use ps2pdf
12411a650d1eSmrg#
12428a355152Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12431a650d1eSmrg#
12448a355152SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12458a355152SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12468a355152Smrgm4_define([_defopt], m4_default([$1], [auto]))
12478a355152SmrgAC_ARG_WITH(ps2pdf,
12488a355152Smrg	AS_HELP_STRING([--with-ps2pdf],
12498a355152Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12508a355152Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12515977a007Smrgm4_undefine([_defopt])
12521a650d1eSmrg
12538a355152Smrgif test "x$use_ps2pdf" = x"auto"; then
12548a355152Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12558a355152Smrg   if test "x$PS2PDF" = "x"; then
12568a355152Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12578a355152Smrg	have_ps2pdf=no
12581a650d1eSmrg   else
12598a355152Smrg        have_ps2pdf=yes
12601a650d1eSmrg   fi
12618a355152Smrgelif test "x$use_ps2pdf" = x"yes" ; then
12628a355152Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12638a355152Smrg   if test "x$PS2PDF" = "x"; then
12648a355152Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12651a650d1eSmrg   fi
12668a355152Smrg   have_ps2pdf=yes
12678a355152Smrgelif test "x$use_ps2pdf" = x"no" ; then
12688a355152Smrg   if test "x$PS2PDF" != "x"; then
12698a355152Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12701a650d1eSmrg   fi
12718a355152Smrg   have_ps2pdf=no
12721a650d1eSmrgelse
12738a355152Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12741a650d1eSmrgfi
12758a355152SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12768a355152Smrg]) # XORG_WITH_PS2PDF
12771a650d1eSmrg
12788a355152Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
12798a355152Smrg# ----------------
12808a355152Smrg# Minimum version: 1.6.0
12815977a007Smrg#
12828a355152Smrg# Documentation tools are not always available on all platforms and sometimes
12838a355152Smrg# not at the appropriate level. This macro enables a builder to skip all
12848a355152Smrg# documentation targets except traditional man pages.
12858a355152Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12868a355152Smrg# maximum flexibilty in controlling documentation building.
12878a355152Smrg# Refer to:
12888a355152Smrg# XORG_WITH_XMLTO         --with-xmlto
12898a355152Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12908a355152Smrg# XORG_WITH_DOXYGEN       --with-doxygen
12918a355152Smrg# XORG_WITH_FOP           --with-fop
12928a355152Smrg# XORG_WITH_GROFF         --with-groff
12938a355152Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
12945977a007Smrg#
12955977a007Smrg# Interface to module:
12968a355152Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12978a355152Smrg# --enable-docs: 'yes' user instructs the module to generate docs
12988a355152Smrg#		 'no' user instructs the module not to generate docs
12998a355152Smrg# parm1:	specify the default value, yes or no.
13005977a007Smrg#
13018a355152SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13028a355152Smrgm4_define([docs_default], m4_default([$1], [yes]))
13038a355152SmrgAC_ARG_ENABLE(docs,
13048a355152Smrg	AS_HELP_STRING([--enable-docs],
13058a355152Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13068a355152Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13078a355152Smrgm4_undefine([docs_default])
13088a355152SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13098a355152SmrgAC_MSG_CHECKING([whether to build documentation])
13108a355152SmrgAC_MSG_RESULT([$build_docs])
13118a355152Smrg]) # XORG_ENABLE_DOCS
13125977a007Smrg
13138a355152Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13148a355152Smrg# ----------------
13158a355152Smrg# Minimum version: 1.6.0
13168a355152Smrg#
13178a355152Smrg# This macro enables a builder to skip all developer documentation.
13188a355152Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13198a355152Smrg# maximum flexibilty in controlling documentation building.
13208a355152Smrg# Refer to:
13218a355152Smrg# XORG_WITH_XMLTO         --with-xmlto
13228a355152Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13238a355152Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13248a355152Smrg# XORG_WITH_FOP           --with-fop
13258a355152Smrg# XORG_WITH_GROFF         --with-groff
13268a355152Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13278a355152Smrg#
13288a355152Smrg# Interface to module:
13298a355152Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13308a355152Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13318a355152Smrg#			'no' user instructs the module not to generate developer docs
13328a355152Smrg# parm1:		specify the default value, yes or no.
13338a355152Smrg#
13348a355152SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13358a355152Smrgm4_define([devel_default], m4_default([$1], [yes]))
13368a355152SmrgAC_ARG_ENABLE(devel-docs,
13378a355152Smrg	AS_HELP_STRING([--enable-devel-docs],
13388a355152Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13398a355152Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13408a355152Smrgm4_undefine([devel_default])
13418a355152SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13428a355152SmrgAC_MSG_CHECKING([whether to build developer documentation])
13438a355152SmrgAC_MSG_RESULT([$build_devel_docs])
13448a355152Smrg]) # XORG_ENABLE_DEVEL_DOCS
13455977a007Smrg
13468a355152Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
13478a355152Smrg# ----------------
13488a355152Smrg# Minimum version: 1.6.0
13498a355152Smrg#
13508a355152Smrg# This macro enables a builder to skip all functional specification targets.
13518a355152Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13528a355152Smrg# maximum flexibilty in controlling documentation building.
13538a355152Smrg# Refer to:
13548a355152Smrg# XORG_WITH_XMLTO         --with-xmlto
13558a355152Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13568a355152Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13578a355152Smrg# XORG_WITH_FOP           --with-fop
13588a355152Smrg# XORG_WITH_GROFF         --with-groff
13598a355152Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13608a355152Smrg#
13618a355152Smrg# Interface to module:
13628a355152Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13638a355152Smrg# --enable-specs:	'yes' user instructs the module to generate specs
13648a355152Smrg#			'no' user instructs the module not to generate specs
13658a355152Smrg# parm1:		specify the default value, yes or no.
13668a355152Smrg#
13678a355152SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13688a355152Smrgm4_define([spec_default], m4_default([$1], [yes]))
13698a355152SmrgAC_ARG_ENABLE(specs,
13708a355152Smrg	AS_HELP_STRING([--enable-specs],
13718a355152Smrg	   [Enable building the specs (default: ]spec_default[)]),
13728a355152Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
13738a355152Smrgm4_undefine([spec_default])
13748a355152SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13758a355152SmrgAC_MSG_CHECKING([whether to build functional specifications])
13768a355152SmrgAC_MSG_RESULT([$build_specs])
13778a355152Smrg]) # XORG_ENABLE_SPECS
13785977a007Smrg
13798a355152Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13808a355152Smrg# ----------------------------------------------
13818a355152Smrg# Minimum version: 1.13.0
13825977a007Smrg#
13838a355152Smrg# This macro enables a builder to enable/disable unit testing
13848a355152Smrg# It makes no assumption about the test cases implementation
13858a355152Smrg# Test cases may or may not use Automake "Support for test suites"
13868a355152Smrg# They may or may not use the software utility library GLib
13875977a007Smrg#
13888a355152Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13898a355152Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13908a355152Smrg# The variable enable_unit_tests is used by other macros in this file.
13915977a007Smrg#
13925977a007Smrg# Interface to module:
13938a355152Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13948a355152Smrg# enable_unit_tests:    used in configure.ac for additional configuration
13958a355152Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13968a355152Smrg#			'no' user instructs the module not to build tests
13978a355152Smrg# parm1:		specify the default value, yes or no.
13985977a007Smrg#
13998a355152SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14008a355152SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14018a355152SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14028a355152SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14038a355152Smrgm4_define([_defopt], m4_default([$1], [auto]))
14048a355152SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14058a355152Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14068a355152Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14075977a007Smrgm4_undefine([_defopt])
14088a355152SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14098a355152SmrgAC_MSG_CHECKING([whether to build unit test cases])
14108a355152SmrgAC_MSG_RESULT([$enable_unit_tests])
14118a355152Smrg]) # XORG_ENABLE_UNIT_TESTS
14125977a007Smrg
14138a355152Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14148a355152Smrg# ------------------------------------------------------
14158a355152Smrg# Minimum version: 1.17.0
14161a650d1eSmrg#
14178a355152Smrg# This macro enables a builder to enable/disable integration testing
14188a355152Smrg# It makes no assumption about the test cases' implementation
14198a355152Smrg# Test cases may or may not use Automake "Support for test suites"
14208a355152Smrg#
14218a355152Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14228a355152Smrg# usually requires less dependencies and may be built and run under less
14238a355152Smrg# stringent environments than integration tests.
14241a650d1eSmrg#
14251a650d1eSmrg# Interface to module:
14268a355152Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14278a355152Smrg# enable_integration_tests:   used in configure.ac for additional configuration
14288a355152Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14298a355152Smrg#                             'no' user instructs the module not to build tests
14308a355152Smrg# parm1:                      specify the default value, yes or no.
14311a650d1eSmrg#
14328a355152SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14338a355152SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14348a355152Smrgm4_define([_defopt], m4_default([$1], [auto]))
14358a355152SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14368a355152Smrg	[Enable building integration test cases (default: ]_defopt[)]),
14378a355152Smrg	[enable_integration_tests=$enableval],
14388a355152Smrg	[enable_integration_tests=]_defopt)
14398a355152Smrgm4_undefine([_defopt])
14408a355152SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14418a355152Smrg	[test "x$enable_integration_tests" != xno])
14428a355152SmrgAC_MSG_CHECKING([whether to build unit test cases])
14438a355152SmrgAC_MSG_RESULT([$enable_integration_tests])
14448a355152Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
14458a355152Smrg
14468a355152Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14478a355152Smrg# ----------------------------------------
14488a355152Smrg# Minimum version: 1.13.0
14491a650d1eSmrg#
14508a355152Smrg# GLib is a library which provides advanced data structures and functions.
14518a355152Smrg# This macro enables a module to test for the presence of Glib.
14528a355152Smrg#
14538a355152Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14548a355152Smrg# Otherwise the value of $enable_unit_tests is blank.
14558a355152Smrg#
14568a355152Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14578a355152Smrg# test support usually requires less dependencies and may be built and run under
14588a355152Smrg# less stringent environments than integration tests.
14598a355152Smrg#
14608a355152Smrg# Interface to module:
14618a355152Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
14628a355152Smrg# with_glib: used in configure.ac to know if GLib has been found
14638a355152Smrg# --with-glib:	'yes' user instructs the module to use glib
14648a355152Smrg#		'no' user instructs the module not to use glib
14658a355152Smrg#
14668a355152SmrgAC_DEFUN([XORG_WITH_GLIB],[
14678a355152SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14685977a007Smrgm4_define([_defopt], m4_default([$2], [auto]))
14698a355152SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14708a355152Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14718a355152Smrg	[with_glib=$withval], [with_glib=]_defopt)
14725977a007Smrgm4_undefine([_defopt])
14731a650d1eSmrg
14748a355152Smrghave_glib=no
14758a355152Smrg# Do not probe GLib if user explicitly disabled unit testing
14768a355152Smrgif test "x$enable_unit_tests" != x"no"; then
14778a355152Smrg  # Do not probe GLib if user explicitly disabled it
14788a355152Smrg  if test "x$with_glib" != x"no"; then
14798a355152Smrg    m4_ifval(
14808a355152Smrg      [$1],
14818a355152Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14828a355152Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14838a355152Smrg    )
14848a355152Smrg  fi
14851a650d1eSmrgfi
14861a650d1eSmrg
14878a355152Smrg# Not having GLib when unit testing has been explicitly requested is an error
14888a355152Smrgif test "x$enable_unit_tests" = x"yes"; then
14898a355152Smrg  if test "x$have_glib" = x"no"; then
14908a355152Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14918a355152Smrg  fi
14928a355152Smrgfi
14938a355152Smrg
14948a355152Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
14958a355152Smrgif test "x$enable_unit_tests" = x"no"; then
14968a355152Smrg  if test "x$with_glib" = x"yes"; then
14978a355152Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14988a355152Smrg  fi
14998a355152Smrgfi
15008a355152Smrg
15018a355152Smrg# Not having GLib when it has been explicitly requested is an error
15028a355152Smrgif test "x$with_glib" = x"yes"; then
15038a355152Smrg  if test "x$have_glib" = x"no"; then
15048a355152Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15058a355152Smrg  fi
15068a355152Smrgfi
15078a355152Smrg
15088a355152SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15098a355152Smrg]) # XORG_WITH_GLIB
15108a355152Smrg
15118a355152Smrg# XORG_LD_WRAP([required|optional])
15128a355152Smrg# ---------------------------------
15138a355152Smrg# Minimum version: 1.13.0
15141a650d1eSmrg#
15158a355152Smrg# Check if linker supports -wrap, passed via compiler flags
15161a650d1eSmrg#
15178a355152Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15188a355152Smrg# Otherwise the value of $enable_unit_tests is blank.
15191a650d1eSmrg#
15208a355152Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15218a355152Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15228a355152Smrg# available, an argument of "optional" allows use when some unit tests require
15238a355152Smrg# ld -wrap and others do not.
15241a650d1eSmrg#
15258a355152SmrgAC_DEFUN([XORG_LD_WRAP],[
15268a355152SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15278a355152Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15288a355152Smrg                      void __wrap_exit(int status) { return; }],
15298a355152Smrg                     [exit(0);])])
15308a355152Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
15318a355152Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15328a355152Smrg  if test "x$have_ld_wrap" = x"no"; then
15338a355152Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15348a355152Smrg  fi
15351a650d1eSmrgfi
15368a355152SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15378a355152Smrg#
15388a355152Smrg]) # XORG_LD_WRAP
15398108eb18Smrg
15408a355152Smrg# XORG_CHECK_LINKER_FLAGS
15418a355152Smrg# -----------------------
15428a355152Smrg# SYNOPSIS
15431a650d1eSmrg#
15448a355152Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15451a650d1eSmrg#
15468a355152Smrg# DESCRIPTION
15471a650d1eSmrg#
15488a355152Smrg#   Check whether the given linker FLAGS work with the current language's
15498a355152Smrg#   linker, or whether they give an error.
15501a650d1eSmrg#
15518a355152Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15528a355152Smrg#   success/failure.
15531a650d1eSmrg#
15548a355152Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
15551a650d1eSmrg#
15568a355152Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15571a650d1eSmrg#
15588a355152Smrg# LICENSE
15598a355152Smrg#
15608a355152Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15618a355152Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15628a355152Smrg#   Copyright (c) 2009 Matteo Frigo
15638a355152Smrg#
15648a355152Smrg#   This program is free software: you can redistribute it and/or modify it
15658a355152Smrg#   under the terms of the GNU General Public License as published by the
15668a355152Smrg#   Free Software Foundation, either version 3 of the License, or (at your
15678a355152Smrg#   option) any later version.
15688a355152Smrg#
15698a355152Smrg#   This program is distributed in the hope that it will be useful, but
15708a355152Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15718a355152Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15728a355152Smrg#   Public License for more details.
15738a355152Smrg#
15748a355152Smrg#   You should have received a copy of the GNU General Public License along
15758a355152Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15768a355152Smrg#
15778a355152Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
15788a355152Smrg#   gives unlimited permission to copy, distribute and modify the configure
15798a355152Smrg#   scripts that are the output of Autoconf when processing the Macro. You
15808a355152Smrg#   need not follow the terms of the GNU General Public License when using
15818a355152Smrg#   or distributing such scripts, even though portions of the text of the
15828a355152Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15838a355152Smrg#   all other use of the material that constitutes the Autoconf Macro.
15848a355152Smrg#
15858a355152Smrg#   This special exception to the GPL applies to versions of the Autoconf
15868a355152Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
15878a355152Smrg#   modified version of the Autoconf Macro, you may extend this special
15888a355152Smrg#   exception to the GPL to apply to your modified version as well.#
15898a355152SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15908a355152Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
15918a355152Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15928a355152SmrgAS_LITERAL_IF([$1],
15938a355152Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15948a355152Smrg      ax_save_FLAGS=$LDFLAGS
15958a355152Smrg      LDFLAGS="$1"
15968a355152Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15978a355152Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15988a355152Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15998a355152Smrg      LDFLAGS=$ax_save_FLAGS])],
16008a355152Smrg  [ax_save_FLAGS=$LDFLAGS
16018a355152Smrg   LDFLAGS="$1"
16028a355152Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16038a355152Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16048a355152Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16058a355152Smrg   LDFLAGS=$ax_save_FLAGS])
16068a355152Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16078a355152SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16088a355152Smrgif test "x$xorg_check_linker_flags" = xyes; then
16098a355152Smrg	m4_default([$2], :)
16108a355152Smrgelse
16118a355152Smrg	m4_default([$3], :)
16121a650d1eSmrgfi
16138a355152Smrg]) # XORG_CHECK_LINKER_FLAGS
16148108eb18Smrg
16158a355152Smrg# XORG_MEMORY_CHECK_FLAGS
16168a355152Smrg# -----------------------
16178a355152Smrg# Minimum version: 1.16.0
16181a650d1eSmrg#
16198a355152Smrg# This macro attempts to find appropriate memory checking functionality
16208a355152Smrg# for various platforms which unit testing code may use to catch various
16218a355152Smrg# forms of memory allocation and access errors in testing.
16221a650d1eSmrg#
16231a650d1eSmrg# Interface to module:
16248a355152Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16258a355152Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16261a650d1eSmrg#
16278a355152Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16281a650d1eSmrg#
16298a355152SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16301a650d1eSmrg
16318a355152SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16328a355152SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16338a355152Smrg           [Environment variables to enable memory checking in tests])
16348a355152Smrg
16358a355152Smrg# Check for different types of support on different platforms
16368a355152Smrgcase $host_os in
16378a355152Smrg    solaris*)
16388a355152Smrg        AC_CHECK_LIB([umem], [umem_alloc],
16398a355152Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16408a355152Smrg        ;;
16418a355152Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16428a355152Smrg        # both directly and inverted, so should not be 0 or 255.
16438a355152Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
16448a355152Smrg        ;;
16458a355152Smrg    darwin*)
16468a355152Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16478a355152Smrg        ;;
16488a355152Smrg    *bsd*)
16498a355152Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16508a355152Smrg        ;;
16518a355152Smrgesac
16528a355152Smrg
16538a355152Smrg# User supplied flags override default flags
16548a355152Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16558a355152Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16568a355152Smrgfi
16578a355152Smrg
16588a355152SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16598a355152Smrg]) # XORG_WITH_LINT
16608a355152Smrg
16618a355152Smrg# XORG_CHECK_MALLOC_ZERO
16628a355152Smrg# ----------------------
16638a355152Smrg# Minimum version: 1.0.0
16648a355152Smrg#
16658a355152Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16668a355152Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16678a355152Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16688a355152SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16698a355152SmrgAC_ARG_ENABLE(malloc0returnsnull,
16708a355152Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16718a355152Smrg		       [malloc(0) returns NULL (default: auto)]),
16728a355152Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16738a355152Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16748a355152Smrg
16758a355152SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16768a355152Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16778a355152SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16788a355152Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16798a355152Smrg#include <stdlib.h>
16808a355152Smrg],[
16818a355152Smrg    char *m0, *r0, *c0, *p;
16828a355152Smrg    m0 = malloc(0);
16838a355152Smrg    p = malloc(10);
16848a355152Smrg    r0 = realloc(p,0);
16858a355152Smrg    c0 = calloc(0,10);
16868a355152Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16878a355152Smrg])],
16888a355152Smrg		[xorg_cv_malloc0_returns_null=yes],
16898a355152Smrg		[xorg_cv_malloc0_returns_null=no])])
16908a355152SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16918a355152Smrgfi
16928a355152SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16938a355152Smrg
16948a355152Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16958a355152Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16968a355152Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16978a355152Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16988108eb18Smrgelse
16998a355152Smrg	MALLOC_ZERO_CFLAGS=""
17008a355152Smrg	XMALLOC_ZERO_CFLAGS=""
17018a355152Smrg	XTMALLOC_ZERO_CFLAGS=""
17028108eb18Smrgfi
17035977a007Smrg
17048a355152SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17058a355152SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17068a355152SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17078a355152Smrg]) # XORG_CHECK_MALLOC_ZERO
17088108eb18Smrg
17098a355152Smrg# XORG_WITH_LINT()
17101a650d1eSmrg# ----------------
17118a355152Smrg# Minimum version: 1.1.0
17121a650d1eSmrg#
17138a355152Smrg# This macro enables the use of a tool that flags some suspicious and
17148a355152Smrg# non-portable constructs (likely to be bugs) in C language source code.
17158a355152Smrg# It will attempt to locate the tool and use appropriate options.
17168a355152Smrg# There are various lint type tools on different platforms.
17171a650d1eSmrg#
17181a650d1eSmrg# Interface to module:
17198a355152Smrg# LINT:		returns the path to the tool found on the platform
17208a355152Smrg#		or the value set to LINT on the configure cmd line
17218a355152Smrg#		also an Automake conditional
17228a355152Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17231a650d1eSmrg#
17248a355152Smrg# --with-lint:	'yes' user instructs the module to use lint
17258a355152Smrg#		'no' user instructs the module not to use lint (default)
17261a650d1eSmrg#
17278a355152Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17288a355152Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17298a355152Smrg#
17308a355152SmrgAC_DEFUN([XORG_WITH_LINT],[
17311a650d1eSmrg
17328a355152SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17338a355152SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17348a355152SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17358a355152Smrg		[Use a lint-style source code checker (default: disabled)])],
17368a355152Smrg		[use_lint=$withval], [use_lint=no])
17378a355152Smrg
17388a355152Smrg# Obtain platform specific info like program name and options
17398a355152Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17408a355152Smrgcase $host_os in
17418a355152Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17428a355152Smrg	lint_name=splint
17438a355152Smrg	lint_options="-badflag"
17448a355152Smrg	;;
17458a355152Smrg  *freebsd* | *netbsd*)
17468a355152Smrg	lint_name=lint
17478a355152Smrg	lint_options="-u -b"
17488a355152Smrg	;;
17498a355152Smrg  *solaris*)
17508a355152Smrg	lint_name=lint
17518a355152Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17528a355152Smrg	;;
17538a355152Smrgesac
17548a355152Smrg
17558a355152Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17568a355152Smrgif test "x$use_lint" = x"yes" ; then
17578a355152Smrg   AC_PATH_PROG([LINT], [$lint_name])
17588a355152Smrg   if test "x$LINT" = "x"; then
17598a355152Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17601a650d1eSmrg   fi
17618a355152Smrgelif test "x$use_lint" = x"no" ; then
17628a355152Smrg   if test "x$LINT" != "x"; then
17638a355152Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17641a650d1eSmrg   fi
17651a650d1eSmrgelse
17668a355152Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17671a650d1eSmrgfi
17688108eb18Smrg
17698a355152Smrg# User supplied flags override default flags
17708a355152Smrgif test "x$LINT_FLAGS" != "x"; then
17718a355152Smrg   lint_options=$LINT_FLAGS
17728a355152Smrgfi
17738a355152Smrg
17748a355152SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17758a355152SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17768a355152Smrg
17778a355152Smrg]) # XORG_WITH_LINT
17788a355152Smrg
17798a355152Smrg# XORG_LINT_LIBRARY(LIBNAME)
17808a355152Smrg# --------------------------
17818a355152Smrg# Minimum version: 1.1.0
17821a650d1eSmrg#
17838a355152Smrg# Sets up flags for building lint libraries for checking programs that call
17848a355152Smrg# functions in the library.
17851a650d1eSmrg#
17861a650d1eSmrg# Interface to module:
17878a355152Smrg# LINTLIB		- Automake variable with the name of lint library file to make
17888a355152Smrg# MAKE_LINT_LIB		- Automake conditional
17891a650d1eSmrg#
17908a355152Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17918a355152Smrg#			  - 'no' user instructs the module not to create a lint library (default)
17921a650d1eSmrg
17938a355152SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17948a355152SmrgAC_REQUIRE([XORG_WITH_LINT])
17958a355152SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17968a355152Smrg	[Create lint library (default: disabled)])],
17978a355152Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17988a355152Smrg
17998a355152Smrgif test "x$make_lint_lib" = x"yes" ; then
18008a355152Smrg   LINTLIB=llib-l$1.ln
18018a355152Smrg   if test "x$LINT" = "x"; then
18028a355152Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18038a355152Smrg   fi
18048a355152Smrgelif test "x$make_lint_lib" != x"no" ; then
18058a355152Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18068a355152Smrgfi
18078a355152Smrg
18088a355152SmrgAC_SUBST(LINTLIB)
18098a355152SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18108a355152Smrg
18118a355152Smrg]) # XORG_LINT_LIBRARY
18128a355152Smrg
18138a355152Smrg# XORG_COMPILER_BRAND
18148a355152Smrg# -------------------
18158a355152Smrg# Minimum version: 1.14.0
18161a650d1eSmrg#
18178a355152Smrg# Checks for various brands of compilers and sets flags as appropriate:
18188a355152Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18198a355152Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18208a355152Smrg#   clang compiler - sets CLANGCC to "yes"
18218a355152Smrg#   Intel compiler - sets INTELCC to "yes"
18228a355152Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18231a650d1eSmrg#
18248a355152SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18258a355152SmrgAC_LANG_CASE(
18268a355152Smrg	[C], [
18278a355152Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18288a355152Smrg	],
18298a355152Smrg	[C++], [
18308a355152Smrg		AC_REQUIRE([AC_PROG_CXX])
18318a355152Smrg	]
18328a355152Smrg)
18338a355152SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18348a355152SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18358a355152SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18368a355152Smrg]) # XORG_COMPILER_BRAND
18371a650d1eSmrg
18388a355152Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18398a355152Smrg# ---------------
18408a355152Smrg# Minimum version: 1.16.0
18411a650d1eSmrg#
18428a355152Smrg# Test if the compiler works when passed the given flag as a command line argument.
18438a355152Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18448a355152Smrg# next flag in the list until there are no more options.
18451a650d1eSmrg#
18468a355152Smrg# Note that this does not guarantee that the compiler supports the flag as some
18478a355152Smrg# compilers will simply ignore arguments that they do not understand, but we do
18488a355152Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18498a355152Smrg# -Werror=unused-command-line-argument
18501a650d1eSmrg#
18518a355152SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18528a355152Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18538a355152Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18548108eb18Smrg
18558a355152SmrgAC_LANG_COMPILER_REQUIRE
18568a355152Smrg
18578a355152SmrgAC_LANG_CASE(
18588a355152Smrg	[C], [
18598a355152Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18608a355152Smrg		define([PREFIX], [C])
18618a355152Smrg		define([CACHE_PREFIX], [cc])
18628a355152Smrg		define([COMPILER], [$CC])
18638a355152Smrg	],
18648a355152Smrg	[C++], [
18658a355152Smrg		define([PREFIX], [CXX])
18668a355152Smrg		define([CACHE_PREFIX], [cxx])
18678a355152Smrg		define([COMPILER], [$CXX])
18688a355152Smrg	]
18698a355152Smrg)
18708a355152Smrg
18718a355152Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18728a355152Smrg
18738a355152Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18748a355152Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18758a355152Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18768a355152Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18778a355152Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18788a355152Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18798a355152Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18808a355152Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18818a355152Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18828a355152Smrgfi
18838a355152Smrg
18848a355152Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18858a355152Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18868a355152Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18878a355152Smrg	fi
18888a355152Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18898a355152Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18908a355152Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18918a355152Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18928a355152Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18938a355152Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18948a355152Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18958a355152Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18968a355152Smrgfi
18978a355152Smrg
18988a355152Smrgfound="no"
18998a355152Smrgm4_foreach([flag], m4_cdr($@), [
19008a355152Smrg	if test $found = "no" ; then
19018a355152Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19028a355152Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19038a355152Smrg		fi
19048a355152Smrg
19058a355152Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19068a355152Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19078a355152Smrg		fi
19088a355152Smrg
19098a355152Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19108a355152Smrg
19118a355152Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19128a355152Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19138a355152Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19148a355152Smrg		AC_CACHE_VAL($cacheid,
19158a355152Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19168a355152Smrg					     [eval $cacheid=yes],
19178a355152Smrg					     [eval $cacheid=no])])
19188a355152Smrg
19198a355152Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19208a355152Smrg
19218a355152Smrg		eval supported=\$$cacheid
19228a355152Smrg		AC_MSG_RESULT([$supported])
19238a355152Smrg		if test "$supported" = "yes" ; then
19248a355152Smrg			$1="$$1 ]flag["
19258a355152Smrg			found="yes"
19268a355152Smrg		fi
19278a355152Smrg	fi
19288a355152Smrg])
19298a355152Smrg]) # XORG_TESTSET_CFLAG
19308a355152Smrg
19318a355152Smrg# XORG_COMPILER_FLAGS
19328a355152Smrg# ---------------
19338a355152Smrg# Minimum version: 1.16.0
19345977a007Smrg#
19358a355152Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19368a355152Smrg# arguments supported by the selected compiler which do NOT alter the generated
19378a355152Smrg# code.  These arguments will cause the compiler to print various warnings
19388a355152Smrg# during compilation AND turn a conservative set of warnings into errors.
19395977a007Smrg#
19408a355152Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19418a355152Smrg# future versions of util-macros as options are added to new compilers.
19425977a007Smrg#
19438a355152SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19448a355152SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19458a355152Smrg
19468a355152SmrgAC_ARG_ENABLE(selective-werror,
19478a355152Smrg              AS_HELP_STRING([--disable-selective-werror],
19488a355152Smrg                             [Turn off selective compiler errors. (default: enabled)]),
19498a355152Smrg              [SELECTIVE_WERROR=$enableval],
19508a355152Smrg              [SELECTIVE_WERROR=yes])
19518a355152Smrg
19528a355152SmrgAC_LANG_CASE(
19538a355152Smrg        [C], [
19548a355152Smrg                define([PREFIX], [C])
19558a355152Smrg        ],
19568a355152Smrg        [C++], [
19578a355152Smrg                define([PREFIX], [CXX])
19588a355152Smrg        ]
19598a355152Smrg)
19608a355152Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19618a355152Smrgif test "x$SUNCC" = "xyes"; then
19628a355152Smrg    [BASE_]PREFIX[FLAGS]="-v"
19638a355152Smrgelse
19648a355152Smrg    [BASE_]PREFIX[FLAGS]=""
19658a355152Smrgfi
19668a355152Smrg
19678a355152Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19688a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19698a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19708a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19718a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19728a355152Smrg
19738a355152SmrgAC_LANG_CASE(
19748a355152Smrg	[C], [
19758a355152Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19768a355152Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19778a355152Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19788a355152Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19798a355152Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19808a355152Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19818a355152Smrg	]
19828a355152Smrg)
19838a355152Smrg
19848a355152Smrg# This chunk adds additional warnings that could catch undesired effects.
19858a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19868a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19878a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19888a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19898a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19908a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19918a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19928a355152Smrg
19938a355152Smrg# These are currently disabled because they are noisy.  They will be enabled
19948a355152Smrg# in the future once the codebase is sufficiently modernized to silence
19958a355152Smrg# them.  For now, I don't want them to drown out the other warnings.
19968a355152Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19978a355152Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19988a355152Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19998a355152Smrg
20008a355152Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20018a355152Smrg# when there are problems that should be fixed.
20028a355152Smrg
20038a355152Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20048a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20058a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20068a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20078a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20088a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20098a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20108a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20118a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20128a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20138a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20148a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20158a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20168a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20178a355152Smrgelse
20188a355152SmrgAC_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])
20198a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20208a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20218a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20228a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20238a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20248a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20258a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20268a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20278a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20288a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20298a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20308a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20318a355152SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20328a355152Smrgfi
20335977a007Smrg
20348a355152SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20358a355152Smrg]) # XORG_COMPILER_FLAGS
20365977a007Smrg
20378a355152Smrg# XORG_CWARNFLAGS
20388a355152Smrg# ---------------
20398a355152Smrg# Minimum version: 1.2.0
20408a355152Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20415977a007Smrg#
20428a355152Smrg# Defines CWARNFLAGS to enable C compiler warnings.
20435977a007Smrg#
20448a355152Smrg# This function is deprecated because it defines -fno-strict-aliasing
20458a355152Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20468a355152Smrg# is needed, then it should be added explicitly in the module when
20478a355152Smrg# it is updated to use BASE_CFLAGS.
20485977a007Smrg#
20498a355152SmrgAC_DEFUN([XORG_CWARNFLAGS], [
20508a355152SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20518a355152SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20528a355152SmrgAC_LANG_CASE(
20538a355152Smrg	[C], [
20548a355152Smrg		CWARNFLAGS="$BASE_CFLAGS"
20558a355152Smrg		if  test "x$GCC" = xyes ; then
20568a355152Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20578a355152Smrg		fi
20588a355152Smrg		AC_SUBST(CWARNFLAGS)
20598a355152Smrg	]
20608a355152Smrg)
20618a355152Smrg]) # XORG_CWARNFLAGS
20628a355152Smrg
20638a355152Smrg# XORG_STRICT_OPTION
20648a355152Smrg# -----------------------
20658a355152Smrg# Minimum version: 1.3.0
20665977a007Smrg#
20678a355152Smrg# Add configure option to enable strict compilation flags, such as treating
20688a355152Smrg# warnings as fatal errors.
20698a355152Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20708a355152Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20715977a007Smrg#
20728a355152Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20738a355152Smrg# when strict compilation is unconditionally desired.
20748a355152SmrgAC_DEFUN([XORG_STRICT_OPTION], [
20758a355152SmrgAC_REQUIRE([XORG_CWARNFLAGS])
20768a355152SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20775977a007Smrg
20788a355152SmrgAC_ARG_ENABLE(strict-compilation,
20798a355152Smrg			  AS_HELP_STRING([--enable-strict-compilation],
20808a355152Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20818a355152Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20825977a007Smrg
20838a355152SmrgAC_LANG_CASE(
20848a355152Smrg        [C], [
20858a355152Smrg                define([PREFIX], [C])
20868a355152Smrg        ],
20878a355152Smrg        [C++], [
20888a355152Smrg                define([PREFIX], [CXX])
20898a355152Smrg        ]
20908a355152Smrg)
20915977a007Smrg
20928a355152Smrg[STRICT_]PREFIX[FLAGS]=""
20938a355152SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20948a355152SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
20955977a007Smrg
20968a355152Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20978a355152Smrg# activate it with -Werror, so we add it here explicitly.
20988a355152SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20995977a007Smrg
21008a355152Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21018a355152Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21028a355152Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21038a355152Smrgfi
21048a355152SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21058a355152SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21068a355152SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21078a355152Smrg]) # XORG_STRICT_OPTION
21085977a007Smrg
21098a355152Smrg# XORG_DEFAULT_OPTIONS
21108a355152Smrg# --------------------
21118a355152Smrg# Minimum version: 1.3.0
21125977a007Smrg#
21138a355152Smrg# Defines default options for X.Org modules.
21145977a007Smrg#
21158a355152SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21168a355152SmrgAC_REQUIRE([AC_PROG_INSTALL])
21178a355152SmrgXORG_COMPILER_FLAGS
21188a355152SmrgXORG_CWARNFLAGS
21198a355152SmrgXORG_STRICT_OPTION
21208a355152SmrgXORG_RELEASE_VERSION
21218a355152SmrgXORG_CHANGELOG
21228a355152SmrgXORG_INSTALL
21238a355152SmrgXORG_MANPAGE_SECTIONS
21248a355152Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21258a355152Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21268a355152Smrg]) # XORG_DEFAULT_OPTIONS
21278a355152Smrg
21288a355152Smrg# XORG_INSTALL()
21298a355152Smrg# ----------------
21308a355152Smrg# Minimum version: 1.4.0
21315977a007Smrg#
21328a355152Smrg# Defines the variable INSTALL_CMD as the command to copy
21338a355152Smrg# INSTALL from $prefix/share/util-macros.
21345977a007Smrg#
21358a355152SmrgAC_DEFUN([XORG_INSTALL], [
21368a355152SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21378a355152Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21388a355152SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21398a355152Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21408a355152Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21418a355152Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21428a355152SmrgAC_SUBST([INSTALL_CMD])
21438a355152Smrg]) # XORG_INSTALL
21448a355152Smrgdnl Copyright 2005 Red Hat, Inc
21458a355152Smrgdnl
21468a355152Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21478a355152Smrgdnl documentation for any purpose is hereby granted without fee, provided that
21488a355152Smrgdnl the above copyright notice appear in all copies and that both that
21498a355152Smrgdnl copyright notice and this permission notice appear in supporting
21508a355152Smrgdnl documentation.
21518a355152Smrgdnl
21528a355152Smrgdnl The above copyright notice and this permission notice shall be included
21538a355152Smrgdnl in all copies or substantial portions of the Software.
21548a355152Smrgdnl
21558a355152Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21568a355152Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21578a355152Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21588a355152Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21598a355152Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21608a355152Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21618a355152Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
21628a355152Smrgdnl
21638a355152Smrgdnl Except as contained in this notice, the name of the copyright holders shall
21648a355152Smrgdnl not be used in advertising or otherwise to promote the sale, use or
21658a355152Smrgdnl other dealings in this Software without prior written authorization
21668a355152Smrgdnl from the copyright holders.
21678a355152Smrgdnl
21688a355152Smrg
21698a355152Smrg# XORG_RELEASE_VERSION
21708a355152Smrg# --------------------
21718a355152Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
21728a355152Smrg
21738a355152SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21748a355152Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21758a355152Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21768a355152Smrg		[Major version of this package])
21778a355152Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21788a355152Smrg	if test "x$PVM" = "x"; then
21798a355152Smrg		PVM="0"
21808a355152Smrg	fi
21818a355152Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21828a355152Smrg		[$PVM],
21838a355152Smrg		[Minor version of this package])
21848a355152Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21858a355152Smrg	if test "x$PVP" = "x"; then
21868a355152Smrg		PVP="0"
21878a355152Smrg	fi
21888a355152Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21898a355152Smrg		[$PVP],
21908a355152Smrg		[Patch version of this package])
21918a355152Smrg])
21925977a007Smrg
21938a355152Smrg# XORG_CHANGELOG()
21948a355152Smrg# ----------------
21958a355152Smrg# Minimum version: 1.2.0
21965977a007Smrg#
21978a355152Smrg# Defines the variable CHANGELOG_CMD as the command to generate
21988a355152Smrg# ChangeLog from git.
21995977a007Smrg#
22005977a007Smrg#
22018a355152SmrgAC_DEFUN([XORG_CHANGELOG], [
22028a355152SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22038a355152Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22048a355152Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22058a355152Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22068a355152SmrgAC_SUBST([CHANGELOG_CMD])
22078a355152Smrg]) # XORG_CHANGELOG
22088a355152Smrg
22098a355152Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
22105977a007Smrg#
22118a355152Smrg# This file is free software; the Free Software Foundation
22128a355152Smrg# gives unlimited permission to copy and/or distribute it,
22138a355152Smrg# with or without modifications, as long as this notice is preserved.
22148a355152Smrg
22158a355152Smrg# AM_AUTOMAKE_VERSION(VERSION)
22168a355152Smrg# ----------------------------
22178a355152Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22188a355152Smrg# generated from the m4 files accompanying Automake X.Y.
22198a355152Smrg# (This private macro should not be called outside this file.)
22208a355152SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22218a355152Smrg[am__api_version='1.15'
22228a355152Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22238a355152Smrgdnl require some minimum version.  Point them to the right macro.
22248a355152Smrgm4_if([$1], [1.15], [],
22258a355152Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22268a355152Smrg])
22278a355152Smrg
22288a355152Smrg# _AM_AUTOCONF_VERSION(VERSION)
22298a355152Smrg# -----------------------------
22308a355152Smrg# aclocal traces this macro to find the Autoconf version.
22318a355152Smrg# This is a private macro too.  Using m4_define simplifies
22328a355152Smrg# the logic in aclocal, which can simply ignore this definition.
22338a355152Smrgm4_define([_AM_AUTOCONF_VERSION], [])
22348a355152Smrg
22358a355152Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22368a355152Smrg# -------------------------------
22378a355152Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22388a355152Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22398a355152SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22408a355152Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
22418a355152Smrgm4_ifndef([AC_AUTOCONF_VERSION],
22428a355152Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22438a355152Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
22448a355152Smrg
22458a355152Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22468a355152Smrg
22478a355152Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
22485977a007Smrg#
22498a355152Smrg# This file is free software; the Free Software Foundation
22508a355152Smrg# gives unlimited permission to copy and/or distribute it,
22518a355152Smrg# with or without modifications, as long as this notice is preserved.
22528a355152Smrg
22538a355152Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22548a355152Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22558a355152Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
22565977a007Smrg#
22578a355152Smrg# Of course, Automake must honor this variable whenever it calls a
22588a355152Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22598a355152Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22608a355152Smrg# depending on how configure is run.  This is pretty annoying, since
22618a355152Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22628a355152Smrg# source directory, any form will work fine, but in subdirectories a
22638a355152Smrg# relative path needs to be adjusted first.
22645977a007Smrg#
22658a355152Smrg# $ac_aux_dir/missing
22668a355152Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22678a355152Smrg# $top_srcdir/$ac_aux_dir/missing
22688a355152Smrg#    fails if $ac_aux_dir is absolute,
22698a355152Smrg#    fails when called from a subdirectory in a VPATH build with
22708a355152Smrg#          a relative $ac_aux_dir
22715977a007Smrg#
22728a355152Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22738a355152Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
22748a355152Smrg# harmless because $srcdir is '.', but things will broke when you
22758a355152Smrg# start a VPATH build or use an absolute $srcdir.
22765977a007Smrg#
22778a355152Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22788a355152Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22798a355152Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22808a355152Smrg# and then we would define $MISSING as
22818a355152Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22828a355152Smrg# This will work as long as MISSING is not called from configure, because
22838a355152Smrg# unfortunately $(top_srcdir) has no meaning in configure.
22848a355152Smrg# However there are other variables, like CC, which are often used in
22858a355152Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
22865977a007Smrg#
22878a355152Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
22888a355152Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
22898a355152Smrg# configured tree to be moved without reconfiguration.
22908a355152Smrg
22918a355152SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22928a355152Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22938a355152Smrg# Expand $ac_aux_dir to an absolute path.
22948a355152Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
22958a355152Smrg])
22968a355152Smrg
22978a355152Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
22988a355152Smrg
22998a355152Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
23005977a007Smrg#
23018a355152Smrg# This file is free software; the Free Software Foundation
23028a355152Smrg# gives unlimited permission to copy and/or distribute it,
23038a355152Smrg# with or without modifications, as long as this notice is preserved.
23048a355152Smrg
23058a355152Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23068a355152Smrg# -------------------------------------
23078a355152Smrg# Define a conditional.
23088a355152SmrgAC_DEFUN([AM_CONDITIONAL],
23098a355152Smrg[AC_PREREQ([2.52])dnl
23108a355152Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23118a355152Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23128a355152SmrgAC_SUBST([$1_TRUE])dnl
23138a355152SmrgAC_SUBST([$1_FALSE])dnl
23148a355152Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23158a355152Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23168a355152Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23178a355152Smrgif $2; then
23188a355152Smrg  $1_TRUE=
23198a355152Smrg  $1_FALSE='#'
23205977a007Smrgelse
23218a355152Smrg  $1_TRUE='#'
23228a355152Smrg  $1_FALSE=
23235977a007Smrgfi
23248a355152SmrgAC_CONFIG_COMMANDS_PRE(
23258a355152Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23268a355152Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23278a355152SmrgUsually this means the macro was only invoked conditionally.]])
23288a355152Smrgfi])])
23295977a007Smrg
23308a355152Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
23315977a007Smrg#
23328a355152Smrg# This file is free software; the Free Software Foundation
23338a355152Smrg# gives unlimited permission to copy and/or distribute it,
23348a355152Smrg# with or without modifications, as long as this notice is preserved.
23358a355152Smrg
23368a355152Smrg
23378a355152Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23388a355152Smrg# written in clear, in which case automake, when reading aclocal.m4,
23398a355152Smrg# will think it sees a *use*, and therefore will trigger all it's
23408a355152Smrg# C support machinery.  Also note that it means that autoscan, seeing
23418a355152Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23428a355152Smrg
23438a355152Smrg
23448a355152Smrg# _AM_DEPENDENCIES(NAME)
23458a355152Smrg# ----------------------
23468a355152Smrg# See how the compiler implements dependency checking.
23478a355152Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23488a355152Smrg# We try a few techniques and use that to set a single cache variable.
23495977a007Smrg#
23508a355152Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23518a355152Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23528a355152Smrg# dependency, and given that the user is not expected to run this macro,
23538a355152Smrg# just rely on AC_PROG_CC.
23548a355152SmrgAC_DEFUN([_AM_DEPENDENCIES],
23558a355152Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23568a355152SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23578a355152SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23588a355152SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
23598a355152Smrg
23608a355152Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23618a355152Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23628a355152Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23638a355152Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23648a355152Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23658a355152Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23668a355152Smrg                    [depcc="$$1"   am_compiler_list=])
23678a355152Smrg
23688a355152SmrgAC_CACHE_CHECK([dependency style of $depcc],
23698a355152Smrg               [am_cv_$1_dependencies_compiler_type],
23708a355152Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23718a355152Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
23728a355152Smrg  # making bogus files that we don't know about and never remove.  For
23738a355152Smrg  # instance it was reported that on HP-UX the gcc test will end up
23748a355152Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23758a355152Smrg  # in D".
23768a355152Smrg  rm -rf conftest.dir
23778a355152Smrg  mkdir conftest.dir
23788a355152Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23798a355152Smrg  # using a relative directory.
23808a355152Smrg  cp "$am_depcomp" conftest.dir
23818a355152Smrg  cd conftest.dir
23828a355152Smrg  # We will build objects and dependencies in a subdirectory because
23838a355152Smrg  # it helps to detect inapplicable dependency modes.  For instance
23848a355152Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23858a355152Smrg  # side effect of compilation, but ICC will put the dependencies in
23868a355152Smrg  # the current directory while Tru64 will put them in the object
23878a355152Smrg  # directory.
23888a355152Smrg  mkdir sub
23898a355152Smrg
23908a355152Smrg  am_cv_$1_dependencies_compiler_type=none
23918a355152Smrg  if test "$am_compiler_list" = ""; then
23928a355152Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
23938a355152Smrg  fi
23948a355152Smrg  am__universal=false
23958a355152Smrg  m4_case([$1], [CC],
23968a355152Smrg    [case " $depcc " in #(
23978a355152Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23988a355152Smrg     esac],
23998a355152Smrg    [CXX],
24008a355152Smrg    [case " $depcc " in #(
24018a355152Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24028a355152Smrg     esac])
24035977a007Smrg
24048a355152Smrg  for depmode in $am_compiler_list; do
24058a355152Smrg    # Setup a source with many dependencies, because some compilers
24068a355152Smrg    # like to wrap large dependency lists on column 80 (with \), and
24078a355152Smrg    # we should not choose a depcomp mode which is confused by this.
24088a355152Smrg    #
24098a355152Smrg    # We need to recreate these files for each test, as the compiler may
24108a355152Smrg    # overwrite some of them when testing with obscure command lines.
24118a355152Smrg    # This happens at least with the AIX C compiler.
24128a355152Smrg    : > sub/conftest.c
24138a355152Smrg    for i in 1 2 3 4 5 6; do
24148a355152Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24158a355152Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24168a355152Smrg      # Solaris 10 /bin/sh.
24178a355152Smrg      echo '/* dummy */' > sub/conftst$i.h
24188a355152Smrg    done
24198a355152Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24205977a007Smrg
24218a355152Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24228a355152Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24238a355152Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24248a355152Smrg    # versions had trouble with output in subdirs.
24258a355152Smrg    am__obj=sub/conftest.${OBJEXT-o}
24268a355152Smrg    am__minus_obj="-o $am__obj"
24278a355152Smrg    case $depmode in
24288a355152Smrg    gcc)
24298a355152Smrg      # This depmode causes a compiler race in universal mode.
24308a355152Smrg      test "$am__universal" = false || continue
24318a355152Smrg      ;;
24328a355152Smrg    nosideeffect)
24338a355152Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24348a355152Smrg      # only be used when explicitly requested.
24358a355152Smrg      if test "x$enable_dependency_tracking" = xyes; then
24368a355152Smrg	continue
24378a355152Smrg      else
24388a355152Smrg	break
24398a355152Smrg      fi
24408a355152Smrg      ;;
24418a355152Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24428a355152Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
24438a355152Smrg      # not run yet.  These depmodes are late enough in the game, and
24448a355152Smrg      # so weak that their functioning should not be impacted.
24458a355152Smrg      am__obj=conftest.${OBJEXT-o}
24468a355152Smrg      am__minus_obj=
24478a355152Smrg      ;;
24488a355152Smrg    none) break ;;
24498a355152Smrg    esac
24508a355152Smrg    if depmode=$depmode \
24518a355152Smrg       source=sub/conftest.c object=$am__obj \
24528a355152Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24538a355152Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24548a355152Smrg         >/dev/null 2>conftest.err &&
24558a355152Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24568a355152Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24578a355152Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24588a355152Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24598a355152Smrg      # icc doesn't choke on unknown options, it will just issue warnings
24608a355152Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
24618a355152Smrg      # that says an option was ignored or not supported.
24628a355152Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24638a355152Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24648a355152Smrg      # The diagnosis changed in icc 8.0:
24658a355152Smrg      #   icc: Command line remark: option '-MP' not supported
24668a355152Smrg      if (grep 'ignoring option' conftest.err ||
24678a355152Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24688a355152Smrg        am_cv_$1_dependencies_compiler_type=$depmode
24698a355152Smrg        break
24708a355152Smrg      fi
24718a355152Smrg    fi
24728a355152Smrg  done
24735977a007Smrg
24748a355152Smrg  cd ..
24758a355152Smrg  rm -rf conftest.dir
24768a355152Smrgelse
24778a355152Smrg  am_cv_$1_dependencies_compiler_type=none
24785977a007Smrgfi
24798a355152Smrg])
24808a355152SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24818a355152SmrgAM_CONDITIONAL([am__fastdep$1], [
24828a355152Smrg  test "x$enable_dependency_tracking" != xno \
24838a355152Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24848a355152Smrg])
24855977a007Smrg
24865977a007Smrg
24878a355152Smrg# AM_SET_DEPDIR
24888a355152Smrg# -------------
24898a355152Smrg# Choose a directory name for dependency files.
24908a355152Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24918a355152SmrgAC_DEFUN([AM_SET_DEPDIR],
24928a355152Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24938a355152SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24948a355152Smrg])
24958108eb18Smrg
24968108eb18Smrg
24978a355152Smrg# AM_DEP_TRACK
24988a355152Smrg# ------------
24998a355152SmrgAC_DEFUN([AM_DEP_TRACK],
25008a355152Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25018a355152SmrgAS_HELP_STRING(
25028a355152Smrg  [--enable-dependency-tracking],
25038a355152Smrg  [do not reject slow dependency extractors])
25048a355152SmrgAS_HELP_STRING(
25058a355152Smrg  [--disable-dependency-tracking],
25068a355152Smrg  [speeds up one-time build])])
25078a355152Smrgif test "x$enable_dependency_tracking" != xno; then
25088a355152Smrg  am_depcomp="$ac_aux_dir/depcomp"
25098a355152Smrg  AMDEPBACKSLASH='\'
25108a355152Smrg  am__nodep='_no'
25118108eb18Smrgfi
25128a355152SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25138a355152SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25148a355152Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25158a355152SmrgAC_SUBST([am__nodep])dnl
25168a355152Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25178a355152Smrg])
25188108eb18Smrg
25198a355152Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25208108eb18Smrg
25218a355152Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
25221a650d1eSmrg#
25238a355152Smrg# This file is free software; the Free Software Foundation
25248a355152Smrg# gives unlimited permission to copy and/or distribute it,
25258a355152Smrg# with or without modifications, as long as this notice is preserved.
25261a650d1eSmrg
25271a650d1eSmrg
25288a355152Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25298a355152Smrg# ------------------------------
25308a355152SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25318a355152Smrg[{
25328a355152Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
25338a355152Smrg  # are listed without --file.  Let's play safe and only enable the eval
25348a355152Smrg  # if we detect the quoting.
25358a355152Smrg  case $CONFIG_FILES in
25368a355152Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
25378a355152Smrg  *)   set x $CONFIG_FILES ;;
25388a355152Smrg  esac
25398a355152Smrg  shift
25408a355152Smrg  for mf
25418a355152Smrg  do
25428a355152Smrg    # Strip MF so we end up with the name of the file.
25438a355152Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25448a355152Smrg    # Check whether this is an Automake generated Makefile or not.
25458a355152Smrg    # We used to match only the files named 'Makefile.in', but
25468a355152Smrg    # some people rename them; so instead we look at the file content.
25478a355152Smrg    # Grep'ing the first line is not enough: some people post-process
25488a355152Smrg    # each Makefile.in and add a new line on top of each file to say so.
25498a355152Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
25508a355152Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
25518a355152Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25528a355152Smrg      dirpart=`AS_DIRNAME("$mf")`
25538a355152Smrg    else
25548a355152Smrg      continue
25558a355152Smrg    fi
25568a355152Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
25578a355152Smrg    # from the Makefile without running 'make'.
25588a355152Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25598a355152Smrg    test -z "$DEPDIR" && continue
25608a355152Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25618a355152Smrg    test -z "$am__include" && continue
25628a355152Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25638a355152Smrg    # Find all dependency output files, they are included files with
25648a355152Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25658a355152Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25668a355152Smrg    # expansion.
25678a355152Smrg    for file in `sed -n "
25688a355152Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25698a355152Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25708a355152Smrg      # Make sure the directory exists.
25718a355152Smrg      test -f "$dirpart/$file" && continue
25728a355152Smrg      fdir=`AS_DIRNAME(["$file"])`
25738a355152Smrg      AS_MKDIR_P([$dirpart/$fdir])
25748a355152Smrg      # echo "creating $dirpart/$file"
25758a355152Smrg      echo '# dummy' > "$dirpart/$file"
25768a355152Smrg    done
25778a355152Smrg  done
25788a355152Smrg}
25798a355152Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25801a650d1eSmrg
25811a650d1eSmrg
25828a355152Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25838a355152Smrg# -----------------------------
25848a355152Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
25858a355152Smrg#
25868a355152Smrg# This code is only required when automatic dependency tracking
25878a355152Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
25888a355152Smrg# need in order to bootstrap the dependency handling code.
25898a355152SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25908a355152Smrg[AC_CONFIG_COMMANDS([depfiles],
25918a355152Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25928a355152Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25938a355152Smrg])
25941a650d1eSmrg
25958a355152Smrg# Do all the work for Automake.                             -*- Autoconf -*-
25961a650d1eSmrg
25978a355152Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25981a650d1eSmrg#
25998a355152Smrg# This file is free software; the Free Software Foundation
26008a355152Smrg# gives unlimited permission to copy and/or distribute it,
26018a355152Smrg# with or without modifications, as long as this notice is preserved.
26021a650d1eSmrg
26038a355152Smrg# This macro actually does too much.  Some checks are only needed if
26048a355152Smrg# your package does certain things.  But this isn't really a big deal.
26051a650d1eSmrg
26068a355152Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26078a355152Smrgm4_define([AC_PROG_CC],
26088a355152Smrgm4_defn([AC_PROG_CC])
26098a355152Smrg[_AM_PROG_CC_C_O
26108a355152Smrg])
26118a355152Smrg
26128a355152Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26138a355152Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26148a355152Smrg# -----------------------------------------------
26158a355152Smrg# The call with PACKAGE and VERSION arguments is the old style
26168a355152Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26178a355152Smrg# and VERSION should now be passed to AC_INIT and removed from
26188a355152Smrg# the call to AM_INIT_AUTOMAKE.
26198a355152Smrg# We support both call styles for the transition.  After
26208a355152Smrg# the next Automake release, Autoconf can make the AC_INIT
26218a355152Smrg# arguments mandatory, and then we can depend on a new Autoconf
26228a355152Smrg# release and drop the old call support.
26238a355152SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26248a355152Smrg[AC_PREREQ([2.65])dnl
26258a355152Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26268a355152Smrgdnl the ones we care about.
26278a355152Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26288a355152SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26298a355152SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26308a355152Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26318a355152Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26328a355152Smrg  # is not polluted with repeated "-I."
26338a355152Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26348a355152Smrg  # test to see if srcdir already configured
26358a355152Smrg  if test -f $srcdir/config.status; then
26368a355152Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
26378a355152Smrg  fi
26381a650d1eSmrgfi
26391a650d1eSmrg
26408a355152Smrg# test whether we have cygpath
26418a355152Smrgif test -z "$CYGPATH_W"; then
26428a355152Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26438a355152Smrg    CYGPATH_W='cygpath -w'
26448a355152Smrg  else
26458a355152Smrg    CYGPATH_W=echo
26468a355152Smrg  fi
26478a355152Smrgfi
26488a355152SmrgAC_SUBST([CYGPATH_W])
26491a650d1eSmrg
26508a355152Smrg# Define the identity of the package.
26518a355152Smrgdnl Distinguish between old-style and new-style calls.
26528a355152Smrgm4_ifval([$2],
26538a355152Smrg[AC_DIAGNOSE([obsolete],
26548a355152Smrg             [$0: two- and three-arguments forms are deprecated.])
26558a355152Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26568a355152Smrg AC_SUBST([PACKAGE], [$1])dnl
26578a355152Smrg AC_SUBST([VERSION], [$2])],
26588a355152Smrg[_AM_SET_OPTIONS([$1])dnl
26598a355152Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26608a355152Smrgm4_if(
26618a355152Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26628a355152Smrg  [ok:ok],,
26638a355152Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26648a355152Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26658a355152Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
26661a650d1eSmrg
26678a355152Smrg_AM_IF_OPTION([no-define],,
26688a355152Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26698a355152Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
26705977a007Smrg
26718a355152Smrg# Some tools Automake needs.
26728a355152SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26738a355152SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26748a355152SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26758a355152SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26768a355152SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26778a355152SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26788a355152SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26798a355152SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26808a355152SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26818a355152SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26828a355152Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
26838a355152Smrg# dies out for good.  For more background, see:
26848a355152Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26858a355152Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26868a355152SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26878a355152Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
26888a355152Smrg# system "awk" is bad on some platforms.
26898a355152SmrgAC_REQUIRE([AC_PROG_AWK])dnl
26908a355152SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26918a355152SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26928a355152Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26938a355152Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26948a355152Smrg			     [_AM_PROG_TAR([v7])])])
26958a355152Smrg_AM_IF_OPTION([no-dependencies],,
26968a355152Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26978a355152Smrg		  [_AM_DEPENDENCIES([CC])],
26988a355152Smrg		  [m4_define([AC_PROG_CC],
26998a355152Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27008a355152SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27018a355152Smrg		  [_AM_DEPENDENCIES([CXX])],
27028a355152Smrg		  [m4_define([AC_PROG_CXX],
27038a355152Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27048a355152SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27058a355152Smrg		  [_AM_DEPENDENCIES([OBJC])],
27068a355152Smrg		  [m4_define([AC_PROG_OBJC],
27078a355152Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27088a355152SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27098a355152Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27108a355152Smrg		  [m4_define([AC_PROG_OBJCXX],
27118a355152Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27128a355152Smrg])
27138a355152SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27148a355152Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27158a355152Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27168a355152Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27178a355152SmrgAC_CONFIG_COMMANDS_PRE(dnl
27188a355152Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27198a355152Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27205977a007Smrg
27218a355152Smrg# POSIX will say in a future version that running "rm -f" with no argument
27228a355152Smrg# is OK; and we want to be able to make that assumption in our Makefile
27238a355152Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27248a355152Smrg# actually supported "in the wild" to an acceptable degree.
27258a355152Smrg# See automake bug#10828.
27268a355152Smrg# To make any issue more visible, cause the running configure to be aborted
27278a355152Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27288a355152Smrg# user can still override this though.
27298a355152Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27308a355152Smrg  cat >&2 <<'END'
27318a355152SmrgOops!
27328a355152Smrg
27338a355152SmrgYour 'rm' program seems unable to run without file operands specified
27348a355152Smrgon the command line, even when the '-f' option is present.  This is contrary
27358a355152Smrgto the behaviour of most rm programs out there, and not conforming with
27368a355152Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27378a355152Smrg
27388a355152SmrgPlease tell bug-automake@gnu.org about your system, including the value
27398a355152Smrgof your $PATH and any error possibly output before this message.  This
27408a355152Smrgcan help us improve future automake versions.
27415977a007Smrg
27428a355152SmrgEND
27438a355152Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27448a355152Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27458a355152Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27468a355152Smrg    echo >&2
27478a355152Smrg  else
27488a355152Smrg    cat >&2 <<'END'
27498a355152SmrgAborting the configuration process, to ensure you take notice of the issue.
27505977a007Smrg
27518a355152SmrgYou can download and install GNU coreutils to get an 'rm' implementation
27528a355152Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
27535977a007Smrg
27548a355152SmrgIf you want to complete the configuration process using your problematic
27558a355152Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27568a355152Smrgto "yes", and re-run configure.
27575977a007Smrg
27588a355152SmrgEND
27598a355152Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27608a355152Smrg  fi
27615977a007Smrgfi
27628a355152Smrgdnl The trailing newline in this macro's definition is deliberate, for
27638a355152Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27648a355152Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27658a355152Smrg])
27665977a007Smrg
27678a355152Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27688a355152Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27698a355152Smrgdnl mangled by Autoconf and run in a shell conditional statement.
27708a355152Smrgm4_define([_AC_COMPILER_EXEEXT],
27718a355152Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27725977a007Smrg
27738a355152Smrg# When config.status generates a header, we must update the stamp-h file.
27748a355152Smrg# This file resides in the same directory as the config header
27758a355152Smrg# that is generated.  The stamp files are numbered to have different names.
27765977a007Smrg
27778a355152Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27788a355152Smrg# loop where config.status creates the headers, so we can generate
27798a355152Smrg# our stamp files there.
27808a355152SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27818a355152Smrg[# Compute $1's index in $config_headers.
27828a355152Smrg_am_arg=$1
27838a355152Smrg_am_stamp_count=1
27848a355152Smrgfor _am_header in $config_headers :; do
27858a355152Smrg  case $_am_header in
27868a355152Smrg    $_am_arg | $_am_arg:* )
27878a355152Smrg      break ;;
27888a355152Smrg    * )
27898a355152Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27908a355152Smrg  esac
27918a355152Smrgdone
27928a355152Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
27935977a007Smrg
27948a355152Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27955977a007Smrg#
27968a355152Smrg# This file is free software; the Free Software Foundation
27978a355152Smrg# gives unlimited permission to copy and/or distribute it,
27988a355152Smrg# with or without modifications, as long as this notice is preserved.
27995977a007Smrg
28008a355152Smrg# AM_PROG_INSTALL_SH
28018a355152Smrg# ------------------
28028a355152Smrg# Define $install_sh.
28038a355152SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28048a355152Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28058a355152Smrgif test x"${install_sh+set}" != xset; then
28068a355152Smrg  case $am_aux_dir in
28078a355152Smrg  *\ * | *\	*)
28088a355152Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28098a355152Smrg  *)
28108a355152Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28118a355152Smrg  esac
28128a355152Smrgfi
28138a355152SmrgAC_SUBST([install_sh])])
28145977a007Smrg
28158a355152Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28168a355152Smrg#
28178a355152Smrg# This file is free software; the Free Software Foundation
28188a355152Smrg# gives unlimited permission to copy and/or distribute it,
28198a355152Smrg# with or without modifications, as long as this notice is preserved.
28208a355152Smrg
28218a355152Smrg# Check whether the underlying file-system supports filenames
28228a355152Smrg# with a leading dot.  For instance MS-DOS doesn't.
28238a355152SmrgAC_DEFUN([AM_SET_LEADING_DOT],
28248a355152Smrg[rm -rf .tst 2>/dev/null
28258a355152Smrgmkdir .tst 2>/dev/null
28268a355152Smrgif test -d .tst; then
28278a355152Smrg  am__leading_dot=.
28285977a007Smrgelse
28298a355152Smrg  am__leading_dot=_
28305977a007Smrgfi
28318a355152Smrgrmdir .tst 2>/dev/null
28328a355152SmrgAC_SUBST([am__leading_dot])])
28335977a007Smrg
28348a355152Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
28355977a007Smrg
28368a355152Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
28378a355152Smrg#
28388a355152Smrg# This file is free software; the Free Software Foundation
28398a355152Smrg# gives unlimited permission to copy and/or distribute it,
28408a355152Smrg# with or without modifications, as long as this notice is preserved.
28415977a007Smrg
28428a355152Smrg# AM_MAKE_INCLUDE()
28438a355152Smrg# -----------------
28448a355152Smrg# Check to see how make treats includes.
28458a355152SmrgAC_DEFUN([AM_MAKE_INCLUDE],
28468a355152Smrg[am_make=${MAKE-make}
28478a355152Smrgcat > confinc << 'END'
28488a355152Smrgam__doit:
28498a355152Smrg	@echo this is the am__doit target
28508a355152Smrg.PHONY: am__doit
28518a355152SmrgEND
28528a355152Smrg# If we don't find an include directive, just comment out the code.
28538a355152SmrgAC_MSG_CHECKING([for style of include used by $am_make])
28548a355152Smrgam__include="#"
28558a355152Smrgam__quote=
28568a355152Smrg_am_result=none
28578a355152Smrg# First try GNU make style include.
28588a355152Smrgecho "include confinc" > confmf
28598a355152Smrg# Ignore all kinds of additional output from 'make'.
28608a355152Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28618a355152Smrg*the\ am__doit\ target*)
28628a355152Smrg  am__include=include
28638a355152Smrg  am__quote=
28648a355152Smrg  _am_result=GNU
28658a355152Smrg  ;;
28668a355152Smrgesac
28678a355152Smrg# Now try BSD make style include.
28688a355152Smrgif test "$am__include" = "#"; then
28698a355152Smrg   echo '.include "confinc"' > confmf
28708a355152Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28718a355152Smrg   *the\ am__doit\ target*)
28728a355152Smrg     am__include=.include
28738a355152Smrg     am__quote="\""
28748a355152Smrg     _am_result=BSD
28758a355152Smrg     ;;
28768a355152Smrg   esac
28778a355152Smrgfi
28788a355152SmrgAC_SUBST([am__include])
28798a355152SmrgAC_SUBST([am__quote])
28808a355152SmrgAC_MSG_RESULT([$_am_result])
28818a355152Smrgrm -f confinc confmf
28828a355152Smrg])
28835977a007Smrg
28848a355152Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
28855977a007Smrg
28868a355152Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
28878a355152Smrg#
28888a355152Smrg# This file is free software; the Free Software Foundation
28898a355152Smrg# gives unlimited permission to copy and/or distribute it,
28908a355152Smrg# with or without modifications, as long as this notice is preserved.
28915977a007Smrg
28928a355152Smrg# AM_MISSING_PROG(NAME, PROGRAM)
28938a355152Smrg# ------------------------------
28948a355152SmrgAC_DEFUN([AM_MISSING_PROG],
28958a355152Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28968a355152Smrg$1=${$1-"${am_missing_run}$2"}
28978a355152SmrgAC_SUBST($1)])
28988a355152Smrg
28998a355152Smrg# AM_MISSING_HAS_RUN
29008a355152Smrg# ------------------
29018a355152Smrg# Define MISSING if not defined so far and test if it is modern enough.
29028a355152Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29038a355152SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29048a355152Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29058a355152SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29068a355152Smrgif test x"${MISSING+set}" != xset; then
29078a355152Smrg  case $am_aux_dir in
29088a355152Smrg  *\ * | *\	*)
29098a355152Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29108a355152Smrg  *)
29118a355152Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29128a355152Smrg  esac
29138a355152Smrgfi
29148a355152Smrg# Use eval to expand $SHELL
29158a355152Smrgif eval "$MISSING --is-lightweight"; then
29168a355152Smrg  am_missing_run="$MISSING "
29175977a007Smrgelse
29188a355152Smrg  am_missing_run=
29198a355152Smrg  AC_MSG_WARN(['missing' script is too old or missing])
29205977a007Smrgfi
29218a355152Smrg])
29225977a007Smrg
29238a355152Smrg# Helper functions for option handling.                     -*- Autoconf -*-
29245977a007Smrg
29258a355152Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29261a650d1eSmrg#
29278a355152Smrg# This file is free software; the Free Software Foundation
29288a355152Smrg# gives unlimited permission to copy and/or distribute it,
29298a355152Smrg# with or without modifications, as long as this notice is preserved.
29301a650d1eSmrg
29318a355152Smrg# _AM_MANGLE_OPTION(NAME)
29321a650d1eSmrg# -----------------------
29338a355152SmrgAC_DEFUN([_AM_MANGLE_OPTION],
29348a355152Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
29358a355152Smrg
29368a355152Smrg# _AM_SET_OPTION(NAME)
29378a355152Smrg# --------------------
29388a355152Smrg# Set option NAME.  Presently that only means defining a flag for this option.
29398a355152SmrgAC_DEFUN([_AM_SET_OPTION],
29408a355152Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
29418a355152Smrg
29428a355152Smrg# _AM_SET_OPTIONS(OPTIONS)
29438a355152Smrg# ------------------------
29448a355152Smrg# OPTIONS is a space-separated list of Automake options.
29458a355152SmrgAC_DEFUN([_AM_SET_OPTIONS],
29468a355152Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
29478a355152Smrg
29488a355152Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29498a355152Smrg# -------------------------------------------
29508a355152Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29518a355152SmrgAC_DEFUN([_AM_IF_OPTION],
29528a355152Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
29538a355152Smrg
29548a355152Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
29551a650d1eSmrg#
29568a355152Smrg# This file is free software; the Free Software Foundation
29578a355152Smrg# gives unlimited permission to copy and/or distribute it,
29588a355152Smrg# with or without modifications, as long as this notice is preserved.
29598a355152Smrg
29608a355152Smrg# _AM_PROG_CC_C_O
29618a355152Smrg# ---------------
29628a355152Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29638a355152Smrg# to automatically call this.
29648a355152SmrgAC_DEFUN([_AM_PROG_CC_C_O],
29658a355152Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29668a355152SmrgAC_REQUIRE_AUX_FILE([compile])dnl
29678a355152SmrgAC_LANG_PUSH([C])dnl
29688a355152SmrgAC_CACHE_CHECK(
29698a355152Smrg  [whether $CC understands -c and -o together],
29708a355152Smrg  [am_cv_prog_cc_c_o],
29718a355152Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29728a355152Smrg  # Make sure it works both with $CC and with simple cc.
29738a355152Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29748a355152Smrg  # compilers refuse to overwrite an existing .o file with -o,
29758a355152Smrg  # though they will create one.
29768a355152Smrg  am_cv_prog_cc_c_o=yes
29778a355152Smrg  for am_i in 1 2; do
29788a355152Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29798a355152Smrg         && test -f conftest2.$ac_objext; then
29808a355152Smrg      : OK
29818a355152Smrg    else
29828a355152Smrg      am_cv_prog_cc_c_o=no
29838a355152Smrg      break
29848a355152Smrg    fi
29858a355152Smrg  done
29868a355152Smrg  rm -f core conftest*
29878a355152Smrg  unset am_i])
29888a355152Smrgif test "$am_cv_prog_cc_c_o" != yes; then
29898a355152Smrg   # Losing compiler, so override with the script.
29908a355152Smrg   # FIXME: It is wrong to rewrite CC.
29918a355152Smrg   # But if we don't then we get into trouble of one sort or another.
29928a355152Smrg   # A longer-term fix would be to have automake use am__CC in this case,
29938a355152Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29948a355152Smrg   CC="$am_aux_dir/compile $CC"
29958a355152Smrgfi
29968a355152SmrgAC_LANG_POP([C])])
29978a355152Smrg
29988a355152Smrg# For backward compatibility.
29998a355152SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30008a355152Smrg
30018a355152Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30025977a007Smrg#
30038a355152Smrg# This file is free software; the Free Software Foundation
30048a355152Smrg# gives unlimited permission to copy and/or distribute it,
30058a355152Smrg# with or without modifications, as long as this notice is preserved.
30061a650d1eSmrg
30078a355152Smrg# AM_RUN_LOG(COMMAND)
30088a355152Smrg# -------------------
30098a355152Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30108a355152Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30118a355152SmrgAC_DEFUN([AM_RUN_LOG],
30128a355152Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30138a355152Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30148a355152Smrg   ac_status=$?
30158a355152Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30168a355152Smrg   (exit $ac_status); }])
30175977a007Smrg
30188a355152Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30195977a007Smrg
30208a355152Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30218a355152Smrg#
30228a355152Smrg# This file is free software; the Free Software Foundation
30238a355152Smrg# gives unlimited permission to copy and/or distribute it,
30248a355152Smrg# with or without modifications, as long as this notice is preserved.
30255977a007Smrg
30268a355152Smrg# AM_SANITY_CHECK
30278a355152Smrg# ---------------
30288a355152SmrgAC_DEFUN([AM_SANITY_CHECK],
30298a355152Smrg[AC_MSG_CHECKING([whether build environment is sane])
30308a355152Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30318a355152Smrg# name.  Accept space and tab only in the latter.
30328a355152Smrgam_lf='
30338a355152Smrg'
30348a355152Smrgcase `pwd` in
30358a355152Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30368a355152Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30378a355152Smrgesac
30388a355152Smrgcase $srcdir in
30398a355152Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30408a355152Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30418a355152Smrgesac
30425977a007Smrg
30438a355152Smrg# Do 'set' in a subshell so we don't clobber the current shell's
30448a355152Smrg# arguments.  Must try -L first in case configure is actually a
30458a355152Smrg# symlink; some systems play weird games with the mod time of symlinks
30468a355152Smrg# (eg FreeBSD returns the mod time of the symlink's containing
30478a355152Smrg# directory).
30488a355152Smrgif (
30498a355152Smrg   am_has_slept=no
30508a355152Smrg   for am_try in 1 2; do
30518a355152Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30528a355152Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30538a355152Smrg     if test "$[*]" = "X"; then
30548a355152Smrg	# -L didn't work.
30558a355152Smrg	set X `ls -t "$srcdir/configure" conftest.file`
30568a355152Smrg     fi
30578a355152Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30588a355152Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
30598a355152Smrg
30608a355152Smrg	# If neither matched, then we have a broken ls.  This can happen
30618a355152Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30628a355152Smrg	# broken ls alias from the environment.  This has actually
30638a355152Smrg	# happened.  Such a system could not be considered "sane".
30648a355152Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30658a355152Smrg  alias in your environment])
30668a355152Smrg     fi
30678a355152Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30688a355152Smrg       break
30698a355152Smrg     fi
30708a355152Smrg     # Just in case.
30718a355152Smrg     sleep 1
30728a355152Smrg     am_has_slept=yes
30738a355152Smrg   done
30748a355152Smrg   test "$[2]" = conftest.file
30758a355152Smrg   )
30768a355152Smrgthen
30778a355152Smrg   # Ok.
30788a355152Smrg   :
30798a355152Smrgelse
30808a355152Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
30818a355152SmrgCheck your system clock])
30821a650d1eSmrgfi
30838a355152SmrgAC_MSG_RESULT([yes])
30848a355152Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30858a355152Smrg# generated files are strictly newer.
30868a355152Smrgam_sleep_pid=
30878a355152Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30888a355152Smrg  ( sleep 1 ) &
30898a355152Smrg  am_sleep_pid=$!
30908a355152Smrgfi
30918a355152SmrgAC_CONFIG_COMMANDS_PRE(
30928a355152Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30938a355152Smrg   if test -n "$am_sleep_pid"; then
30948a355152Smrg     # Hide warnings about reused PIDs.
30958a355152Smrg     wait $am_sleep_pid 2>/dev/null
30968a355152Smrg   fi
30978a355152Smrg   AC_MSG_RESULT([done])])
30988a355152Smrgrm -f conftest.file
30998a355152Smrg])
31001a650d1eSmrg
31018a355152Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
31021a650d1eSmrg#
31038a355152Smrg# This file is free software; the Free Software Foundation
31048a355152Smrg# gives unlimited permission to copy and/or distribute it,
31058a355152Smrg# with or without modifications, as long as this notice is preserved.
31068a355152Smrg
31078a355152Smrg# AM_SILENT_RULES([DEFAULT])
31088a355152Smrg# --------------------------
31098a355152Smrg# Enable less verbose build rules; with the default set to DEFAULT
31108a355152Smrg# ("yes" being less verbose, "no" or empty being verbose).
31118a355152SmrgAC_DEFUN([AM_SILENT_RULES],
31128a355152Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31138a355152SmrgAS_HELP_STRING(
31148a355152Smrg  [--enable-silent-rules],
31158a355152Smrg  [less verbose build output (undo: "make V=1")])
31168a355152SmrgAS_HELP_STRING(
31178a355152Smrg  [--disable-silent-rules],
31188a355152Smrg  [verbose build output (undo: "make V=0")])dnl
31198a355152Smrg])
31208a355152Smrgcase $enable_silent_rules in @%:@ (((
31218a355152Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31228a355152Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31238a355152Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31248a355152Smrgesac
31258a355152Smrgdnl
31268a355152Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31278a355152Smrgdnl do not support nested variable expansions.
31288a355152Smrgdnl See automake bug#9928 and bug#10237.
31298a355152Smrgam_make=${MAKE-make}
31308a355152SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31318a355152Smrg   [am_cv_make_support_nested_variables],
31328a355152Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31338a355152SmrgBAR0=false
31348a355152SmrgBAR1=true
31358a355152SmrgV=1
31368a355152Smrgam__doit:
31378a355152Smrg	@$(TRUE)
31388a355152Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31398a355152Smrg  am_cv_make_support_nested_variables=yes
31408a355152Smrgelse
31418a355152Smrg  am_cv_make_support_nested_variables=no
31428a355152Smrgfi])
31438a355152Smrgif test $am_cv_make_support_nested_variables = yes; then
31448a355152Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31458a355152Smrg  AM_V='$(V)'
31468a355152Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31478a355152Smrgelse
31488a355152Smrg  AM_V=$AM_DEFAULT_VERBOSITY
31498a355152Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31508a355152Smrgfi
31518a355152SmrgAC_SUBST([AM_V])dnl
31528a355152SmrgAM_SUBST_NOTMAKE([AM_V])dnl
31538a355152SmrgAC_SUBST([AM_DEFAULT_V])dnl
31548a355152SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31558a355152SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31568a355152SmrgAM_BACKSLASH='\'
31578a355152SmrgAC_SUBST([AM_BACKSLASH])dnl
31588a355152Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31598a355152Smrg])
31608a355152Smrg
31618a355152Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
31621a650d1eSmrg#
31638a355152Smrg# This file is free software; the Free Software Foundation
31648a355152Smrg# gives unlimited permission to copy and/or distribute it,
31658a355152Smrg# with or without modifications, as long as this notice is preserved.
31661a650d1eSmrg
31678a355152Smrg# AM_PROG_INSTALL_STRIP
31688a355152Smrg# ---------------------
31698a355152Smrg# One issue with vendor 'install' (even GNU) is that you can't
31708a355152Smrg# specify the program used to strip binaries.  This is especially
31718a355152Smrg# annoying in cross-compiling environments, where the build's strip
31728a355152Smrg# is unlikely to handle the host's binaries.
31738a355152Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31748a355152Smrg# always use install-sh in "make install-strip", and initialize
31758a355152Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
31768a355152SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31778a355152Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31788a355152Smrg# Installed binaries are usually stripped using 'strip' when the user
31798a355152Smrg# run "make install-strip".  However 'strip' might not be the right
31808a355152Smrg# tool to use in cross-compilation environments, therefore Automake
31818a355152Smrg# will honor the 'STRIP' environment variable to overrule this program.
31828a355152Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31838a355152Smrgif test "$cross_compiling" != no; then
31848a355152Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
31858a355152Smrgfi
31868a355152SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31878a355152SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31888a355152Smrg
31898a355152Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31901a650d1eSmrg#
31918a355152Smrg# This file is free software; the Free Software Foundation
31928a355152Smrg# gives unlimited permission to copy and/or distribute it,
31938a355152Smrg# with or without modifications, as long as this notice is preserved.
31948a355152Smrg
31958a355152Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
31968a355152Smrg# ---------------------------
31978a355152Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31988a355152Smrg# This macro is traced by Automake.
31998a355152SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
32008a355152Smrg
32018a355152Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32028a355152Smrg# --------------------------
32038a355152Smrg# Public sister of _AM_SUBST_NOTMAKE.
32048a355152SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32058a355152Smrg
32068a355152Smrg# Check how to create a tarball.                            -*- Autoconf -*-
32078a355152Smrg
32088a355152Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32091a650d1eSmrg#
32108a355152Smrg# This file is free software; the Free Software Foundation
32118a355152Smrg# gives unlimited permission to copy and/or distribute it,
32128a355152Smrg# with or without modifications, as long as this notice is preserved.
32138108eb18Smrg
32148a355152Smrg# _AM_PROG_TAR(FORMAT)
32158108eb18Smrg# --------------------
32168a355152Smrg# Check how to create a tarball in format FORMAT.
32178a355152Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32181a650d1eSmrg#
32198a355152Smrg# Substitute a variable $(am__tar) that is a command
32208a355152Smrg# writing to stdout a FORMAT-tarball containing the directory
32218a355152Smrg# $tardir.
32228a355152Smrg#     tardir=directory && $(am__tar) > result.tar
32231a650d1eSmrg#
32248a355152Smrg# Substitute a variable $(am__untar) that extract such
32258a355152Smrg# a tarball read from stdin.
32268a355152Smrg#     $(am__untar) < result.tar
32271a650d1eSmrg#
32288a355152SmrgAC_DEFUN([_AM_PROG_TAR],
32298a355152Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32308a355152Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32318a355152SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32328a355152Smrg
32338a355152Smrg# We'll loop over all known methods to create a tar archive until one works.
32348a355152Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32358a355152Smrg
32368a355152Smrgm4_if([$1], [v7],
32378a355152Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32388a355152Smrg
32398a355152Smrg  [m4_case([$1],
32408a355152Smrg    [ustar],
32418a355152Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32428a355152Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32438a355152Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32448a355152Smrg      # and bug#13588).
32458a355152Smrg      am_max_uid=2097151 # 2^21 - 1
32468a355152Smrg      am_max_gid=$am_max_uid
32478a355152Smrg      # The $UID and $GID variables are not portable, so we need to resort
32488a355152Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32498a355152Smrg      # below are definitely unexpected, so allow the users to see them
32508a355152Smrg      # (that is, avoid stderr redirection).
32518a355152Smrg      am_uid=`id -u || echo unknown`
32528a355152Smrg      am_gid=`id -g || echo unknown`
32538a355152Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32548a355152Smrg      if test $am_uid -le $am_max_uid; then
32558a355152Smrg         AC_MSG_RESULT([yes])
32568a355152Smrg      else
32578a355152Smrg         AC_MSG_RESULT([no])
32588a355152Smrg         _am_tools=none
32598a355152Smrg      fi
32608a355152Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32618a355152Smrg      if test $am_gid -le $am_max_gid; then
32628a355152Smrg         AC_MSG_RESULT([yes])
32638a355152Smrg      else
32648a355152Smrg        AC_MSG_RESULT([no])
32658a355152Smrg        _am_tools=none
32668a355152Smrg      fi],
32678a355152Smrg
32688a355152Smrg  [pax],
32698a355152Smrg    [],
32708a355152Smrg
32718a355152Smrg  [m4_fatal([Unknown tar format])])
32728a355152Smrg
32738a355152Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
32748a355152Smrg
32758a355152Smrg  # Go ahead even if we have the value already cached.  We do so because we
32768a355152Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32778a355152Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32788a355152Smrg
32798a355152Smrg  for _am_tool in $_am_tools; do
32808a355152Smrg    case $_am_tool in
32818a355152Smrg    gnutar)
32828a355152Smrg      for _am_tar in tar gnutar gtar; do
32838a355152Smrg        AM_RUN_LOG([$_am_tar --version]) && break
32848a355152Smrg      done
32858a355152Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32868a355152Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32878a355152Smrg      am__untar="$_am_tar -xf -"
32888a355152Smrg      ;;
32898a355152Smrg    plaintar)
32908a355152Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32918a355152Smrg      # ustar tarball either.
32928a355152Smrg      (tar --version) >/dev/null 2>&1 && continue
32938a355152Smrg      am__tar='tar chf - "$$tardir"'
32948a355152Smrg      am__tar_='tar chf - "$tardir"'
32958a355152Smrg      am__untar='tar xf -'
32968a355152Smrg      ;;
32978a355152Smrg    pax)
32988a355152Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
32998a355152Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33008a355152Smrg      am__untar='pax -r'
33018a355152Smrg      ;;
33028a355152Smrg    cpio)
33038a355152Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33048a355152Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33058a355152Smrg      am__untar='cpio -i -H $1 -d'
33068a355152Smrg      ;;
33078a355152Smrg    none)
33088a355152Smrg      am__tar=false
33098a355152Smrg      am__tar_=false
33108a355152Smrg      am__untar=false
33118a355152Smrg      ;;
33128a355152Smrg    esac
33138a355152Smrg
33148a355152Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33158a355152Smrg    # and am__untar set.
33168a355152Smrg    test -n "${am_cv_prog_tar_$1}" && break
33178a355152Smrg
33188a355152Smrg    # tar/untar a dummy directory, and stop if the command works.
33198a355152Smrg    rm -rf conftest.dir
33208a355152Smrg    mkdir conftest.dir
33218a355152Smrg    echo GrepMe > conftest.dir/file
33228a355152Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33238a355152Smrg    rm -rf conftest.dir
33248a355152Smrg    if test -s conftest.tar; then
33258a355152Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33268a355152Smrg      AM_RUN_LOG([cat conftest.dir/file])
33278a355152Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33288a355152Smrg    fi
33298a355152Smrg  done
33308a355152Smrg  rm -rf conftest.dir
33318a355152Smrg
33328a355152Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33338a355152Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33348a355152Smrg
33358a355152SmrgAC_SUBST([am__tar])
33368a355152SmrgAC_SUBST([am__untar])
33378a355152Smrg]) # _AM_PROG_TAR
33381a650d1eSmrg
3339