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