aclocal.m4 revision 1c235774
11c235774Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2ac92798bSmrg
31c235774Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4a966c04fSmrg
5a966c04fSmrg# This file is free software; the Free Software Foundation
6a966c04fSmrg# gives unlimited permission to copy and/or distribute it,
7a966c04fSmrg# with or without modifications, as long as this notice is preserved.
8a966c04fSmrg
9a966c04fSmrg# This program is distributed in the hope that it will be useful,
10a966c04fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a966c04fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a966c04fSmrg# PARTICULAR PURPOSE.
13a966c04fSmrg
14ac92798bSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152e2dd055Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162e2dd055Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
171c235774Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
181c235774Smrg[m4_warning([this file was generated for autoconf 2.69.
192e2dd055SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202e2dd055SmrgIf you have problems, you may need to regenerate the build system entirely.
21ac92798bSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a966c04fSmrg
231c235774Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
241c235774Smrgdnl serial 11 (pkg-config-0.29)
251c235774Smrgdnl
261c235774Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
271c235774Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
281c235774Smrgdnl
291c235774Smrgdnl This program is free software; you can redistribute it and/or modify
301c235774Smrgdnl it under the terms of the GNU General Public License as published by
311c235774Smrgdnl the Free Software Foundation; either version 2 of the License, or
321c235774Smrgdnl (at your option) any later version.
331c235774Smrgdnl
341c235774Smrgdnl This program is distributed in the hope that it will be useful, but
351c235774Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
361c235774Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
371c235774Smrgdnl General Public License for more details.
381c235774Smrgdnl
391c235774Smrgdnl You should have received a copy of the GNU General Public License
401c235774Smrgdnl along with this program; if not, write to the Free Software
411c235774Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
421c235774Smrgdnl 02111-1307, USA.
431c235774Smrgdnl
441c235774Smrgdnl As a special exception to the GNU General Public License, if you
451c235774Smrgdnl distribute this file as part of a program that contains a
461c235774Smrgdnl configuration script generated by Autoconf, you may include it under
471c235774Smrgdnl the same distribution terms that you use for the rest of that
481c235774Smrgdnl program.
49a966c04fSmrg
501c235774Smrgdnl PKG_PREREQ(MIN-VERSION)
511c235774Smrgdnl -----------------------
521c235774Smrgdnl Since: 0.29
531c235774Smrgdnl
541c235774Smrgdnl Verify that the version of the pkg-config macros are at least
551c235774Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
561c235774Smrgdnl installed version of pkg-config, this checks the developer's version
571c235774Smrgdnl of pkg.m4 when generating configure.
581c235774Smrgdnl
591c235774Smrgdnl To ensure that this macro is defined, also add:
601c235774Smrgdnl m4_ifndef([PKG_PREREQ],
611c235774Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
621c235774Smrgdnl
631c235774Smrgdnl See the "Since" comment for each macro you use to see what version
641c235774Smrgdnl of the macros you require.
651c235774Smrgm4_defun([PKG_PREREQ],
661c235774Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
671c235774Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
681c235774Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
691c235774Smrg])dnl PKG_PREREQ
70a966c04fSmrg
711c235774Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
721c235774Smrgdnl ----------------------------------
731c235774Smrgdnl Since: 0.16
741c235774Smrgdnl
751c235774Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
761c235774Smrgdnl first found in the path. Checks that the version of pkg-config found
771c235774Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
781c235774Smrgdnl used since that's the first version where most current features of
791c235774Smrgdnl pkg-config existed.
801c235774SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
811c235774Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
821c235774Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
831c235774Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
841c235774SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
851c235774SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
861c235774SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87a966c04fSmrg
881c235774Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
891c235774Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
901c235774Smrgfi
911c235774Smrgif test -n "$PKG_CONFIG"; then
921c235774Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
931c235774Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
941c235774Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
951c235774Smrg		AC_MSG_RESULT([yes])
961c235774Smrg	else
971c235774Smrg		AC_MSG_RESULT([no])
981c235774Smrg		PKG_CONFIG=""
991c235774Smrg	fi
1001c235774Smrgfi[]dnl
1011c235774Smrg])dnl PKG_PROG_PKG_CONFIG
102a966c04fSmrg
1031c235774Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1041c235774Smrgdnl -------------------------------------------------------------------
1051c235774Smrgdnl Since: 0.18
1061c235774Smrgdnl
1071c235774Smrgdnl Check to see whether a particular set of modules exists. Similar to
1081c235774Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1091c235774Smrgdnl
1101c235774Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1111c235774Smrgdnl only at the first occurence in configure.ac, so if the first place
1121c235774Smrgdnl it's called might be skipped (such as if it is within an "if", you
1131c235774Smrgdnl have to call PKG_CHECK_EXISTS manually
1141c235774SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1151c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1161c235774Smrgif test -n "$PKG_CONFIG" && \
1171c235774Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1181c235774Smrg  m4_default([$2], [:])
1191c235774Smrgm4_ifvaln([$3], [else
1201c235774Smrg  $3])dnl
1211c235774Smrgfi])
1229f00f3a1Smrg
1231c235774Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1241c235774Smrgdnl ---------------------------------------------
1251c235774Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1261c235774Smrgdnl pkg_failed based on the result.
1271c235774Smrgm4_define([_PKG_CONFIG],
1281c235774Smrg[if test -n "$$1"; then
1291c235774Smrg    pkg_cv_[]$1="$$1"
1301c235774Smrg elif test -n "$PKG_CONFIG"; then
1311c235774Smrg    PKG_CHECK_EXISTS([$3],
1321c235774Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1331c235774Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1341c235774Smrg		     [pkg_failed=yes])
1351c235774Smrg else
1361c235774Smrg    pkg_failed=untried
1371c235774Smrgfi[]dnl
1381c235774Smrg])dnl _PKG_CONFIG
139a966c04fSmrg
1401c235774Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1411c235774Smrgdnl ---------------------------
1421c235774Smrgdnl Internal check to see if pkg-config supports short errors.
1431c235774SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1441c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1451c235774Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1461c235774Smrg        _pkg_short_errors_supported=yes
14719569120Smrgelse
1481c235774Smrg        _pkg_short_errors_supported=no
1491c235774Smrgfi[]dnl
1501c235774Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151a966c04fSmrg
152a966c04fSmrg
1531c235774Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1541c235774Smrgdnl   [ACTION-IF-NOT-FOUND])
1551c235774Smrgdnl --------------------------------------------------------------
1561c235774Smrgdnl Since: 0.4.0
1571c235774Smrgdnl
1581c235774Smrgdnl Note that if there is a possibility the first call to
1591c235774Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1601c235774Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1611c235774SmrgAC_DEFUN([PKG_CHECK_MODULES],
1621c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1631c235774SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1641c235774SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165a966c04fSmrg
1661c235774Smrgpkg_failed=no
1671c235774SmrgAC_MSG_CHECKING([for $1])
168a966c04fSmrg
1691c235774Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1701c235774Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171a966c04fSmrg
1721c235774Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1731c235774Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1741c235774SmrgSee the pkg-config man page for more details.])
175a966c04fSmrg
1761c235774Smrgif test $pkg_failed = yes; then
1771c235774Smrg   	AC_MSG_RESULT([no])
1781c235774Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1791c235774Smrg        if test $_pkg_short_errors_supported = yes; then
1801c235774Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1811c235774Smrg        else 
1821c235774Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1831c235774Smrg        fi
1841c235774Smrg	# Put the nasty error message in config.log where it belongs
1851c235774Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186a966c04fSmrg
1871c235774Smrg	m4_default([$4], [AC_MSG_ERROR(
1881c235774Smrg[Package requirements ($2) were not met:
189a966c04fSmrg
1901c235774Smrg$$1_PKG_ERRORS
191a966c04fSmrg
1921c235774SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1931c235774Smrginstalled software in a non-standard prefix.
194edce3322Smrg
1951c235774Smrg_PKG_TEXT])[]dnl
1961c235774Smrg        ])
1971c235774Smrgelif test $pkg_failed = untried; then
1981c235774Smrg     	AC_MSG_RESULT([no])
1991c235774Smrg	m4_default([$4], [AC_MSG_FAILURE(
2001c235774Smrg[The pkg-config script could not be found or is too old.  Make sure it
2011c235774Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2021c235774Smrgpath to pkg-config.
203edce3322Smrg
2041c235774Smrg_PKG_TEXT
205edce3322Smrg
2061c235774SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2071c235774Smrg        ])
2081c235774Smrgelse
2091c235774Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2101c235774Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2111c235774Smrg        AC_MSG_RESULT([yes])
2121c235774Smrg	$3
2131c235774Smrgfi[]dnl
2141c235774Smrg])dnl PKG_CHECK_MODULES
215edce3322Smrg
216edce3322Smrg
2171c235774Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2181c235774Smrgdnl   [ACTION-IF-NOT-FOUND])
2191c235774Smrgdnl ---------------------------------------------------------------------
2201c235774Smrgdnl Since: 0.29
2211c235774Smrgdnl
2221c235774Smrgdnl Checks for existence of MODULES and gathers its build flags with
2231c235774Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2241c235774Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2251c235774Smrgdnl
2261c235774Smrgdnl Note that if there is a possibility the first call to
2271c235774Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2281c235774Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2291c235774Smrgdnl configure.ac.
2301c235774SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2311c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2321c235774Smrg_save_PKG_CONFIG=$PKG_CONFIG
2331c235774SmrgPKG_CONFIG="$PKG_CONFIG --static"
2341c235774SmrgPKG_CHECK_MODULES($@)
2351c235774SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2361c235774Smrg])dnl PKG_CHECK_MODULES_STATIC
237edce3322Smrg
238edce3322Smrg
2391c235774Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2401c235774Smrgdnl -------------------------
2411c235774Smrgdnl Since: 0.27
2421c235774Smrgdnl
2431c235774Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2441c235774Smrgdnl should install pkg-config .pc files. By default the directory is
2451c235774Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2461c235774Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2471c235774Smrgdnl parameter.
2481c235774SmrgAC_DEFUN([PKG_INSTALLDIR],
2491c235774Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2501c235774Smrgm4_pushdef([pkg_description],
2511c235774Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2521c235774SmrgAC_ARG_WITH([pkgconfigdir],
2531c235774Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2541c235774Smrg    [with_pkgconfigdir=]pkg_default)
2551c235774SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2561c235774Smrgm4_popdef([pkg_default])
2571c235774Smrgm4_popdef([pkg_description])
2581c235774Smrg])dnl PKG_INSTALLDIR
259edce3322Smrg
260a966c04fSmrg
2611c235774Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2621c235774Smrgdnl --------------------------------
2631c235774Smrgdnl Since: 0.27
2641c235774Smrgdnl
2651c235774Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2661c235774Smrgdnl module should install arch-independent pkg-config .pc files. By
2671c235774Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2681c235774Smrgdnl changed by passing DIRECTORY. The user can override through the
2691c235774Smrgdnl --with-noarch-pkgconfigdir parameter.
2701c235774SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2711c235774Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2721c235774Smrgm4_pushdef([pkg_description],
2731c235774Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2741c235774SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2751c235774Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2761c235774Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2771c235774SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2781c235774Smrgm4_popdef([pkg_default])
2791c235774Smrgm4_popdef([pkg_description])
2801c235774Smrg])dnl PKG_NOARCH_INSTALLDIR
281a966c04fSmrg
2822e2dd055Smrg
2831c235774Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2841c235774Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2851c235774Smrgdnl -------------------------------------------
2861c235774Smrgdnl Since: 0.28
2871c235774Smrgdnl
2881c235774Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2891c235774SmrgAC_DEFUN([PKG_CHECK_VAR],
2901c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2911c235774SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292a966c04fSmrg
2931c235774Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2941c235774SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
295a966c04fSmrg
2961c235774SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2971c235774Smrg])dnl PKG_CHECK_VAR
298a966c04fSmrg
2991c235774Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3001c235774Smrgdnl
3011c235774Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3021c235774Smrgdnl
3031c235774Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3041c235774Smrgdnl copy of this software and associated documentation files (the "Software"),
3051c235774Smrgdnl to deal in the Software without restriction, including without limitation
3061c235774Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3071c235774Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3081c235774Smrgdnl Software is furnished to do so, subject to the following conditions:
3091c235774Smrgdnl
3101c235774Smrgdnl The above copyright notice and this permission notice (including the next
3111c235774Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3121c235774Smrgdnl Software.
3131c235774Smrgdnl
3141c235774Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3151c235774Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3161c235774Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3171c235774Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3181c235774Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3191c235774Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3201c235774Smrgdnl DEALINGS IN THE SOFTWARE.
321edce3322Smrg
3221c235774Smrg# XORG_MACROS_VERSION(required-version)
3231c235774Smrg# -------------------------------------
3241c235774Smrg# Minimum version: 1.1.0
3251c235774Smrg#
3261c235774Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3271c235774Smrg# your configure.ac with the minimum required version, such as:
3281c235774Smrg# XORG_MACROS_VERSION(1.1)
3291c235774Smrg#
3301c235774Smrg# To ensure that this macro is defined, also add:
3311c235774Smrg# m4_ifndef([XORG_MACROS_VERSION],
3321c235774Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3331c235774Smrg#
3341c235774Smrg#
3351c235774Smrg# See the "minimum version" comment for each macro you use to see what
3361c235774Smrg# version you require.
3371c235774Smrgm4_defun([XORG_MACROS_VERSION],[
3381c235774Smrgm4_define([vers_have], [1.19.0])
3391c235774Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3401c235774Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3411c235774Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3421c235774Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3431c235774Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3441c235774Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3451c235774Smrgm4_undefine([vers_have])
3461c235774Smrgm4_undefine([maj_have])
3471c235774Smrgm4_undefine([maj_needed])
3481c235774Smrg]) # XORG_MACROS_VERSION
349a966c04fSmrg
3501c235774Smrg# XORG_PROG_RAWCPP()
3511c235774Smrg# ------------------
3521c235774Smrg# Minimum version: 1.0.0
3531c235774Smrg#
3541c235774Smrg# Find cpp program and necessary flags for use in pre-processing text files
3551c235774Smrg# such as man pages and config files
3561c235774SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3571c235774SmrgAC_REQUIRE([AC_PROG_CPP])
3581c235774SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3591c235774Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3601c235774Smrg
3611c235774Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3621c235774Smrg# which is not the best choice for supporting other OS'es, but covers most
3631c235774Smrg# of the ones we need for now.
3641c235774SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3651c235774SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3661c235774Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3671c235774Smrg	AC_MSG_RESULT([no])
3681c235774Smrgelse
3691c235774Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3701c235774Smrg		RAWCPPFLAGS=-undef
3711c235774Smrg		AC_MSG_RESULT([yes])
3721c235774Smrg	# under Cygwin unix is still defined even with -undef
3731c235774Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3741c235774Smrg		RAWCPPFLAGS="-undef -ansi"
3751c235774Smrg		AC_MSG_RESULT([yes, with -ansi])
3761c235774Smrg	else
3771c235774Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3781c235774Smrg	fi
379a966c04fSmrgfi
3801c235774Smrgrm -f conftest.$ac_ext
381a966c04fSmrg
3821c235774SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3831c235774SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3841c235774Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3851c235774Smrg	AC_MSG_RESULT([no])
3861c235774Smrgelse
3871c235774Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3881c235774Smrg		TRADITIONALCPPFLAGS="-traditional"
3891c235774Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3901c235774Smrg		AC_MSG_RESULT([yes])
3911c235774Smrg	else
3921c235774Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3931c235774Smrg	fi
3949f00f3a1Smrgfi
3951c235774Smrgrm -f conftest.$ac_ext
3961c235774SmrgAC_SUBST(RAWCPPFLAGS)
3971c235774SmrgAC_SUBST(TRADITIONALCPPFLAGS)
3981c235774Smrg]) # XORG_PROG_RAWCPP
399a966c04fSmrg
4001c235774Smrg# XORG_MANPAGE_SECTIONS()
4011c235774Smrg# -----------------------
4021c235774Smrg# Minimum version: 1.0.0
4031c235774Smrg#
4041c235774Smrg# Determine which sections man pages go in for the different man page types
4051c235774Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4061c235774Smrg# Not sure if there's any better way than just hardcoding by OS name.
4071c235774Smrg# Override default settings by setting environment variables
4081c235774Smrg# Added MAN_SUBSTS in version 1.8
4091c235774Smrg# Added AC_PROG_SED in version 1.8
410a966c04fSmrg
4111c235774SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4121c235774SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4131c235774SmrgAC_REQUIRE([AC_PROG_SED])
414a966c04fSmrg
4151c235774Smrgif test x$APP_MAN_SUFFIX = x    ; then
4161c235774Smrg    APP_MAN_SUFFIX=1
4179f00f3a1Smrgfi
4181c235774Smrgif test x$APP_MAN_DIR = x    ; then
4191c235774Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
42019569120Smrgfi
421a966c04fSmrg
4221c235774Smrgif test x$LIB_MAN_SUFFIX = x    ; then
4231c235774Smrg    LIB_MAN_SUFFIX=3
4241c235774Smrgfi
4251c235774Smrgif test x$LIB_MAN_DIR = x    ; then
4261c235774Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4271c235774Smrgfi
428a966c04fSmrg
4291c235774Smrgif test x$FILE_MAN_SUFFIX = x    ; then
4301c235774Smrg    case $host_os in
4311c235774Smrg	# Solaris 2.0 - 11 use SysV man page sections
4321c235774Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4331c235774Smrg	*)				FILE_MAN_SUFFIX=5  ;;
4341c235774Smrg    esac
4351c235774Smrgfi
4361c235774Smrgif test x$FILE_MAN_DIR = x    ; then
4371c235774Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4381c235774Smrgfi
43919569120Smrg
4401c235774Smrgif test x$MISC_MAN_SUFFIX = x    ; then
4411c235774Smrg    case $host_os in
4421c235774Smrg	# Solaris 2.0 - 11 use SysV man page sections
4431c235774Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4441c235774Smrg	*)				MISC_MAN_SUFFIX=7  ;;
4451c235774Smrg    esac
4461c235774Smrgfi
4471c235774Smrgif test x$MISC_MAN_DIR = x    ; then
4481c235774Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4491c235774Smrgfi
45019569120Smrg
4511c235774Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4521c235774Smrg    case $host_os in
4531c235774Smrg	# Solaris 2.0 - 11 use SysV man page sections
4541c235774Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4551c235774Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4561c235774Smrg    esac
4571c235774Smrgfi
4581c235774Smrgif test x$DRIVER_MAN_DIR = x    ; then
4591c235774Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4609f00f3a1Smrgfi
461a966c04fSmrg
4621c235774Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4631c235774Smrg    case $host_os in
4641c235774Smrg	# Solaris 2.0 - 11 use SysV man page sections
4651c235774Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4661c235774Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4671c235774Smrg    esac
4681c235774Smrgfi
4691c235774Smrgif test x$ADMIN_MAN_DIR = x    ; then
4701c235774Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4711c235774Smrgfi
4729f00f3a1Smrg
473a966c04fSmrg
4741c235774SmrgAC_SUBST([APP_MAN_SUFFIX])
4751c235774SmrgAC_SUBST([LIB_MAN_SUFFIX])
4761c235774SmrgAC_SUBST([FILE_MAN_SUFFIX])
4771c235774SmrgAC_SUBST([MISC_MAN_SUFFIX])
4781c235774SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4791c235774SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4801c235774SmrgAC_SUBST([APP_MAN_DIR])
4811c235774SmrgAC_SUBST([LIB_MAN_DIR])
4821c235774SmrgAC_SUBST([FILE_MAN_DIR])
4831c235774SmrgAC_SUBST([MISC_MAN_DIR])
4841c235774SmrgAC_SUBST([DRIVER_MAN_DIR])
4851c235774SmrgAC_SUBST([ADMIN_MAN_DIR])
486a966c04fSmrg
4871c235774SmrgXORG_MAN_PAGE="X Version 11"
4881c235774SmrgAC_SUBST([XORG_MAN_PAGE])
4891c235774SmrgMAN_SUBSTS="\
4901c235774Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4911c235774Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4921c235774Smrg	-e 's|__xservername__|Xorg|g' \
4931c235774Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
4941c235774Smrg	-e 's|__projectroot__|\$(prefix)|g' \
4951c235774Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4961c235774Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4971c235774Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4981c235774Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4991c235774Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5001c235774Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5011c235774Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5021c235774SmrgAC_SUBST([MAN_SUBSTS])
503ac92798bSmrg
5041c235774Smrg]) # XORG_MANPAGE_SECTIONS
505a966c04fSmrg
5061c235774Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5071c235774Smrg# ------------------------
5081c235774Smrg# Minimum version: 1.7.0
50919569120Smrg#
5101c235774Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5111c235774Smrg# provided by xorg-sgml-doctools, if installed.
5121c235774SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5131c235774SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5141c235774SmrgXORG_SGML_PATH=
5151c235774SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5161c235774Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5171c235774Smrg    [m4_ifval([$1],[:],
5181c235774Smrg        [if test x"$cross_compiling" != x"yes" ; then
5191c235774Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5201c235774Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5211c235774Smrg         fi])
5221c235774Smrg    ])
5239f00f3a1Smrg
5241c235774Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5251c235774Smrg# the path and the name of the doc stylesheet
5261c235774Smrgif test "x$XORG_SGML_PATH" != "x" ; then
5271c235774Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5281c235774Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5291c235774Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5309f00f3a1Smrgelse
5311c235774Smrg   AC_MSG_RESULT([no])
532a966c04fSmrgfi
533a966c04fSmrg
5341c235774SmrgAC_SUBST(XORG_SGML_PATH)
5351c235774SmrgAC_SUBST(STYLESHEET_SRCDIR)
5361c235774SmrgAC_SUBST(XSL_STYLESHEET)
5371c235774SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5381c235774Smrg]) # XORG_CHECK_SGML_DOCTOOLS
539a966c04fSmrg
5401c235774Smrg# XORG_CHECK_LINUXDOC
5411c235774Smrg# -------------------
5421c235774Smrg# Minimum version: 1.0.0
54319569120Smrg#
5441c235774Smrg# Defines the variable MAKE_TEXT if the necessary tools and
5451c235774Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5461c235774Smrg# Whether or not the necessary tools and files are found can be checked
5471c235774Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5481c235774SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5491c235774SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5501c235774SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551ac92798bSmrg
5521c235774SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553ac92798bSmrg
5541c235774SmrgAC_MSG_CHECKING([whether to build documentation])
555ac92798bSmrg
5561c235774Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5571c235774Smrg   BUILDDOC=yes
55819569120Smrgelse
5591c235774Smrg   BUILDDOC=no
5609f00f3a1Smrgfi
561ac92798bSmrg
5621c235774SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5632e2dd055Smrg
5641c235774SmrgAC_MSG_RESULT([$BUILDDOC])
565a966c04fSmrg
5661c235774SmrgAC_MSG_CHECKING([whether to build pdf documentation])
567a966c04fSmrg
5681c235774Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5691c235774Smrg   BUILDPDFDOC=yes
5701c235774Smrgelse
5711c235774Smrg   BUILDPDFDOC=no
5721c235774Smrgfi
573a966c04fSmrg
5741c235774SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575a966c04fSmrg
5761c235774SmrgAC_MSG_RESULT([$BUILDPDFDOC])
577a966c04fSmrg
5781c235774SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5791c235774SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5801c235774SmrgMAKE_PDF="$PS2PDF"
5811c235774SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582a966c04fSmrg
5831c235774SmrgAC_SUBST(MAKE_TEXT)
5841c235774SmrgAC_SUBST(MAKE_PS)
5851c235774SmrgAC_SUBST(MAKE_PDF)
5861c235774SmrgAC_SUBST(MAKE_HTML)
5871c235774Smrg]) # XORG_CHECK_LINUXDOC
588a966c04fSmrg
5891c235774Smrg# XORG_CHECK_DOCBOOK
59019569120Smrg# -------------------
5911c235774Smrg# Minimum version: 1.0.0
5921c235774Smrg#
5931c235774Smrg# Checks for the ability to build output formats from SGML DocBook source.
5941c235774Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5951c235774Smrg# indicates whether the necessary tools and files are found and, if set,
5961c235774Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5971c235774SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5981c235774SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599a966c04fSmrg
6001c235774SmrgBUILDTXTDOC=no
6011c235774SmrgBUILDPDFDOC=no
6021c235774SmrgBUILDPSDOC=no
6031c235774SmrgBUILDHTMLDOC=no
604a966c04fSmrg
6051c235774SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6061c235774SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6071c235774SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6081c235774SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609a966c04fSmrg
6101c235774SmrgAC_MSG_CHECKING([whether to build text documentation])
6111c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6121c235774Smrg   test x$BUILD_TXTDOC != xno; then
6131c235774Smrg	BUILDTXTDOC=yes
6141c235774Smrgfi
6151c235774SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6161c235774SmrgAC_MSG_RESULT([$BUILDTXTDOC])
6172e2dd055Smrg
6181c235774SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6191c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6201c235774Smrg   test x$BUILD_PDFDOC != xno; then
6211c235774Smrg	BUILDPDFDOC=yes
6221c235774Smrgfi
6231c235774SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6241c235774SmrgAC_MSG_RESULT([$BUILDPDFDOC])
625ac92798bSmrg
6261c235774SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6271c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6281c235774Smrg   test x$BUILD_PSDOC != xno; then
6291c235774Smrg	BUILDPSDOC=yes
630ac92798bSmrgfi
6311c235774SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6321c235774SmrgAC_MSG_RESULT([$BUILDPSDOC])
6331c235774Smrg
6341c235774SmrgAC_MSG_CHECKING([whether to build HTML documentation])
6351c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6361c235774Smrg   test x$BUILD_HTMLDOC != xno; then
6371c235774Smrg	BUILDHTMLDOC=yes
638edce3322Smrgfi
6391c235774SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6401c235774SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641edce3322Smrg
6421c235774SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6431c235774SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6441c235774SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6451c235774SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6462e2dd055Smrg
6471c235774SmrgAC_SUBST(MAKE_TEXT)
6481c235774SmrgAC_SUBST(MAKE_PS)
6491c235774SmrgAC_SUBST(MAKE_PDF)
6501c235774SmrgAC_SUBST(MAKE_HTML)
6511c235774Smrg]) # XORG_CHECK_DOCBOOK
652a966c04fSmrg
6531c235774Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6541c235774Smrg# ----------------
6551c235774Smrg# Minimum version: 1.5.0
6561c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
657a966c04fSmrg#
6581c235774Smrg# Documentation tools are not always available on all platforms and sometimes
6591c235774Smrg# not at the appropriate level. This macro enables a module to test for the
6601c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
6611c235774Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6621c235774Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6631c235774Smrg# --with-xmlto assumes 'auto'.
6641c235774Smrg#
6651c235774Smrg# Interface to module:
6661c235774Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6671c235774Smrg# XMLTO:	returns the path of the xmlto program found
6681c235774Smrg#		returns the path set by the user in the environment
6691c235774Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6701c235774Smrg#		'no' user instructs the module not to use xmlto
6711c235774Smrg#
6721c235774Smrg# Added in version 1.10.0
6731c235774Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6741c235774Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6751c235774Smrg#
6761c235774Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6771c235774Smrg#
6781c235774SmrgAC_DEFUN([XORG_WITH_XMLTO],[
6791c235774SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6801c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
6811c235774SmrgAC_ARG_WITH(xmlto,
6821c235774Smrg	AS_HELP_STRING([--with-xmlto],
6831c235774Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6841c235774Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6851c235774Smrgm4_undefine([_defopt])
686ac92798bSmrg
6871c235774Smrgif test "x$use_xmlto" = x"auto"; then
6881c235774Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6891c235774Smrg   if test "x$XMLTO" = "x"; then
6901c235774Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6911c235774Smrg	have_xmlto=no
6921c235774Smrg   else
6931c235774Smrg        have_xmlto=yes
6941c235774Smrg   fi
6951c235774Smrgelif test "x$use_xmlto" = x"yes" ; then
6961c235774Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6971c235774Smrg   if test "x$XMLTO" = "x"; then
6981c235774Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6991c235774Smrg   fi
7001c235774Smrg   have_xmlto=yes
7011c235774Smrgelif test "x$use_xmlto" = x"no" ; then
7021c235774Smrg   if test "x$XMLTO" != "x"; then
7031c235774Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7041c235774Smrg   fi
7051c235774Smrg   have_xmlto=no
7061c235774Smrgelse
7071c235774Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7089f00f3a1Smrgfi
709ac92798bSmrg
7101c235774Smrg# Test for a minimum version of xmlto, if provided.
7111c235774Smrgm4_ifval([$1],
7121c235774Smrg[if test "$have_xmlto" = yes; then
7131c235774Smrg    # scrape the xmlto version
7141c235774Smrg    AC_MSG_CHECKING([the xmlto version])
7151c235774Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7161c235774Smrg    AC_MSG_RESULT([$xmlto_version])
7171c235774Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7181c235774Smrg        [if test "x$use_xmlto" = xauto; then
7191c235774Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7201c235774Smrg            have_xmlto=no
7211c235774Smrg        else
7221c235774Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7231c235774Smrg        fi])
7241c235774Smrgfi])
7251c235774Smrg
7261c235774Smrg# Test for the ability of xmlto to generate a text target
72719569120Smrg#
7281c235774Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7291c235774Smrg# following test for empty XML docbook files.
7301c235774Smrg# For compatibility reasons use the following empty XML docbook file and if
7311c235774Smrg# it fails try it again with a non-empty XML file.
7321c235774Smrghave_xmlto_text=no
7331c235774Smrgcat > conftest.xml << "EOF"
7341c235774SmrgEOF
7351c235774SmrgAS_IF([test "$have_xmlto" = yes],
7361c235774Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7371c235774Smrg             [have_xmlto_text=yes],
7381c235774Smrg             [# Try it again with a non-empty XML file.
7391c235774Smrg              cat > conftest.xml << "EOF"
7401c235774Smrg<x></x>
7411c235774SmrgEOF
7421c235774Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7431c235774Smrg                    [have_xmlto_text=yes],
7441c235774Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7451c235774Smrgrm -f conftest.xml
7461c235774SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7471c235774SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7481c235774Smrg]) # XORG_WITH_XMLTO
749a966c04fSmrg
7501c235774Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7511c235774Smrg# --------------------------------------------
7521c235774Smrg# Minimum version: 1.12.0
7531c235774Smrg# Minimum version for optional DEFAULT argument: 1.12.0
7541c235774Smrg#
7551c235774Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7561c235774Smrg# XML-based language used for the transformation of XML documents.
7571c235774Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7581c235774Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7591c235774Smrg# The XSLT processor is often used as a standalone tool for transformations.
7601c235774Smrg# It should not be assumed that this tool is used only to work with documnetation.
7611c235774Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7621c235774Smrg#
7631c235774Smrg# Interface to module:
7641c235774Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7651c235774Smrg# XSLTPROC:	 returns the path of the xsltproc program found
7661c235774Smrg#		 returns the path set by the user in the environment
7671c235774Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7681c235774Smrg#		  'no' user instructs the module not to use xsltproc
7691c235774Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7701c235774Smrg#
7711c235774Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7721c235774Smrg#
7731c235774SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7741c235774SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7751c235774Smrg# Preserves the interface, should it be implemented later
7761c235774Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7771c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
7781c235774SmrgAC_ARG_WITH(xsltproc,
7791c235774Smrg	AS_HELP_STRING([--with-xsltproc],
7801c235774Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7811c235774Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7821c235774Smrgm4_undefine([_defopt])
783edce3322Smrg
7841c235774Smrgif test "x$use_xsltproc" = x"auto"; then
7851c235774Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7861c235774Smrg   if test "x$XSLTPROC" = "x"; then
7871c235774Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7881c235774Smrg	have_xsltproc=no
7891c235774Smrg   else
7901c235774Smrg        have_xsltproc=yes
7911c235774Smrg   fi
7921c235774Smrgelif test "x$use_xsltproc" = x"yes" ; then
7931c235774Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7941c235774Smrg   if test "x$XSLTPROC" = "x"; then
7951c235774Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7961c235774Smrg   fi
7971c235774Smrg   have_xsltproc=yes
7981c235774Smrgelif test "x$use_xsltproc" = x"no" ; then
7991c235774Smrg   if test "x$XSLTPROC" != "x"; then
8001c235774Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8011c235774Smrg   fi
8021c235774Smrg   have_xsltproc=no
8031c235774Smrgelse
8041c235774Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8051c235774Smrgfi
806edce3322Smrg
8071c235774SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8081c235774Smrg]) # XORG_WITH_XSLTPROC
80919569120Smrg
8101c235774Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8111c235774Smrg# ----------------------------------------
8121c235774Smrg# Minimum version: 1.15.0
8139f00f3a1Smrg#
8141c235774Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8151c235774Smrg# scanning arbitrary text files, extracting information from those text files,
8161c235774Smrg# and printing reports based on that information.
8179f00f3a1Smrg#
8181c235774Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8199f00f3a1Smrg#
8201c235774Smrg# Interface to module:
8211c235774Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8221c235774Smrg# PERL:	     returns the path of the perl program found
8231c235774Smrg#	     returns the path set by the user in the environment
8241c235774Smrg# --with-perl: 'yes' user instructs the module to use perl
8251c235774Smrg#	       'no' user instructs the module not to use perl
8261c235774Smrg# have_perl: returns yes if perl found in PATH or no
8279f00f3a1Smrg#
8281c235774Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8291c235774Smrg#
8301c235774SmrgAC_DEFUN([XORG_WITH_PERL],[
8311c235774SmrgAC_ARG_VAR([PERL], [Path to perl command])
8321c235774Smrg# Preserves the interface, should it be implemented later
8331c235774Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8341c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
8351c235774SmrgAC_ARG_WITH(perl,
8361c235774Smrg	AS_HELP_STRING([--with-perl],
8371c235774Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8381c235774Smrg	   [use_perl=$withval], [use_perl=]_defopt)
8391c235774Smrgm4_undefine([_defopt])
840a966c04fSmrg
8411c235774Smrgif test "x$use_perl" = x"auto"; then
8421c235774Smrg   AC_PATH_PROG([PERL], [perl])
8431c235774Smrg   if test "x$PERL" = "x"; then
8441c235774Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8451c235774Smrg	have_perl=no
8461c235774Smrg   else
8471c235774Smrg        have_perl=yes
8481c235774Smrg   fi
8491c235774Smrgelif test "x$use_perl" = x"yes" ; then
8501c235774Smrg   AC_PATH_PROG([PERL], [perl])
8511c235774Smrg   if test "x$PERL" = "x"; then
8521c235774Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8531c235774Smrg   fi
8541c235774Smrg   have_perl=yes
8551c235774Smrgelif test "x$use_perl" = x"no" ; then
8561c235774Smrg   if test "x$PERL" != "x"; then
8571c235774Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8581c235774Smrg   fi
8591c235774Smrg   have_perl=no
8601c235774Smrgelse
8611c235774Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8621c235774Smrgfi
86319569120Smrg
8641c235774SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8651c235774Smrg]) # XORG_WITH_PERL
86619569120Smrg
8671c235774Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8681c235774Smrg# ----------------
8691c235774Smrg# Minimum version: 1.5.0
8701c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
8711c235774Smrg#
8721c235774Smrg# Documentation tools are not always available on all platforms and sometimes
8731c235774Smrg# not at the appropriate level. This macro enables a module to test for the
8741c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
8751c235774Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8761c235774Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8771c235774Smrg# --with-asciidoc assumes 'auto'.
8781c235774Smrg#
8791c235774Smrg# Interface to module:
8801c235774Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8811c235774Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
8821c235774Smrg#		 returns the path set by the user in the environment
8831c235774Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8841c235774Smrg#		  'no' user instructs the module not to use asciidoc
8851c235774Smrg#
8861c235774Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8871c235774Smrg#
8881c235774SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8891c235774SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8901c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
8911c235774SmrgAC_ARG_WITH(asciidoc,
8921c235774Smrg	AS_HELP_STRING([--with-asciidoc],
8931c235774Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8941c235774Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8951c235774Smrgm4_undefine([_defopt])
89619569120Smrg
8971c235774Smrgif test "x$use_asciidoc" = x"auto"; then
8981c235774Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8991c235774Smrg   if test "x$ASCIIDOC" = "x"; then
9001c235774Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9011c235774Smrg	have_asciidoc=no
9021c235774Smrg   else
9031c235774Smrg        have_asciidoc=yes
9041c235774Smrg   fi
9051c235774Smrgelif test "x$use_asciidoc" = x"yes" ; then
9061c235774Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9071c235774Smrg   if test "x$ASCIIDOC" = "x"; then
9081c235774Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9091c235774Smrg   fi
9101c235774Smrg   have_asciidoc=yes
9111c235774Smrgelif test "x$use_asciidoc" = x"no" ; then
9121c235774Smrg   if test "x$ASCIIDOC" != "x"; then
9131c235774Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9141c235774Smrg   fi
9151c235774Smrg   have_asciidoc=no
9161c235774Smrgelse
9171c235774Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9181c235774Smrgfi
9191c235774Smrgm4_ifval([$1],
9201c235774Smrg[if test "$have_asciidoc" = yes; then
9211c235774Smrg    # scrape the asciidoc version
9221c235774Smrg    AC_MSG_CHECKING([the asciidoc version])
9231c235774Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9241c235774Smrg    AC_MSG_RESULT([$asciidoc_version])
9251c235774Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9261c235774Smrg        [if test "x$use_asciidoc" = xauto; then
9271c235774Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9281c235774Smrg            have_asciidoc=no
9291c235774Smrg        else
9301c235774Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9311c235774Smrg        fi])
9321c235774Smrgfi])
9331c235774SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9341c235774Smrg]) # XORG_WITH_ASCIIDOC
93519569120Smrg
9361c235774Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9371c235774Smrg# -------------------------------------------
9381c235774Smrg# Minimum version: 1.5.0
9391c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9401c235774Smrg# Minimum version for optional DOT checking: 1.18.0
9411c235774Smrg#
9421c235774Smrg# Documentation tools are not always available on all platforms and sometimes
9431c235774Smrg# not at the appropriate level. This macro enables a module to test for the
9441c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9451c235774Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9461c235774Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9471c235774Smrg# --with-doxygen assumes 'auto'.
9481c235774Smrg#
9491c235774Smrg# Interface to module:
9501c235774Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9511c235774Smrg# DOXYGEN:	 returns the path of the doxygen program found
9521c235774Smrg#		 returns the path set by the user in the environment
9531c235774Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9541c235774Smrg#		  'no' user instructs the module not to use doxygen
9551c235774Smrg#
9561c235774Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9571c235774Smrg#
9581c235774SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9591c235774SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9601c235774SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9611c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
9621c235774SmrgAC_ARG_WITH(doxygen,
9631c235774Smrg	AS_HELP_STRING([--with-doxygen],
9641c235774Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9651c235774Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9661c235774Smrgm4_undefine([_defopt])
96719569120Smrg
9681c235774Smrgif test "x$use_doxygen" = x"auto"; then
9691c235774Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9701c235774Smrg   if test "x$DOXYGEN" = "x"; then
9711c235774Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9721c235774Smrg	have_doxygen=no
9731c235774Smrg   else
9741c235774Smrg        have_doxygen=yes
9751c235774Smrg   fi
9761c235774Smrgelif test "x$use_doxygen" = x"yes" ; then
9771c235774Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9781c235774Smrg   if test "x$DOXYGEN" = "x"; then
9791c235774Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9801c235774Smrg   fi
9811c235774Smrg   have_doxygen=yes
9821c235774Smrgelif test "x$use_doxygen" = x"no" ; then
9831c235774Smrg   if test "x$DOXYGEN" != "x"; then
9841c235774Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9851c235774Smrg   fi
9861c235774Smrg   have_doxygen=no
9871c235774Smrgelse
9881c235774Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9891c235774Smrgfi
9901c235774Smrgm4_ifval([$1],
9911c235774Smrg[if test "$have_doxygen" = yes; then
9921c235774Smrg    # scrape the doxygen version
9931c235774Smrg    AC_MSG_CHECKING([the doxygen version])
9941c235774Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9951c235774Smrg    AC_MSG_RESULT([$doxygen_version])
9961c235774Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9971c235774Smrg        [if test "x$use_doxygen" = xauto; then
9981c235774Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9991c235774Smrg            have_doxygen=no
10001c235774Smrg        else
10011c235774Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10021c235774Smrg        fi])
10031c235774Smrgfi])
100419569120Smrg
10051c235774Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10061c235774Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10071c235774Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10081c235774SmrgHAVE_DOT=no
10091c235774Smrgif test "x$have_doxygen" = "xyes"; then
10101c235774Smrg  AC_PATH_PROG([DOT], [dot])
10111c235774Smrg    if test "x$DOT" != "x"; then
10121c235774Smrg      HAVE_DOT=yes
101319569120Smrg    fi
10141c235774Smrgfi
101519569120Smrg
10161c235774SmrgAC_SUBST([HAVE_DOT])
10171c235774SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10181c235774SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10191c235774Smrg]) # XORG_WITH_DOXYGEN
102019569120Smrg
10211c235774Smrg# XORG_WITH_GROFF([DEFAULT])
10221c235774Smrg# ----------------
10231c235774Smrg# Minimum version: 1.6.0
10241c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10251c235774Smrg#
10261c235774Smrg# Documentation tools are not always available on all platforms and sometimes
10271c235774Smrg# not at the appropriate level. This macro enables a module to test for the
10281c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10291c235774Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
10301c235774Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
10311c235774Smrg# --with-groff assumes 'auto'.
10321c235774Smrg#
10331c235774Smrg# Interface to module:
10341c235774Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10351c235774Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10361c235774Smrg# HAVE_GROFF_MS: the -ms macros package
10371c235774Smrg# GROFF:	 returns the path of the groff program found
10381c235774Smrg#		 returns the path set by the user in the environment
10391c235774Smrg# --with-groff:	 'yes' user instructs the module to use groff
10401c235774Smrg#		 'no' user instructs the module not to use groff
10411c235774Smrg#
10421c235774Smrg# Added in version 1.9.0:
10431c235774Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10441c235774Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10451c235774Smrg#		   psselect from the psutils package.
10461c235774Smrg#		   the ghostcript package. Refer to the grohtml man pages
10471c235774Smrg#
10481c235774Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10491c235774Smrg#
10501c235774Smrg# OS and distros often splits groff in a basic and full package, the former
10511c235774Smrg# having the groff program and the later having devices, fonts and macros
10521c235774Smrg# Checking for the groff executable is not enough.
10531c235774Smrg#
10541c235774Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
10551c235774Smrg# unset HAVE_GROFF or GROFF env variables.
10561c235774Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10571c235774Smrg#
10581c235774SmrgAC_DEFUN([XORG_WITH_GROFF],[
10591c235774SmrgAC_ARG_VAR([GROFF], [Path to groff command])
10601c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
10611c235774SmrgAC_ARG_WITH(groff,
10621c235774Smrg	AS_HELP_STRING([--with-groff],
10631c235774Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10641c235774Smrg	   [use_groff=$withval], [use_groff=]_defopt)
10651c235774Smrgm4_undefine([_defopt])
106619569120Smrg
10671c235774Smrgif test "x$use_groff" = x"auto"; then
10681c235774Smrg   AC_PATH_PROG([GROFF], [groff])
10691c235774Smrg   if test "x$GROFF" = "x"; then
10701c235774Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10711c235774Smrg	have_groff=no
10721c235774Smrg   else
10731c235774Smrg        have_groff=yes
10741c235774Smrg   fi
10751c235774Smrgelif test "x$use_groff" = x"yes" ; then
10761c235774Smrg   AC_PATH_PROG([GROFF], [groff])
10771c235774Smrg   if test "x$GROFF" = "x"; then
10781c235774Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10791c235774Smrg   fi
10801c235774Smrg   have_groff=yes
10811c235774Smrgelif test "x$use_groff" = x"no" ; then
10821c235774Smrg   if test "x$GROFF" != "x"; then
10831c235774Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10841c235774Smrg   fi
10851c235774Smrg   have_groff=no
10861c235774Smrgelse
10871c235774Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10881c235774Smrgfi
108919569120Smrg
10901c235774Smrg# We have groff, test for the presence of the macro packages
10911c235774Smrgif test "x$have_groff" = x"yes"; then
10921c235774Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10931c235774Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10941c235774Smrg        groff_ms_works=yes
10951c235774Smrg    else
10961c235774Smrg        groff_ms_works=no
10971c235774Smrg    fi
10981c235774Smrg    AC_MSG_RESULT([$groff_ms_works])
10991c235774Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11001c235774Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11011c235774Smrg        groff_mm_works=yes
11021c235774Smrg    else
11031c235774Smrg        groff_mm_works=no
11041c235774Smrg    fi
11051c235774Smrg    AC_MSG_RESULT([$groff_mm_works])
11061c235774Smrgfi
110719569120Smrg
11081c235774Smrg# We have groff, test for HTML dependencies, one command per package
11091c235774Smrgif test "x$have_groff" = x"yes"; then
11101c235774Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11111c235774Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11121c235774Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11131c235774Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11141c235774Smrg      have_groff_html=yes
11151c235774Smrg   else
11161c235774Smrg      have_groff_html=no
11171c235774Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11181c235774Smrg   fi
111919569120Smrgfi
112019569120Smrg
11211c235774Smrg# Set Automake conditionals for Makefiles
11221c235774SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11231c235774SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11241c235774SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11251c235774SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11261c235774Smrg]) # XORG_WITH_GROFF
112719569120Smrg
11281c235774Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11291c235774Smrg# ---------------------------------------
11301c235774Smrg# Minimum version: 1.6.0
11311c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11321c235774Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11331c235774Smrg#
11341c235774Smrg# Documentation tools are not always available on all platforms and sometimes
11351c235774Smrg# not at the appropriate level. This macro enables a module to test for the
11361c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11371c235774Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
11381c235774Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
11391c235774Smrg# --with-fop assumes 'auto'.
11401c235774Smrg#
11411c235774Smrg# Interface to module:
11421c235774Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11431c235774Smrg# FOP:	 	returns the path of the fop program found
11441c235774Smrg#		returns the path set by the user in the environment
11451c235774Smrg# --with-fop: 	'yes' user instructs the module to use fop
11461c235774Smrg#		'no' user instructs the module not to use fop
11471c235774Smrg#
11481c235774Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
11491c235774Smrg#
11501c235774SmrgAC_DEFUN([XORG_WITH_FOP],[
11511c235774SmrgAC_ARG_VAR([FOP], [Path to fop command])
11521c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
11531c235774SmrgAC_ARG_WITH(fop,
11541c235774Smrg	AS_HELP_STRING([--with-fop],
11551c235774Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11561c235774Smrg	   [use_fop=$withval], [use_fop=]_defopt)
11571c235774Smrgm4_undefine([_defopt])
115819569120Smrg
11591c235774Smrgif test "x$use_fop" = x"auto"; then
11601c235774Smrg   AC_PATH_PROG([FOP], [fop])
11611c235774Smrg   if test "x$FOP" = "x"; then
11621c235774Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11631c235774Smrg	have_fop=no
11641c235774Smrg   else
11651c235774Smrg        have_fop=yes
11661c235774Smrg   fi
11671c235774Smrgelif test "x$use_fop" = x"yes" ; then
11681c235774Smrg   AC_PATH_PROG([FOP], [fop])
11691c235774Smrg   if test "x$FOP" = "x"; then
11701c235774Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11711c235774Smrg   fi
11721c235774Smrg   have_fop=yes
11731c235774Smrgelif test "x$use_fop" = x"no" ; then
11741c235774Smrg   if test "x$FOP" != "x"; then
11751c235774Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11761c235774Smrg   fi
11771c235774Smrg   have_fop=no
117819569120Smrgelse
11791c235774Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11801c235774Smrgfi
1181a966c04fSmrg
11821c235774Smrg# Test for a minimum version of fop, if provided.
11831c235774Smrgm4_ifval([$1],
11841c235774Smrg[if test "$have_fop" = yes; then
11851c235774Smrg    # scrape the fop version
11861c235774Smrg    AC_MSG_CHECKING([for fop minimum version])
11871c235774Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11881c235774Smrg    AC_MSG_RESULT([$fop_version])
11891c235774Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
11901c235774Smrg        [if test "x$use_fop" = xauto; then
11911c235774Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11921c235774Smrg            have_fop=no
11931c235774Smrg        else
11941c235774Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11951c235774Smrg        fi])
11961c235774Smrgfi])
11971c235774SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11981c235774Smrg]) # XORG_WITH_FOP
1199a966c04fSmrg
12001c235774Smrg# XORG_WITH_M4([MIN-VERSION])
12011c235774Smrg# ---------------------------
12021c235774Smrg# Minimum version: 1.19.0
12031c235774Smrg#
12041c235774Smrg# This macro attempts to locate an m4 macro processor which supports
12051c235774Smrg# -I option and is only useful for modules relying on M4 in order to
12061c235774Smrg# expand macros in source code files.
12071c235774Smrg#
12081c235774Smrg# Interface to module:
12091c235774Smrg# M4:	 	returns the path of the m4 program found
12101c235774Smrg#		returns the path set by the user in the environment
12111c235774Smrg#
12121c235774SmrgAC_DEFUN([XORG_WITH_M4], [
12131c235774SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12141c235774Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12151c235774Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12161c235774Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12171c235774Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12181c235774Smrg   [$PATH:/usr/gnu/bin])])
12196e7d3316Smrg
12201c235774SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12211c235774Smrg]) # XORG_WITH_M4
12226e7d3316Smrg
12231c235774Smrg# XORG_WITH_PS2PDF([DEFAULT])
12241c235774Smrg# ----------------
12251c235774Smrg# Minimum version: 1.6.0
12261c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12271c235774Smrg#
12281c235774Smrg# Documentation tools are not always available on all platforms and sometimes
12291c235774Smrg# not at the appropriate level. This macro enables a module to test for the
12301c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12311c235774Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12321c235774Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12331c235774Smrg# --with-ps2pdf assumes 'auto'.
12341c235774Smrg#
12351c235774Smrg# Interface to module:
12361c235774Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12371c235774Smrg# PS2PDF:	returns the path of the ps2pdf program found
12381c235774Smrg#		returns the path set by the user in the environment
12391c235774Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12401c235774Smrg#		 'no' user instructs the module not to use ps2pdf
12411c235774Smrg#
12421c235774Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12431c235774Smrg#
12441c235774SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12451c235774SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12461c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
12471c235774SmrgAC_ARG_WITH(ps2pdf,
12481c235774Smrg	AS_HELP_STRING([--with-ps2pdf],
12491c235774Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12501c235774Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12511c235774Smrgm4_undefine([_defopt])
12526e7d3316Smrg
12531c235774Smrgif test "x$use_ps2pdf" = x"auto"; then
12541c235774Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12551c235774Smrg   if test "x$PS2PDF" = "x"; then
12561c235774Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12571c235774Smrg	have_ps2pdf=no
12581c235774Smrg   else
12591c235774Smrg        have_ps2pdf=yes
12601c235774Smrg   fi
12611c235774Smrgelif test "x$use_ps2pdf" = x"yes" ; then
12621c235774Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12631c235774Smrg   if test "x$PS2PDF" = "x"; then
12641c235774Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12651c235774Smrg   fi
12661c235774Smrg   have_ps2pdf=yes
12671c235774Smrgelif test "x$use_ps2pdf" = x"no" ; then
12681c235774Smrg   if test "x$PS2PDF" != "x"; then
12691c235774Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12701c235774Smrg   fi
12711c235774Smrg   have_ps2pdf=no
127219569120Smrgelse
12731c235774Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12741c235774Smrgfi
12751c235774SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12761c235774Smrg]) # XORG_WITH_PS2PDF
12776e7d3316Smrg
12781c235774Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
12791c235774Smrg# ----------------
12801c235774Smrg# Minimum version: 1.6.0
12811c235774Smrg#
12821c235774Smrg# Documentation tools are not always available on all platforms and sometimes
12831c235774Smrg# not at the appropriate level. This macro enables a builder to skip all
12841c235774Smrg# documentation targets except traditional man pages.
12851c235774Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12861c235774Smrg# maximum flexibilty in controlling documentation building.
12871c235774Smrg# Refer to:
12881c235774Smrg# XORG_WITH_XMLTO         --with-xmlto
12891c235774Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12901c235774Smrg# XORG_WITH_DOXYGEN       --with-doxygen
12911c235774Smrg# XORG_WITH_FOP           --with-fop
12921c235774Smrg# XORG_WITH_GROFF         --with-groff
12931c235774Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
12941c235774Smrg#
12951c235774Smrg# Interface to module:
12961c235774Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12971c235774Smrg# --enable-docs: 'yes' user instructs the module to generate docs
12981c235774Smrg#		 'no' user instructs the module not to generate docs
12991c235774Smrg# parm1:	specify the default value, yes or no.
13001c235774Smrg#
13011c235774SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13021c235774Smrgm4_define([docs_default], m4_default([$1], [yes]))
13031c235774SmrgAC_ARG_ENABLE(docs,
13041c235774Smrg	AS_HELP_STRING([--enable-docs],
13051c235774Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13061c235774Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13071c235774Smrgm4_undefine([docs_default])
13081c235774SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13091c235774SmrgAC_MSG_CHECKING([whether to build documentation])
13101c235774SmrgAC_MSG_RESULT([$build_docs])
13111c235774Smrg]) # XORG_ENABLE_DOCS
13126e7d3316Smrg
13131c235774Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13141c235774Smrg# ----------------
13151c235774Smrg# Minimum version: 1.6.0
13161c235774Smrg#
13171c235774Smrg# This macro enables a builder to skip all developer documentation.
13181c235774Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13191c235774Smrg# maximum flexibilty in controlling documentation building.
13201c235774Smrg# Refer to:
13211c235774Smrg# XORG_WITH_XMLTO         --with-xmlto
13221c235774Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13231c235774Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13241c235774Smrg# XORG_WITH_FOP           --with-fop
13251c235774Smrg# XORG_WITH_GROFF         --with-groff
13261c235774Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13271c235774Smrg#
13281c235774Smrg# Interface to module:
13291c235774Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13301c235774Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13311c235774Smrg#			'no' user instructs the module not to generate developer docs
13321c235774Smrg# parm1:		specify the default value, yes or no.
13331c235774Smrg#
13341c235774SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13351c235774Smrgm4_define([devel_default], m4_default([$1], [yes]))
13361c235774SmrgAC_ARG_ENABLE(devel-docs,
13371c235774Smrg	AS_HELP_STRING([--enable-devel-docs],
13381c235774Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13391c235774Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13401c235774Smrgm4_undefine([devel_default])
13411c235774SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13421c235774SmrgAC_MSG_CHECKING([whether to build developer documentation])
13431c235774SmrgAC_MSG_RESULT([$build_devel_docs])
13441c235774Smrg]) # XORG_ENABLE_DEVEL_DOCS
134519569120Smrg
13461c235774Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
13471c235774Smrg# ----------------
13481c235774Smrg# Minimum version: 1.6.0
13491c235774Smrg#
13501c235774Smrg# This macro enables a builder to skip all functional specification targets.
13511c235774Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13521c235774Smrg# maximum flexibilty in controlling documentation building.
13531c235774Smrg# Refer to:
13541c235774Smrg# XORG_WITH_XMLTO         --with-xmlto
13551c235774Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13561c235774Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13571c235774Smrg# XORG_WITH_FOP           --with-fop
13581c235774Smrg# XORG_WITH_GROFF         --with-groff
13591c235774Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13601c235774Smrg#
13611c235774Smrg# Interface to module:
13621c235774Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13631c235774Smrg# --enable-specs:	'yes' user instructs the module to generate specs
13641c235774Smrg#			'no' user instructs the module not to generate specs
13651c235774Smrg# parm1:		specify the default value, yes or no.
13661c235774Smrg#
13671c235774SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13681c235774Smrgm4_define([spec_default], m4_default([$1], [yes]))
13691c235774SmrgAC_ARG_ENABLE(specs,
13701c235774Smrg	AS_HELP_STRING([--enable-specs],
13711c235774Smrg	   [Enable building the specs (default: ]spec_default[)]),
13721c235774Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
13731c235774Smrgm4_undefine([spec_default])
13741c235774SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13751c235774SmrgAC_MSG_CHECKING([whether to build functional specifications])
13761c235774SmrgAC_MSG_RESULT([$build_specs])
13771c235774Smrg]) # XORG_ENABLE_SPECS
137819569120Smrg
13791c235774Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13801c235774Smrg# ----------------------------------------------
13811c235774Smrg# Minimum version: 1.13.0
13821c235774Smrg#
13831c235774Smrg# This macro enables a builder to enable/disable unit testing
13841c235774Smrg# It makes no assumption about the test cases implementation
13851c235774Smrg# Test cases may or may not use Automake "Support for test suites"
13861c235774Smrg# They may or may not use the software utility library GLib
13871c235774Smrg#
13881c235774Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13891c235774Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13901c235774Smrg# The variable enable_unit_tests is used by other macros in this file.
13911c235774Smrg#
13921c235774Smrg# Interface to module:
13931c235774Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13941c235774Smrg# enable_unit_tests:    used in configure.ac for additional configuration
13951c235774Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13961c235774Smrg#			'no' user instructs the module not to build tests
13971c235774Smrg# parm1:		specify the default value, yes or no.
13981c235774Smrg#
13991c235774SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14001c235774SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14011c235774SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14021c235774SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14031c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
14041c235774SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14051c235774Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14061c235774Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14071c235774Smrgm4_undefine([_defopt])
14081c235774SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14091c235774SmrgAC_MSG_CHECKING([whether to build unit test cases])
14101c235774SmrgAC_MSG_RESULT([$enable_unit_tests])
14111c235774Smrg]) # XORG_ENABLE_UNIT_TESTS
141219569120Smrg
14131c235774Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14141c235774Smrg# ------------------------------------------------------
14151c235774Smrg# Minimum version: 1.17.0
14161c235774Smrg#
14171c235774Smrg# This macro enables a builder to enable/disable integration testing
14181c235774Smrg# It makes no assumption about the test cases' implementation
14191c235774Smrg# Test cases may or may not use Automake "Support for test suites"
14201c235774Smrg#
14211c235774Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14221c235774Smrg# usually requires less dependencies and may be built and run under less
14231c235774Smrg# stringent environments than integration tests.
14241c235774Smrg#
14251c235774Smrg# Interface to module:
14261c235774Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14271c235774Smrg# enable_integration_tests:   used in configure.ac for additional configuration
14281c235774Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14291c235774Smrg#                             'no' user instructs the module not to build tests
14301c235774Smrg# parm1:                      specify the default value, yes or no.
14311c235774Smrg#
14321c235774SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14331c235774SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14341c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
14351c235774SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14361c235774Smrg	[Enable building integration test cases (default: ]_defopt[)]),
14371c235774Smrg	[enable_integration_tests=$enableval],
14381c235774Smrg	[enable_integration_tests=]_defopt)
14391c235774Smrgm4_undefine([_defopt])
14401c235774SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14411c235774Smrg	[test "x$enable_integration_tests" != xno])
14421c235774SmrgAC_MSG_CHECKING([whether to build unit test cases])
14431c235774SmrgAC_MSG_RESULT([$enable_integration_tests])
14441c235774Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
144519569120Smrg
14461c235774Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14471c235774Smrg# ----------------------------------------
14481c235774Smrg# Minimum version: 1.13.0
14491c235774Smrg#
14501c235774Smrg# GLib is a library which provides advanced data structures and functions.
14511c235774Smrg# This macro enables a module to test for the presence of Glib.
14521c235774Smrg#
14531c235774Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14541c235774Smrg# Otherwise the value of $enable_unit_tests is blank.
14551c235774Smrg#
14561c235774Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14571c235774Smrg# test support usually requires less dependencies and may be built and run under
14581c235774Smrg# less stringent environments than integration tests.
14591c235774Smrg#
14601c235774Smrg# Interface to module:
14611c235774Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
14621c235774Smrg# with_glib: used in configure.ac to know if GLib has been found
14631c235774Smrg# --with-glib:	'yes' user instructs the module to use glib
14641c235774Smrg#		'no' user instructs the module not to use glib
14651c235774Smrg#
14661c235774SmrgAC_DEFUN([XORG_WITH_GLIB],[
14671c235774SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14681c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
14691c235774SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14701c235774Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14711c235774Smrg	[with_glib=$withval], [with_glib=]_defopt)
14721c235774Smrgm4_undefine([_defopt])
147319569120Smrg
14741c235774Smrghave_glib=no
14751c235774Smrg# Do not probe GLib if user explicitly disabled unit testing
14761c235774Smrgif test "x$enable_unit_tests" != x"no"; then
14771c235774Smrg  # Do not probe GLib if user explicitly disabled it
14781c235774Smrg  if test "x$with_glib" != x"no"; then
14791c235774Smrg    m4_ifval(
14801c235774Smrg      [$1],
14811c235774Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14821c235774Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14831c235774Smrg    )
14841c235774Smrg  fi
14851c235774Smrgfi
148619569120Smrg
14871c235774Smrg# Not having GLib when unit testing has been explicitly requested is an error
14881c235774Smrgif test "x$enable_unit_tests" = x"yes"; then
14891c235774Smrg  if test "x$have_glib" = x"no"; then
14901c235774Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14911c235774Smrg  fi
14921c235774Smrgfi
14936e7d3316Smrg
14941c235774Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
14951c235774Smrgif test "x$enable_unit_tests" = x"no"; then
14961c235774Smrg  if test "x$with_glib" = x"yes"; then
14971c235774Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14981c235774Smrg  fi
14991c235774Smrgfi
15006e7d3316Smrg
15011c235774Smrg# Not having GLib when it has been explicitly requested is an error
15021c235774Smrgif test "x$with_glib" = x"yes"; then
15031c235774Smrg  if test "x$have_glib" = x"no"; then
15041c235774Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15051c235774Smrg  fi
15061c235774Smrgfi
15076e7d3316Smrg
15081c235774SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15091c235774Smrg]) # XORG_WITH_GLIB
15106e7d3316Smrg
15111c235774Smrg# XORG_LD_WRAP([required|optional])
15121c235774Smrg# ---------------------------------
15131c235774Smrg# Minimum version: 1.13.0
15149f00f3a1Smrg#
15151c235774Smrg# Check if linker supports -wrap, passed via compiler flags
15169f00f3a1Smrg#
15171c235774Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15181c235774Smrg# Otherwise the value of $enable_unit_tests is blank.
15199f00f3a1Smrg#
15201c235774Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15211c235774Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15221c235774Smrg# available, an argument of "optional" allows use when some unit tests require
15231c235774Smrg# ld -wrap and others do not.
15249f00f3a1Smrg#
15251c235774SmrgAC_DEFUN([XORG_LD_WRAP],[
15261c235774SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15271c235774Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15281c235774Smrg                      void __wrap_exit(int status) { return; }],
15291c235774Smrg                     [exit(0);])])
15301c235774Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
15311c235774Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15321c235774Smrg  if test "x$have_ld_wrap" = x"no"; then
15331c235774Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15341c235774Smrg  fi
1535ac92798bSmrgfi
15361c235774SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15371c235774Smrg#
15381c235774Smrg]) # XORG_LD_WRAP
15399f00f3a1Smrg
15401c235774Smrg# XORG_CHECK_LINKER_FLAGS
15411c235774Smrg# -----------------------
15421c235774Smrg# SYNOPSIS
15431c235774Smrg#
15441c235774Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15451c235774Smrg#
15461c235774Smrg# DESCRIPTION
15471c235774Smrg#
15481c235774Smrg#   Check whether the given linker FLAGS work with the current language's
15491c235774Smrg#   linker, or whether they give an error.
15501c235774Smrg#
15511c235774Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15521c235774Smrg#   success/failure.
15531c235774Smrg#
15541c235774Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
15551c235774Smrg#
15561c235774Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15571c235774Smrg#
15581c235774Smrg# LICENSE
15591c235774Smrg#
15601c235774Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15611c235774Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15621c235774Smrg#   Copyright (c) 2009 Matteo Frigo
15631c235774Smrg#
15641c235774Smrg#   This program is free software: you can redistribute it and/or modify it
15651c235774Smrg#   under the terms of the GNU General Public License as published by the
15661c235774Smrg#   Free Software Foundation, either version 3 of the License, or (at your
15671c235774Smrg#   option) any later version.
15681c235774Smrg#
15691c235774Smrg#   This program is distributed in the hope that it will be useful, but
15701c235774Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15711c235774Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15721c235774Smrg#   Public License for more details.
15731c235774Smrg#
15741c235774Smrg#   You should have received a copy of the GNU General Public License along
15751c235774Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15761c235774Smrg#
15771c235774Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
15781c235774Smrg#   gives unlimited permission to copy, distribute and modify the configure
15791c235774Smrg#   scripts that are the output of Autoconf when processing the Macro. You
15801c235774Smrg#   need not follow the terms of the GNU General Public License when using
15811c235774Smrg#   or distributing such scripts, even though portions of the text of the
15821c235774Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15831c235774Smrg#   all other use of the material that constitutes the Autoconf Macro.
15841c235774Smrg#
15851c235774Smrg#   This special exception to the GPL applies to versions of the Autoconf
15861c235774Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
15871c235774Smrg#   modified version of the Autoconf Macro, you may extend this special
15881c235774Smrg#   exception to the GPL to apply to your modified version as well.#
15891c235774SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15901c235774Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
15911c235774Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15921c235774SmrgAS_LITERAL_IF([$1],
15931c235774Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15941c235774Smrg      ax_save_FLAGS=$LDFLAGS
15951c235774Smrg      LDFLAGS="$1"
15961c235774Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15971c235774Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15981c235774Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15991c235774Smrg      LDFLAGS=$ax_save_FLAGS])],
16001c235774Smrg  [ax_save_FLAGS=$LDFLAGS
16011c235774Smrg   LDFLAGS="$1"
16021c235774Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16031c235774Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16041c235774Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16051c235774Smrg   LDFLAGS=$ax_save_FLAGS])
16061c235774Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16071c235774SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16081c235774Smrgif test "x$xorg_check_linker_flags" = xyes; then
16091c235774Smrg	m4_default([$2], :)
16109f00f3a1Smrgelse
16111c235774Smrg	m4_default([$3], :)
1612ac92798bSmrgfi
16131c235774Smrg]) # XORG_CHECK_LINKER_FLAGS
1614ac92798bSmrg
16151c235774Smrg# XORG_MEMORY_CHECK_FLAGS
161619569120Smrg# -----------------------
16171c235774Smrg# Minimum version: 1.16.0
16189f00f3a1Smrg#
16191c235774Smrg# This macro attempts to find appropriate memory checking functionality
16201c235774Smrg# for various platforms which unit testing code may use to catch various
16211c235774Smrg# forms of memory allocation and access errors in testing.
16221c235774Smrg#
16231c235774Smrg# Interface to module:
16241c235774Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16251c235774Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16261c235774Smrg#
16271c235774Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16281c235774Smrg#
16291c235774SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16306e7d3316Smrg
163119569120SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16321c235774SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16331c235774Smrg           [Environment variables to enable memory checking in tests])
16346e7d3316Smrg
16351c235774Smrg# Check for different types of support on different platforms
16369f00f3a1Smrgcase $host_os in
163719569120Smrg    solaris*)
16381c235774Smrg        AC_CHECK_LIB([umem], [umem_alloc],
16391c235774Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16401c235774Smrg        ;;
16411c235774Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16421c235774Smrg        # both directly and inverted, so should not be 0 or 255.
16431c235774Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
16441c235774Smrg        ;;
16451c235774Smrg    darwin*)
16461c235774Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16471c235774Smrg        ;;
16481c235774Smrg    *bsd*)
16491c235774Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
165019569120Smrg        ;;
16519f00f3a1Smrgesac
16526e7d3316Smrg
16531c235774Smrg# User supplied flags override default flags
16541c235774Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16551c235774Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
165619569120Smrgfi
16576e7d3316Smrg
16581c235774SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16591c235774Smrg]) # XORG_WITH_LINT
16606e7d3316Smrg
16611c235774Smrg# XORG_CHECK_MALLOC_ZERO
16621c235774Smrg# ----------------------
16631c235774Smrg# Minimum version: 1.0.0
16641c235774Smrg#
16651c235774Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16661c235774Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16671c235774Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16681c235774SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16691c235774SmrgAC_ARG_ENABLE(malloc0returnsnull,
16701c235774Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16711c235774Smrg		       [malloc(0) returns NULL (default: auto)]),
16721c235774Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16731c235774Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16746e7d3316Smrg
16751c235774SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16761c235774Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16771c235774SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16781c235774Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16791c235774Smrg#include <stdlib.h>
16801c235774Smrg],[
16811c235774Smrg    char *m0, *r0, *c0, *p;
16821c235774Smrg    m0 = malloc(0);
16831c235774Smrg    p = malloc(10);
16841c235774Smrg    r0 = realloc(p,0);
16851c235774Smrg    c0 = calloc(0,10);
16861c235774Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16871c235774Smrg])],
16881c235774Smrg		[xorg_cv_malloc0_returns_null=yes],
16891c235774Smrg		[xorg_cv_malloc0_returns_null=no])])
16901c235774SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
169197cf2ee2Smrgfi
16921c235774SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16936e7d3316Smrg
16941c235774Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16951c235774Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16961c235774Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16971c235774Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
169819569120Smrgelse
16991c235774Smrg	MALLOC_ZERO_CFLAGS=""
17001c235774Smrg	XMALLOC_ZERO_CFLAGS=""
17011c235774Smrg	XTMALLOC_ZERO_CFLAGS=""
170219569120Smrgfi
17036e7d3316Smrg
17041c235774SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17051c235774SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17061c235774SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17071c235774Smrg]) # XORG_CHECK_MALLOC_ZERO
17086e7d3316Smrg
17091c235774Smrg# XORG_WITH_LINT()
17101c235774Smrg# ----------------
17111c235774Smrg# Minimum version: 1.1.0
171219569120Smrg#
17131c235774Smrg# This macro enables the use of a tool that flags some suspicious and
17141c235774Smrg# non-portable constructs (likely to be bugs) in C language source code.
17151c235774Smrg# It will attempt to locate the tool and use appropriate options.
17161c235774Smrg# There are various lint type tools on different platforms.
17171c235774Smrg#
17181c235774Smrg# Interface to module:
17191c235774Smrg# LINT:		returns the path to the tool found on the platform
17201c235774Smrg#		or the value set to LINT on the configure cmd line
17211c235774Smrg#		also an Automake conditional
17221c235774Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17231c235774Smrg#
17241c235774Smrg# --with-lint:	'yes' user instructs the module to use lint
17251c235774Smrg#		'no' user instructs the module not to use lint (default)
17261c235774Smrg#
17271c235774Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17281c235774Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17291c235774Smrg#
17301c235774SmrgAC_DEFUN([XORG_WITH_LINT],[
17316e7d3316Smrg
17321c235774SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17331c235774SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17341c235774SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17351c235774Smrg		[Use a lint-style source code checker (default: disabled)])],
17361c235774Smrg		[use_lint=$withval], [use_lint=no])
17376e7d3316Smrg
17381c235774Smrg# Obtain platform specific info like program name and options
17391c235774Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17401c235774Smrgcase $host_os in
17411c235774Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17421c235774Smrg	lint_name=splint
17431c235774Smrg	lint_options="-badflag"
17441c235774Smrg	;;
17451c235774Smrg  *freebsd* | *netbsd*)
17461c235774Smrg	lint_name=lint
17471c235774Smrg	lint_options="-u -b"
17481c235774Smrg	;;
17491c235774Smrg  *solaris*)
17501c235774Smrg	lint_name=lint
17511c235774Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17521c235774Smrg	;;
17531c235774Smrgesac
17546e7d3316Smrg
17551c235774Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17561c235774Smrgif test "x$use_lint" = x"yes" ; then
17571c235774Smrg   AC_PATH_PROG([LINT], [$lint_name])
17581c235774Smrg   if test "x$LINT" = "x"; then
17591c235774Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17601c235774Smrg   fi
17611c235774Smrgelif test "x$use_lint" = x"no" ; then
17621c235774Smrg   if test "x$LINT" != "x"; then
17631c235774Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17641c235774Smrg   fi
176519569120Smrgelse
17661c235774Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
176719569120Smrgfi
17686e7d3316Smrg
17691c235774Smrg# User supplied flags override default flags
17701c235774Smrgif test "x$LINT_FLAGS" != "x"; then
17711c235774Smrg   lint_options=$LINT_FLAGS
17721c235774Smrgfi
17736e7d3316Smrg
17741c235774SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17751c235774SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17769f00f3a1Smrg
17771c235774Smrg]) # XORG_WITH_LINT
17786e7d3316Smrg
17791c235774Smrg# XORG_LINT_LIBRARY(LIBNAME)
17801c235774Smrg# --------------------------
17811c235774Smrg# Minimum version: 1.1.0
178219569120Smrg#
17831c235774Smrg# Sets up flags for building lint libraries for checking programs that call
17841c235774Smrg# functions in the library.
17851c235774Smrg#
17861c235774Smrg# Interface to module:
17871c235774Smrg# LINTLIB		- Automake variable with the name of lint library file to make
17881c235774Smrg# MAKE_LINT_LIB		- Automake conditional
17891c235774Smrg#
17901c235774Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17911c235774Smrg#			  - 'no' user instructs the module not to create a lint library (default)
17926e7d3316Smrg
17931c235774SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17941c235774SmrgAC_REQUIRE([XORG_WITH_LINT])
17951c235774SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17961c235774Smrg	[Create lint library (default: disabled)])],
17971c235774Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17986e7d3316Smrg
17991c235774Smrgif test "x$make_lint_lib" = x"yes" ; then
18001c235774Smrg   LINTLIB=llib-l$1.ln
18011c235774Smrg   if test "x$LINT" = "x"; then
18021c235774Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18031c235774Smrg   fi
18041c235774Smrgelif test "x$make_lint_lib" != x"no" ; then
18051c235774Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
180697cf2ee2Smrgfi
180719569120Smrg
18081c235774SmrgAC_SUBST(LINTLIB)
18091c235774SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18106e7d3316Smrg
18111c235774Smrg]) # XORG_LINT_LIBRARY
1812a966c04fSmrg
18131c235774Smrg# XORG_COMPILER_BRAND
18141c235774Smrg# -------------------
18151c235774Smrg# Minimum version: 1.14.0
18169f00f3a1Smrg#
18171c235774Smrg# Checks for various brands of compilers and sets flags as appropriate:
18181c235774Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18191c235774Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18201c235774Smrg#   clang compiler - sets CLANGCC to "yes"
18211c235774Smrg#   Intel compiler - sets INTELCC to "yes"
18221c235774Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18239f00f3a1Smrg#
18241c235774SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18251c235774SmrgAC_LANG_CASE(
18261c235774Smrg	[C], [
18271c235774Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18281c235774Smrg	],
18291c235774Smrg	[C++], [
18301c235774Smrg		AC_REQUIRE([AC_PROG_CXX])
18311c235774Smrg	]
18321c235774Smrg)
18331c235774SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18341c235774SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18351c235774SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18361c235774Smrg]) # XORG_COMPILER_BRAND
18371c235774Smrg
18381c235774Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18391c235774Smrg# ---------------
18401c235774Smrg# Minimum version: 1.16.0
18419f00f3a1Smrg#
18421c235774Smrg# Test if the compiler works when passed the given flag as a command line argument.
18431c235774Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18441c235774Smrg# next flag in the list until there are no more options.
18459f00f3a1Smrg#
18461c235774Smrg# Note that this does not guarantee that the compiler supports the flag as some
18471c235774Smrg# compilers will simply ignore arguments that they do not understand, but we do
18481c235774Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18491c235774Smrg# -Werror=unused-command-line-argument
18509f00f3a1Smrg#
18511c235774SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18521c235774Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18531c235774Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854a966c04fSmrg
18551c235774SmrgAC_LANG_COMPILER_REQUIRE
18561c235774Smrg
18571c235774SmrgAC_LANG_CASE(
18581c235774Smrg	[C], [
18591c235774Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18601c235774Smrg		define([PREFIX], [C])
18611c235774Smrg		define([CACHE_PREFIX], [cc])
18621c235774Smrg		define([COMPILER], [$CC])
18631c235774Smrg	],
18641c235774Smrg	[C++], [
18651c235774Smrg		define([PREFIX], [CXX])
18661c235774Smrg		define([CACHE_PREFIX], [cxx])
18671c235774Smrg		define([COMPILER], [$CXX])
18681c235774Smrg	]
18691c235774Smrg)
18701c235774Smrg
18711c235774Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18721c235774Smrg
18731c235774Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18741c235774Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18751c235774Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18761c235774Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18771c235774Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18781c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18791c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18801c235774Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18811c235774Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18821c235774Smrgfi
18831c235774Smrg
18841c235774Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18851c235774Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18861c235774Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18871c235774Smrg	fi
18881c235774Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18891c235774Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18901c235774Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18911c235774Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18921c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18931c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18941c235774Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18951c235774Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
189619569120Smrgfi
1897a966c04fSmrg
18981c235774Smrgfound="no"
18991c235774Smrgm4_foreach([flag], m4_cdr($@), [
19001c235774Smrg	if test $found = "no" ; then
19011c235774Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19021c235774Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19031c235774Smrg		fi
19046e7d3316Smrg
19051c235774Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19061c235774Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19071c235774Smrg		fi
1908a966c04fSmrg
19091c235774Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19101c235774Smrg
19111c235774Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19121c235774Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19131c235774Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19141c235774Smrg		AC_CACHE_VAL($cacheid,
19151c235774Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19161c235774Smrg					     [eval $cacheid=yes],
19171c235774Smrg					     [eval $cacheid=no])])
19181c235774Smrg
19191c235774Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19201c235774Smrg
19211c235774Smrg		eval supported=\$$cacheid
19221c235774Smrg		AC_MSG_RESULT([$supported])
19231c235774Smrg		if test "$supported" = "yes" ; then
19241c235774Smrg			$1="$$1 ]flag["
19251c235774Smrg			found="yes"
19261c235774Smrg		fi
19271c235774Smrg	fi
19281c235774Smrg])
19291c235774Smrg]) # XORG_TESTSET_CFLAG
19301c235774Smrg
19311c235774Smrg# XORG_COMPILER_FLAGS
19321c235774Smrg# ---------------
19331c235774Smrg# Minimum version: 1.16.0
19349f00f3a1Smrg#
19351c235774Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19361c235774Smrg# arguments supported by the selected compiler which do NOT alter the generated
19371c235774Smrg# code.  These arguments will cause the compiler to print various warnings
19381c235774Smrg# during compilation AND turn a conservative set of warnings into errors.
19399f00f3a1Smrg#
19401c235774Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19411c235774Smrg# future versions of util-macros as options are added to new compilers.
19429f00f3a1Smrg#
19431c235774SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19441c235774SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945a966c04fSmrg
19461c235774SmrgAC_ARG_ENABLE(selective-werror,
19471c235774Smrg              AS_HELP_STRING([--disable-selective-werror],
19481c235774Smrg                             [Turn off selective compiler errors. (default: enabled)]),
19491c235774Smrg              [SELECTIVE_WERROR=$enableval],
19501c235774Smrg              [SELECTIVE_WERROR=yes])
19511c235774Smrg
19521c235774SmrgAC_LANG_CASE(
19531c235774Smrg        [C], [
19541c235774Smrg                define([PREFIX], [C])
19551c235774Smrg        ],
19561c235774Smrg        [C++], [
19571c235774Smrg                define([PREFIX], [CXX])
19581c235774Smrg        ]
19591c235774Smrg)
19601c235774Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19611c235774Smrgif test "x$SUNCC" = "xyes"; then
19621c235774Smrg    [BASE_]PREFIX[FLAGS]="-v"
196319569120Smrgelse
19641c235774Smrg    [BASE_]PREFIX[FLAGS]=""
196519569120Smrgfi
1966edce3322Smrg
19671c235774Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19681c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19691c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19701c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19711c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19726e7d3316Smrg
19731c235774SmrgAC_LANG_CASE(
19741c235774Smrg	[C], [
19751c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19761c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19771c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19781c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19791c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19801c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19811c235774Smrg	]
19821c235774Smrg)
1983a966c04fSmrg
19841c235774Smrg# This chunk adds additional warnings that could catch undesired effects.
19851c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19861c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19871c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19881c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19891c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19901c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19911c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19921c235774Smrg
19931c235774Smrg# These are currently disabled because they are noisy.  They will be enabled
19941c235774Smrg# in the future once the codebase is sufficiently modernized to silence
19951c235774Smrg# them.  For now, I don't want them to drown out the other warnings.
19961c235774Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19971c235774Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19981c235774Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19991c235774Smrg
20001c235774Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20011c235774Smrg# when there are problems that should be fixed.
20021c235774Smrg
20031c235774Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20041c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20051c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20061c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20071c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20081c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20091c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20101c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20111c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20121c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20131c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20141c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20151c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20161c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
201719569120Smrgelse
20181c235774SmrgAC_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])
20191c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20201c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20211c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20221c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20231c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20241c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20251c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20261c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20271c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20281c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20291c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20301c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20311c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
203219569120Smrgfi
2033a966c04fSmrg
20341c235774SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20351c235774Smrg]) # XORG_COMPILER_FLAGS
2036a966c04fSmrg
20371c235774Smrg# XORG_CWARNFLAGS
20381c235774Smrg# ---------------
20391c235774Smrg# Minimum version: 1.2.0
20401c235774Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20419f00f3a1Smrg#
20421c235774Smrg# Defines CWARNFLAGS to enable C compiler warnings.
20439f00f3a1Smrg#
20441c235774Smrg# This function is deprecated because it defines -fno-strict-aliasing
20451c235774Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20461c235774Smrg# is needed, then it should be added explicitly in the module when
20471c235774Smrg# it is updated to use BASE_CFLAGS.
20489f00f3a1Smrg#
20491c235774SmrgAC_DEFUN([XORG_CWARNFLAGS], [
20501c235774SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20511c235774SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20521c235774SmrgAC_LANG_CASE(
20531c235774Smrg	[C], [
20541c235774Smrg		CWARNFLAGS="$BASE_CFLAGS"
20551c235774Smrg		if  test "x$GCC" = xyes ; then
20561c235774Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20571c235774Smrg		fi
20581c235774Smrg		AC_SUBST(CWARNFLAGS)
20591c235774Smrg	]
20601c235774Smrg)
20611c235774Smrg]) # XORG_CWARNFLAGS
20621c235774Smrg
20631c235774Smrg# XORG_STRICT_OPTION
20641c235774Smrg# -----------------------
20651c235774Smrg# Minimum version: 1.3.0
20669f00f3a1Smrg#
20671c235774Smrg# Add configure option to enable strict compilation flags, such as treating
20681c235774Smrg# warnings as fatal errors.
20691c235774Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20701c235774Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20711c235774Smrg#
20721c235774Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20731c235774Smrg# when strict compilation is unconditionally desired.
20741c235774SmrgAC_DEFUN([XORG_STRICT_OPTION], [
20751c235774SmrgAC_REQUIRE([XORG_CWARNFLAGS])
20761c235774SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077a966c04fSmrg
20781c235774SmrgAC_ARG_ENABLE(strict-compilation,
20791c235774Smrg			  AS_HELP_STRING([--enable-strict-compilation],
20801c235774Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20811c235774Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20821c235774Smrg
20831c235774SmrgAC_LANG_CASE(
20841c235774Smrg        [C], [
20851c235774Smrg                define([PREFIX], [C])
20861c235774Smrg        ],
20871c235774Smrg        [C++], [
20881c235774Smrg                define([PREFIX], [CXX])
20891c235774Smrg        ]
20901c235774Smrg)
20911c235774Smrg
20921c235774Smrg[STRICT_]PREFIX[FLAGS]=""
20931c235774SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20941c235774SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
20951c235774Smrg
20961c235774Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20971c235774Smrg# activate it with -Werror, so we add it here explicitly.
20981c235774SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20991c235774Smrg
21001c235774Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21011c235774Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21021c235774Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
210319569120Smrgfi
21041c235774SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21051c235774SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21061c235774SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21071c235774Smrg]) # XORG_STRICT_OPTION
2108a966c04fSmrg
21091c235774Smrg# XORG_DEFAULT_OPTIONS
21101c235774Smrg# --------------------
21111c235774Smrg# Minimum version: 1.3.0
211219569120Smrg#
21131c235774Smrg# Defines default options for X.Org modules.
211419569120Smrg#
21151c235774SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21161c235774SmrgAC_REQUIRE([AC_PROG_INSTALL])
21171c235774SmrgXORG_COMPILER_FLAGS
21181c235774SmrgXORG_CWARNFLAGS
21191c235774SmrgXORG_STRICT_OPTION
21201c235774SmrgXORG_RELEASE_VERSION
21211c235774SmrgXORG_CHANGELOG
21221c235774SmrgXORG_INSTALL
21231c235774SmrgXORG_MANPAGE_SECTIONS
21241c235774Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21251c235774Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21261c235774Smrg]) # XORG_DEFAULT_OPTIONS
21271c235774Smrg
21281c235774Smrg# XORG_INSTALL()
21291c235774Smrg# ----------------
21301c235774Smrg# Minimum version: 1.4.0
21319f00f3a1Smrg#
21321c235774Smrg# Defines the variable INSTALL_CMD as the command to copy
21331c235774Smrg# INSTALL from $prefix/share/util-macros.
213419569120Smrg#
21351c235774SmrgAC_DEFUN([XORG_INSTALL], [
21361c235774SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21371c235774Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21381c235774SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21391c235774Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21401c235774Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21411c235774Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21421c235774SmrgAC_SUBST([INSTALL_CMD])
21431c235774Smrg]) # XORG_INSTALL
21441c235774Smrgdnl Copyright 2005 Red Hat, Inc
21451c235774Smrgdnl
21461c235774Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21471c235774Smrgdnl documentation for any purpose is hereby granted without fee, provided that
21481c235774Smrgdnl the above copyright notice appear in all copies and that both that
21491c235774Smrgdnl copyright notice and this permission notice appear in supporting
21501c235774Smrgdnl documentation.
21511c235774Smrgdnl
21521c235774Smrgdnl The above copyright notice and this permission notice shall be included
21531c235774Smrgdnl in all copies or substantial portions of the Software.
21541c235774Smrgdnl
21551c235774Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21561c235774Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21571c235774Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21581c235774Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21591c235774Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21601c235774Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21611c235774Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
21621c235774Smrgdnl
21631c235774Smrgdnl Except as contained in this notice, the name of the copyright holders shall
21641c235774Smrgdnl not be used in advertising or otherwise to promote the sale, use or
21651c235774Smrgdnl other dealings in this Software without prior written authorization
21661c235774Smrgdnl from the copyright holders.
21671c235774Smrgdnl
2168a966c04fSmrg
21691c235774Smrg# XORG_RELEASE_VERSION
21701c235774Smrg# --------------------
21711c235774Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172a966c04fSmrg
21731c235774SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21741c235774Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21751c235774Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21761c235774Smrg		[Major version of this package])
21771c235774Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21781c235774Smrg	if test "x$PVM" = "x"; then
21791c235774Smrg		PVM="0"
21801c235774Smrg	fi
21811c235774Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21821c235774Smrg		[$PVM],
21831c235774Smrg		[Minor version of this package])
21841c235774Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21851c235774Smrg	if test "x$PVP" = "x"; then
21861c235774Smrg		PVP="0"
21871c235774Smrg	fi
21881c235774Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21891c235774Smrg		[$PVP],
21901c235774Smrg		[Patch version of this package])
21911c235774Smrg])
21926e7d3316Smrg
21931c235774Smrg# XORG_CHANGELOG()
219419569120Smrg# ----------------
21951c235774Smrg# Minimum version: 1.2.0
219619569120Smrg#
21971c235774Smrg# Defines the variable CHANGELOG_CMD as the command to generate
21981c235774Smrg# ChangeLog from git.
219919569120Smrg#
220019569120Smrg#
22011c235774SmrgAC_DEFUN([XORG_CHANGELOG], [
22021c235774SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22031c235774Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22041c235774Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22051c235774Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22061c235774SmrgAC_SUBST([CHANGELOG_CMD])
22071c235774Smrg]) # XORG_CHANGELOG
22081c235774Smrg
22091c235774Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
221019569120Smrg#
22111c235774Smrg# This file is free software; the Free Software Foundation
22121c235774Smrg# gives unlimited permission to copy and/or distribute it,
22131c235774Smrg# with or without modifications, as long as this notice is preserved.
22146e7d3316Smrg
22151c235774Smrg# AM_AUTOMAKE_VERSION(VERSION)
22161c235774Smrg# ----------------------------
22171c235774Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22181c235774Smrg# generated from the m4 files accompanying Automake X.Y.
22191c235774Smrg# (This private macro should not be called outside this file.)
22201c235774SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22211c235774Smrg[am__api_version='1.15'
22221c235774Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22231c235774Smrgdnl require some minimum version.  Point them to the right macro.
22241c235774Smrgm4_if([$1], [1.15], [],
22251c235774Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22261c235774Smrg])
222797cf2ee2Smrg
22281c235774Smrg# _AM_AUTOCONF_VERSION(VERSION)
22291c235774Smrg# -----------------------------
22301c235774Smrg# aclocal traces this macro to find the Autoconf version.
22311c235774Smrg# This is a private macro too.  Using m4_define simplifies
22321c235774Smrg# the logic in aclocal, which can simply ignore this definition.
22331c235774Smrgm4_define([_AM_AUTOCONF_VERSION], [])
223497cf2ee2Smrg
22351c235774Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22361c235774Smrg# -------------------------------
22371c235774Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22381c235774Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22391c235774SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22401c235774Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
22411c235774Smrgm4_ifndef([AC_AUTOCONF_VERSION],
22421c235774Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22431c235774Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
224497cf2ee2Smrg
22451c235774Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2246a966c04fSmrg
22471c235774Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
224819569120Smrg#
22491c235774Smrg# This file is free software; the Free Software Foundation
22501c235774Smrg# gives unlimited permission to copy and/or distribute it,
22511c235774Smrg# with or without modifications, as long as this notice is preserved.
2252a966c04fSmrg
22531c235774Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22541c235774Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22551c235774Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
22561c235774Smrg#
22571c235774Smrg# Of course, Automake must honor this variable whenever it calls a
22581c235774Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22591c235774Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22601c235774Smrg# depending on how configure is run.  This is pretty annoying, since
22611c235774Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22621c235774Smrg# source directory, any form will work fine, but in subdirectories a
22631c235774Smrg# relative path needs to be adjusted first.
2264ac92798bSmrg#
22651c235774Smrg# $ac_aux_dir/missing
22661c235774Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22671c235774Smrg# $top_srcdir/$ac_aux_dir/missing
22681c235774Smrg#    fails if $ac_aux_dir is absolute,
22691c235774Smrg#    fails when called from a subdirectory in a VPATH build with
22701c235774Smrg#          a relative $ac_aux_dir
227119569120Smrg#
22721c235774Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22731c235774Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
22741c235774Smrg# harmless because $srcdir is '.', but things will broke when you
22751c235774Smrg# start a VPATH build or use an absolute $srcdir.
227619569120Smrg#
22771c235774Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22781c235774Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22791c235774Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22801c235774Smrg# and then we would define $MISSING as
22811c235774Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22821c235774Smrg# This will work as long as MISSING is not called from configure, because
22831c235774Smrg# unfortunately $(top_srcdir) has no meaning in configure.
22841c235774Smrg# However there are other variables, like CC, which are often used in
22851c235774Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
22861c235774Smrg#
22871c235774Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
22881c235774Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
22891c235774Smrg# configured tree to be moved without reconfiguration.
2290ac92798bSmrg
22911c235774SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22921c235774Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22931c235774Smrg# Expand $ac_aux_dir to an absolute path.
22941c235774Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
22951c235774Smrg])
229619569120Smrg
22971c235774Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
22981c235774Smrg
22991c235774Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
230019569120Smrg#
23011c235774Smrg# This file is free software; the Free Software Foundation
23021c235774Smrg# gives unlimited permission to copy and/or distribute it,
23031c235774Smrg# with or without modifications, as long as this notice is preserved.
23041c235774Smrg
23051c235774Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23061c235774Smrg# -------------------------------------
23071c235774Smrg# Define a conditional.
23081c235774SmrgAC_DEFUN([AM_CONDITIONAL],
23091c235774Smrg[AC_PREREQ([2.52])dnl
23101c235774Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23111c235774Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23121c235774SmrgAC_SUBST([$1_TRUE])dnl
23131c235774SmrgAC_SUBST([$1_FALSE])dnl
23141c235774Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23151c235774Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23161c235774Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23171c235774Smrgif $2; then
23181c235774Smrg  $1_TRUE=
23191c235774Smrg  $1_FALSE='#'
23201c235774Smrgelse
23211c235774Smrg  $1_TRUE='#'
23221c235774Smrg  $1_FALSE=
23231c235774Smrgfi
23241c235774SmrgAC_CONFIG_COMMANDS_PRE(
23251c235774Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23261c235774Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23271c235774SmrgUsually this means the macro was only invoked conditionally.]])
23281c235774Smrgfi])])
23291c235774Smrg
23301c235774Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
233119569120Smrg#
23321c235774Smrg# This file is free software; the Free Software Foundation
23331c235774Smrg# gives unlimited permission to copy and/or distribute it,
23341c235774Smrg# with or without modifications, as long as this notice is preserved.
23351c235774Smrg
23361c235774Smrg
23371c235774Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23381c235774Smrg# written in clear, in which case automake, when reading aclocal.m4,
23391c235774Smrg# will think it sees a *use*, and therefore will trigger all it's
23401c235774Smrg# C support machinery.  Also note that it means that autoscan, seeing
23411c235774Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23421c235774Smrg
23431c235774Smrg
23441c235774Smrg# _AM_DEPENDENCIES(NAME)
23451c235774Smrg# ----------------------
23461c235774Smrg# See how the compiler implements dependency checking.
23471c235774Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23481c235774Smrg# We try a few techniques and use that to set a single cache variable.
234919569120Smrg#
23501c235774Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23511c235774Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23521c235774Smrg# dependency, and given that the user is not expected to run this macro,
23531c235774Smrg# just rely on AC_PROG_CC.
23541c235774SmrgAC_DEFUN([_AM_DEPENDENCIES],
23551c235774Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23561c235774SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23571c235774SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23581c235774SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
23599f00f3a1Smrg
23601c235774Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23611c235774Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23621c235774Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23631c235774Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23641c235774Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23651c235774Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23661c235774Smrg                    [depcc="$$1"   am_compiler_list=])
23671c235774Smrg
23681c235774SmrgAC_CACHE_CHECK([dependency style of $depcc],
23691c235774Smrg               [am_cv_$1_dependencies_compiler_type],
23701c235774Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23711c235774Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
23721c235774Smrg  # making bogus files that we don't know about and never remove.  For
23731c235774Smrg  # instance it was reported that on HP-UX the gcc test will end up
23741c235774Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23751c235774Smrg  # in D".
23761c235774Smrg  rm -rf conftest.dir
23771c235774Smrg  mkdir conftest.dir
23781c235774Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23791c235774Smrg  # using a relative directory.
23801c235774Smrg  cp "$am_depcomp" conftest.dir
23811c235774Smrg  cd conftest.dir
23821c235774Smrg  # We will build objects and dependencies in a subdirectory because
23831c235774Smrg  # it helps to detect inapplicable dependency modes.  For instance
23841c235774Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23851c235774Smrg  # side effect of compilation, but ICC will put the dependencies in
23861c235774Smrg  # the current directory while Tru64 will put them in the object
23871c235774Smrg  # directory.
23881c235774Smrg  mkdir sub
23891c235774Smrg
23901c235774Smrg  am_cv_$1_dependencies_compiler_type=none
23911c235774Smrg  if test "$am_compiler_list" = ""; then
23921c235774Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
23931c235774Smrg  fi
23941c235774Smrg  am__universal=false
23951c235774Smrg  m4_case([$1], [CC],
23961c235774Smrg    [case " $depcc " in #(
23971c235774Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23981c235774Smrg     esac],
23991c235774Smrg    [CXX],
24001c235774Smrg    [case " $depcc " in #(
24011c235774Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24021c235774Smrg     esac])
24031c235774Smrg
24041c235774Smrg  for depmode in $am_compiler_list; do
24051c235774Smrg    # Setup a source with many dependencies, because some compilers
24061c235774Smrg    # like to wrap large dependency lists on column 80 (with \), and
24071c235774Smrg    # we should not choose a depcomp mode which is confused by this.
24081c235774Smrg    #
24091c235774Smrg    # We need to recreate these files for each test, as the compiler may
24101c235774Smrg    # overwrite some of them when testing with obscure command lines.
24111c235774Smrg    # This happens at least with the AIX C compiler.
24121c235774Smrg    : > sub/conftest.c
24131c235774Smrg    for i in 1 2 3 4 5 6; do
24141c235774Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24151c235774Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24161c235774Smrg      # Solaris 10 /bin/sh.
24171c235774Smrg      echo '/* dummy */' > sub/conftst$i.h
24181c235774Smrg    done
24191c235774Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24201c235774Smrg
24211c235774Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24221c235774Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24231c235774Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24241c235774Smrg    # versions had trouble with output in subdirs.
24251c235774Smrg    am__obj=sub/conftest.${OBJEXT-o}
24261c235774Smrg    am__minus_obj="-o $am__obj"
24271c235774Smrg    case $depmode in
24281c235774Smrg    gcc)
24291c235774Smrg      # This depmode causes a compiler race in universal mode.
24301c235774Smrg      test "$am__universal" = false || continue
24311c235774Smrg      ;;
24321c235774Smrg    nosideeffect)
24331c235774Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24341c235774Smrg      # only be used when explicitly requested.
24351c235774Smrg      if test "x$enable_dependency_tracking" = xyes; then
24361c235774Smrg	continue
24371c235774Smrg      else
24381c235774Smrg	break
24391c235774Smrg      fi
24401c235774Smrg      ;;
24411c235774Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24421c235774Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
24431c235774Smrg      # not run yet.  These depmodes are late enough in the game, and
24441c235774Smrg      # so weak that their functioning should not be impacted.
24451c235774Smrg      am__obj=conftest.${OBJEXT-o}
24461c235774Smrg      am__minus_obj=
24471c235774Smrg      ;;
24481c235774Smrg    none) break ;;
24491c235774Smrg    esac
24501c235774Smrg    if depmode=$depmode \
24511c235774Smrg       source=sub/conftest.c object=$am__obj \
24521c235774Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24531c235774Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24541c235774Smrg         >/dev/null 2>conftest.err &&
24551c235774Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24561c235774Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24571c235774Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24581c235774Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24591c235774Smrg      # icc doesn't choke on unknown options, it will just issue warnings
24601c235774Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
24611c235774Smrg      # that says an option was ignored or not supported.
24621c235774Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24631c235774Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24641c235774Smrg      # The diagnosis changed in icc 8.0:
24651c235774Smrg      #   icc: Command line remark: option '-MP' not supported
24661c235774Smrg      if (grep 'ignoring option' conftest.err ||
24671c235774Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24681c235774Smrg        am_cv_$1_dependencies_compiler_type=$depmode
24691c235774Smrg        break
24701c235774Smrg      fi
24711c235774Smrg    fi
24721c235774Smrg  done
24731c235774Smrg
24741c235774Smrg  cd ..
24751c235774Smrg  rm -rf conftest.dir
247619569120Smrgelse
24771c235774Smrg  am_cv_$1_dependencies_compiler_type=none
247819569120Smrgfi
24791c235774Smrg])
24801c235774SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24811c235774SmrgAM_CONDITIONAL([am__fastdep$1], [
24821c235774Smrg  test "x$enable_dependency_tracking" != xno \
24831c235774Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24841c235774Smrg])
24859f00f3a1Smrg
24869f00f3a1Smrg
24871c235774Smrg# AM_SET_DEPDIR
24881c235774Smrg# -------------
24891c235774Smrg# Choose a directory name for dependency files.
24901c235774Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24911c235774SmrgAC_DEFUN([AM_SET_DEPDIR],
24921c235774Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24931c235774SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24941c235774Smrg])
24959f00f3a1Smrg
2496a966c04fSmrg
24971c235774Smrg# AM_DEP_TRACK
24981c235774Smrg# ------------
24991c235774SmrgAC_DEFUN([AM_DEP_TRACK],
25001c235774Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25011c235774SmrgAS_HELP_STRING(
25021c235774Smrg  [--enable-dependency-tracking],
25031c235774Smrg  [do not reject slow dependency extractors])
25041c235774SmrgAS_HELP_STRING(
25051c235774Smrg  [--disable-dependency-tracking],
25061c235774Smrg  [speeds up one-time build])])
25071c235774Smrgif test "x$enable_dependency_tracking" != xno; then
25081c235774Smrg  am_depcomp="$ac_aux_dir/depcomp"
25091c235774Smrg  AMDEPBACKSLASH='\'
25101c235774Smrg  am__nodep='_no'
25111c235774Smrgfi
25121c235774SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25131c235774SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25141c235774Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25151c235774SmrgAC_SUBST([am__nodep])dnl
25161c235774Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25171c235774Smrg])
2518a966c04fSmrg
25191c235774Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25209f00f3a1Smrg
25211c235774Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
252219569120Smrg#
25231c235774Smrg# This file is free software; the Free Software Foundation
25241c235774Smrg# gives unlimited permission to copy and/or distribute it,
25251c235774Smrg# with or without modifications, as long as this notice is preserved.
25261c235774Smrg
25271c235774Smrg
25281c235774Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25291c235774Smrg# ------------------------------
25301c235774SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25311c235774Smrg[{
25321c235774Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
25331c235774Smrg  # are listed without --file.  Let's play safe and only enable the eval
25341c235774Smrg  # if we detect the quoting.
25351c235774Smrg  case $CONFIG_FILES in
25361c235774Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
25371c235774Smrg  *)   set x $CONFIG_FILES ;;
25381c235774Smrg  esac
25391c235774Smrg  shift
25401c235774Smrg  for mf
25411c235774Smrg  do
25421c235774Smrg    # Strip MF so we end up with the name of the file.
25431c235774Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25441c235774Smrg    # Check whether this is an Automake generated Makefile or not.
25451c235774Smrg    # We used to match only the files named 'Makefile.in', but
25461c235774Smrg    # some people rename them; so instead we look at the file content.
25471c235774Smrg    # Grep'ing the first line is not enough: some people post-process
25481c235774Smrg    # each Makefile.in and add a new line on top of each file to say so.
25491c235774Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
25501c235774Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
25511c235774Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25521c235774Smrg      dirpart=`AS_DIRNAME("$mf")`
25531c235774Smrg    else
25541c235774Smrg      continue
25551c235774Smrg    fi
25561c235774Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
25571c235774Smrg    # from the Makefile without running 'make'.
25581c235774Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25591c235774Smrg    test -z "$DEPDIR" && continue
25601c235774Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25611c235774Smrg    test -z "$am__include" && continue
25621c235774Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25631c235774Smrg    # Find all dependency output files, they are included files with
25641c235774Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25651c235774Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25661c235774Smrg    # expansion.
25671c235774Smrg    for file in `sed -n "
25681c235774Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25691c235774Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25701c235774Smrg      # Make sure the directory exists.
25711c235774Smrg      test -f "$dirpart/$file" && continue
25721c235774Smrg      fdir=`AS_DIRNAME(["$file"])`
25731c235774Smrg      AS_MKDIR_P([$dirpart/$fdir])
25741c235774Smrg      # echo "creating $dirpart/$file"
25751c235774Smrg      echo '# dummy' > "$dirpart/$file"
25761c235774Smrg    done
25771c235774Smrg  done
25781c235774Smrg}
25791c235774Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25801c235774Smrg
25811c235774Smrg
25821c235774Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25831c235774Smrg# -----------------------------
25841c235774Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
258519569120Smrg#
25861c235774Smrg# This code is only required when automatic dependency tracking
25871c235774Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
25881c235774Smrg# need in order to bootstrap the dependency handling code.
25891c235774SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25901c235774Smrg[AC_CONFIG_COMMANDS([depfiles],
25911c235774Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25921c235774Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25931c235774Smrg])
259419569120Smrg
25951c235774Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2596a966c04fSmrg
25971c235774Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25981c235774Smrg#
25991c235774Smrg# This file is free software; the Free Software Foundation
26001c235774Smrg# gives unlimited permission to copy and/or distribute it,
26011c235774Smrg# with or without modifications, as long as this notice is preserved.
2602a966c04fSmrg
26031c235774Smrg# This macro actually does too much.  Some checks are only needed if
26041c235774Smrg# your package does certain things.  But this isn't really a big deal.
26051c235774Smrg
26061c235774Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26071c235774Smrgm4_define([AC_PROG_CC],
26081c235774Smrgm4_defn([AC_PROG_CC])
26091c235774Smrg[_AM_PROG_CC_C_O
26101c235774Smrg])
26111c235774Smrg
26121c235774Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26131c235774Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26141c235774Smrg# -----------------------------------------------
26151c235774Smrg# The call with PACKAGE and VERSION arguments is the old style
26161c235774Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26171c235774Smrg# and VERSION should now be passed to AC_INIT and removed from
26181c235774Smrg# the call to AM_INIT_AUTOMAKE.
26191c235774Smrg# We support both call styles for the transition.  After
26201c235774Smrg# the next Automake release, Autoconf can make the AC_INIT
26211c235774Smrg# arguments mandatory, and then we can depend on a new Autoconf
26221c235774Smrg# release and drop the old call support.
26231c235774SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26241c235774Smrg[AC_PREREQ([2.65])dnl
26251c235774Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26261c235774Smrgdnl the ones we care about.
26271c235774Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26281c235774SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26291c235774SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26301c235774Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26311c235774Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26321c235774Smrg  # is not polluted with repeated "-I."
26331c235774Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26341c235774Smrg  # test to see if srcdir already configured
26351c235774Smrg  if test -f $srcdir/config.status; then
26361c235774Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
263719569120Smrg  fi
263819569120Smrgfi
2639a966c04fSmrg
26401c235774Smrg# test whether we have cygpath
26411c235774Smrgif test -z "$CYGPATH_W"; then
26421c235774Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26431c235774Smrg    CYGPATH_W='cygpath -w'
26441c235774Smrg  else
26451c235774Smrg    CYGPATH_W=echo
264619569120Smrg  fi
264719569120Smrgfi
26481c235774SmrgAC_SUBST([CYGPATH_W])
2649a966c04fSmrg
26501c235774Smrg# Define the identity of the package.
26511c235774Smrgdnl Distinguish between old-style and new-style calls.
26521c235774Smrgm4_ifval([$2],
26531c235774Smrg[AC_DIAGNOSE([obsolete],
26541c235774Smrg             [$0: two- and three-arguments forms are deprecated.])
26551c235774Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26561c235774Smrg AC_SUBST([PACKAGE], [$1])dnl
26571c235774Smrg AC_SUBST([VERSION], [$2])],
26581c235774Smrg[_AM_SET_OPTIONS([$1])dnl
26591c235774Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26601c235774Smrgm4_if(
26611c235774Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26621c235774Smrg  [ok:ok],,
26631c235774Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26641c235774Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26651c235774Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666a966c04fSmrg
26671c235774Smrg_AM_IF_OPTION([no-define],,
26681c235774Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26691c235774Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
26702e2dd055Smrg
26711c235774Smrg# Some tools Automake needs.
26721c235774SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26731c235774SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26741c235774SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26751c235774SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26761c235774SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26771c235774SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26781c235774SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26791c235774SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26801c235774SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26811c235774SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26821c235774Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
26831c235774Smrg# dies out for good.  For more background, see:
26841c235774Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26851c235774Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26861c235774SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26871c235774Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
26881c235774Smrg# system "awk" is bad on some platforms.
26891c235774SmrgAC_REQUIRE([AC_PROG_AWK])dnl
26901c235774SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26911c235774SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26921c235774Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26931c235774Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26941c235774Smrg			     [_AM_PROG_TAR([v7])])])
26951c235774Smrg_AM_IF_OPTION([no-dependencies],,
26961c235774Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26971c235774Smrg		  [_AM_DEPENDENCIES([CC])],
26981c235774Smrg		  [m4_define([AC_PROG_CC],
26991c235774Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27001c235774SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27011c235774Smrg		  [_AM_DEPENDENCIES([CXX])],
27021c235774Smrg		  [m4_define([AC_PROG_CXX],
27031c235774Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27041c235774SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27051c235774Smrg		  [_AM_DEPENDENCIES([OBJC])],
27061c235774Smrg		  [m4_define([AC_PROG_OBJC],
27071c235774Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27081c235774SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27091c235774Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27101c235774Smrg		  [m4_define([AC_PROG_OBJCXX],
27111c235774Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27121c235774Smrg])
27131c235774SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27141c235774Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27151c235774Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27161c235774Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27171c235774SmrgAC_CONFIG_COMMANDS_PRE(dnl
27181c235774Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27191c235774Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27201c235774Smrg
27211c235774Smrg# POSIX will say in a future version that running "rm -f" with no argument
27221c235774Smrg# is OK; and we want to be able to make that assumption in our Makefile
27231c235774Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27241c235774Smrg# actually supported "in the wild" to an acceptable degree.
27251c235774Smrg# See automake bug#10828.
27261c235774Smrg# To make any issue more visible, cause the running configure to be aborted
27271c235774Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27281c235774Smrg# user can still override this though.
27291c235774Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27301c235774Smrg  cat >&2 <<'END'
27311c235774SmrgOops!
27322e2dd055Smrg
27331c235774SmrgYour 'rm' program seems unable to run without file operands specified
27341c235774Smrgon the command line, even when the '-f' option is present.  This is contrary
27351c235774Smrgto the behaviour of most rm programs out there, and not conforming with
27361c235774Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27372e2dd055Smrg
27381c235774SmrgPlease tell bug-automake@gnu.org about your system, including the value
27391c235774Smrgof your $PATH and any error possibly output before this message.  This
27401c235774Smrgcan help us improve future automake versions.
27412e2dd055Smrg
27421c235774SmrgEND
27431c235774Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27441c235774Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27451c235774Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27461c235774Smrg    echo >&2
27471c235774Smrg  else
27481c235774Smrg    cat >&2 <<'END'
27491c235774SmrgAborting the configuration process, to ensure you take notice of the issue.
2750a966c04fSmrg
27511c235774SmrgYou can download and install GNU coreutils to get an 'rm' implementation
27521c235774Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
27531c235774Smrg
27541c235774SmrgIf you want to complete the configuration process using your problematic
27551c235774Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27561c235774Smrgto "yes", and re-run configure.
27571c235774Smrg
27581c235774SmrgEND
27591c235774Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27601c235774Smrg  fi
2761edce3322Smrgfi
27621c235774Smrgdnl The trailing newline in this macro's definition is deliberate, for
27631c235774Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27641c235774Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27651c235774Smrg])
27666e7d3316Smrg
27671c235774Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27681c235774Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27691c235774Smrgdnl mangled by Autoconf and run in a shell conditional statement.
27701c235774Smrgm4_define([_AC_COMPILER_EXEEXT],
27711c235774Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27726e7d3316Smrg
27731c235774Smrg# When config.status generates a header, we must update the stamp-h file.
27741c235774Smrg# This file resides in the same directory as the config header
27751c235774Smrg# that is generated.  The stamp files are numbered to have different names.
27761c235774Smrg
27771c235774Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27781c235774Smrg# loop where config.status creates the headers, so we can generate
27791c235774Smrg# our stamp files there.
27801c235774SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27811c235774Smrg[# Compute $1's index in $config_headers.
27821c235774Smrg_am_arg=$1
27831c235774Smrg_am_stamp_count=1
27841c235774Smrgfor _am_header in $config_headers :; do
27851c235774Smrg  case $_am_header in
27861c235774Smrg    $_am_arg | $_am_arg:* )
27871c235774Smrg      break ;;
27881c235774Smrg    * )
27891c235774Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27901c235774Smrg  esac
27911c235774Smrgdone
27921c235774Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
27931c235774Smrg
27941c235774Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
279597cf2ee2Smrg#
27961c235774Smrg# This file is free software; the Free Software Foundation
27971c235774Smrg# gives unlimited permission to copy and/or distribute it,
27981c235774Smrg# with or without modifications, as long as this notice is preserved.
27996e7d3316Smrg
28001c235774Smrg# AM_PROG_INSTALL_SH
28011c235774Smrg# ------------------
28021c235774Smrg# Define $install_sh.
28031c235774SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28041c235774Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28051c235774Smrgif test x"${install_sh+set}" != xset; then
28061c235774Smrg  case $am_aux_dir in
28071c235774Smrg  *\ * | *\	*)
28081c235774Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28091c235774Smrg  *)
28101c235774Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28111c235774Smrg  esac
28129f00f3a1Smrgfi
28131c235774SmrgAC_SUBST([install_sh])])
28146e7d3316Smrg
28151c235774Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28161c235774Smrg#
28171c235774Smrg# This file is free software; the Free Software Foundation
28181c235774Smrg# gives unlimited permission to copy and/or distribute it,
28191c235774Smrg# with or without modifications, as long as this notice is preserved.
28201c235774Smrg
28211c235774Smrg# Check whether the underlying file-system supports filenames
28221c235774Smrg# with a leading dot.  For instance MS-DOS doesn't.
28231c235774SmrgAC_DEFUN([AM_SET_LEADING_DOT],
28241c235774Smrg[rm -rf .tst 2>/dev/null
28251c235774Smrgmkdir .tst 2>/dev/null
28261c235774Smrgif test -d .tst; then
28271c235774Smrg  am__leading_dot=.
282897cf2ee2Smrgelse
28291c235774Smrg  am__leading_dot=_
283097cf2ee2Smrgfi
28311c235774Smrgrmdir .tst 2>/dev/null
28321c235774SmrgAC_SUBST([am__leading_dot])])
28336e7d3316Smrg
28341c235774Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
28356e7d3316Smrg
28361c235774Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
283719569120Smrg#
28381c235774Smrg# This file is free software; the Free Software Foundation
28391c235774Smrg# gives unlimited permission to copy and/or distribute it,
28401c235774Smrg# with or without modifications, as long as this notice is preserved.
284197cf2ee2Smrg
28421c235774Smrg# AM_MAKE_INCLUDE()
28431c235774Smrg# -----------------
28441c235774Smrg# Check to see how make treats includes.
28451c235774SmrgAC_DEFUN([AM_MAKE_INCLUDE],
28461c235774Smrg[am_make=${MAKE-make}
28471c235774Smrgcat > confinc << 'END'
28481c235774Smrgam__doit:
28491c235774Smrg	@echo this is the am__doit target
28501c235774Smrg.PHONY: am__doit
28511c235774SmrgEND
28521c235774Smrg# If we don't find an include directive, just comment out the code.
28531c235774SmrgAC_MSG_CHECKING([for style of include used by $am_make])
28541c235774Smrgam__include="#"
28551c235774Smrgam__quote=
28561c235774Smrg_am_result=none
28571c235774Smrg# First try GNU make style include.
28581c235774Smrgecho "include confinc" > confmf
28591c235774Smrg# Ignore all kinds of additional output from 'make'.
28601c235774Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28611c235774Smrg*the\ am__doit\ target*)
28621c235774Smrg  am__include=include
28631c235774Smrg  am__quote=
28641c235774Smrg  _am_result=GNU
28651c235774Smrg  ;;
286619569120Smrgesac
28671c235774Smrg# Now try BSD make style include.
28681c235774Smrgif test "$am__include" = "#"; then
28691c235774Smrg   echo '.include "confinc"' > confmf
28701c235774Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28711c235774Smrg   *the\ am__doit\ target*)
28721c235774Smrg     am__include=.include
28731c235774Smrg     am__quote="\""
28741c235774Smrg     _am_result=BSD
28751c235774Smrg     ;;
28761c235774Smrg   esac
28771c235774Smrgfi
28781c235774SmrgAC_SUBST([am__include])
28791c235774SmrgAC_SUBST([am__quote])
28801c235774SmrgAC_MSG_RESULT([$_am_result])
28811c235774Smrgrm -f confinc confmf
28821c235774Smrg])
288319569120Smrg
28841c235774Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
28851c235774Smrg
28861c235774Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
28871c235774Smrg#
28881c235774Smrg# This file is free software; the Free Software Foundation
28891c235774Smrg# gives unlimited permission to copy and/or distribute it,
28901c235774Smrg# with or without modifications, as long as this notice is preserved.
28911c235774Smrg
28921c235774Smrg# AM_MISSING_PROG(NAME, PROGRAM)
28931c235774Smrg# ------------------------------
28941c235774SmrgAC_DEFUN([AM_MISSING_PROG],
28951c235774Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28961c235774Smrg$1=${$1-"${am_missing_run}$2"}
28971c235774SmrgAC_SUBST($1)])
28981c235774Smrg
28991c235774Smrg# AM_MISSING_HAS_RUN
29001c235774Smrg# ------------------
29011c235774Smrg# Define MISSING if not defined so far and test if it is modern enough.
29021c235774Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29031c235774SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29041c235774Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29051c235774SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29061c235774Smrgif test x"${MISSING+set}" != xset; then
29071c235774Smrg  case $am_aux_dir in
29081c235774Smrg  *\ * | *\	*)
29091c235774Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29101c235774Smrg  *)
29111c235774Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29121c235774Smrg  esac
291397cf2ee2Smrgfi
29141c235774Smrg# Use eval to expand $SHELL
29151c235774Smrgif eval "$MISSING --is-lightweight"; then
29161c235774Smrg  am_missing_run="$MISSING "
29171c235774Smrgelse
29181c235774Smrg  am_missing_run=
29191c235774Smrg  AC_MSG_WARN(['missing' script is too old or missing])
292019569120Smrgfi
29211c235774Smrg])
292297cf2ee2Smrg
29231c235774Smrg# Helper functions for option handling.                     -*- Autoconf -*-
29242e2dd055Smrg
29251c235774Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
292619569120Smrg#
29271c235774Smrg# This file is free software; the Free Software Foundation
29281c235774Smrg# gives unlimited permission to copy and/or distribute it,
29291c235774Smrg# with or without modifications, as long as this notice is preserved.
293097cf2ee2Smrg
29311c235774Smrg# _AM_MANGLE_OPTION(NAME)
29321c235774Smrg# -----------------------
29331c235774SmrgAC_DEFUN([_AM_MANGLE_OPTION],
29341c235774Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
293519569120Smrg
29361c235774Smrg# _AM_SET_OPTION(NAME)
29371c235774Smrg# --------------------
29381c235774Smrg# Set option NAME.  Presently that only means defining a flag for this option.
29391c235774SmrgAC_DEFUN([_AM_SET_OPTION],
29401c235774Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941a966c04fSmrg
29421c235774Smrg# _AM_SET_OPTIONS(OPTIONS)
29431c235774Smrg# ------------------------
29441c235774Smrg# OPTIONS is a space-separated list of Automake options.
29451c235774SmrgAC_DEFUN([_AM_SET_OPTIONS],
29461c235774Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
29479f00f3a1Smrg
29481c235774Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29491c235774Smrg# -------------------------------------------
29501c235774Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29511c235774SmrgAC_DEFUN([_AM_IF_OPTION],
29521c235774Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
29539f00f3a1Smrg
29541c235774Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
29559f00f3a1Smrg#
29561c235774Smrg# This file is free software; the Free Software Foundation
29571c235774Smrg# gives unlimited permission to copy and/or distribute it,
29581c235774Smrg# with or without modifications, as long as this notice is preserved.
295997cf2ee2Smrg
29601c235774Smrg# _AM_PROG_CC_C_O
29619f00f3a1Smrg# ---------------
29621c235774Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29631c235774Smrg# to automatically call this.
29641c235774SmrgAC_DEFUN([_AM_PROG_CC_C_O],
29651c235774Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29661c235774SmrgAC_REQUIRE_AUX_FILE([compile])dnl
29671c235774SmrgAC_LANG_PUSH([C])dnl
29681c235774SmrgAC_CACHE_CHECK(
29691c235774Smrg  [whether $CC understands -c and -o together],
29701c235774Smrg  [am_cv_prog_cc_c_o],
29711c235774Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29721c235774Smrg  # Make sure it works both with $CC and with simple cc.
29731c235774Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29741c235774Smrg  # compilers refuse to overwrite an existing .o file with -o,
29751c235774Smrg  # though they will create one.
29761c235774Smrg  am_cv_prog_cc_c_o=yes
29771c235774Smrg  for am_i in 1 2; do
29781c235774Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29791c235774Smrg         && test -f conftest2.$ac_objext; then
29801c235774Smrg      : OK
29811c235774Smrg    else
29821c235774Smrg      am_cv_prog_cc_c_o=no
29831c235774Smrg      break
29841c235774Smrg    fi
29851c235774Smrg  done
29861c235774Smrg  rm -f core conftest*
29871c235774Smrg  unset am_i])
29881c235774Smrgif test "$am_cv_prog_cc_c_o" != yes; then
29891c235774Smrg   # Losing compiler, so override with the script.
29901c235774Smrg   # FIXME: It is wrong to rewrite CC.
29911c235774Smrg   # But if we don't then we get into trouble of one sort or another.
29921c235774Smrg   # A longer-term fix would be to have automake use am__CC in this case,
29931c235774Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29941c235774Smrg   CC="$am_aux_dir/compile $CC"
299597cf2ee2Smrgfi
29961c235774SmrgAC_LANG_POP([C])])
299719569120Smrg
29981c235774Smrg# For backward compatibility.
29991c235774SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
300019569120Smrg
30011c235774Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30021c235774Smrg#
30031c235774Smrg# This file is free software; the Free Software Foundation
30041c235774Smrg# gives unlimited permission to copy and/or distribute it,
30051c235774Smrg# with or without modifications, as long as this notice is preserved.
300619569120Smrg
30071c235774Smrg# AM_RUN_LOG(COMMAND)
30081c235774Smrg# -------------------
30091c235774Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30101c235774Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30111c235774SmrgAC_DEFUN([AM_RUN_LOG],
30121c235774Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30131c235774Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30141c235774Smrg   ac_status=$?
30151c235774Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30161c235774Smrg   (exit $ac_status); }])
301719569120Smrg
30181c235774Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
301919569120Smrg
30201c235774Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30211c235774Smrg#
30221c235774Smrg# This file is free software; the Free Software Foundation
30231c235774Smrg# gives unlimited permission to copy and/or distribute it,
30241c235774Smrg# with or without modifications, as long as this notice is preserved.
302519569120Smrg
30261c235774Smrg# AM_SANITY_CHECK
30271c235774Smrg# ---------------
30281c235774SmrgAC_DEFUN([AM_SANITY_CHECK],
30291c235774Smrg[AC_MSG_CHECKING([whether build environment is sane])
30301c235774Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30311c235774Smrg# name.  Accept space and tab only in the latter.
30321c235774Smrgam_lf='
30331c235774Smrg'
30341c235774Smrgcase `pwd` in
30351c235774Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30361c235774Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30371c235774Smrgesac
30381c235774Smrgcase $srcdir in
30391c235774Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30401c235774Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30411c235774Smrgesac
30421c235774Smrg
30431c235774Smrg# Do 'set' in a subshell so we don't clobber the current shell's
30441c235774Smrg# arguments.  Must try -L first in case configure is actually a
30451c235774Smrg# symlink; some systems play weird games with the mod time of symlinks
30461c235774Smrg# (eg FreeBSD returns the mod time of the symlink's containing
30471c235774Smrg# directory).
30481c235774Smrgif (
30491c235774Smrg   am_has_slept=no
30501c235774Smrg   for am_try in 1 2; do
30511c235774Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30521c235774Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30531c235774Smrg     if test "$[*]" = "X"; then
30541c235774Smrg	# -L didn't work.
30551c235774Smrg	set X `ls -t "$srcdir/configure" conftest.file`
30561c235774Smrg     fi
30571c235774Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30581c235774Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
305919569120Smrg
30601c235774Smrg	# If neither matched, then we have a broken ls.  This can happen
30611c235774Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30621c235774Smrg	# broken ls alias from the environment.  This has actually
30631c235774Smrg	# happened.  Such a system could not be considered "sane".
30641c235774Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30651c235774Smrg  alias in your environment])
30661c235774Smrg     fi
30671c235774Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30681c235774Smrg       break
30691c235774Smrg     fi
30701c235774Smrg     # Just in case.
30711c235774Smrg     sleep 1
30721c235774Smrg     am_has_slept=yes
30731c235774Smrg   done
30741c235774Smrg   test "$[2]" = conftest.file
30751c235774Smrg   )
30761c235774Smrgthen
30771c235774Smrg   # Ok.
30781c235774Smrg   :
30791c235774Smrgelse
30801c235774Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
30811c235774SmrgCheck your system clock])
30821c235774Smrgfi
30831c235774SmrgAC_MSG_RESULT([yes])
30841c235774Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30851c235774Smrg# generated files are strictly newer.
30861c235774Smrgam_sleep_pid=
30871c235774Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30881c235774Smrg  ( sleep 1 ) &
30891c235774Smrg  am_sleep_pid=$!
30901c235774Smrgfi
30911c235774SmrgAC_CONFIG_COMMANDS_PRE(
30921c235774Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30931c235774Smrg   if test -n "$am_sleep_pid"; then
30941c235774Smrg     # Hide warnings about reused PIDs.
30951c235774Smrg     wait $am_sleep_pid 2>/dev/null
30961c235774Smrg   fi
30971c235774Smrg   AC_MSG_RESULT([done])])
30981c235774Smrgrm -f conftest.file
30999f00f3a1Smrg])
3100a966c04fSmrg
31011c235774Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
310219569120Smrg#
31031c235774Smrg# This file is free software; the Free Software Foundation
31041c235774Smrg# gives unlimited permission to copy and/or distribute it,
31051c235774Smrg# with or without modifications, as long as this notice is preserved.
310619569120Smrg
31071c235774Smrg# AM_SILENT_RULES([DEFAULT])
31081c235774Smrg# --------------------------
31091c235774Smrg# Enable less verbose build rules; with the default set to DEFAULT
31101c235774Smrg# ("yes" being less verbose, "no" or empty being verbose).
31111c235774SmrgAC_DEFUN([AM_SILENT_RULES],
31121c235774Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31131c235774SmrgAS_HELP_STRING(
31141c235774Smrg  [--enable-silent-rules],
31151c235774Smrg  [less verbose build output (undo: "make V=1")])
31161c235774SmrgAS_HELP_STRING(
31171c235774Smrg  [--disable-silent-rules],
31181c235774Smrg  [verbose build output (undo: "make V=0")])dnl
31191c235774Smrg])
31201c235774Smrgcase $enable_silent_rules in @%:@ (((
31211c235774Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31221c235774Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31231c235774Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31241c235774Smrgesac
31251c235774Smrgdnl
31261c235774Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31271c235774Smrgdnl do not support nested variable expansions.
31281c235774Smrgdnl See automake bug#9928 and bug#10237.
31291c235774Smrgam_make=${MAKE-make}
31301c235774SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31311c235774Smrg   [am_cv_make_support_nested_variables],
31321c235774Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31331c235774SmrgBAR0=false
31341c235774SmrgBAR1=true
31351c235774SmrgV=1
31361c235774Smrgam__doit:
31371c235774Smrg	@$(TRUE)
31381c235774Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31391c235774Smrg  am_cv_make_support_nested_variables=yes
31409f00f3a1Smrgelse
31411c235774Smrg  am_cv_make_support_nested_variables=no
31421c235774Smrgfi])
31431c235774Smrgif test $am_cv_make_support_nested_variables = yes; then
31441c235774Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31451c235774Smrg  AM_V='$(V)'
31461c235774Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31471c235774Smrgelse
31481c235774Smrg  AM_V=$AM_DEFAULT_VERBOSITY
31491c235774Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31509f00f3a1Smrgfi
31511c235774SmrgAC_SUBST([AM_V])dnl
31521c235774SmrgAM_SUBST_NOTMAKE([AM_V])dnl
31531c235774SmrgAC_SUBST([AM_DEFAULT_V])dnl
31541c235774SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31551c235774SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31561c235774SmrgAM_BACKSLASH='\'
31571c235774SmrgAC_SUBST([AM_BACKSLASH])dnl
31581c235774Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31591c235774Smrg])
31609f00f3a1Smrg
31611c235774Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
31621c235774Smrg#
31631c235774Smrg# This file is free software; the Free Software Foundation
31641c235774Smrg# gives unlimited permission to copy and/or distribute it,
31651c235774Smrg# with or without modifications, as long as this notice is preserved.
31662e2dd055Smrg
31671c235774Smrg# AM_PROG_INSTALL_STRIP
31681c235774Smrg# ---------------------
31691c235774Smrg# One issue with vendor 'install' (even GNU) is that you can't
31701c235774Smrg# specify the program used to strip binaries.  This is especially
31711c235774Smrg# annoying in cross-compiling environments, where the build's strip
31721c235774Smrg# is unlikely to handle the host's binaries.
31731c235774Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31741c235774Smrg# always use install-sh in "make install-strip", and initialize
31751c235774Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
31761c235774SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31771c235774Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31781c235774Smrg# Installed binaries are usually stripped using 'strip' when the user
31791c235774Smrg# run "make install-strip".  However 'strip' might not be the right
31801c235774Smrg# tool to use in cross-compilation environments, therefore Automake
31811c235774Smrg# will honor the 'STRIP' environment variable to overrule this program.
31821c235774Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31831c235774Smrgif test "$cross_compiling" != no; then
31841c235774Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
31851c235774Smrgfi
31861c235774SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31871c235774SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31882e2dd055Smrg
31891c235774Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31901c235774Smrg#
31911c235774Smrg# This file is free software; the Free Software Foundation
31921c235774Smrg# gives unlimited permission to copy and/or distribute it,
31931c235774Smrg# with or without modifications, as long as this notice is preserved.
3194a966c04fSmrg
31951c235774Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
31961c235774Smrg# ---------------------------
31971c235774Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31981c235774Smrg# This macro is traced by Automake.
31991c235774SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200a966c04fSmrg
32011c235774Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32021c235774Smrg# --------------------------
32031c235774Smrg# Public sister of _AM_SUBST_NOTMAKE.
32041c235774SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205a966c04fSmrg
32061c235774Smrg# Check how to create a tarball.                            -*- Autoconf -*-
32076e7d3316Smrg
32081c235774Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32096e7d3316Smrg#
32101c235774Smrg# This file is free software; the Free Software Foundation
32111c235774Smrg# gives unlimited permission to copy and/or distribute it,
32121c235774Smrg# with or without modifications, as long as this notice is preserved.
3213ac92798bSmrg
32141c235774Smrg# _AM_PROG_TAR(FORMAT)
32151c235774Smrg# --------------------
32161c235774Smrg# Check how to create a tarball in format FORMAT.
32171c235774Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
321819569120Smrg#
32191c235774Smrg# Substitute a variable $(am__tar) that is a command
32201c235774Smrg# writing to stdout a FORMAT-tarball containing the directory
32211c235774Smrg# $tardir.
32221c235774Smrg#     tardir=directory && $(am__tar) > result.tar
322319569120Smrg#
32241c235774Smrg# Substitute a variable $(am__untar) that extract such
32251c235774Smrg# a tarball read from stdin.
32261c235774Smrg#     $(am__untar) < result.tar
32271c235774Smrg#
32281c235774SmrgAC_DEFUN([_AM_PROG_TAR],
32291c235774Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32301c235774Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32311c235774SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32326e7d3316Smrg
32331c235774Smrg# We'll loop over all known methods to create a tar archive until one works.
32341c235774Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32359f00f3a1Smrg
32361c235774Smrgm4_if([$1], [v7],
32371c235774Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32389f00f3a1Smrg
32391c235774Smrg  [m4_case([$1],
32401c235774Smrg    [ustar],
32411c235774Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32421c235774Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32431c235774Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32441c235774Smrg      # and bug#13588).
32451c235774Smrg      am_max_uid=2097151 # 2^21 - 1
32461c235774Smrg      am_max_gid=$am_max_uid
32471c235774Smrg      # The $UID and $GID variables are not portable, so we need to resort
32481c235774Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32491c235774Smrg      # below are definitely unexpected, so allow the users to see them
32501c235774Smrg      # (that is, avoid stderr redirection).
32511c235774Smrg      am_uid=`id -u || echo unknown`
32521c235774Smrg      am_gid=`id -g || echo unknown`
32531c235774Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32541c235774Smrg      if test $am_uid -le $am_max_uid; then
32551c235774Smrg         AC_MSG_RESULT([yes])
32561c235774Smrg      else
32571c235774Smrg         AC_MSG_RESULT([no])
32581c235774Smrg         _am_tools=none
32591c235774Smrg      fi
32601c235774Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32611c235774Smrg      if test $am_gid -le $am_max_gid; then
32621c235774Smrg         AC_MSG_RESULT([yes])
32631c235774Smrg      else
32641c235774Smrg        AC_MSG_RESULT([no])
32651c235774Smrg        _am_tools=none
32661c235774Smrg      fi],
32679f00f3a1Smrg
32681c235774Smrg  [pax],
32691c235774Smrg    [],
32709f00f3a1Smrg
32711c235774Smrg  [m4_fatal([Unknown tar format])])
32729f00f3a1Smrg
32731c235774Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
32749f00f3a1Smrg
32751c235774Smrg  # Go ahead even if we have the value already cached.  We do so because we
32761c235774Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32771c235774Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32789f00f3a1Smrg
32791c235774Smrg  for _am_tool in $_am_tools; do
32801c235774Smrg    case $_am_tool in
32811c235774Smrg    gnutar)
32821c235774Smrg      for _am_tar in tar gnutar gtar; do
32831c235774Smrg        AM_RUN_LOG([$_am_tar --version]) && break
32841c235774Smrg      done
32851c235774Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32861c235774Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32871c235774Smrg      am__untar="$_am_tar -xf -"
32881c235774Smrg      ;;
32891c235774Smrg    plaintar)
32901c235774Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32911c235774Smrg      # ustar tarball either.
32921c235774Smrg      (tar --version) >/dev/null 2>&1 && continue
32931c235774Smrg      am__tar='tar chf - "$$tardir"'
32941c235774Smrg      am__tar_='tar chf - "$tardir"'
32951c235774Smrg      am__untar='tar xf -'
32961c235774Smrg      ;;
32971c235774Smrg    pax)
32981c235774Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
32991c235774Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33001c235774Smrg      am__untar='pax -r'
33011c235774Smrg      ;;
33021c235774Smrg    cpio)
33031c235774Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33041c235774Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33051c235774Smrg      am__untar='cpio -i -H $1 -d'
33061c235774Smrg      ;;
33071c235774Smrg    none)
33081c235774Smrg      am__tar=false
33091c235774Smrg      am__tar_=false
33101c235774Smrg      am__untar=false
33111c235774Smrg      ;;
33121c235774Smrg    esac
3313a966c04fSmrg
33141c235774Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33151c235774Smrg    # and am__untar set.
33161c235774Smrg    test -n "${am_cv_prog_tar_$1}" && break
33179f00f3a1Smrg
33181c235774Smrg    # tar/untar a dummy directory, and stop if the command works.
33191c235774Smrg    rm -rf conftest.dir
33201c235774Smrg    mkdir conftest.dir
33211c235774Smrg    echo GrepMe > conftest.dir/file
33221c235774Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33231c235774Smrg    rm -rf conftest.dir
33241c235774Smrg    if test -s conftest.tar; then
33251c235774Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33261c235774Smrg      AM_RUN_LOG([cat conftest.dir/file])
33271c235774Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33281c235774Smrg    fi
33291c235774Smrg  done
33301c235774Smrg  rm -rf conftest.dir
33311c235774Smrg
33321c235774Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33331c235774Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33341c235774Smrg
33351c235774SmrgAC_SUBST([am__tar])
33361c235774SmrgAC_SUBST([am__untar])
33371c235774Smrg]) # _AM_PROG_TAR
33389f00f3a1Smrg
33399f00f3a1Smrgm4_include([m4/ax_define_dir.m4])
33409f00f3a1Smrgm4_include([m4/libtool.m4])
33419f00f3a1Smrgm4_include([m4/ltoptions.m4])
33429f00f3a1Smrgm4_include([m4/ltsugar.m4])
33439f00f3a1Smrgm4_include([m4/ltversion.m4])
33449f00f3a1Smrgm4_include([m4/lt~obsolete.m4])
3345