aclocal.m4 revision 4929c8f8
14929c8f8Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2df58931aSmrg
34929c8f8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
44fb28925Smrg
54fb28925Smrg# This file is free software; the Free Software Foundation
64fb28925Smrg# gives unlimited permission to copy and/or distribute it,
74fb28925Smrg# with or without modifications, as long as this notice is preserved.
84fb28925Smrg
94fb28925Smrg# This program is distributed in the hope that it will be useful,
104fb28925Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
114fb28925Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
124fb28925Smrg# PARTICULAR PURPOSE.
134fb28925Smrg
14df58931aSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b66d1acbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b66d1acbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
174929c8f8Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
184929c8f8Smrg[m4_warning([this file was generated for autoconf 2.69.
19b66d1acbSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b66d1acbSmrgIf you have problems, you may need to regenerate the build system entirely.
21df58931aSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
224fb28925Smrg
234929c8f8Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
244929c8f8Smrgdnl serial 11 (pkg-config-0.29)
254929c8f8Smrgdnl
264929c8f8Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
274929c8f8Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
284929c8f8Smrgdnl
294929c8f8Smrgdnl This program is free software; you can redistribute it and/or modify
304929c8f8Smrgdnl it under the terms of the GNU General Public License as published by
314929c8f8Smrgdnl the Free Software Foundation; either version 2 of the License, or
324929c8f8Smrgdnl (at your option) any later version.
334929c8f8Smrgdnl
344929c8f8Smrgdnl This program is distributed in the hope that it will be useful, but
354929c8f8Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
364929c8f8Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
374929c8f8Smrgdnl General Public License for more details.
384929c8f8Smrgdnl
394929c8f8Smrgdnl You should have received a copy of the GNU General Public License
404929c8f8Smrgdnl along with this program; if not, write to the Free Software
414929c8f8Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
424929c8f8Smrgdnl 02111-1307, USA.
434929c8f8Smrgdnl
444929c8f8Smrgdnl As a special exception to the GNU General Public License, if you
454929c8f8Smrgdnl distribute this file as part of a program that contains a
464929c8f8Smrgdnl configuration script generated by Autoconf, you may include it under
474929c8f8Smrgdnl the same distribution terms that you use for the rest of that
484929c8f8Smrgdnl program.
494929c8f8Smrg
504929c8f8Smrgdnl PKG_PREREQ(MIN-VERSION)
514929c8f8Smrgdnl -----------------------
524929c8f8Smrgdnl Since: 0.29
534929c8f8Smrgdnl
544929c8f8Smrgdnl Verify that the version of the pkg-config macros are at least
554929c8f8Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
564929c8f8Smrgdnl installed version of pkg-config, this checks the developer's version
574929c8f8Smrgdnl of pkg.m4 when generating configure.
584929c8f8Smrgdnl
594929c8f8Smrgdnl To ensure that this macro is defined, also add:
604929c8f8Smrgdnl m4_ifndef([PKG_PREREQ],
614929c8f8Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
624929c8f8Smrgdnl
634929c8f8Smrgdnl See the "Since" comment for each macro you use to see what version
644929c8f8Smrgdnl of the macros you require.
654929c8f8Smrgm4_defun([PKG_PREREQ],
664929c8f8Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
674929c8f8Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
684929c8f8Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
694929c8f8Smrg])dnl PKG_PREREQ
704929c8f8Smrg
714929c8f8Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
724929c8f8Smrgdnl ----------------------------------
734929c8f8Smrgdnl Since: 0.16
744929c8f8Smrgdnl
754929c8f8Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
764929c8f8Smrgdnl first found in the path. Checks that the version of pkg-config found
774929c8f8Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
784929c8f8Smrgdnl used since that's the first version where most current features of
794929c8f8Smrgdnl pkg-config existed.
804929c8f8SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
814929c8f8Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
824929c8f8Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
834929c8f8Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
844929c8f8SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
854929c8f8SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
864929c8f8SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
874fb28925Smrg
884929c8f8Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
894929c8f8Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
904929c8f8Smrgfi
914929c8f8Smrgif test -n "$PKG_CONFIG"; then
924929c8f8Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
934929c8f8Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
944929c8f8Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
954929c8f8Smrg		AC_MSG_RESULT([yes])
964929c8f8Smrg	else
974929c8f8Smrg		AC_MSG_RESULT([no])
984929c8f8Smrg		PKG_CONFIG=""
994929c8f8Smrg	fi
1004929c8f8Smrgfi[]dnl
1014929c8f8Smrg])dnl PKG_PROG_PKG_CONFIG
102b66d1acbSmrg
1034929c8f8Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1044929c8f8Smrgdnl -------------------------------------------------------------------
1054929c8f8Smrgdnl Since: 0.18
1064929c8f8Smrgdnl
1074929c8f8Smrgdnl Check to see whether a particular set of modules exists. Similar to
1084929c8f8Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1094929c8f8Smrgdnl
1104929c8f8Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1114929c8f8Smrgdnl only at the first occurence in configure.ac, so if the first place
1124929c8f8Smrgdnl it's called might be skipped (such as if it is within an "if", you
1134929c8f8Smrgdnl have to call PKG_CHECK_EXISTS manually
1144929c8f8SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1154929c8f8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1164929c8f8Smrgif test -n "$PKG_CONFIG" && \
1174929c8f8Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1184929c8f8Smrg  m4_default([$2], [:])
1194929c8f8Smrgm4_ifvaln([$3], [else
1204929c8f8Smrg  $3])dnl
1214929c8f8Smrgfi])
1224fb28925Smrg
1234929c8f8Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1244929c8f8Smrgdnl ---------------------------------------------
1254929c8f8Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1264929c8f8Smrgdnl pkg_failed based on the result.
1274929c8f8Smrgm4_define([_PKG_CONFIG],
1284929c8f8Smrg[if test -n "$$1"; then
1294929c8f8Smrg    pkg_cv_[]$1="$$1"
1304929c8f8Smrg elif test -n "$PKG_CONFIG"; then
1314929c8f8Smrg    PKG_CHECK_EXISTS([$3],
1324929c8f8Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1334929c8f8Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1344929c8f8Smrg		     [pkg_failed=yes])
1354929c8f8Smrg else
1364929c8f8Smrg    pkg_failed=untried
1374929c8f8Smrgfi[]dnl
1384929c8f8Smrg])dnl _PKG_CONFIG
1394fb28925Smrg
1404929c8f8Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1414929c8f8Smrgdnl ---------------------------
1424929c8f8Smrgdnl Internal check to see if pkg-config supports short errors.
1434929c8f8SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1444929c8f8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1454929c8f8Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1464929c8f8Smrg        _pkg_short_errors_supported=yes
1474929c8f8Smrgelse
1484929c8f8Smrg        _pkg_short_errors_supported=no
1494929c8f8Smrgfi[]dnl
1504929c8f8Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1514fb28925Smrg
1524fb28925Smrg
1534929c8f8Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1544929c8f8Smrgdnl   [ACTION-IF-NOT-FOUND])
1554929c8f8Smrgdnl --------------------------------------------------------------
1564929c8f8Smrgdnl Since: 0.4.0
1574929c8f8Smrgdnl
1584929c8f8Smrgdnl Note that if there is a possibility the first call to
1594929c8f8Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1604929c8f8Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1614929c8f8SmrgAC_DEFUN([PKG_CHECK_MODULES],
1624929c8f8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1634929c8f8SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1644929c8f8SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1654fb28925Smrg
1664929c8f8Smrgpkg_failed=no
1674929c8f8SmrgAC_MSG_CHECKING([for $1])
1684fb28925Smrg
1694929c8f8Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1704929c8f8Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1714fb28925Smrg
1724929c8f8Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1734929c8f8Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1744929c8f8SmrgSee the pkg-config man page for more details.])
1754fb28925Smrg
1764929c8f8Smrgif test $pkg_failed = yes; then
1774929c8f8Smrg   	AC_MSG_RESULT([no])
1784929c8f8Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1794929c8f8Smrg        if test $_pkg_short_errors_supported = yes; then
1804929c8f8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1814929c8f8Smrg        else 
1824929c8f8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1834929c8f8Smrg        fi
1844929c8f8Smrg	# Put the nasty error message in config.log where it belongs
1854929c8f8Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1864fb28925Smrg
1874929c8f8Smrg	m4_default([$4], [AC_MSG_ERROR(
1884929c8f8Smrg[Package requirements ($2) were not met:
1894fb28925Smrg
1904929c8f8Smrg$$1_PKG_ERRORS
1914fb28925Smrg
1924929c8f8SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1934929c8f8Smrginstalled software in a non-standard prefix.
1944fb28925Smrg
1954929c8f8Smrg_PKG_TEXT])[]dnl
1964929c8f8Smrg        ])
1974929c8f8Smrgelif test $pkg_failed = untried; then
1984929c8f8Smrg     	AC_MSG_RESULT([no])
1994929c8f8Smrg	m4_default([$4], [AC_MSG_FAILURE(
2004929c8f8Smrg[The pkg-config script could not be found or is too old.  Make sure it
2014929c8f8Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2024929c8f8Smrgpath to pkg-config.
2034fb28925Smrg
2044929c8f8Smrg_PKG_TEXT
2054fb28925Smrg
2064929c8f8SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2074929c8f8Smrg        ])
2084929c8f8Smrgelse
2094929c8f8Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2104929c8f8Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2114929c8f8Smrg        AC_MSG_RESULT([yes])
2124929c8f8Smrg	$3
2134929c8f8Smrgfi[]dnl
2144929c8f8Smrg])dnl PKG_CHECK_MODULES
2154fb28925Smrg
2164fb28925Smrg
2174929c8f8Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2184929c8f8Smrgdnl   [ACTION-IF-NOT-FOUND])
2194929c8f8Smrgdnl ---------------------------------------------------------------------
2204929c8f8Smrgdnl Since: 0.29
2214929c8f8Smrgdnl
2224929c8f8Smrgdnl Checks for existence of MODULES and gathers its build flags with
2234929c8f8Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2244929c8f8Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2254929c8f8Smrgdnl
2264929c8f8Smrgdnl Note that if there is a possibility the first call to
2274929c8f8Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2284929c8f8Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2294929c8f8Smrgdnl configure.ac.
2304929c8f8SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2314929c8f8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2324929c8f8Smrg_save_PKG_CONFIG=$PKG_CONFIG
2334929c8f8SmrgPKG_CONFIG="$PKG_CONFIG --static"
2344929c8f8SmrgPKG_CHECK_MODULES($@)
2354929c8f8SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2364929c8f8Smrg])dnl PKG_CHECK_MODULES_STATIC
237b66d1acbSmrg
2384fb28925Smrg
2394929c8f8Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2404929c8f8Smrgdnl -------------------------
2414929c8f8Smrgdnl Since: 0.27
2424929c8f8Smrgdnl
2434929c8f8Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2444929c8f8Smrgdnl should install pkg-config .pc files. By default the directory is
2454929c8f8Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2464929c8f8Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2474929c8f8Smrgdnl parameter.
2484929c8f8SmrgAC_DEFUN([PKG_INSTALLDIR],
2494929c8f8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2504929c8f8Smrgm4_pushdef([pkg_description],
2514929c8f8Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2524929c8f8SmrgAC_ARG_WITH([pkgconfigdir],
2534929c8f8Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2544929c8f8Smrg    [with_pkgconfigdir=]pkg_default)
2554929c8f8SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2564929c8f8Smrgm4_popdef([pkg_default])
2574929c8f8Smrgm4_popdef([pkg_description])
2584929c8f8Smrg])dnl PKG_INSTALLDIR
2594929c8f8Smrg
2604929c8f8Smrg
2614929c8f8Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2624929c8f8Smrgdnl --------------------------------
2634929c8f8Smrgdnl Since: 0.27
2644929c8f8Smrgdnl
2654929c8f8Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2664929c8f8Smrgdnl module should install arch-independent pkg-config .pc files. By
2674929c8f8Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2684929c8f8Smrgdnl changed by passing DIRECTORY. The user can override through the
2694929c8f8Smrgdnl --with-noarch-pkgconfigdir parameter.
2704929c8f8SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2714929c8f8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2724929c8f8Smrgm4_pushdef([pkg_description],
2734929c8f8Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2744929c8f8SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2754929c8f8Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2764929c8f8Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2774929c8f8SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2784929c8f8Smrgm4_popdef([pkg_default])
2794929c8f8Smrgm4_popdef([pkg_description])
2804929c8f8Smrg])dnl PKG_NOARCH_INSTALLDIR
2814929c8f8Smrg
2824929c8f8Smrg
2834929c8f8Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2844929c8f8Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2854929c8f8Smrgdnl -------------------------------------------
2864929c8f8Smrgdnl Since: 0.28
2874929c8f8Smrgdnl
2884929c8f8Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2894929c8f8SmrgAC_DEFUN([PKG_CHECK_VAR],
2904929c8f8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2914929c8f8SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2924fb28925Smrg
2934929c8f8Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2944929c8f8SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2954929c8f8Smrg
2964929c8f8SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2974929c8f8Smrg])dnl PKG_CHECK_VAR
2984929c8f8Smrg
2994929c8f8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3004929c8f8Smrgdnl
3014929c8f8Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3024929c8f8Smrgdnl
3034929c8f8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3044929c8f8Smrgdnl copy of this software and associated documentation files (the "Software"),
3054929c8f8Smrgdnl to deal in the Software without restriction, including without limitation
3064929c8f8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3074929c8f8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3084929c8f8Smrgdnl Software is furnished to do so, subject to the following conditions:
3094929c8f8Smrgdnl
3104929c8f8Smrgdnl The above copyright notice and this permission notice (including the next
3114929c8f8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3124929c8f8Smrgdnl Software.
3134929c8f8Smrgdnl
3144929c8f8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3154929c8f8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3164929c8f8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3174929c8f8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3184929c8f8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3194929c8f8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3204929c8f8Smrgdnl DEALINGS IN THE SOFTWARE.
3214929c8f8Smrg
3224929c8f8Smrg# XORG_MACROS_VERSION(required-version)
3234929c8f8Smrg# -------------------------------------
3244929c8f8Smrg# Minimum version: 1.1.0
3254929c8f8Smrg#
3264929c8f8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3274929c8f8Smrg# your configure.ac with the minimum required version, such as:
3284929c8f8Smrg# XORG_MACROS_VERSION(1.1)
3294929c8f8Smrg#
3304929c8f8Smrg# To ensure that this macro is defined, also add:
3314929c8f8Smrg# m4_ifndef([XORG_MACROS_VERSION],
3324929c8f8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3334929c8f8Smrg#
3344929c8f8Smrg#
3354929c8f8Smrg# See the "minimum version" comment for each macro you use to see what
3364929c8f8Smrg# version you require.
3374929c8f8Smrgm4_defun([XORG_MACROS_VERSION],[
3384929c8f8Smrgm4_define([vers_have], [1.19.0])
3394929c8f8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3404929c8f8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3414929c8f8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3424929c8f8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3434929c8f8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3444929c8f8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3454929c8f8Smrgm4_undefine([vers_have])
3464929c8f8Smrgm4_undefine([maj_have])
3474929c8f8Smrgm4_undefine([maj_needed])
3484929c8f8Smrg]) # XORG_MACROS_VERSION
3494929c8f8Smrg
3504929c8f8Smrg# XORG_PROG_RAWCPP()
3514929c8f8Smrg# ------------------
3524929c8f8Smrg# Minimum version: 1.0.0
3534929c8f8Smrg#
3544929c8f8Smrg# Find cpp program and necessary flags for use in pre-processing text files
3554929c8f8Smrg# such as man pages and config files
3564929c8f8SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3574929c8f8SmrgAC_REQUIRE([AC_PROG_CPP])
3584929c8f8SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3594929c8f8Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3604929c8f8Smrg
3614929c8f8Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3624929c8f8Smrg# which is not the best choice for supporting other OS'es, but covers most
3634929c8f8Smrg# of the ones we need for now.
3644929c8f8SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3654929c8f8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3664929c8f8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3674929c8f8Smrg	AC_MSG_RESULT([no])
3684fb28925Smrgelse
3694929c8f8Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3704929c8f8Smrg		RAWCPPFLAGS=-undef
3714929c8f8Smrg		AC_MSG_RESULT([yes])
3724929c8f8Smrg	# under Cygwin unix is still defined even with -undef
3734929c8f8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3744929c8f8Smrg		RAWCPPFLAGS="-undef -ansi"
3754929c8f8Smrg		AC_MSG_RESULT([yes, with -ansi])
3764929c8f8Smrg	else
3774929c8f8Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3784929c8f8Smrg	fi
3794fb28925Smrgfi
3804929c8f8Smrgrm -f conftest.$ac_ext
3814fb28925Smrg
3824929c8f8SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3834929c8f8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3844929c8f8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3854929c8f8Smrg	AC_MSG_RESULT([no])
3864929c8f8Smrgelse
3874929c8f8Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3884929c8f8Smrg		TRADITIONALCPPFLAGS="-traditional"
3894929c8f8Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3904929c8f8Smrg		AC_MSG_RESULT([yes])
3914929c8f8Smrg	else
3924929c8f8Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3934929c8f8Smrg	fi
3944929c8f8Smrgfi
3954929c8f8Smrgrm -f conftest.$ac_ext
3964929c8f8SmrgAC_SUBST(RAWCPPFLAGS)
3974929c8f8SmrgAC_SUBST(TRADITIONALCPPFLAGS)
3984929c8f8Smrg]) # XORG_PROG_RAWCPP
3994fb28925Smrg
4004929c8f8Smrg# XORG_MANPAGE_SECTIONS()
4014929c8f8Smrg# -----------------------
4024929c8f8Smrg# Minimum version: 1.0.0
4034929c8f8Smrg#
4044929c8f8Smrg# Determine which sections man pages go in for the different man page types
4054929c8f8Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4064929c8f8Smrg# Not sure if there's any better way than just hardcoding by OS name.
4074929c8f8Smrg# Override default settings by setting environment variables
4084929c8f8Smrg# Added MAN_SUBSTS in version 1.8
4094929c8f8Smrg# Added AC_PROG_SED in version 1.8
4104fb28925Smrg
4114929c8f8SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4124929c8f8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4134929c8f8SmrgAC_REQUIRE([AC_PROG_SED])
4144fb28925Smrg
4154929c8f8Smrgif test x$APP_MAN_SUFFIX = x    ; then
4164929c8f8Smrg    APP_MAN_SUFFIX=1
4174929c8f8Smrgfi
4184929c8f8Smrgif test x$APP_MAN_DIR = x    ; then
4194929c8f8Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4204fb28925Smrgfi
4214fb28925Smrg
4224929c8f8Smrgif test x$LIB_MAN_SUFFIX = x    ; then
4234929c8f8Smrg    LIB_MAN_SUFFIX=3
4244929c8f8Smrgfi
4254929c8f8Smrgif test x$LIB_MAN_DIR = x    ; then
4264929c8f8Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4274929c8f8Smrgfi
4284fb28925Smrg
4294929c8f8Smrgif test x$FILE_MAN_SUFFIX = x    ; then
4304929c8f8Smrg    case $host_os in
4314929c8f8Smrg	# Solaris 2.0 - 11 use SysV man page sections
4324929c8f8Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4334929c8f8Smrg	*)				FILE_MAN_SUFFIX=5  ;;
4344929c8f8Smrg    esac
4354929c8f8Smrgfi
4364929c8f8Smrgif test x$FILE_MAN_DIR = x    ; then
4374929c8f8Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4384929c8f8Smrgfi
4394fb28925Smrg
4404929c8f8Smrgif test x$MISC_MAN_SUFFIX = x    ; then
4414929c8f8Smrg    case $host_os in
4424929c8f8Smrg	# Solaris 2.0 - 11 use SysV man page sections
4434929c8f8Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4444929c8f8Smrg	*)				MISC_MAN_SUFFIX=7  ;;
4454929c8f8Smrg    esac
4464929c8f8Smrgfi
4474929c8f8Smrgif test x$MISC_MAN_DIR = x    ; then
4484929c8f8Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4494929c8f8Smrgfi
4504fb28925Smrg
4514929c8f8Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4524929c8f8Smrg    case $host_os in
4534929c8f8Smrg	# Solaris 2.0 - 11 use SysV man page sections
4544929c8f8Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4554929c8f8Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4564929c8f8Smrg    esac
4574929c8f8Smrgfi
4584929c8f8Smrgif test x$DRIVER_MAN_DIR = x    ; then
4594929c8f8Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4604929c8f8Smrgfi
4614929c8f8Smrg
4624929c8f8Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4634929c8f8Smrg    case $host_os in
4644929c8f8Smrg	# Solaris 2.0 - 11 use SysV man page sections
4654929c8f8Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4664929c8f8Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4674929c8f8Smrg    esac
4684929c8f8Smrgfi
4694929c8f8Smrgif test x$ADMIN_MAN_DIR = x    ; then
4704929c8f8Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4714929c8f8Smrgfi
4724fb28925Smrg
4734fb28925Smrg
4744929c8f8SmrgAC_SUBST([APP_MAN_SUFFIX])
4754929c8f8SmrgAC_SUBST([LIB_MAN_SUFFIX])
4764929c8f8SmrgAC_SUBST([FILE_MAN_SUFFIX])
4774929c8f8SmrgAC_SUBST([MISC_MAN_SUFFIX])
4784929c8f8SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4794929c8f8SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4804929c8f8SmrgAC_SUBST([APP_MAN_DIR])
4814929c8f8SmrgAC_SUBST([LIB_MAN_DIR])
4824929c8f8SmrgAC_SUBST([FILE_MAN_DIR])
4834929c8f8SmrgAC_SUBST([MISC_MAN_DIR])
4844929c8f8SmrgAC_SUBST([DRIVER_MAN_DIR])
4854929c8f8SmrgAC_SUBST([ADMIN_MAN_DIR])
4864929c8f8Smrg
4874929c8f8SmrgXORG_MAN_PAGE="X Version 11"
4884929c8f8SmrgAC_SUBST([XORG_MAN_PAGE])
4894929c8f8SmrgMAN_SUBSTS="\
4904929c8f8Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4914929c8f8Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4924929c8f8Smrg	-e 's|__xservername__|Xorg|g' \
4934929c8f8Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
4944929c8f8Smrg	-e 's|__projectroot__|\$(prefix)|g' \
4954929c8f8Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4964929c8f8Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4974929c8f8Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4984929c8f8Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4994929c8f8Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5004929c8f8Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5014929c8f8Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5024929c8f8SmrgAC_SUBST([MAN_SUBSTS])
5034929c8f8Smrg
5044929c8f8Smrg]) # XORG_MANPAGE_SECTIONS
5054929c8f8Smrg
5064929c8f8Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5074929c8f8Smrg# ------------------------
5084929c8f8Smrg# Minimum version: 1.7.0
5094fb28925Smrg#
5104929c8f8Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5114929c8f8Smrg# provided by xorg-sgml-doctools, if installed.
5124929c8f8SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5134929c8f8SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5144929c8f8SmrgXORG_SGML_PATH=
5154929c8f8SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5164929c8f8Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5174929c8f8Smrg    [m4_ifval([$1],[:],
5184929c8f8Smrg        [if test x"$cross_compiling" != x"yes" ; then
5194929c8f8Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5204929c8f8Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5214929c8f8Smrg         fi])
5224929c8f8Smrg    ])
5234fb28925Smrg
5244929c8f8Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5254929c8f8Smrg# the path and the name of the doc stylesheet
5264929c8f8Smrgif test "x$XORG_SGML_PATH" != "x" ; then
5274929c8f8Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5284929c8f8Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5294929c8f8Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5304929c8f8Smrgelse
5314929c8f8Smrg   AC_MSG_RESULT([no])
5324929c8f8Smrgfi
5334929c8f8Smrg
5344929c8f8SmrgAC_SUBST(XORG_SGML_PATH)
5354929c8f8SmrgAC_SUBST(STYLESHEET_SRCDIR)
5364929c8f8SmrgAC_SUBST(XSL_STYLESHEET)
5374929c8f8SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5384929c8f8Smrg]) # XORG_CHECK_SGML_DOCTOOLS
5394fb28925Smrg
5404929c8f8Smrg# XORG_CHECK_LINUXDOC
5414929c8f8Smrg# -------------------
5424929c8f8Smrg# Minimum version: 1.0.0
543b66d1acbSmrg#
5444929c8f8Smrg# Defines the variable MAKE_TEXT if the necessary tools and
5454929c8f8Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5464929c8f8Smrg# Whether or not the necessary tools and files are found can be checked
5474929c8f8Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5484929c8f8SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5494929c8f8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5504929c8f8SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5514fb28925Smrg
5524929c8f8SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553b66d1acbSmrg
5544929c8f8SmrgAC_MSG_CHECKING([whether to build documentation])
555df58931aSmrg
5564929c8f8Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5574929c8f8Smrg   BUILDDOC=yes
5584929c8f8Smrgelse
5594929c8f8Smrg   BUILDDOC=no
5604fb28925Smrgfi
561b66d1acbSmrg
5624929c8f8SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5634929c8f8Smrg
5644929c8f8SmrgAC_MSG_RESULT([$BUILDDOC])
5654929c8f8Smrg
5664929c8f8SmrgAC_MSG_CHECKING([whether to build pdf documentation])
5674929c8f8Smrg
5684929c8f8Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5694929c8f8Smrg   BUILDPDFDOC=yes
5704929c8f8Smrgelse
5714929c8f8Smrg   BUILDPDFDOC=no
5724fb28925Smrgfi
5734fb28925Smrg
5744929c8f8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5754fb28925Smrg
5764929c8f8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
5774fb28925Smrg
5784929c8f8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5794929c8f8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5804929c8f8SmrgMAKE_PDF="$PS2PDF"
5814929c8f8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5824fb28925Smrg
5834929c8f8SmrgAC_SUBST(MAKE_TEXT)
5844929c8f8SmrgAC_SUBST(MAKE_PS)
5854929c8f8SmrgAC_SUBST(MAKE_PDF)
5864929c8f8SmrgAC_SUBST(MAKE_HTML)
5874929c8f8Smrg]) # XORG_CHECK_LINUXDOC
588df58931aSmrg
5894929c8f8Smrg# XORG_CHECK_DOCBOOK
5904929c8f8Smrg# -------------------
5914929c8f8Smrg# Minimum version: 1.0.0
5924929c8f8Smrg#
5934929c8f8Smrg# Checks for the ability to build output formats from SGML DocBook source.
5944929c8f8Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5954929c8f8Smrg# indicates whether the necessary tools and files are found and, if set,
5964929c8f8Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5974929c8f8SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5984929c8f8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599df58931aSmrg
6004929c8f8SmrgBUILDTXTDOC=no
6014929c8f8SmrgBUILDPDFDOC=no
6024929c8f8SmrgBUILDPSDOC=no
6034929c8f8SmrgBUILDHTMLDOC=no
604df58931aSmrg
6054929c8f8SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6064929c8f8SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6074929c8f8SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6084929c8f8SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609df58931aSmrg
6104929c8f8SmrgAC_MSG_CHECKING([whether to build text documentation])
6114929c8f8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6124929c8f8Smrg   test x$BUILD_TXTDOC != xno; then
6134929c8f8Smrg	BUILDTXTDOC=yes
6144929c8f8Smrgfi
6154929c8f8SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6164929c8f8SmrgAC_MSG_RESULT([$BUILDTXTDOC])
617df58931aSmrg
6184929c8f8SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6194929c8f8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6204929c8f8Smrg   test x$BUILD_PDFDOC != xno; then
6214929c8f8Smrg	BUILDPDFDOC=yes
6224929c8f8Smrgfi
6234929c8f8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6244929c8f8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
625df58931aSmrg
6264929c8f8SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6274929c8f8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6284929c8f8Smrg   test x$BUILD_PSDOC != xno; then
6294929c8f8Smrg	BUILDPSDOC=yes
6304929c8f8Smrgfi
6314929c8f8SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6324929c8f8SmrgAC_MSG_RESULT([$BUILDPSDOC])
633df58931aSmrg
6344929c8f8SmrgAC_MSG_CHECKING([whether to build HTML documentation])
6354929c8f8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6364929c8f8Smrg   test x$BUILD_HTMLDOC != xno; then
6374929c8f8Smrg	BUILDHTMLDOC=yes
6384929c8f8Smrgfi
6394929c8f8SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6404929c8f8SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6414fb28925Smrg
6424929c8f8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6434929c8f8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6444929c8f8SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6454929c8f8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
646b66d1acbSmrg
6474929c8f8SmrgAC_SUBST(MAKE_TEXT)
6484929c8f8SmrgAC_SUBST(MAKE_PS)
6494929c8f8SmrgAC_SUBST(MAKE_PDF)
6504929c8f8SmrgAC_SUBST(MAKE_HTML)
6514929c8f8Smrg]) # XORG_CHECK_DOCBOOK
6524fb28925Smrg
6534929c8f8Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6544929c8f8Smrg# ----------------
6554929c8f8Smrg# Minimum version: 1.5.0
6564929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
657b66d1acbSmrg#
6584929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
6594929c8f8Smrg# not at the appropriate level. This macro enables a module to test for the
6604929c8f8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
6614929c8f8Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6624929c8f8Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6634929c8f8Smrg# --with-xmlto assumes 'auto'.
664b66d1acbSmrg#
6654929c8f8Smrg# Interface to module:
6664929c8f8Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6674929c8f8Smrg# XMLTO:	returns the path of the xmlto program found
6684929c8f8Smrg#		returns the path set by the user in the environment
6694929c8f8Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6704929c8f8Smrg#		'no' user instructs the module not to use xmlto
6714929c8f8Smrg#
6724929c8f8Smrg# Added in version 1.10.0
6734929c8f8Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6744929c8f8Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6754929c8f8Smrg#
6764929c8f8Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6774929c8f8Smrg#
6784929c8f8SmrgAC_DEFUN([XORG_WITH_XMLTO],[
6794929c8f8SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6804929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
6814929c8f8SmrgAC_ARG_WITH(xmlto,
6824929c8f8Smrg	AS_HELP_STRING([--with-xmlto],
6834929c8f8Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6844929c8f8Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6854929c8f8Smrgm4_undefine([_defopt])
6864fb28925Smrg
6874929c8f8Smrgif test "x$use_xmlto" = x"auto"; then
6884929c8f8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6894929c8f8Smrg   if test "x$XMLTO" = "x"; then
6904929c8f8Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6914929c8f8Smrg	have_xmlto=no
6924929c8f8Smrg   else
6934929c8f8Smrg        have_xmlto=yes
6944929c8f8Smrg   fi
6954929c8f8Smrgelif test "x$use_xmlto" = x"yes" ; then
6964929c8f8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6974929c8f8Smrg   if test "x$XMLTO" = "x"; then
6984929c8f8Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6994929c8f8Smrg   fi
7004929c8f8Smrg   have_xmlto=yes
7014929c8f8Smrgelif test "x$use_xmlto" = x"no" ; then
7024929c8f8Smrg   if test "x$XMLTO" != "x"; then
7034929c8f8Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7044929c8f8Smrg   fi
7054929c8f8Smrg   have_xmlto=no
706b66d1acbSmrgelse
7074929c8f8Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
708b66d1acbSmrgfi
7094fb28925Smrg
7104929c8f8Smrg# Test for a minimum version of xmlto, if provided.
7114929c8f8Smrgm4_ifval([$1],
7124929c8f8Smrg[if test "$have_xmlto" = yes; then
7134929c8f8Smrg    # scrape the xmlto version
7144929c8f8Smrg    AC_MSG_CHECKING([the xmlto version])
7154929c8f8Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7164929c8f8Smrg    AC_MSG_RESULT([$xmlto_version])
7174929c8f8Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7184929c8f8Smrg        [if test "x$use_xmlto" = xauto; then
7194929c8f8Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7204929c8f8Smrg            have_xmlto=no
7214929c8f8Smrg        else
7224929c8f8Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7234929c8f8Smrg        fi])
7244929c8f8Smrgfi])
7254fb28925Smrg
7264929c8f8Smrg# Test for the ability of xmlto to generate a text target
727b66d1acbSmrg#
7284929c8f8Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7294929c8f8Smrg# following test for empty XML docbook files.
7304929c8f8Smrg# For compatibility reasons use the following empty XML docbook file and if
7314929c8f8Smrg# it fails try it again with a non-empty XML file.
7324929c8f8Smrghave_xmlto_text=no
7334929c8f8Smrgcat > conftest.xml << "EOF"
7344929c8f8SmrgEOF
7354929c8f8SmrgAS_IF([test "$have_xmlto" = yes],
7364929c8f8Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7374929c8f8Smrg             [have_xmlto_text=yes],
7384929c8f8Smrg             [# Try it again with a non-empty XML file.
7394929c8f8Smrg              cat > conftest.xml << "EOF"
7404929c8f8Smrg<x></x>
7414929c8f8SmrgEOF
7424929c8f8Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7434929c8f8Smrg                    [have_xmlto_text=yes],
7444929c8f8Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7454929c8f8Smrgrm -f conftest.xml
7464929c8f8SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7474929c8f8SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7484929c8f8Smrg]) # XORG_WITH_XMLTO
7494fb28925Smrg
7504929c8f8Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7514929c8f8Smrg# --------------------------------------------
7524929c8f8Smrg# Minimum version: 1.12.0
7534929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.12.0
754b66d1acbSmrg#
7554929c8f8Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7564929c8f8Smrg# XML-based language used for the transformation of XML documents.
7574929c8f8Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7584929c8f8Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7594929c8f8Smrg# The XSLT processor is often used as a standalone tool for transformations.
7604929c8f8Smrg# It should not be assumed that this tool is used only to work with documnetation.
7614929c8f8Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
762b66d1acbSmrg#
7634929c8f8Smrg# Interface to module:
7644929c8f8Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7654929c8f8Smrg# XSLTPROC:	 returns the path of the xsltproc program found
7664929c8f8Smrg#		 returns the path set by the user in the environment
7674929c8f8Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7684929c8f8Smrg#		  'no' user instructs the module not to use xsltproc
7694929c8f8Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7704929c8f8Smrg#
7714929c8f8Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7724929c8f8Smrg#
7734929c8f8SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7744929c8f8SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7754929c8f8Smrg# Preserves the interface, should it be implemented later
7764929c8f8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7774929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
7784929c8f8SmrgAC_ARG_WITH(xsltproc,
7794929c8f8Smrg	AS_HELP_STRING([--with-xsltproc],
7804929c8f8Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7814929c8f8Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7824929c8f8Smrgm4_undefine([_defopt])
7834fb28925Smrg
7844929c8f8Smrgif test "x$use_xsltproc" = x"auto"; then
7854929c8f8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7864929c8f8Smrg   if test "x$XSLTPROC" = "x"; then
7874929c8f8Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7884929c8f8Smrg	have_xsltproc=no
7894929c8f8Smrg   else
7904929c8f8Smrg        have_xsltproc=yes
7914929c8f8Smrg   fi
7924929c8f8Smrgelif test "x$use_xsltproc" = x"yes" ; then
7934929c8f8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7944929c8f8Smrg   if test "x$XSLTPROC" = "x"; then
7954929c8f8Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7964929c8f8Smrg   fi
7974929c8f8Smrg   have_xsltproc=yes
7984929c8f8Smrgelif test "x$use_xsltproc" = x"no" ; then
7994929c8f8Smrg   if test "x$XSLTPROC" != "x"; then
8004929c8f8Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8014929c8f8Smrg   fi
8024929c8f8Smrg   have_xsltproc=no
803b66d1acbSmrgelse
8044929c8f8Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805b66d1acbSmrgfi
8064fb28925Smrg
8074929c8f8SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8084929c8f8Smrg]) # XORG_WITH_XSLTPROC
809b66d1acbSmrg
8104929c8f8Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8114929c8f8Smrg# ----------------------------------------
8124929c8f8Smrg# Minimum version: 1.15.0
8134fb28925Smrg#
8144929c8f8Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8154929c8f8Smrg# scanning arbitrary text files, extracting information from those text files,
8164929c8f8Smrg# and printing reports based on that information.
817df58931aSmrg#
8184929c8f8Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8194929c8f8Smrg#
8204929c8f8Smrg# Interface to module:
8214929c8f8Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8224929c8f8Smrg# PERL:	     returns the path of the perl program found
8234929c8f8Smrg#	     returns the path set by the user in the environment
8244929c8f8Smrg# --with-perl: 'yes' user instructs the module to use perl
8254929c8f8Smrg#	       'no' user instructs the module not to use perl
8264929c8f8Smrg# have_perl: returns yes if perl found in PATH or no
8274929c8f8Smrg#
8284929c8f8Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8294929c8f8Smrg#
8304929c8f8SmrgAC_DEFUN([XORG_WITH_PERL],[
8314929c8f8SmrgAC_ARG_VAR([PERL], [Path to perl command])
8324929c8f8Smrg# Preserves the interface, should it be implemented later
8334929c8f8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8344929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
8354929c8f8SmrgAC_ARG_WITH(perl,
8364929c8f8Smrg	AS_HELP_STRING([--with-perl],
8374929c8f8Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8384929c8f8Smrg	   [use_perl=$withval], [use_perl=]_defopt)
8394929c8f8Smrgm4_undefine([_defopt])
840df58931aSmrg
8414929c8f8Smrgif test "x$use_perl" = x"auto"; then
8424929c8f8Smrg   AC_PATH_PROG([PERL], [perl])
8434929c8f8Smrg   if test "x$PERL" = "x"; then
8444929c8f8Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8454929c8f8Smrg	have_perl=no
8464929c8f8Smrg   else
8474929c8f8Smrg        have_perl=yes
8484929c8f8Smrg   fi
8494929c8f8Smrgelif test "x$use_perl" = x"yes" ; then
8504929c8f8Smrg   AC_PATH_PROG([PERL], [perl])
8514929c8f8Smrg   if test "x$PERL" = "x"; then
8524929c8f8Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8534929c8f8Smrg   fi
8544929c8f8Smrg   have_perl=yes
8554929c8f8Smrgelif test "x$use_perl" = x"no" ; then
8564929c8f8Smrg   if test "x$PERL" != "x"; then
8574929c8f8Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8584929c8f8Smrg   fi
8594929c8f8Smrg   have_perl=no
8604929c8f8Smrgelse
8614929c8f8Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
862df58931aSmrgfi
863b66d1acbSmrg
8644929c8f8SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8654929c8f8Smrg]) # XORG_WITH_PERL
866df58931aSmrg
8674929c8f8Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8684929c8f8Smrg# ----------------
8694929c8f8Smrg# Minimum version: 1.5.0
8704929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
8714fb28925Smrg#
8724929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
8734929c8f8Smrg# not at the appropriate level. This macro enables a module to test for the
8744929c8f8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
8754929c8f8Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8764929c8f8Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8774929c8f8Smrg# --with-asciidoc assumes 'auto'.
878df58931aSmrg#
8794929c8f8Smrg# Interface to module:
8804929c8f8Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8814929c8f8Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
8824929c8f8Smrg#		 returns the path set by the user in the environment
8834929c8f8Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8844929c8f8Smrg#		  'no' user instructs the module not to use asciidoc
8854929c8f8Smrg#
8864929c8f8Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8874929c8f8Smrg#
8884929c8f8SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8894929c8f8SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8904929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
8914929c8f8SmrgAC_ARG_WITH(asciidoc,
8924929c8f8Smrg	AS_HELP_STRING([--with-asciidoc],
8934929c8f8Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8944929c8f8Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8954929c8f8Smrgm4_undefine([_defopt])
896df58931aSmrg
8974929c8f8Smrgif test "x$use_asciidoc" = x"auto"; then
8984929c8f8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8994929c8f8Smrg   if test "x$ASCIIDOC" = "x"; then
9004929c8f8Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9014929c8f8Smrg	have_asciidoc=no
9024929c8f8Smrg   else
9034929c8f8Smrg        have_asciidoc=yes
9044929c8f8Smrg   fi
9054929c8f8Smrgelif test "x$use_asciidoc" = x"yes" ; then
9064929c8f8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9074929c8f8Smrg   if test "x$ASCIIDOC" = "x"; then
9084929c8f8Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9094929c8f8Smrg   fi
9104929c8f8Smrg   have_asciidoc=yes
9114929c8f8Smrgelif test "x$use_asciidoc" = x"no" ; then
9124929c8f8Smrg   if test "x$ASCIIDOC" != "x"; then
9134929c8f8Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9144929c8f8Smrg   fi
9154929c8f8Smrg   have_asciidoc=no
916b66d1acbSmrgelse
9174929c8f8Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918df58931aSmrgfi
9194929c8f8Smrgm4_ifval([$1],
9204929c8f8Smrg[if test "$have_asciidoc" = yes; then
9214929c8f8Smrg    # scrape the asciidoc version
9224929c8f8Smrg    AC_MSG_CHECKING([the asciidoc version])
9234929c8f8Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9244929c8f8Smrg    AC_MSG_RESULT([$asciidoc_version])
9254929c8f8Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9264929c8f8Smrg        [if test "x$use_asciidoc" = xauto; then
9274929c8f8Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9284929c8f8Smrg            have_asciidoc=no
9294929c8f8Smrg        else
9304929c8f8Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9314929c8f8Smrg        fi])
9324929c8f8Smrgfi])
9334929c8f8SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9344929c8f8Smrg]) # XORG_WITH_ASCIIDOC
935b66d1acbSmrg
9364929c8f8Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9374929c8f8Smrg# -------------------------------------------
9384929c8f8Smrg# Minimum version: 1.5.0
9394929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9404929c8f8Smrg# Minimum version for optional DOT checking: 1.18.0
9414fb28925Smrg#
9424929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
9434929c8f8Smrg# not at the appropriate level. This macro enables a module to test for the
9444929c8f8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9454929c8f8Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9464929c8f8Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9474929c8f8Smrg# --with-doxygen assumes 'auto'.
9484929c8f8Smrg#
9494929c8f8Smrg# Interface to module:
9504929c8f8Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9514929c8f8Smrg# DOXYGEN:	 returns the path of the doxygen program found
9524929c8f8Smrg#		 returns the path set by the user in the environment
9534929c8f8Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9544929c8f8Smrg#		  'no' user instructs the module not to use doxygen
9554929c8f8Smrg#
9564929c8f8Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9574929c8f8Smrg#
9584929c8f8SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9594929c8f8SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9604929c8f8SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9614929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
9624929c8f8SmrgAC_ARG_WITH(doxygen,
9634929c8f8Smrg	AS_HELP_STRING([--with-doxygen],
9644929c8f8Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9654929c8f8Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9664929c8f8Smrgm4_undefine([_defopt])
967b66d1acbSmrg
9684929c8f8Smrgif test "x$use_doxygen" = x"auto"; then
9694929c8f8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9704929c8f8Smrg   if test "x$DOXYGEN" = "x"; then
9714929c8f8Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9724929c8f8Smrg	have_doxygen=no
9734929c8f8Smrg   else
9744929c8f8Smrg        have_doxygen=yes
9754929c8f8Smrg   fi
9764929c8f8Smrgelif test "x$use_doxygen" = x"yes" ; then
9774929c8f8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9784929c8f8Smrg   if test "x$DOXYGEN" = "x"; then
9794929c8f8Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9804929c8f8Smrg   fi
9814929c8f8Smrg   have_doxygen=yes
9824929c8f8Smrgelif test "x$use_doxygen" = x"no" ; then
9834929c8f8Smrg   if test "x$DOXYGEN" != "x"; then
9844929c8f8Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9854929c8f8Smrg   fi
9864929c8f8Smrg   have_doxygen=no
987df58931aSmrgelse
9884929c8f8Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9894929c8f8Smrgfi
9904929c8f8Smrgm4_ifval([$1],
9914929c8f8Smrg[if test "$have_doxygen" = yes; then
9924929c8f8Smrg    # scrape the doxygen version
9934929c8f8Smrg    AC_MSG_CHECKING([the doxygen version])
9944929c8f8Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9954929c8f8Smrg    AC_MSG_RESULT([$doxygen_version])
9964929c8f8Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9974929c8f8Smrg        [if test "x$use_doxygen" = xauto; then
9984929c8f8Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9994929c8f8Smrg            have_doxygen=no
10004929c8f8Smrg        else
10014929c8f8Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10024929c8f8Smrg        fi])
1003df58931aSmrgfi])
10044929c8f8Smrg
10054929c8f8Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10064929c8f8Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10074929c8f8Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10084929c8f8SmrgHAVE_DOT=no
10094929c8f8Smrgif test "x$have_doxygen" = "xyes"; then
10104929c8f8Smrg  AC_PATH_PROG([DOT], [dot])
10114929c8f8Smrg    if test "x$DOT" != "x"; then
10124929c8f8Smrg      HAVE_DOT=yes
10134929c8f8Smrg    fi
1014df58931aSmrgfi
1015b66d1acbSmrg
10164929c8f8SmrgAC_SUBST([HAVE_DOT])
10174929c8f8SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10184929c8f8SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10194929c8f8Smrg]) # XORG_WITH_DOXYGEN
10204929c8f8Smrg
10214929c8f8Smrg# XORG_WITH_GROFF([DEFAULT])
10224929c8f8Smrg# ----------------
10234929c8f8Smrg# Minimum version: 1.6.0
10244929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10254fb28925Smrg#
10264929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
10274929c8f8Smrg# not at the appropriate level. This macro enables a module to test for the
10284929c8f8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10294929c8f8Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
10304929c8f8Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
10314929c8f8Smrg# --with-groff assumes 'auto'.
10324929c8f8Smrg#
10334929c8f8Smrg# Interface to module:
10344929c8f8Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10354929c8f8Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10364929c8f8Smrg# HAVE_GROFF_MS: the -ms macros package
10374929c8f8Smrg# GROFF:	 returns the path of the groff program found
10384929c8f8Smrg#		 returns the path set by the user in the environment
10394929c8f8Smrg# --with-groff:	 'yes' user instructs the module to use groff
10404929c8f8Smrg#		 'no' user instructs the module not to use groff
10414929c8f8Smrg#
10424929c8f8Smrg# Added in version 1.9.0:
10434929c8f8Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10444929c8f8Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10454929c8f8Smrg#		   psselect from the psutils package.
10464929c8f8Smrg#		   the ghostcript package. Refer to the grohtml man pages
10474929c8f8Smrg#
10484929c8f8Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10494929c8f8Smrg#
10504929c8f8Smrg# OS and distros often splits groff in a basic and full package, the former
10514929c8f8Smrg# having the groff program and the later having devices, fonts and macros
10524929c8f8Smrg# Checking for the groff executable is not enough.
10534929c8f8Smrg#
10544929c8f8Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
10554929c8f8Smrg# unset HAVE_GROFF or GROFF env variables.
10564929c8f8Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10574929c8f8Smrg#
10584929c8f8SmrgAC_DEFUN([XORG_WITH_GROFF],[
10594929c8f8SmrgAC_ARG_VAR([GROFF], [Path to groff command])
10604929c8f8Smrgm4_define([_defopt], m4_default([$1], [auto]))
10614929c8f8SmrgAC_ARG_WITH(groff,
10624929c8f8Smrg	AS_HELP_STRING([--with-groff],
10634929c8f8Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10644929c8f8Smrg	   [use_groff=$withval], [use_groff=]_defopt)
10654929c8f8Smrgm4_undefine([_defopt])
10664fb28925Smrg
10674929c8f8Smrgif test "x$use_groff" = x"auto"; then
10684929c8f8Smrg   AC_PATH_PROG([GROFF], [groff])
10694929c8f8Smrg   if test "x$GROFF" = "x"; then
10704929c8f8Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10714929c8f8Smrg	have_groff=no
10724929c8f8Smrg   else
10734929c8f8Smrg        have_groff=yes
10744929c8f8Smrg   fi
10754929c8f8Smrgelif test "x$use_groff" = x"yes" ; then
10764929c8f8Smrg   AC_PATH_PROG([GROFF], [groff])
10774929c8f8Smrg   if test "x$GROFF" = "x"; then
10784929c8f8Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10794929c8f8Smrg   fi
10804929c8f8Smrg   have_groff=yes
10814929c8f8Smrgelif test "x$use_groff" = x"no" ; then
10824929c8f8Smrg   if test "x$GROFF" != "x"; then
10834929c8f8Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10844929c8f8Smrg   fi
10854929c8f8Smrg   have_groff=no
10864929c8f8Smrgelse
10874929c8f8Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1088b66d1acbSmrgfi
10894fb28925Smrg
10904929c8f8Smrg# We have groff, test for the presence of the macro packages
10914929c8f8Smrgif test "x$have_groff" = x"yes"; then
10924929c8f8Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10934929c8f8Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10944929c8f8Smrg        groff_ms_works=yes
10954929c8f8Smrg    else
10964929c8f8Smrg        groff_ms_works=no
10974929c8f8Smrg    fi
10984929c8f8Smrg    AC_MSG_RESULT([$groff_ms_works])
10994929c8f8Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11004929c8f8Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11014929c8f8Smrg        groff_mm_works=yes
11024929c8f8Smrg    else
11034929c8f8Smrg        groff_mm_works=no
11044929c8f8Smrg    fi
11054929c8f8Smrg    AC_MSG_RESULT([$groff_mm_works])
11064929c8f8Smrgfi
11074fb28925Smrg
11084929c8f8Smrg# We have groff, test for HTML dependencies, one command per package
11094929c8f8Smrgif test "x$have_groff" = x"yes"; then
11104929c8f8Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11114929c8f8Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11124929c8f8Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11134929c8f8Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11144929c8f8Smrg      have_groff_html=yes
11154929c8f8Smrg   else
11164929c8f8Smrg      have_groff_html=no
11174929c8f8Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11184929c8f8Smrg   fi
11194929c8f8Smrgfi
11204fb28925Smrg
11214929c8f8Smrg# Set Automake conditionals for Makefiles
11224929c8f8SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11234929c8f8SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11244929c8f8SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11254929c8f8SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11264929c8f8Smrg]) # XORG_WITH_GROFF
11274fb28925Smrg
11284929c8f8Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11294929c8f8Smrg# ---------------------------------------
11304929c8f8Smrg# Minimum version: 1.6.0
11314929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11324929c8f8Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1133b66d1acbSmrg#
11344929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
11354929c8f8Smrg# not at the appropriate level. This macro enables a module to test for the
11364929c8f8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11374929c8f8Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
11384929c8f8Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
11394929c8f8Smrg# --with-fop assumes 'auto'.
1140b66d1acbSmrg#
11414929c8f8Smrg# Interface to module:
11424929c8f8Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11434929c8f8Smrg# FOP:	 	returns the path of the fop program found
11444929c8f8Smrg#		returns the path set by the user in the environment
11454929c8f8Smrg# --with-fop: 	'yes' user instructs the module to use fop
11464929c8f8Smrg#		'no' user instructs the module not to use fop
1147b66d1acbSmrg#
11484929c8f8Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149df58931aSmrg#
11504929c8f8SmrgAC_DEFUN([XORG_WITH_FOP],[
11514929c8f8SmrgAC_ARG_VAR([FOP], [Path to fop command])
11524929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
11534929c8f8SmrgAC_ARG_WITH(fop,
11544929c8f8Smrg	AS_HELP_STRING([--with-fop],
11554929c8f8Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11564929c8f8Smrg	   [use_fop=$withval], [use_fop=]_defopt)
11574929c8f8Smrgm4_undefine([_defopt])
1158df58931aSmrg
11594929c8f8Smrgif test "x$use_fop" = x"auto"; then
11604929c8f8Smrg   AC_PATH_PROG([FOP], [fop])
11614929c8f8Smrg   if test "x$FOP" = "x"; then
11624929c8f8Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11634929c8f8Smrg	have_fop=no
11644929c8f8Smrg   else
11654929c8f8Smrg        have_fop=yes
11664929c8f8Smrg   fi
11674929c8f8Smrgelif test "x$use_fop" = x"yes" ; then
11684929c8f8Smrg   AC_PATH_PROG([FOP], [fop])
11694929c8f8Smrg   if test "x$FOP" = "x"; then
11704929c8f8Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11714929c8f8Smrg   fi
11724929c8f8Smrg   have_fop=yes
11734929c8f8Smrgelif test "x$use_fop" = x"no" ; then
11744929c8f8Smrg   if test "x$FOP" != "x"; then
11754929c8f8Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11764929c8f8Smrg   fi
11774929c8f8Smrg   have_fop=no
11784929c8f8Smrgelse
11794929c8f8Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11804929c8f8Smrgfi
11814fb28925Smrg
11824929c8f8Smrg# Test for a minimum version of fop, if provided.
11834929c8f8Smrgm4_ifval([$1],
11844929c8f8Smrg[if test "$have_fop" = yes; then
11854929c8f8Smrg    # scrape the fop version
11864929c8f8Smrg    AC_MSG_CHECKING([for fop minimum version])
11874929c8f8Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11884929c8f8Smrg    AC_MSG_RESULT([$fop_version])
11894929c8f8Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
11904929c8f8Smrg        [if test "x$use_fop" = xauto; then
11914929c8f8Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11924929c8f8Smrg            have_fop=no
11934929c8f8Smrg        else
11944929c8f8Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11954929c8f8Smrg        fi])
11964929c8f8Smrgfi])
11974929c8f8SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11984929c8f8Smrg]) # XORG_WITH_FOP
1199df58931aSmrg
12004929c8f8Smrg# XORG_WITH_M4([MIN-VERSION])
12014929c8f8Smrg# ---------------------------
12024929c8f8Smrg# Minimum version: 1.19.0
12034929c8f8Smrg#
12044929c8f8Smrg# This macro attempts to locate an m4 macro processor which supports
12054929c8f8Smrg# -I option and is only useful for modules relying on M4 in order to
12064929c8f8Smrg# expand macros in source code files.
12074929c8f8Smrg#
12084929c8f8Smrg# Interface to module:
12094929c8f8Smrg# M4:	 	returns the path of the m4 program found
12104929c8f8Smrg#		returns the path set by the user in the environment
12114929c8f8Smrg#
12124929c8f8SmrgAC_DEFUN([XORG_WITH_M4], [
12134929c8f8SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12144929c8f8Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12154929c8f8Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12164929c8f8Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12174929c8f8Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12184929c8f8Smrg   [$PATH:/usr/gnu/bin])])
1219df58931aSmrg
12204929c8f8SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12214929c8f8Smrg]) # XORG_WITH_M4
1222b66d1acbSmrg
12234929c8f8Smrg# XORG_WITH_PS2PDF([DEFAULT])
12244929c8f8Smrg# ----------------
12254929c8f8Smrg# Minimum version: 1.6.0
12264929c8f8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1227b66d1acbSmrg#
12284929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
12294929c8f8Smrg# not at the appropriate level. This macro enables a module to test for the
12304929c8f8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12314929c8f8Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12324929c8f8Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12334929c8f8Smrg# --with-ps2pdf assumes 'auto'.
1234b66d1acbSmrg#
12354929c8f8Smrg# Interface to module:
12364929c8f8Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12374929c8f8Smrg# PS2PDF:	returns the path of the ps2pdf program found
12384929c8f8Smrg#		returns the path set by the user in the environment
12394929c8f8Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12404929c8f8Smrg#		 'no' user instructs the module not to use ps2pdf
1241b66d1acbSmrg#
12424929c8f8Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243b66d1acbSmrg#
12444929c8f8SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12454929c8f8SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12464929c8f8Smrgm4_define([_defopt], m4_default([$1], [auto]))
12474929c8f8SmrgAC_ARG_WITH(ps2pdf,
12484929c8f8Smrg	AS_HELP_STRING([--with-ps2pdf],
12494929c8f8Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12504929c8f8Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12514929c8f8Smrgm4_undefine([_defopt])
12524fb28925Smrg
12534929c8f8Smrgif test "x$use_ps2pdf" = x"auto"; then
12544929c8f8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12554929c8f8Smrg   if test "x$PS2PDF" = "x"; then
12564929c8f8Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12574929c8f8Smrg	have_ps2pdf=no
12584929c8f8Smrg   else
12594929c8f8Smrg        have_ps2pdf=yes
12604929c8f8Smrg   fi
12614929c8f8Smrgelif test "x$use_ps2pdf" = x"yes" ; then
12624929c8f8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12634929c8f8Smrg   if test "x$PS2PDF" = "x"; then
12644929c8f8Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12654929c8f8Smrg   fi
12664929c8f8Smrg   have_ps2pdf=yes
12674929c8f8Smrgelif test "x$use_ps2pdf" = x"no" ; then
12684929c8f8Smrg   if test "x$PS2PDF" != "x"; then
12694929c8f8Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12704929c8f8Smrg   fi
12714929c8f8Smrg   have_ps2pdf=no
12724929c8f8Smrgelse
12734929c8f8Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12744fb28925Smrgfi
12754929c8f8SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12764929c8f8Smrg]) # XORG_WITH_PS2PDF
12774fb28925Smrg
12784929c8f8Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
12794929c8f8Smrg# ----------------
12804929c8f8Smrg# Minimum version: 1.6.0
1281b66d1acbSmrg#
12824929c8f8Smrg# Documentation tools are not always available on all platforms and sometimes
12834929c8f8Smrg# not at the appropriate level. This macro enables a builder to skip all
12844929c8f8Smrg# documentation targets except traditional man pages.
12854929c8f8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12864929c8f8Smrg# maximum flexibilty in controlling documentation building.
12874929c8f8Smrg# Refer to:
12884929c8f8Smrg# XORG_WITH_XMLTO         --with-xmlto
12894929c8f8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12904929c8f8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
12914929c8f8Smrg# XORG_WITH_FOP           --with-fop
12924929c8f8Smrg# XORG_WITH_GROFF         --with-groff
12934929c8f8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294df58931aSmrg#
12954929c8f8Smrg# Interface to module:
12964929c8f8Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12974929c8f8Smrg# --enable-docs: 'yes' user instructs the module to generate docs
12984929c8f8Smrg#		 'no' user instructs the module not to generate docs
12994929c8f8Smrg# parm1:	specify the default value, yes or no.
1300df58931aSmrg#
13014929c8f8SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13024929c8f8Smrgm4_define([docs_default], m4_default([$1], [yes]))
13034929c8f8SmrgAC_ARG_ENABLE(docs,
13044929c8f8Smrg	AS_HELP_STRING([--enable-docs],
13054929c8f8Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13064929c8f8Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13074929c8f8Smrgm4_undefine([docs_default])
13084929c8f8SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13094929c8f8SmrgAC_MSG_CHECKING([whether to build documentation])
13104929c8f8SmrgAC_MSG_RESULT([$build_docs])
13114929c8f8Smrg]) # XORG_ENABLE_DOCS
1312df58931aSmrg
13134929c8f8Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13144929c8f8Smrg# ----------------
13154929c8f8Smrg# Minimum version: 1.6.0
1316df58931aSmrg#
13174929c8f8Smrg# This macro enables a builder to skip all developer documentation.
13184929c8f8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13194929c8f8Smrg# maximum flexibilty in controlling documentation building.
13204929c8f8Smrg# Refer to:
13214929c8f8Smrg# XORG_WITH_XMLTO         --with-xmlto
13224929c8f8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13234929c8f8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13244929c8f8Smrg# XORG_WITH_FOP           --with-fop
13254929c8f8Smrg# XORG_WITH_GROFF         --with-groff
13264929c8f8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1327df58931aSmrg#
13284929c8f8Smrg# Interface to module:
13294929c8f8Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13304929c8f8Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13314929c8f8Smrg#			'no' user instructs the module not to generate developer docs
13324929c8f8Smrg# parm1:		specify the default value, yes or no.
1333df58931aSmrg#
13344929c8f8SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13354929c8f8Smrgm4_define([devel_default], m4_default([$1], [yes]))
13364929c8f8SmrgAC_ARG_ENABLE(devel-docs,
13374929c8f8Smrg	AS_HELP_STRING([--enable-devel-docs],
13384929c8f8Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13394929c8f8Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13404929c8f8Smrgm4_undefine([devel_default])
13414929c8f8SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13424929c8f8SmrgAC_MSG_CHECKING([whether to build developer documentation])
13434929c8f8SmrgAC_MSG_RESULT([$build_devel_docs])
13444929c8f8Smrg]) # XORG_ENABLE_DEVEL_DOCS
1345df58931aSmrg
13464929c8f8Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
13474929c8f8Smrg# ----------------
13484929c8f8Smrg# Minimum version: 1.6.0
13494929c8f8Smrg#
13504929c8f8Smrg# This macro enables a builder to skip all functional specification targets.
13514929c8f8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13524929c8f8Smrg# maximum flexibilty in controlling documentation building.
13534929c8f8Smrg# Refer to:
13544929c8f8Smrg# XORG_WITH_XMLTO         --with-xmlto
13554929c8f8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13564929c8f8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13574929c8f8Smrg# XORG_WITH_FOP           --with-fop
13584929c8f8Smrg# XORG_WITH_GROFF         --with-groff
13594929c8f8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13604929c8f8Smrg#
13614929c8f8Smrg# Interface to module:
13624929c8f8Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13634929c8f8Smrg# --enable-specs:	'yes' user instructs the module to generate specs
13644929c8f8Smrg#			'no' user instructs the module not to generate specs
13654929c8f8Smrg# parm1:		specify the default value, yes or no.
13664929c8f8Smrg#
13674929c8f8SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13684929c8f8Smrgm4_define([spec_default], m4_default([$1], [yes]))
13694929c8f8SmrgAC_ARG_ENABLE(specs,
13704929c8f8Smrg	AS_HELP_STRING([--enable-specs],
13714929c8f8Smrg	   [Enable building the specs (default: ]spec_default[)]),
13724929c8f8Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
13734929c8f8Smrgm4_undefine([spec_default])
13744929c8f8SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13754929c8f8SmrgAC_MSG_CHECKING([whether to build functional specifications])
13764929c8f8SmrgAC_MSG_RESULT([$build_specs])
13774929c8f8Smrg]) # XORG_ENABLE_SPECS
1378df58931aSmrg
13794929c8f8Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13804929c8f8Smrg# ----------------------------------------------
13814929c8f8Smrg# Minimum version: 1.13.0
13824929c8f8Smrg#
13834929c8f8Smrg# This macro enables a builder to enable/disable unit testing
13844929c8f8Smrg# It makes no assumption about the test cases implementation
13854929c8f8Smrg# Test cases may or may not use Automake "Support for test suites"
13864929c8f8Smrg# They may or may not use the software utility library GLib
13874929c8f8Smrg#
13884929c8f8Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13894929c8f8Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13904929c8f8Smrg# The variable enable_unit_tests is used by other macros in this file.
13914929c8f8Smrg#
13924929c8f8Smrg# Interface to module:
13934929c8f8Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13944929c8f8Smrg# enable_unit_tests:    used in configure.ac for additional configuration
13954929c8f8Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13964929c8f8Smrg#			'no' user instructs the module not to build tests
13974929c8f8Smrg# parm1:		specify the default value, yes or no.
13984929c8f8Smrg#
13994929c8f8SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14004929c8f8SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14014929c8f8SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14024929c8f8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14034929c8f8Smrgm4_define([_defopt], m4_default([$1], [auto]))
14044929c8f8SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14054929c8f8Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14064929c8f8Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14074929c8f8Smrgm4_undefine([_defopt])
14084929c8f8SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14094929c8f8SmrgAC_MSG_CHECKING([whether to build unit test cases])
14104929c8f8SmrgAC_MSG_RESULT([$enable_unit_tests])
14114929c8f8Smrg]) # XORG_ENABLE_UNIT_TESTS
1412df58931aSmrg
14134929c8f8Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14144929c8f8Smrg# ------------------------------------------------------
14154929c8f8Smrg# Minimum version: 1.17.0
1416df58931aSmrg#
14174929c8f8Smrg# This macro enables a builder to enable/disable integration testing
14184929c8f8Smrg# It makes no assumption about the test cases' implementation
14194929c8f8Smrg# Test cases may or may not use Automake "Support for test suites"
1420df58931aSmrg#
14214929c8f8Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14224929c8f8Smrg# usually requires less dependencies and may be built and run under less
14234929c8f8Smrg# stringent environments than integration tests.
1424df58931aSmrg#
14254929c8f8Smrg# Interface to module:
14264929c8f8Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14274929c8f8Smrg# enable_integration_tests:   used in configure.ac for additional configuration
14284929c8f8Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14294929c8f8Smrg#                             'no' user instructs the module not to build tests
14304929c8f8Smrg# parm1:                      specify the default value, yes or no.
1431df58931aSmrg#
14324929c8f8SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14334929c8f8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14344929c8f8Smrgm4_define([_defopt], m4_default([$1], [auto]))
14354929c8f8SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14364929c8f8Smrg	[Enable building integration test cases (default: ]_defopt[)]),
14374929c8f8Smrg	[enable_integration_tests=$enableval],
14384929c8f8Smrg	[enable_integration_tests=]_defopt)
14394929c8f8Smrgm4_undefine([_defopt])
14404929c8f8SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14414929c8f8Smrg	[test "x$enable_integration_tests" != xno])
14424929c8f8SmrgAC_MSG_CHECKING([whether to build unit test cases])
14434929c8f8SmrgAC_MSG_RESULT([$enable_integration_tests])
14444929c8f8Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445df58931aSmrg
14464929c8f8Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14474929c8f8Smrg# ----------------------------------------
14484929c8f8Smrg# Minimum version: 1.13.0
1449df58931aSmrg#
14504929c8f8Smrg# GLib is a library which provides advanced data structures and functions.
14514929c8f8Smrg# This macro enables a module to test for the presence of Glib.
14524929c8f8Smrg#
14534929c8f8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14544929c8f8Smrg# Otherwise the value of $enable_unit_tests is blank.
14554929c8f8Smrg#
14564929c8f8Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14574929c8f8Smrg# test support usually requires less dependencies and may be built and run under
14584929c8f8Smrg# less stringent environments than integration tests.
14594929c8f8Smrg#
14604929c8f8Smrg# Interface to module:
14614929c8f8Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
14624929c8f8Smrg# with_glib: used in configure.ac to know if GLib has been found
14634929c8f8Smrg# --with-glib:	'yes' user instructs the module to use glib
14644929c8f8Smrg#		'no' user instructs the module not to use glib
14654929c8f8Smrg#
14664929c8f8SmrgAC_DEFUN([XORG_WITH_GLIB],[
14674929c8f8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14684929c8f8Smrgm4_define([_defopt], m4_default([$2], [auto]))
14694929c8f8SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14704929c8f8Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14714929c8f8Smrg	[with_glib=$withval], [with_glib=]_defopt)
14724929c8f8Smrgm4_undefine([_defopt])
1473df58931aSmrg
14744929c8f8Smrghave_glib=no
14754929c8f8Smrg# Do not probe GLib if user explicitly disabled unit testing
14764929c8f8Smrgif test "x$enable_unit_tests" != x"no"; then
14774929c8f8Smrg  # Do not probe GLib if user explicitly disabled it
14784929c8f8Smrg  if test "x$with_glib" != x"no"; then
14794929c8f8Smrg    m4_ifval(
14804929c8f8Smrg      [$1],
14814929c8f8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14824929c8f8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14834929c8f8Smrg    )
14844929c8f8Smrg  fi
1485df58931aSmrgfi
1486df58931aSmrg
14874929c8f8Smrg# Not having GLib when unit testing has been explicitly requested is an error
14884929c8f8Smrgif test "x$enable_unit_tests" = x"yes"; then
14894929c8f8Smrg  if test "x$have_glib" = x"no"; then
14904929c8f8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14914929c8f8Smrg  fi
1492df58931aSmrgfi
1493df58931aSmrg
14944929c8f8Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
14954929c8f8Smrgif test "x$enable_unit_tests" = x"no"; then
14964929c8f8Smrg  if test "x$with_glib" = x"yes"; then
14974929c8f8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14984929c8f8Smrg  fi
14994929c8f8Smrgfi
1500df58931aSmrg
15014929c8f8Smrg# Not having GLib when it has been explicitly requested is an error
15024929c8f8Smrgif test "x$with_glib" = x"yes"; then
15034929c8f8Smrg  if test "x$have_glib" = x"no"; then
15044929c8f8Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15054929c8f8Smrg  fi
15064fb28925Smrgfi
15074fb28925Smrg
15084929c8f8SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15094929c8f8Smrg]) # XORG_WITH_GLIB
15104fb28925Smrg
15114929c8f8Smrg# XORG_LD_WRAP([required|optional])
15124929c8f8Smrg# ---------------------------------
15134929c8f8Smrg# Minimum version: 1.13.0
15144929c8f8Smrg#
15154929c8f8Smrg# Check if linker supports -wrap, passed via compiler flags
15164929c8f8Smrg#
15174929c8f8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15184929c8f8Smrg# Otherwise the value of $enable_unit_tests is blank.
15194929c8f8Smrg#
15204929c8f8Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15214929c8f8Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15224929c8f8Smrg# available, an argument of "optional" allows use when some unit tests require
15234929c8f8Smrg# ld -wrap and others do not.
15244929c8f8Smrg#
15254929c8f8SmrgAC_DEFUN([XORG_LD_WRAP],[
15264929c8f8SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15274929c8f8Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15284929c8f8Smrg                      void __wrap_exit(int status) { return; }],
15294929c8f8Smrg                     [exit(0);])])
15304929c8f8Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
15314929c8f8Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15324929c8f8Smrg  if test "x$have_ld_wrap" = x"no"; then
15334929c8f8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15344929c8f8Smrg  fi
15354fb28925Smrgfi
15364929c8f8SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15374929c8f8Smrg#
15384929c8f8Smrg]) # XORG_LD_WRAP
15394fb28925Smrg
15404929c8f8Smrg# XORG_CHECK_LINKER_FLAGS
15414929c8f8Smrg# -----------------------
15424929c8f8Smrg# SYNOPSIS
15434929c8f8Smrg#
15444929c8f8Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15454929c8f8Smrg#
15464929c8f8Smrg# DESCRIPTION
15474929c8f8Smrg#
15484929c8f8Smrg#   Check whether the given linker FLAGS work with the current language's
15494929c8f8Smrg#   linker, or whether they give an error.
15504929c8f8Smrg#
15514929c8f8Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15524929c8f8Smrg#   success/failure.
15534929c8f8Smrg#
15544929c8f8Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
15554929c8f8Smrg#
15564929c8f8Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15574929c8f8Smrg#
15584929c8f8Smrg# LICENSE
15594929c8f8Smrg#
15604929c8f8Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15614929c8f8Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15624929c8f8Smrg#   Copyright (c) 2009 Matteo Frigo
15634929c8f8Smrg#
15644929c8f8Smrg#   This program is free software: you can redistribute it and/or modify it
15654929c8f8Smrg#   under the terms of the GNU General Public License as published by the
15664929c8f8Smrg#   Free Software Foundation, either version 3 of the License, or (at your
15674929c8f8Smrg#   option) any later version.
15684929c8f8Smrg#
15694929c8f8Smrg#   This program is distributed in the hope that it will be useful, but
15704929c8f8Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15714929c8f8Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15724929c8f8Smrg#   Public License for more details.
15734929c8f8Smrg#
15744929c8f8Smrg#   You should have received a copy of the GNU General Public License along
15754929c8f8Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15764929c8f8Smrg#
15774929c8f8Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
15784929c8f8Smrg#   gives unlimited permission to copy, distribute and modify the configure
15794929c8f8Smrg#   scripts that are the output of Autoconf when processing the Macro. You
15804929c8f8Smrg#   need not follow the terms of the GNU General Public License when using
15814929c8f8Smrg#   or distributing such scripts, even though portions of the text of the
15824929c8f8Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15834929c8f8Smrg#   all other use of the material that constitutes the Autoconf Macro.
15844929c8f8Smrg#
15854929c8f8Smrg#   This special exception to the GPL applies to versions of the Autoconf
15864929c8f8Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
15874929c8f8Smrg#   modified version of the Autoconf Macro, you may extend this special
15884929c8f8Smrg#   exception to the GPL to apply to your modified version as well.#
15894929c8f8SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15904929c8f8Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
15914929c8f8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15924929c8f8SmrgAS_LITERAL_IF([$1],
15934929c8f8Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15944929c8f8Smrg      ax_save_FLAGS=$LDFLAGS
15954929c8f8Smrg      LDFLAGS="$1"
15964929c8f8Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15974929c8f8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15984929c8f8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15994929c8f8Smrg      LDFLAGS=$ax_save_FLAGS])],
16004929c8f8Smrg  [ax_save_FLAGS=$LDFLAGS
16014929c8f8Smrg   LDFLAGS="$1"
16024929c8f8Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16034929c8f8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16044929c8f8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16054929c8f8Smrg   LDFLAGS=$ax_save_FLAGS])
16064929c8f8Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16074929c8f8SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16084929c8f8Smrgif test "x$xorg_check_linker_flags" = xyes; then
16094929c8f8Smrg	m4_default([$2], :)
16104929c8f8Smrgelse
16114929c8f8Smrg	m4_default([$3], :)
16124fb28925Smrgfi
16134929c8f8Smrg]) # XORG_CHECK_LINKER_FLAGS
16144fb28925Smrg
16154929c8f8Smrg# XORG_MEMORY_CHECK_FLAGS
16164929c8f8Smrg# -----------------------
16174929c8f8Smrg# Minimum version: 1.16.0
16184929c8f8Smrg#
16194929c8f8Smrg# This macro attempts to find appropriate memory checking functionality
16204929c8f8Smrg# for various platforms which unit testing code may use to catch various
16214929c8f8Smrg# forms of memory allocation and access errors in testing.
16224929c8f8Smrg#
16234929c8f8Smrg# Interface to module:
16244929c8f8Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16254929c8f8Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16264929c8f8Smrg#
16274929c8f8Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16284929c8f8Smrg#
16294929c8f8SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16304fb28925Smrg
16314929c8f8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16324929c8f8SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16334929c8f8Smrg           [Environment variables to enable memory checking in tests])
16344fb28925Smrg
16354929c8f8Smrg# Check for different types of support on different platforms
16364929c8f8Smrgcase $host_os in
16374929c8f8Smrg    solaris*)
16384929c8f8Smrg        AC_CHECK_LIB([umem], [umem_alloc],
16394929c8f8Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16404929c8f8Smrg        ;;
16414929c8f8Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16424929c8f8Smrg        # both directly and inverted, so should not be 0 or 255.
16434929c8f8Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
16444929c8f8Smrg        ;;
16454929c8f8Smrg    darwin*)
16464929c8f8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16474929c8f8Smrg        ;;
16484929c8f8Smrg    *bsd*)
16494929c8f8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16504929c8f8Smrg        ;;
16514929c8f8Smrgesac
1652df58931aSmrg
16534929c8f8Smrg# User supplied flags override default flags
16544929c8f8Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16554929c8f8Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1656df58931aSmrgfi
1657df58931aSmrg
16584929c8f8SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16594929c8f8Smrg]) # XORG_WITH_LINT
1660df58931aSmrg
16614929c8f8Smrg# XORG_CHECK_MALLOC_ZERO
16624929c8f8Smrg# ----------------------
1663b66d1acbSmrg# Minimum version: 1.0.0
1664b66d1acbSmrg#
16654929c8f8Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16664929c8f8Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16674929c8f8Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16684929c8f8SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16694929c8f8SmrgAC_ARG_ENABLE(malloc0returnsnull,
16704929c8f8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16714929c8f8Smrg		       [malloc(0) returns NULL (default: auto)]),
16724929c8f8Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16734929c8f8Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16744fb28925Smrg
16754929c8f8SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16764929c8f8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16774929c8f8SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16784929c8f8Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16794929c8f8Smrg#include <stdlib.h>
16804929c8f8Smrg],[
16814929c8f8Smrg    char *m0, *r0, *c0, *p;
16824929c8f8Smrg    m0 = malloc(0);
16834929c8f8Smrg    p = malloc(10);
16844929c8f8Smrg    r0 = realloc(p,0);
16854929c8f8Smrg    c0 = calloc(0,10);
16864929c8f8Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16874929c8f8Smrg])],
16884929c8f8Smrg		[xorg_cv_malloc0_returns_null=yes],
16894929c8f8Smrg		[xorg_cv_malloc0_returns_null=no])])
16904929c8f8SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16914fb28925Smrgfi
16924929c8f8SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16934fb28925Smrg
16944929c8f8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16954929c8f8Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16964929c8f8Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16974929c8f8Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16984fb28925Smrgelse
16994929c8f8Smrg	MALLOC_ZERO_CFLAGS=""
17004929c8f8Smrg	XMALLOC_ZERO_CFLAGS=""
17014929c8f8Smrg	XTMALLOC_ZERO_CFLAGS=""
17024fb28925Smrgfi
17034fb28925Smrg
17044929c8f8SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17054929c8f8SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17064929c8f8SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17074929c8f8Smrg]) # XORG_CHECK_MALLOC_ZERO
17084fb28925Smrg
17094929c8f8Smrg# XORG_WITH_LINT()
17104929c8f8Smrg# ----------------
17114929c8f8Smrg# Minimum version: 1.1.0
1712b66d1acbSmrg#
17134929c8f8Smrg# This macro enables the use of a tool that flags some suspicious and
17144929c8f8Smrg# non-portable constructs (likely to be bugs) in C language source code.
17154929c8f8Smrg# It will attempt to locate the tool and use appropriate options.
17164929c8f8Smrg# There are various lint type tools on different platforms.
17174929c8f8Smrg#
17184929c8f8Smrg# Interface to module:
17194929c8f8Smrg# LINT:		returns the path to the tool found on the platform
17204929c8f8Smrg#		or the value set to LINT on the configure cmd line
17214929c8f8Smrg#		also an Automake conditional
17224929c8f8Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17234929c8f8Smrg#
17244929c8f8Smrg# --with-lint:	'yes' user instructs the module to use lint
17254929c8f8Smrg#		'no' user instructs the module not to use lint (default)
17264929c8f8Smrg#
17274929c8f8Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17284929c8f8Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17294929c8f8Smrg#
17304929c8f8SmrgAC_DEFUN([XORG_WITH_LINT],[
1731b66d1acbSmrg
17324929c8f8SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17334929c8f8SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17344929c8f8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17354929c8f8Smrg		[Use a lint-style source code checker (default: disabled)])],
17364929c8f8Smrg		[use_lint=$withval], [use_lint=no])
1737b66d1acbSmrg
17384929c8f8Smrg# Obtain platform specific info like program name and options
17394929c8f8Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17404929c8f8Smrgcase $host_os in
17414929c8f8Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17424929c8f8Smrg	lint_name=splint
17434929c8f8Smrg	lint_options="-badflag"
17444929c8f8Smrg	;;
17454929c8f8Smrg  *freebsd* | *netbsd*)
17464929c8f8Smrg	lint_name=lint
17474929c8f8Smrg	lint_options="-u -b"
17484929c8f8Smrg	;;
17494929c8f8Smrg  *solaris*)
17504929c8f8Smrg	lint_name=lint
17514929c8f8Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17524929c8f8Smrg	;;
17534929c8f8Smrgesac
1754b66d1acbSmrg
17554929c8f8Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17564929c8f8Smrgif test "x$use_lint" = x"yes" ; then
17574929c8f8Smrg   AC_PATH_PROG([LINT], [$lint_name])
17584929c8f8Smrg   if test "x$LINT" = "x"; then
17594929c8f8Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17604929c8f8Smrg   fi
17614929c8f8Smrgelif test "x$use_lint" = x"no" ; then
17624929c8f8Smrg   if test "x$LINT" != "x"; then
17634929c8f8Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17644929c8f8Smrg   fi
17654929c8f8Smrgelse
17664929c8f8Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1767df58931aSmrgfi
1768df58931aSmrg
17694929c8f8Smrg# User supplied flags override default flags
17704929c8f8Smrgif test "x$LINT_FLAGS" != "x"; then
17714929c8f8Smrg   lint_options=$LINT_FLAGS
1772df58931aSmrgfi
1773df58931aSmrg
17744929c8f8SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17754929c8f8SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776df58931aSmrg
17774929c8f8Smrg]) # XORG_WITH_LINT
1778df58931aSmrg
17794929c8f8Smrg# XORG_LINT_LIBRARY(LIBNAME)
17804929c8f8Smrg# --------------------------
17814929c8f8Smrg# Minimum version: 1.1.0
1782df58931aSmrg#
17834929c8f8Smrg# Sets up flags for building lint libraries for checking programs that call
17844929c8f8Smrg# functions in the library.
1785df58931aSmrg#
1786df58931aSmrg# Interface to module:
17874929c8f8Smrg# LINTLIB		- Automake variable with the name of lint library file to make
17884929c8f8Smrg# MAKE_LINT_LIB		- Automake conditional
1789df58931aSmrg#
17904929c8f8Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17914929c8f8Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1792df58931aSmrg
17934929c8f8SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17944929c8f8SmrgAC_REQUIRE([XORG_WITH_LINT])
17954929c8f8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17964929c8f8Smrg	[Create lint library (default: disabled)])],
17974929c8f8Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17984929c8f8Smrg
17994929c8f8Smrgif test "x$make_lint_lib" = x"yes" ; then
18004929c8f8Smrg   LINTLIB=llib-l$1.ln
18014929c8f8Smrg   if test "x$LINT" = "x"; then
18024929c8f8Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1803df58931aSmrg   fi
18044929c8f8Smrgelif test "x$make_lint_lib" != x"no" ; then
18054929c8f8Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1806df58931aSmrgfi
1807df58931aSmrg
18084929c8f8SmrgAC_SUBST(LINTLIB)
18094929c8f8SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1810df58931aSmrg
18114929c8f8Smrg]) # XORG_LINT_LIBRARY
1812df58931aSmrg
18134929c8f8Smrg# XORG_COMPILER_BRAND
18144929c8f8Smrg# -------------------
18154929c8f8Smrg# Minimum version: 1.14.0
1816df58931aSmrg#
18174929c8f8Smrg# Checks for various brands of compilers and sets flags as appropriate:
18184929c8f8Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18194929c8f8Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18204929c8f8Smrg#   clang compiler - sets CLANGCC to "yes"
18214929c8f8Smrg#   Intel compiler - sets INTELCC to "yes"
18224929c8f8Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823df58931aSmrg#
18244929c8f8SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18254929c8f8SmrgAC_LANG_CASE(
18264929c8f8Smrg	[C], [
18274929c8f8Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18284929c8f8Smrg	],
18294929c8f8Smrg	[C++], [
18304929c8f8Smrg		AC_REQUIRE([AC_PROG_CXX])
18314929c8f8Smrg	]
18324929c8f8Smrg)
18334929c8f8SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18344929c8f8SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18354929c8f8SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18364929c8f8Smrg]) # XORG_COMPILER_BRAND
18374929c8f8Smrg
18384929c8f8Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18394929c8f8Smrg# ---------------
18404929c8f8Smrg# Minimum version: 1.16.0
1841df58931aSmrg#
18424929c8f8Smrg# Test if the compiler works when passed the given flag as a command line argument.
18434929c8f8Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18444929c8f8Smrg# next flag in the list until there are no more options.
1845df58931aSmrg#
18464929c8f8Smrg# Note that this does not guarantee that the compiler supports the flag as some
18474929c8f8Smrg# compilers will simply ignore arguments that they do not understand, but we do
18484929c8f8Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18494929c8f8Smrg# -Werror=unused-command-line-argument
18504929c8f8Smrg#
18514929c8f8SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18524929c8f8Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18534929c8f8Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854df58931aSmrg
18554929c8f8SmrgAC_LANG_COMPILER_REQUIRE
1856df58931aSmrg
18574929c8f8SmrgAC_LANG_CASE(
18584929c8f8Smrg	[C], [
18594929c8f8Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18604929c8f8Smrg		define([PREFIX], [C])
18614929c8f8Smrg		define([CACHE_PREFIX], [cc])
18624929c8f8Smrg		define([COMPILER], [$CC])
18634929c8f8Smrg	],
18644929c8f8Smrg	[C++], [
18654929c8f8Smrg		define([PREFIX], [CXX])
18664929c8f8Smrg		define([CACHE_PREFIX], [cxx])
18674929c8f8Smrg		define([COMPILER], [$CXX])
18684929c8f8Smrg	]
18694929c8f8Smrg)
1870df58931aSmrg
18714929c8f8Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1872df58931aSmrg
18734929c8f8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18744929c8f8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18754929c8f8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18764929c8f8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18774929c8f8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18784929c8f8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18794929c8f8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18804929c8f8Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18814929c8f8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882df58931aSmrgfi
1883df58931aSmrg
18844929c8f8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18854929c8f8Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18864929c8f8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18874929c8f8Smrg	fi
18884929c8f8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18894929c8f8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18904929c8f8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18914929c8f8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18924929c8f8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18934929c8f8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18944929c8f8Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18954929c8f8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18964929c8f8Smrgfi
1897df58931aSmrg
18984929c8f8Smrgfound="no"
18994929c8f8Smrgm4_foreach([flag], m4_cdr($@), [
19004929c8f8Smrg	if test $found = "no" ; then
19014929c8f8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19024929c8f8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19034929c8f8Smrg		fi
19044929c8f8Smrg
19054929c8f8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19064929c8f8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19074929c8f8Smrg		fi
19084929c8f8Smrg
19094929c8f8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19104929c8f8Smrg
19114929c8f8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19124929c8f8Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19134929c8f8Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19144929c8f8Smrg		AC_CACHE_VAL($cacheid,
19154929c8f8Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19164929c8f8Smrg					     [eval $cacheid=yes],
19174929c8f8Smrg					     [eval $cacheid=no])])
19184929c8f8Smrg
19194929c8f8Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19204929c8f8Smrg
19214929c8f8Smrg		eval supported=\$$cacheid
19224929c8f8Smrg		AC_MSG_RESULT([$supported])
19234929c8f8Smrg		if test "$supported" = "yes" ; then
19244929c8f8Smrg			$1="$$1 ]flag["
19254929c8f8Smrg			found="yes"
19264929c8f8Smrg		fi
19274929c8f8Smrg	fi
19284929c8f8Smrg])
19294929c8f8Smrg]) # XORG_TESTSET_CFLAG
19304929c8f8Smrg
19314929c8f8Smrg# XORG_COMPILER_FLAGS
19324929c8f8Smrg# ---------------
19334929c8f8Smrg# Minimum version: 1.16.0
1934df58931aSmrg#
19354929c8f8Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19364929c8f8Smrg# arguments supported by the selected compiler which do NOT alter the generated
19374929c8f8Smrg# code.  These arguments will cause the compiler to print various warnings
19384929c8f8Smrg# during compilation AND turn a conservative set of warnings into errors.
1939df58931aSmrg#
19404929c8f8Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19414929c8f8Smrg# future versions of util-macros as options are added to new compilers.
1942df58931aSmrg#
19434929c8f8SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19444929c8f8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945df58931aSmrg
19464929c8f8SmrgAC_ARG_ENABLE(selective-werror,
19474929c8f8Smrg              AS_HELP_STRING([--disable-selective-werror],
19484929c8f8Smrg                             [Turn off selective compiler errors. (default: enabled)]),
19494929c8f8Smrg              [SELECTIVE_WERROR=$enableval],
19504929c8f8Smrg              [SELECTIVE_WERROR=yes])
19514929c8f8Smrg
19524929c8f8SmrgAC_LANG_CASE(
19534929c8f8Smrg        [C], [
19544929c8f8Smrg                define([PREFIX], [C])
19554929c8f8Smrg        ],
19564929c8f8Smrg        [C++], [
19574929c8f8Smrg                define([PREFIX], [CXX])
19584929c8f8Smrg        ]
19594929c8f8Smrg)
19604929c8f8Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19614929c8f8Smrgif test "x$SUNCC" = "xyes"; then
19624929c8f8Smrg    [BASE_]PREFIX[FLAGS]="-v"
1963df58931aSmrgelse
19644929c8f8Smrg    [BASE_]PREFIX[FLAGS]=""
1965df58931aSmrgfi
1966df58931aSmrg
19674929c8f8Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19684929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19694929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19704929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19714929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972df58931aSmrg
19734929c8f8SmrgAC_LANG_CASE(
19744929c8f8Smrg	[C], [
19754929c8f8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19764929c8f8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19774929c8f8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19784929c8f8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19794929c8f8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19804929c8f8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19814929c8f8Smrg	]
19824929c8f8Smrg)
19834929c8f8Smrg
19844929c8f8Smrg# This chunk adds additional warnings that could catch undesired effects.
19854929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19864929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19874929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19884929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19894929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19904929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19914929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19924929c8f8Smrg
19934929c8f8Smrg# These are currently disabled because they are noisy.  They will be enabled
19944929c8f8Smrg# in the future once the codebase is sufficiently modernized to silence
19954929c8f8Smrg# them.  For now, I don't want them to drown out the other warnings.
19964929c8f8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19974929c8f8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19984929c8f8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19994929c8f8Smrg
20004929c8f8Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20014929c8f8Smrg# when there are problems that should be fixed.
20024929c8f8Smrg
20034929c8f8Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20044929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20054929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20064929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20074929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20084929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20094929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20104929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20114929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20124929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20134929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20144929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20154929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20164929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2017df58931aSmrgelse
20184929c8f8SmrgAC_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])
20194929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20204929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20214929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20224929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20234929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20244929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20254929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20264929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20274929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20284929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20294929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20304929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20314929c8f8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2032df58931aSmrgfi
2033df58931aSmrg
20344929c8f8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20354929c8f8Smrg]) # XORG_COMPILER_FLAGS
20364929c8f8Smrg
20374929c8f8Smrg# XORG_CWARNFLAGS
20384929c8f8Smrg# ---------------
20394929c8f8Smrg# Minimum version: 1.2.0
20404929c8f8Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041df58931aSmrg#
20424929c8f8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2043df58931aSmrg#
20444929c8f8Smrg# This function is deprecated because it defines -fno-strict-aliasing
20454929c8f8Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20464929c8f8Smrg# is needed, then it should be added explicitly in the module when
20474929c8f8Smrg# it is updated to use BASE_CFLAGS.
2048df58931aSmrg#
20494929c8f8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
20504929c8f8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20514929c8f8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20524929c8f8SmrgAC_LANG_CASE(
20534929c8f8Smrg	[C], [
20544929c8f8Smrg		CWARNFLAGS="$BASE_CFLAGS"
20554929c8f8Smrg		if  test "x$GCC" = xyes ; then
20564929c8f8Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20574929c8f8Smrg		fi
20584929c8f8Smrg		AC_SUBST(CWARNFLAGS)
20594929c8f8Smrg	]
20604929c8f8Smrg)
20614929c8f8Smrg]) # XORG_CWARNFLAGS
20624929c8f8Smrg
20634929c8f8Smrg# XORG_STRICT_OPTION
20644929c8f8Smrg# -----------------------
20654929c8f8Smrg# Minimum version: 1.3.0
2066df58931aSmrg#
20674929c8f8Smrg# Add configure option to enable strict compilation flags, such as treating
20684929c8f8Smrg# warnings as fatal errors.
20694929c8f8Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20704929c8f8Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071df58931aSmrg#
20724929c8f8Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20734929c8f8Smrg# when strict compilation is unconditionally desired.
20744929c8f8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
20754929c8f8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
20764929c8f8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077df58931aSmrg
20784929c8f8SmrgAC_ARG_ENABLE(strict-compilation,
20794929c8f8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
20804929c8f8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20814929c8f8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082df58931aSmrg
20834929c8f8SmrgAC_LANG_CASE(
20844929c8f8Smrg        [C], [
20854929c8f8Smrg                define([PREFIX], [C])
20864929c8f8Smrg        ],
20874929c8f8Smrg        [C++], [
20884929c8f8Smrg                define([PREFIX], [CXX])
20894929c8f8Smrg        ]
20904929c8f8Smrg)
2091df58931aSmrg
20924929c8f8Smrg[STRICT_]PREFIX[FLAGS]=""
20934929c8f8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20944929c8f8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2095df58931aSmrg
20964929c8f8Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20974929c8f8Smrg# activate it with -Werror, so we add it here explicitly.
20984929c8f8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2099df58931aSmrg
21004929c8f8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21014929c8f8Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21024929c8f8Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21034929c8f8Smrgfi
21044929c8f8SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21054929c8f8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21064929c8f8SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21074929c8f8Smrg]) # XORG_STRICT_OPTION
21084929c8f8Smrg
21094929c8f8Smrg# XORG_DEFAULT_OPTIONS
21104929c8f8Smrg# --------------------
21114929c8f8Smrg# Minimum version: 1.3.0
2112df58931aSmrg#
21134929c8f8Smrg# Defines default options for X.Org modules.
2114df58931aSmrg#
21154929c8f8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21164929c8f8SmrgAC_REQUIRE([AC_PROG_INSTALL])
21174929c8f8SmrgXORG_COMPILER_FLAGS
21184929c8f8SmrgXORG_CWARNFLAGS
21194929c8f8SmrgXORG_STRICT_OPTION
21204929c8f8SmrgXORG_RELEASE_VERSION
21214929c8f8SmrgXORG_CHANGELOG
21224929c8f8SmrgXORG_INSTALL
21234929c8f8SmrgXORG_MANPAGE_SECTIONS
21244929c8f8Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21254929c8f8Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21264929c8f8Smrg]) # XORG_DEFAULT_OPTIONS
21274929c8f8Smrg
21284929c8f8Smrg# XORG_INSTALL()
21294929c8f8Smrg# ----------------
21304929c8f8Smrg# Minimum version: 1.4.0
2131df58931aSmrg#
21324929c8f8Smrg# Defines the variable INSTALL_CMD as the command to copy
21334929c8f8Smrg# INSTALL from $prefix/share/util-macros.
2134df58931aSmrg#
21354929c8f8SmrgAC_DEFUN([XORG_INSTALL], [
21364929c8f8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21374929c8f8Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21384929c8f8SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21394929c8f8Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21404929c8f8Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21414929c8f8Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21424929c8f8SmrgAC_SUBST([INSTALL_CMD])
21434929c8f8Smrg]) # XORG_INSTALL
21444929c8f8Smrgdnl Copyright 2005 Red Hat, Inc
21454929c8f8Smrgdnl
21464929c8f8Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21474929c8f8Smrgdnl documentation for any purpose is hereby granted without fee, provided that
21484929c8f8Smrgdnl the above copyright notice appear in all copies and that both that
21494929c8f8Smrgdnl copyright notice and this permission notice appear in supporting
21504929c8f8Smrgdnl documentation.
21514929c8f8Smrgdnl
21524929c8f8Smrgdnl The above copyright notice and this permission notice shall be included
21534929c8f8Smrgdnl in all copies or substantial portions of the Software.
21544929c8f8Smrgdnl
21554929c8f8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21564929c8f8Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21574929c8f8Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21584929c8f8Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21594929c8f8Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21604929c8f8Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21614929c8f8Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
21624929c8f8Smrgdnl
21634929c8f8Smrgdnl Except as contained in this notice, the name of the copyright holders shall
21644929c8f8Smrgdnl not be used in advertising or otherwise to promote the sale, use or
21654929c8f8Smrgdnl other dealings in this Software without prior written authorization
21664929c8f8Smrgdnl from the copyright holders.
21674929c8f8Smrgdnl
2168df58931aSmrg
21694929c8f8Smrg# XORG_RELEASE_VERSION
21704929c8f8Smrg# --------------------
21714929c8f8Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172df58931aSmrg
21734929c8f8SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21744929c8f8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21754929c8f8Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21764929c8f8Smrg		[Major version of this package])
21774929c8f8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21784929c8f8Smrg	if test "x$PVM" = "x"; then
21794929c8f8Smrg		PVM="0"
21804929c8f8Smrg	fi
21814929c8f8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21824929c8f8Smrg		[$PVM],
21834929c8f8Smrg		[Minor version of this package])
21844929c8f8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21854929c8f8Smrg	if test "x$PVP" = "x"; then
21864929c8f8Smrg		PVP="0"
21874929c8f8Smrg	fi
21884929c8f8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21894929c8f8Smrg		[$PVP],
21904929c8f8Smrg		[Patch version of this package])
21914929c8f8Smrg])
2192df58931aSmrg
21934929c8f8Smrg# XORG_CHANGELOG()
2194df58931aSmrg# ----------------
21954929c8f8Smrg# Minimum version: 1.2.0
2196df58931aSmrg#
21974929c8f8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
21984929c8f8Smrg# ChangeLog from git.
2199df58931aSmrg#
2200df58931aSmrg#
22014929c8f8SmrgAC_DEFUN([XORG_CHANGELOG], [
22024929c8f8SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22034929c8f8Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22044929c8f8Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22054929c8f8Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22064929c8f8SmrgAC_SUBST([CHANGELOG_CMD])
22074929c8f8Smrg]) # XORG_CHANGELOG
22084929c8f8Smrg
22094929c8f8Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210df58931aSmrg#
22114929c8f8Smrg# This file is free software; the Free Software Foundation
22124929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
22134929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2214df58931aSmrg
22154929c8f8Smrg# AM_AUTOMAKE_VERSION(VERSION)
22164929c8f8Smrg# ----------------------------
22174929c8f8Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22184929c8f8Smrg# generated from the m4 files accompanying Automake X.Y.
22194929c8f8Smrg# (This private macro should not be called outside this file.)
22204929c8f8SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22214929c8f8Smrg[am__api_version='1.15'
22224929c8f8Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22234929c8f8Smrgdnl require some minimum version.  Point them to the right macro.
22244929c8f8Smrgm4_if([$1], [1.15], [],
22254929c8f8Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22264929c8f8Smrg])
2227df58931aSmrg
22284929c8f8Smrg# _AM_AUTOCONF_VERSION(VERSION)
22294929c8f8Smrg# -----------------------------
22304929c8f8Smrg# aclocal traces this macro to find the Autoconf version.
22314929c8f8Smrg# This is a private macro too.  Using m4_define simplifies
22324929c8f8Smrg# the logic in aclocal, which can simply ignore this definition.
22334929c8f8Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2234df58931aSmrg
22354929c8f8Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22364929c8f8Smrg# -------------------------------
22374929c8f8Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22384929c8f8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22394929c8f8SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22404929c8f8Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
22414929c8f8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
22424929c8f8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22434929c8f8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244df58931aSmrg
22454929c8f8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22464929c8f8Smrg
22474929c8f8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248df58931aSmrg#
22494929c8f8Smrg# This file is free software; the Free Software Foundation
22504929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
22514929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2252df58931aSmrg
22534929c8f8Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22544929c8f8Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22554929c8f8Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256df58931aSmrg#
22574929c8f8Smrg# Of course, Automake must honor this variable whenever it calls a
22584929c8f8Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22594929c8f8Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22604929c8f8Smrg# depending on how configure is run.  This is pretty annoying, since
22614929c8f8Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22624929c8f8Smrg# source directory, any form will work fine, but in subdirectories a
22634929c8f8Smrg# relative path needs to be adjusted first.
2264df58931aSmrg#
22654929c8f8Smrg# $ac_aux_dir/missing
22664929c8f8Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22674929c8f8Smrg# $top_srcdir/$ac_aux_dir/missing
22684929c8f8Smrg#    fails if $ac_aux_dir is absolute,
22694929c8f8Smrg#    fails when called from a subdirectory in a VPATH build with
22704929c8f8Smrg#          a relative $ac_aux_dir
2271df58931aSmrg#
22724929c8f8Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22734929c8f8Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
22744929c8f8Smrg# harmless because $srcdir is '.', but things will broke when you
22754929c8f8Smrg# start a VPATH build or use an absolute $srcdir.
2276df58931aSmrg#
22774929c8f8Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22784929c8f8Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22794929c8f8Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22804929c8f8Smrg# and then we would define $MISSING as
22814929c8f8Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22824929c8f8Smrg# This will work as long as MISSING is not called from configure, because
22834929c8f8Smrg# unfortunately $(top_srcdir) has no meaning in configure.
22844929c8f8Smrg# However there are other variables, like CC, which are often used in
22854929c8f8Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286df58931aSmrg#
22874929c8f8Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
22884929c8f8Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
22894929c8f8Smrg# configured tree to be moved without reconfiguration.
22904929c8f8Smrg
22914929c8f8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22924929c8f8Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22934929c8f8Smrg# Expand $ac_aux_dir to an absolute path.
22944929c8f8Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
22954929c8f8Smrg])
22964929c8f8Smrg
22974929c8f8Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
22984929c8f8Smrg
22994929c8f8Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2300df58931aSmrg#
23014929c8f8Smrg# This file is free software; the Free Software Foundation
23024929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
23034929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2304df58931aSmrg
23054929c8f8Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23064929c8f8Smrg# -------------------------------------
23074929c8f8Smrg# Define a conditional.
23084929c8f8SmrgAC_DEFUN([AM_CONDITIONAL],
23094929c8f8Smrg[AC_PREREQ([2.52])dnl
23104929c8f8Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23114929c8f8Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23124929c8f8SmrgAC_SUBST([$1_TRUE])dnl
23134929c8f8SmrgAC_SUBST([$1_FALSE])dnl
23144929c8f8Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23154929c8f8Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23164929c8f8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23174929c8f8Smrgif $2; then
23184929c8f8Smrg  $1_TRUE=
23194929c8f8Smrg  $1_FALSE='#'
23204929c8f8Smrgelse
23214929c8f8Smrg  $1_TRUE='#'
23224929c8f8Smrg  $1_FALSE=
23234929c8f8Smrgfi
23244929c8f8SmrgAC_CONFIG_COMMANDS_PRE(
23254929c8f8Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23264929c8f8Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23274929c8f8SmrgUsually this means the macro was only invoked conditionally.]])
23284929c8f8Smrgfi])])
23294929c8f8Smrg
23304929c8f8Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2331df58931aSmrg#
23324929c8f8Smrg# This file is free software; the Free Software Foundation
23334929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
23344929c8f8Smrg# with or without modifications, as long as this notice is preserved.
23354929c8f8Smrg
23364929c8f8Smrg
23374929c8f8Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23384929c8f8Smrg# written in clear, in which case automake, when reading aclocal.m4,
23394929c8f8Smrg# will think it sees a *use*, and therefore will trigger all it's
23404929c8f8Smrg# C support machinery.  Also note that it means that autoscan, seeing
23414929c8f8Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23424929c8f8Smrg
23434929c8f8Smrg
23444929c8f8Smrg# _AM_DEPENDENCIES(NAME)
23454929c8f8Smrg# ----------------------
23464929c8f8Smrg# See how the compiler implements dependency checking.
23474929c8f8Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23484929c8f8Smrg# We try a few techniques and use that to set a single cache variable.
2349df58931aSmrg#
23504929c8f8Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23514929c8f8Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23524929c8f8Smrg# dependency, and given that the user is not expected to run this macro,
23534929c8f8Smrg# just rely on AC_PROG_CC.
23544929c8f8SmrgAC_DEFUN([_AM_DEPENDENCIES],
23554929c8f8Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23564929c8f8SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23574929c8f8SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23584929c8f8SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359df58931aSmrg
23604929c8f8Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23614929c8f8Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23624929c8f8Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23634929c8f8Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23644929c8f8Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23654929c8f8Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23664929c8f8Smrg                    [depcc="$$1"   am_compiler_list=])
23674929c8f8Smrg
23684929c8f8SmrgAC_CACHE_CHECK([dependency style of $depcc],
23694929c8f8Smrg               [am_cv_$1_dependencies_compiler_type],
23704929c8f8Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23714929c8f8Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
23724929c8f8Smrg  # making bogus files that we don't know about and never remove.  For
23734929c8f8Smrg  # instance it was reported that on HP-UX the gcc test will end up
23744929c8f8Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23754929c8f8Smrg  # in D".
23764929c8f8Smrg  rm -rf conftest.dir
23774929c8f8Smrg  mkdir conftest.dir
23784929c8f8Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23794929c8f8Smrg  # using a relative directory.
23804929c8f8Smrg  cp "$am_depcomp" conftest.dir
23814929c8f8Smrg  cd conftest.dir
23824929c8f8Smrg  # We will build objects and dependencies in a subdirectory because
23834929c8f8Smrg  # it helps to detect inapplicable dependency modes.  For instance
23844929c8f8Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23854929c8f8Smrg  # side effect of compilation, but ICC will put the dependencies in
23864929c8f8Smrg  # the current directory while Tru64 will put them in the object
23874929c8f8Smrg  # directory.
23884929c8f8Smrg  mkdir sub
23894929c8f8Smrg
23904929c8f8Smrg  am_cv_$1_dependencies_compiler_type=none
23914929c8f8Smrg  if test "$am_compiler_list" = ""; then
23924929c8f8Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2393df58931aSmrg  fi
23944929c8f8Smrg  am__universal=false
23954929c8f8Smrg  m4_case([$1], [CC],
23964929c8f8Smrg    [case " $depcc " in #(
23974929c8f8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23984929c8f8Smrg     esac],
23994929c8f8Smrg    [CXX],
24004929c8f8Smrg    [case " $depcc " in #(
24014929c8f8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24024929c8f8Smrg     esac])
24034929c8f8Smrg
24044929c8f8Smrg  for depmode in $am_compiler_list; do
24054929c8f8Smrg    # Setup a source with many dependencies, because some compilers
24064929c8f8Smrg    # like to wrap large dependency lists on column 80 (with \), and
24074929c8f8Smrg    # we should not choose a depcomp mode which is confused by this.
24084929c8f8Smrg    #
24094929c8f8Smrg    # We need to recreate these files for each test, as the compiler may
24104929c8f8Smrg    # overwrite some of them when testing with obscure command lines.
24114929c8f8Smrg    # This happens at least with the AIX C compiler.
24124929c8f8Smrg    : > sub/conftest.c
24134929c8f8Smrg    for i in 1 2 3 4 5 6; do
24144929c8f8Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24154929c8f8Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24164929c8f8Smrg      # Solaris 10 /bin/sh.
24174929c8f8Smrg      echo '/* dummy */' > sub/conftst$i.h
24184929c8f8Smrg    done
24194929c8f8Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24204929c8f8Smrg
24214929c8f8Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24224929c8f8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24234929c8f8Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24244929c8f8Smrg    # versions had trouble with output in subdirs.
24254929c8f8Smrg    am__obj=sub/conftest.${OBJEXT-o}
24264929c8f8Smrg    am__minus_obj="-o $am__obj"
24274929c8f8Smrg    case $depmode in
24284929c8f8Smrg    gcc)
24294929c8f8Smrg      # This depmode causes a compiler race in universal mode.
24304929c8f8Smrg      test "$am__universal" = false || continue
24314929c8f8Smrg      ;;
24324929c8f8Smrg    nosideeffect)
24334929c8f8Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24344929c8f8Smrg      # only be used when explicitly requested.
24354929c8f8Smrg      if test "x$enable_dependency_tracking" = xyes; then
24364929c8f8Smrg	continue
24374929c8f8Smrg      else
24384929c8f8Smrg	break
24394929c8f8Smrg      fi
24404929c8f8Smrg      ;;
24414929c8f8Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24424929c8f8Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
24434929c8f8Smrg      # not run yet.  These depmodes are late enough in the game, and
24444929c8f8Smrg      # so weak that their functioning should not be impacted.
24454929c8f8Smrg      am__obj=conftest.${OBJEXT-o}
24464929c8f8Smrg      am__minus_obj=
24474929c8f8Smrg      ;;
24484929c8f8Smrg    none) break ;;
24494929c8f8Smrg    esac
24504929c8f8Smrg    if depmode=$depmode \
24514929c8f8Smrg       source=sub/conftest.c object=$am__obj \
24524929c8f8Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24534929c8f8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24544929c8f8Smrg         >/dev/null 2>conftest.err &&
24554929c8f8Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24564929c8f8Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24574929c8f8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24584929c8f8Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24594929c8f8Smrg      # icc doesn't choke on unknown options, it will just issue warnings
24604929c8f8Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
24614929c8f8Smrg      # that says an option was ignored or not supported.
24624929c8f8Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24634929c8f8Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24644929c8f8Smrg      # The diagnosis changed in icc 8.0:
24654929c8f8Smrg      #   icc: Command line remark: option '-MP' not supported
24664929c8f8Smrg      if (grep 'ignoring option' conftest.err ||
24674929c8f8Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24684929c8f8Smrg        am_cv_$1_dependencies_compiler_type=$depmode
24694929c8f8Smrg        break
24704929c8f8Smrg      fi
24714929c8f8Smrg    fi
24724929c8f8Smrg  done
24734929c8f8Smrg
24744929c8f8Smrg  cd ..
24754929c8f8Smrg  rm -rf conftest.dir
24764929c8f8Smrgelse
24774929c8f8Smrg  am_cv_$1_dependencies_compiler_type=none
2478df58931aSmrgfi
24794929c8f8Smrg])
24804929c8f8SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24814929c8f8SmrgAM_CONDITIONAL([am__fastdep$1], [
24824929c8f8Smrg  test "x$enable_dependency_tracking" != xno \
24834929c8f8Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24844929c8f8Smrg])
2485df58931aSmrg
24864929c8f8Smrg
24874929c8f8Smrg# AM_SET_DEPDIR
24884929c8f8Smrg# -------------
24894929c8f8Smrg# Choose a directory name for dependency files.
24904929c8f8Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24914929c8f8SmrgAC_DEFUN([AM_SET_DEPDIR],
24924929c8f8Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24934929c8f8SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24944929c8f8Smrg])
24954929c8f8Smrg
24964929c8f8Smrg
24974929c8f8Smrg# AM_DEP_TRACK
24984929c8f8Smrg# ------------
24994929c8f8SmrgAC_DEFUN([AM_DEP_TRACK],
25004929c8f8Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25014929c8f8SmrgAS_HELP_STRING(
25024929c8f8Smrg  [--enable-dependency-tracking],
25034929c8f8Smrg  [do not reject slow dependency extractors])
25044929c8f8SmrgAS_HELP_STRING(
25054929c8f8Smrg  [--disable-dependency-tracking],
25064929c8f8Smrg  [speeds up one-time build])])
25074929c8f8Smrgif test "x$enable_dependency_tracking" != xno; then
25084929c8f8Smrg  am_depcomp="$ac_aux_dir/depcomp"
25094929c8f8Smrg  AMDEPBACKSLASH='\'
25104929c8f8Smrg  am__nodep='_no'
2511df58931aSmrgfi
25124929c8f8SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25134929c8f8SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25144929c8f8Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25154929c8f8SmrgAC_SUBST([am__nodep])dnl
25164929c8f8Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25174929c8f8Smrg])
25184929c8f8Smrg
25194929c8f8Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25204929c8f8Smrg
25214929c8f8Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
25224929c8f8Smrg#
25234929c8f8Smrg# This file is free software; the Free Software Foundation
25244929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
25254929c8f8Smrg# with or without modifications, as long as this notice is preserved.
25264929c8f8Smrg
25274929c8f8Smrg
25284929c8f8Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25294929c8f8Smrg# ------------------------------
25304929c8f8SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25314929c8f8Smrg[{
25324929c8f8Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
25334929c8f8Smrg  # are listed without --file.  Let's play safe and only enable the eval
25344929c8f8Smrg  # if we detect the quoting.
25354929c8f8Smrg  case $CONFIG_FILES in
25364929c8f8Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
25374929c8f8Smrg  *)   set x $CONFIG_FILES ;;
25384929c8f8Smrg  esac
25394929c8f8Smrg  shift
25404929c8f8Smrg  for mf
25414929c8f8Smrg  do
25424929c8f8Smrg    # Strip MF so we end up with the name of the file.
25434929c8f8Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25444929c8f8Smrg    # Check whether this is an Automake generated Makefile or not.
25454929c8f8Smrg    # We used to match only the files named 'Makefile.in', but
25464929c8f8Smrg    # some people rename them; so instead we look at the file content.
25474929c8f8Smrg    # Grep'ing the first line is not enough: some people post-process
25484929c8f8Smrg    # each Makefile.in and add a new line on top of each file to say so.
25494929c8f8Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
25504929c8f8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
25514929c8f8Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25524929c8f8Smrg      dirpart=`AS_DIRNAME("$mf")`
25534929c8f8Smrg    else
25544929c8f8Smrg      continue
25554929c8f8Smrg    fi
25564929c8f8Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
25574929c8f8Smrg    # from the Makefile without running 'make'.
25584929c8f8Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25594929c8f8Smrg    test -z "$DEPDIR" && continue
25604929c8f8Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25614929c8f8Smrg    test -z "$am__include" && continue
25624929c8f8Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25634929c8f8Smrg    # Find all dependency output files, they are included files with
25644929c8f8Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25654929c8f8Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25664929c8f8Smrg    # expansion.
25674929c8f8Smrg    for file in `sed -n "
25684929c8f8Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25694929c8f8Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25704929c8f8Smrg      # Make sure the directory exists.
25714929c8f8Smrg      test -f "$dirpart/$file" && continue
25724929c8f8Smrg      fdir=`AS_DIRNAME(["$file"])`
25734929c8f8Smrg      AS_MKDIR_P([$dirpart/$fdir])
25744929c8f8Smrg      # echo "creating $dirpart/$file"
25754929c8f8Smrg      echo '# dummy' > "$dirpart/$file"
25764929c8f8Smrg    done
25774929c8f8Smrg  done
25784929c8f8Smrg}
25794929c8f8Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25804929c8f8Smrg
25814929c8f8Smrg
25824929c8f8Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25834929c8f8Smrg# -----------------------------
25844929c8f8Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
25854929c8f8Smrg#
25864929c8f8Smrg# This code is only required when automatic dependency tracking
25874929c8f8Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
25884929c8f8Smrg# need in order to bootstrap the dependency handling code.
25894929c8f8SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25904929c8f8Smrg[AC_CONFIG_COMMANDS([depfiles],
25914929c8f8Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25924929c8f8Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25934929c8f8Smrg])
25944929c8f8Smrg
25954929c8f8Smrg# Do all the work for Automake.                             -*- Autoconf -*-
25964929c8f8Smrg
25974929c8f8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25984929c8f8Smrg#
25994929c8f8Smrg# This file is free software; the Free Software Foundation
26004929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
26014929c8f8Smrg# with or without modifications, as long as this notice is preserved.
26024929c8f8Smrg
26034929c8f8Smrg# This macro actually does too much.  Some checks are only needed if
26044929c8f8Smrg# your package does certain things.  But this isn't really a big deal.
2605df58931aSmrg
26064929c8f8Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26074929c8f8Smrgm4_define([AC_PROG_CC],
26084929c8f8Smrgm4_defn([AC_PROG_CC])
26094929c8f8Smrg[_AM_PROG_CC_C_O
26104929c8f8Smrg])
2611df58931aSmrg
26124929c8f8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26134929c8f8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26144929c8f8Smrg# -----------------------------------------------
26154929c8f8Smrg# The call with PACKAGE and VERSION arguments is the old style
26164929c8f8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26174929c8f8Smrg# and VERSION should now be passed to AC_INIT and removed from
26184929c8f8Smrg# the call to AM_INIT_AUTOMAKE.
26194929c8f8Smrg# We support both call styles for the transition.  After
26204929c8f8Smrg# the next Automake release, Autoconf can make the AC_INIT
26214929c8f8Smrg# arguments mandatory, and then we can depend on a new Autoconf
26224929c8f8Smrg# release and drop the old call support.
26234929c8f8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26244929c8f8Smrg[AC_PREREQ([2.65])dnl
26254929c8f8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26264929c8f8Smrgdnl the ones we care about.
26274929c8f8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26284929c8f8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26294929c8f8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26304929c8f8Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26314929c8f8Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26324929c8f8Smrg  # is not polluted with repeated "-I."
26334929c8f8Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26344929c8f8Smrg  # test to see if srcdir already configured
26354929c8f8Smrg  if test -f $srcdir/config.status; then
26364929c8f8Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637df58931aSmrg  fi
2638df58931aSmrgfi
2639df58931aSmrg
26404929c8f8Smrg# test whether we have cygpath
26414929c8f8Smrgif test -z "$CYGPATH_W"; then
26424929c8f8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26434929c8f8Smrg    CYGPATH_W='cygpath -w'
26444929c8f8Smrg  else
26454929c8f8Smrg    CYGPATH_W=echo
2646df58931aSmrg  fi
2647df58931aSmrgfi
26484929c8f8SmrgAC_SUBST([CYGPATH_W])
2649df58931aSmrg
26504929c8f8Smrg# Define the identity of the package.
26514929c8f8Smrgdnl Distinguish between old-style and new-style calls.
26524929c8f8Smrgm4_ifval([$2],
26534929c8f8Smrg[AC_DIAGNOSE([obsolete],
26544929c8f8Smrg             [$0: two- and three-arguments forms are deprecated.])
26554929c8f8Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26564929c8f8Smrg AC_SUBST([PACKAGE], [$1])dnl
26574929c8f8Smrg AC_SUBST([VERSION], [$2])],
26584929c8f8Smrg[_AM_SET_OPTIONS([$1])dnl
26594929c8f8Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26604929c8f8Smrgm4_if(
26614929c8f8Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26624929c8f8Smrg  [ok:ok],,
26634929c8f8Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26644929c8f8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26654929c8f8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666df58931aSmrg
26674929c8f8Smrg_AM_IF_OPTION([no-define],,
26684929c8f8Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26694929c8f8Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670df58931aSmrg
26714929c8f8Smrg# Some tools Automake needs.
26724929c8f8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26734929c8f8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26744929c8f8SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26754929c8f8SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26764929c8f8SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26774929c8f8SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26784929c8f8SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26794929c8f8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26804929c8f8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26814929c8f8SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26824929c8f8Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
26834929c8f8Smrg# dies out for good.  For more background, see:
26844929c8f8Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26854929c8f8Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26864929c8f8SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26874929c8f8Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
26884929c8f8Smrg# system "awk" is bad on some platforms.
26894929c8f8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
26904929c8f8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26914929c8f8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26924929c8f8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26934929c8f8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26944929c8f8Smrg			     [_AM_PROG_TAR([v7])])])
26954929c8f8Smrg_AM_IF_OPTION([no-dependencies],,
26964929c8f8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26974929c8f8Smrg		  [_AM_DEPENDENCIES([CC])],
26984929c8f8Smrg		  [m4_define([AC_PROG_CC],
26994929c8f8Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27004929c8f8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27014929c8f8Smrg		  [_AM_DEPENDENCIES([CXX])],
27024929c8f8Smrg		  [m4_define([AC_PROG_CXX],
27034929c8f8Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27044929c8f8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27054929c8f8Smrg		  [_AM_DEPENDENCIES([OBJC])],
27064929c8f8Smrg		  [m4_define([AC_PROG_OBJC],
27074929c8f8Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27084929c8f8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27094929c8f8Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27104929c8f8Smrg		  [m4_define([AC_PROG_OBJCXX],
27114929c8f8Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27124929c8f8Smrg])
27134929c8f8SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27144929c8f8Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27154929c8f8Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27164929c8f8Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27174929c8f8SmrgAC_CONFIG_COMMANDS_PRE(dnl
27184929c8f8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27194929c8f8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720df58931aSmrg
27214929c8f8Smrg# POSIX will say in a future version that running "rm -f" with no argument
27224929c8f8Smrg# is OK; and we want to be able to make that assumption in our Makefile
27234929c8f8Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27244929c8f8Smrg# actually supported "in the wild" to an acceptable degree.
27254929c8f8Smrg# See automake bug#10828.
27264929c8f8Smrg# To make any issue more visible, cause the running configure to be aborted
27274929c8f8Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27284929c8f8Smrg# user can still override this though.
27294929c8f8Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27304929c8f8Smrg  cat >&2 <<'END'
27314929c8f8SmrgOops!
2732b66d1acbSmrg
27334929c8f8SmrgYour 'rm' program seems unable to run without file operands specified
27344929c8f8Smrgon the command line, even when the '-f' option is present.  This is contrary
27354929c8f8Smrgto the behaviour of most rm programs out there, and not conforming with
27364929c8f8Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737b66d1acbSmrg
27384929c8f8SmrgPlease tell bug-automake@gnu.org about your system, including the value
27394929c8f8Smrgof your $PATH and any error possibly output before this message.  This
27404929c8f8Smrgcan help us improve future automake versions.
2741b66d1acbSmrg
27424929c8f8SmrgEND
27434929c8f8Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27444929c8f8Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27454929c8f8Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27464929c8f8Smrg    echo >&2
27474929c8f8Smrg  else
27484929c8f8Smrg    cat >&2 <<'END'
27494929c8f8SmrgAborting the configuration process, to ensure you take notice of the issue.
27504fb28925Smrg
27514929c8f8SmrgYou can download and install GNU coreutils to get an 'rm' implementation
27524929c8f8Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
27534fb28925Smrg
27544929c8f8SmrgIf you want to complete the configuration process using your problematic
27554929c8f8Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27564929c8f8Smrgto "yes", and re-run configure.
27574929c8f8Smrg
27584929c8f8SmrgEND
27594929c8f8Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27604929c8f8Smrg  fi
27614fb28925Smrgfi
27624929c8f8Smrgdnl The trailing newline in this macro's definition is deliberate, for
27634929c8f8Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27644929c8f8Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27654929c8f8Smrg])
27664fb28925Smrg
27674929c8f8Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27684929c8f8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27694929c8f8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
27704929c8f8Smrgm4_define([_AC_COMPILER_EXEEXT],
27714929c8f8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27724fb28925Smrg
27734929c8f8Smrg# When config.status generates a header, we must update the stamp-h file.
27744929c8f8Smrg# This file resides in the same directory as the config header
27754929c8f8Smrg# that is generated.  The stamp files are numbered to have different names.
2776b66d1acbSmrg
27774929c8f8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27784929c8f8Smrg# loop where config.status creates the headers, so we can generate
27794929c8f8Smrg# our stamp files there.
27804929c8f8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27814929c8f8Smrg[# Compute $1's index in $config_headers.
27824929c8f8Smrg_am_arg=$1
27834929c8f8Smrg_am_stamp_count=1
27844929c8f8Smrgfor _am_header in $config_headers :; do
27854929c8f8Smrg  case $_am_header in
27864929c8f8Smrg    $_am_arg | $_am_arg:* )
27874929c8f8Smrg      break ;;
27884929c8f8Smrg    * )
27894929c8f8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27904929c8f8Smrg  esac
27914929c8f8Smrgdone
27924929c8f8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2793df58931aSmrg
27944929c8f8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27954929c8f8Smrg#
27964929c8f8Smrg# This file is free software; the Free Software Foundation
27974929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
27984929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2799df58931aSmrg
28004929c8f8Smrg# AM_PROG_INSTALL_SH
28014929c8f8Smrg# ------------------
28024929c8f8Smrg# Define $install_sh.
28034929c8f8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28044929c8f8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28054929c8f8Smrgif test x"${install_sh+set}" != xset; then
28064929c8f8Smrg  case $am_aux_dir in
28074929c8f8Smrg  *\ * | *\	*)
28084929c8f8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28094929c8f8Smrg  *)
28104929c8f8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28114929c8f8Smrg  esac
2812df58931aSmrgfi
28134929c8f8SmrgAC_SUBST([install_sh])])
2814df58931aSmrg
28154929c8f8Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28164929c8f8Smrg#
28174929c8f8Smrg# This file is free software; the Free Software Foundation
28184929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
28194929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2820b66d1acbSmrg
28214929c8f8Smrg# Check whether the underlying file-system supports filenames
28224929c8f8Smrg# with a leading dot.  For instance MS-DOS doesn't.
28234929c8f8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
28244929c8f8Smrg[rm -rf .tst 2>/dev/null
28254929c8f8Smrgmkdir .tst 2>/dev/null
28264929c8f8Smrgif test -d .tst; then
28274929c8f8Smrg  am__leading_dot=.
28284929c8f8Smrgelse
28294929c8f8Smrg  am__leading_dot=_
28304929c8f8Smrgfi
28314929c8f8Smrgrmdir .tst 2>/dev/null
28324929c8f8SmrgAC_SUBST([am__leading_dot])])
2833b66d1acbSmrg
28344929c8f8Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835b66d1acbSmrg
28364929c8f8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2837df58931aSmrg#
28384929c8f8Smrg# This file is free software; the Free Software Foundation
28394929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
28404929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2841df58931aSmrg
28424929c8f8Smrg# AM_MAKE_INCLUDE()
28434929c8f8Smrg# -----------------
28444929c8f8Smrg# Check to see how make treats includes.
28454929c8f8SmrgAC_DEFUN([AM_MAKE_INCLUDE],
28464929c8f8Smrg[am_make=${MAKE-make}
28474929c8f8Smrgcat > confinc << 'END'
28484929c8f8Smrgam__doit:
28494929c8f8Smrg	@echo this is the am__doit target
28504929c8f8Smrg.PHONY: am__doit
28514929c8f8SmrgEND
28524929c8f8Smrg# If we don't find an include directive, just comment out the code.
28534929c8f8SmrgAC_MSG_CHECKING([for style of include used by $am_make])
28544929c8f8Smrgam__include="#"
28554929c8f8Smrgam__quote=
28564929c8f8Smrg_am_result=none
28574929c8f8Smrg# First try GNU make style include.
28584929c8f8Smrgecho "include confinc" > confmf
28594929c8f8Smrg# Ignore all kinds of additional output from 'make'.
28604929c8f8Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28614929c8f8Smrg*the\ am__doit\ target*)
28624929c8f8Smrg  am__include=include
28634929c8f8Smrg  am__quote=
28644929c8f8Smrg  _am_result=GNU
28654929c8f8Smrg  ;;
28664929c8f8Smrgesac
28674929c8f8Smrg# Now try BSD make style include.
28684929c8f8Smrgif test "$am__include" = "#"; then
28694929c8f8Smrg   echo '.include "confinc"' > confmf
28704929c8f8Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28714929c8f8Smrg   *the\ am__doit\ target*)
28724929c8f8Smrg     am__include=.include
28734929c8f8Smrg     am__quote="\""
28744929c8f8Smrg     _am_result=BSD
28754929c8f8Smrg     ;;
28764929c8f8Smrg   esac
2877b66d1acbSmrgfi
28784929c8f8SmrgAC_SUBST([am__include])
28794929c8f8SmrgAC_SUBST([am__quote])
28804929c8f8SmrgAC_MSG_RESULT([$_am_result])
28814929c8f8Smrgrm -f confinc confmf
28824929c8f8Smrg])
2883df58931aSmrg
28844929c8f8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885df58931aSmrg
28864929c8f8Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887df58931aSmrg#
28884929c8f8Smrg# This file is free software; the Free Software Foundation
28894929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
28904929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2891df58931aSmrg
28924929c8f8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
28934929c8f8Smrg# ------------------------------
28944929c8f8SmrgAC_DEFUN([AM_MISSING_PROG],
28954929c8f8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28964929c8f8Smrg$1=${$1-"${am_missing_run}$2"}
28974929c8f8SmrgAC_SUBST($1)])
2898df58931aSmrg
28994929c8f8Smrg# AM_MISSING_HAS_RUN
29004929c8f8Smrg# ------------------
29014929c8f8Smrg# Define MISSING if not defined so far and test if it is modern enough.
29024929c8f8Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29034929c8f8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29044929c8f8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29054929c8f8SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29064929c8f8Smrgif test x"${MISSING+set}" != xset; then
29074929c8f8Smrg  case $am_aux_dir in
29084929c8f8Smrg  *\ * | *\	*)
29094929c8f8Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29104929c8f8Smrg  *)
29114929c8f8Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29124929c8f8Smrg  esac
2913df58931aSmrgfi
29144929c8f8Smrg# Use eval to expand $SHELL
29154929c8f8Smrgif eval "$MISSING --is-lightweight"; then
29164929c8f8Smrg  am_missing_run="$MISSING "
29174929c8f8Smrgelse
29184929c8f8Smrg  am_missing_run=
29194929c8f8Smrg  AC_MSG_WARN(['missing' script is too old or missing])
2920df58931aSmrgfi
29214929c8f8Smrg])
2922df58931aSmrg
29234929c8f8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2924df58931aSmrg
29254929c8f8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29264929c8f8Smrg#
29274929c8f8Smrg# This file is free software; the Free Software Foundation
29284929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
29294929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2930df58931aSmrg
29314929c8f8Smrg# _AM_MANGLE_OPTION(NAME)
29324929c8f8Smrg# -----------------------
29334929c8f8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
29344929c8f8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935df58931aSmrg
29364929c8f8Smrg# _AM_SET_OPTION(NAME)
29374929c8f8Smrg# --------------------
29384929c8f8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
29394929c8f8SmrgAC_DEFUN([_AM_SET_OPTION],
29404929c8f8Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941df58931aSmrg
29424929c8f8Smrg# _AM_SET_OPTIONS(OPTIONS)
29434929c8f8Smrg# ------------------------
29444929c8f8Smrg# OPTIONS is a space-separated list of Automake options.
29454929c8f8SmrgAC_DEFUN([_AM_SET_OPTIONS],
29464929c8f8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947df58931aSmrg
29484929c8f8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29494929c8f8Smrg# -------------------------------------------
29504929c8f8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29514929c8f8SmrgAC_DEFUN([_AM_IF_OPTION],
29524929c8f8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953df58931aSmrg
29544929c8f8Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955df58931aSmrg#
29564929c8f8Smrg# This file is free software; the Free Software Foundation
29574929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
29584929c8f8Smrg# with or without modifications, as long as this notice is preserved.
2959df58931aSmrg
29604929c8f8Smrg# _AM_PROG_CC_C_O
29614929c8f8Smrg# ---------------
29624929c8f8Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29634929c8f8Smrg# to automatically call this.
29644929c8f8SmrgAC_DEFUN([_AM_PROG_CC_C_O],
29654929c8f8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29664929c8f8SmrgAC_REQUIRE_AUX_FILE([compile])dnl
29674929c8f8SmrgAC_LANG_PUSH([C])dnl
29684929c8f8SmrgAC_CACHE_CHECK(
29694929c8f8Smrg  [whether $CC understands -c and -o together],
29704929c8f8Smrg  [am_cv_prog_cc_c_o],
29714929c8f8Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29724929c8f8Smrg  # Make sure it works both with $CC and with simple cc.
29734929c8f8Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29744929c8f8Smrg  # compilers refuse to overwrite an existing .o file with -o,
29754929c8f8Smrg  # though they will create one.
29764929c8f8Smrg  am_cv_prog_cc_c_o=yes
29774929c8f8Smrg  for am_i in 1 2; do
29784929c8f8Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29794929c8f8Smrg         && test -f conftest2.$ac_objext; then
29804929c8f8Smrg      : OK
29814929c8f8Smrg    else
29824929c8f8Smrg      am_cv_prog_cc_c_o=no
29834929c8f8Smrg      break
29844929c8f8Smrg    fi
29854929c8f8Smrg  done
29864929c8f8Smrg  rm -f core conftest*
29874929c8f8Smrg  unset am_i])
29884929c8f8Smrgif test "$am_cv_prog_cc_c_o" != yes; then
29894929c8f8Smrg   # Losing compiler, so override with the script.
29904929c8f8Smrg   # FIXME: It is wrong to rewrite CC.
29914929c8f8Smrg   # But if we don't then we get into trouble of one sort or another.
29924929c8f8Smrg   # A longer-term fix would be to have automake use am__CC in this case,
29934929c8f8Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29944929c8f8Smrg   CC="$am_aux_dir/compile $CC"
2995df58931aSmrgfi
29964929c8f8SmrgAC_LANG_POP([C])])
2997df58931aSmrg
29984929c8f8Smrg# For backward compatibility.
29994929c8f8SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30004929c8f8Smrg
30014929c8f8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30024929c8f8Smrg#
30034929c8f8Smrg# This file is free software; the Free Software Foundation
30044929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
30054929c8f8Smrg# with or without modifications, as long as this notice is preserved.
3006df58931aSmrg
30074929c8f8Smrg# AM_RUN_LOG(COMMAND)
30084929c8f8Smrg# -------------------
30094929c8f8Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30104929c8f8Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30114929c8f8SmrgAC_DEFUN([AM_RUN_LOG],
30124929c8f8Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30134929c8f8Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30144929c8f8Smrg   ac_status=$?
30154929c8f8Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30164929c8f8Smrg   (exit $ac_status); }])
3017df58931aSmrg
30184929c8f8Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019df58931aSmrg
30204929c8f8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30214929c8f8Smrg#
30224929c8f8Smrg# This file is free software; the Free Software Foundation
30234929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
30244929c8f8Smrg# with or without modifications, as long as this notice is preserved.
3025df58931aSmrg
30264929c8f8Smrg# AM_SANITY_CHECK
30274929c8f8Smrg# ---------------
30284929c8f8SmrgAC_DEFUN([AM_SANITY_CHECK],
30294929c8f8Smrg[AC_MSG_CHECKING([whether build environment is sane])
30304929c8f8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30314929c8f8Smrg# name.  Accept space and tab only in the latter.
30324929c8f8Smrgam_lf='
30334929c8f8Smrg'
30344929c8f8Smrgcase `pwd` in
30354929c8f8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30364929c8f8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30374929c8f8Smrgesac
30384929c8f8Smrgcase $srcdir in
30394929c8f8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30404929c8f8Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30414929c8f8Smrgesac
3042df58931aSmrg
30434929c8f8Smrg# Do 'set' in a subshell so we don't clobber the current shell's
30444929c8f8Smrg# arguments.  Must try -L first in case configure is actually a
30454929c8f8Smrg# symlink; some systems play weird games with the mod time of symlinks
30464929c8f8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
30474929c8f8Smrg# directory).
30484929c8f8Smrgif (
30494929c8f8Smrg   am_has_slept=no
30504929c8f8Smrg   for am_try in 1 2; do
30514929c8f8Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30524929c8f8Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30534929c8f8Smrg     if test "$[*]" = "X"; then
30544929c8f8Smrg	# -L didn't work.
30554929c8f8Smrg	set X `ls -t "$srcdir/configure" conftest.file`
30564929c8f8Smrg     fi
30574929c8f8Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30584929c8f8Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
30594929c8f8Smrg
30604929c8f8Smrg	# If neither matched, then we have a broken ls.  This can happen
30614929c8f8Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30624929c8f8Smrg	# broken ls alias from the environment.  This has actually
30634929c8f8Smrg	# happened.  Such a system could not be considered "sane".
30644929c8f8Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30654929c8f8Smrg  alias in your environment])
30664929c8f8Smrg     fi
30674929c8f8Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30684929c8f8Smrg       break
30694929c8f8Smrg     fi
30704929c8f8Smrg     # Just in case.
30714929c8f8Smrg     sleep 1
30724929c8f8Smrg     am_has_slept=yes
30734929c8f8Smrg   done
30744929c8f8Smrg   test "$[2]" = conftest.file
30754929c8f8Smrg   )
30764929c8f8Smrgthen
30774929c8f8Smrg   # Ok.
30784929c8f8Smrg   :
3079df58931aSmrgelse
30804929c8f8Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
30814929c8f8SmrgCheck your system clock])
3082df58931aSmrgfi
30834929c8f8SmrgAC_MSG_RESULT([yes])
30844929c8f8Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30854929c8f8Smrg# generated files are strictly newer.
30864929c8f8Smrgam_sleep_pid=
30874929c8f8Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30884929c8f8Smrg  ( sleep 1 ) &
30894929c8f8Smrg  am_sleep_pid=$!
30904929c8f8Smrgfi
30914929c8f8SmrgAC_CONFIG_COMMANDS_PRE(
30924929c8f8Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30934929c8f8Smrg   if test -n "$am_sleep_pid"; then
30944929c8f8Smrg     # Hide warnings about reused PIDs.
30954929c8f8Smrg     wait $am_sleep_pid 2>/dev/null
30964929c8f8Smrg   fi
30974929c8f8Smrg   AC_MSG_RESULT([done])])
30984929c8f8Smrgrm -f conftest.file
30994929c8f8Smrg])
3100df58931aSmrg
31014929c8f8Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102b66d1acbSmrg#
31034929c8f8Smrg# This file is free software; the Free Software Foundation
31044929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
31054929c8f8Smrg# with or without modifications, as long as this notice is preserved.
3106b66d1acbSmrg
31074929c8f8Smrg# AM_SILENT_RULES([DEFAULT])
31084929c8f8Smrg# --------------------------
31094929c8f8Smrg# Enable less verbose build rules; with the default set to DEFAULT
31104929c8f8Smrg# ("yes" being less verbose, "no" or empty being verbose).
31114929c8f8SmrgAC_DEFUN([AM_SILENT_RULES],
31124929c8f8Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31134929c8f8SmrgAS_HELP_STRING(
31144929c8f8Smrg  [--enable-silent-rules],
31154929c8f8Smrg  [less verbose build output (undo: "make V=1")])
31164929c8f8SmrgAS_HELP_STRING(
31174929c8f8Smrg  [--disable-silent-rules],
31184929c8f8Smrg  [verbose build output (undo: "make V=0")])dnl
31194929c8f8Smrg])
31204929c8f8Smrgcase $enable_silent_rules in @%:@ (((
31214929c8f8Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31224929c8f8Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31234929c8f8Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31244929c8f8Smrgesac
31254929c8f8Smrgdnl
31264929c8f8Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31274929c8f8Smrgdnl do not support nested variable expansions.
31284929c8f8Smrgdnl See automake bug#9928 and bug#10237.
31294929c8f8Smrgam_make=${MAKE-make}
31304929c8f8SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31314929c8f8Smrg   [am_cv_make_support_nested_variables],
31324929c8f8Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31334929c8f8SmrgBAR0=false
31344929c8f8SmrgBAR1=true
31354929c8f8SmrgV=1
31364929c8f8Smrgam__doit:
31374929c8f8Smrg	@$(TRUE)
31384929c8f8Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31394929c8f8Smrg  am_cv_make_support_nested_variables=yes
31404929c8f8Smrgelse
31414929c8f8Smrg  am_cv_make_support_nested_variables=no
31424929c8f8Smrgfi])
31434929c8f8Smrgif test $am_cv_make_support_nested_variables = yes; then
31444929c8f8Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31454929c8f8Smrg  AM_V='$(V)'
31464929c8f8Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31474929c8f8Smrgelse
31484929c8f8Smrg  AM_V=$AM_DEFAULT_VERBOSITY
31494929c8f8Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31504929c8f8Smrgfi
31514929c8f8SmrgAC_SUBST([AM_V])dnl
31524929c8f8SmrgAM_SUBST_NOTMAKE([AM_V])dnl
31534929c8f8SmrgAC_SUBST([AM_DEFAULT_V])dnl
31544929c8f8SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31554929c8f8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31564929c8f8SmrgAM_BACKSLASH='\'
31574929c8f8SmrgAC_SUBST([AM_BACKSLASH])dnl
31584929c8f8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31594929c8f8Smrg])
31604929c8f8Smrg
31614929c8f8Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162df58931aSmrg#
31634929c8f8Smrg# This file is free software; the Free Software Foundation
31644929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
31654929c8f8Smrg# with or without modifications, as long as this notice is preserved.
31664929c8f8Smrg
31674929c8f8Smrg# AM_PROG_INSTALL_STRIP
31684929c8f8Smrg# ---------------------
31694929c8f8Smrg# One issue with vendor 'install' (even GNU) is that you can't
31704929c8f8Smrg# specify the program used to strip binaries.  This is especially
31714929c8f8Smrg# annoying in cross-compiling environments, where the build's strip
31724929c8f8Smrg# is unlikely to handle the host's binaries.
31734929c8f8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31744929c8f8Smrg# always use install-sh in "make install-strip", and initialize
31754929c8f8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
31764929c8f8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31774929c8f8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31784929c8f8Smrg# Installed binaries are usually stripped using 'strip' when the user
31794929c8f8Smrg# run "make install-strip".  However 'strip' might not be the right
31804929c8f8Smrg# tool to use in cross-compilation environments, therefore Automake
31814929c8f8Smrg# will honor the 'STRIP' environment variable to overrule this program.
31824929c8f8Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31834929c8f8Smrgif test "$cross_compiling" != no; then
31844929c8f8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
31854929c8f8Smrgfi
31864929c8f8SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31874929c8f8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188b66d1acbSmrg
31894929c8f8Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31904929c8f8Smrg#
31914929c8f8Smrg# This file is free software; the Free Software Foundation
31924929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
31934929c8f8Smrg# with or without modifications, as long as this notice is preserved.
3194df58931aSmrg
31954929c8f8Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
31964929c8f8Smrg# ---------------------------
31974929c8f8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31984929c8f8Smrg# This macro is traced by Automake.
31994929c8f8SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200df58931aSmrg
32014929c8f8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32024929c8f8Smrg# --------------------------
32034929c8f8Smrg# Public sister of _AM_SUBST_NOTMAKE.
32044929c8f8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205df58931aSmrg
32064929c8f8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3207df58931aSmrg
32084929c8f8Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32094929c8f8Smrg#
32104929c8f8Smrg# This file is free software; the Free Software Foundation
32114929c8f8Smrg# gives unlimited permission to copy and/or distribute it,
32124929c8f8Smrg# with or without modifications, as long as this notice is preserved.
3213b66d1acbSmrg
32144929c8f8Smrg# _AM_PROG_TAR(FORMAT)
3215b66d1acbSmrg# --------------------
32164929c8f8Smrg# Check how to create a tarball in format FORMAT.
32174929c8f8Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218b66d1acbSmrg#
32194929c8f8Smrg# Substitute a variable $(am__tar) that is a command
32204929c8f8Smrg# writing to stdout a FORMAT-tarball containing the directory
32214929c8f8Smrg# $tardir.
32224929c8f8Smrg#     tardir=directory && $(am__tar) > result.tar
3223df58931aSmrg#
32244929c8f8Smrg# Substitute a variable $(am__untar) that extract such
32254929c8f8Smrg# a tarball read from stdin.
32264929c8f8Smrg#     $(am__untar) < result.tar
3227df58931aSmrg#
32284929c8f8SmrgAC_DEFUN([_AM_PROG_TAR],
32294929c8f8Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32304929c8f8Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32314929c8f8SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32324fb28925Smrg
32334929c8f8Smrg# We'll loop over all known methods to create a tar archive until one works.
32344929c8f8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235df58931aSmrg
32364929c8f8Smrgm4_if([$1], [v7],
32374929c8f8Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32384fb28925Smrg
32394929c8f8Smrg  [m4_case([$1],
32404929c8f8Smrg    [ustar],
32414929c8f8Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32424929c8f8Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32434929c8f8Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32444929c8f8Smrg      # and bug#13588).
32454929c8f8Smrg      am_max_uid=2097151 # 2^21 - 1
32464929c8f8Smrg      am_max_gid=$am_max_uid
32474929c8f8Smrg      # The $UID and $GID variables are not portable, so we need to resort
32484929c8f8Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32494929c8f8Smrg      # below are definitely unexpected, so allow the users to see them
32504929c8f8Smrg      # (that is, avoid stderr redirection).
32514929c8f8Smrg      am_uid=`id -u || echo unknown`
32524929c8f8Smrg      am_gid=`id -g || echo unknown`
32534929c8f8Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32544929c8f8Smrg      if test $am_uid -le $am_max_uid; then
32554929c8f8Smrg         AC_MSG_RESULT([yes])
32564929c8f8Smrg      else
32574929c8f8Smrg         AC_MSG_RESULT([no])
32584929c8f8Smrg         _am_tools=none
32594929c8f8Smrg      fi
32604929c8f8Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32614929c8f8Smrg      if test $am_gid -le $am_max_gid; then
32624929c8f8Smrg         AC_MSG_RESULT([yes])
32634929c8f8Smrg      else
32644929c8f8Smrg        AC_MSG_RESULT([no])
32654929c8f8Smrg        _am_tools=none
32664929c8f8Smrg      fi],
32674929c8f8Smrg
32684929c8f8Smrg  [pax],
32694929c8f8Smrg    [],
32704929c8f8Smrg
32714929c8f8Smrg  [m4_fatal([Unknown tar format])])
32724929c8f8Smrg
32734929c8f8Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
32744929c8f8Smrg
32754929c8f8Smrg  # Go ahead even if we have the value already cached.  We do so because we
32764929c8f8Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32774929c8f8Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32784929c8f8Smrg
32794929c8f8Smrg  for _am_tool in $_am_tools; do
32804929c8f8Smrg    case $_am_tool in
32814929c8f8Smrg    gnutar)
32824929c8f8Smrg      for _am_tar in tar gnutar gtar; do
32834929c8f8Smrg        AM_RUN_LOG([$_am_tar --version]) && break
32844929c8f8Smrg      done
32854929c8f8Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32864929c8f8Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32874929c8f8Smrg      am__untar="$_am_tar -xf -"
32884929c8f8Smrg      ;;
32894929c8f8Smrg    plaintar)
32904929c8f8Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32914929c8f8Smrg      # ustar tarball either.
32924929c8f8Smrg      (tar --version) >/dev/null 2>&1 && continue
32934929c8f8Smrg      am__tar='tar chf - "$$tardir"'
32944929c8f8Smrg      am__tar_='tar chf - "$tardir"'
32954929c8f8Smrg      am__untar='tar xf -'
32964929c8f8Smrg      ;;
32974929c8f8Smrg    pax)
32984929c8f8Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
32994929c8f8Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33004929c8f8Smrg      am__untar='pax -r'
33014929c8f8Smrg      ;;
33024929c8f8Smrg    cpio)
33034929c8f8Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33044929c8f8Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33054929c8f8Smrg      am__untar='cpio -i -H $1 -d'
33064929c8f8Smrg      ;;
33074929c8f8Smrg    none)
33084929c8f8Smrg      am__tar=false
33094929c8f8Smrg      am__tar_=false
33104929c8f8Smrg      am__untar=false
33114929c8f8Smrg      ;;
33124929c8f8Smrg    esac
33134929c8f8Smrg
33144929c8f8Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33154929c8f8Smrg    # and am__untar set.
33164929c8f8Smrg    test -n "${am_cv_prog_tar_$1}" && break
33174929c8f8Smrg
33184929c8f8Smrg    # tar/untar a dummy directory, and stop if the command works.
33194929c8f8Smrg    rm -rf conftest.dir
33204929c8f8Smrg    mkdir conftest.dir
33214929c8f8Smrg    echo GrepMe > conftest.dir/file
33224929c8f8Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33234929c8f8Smrg    rm -rf conftest.dir
33244929c8f8Smrg    if test -s conftest.tar; then
33254929c8f8Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33264929c8f8Smrg      AM_RUN_LOG([cat conftest.dir/file])
33274929c8f8Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33284929c8f8Smrg    fi
33294929c8f8Smrg  done
33304929c8f8Smrg  rm -rf conftest.dir
33314929c8f8Smrg
33324929c8f8Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33334929c8f8Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33344929c8f8Smrg
33354929c8f8SmrgAC_SUBST([am__tar])
33364929c8f8SmrgAC_SUBST([am__untar])
33374929c8f8Smrg]) # _AM_PROG_TAR
3338b66d1acbSmrg
3339