aclocal.m4 revision 2f6f3826
1585aa3f7Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2585aa3f7Smrg
3585aa3f7Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4fdb3d228Smrg
5fdb3d228Smrg# This file is free software; the Free Software Foundation
6fdb3d228Smrg# gives unlimited permission to copy and/or distribute it,
7fdb3d228Smrg# with or without modifications, as long as this notice is preserved.
8fdb3d228Smrg
9fdb3d228Smrg# This program is distributed in the hope that it will be useful,
10fdb3d228Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fdb3d228Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fdb3d228Smrg# PARTICULAR PURPOSE.
13fdb3d228Smrg
14585aa3f7Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
159b41ff1aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
169b41ff1aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17585aa3f7Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18585aa3f7Smrg[m4_warning([this file was generated for autoconf 2.69.
199b41ff1aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
209b41ff1aSmrgIf you have problems, you may need to regenerate the build system entirely.
21585aa3f7SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22fdb3d228Smrg
232f6f3826Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
242f6f3826Smrgdnl serial 11 (pkg-config-0.29)
252f6f3826Smrgdnl
262f6f3826Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
272f6f3826Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
282f6f3826Smrgdnl
292f6f3826Smrgdnl This program is free software; you can redistribute it and/or modify
302f6f3826Smrgdnl it under the terms of the GNU General Public License as published by
312f6f3826Smrgdnl the Free Software Foundation; either version 2 of the License, or
322f6f3826Smrgdnl (at your option) any later version.
332f6f3826Smrgdnl
342f6f3826Smrgdnl This program is distributed in the hope that it will be useful, but
352f6f3826Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
362f6f3826Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
372f6f3826Smrgdnl General Public License for more details.
382f6f3826Smrgdnl
392f6f3826Smrgdnl You should have received a copy of the GNU General Public License
402f6f3826Smrgdnl along with this program; if not, write to the Free Software
412f6f3826Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
422f6f3826Smrgdnl 02111-1307, USA.
432f6f3826Smrgdnl
442f6f3826Smrgdnl As a special exception to the GNU General Public License, if you
452f6f3826Smrgdnl distribute this file as part of a program that contains a
462f6f3826Smrgdnl configuration script generated by Autoconf, you may include it under
472f6f3826Smrgdnl the same distribution terms that you use for the rest of that
482f6f3826Smrgdnl program.
492f6f3826Smrg
502f6f3826Smrgdnl PKG_PREREQ(MIN-VERSION)
512f6f3826Smrgdnl -----------------------
522f6f3826Smrgdnl Since: 0.29
532f6f3826Smrgdnl
542f6f3826Smrgdnl Verify that the version of the pkg-config macros are at least
552f6f3826Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
562f6f3826Smrgdnl installed version of pkg-config, this checks the developer's version
572f6f3826Smrgdnl of pkg.m4 when generating configure.
582f6f3826Smrgdnl
592f6f3826Smrgdnl To ensure that this macro is defined, also add:
602f6f3826Smrgdnl m4_ifndef([PKG_PREREQ],
612f6f3826Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
622f6f3826Smrgdnl
632f6f3826Smrgdnl See the "Since" comment for each macro you use to see what version
642f6f3826Smrgdnl of the macros you require.
652f6f3826Smrgm4_defun([PKG_PREREQ],
662f6f3826Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
672f6f3826Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
682f6f3826Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
692f6f3826Smrg])dnl PKG_PREREQ
702f6f3826Smrg
712f6f3826Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
722f6f3826Smrgdnl ----------------------------------
732f6f3826Smrgdnl Since: 0.16
742f6f3826Smrgdnl
752f6f3826Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
762f6f3826Smrgdnl first found in the path. Checks that the version of pkg-config found
772f6f3826Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
782f6f3826Smrgdnl used since that's the first version where most current features of
792f6f3826Smrgdnl pkg-config existed.
802f6f3826SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
812f6f3826Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
822f6f3826Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
832f6f3826Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
842f6f3826SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
852f6f3826SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
862f6f3826SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87fdb3d228Smrg
882f6f3826Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
892f6f3826Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
902f6f3826Smrgfi
912f6f3826Smrgif test -n "$PKG_CONFIG"; then
922f6f3826Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
932f6f3826Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
942f6f3826Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
952f6f3826Smrg		AC_MSG_RESULT([yes])
962f6f3826Smrg	else
972f6f3826Smrg		AC_MSG_RESULT([no])
982f6f3826Smrg		PKG_CONFIG=""
992f6f3826Smrg	fi
1002f6f3826Smrgfi[]dnl
1012f6f3826Smrg])dnl PKG_PROG_PKG_CONFIG
1029b41ff1aSmrg
1032f6f3826Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1042f6f3826Smrgdnl -------------------------------------------------------------------
1052f6f3826Smrgdnl Since: 0.18
1062f6f3826Smrgdnl
1072f6f3826Smrgdnl Check to see whether a particular set of modules exists. Similar to
1082f6f3826Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1092f6f3826Smrgdnl
1102f6f3826Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1112f6f3826Smrgdnl only at the first occurence in configure.ac, so if the first place
1122f6f3826Smrgdnl it's called might be skipped (such as if it is within an "if", you
1132f6f3826Smrgdnl have to call PKG_CHECK_EXISTS manually
1142f6f3826SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1152f6f3826Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1162f6f3826Smrgif test -n "$PKG_CONFIG" && \
1172f6f3826Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1182f6f3826Smrg  m4_default([$2], [:])
1192f6f3826Smrgm4_ifvaln([$3], [else
1202f6f3826Smrg  $3])dnl
1212f6f3826Smrgfi])
122fdb3d228Smrg
1232f6f3826Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1242f6f3826Smrgdnl ---------------------------------------------
1252f6f3826Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1262f6f3826Smrgdnl pkg_failed based on the result.
1272f6f3826Smrgm4_define([_PKG_CONFIG],
1282f6f3826Smrg[if test -n "$$1"; then
1292f6f3826Smrg    pkg_cv_[]$1="$$1"
1302f6f3826Smrg elif test -n "$PKG_CONFIG"; then
1312f6f3826Smrg    PKG_CHECK_EXISTS([$3],
1322f6f3826Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1332f6f3826Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1342f6f3826Smrg		     [pkg_failed=yes])
1352f6f3826Smrg else
1362f6f3826Smrg    pkg_failed=untried
1372f6f3826Smrgfi[]dnl
1382f6f3826Smrg])dnl _PKG_CONFIG
139fdb3d228Smrg
1402f6f3826Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1412f6f3826Smrgdnl ---------------------------
1422f6f3826Smrgdnl Internal check to see if pkg-config supports short errors.
1432f6f3826SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1442f6f3826Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1452f6f3826Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1462f6f3826Smrg        _pkg_short_errors_supported=yes
1472f6f3826Smrgelse
1482f6f3826Smrg        _pkg_short_errors_supported=no
1492f6f3826Smrgfi[]dnl
1502f6f3826Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151fdb3d228Smrg
152fdb3d228Smrg
1532f6f3826Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1542f6f3826Smrgdnl   [ACTION-IF-NOT-FOUND])
1552f6f3826Smrgdnl --------------------------------------------------------------
1562f6f3826Smrgdnl Since: 0.4.0
1572f6f3826Smrgdnl
1582f6f3826Smrgdnl Note that if there is a possibility the first call to
1592f6f3826Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1602f6f3826Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1612f6f3826SmrgAC_DEFUN([PKG_CHECK_MODULES],
1622f6f3826Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1632f6f3826SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1642f6f3826SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165fdb3d228Smrg
1662f6f3826Smrgpkg_failed=no
1672f6f3826SmrgAC_MSG_CHECKING([for $1])
168fdb3d228Smrg
1692f6f3826Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1702f6f3826Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171fdb3d228Smrg
1722f6f3826Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1732f6f3826Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1742f6f3826SmrgSee the pkg-config man page for more details.])
175fdb3d228Smrg
1762f6f3826Smrgif test $pkg_failed = yes; then
1772f6f3826Smrg   	AC_MSG_RESULT([no])
1782f6f3826Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1792f6f3826Smrg        if test $_pkg_short_errors_supported = yes; then
1802f6f3826Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1812f6f3826Smrg        else 
1822f6f3826Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1832f6f3826Smrg        fi
1842f6f3826Smrg	# Put the nasty error message in config.log where it belongs
1852f6f3826Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186fdb3d228Smrg
1872f6f3826Smrg	m4_default([$4], [AC_MSG_ERROR(
1882f6f3826Smrg[Package requirements ($2) were not met:
189fdb3d228Smrg
1902f6f3826Smrg$$1_PKG_ERRORS
191fdb3d228Smrg
1922f6f3826SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1932f6f3826Smrginstalled software in a non-standard prefix.
194fdb3d228Smrg
1952f6f3826Smrg_PKG_TEXT])[]dnl
1962f6f3826Smrg        ])
1972f6f3826Smrgelif test $pkg_failed = untried; then
1982f6f3826Smrg     	AC_MSG_RESULT([no])
1992f6f3826Smrg	m4_default([$4], [AC_MSG_FAILURE(
2002f6f3826Smrg[The pkg-config script could not be found or is too old.  Make sure it
2012f6f3826Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2022f6f3826Smrgpath to pkg-config.
203fdb3d228Smrg
2042f6f3826Smrg_PKG_TEXT
205fdb3d228Smrg
2062f6f3826SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2072f6f3826Smrg        ])
2082f6f3826Smrgelse
2092f6f3826Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2102f6f3826Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2112f6f3826Smrg        AC_MSG_RESULT([yes])
2122f6f3826Smrg	$3
2132f6f3826Smrgfi[]dnl
2142f6f3826Smrg])dnl PKG_CHECK_MODULES
215fdb3d228Smrg
216fdb3d228Smrg
2172f6f3826Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2182f6f3826Smrgdnl   [ACTION-IF-NOT-FOUND])
2192f6f3826Smrgdnl ---------------------------------------------------------------------
2202f6f3826Smrgdnl Since: 0.29
2212f6f3826Smrgdnl
2222f6f3826Smrgdnl Checks for existence of MODULES and gathers its build flags with
2232f6f3826Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2242f6f3826Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2252f6f3826Smrgdnl
2262f6f3826Smrgdnl Note that if there is a possibility the first call to
2272f6f3826Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2282f6f3826Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2292f6f3826Smrgdnl configure.ac.
2302f6f3826SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2312f6f3826Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2322f6f3826Smrg_save_PKG_CONFIG=$PKG_CONFIG
2332f6f3826SmrgPKG_CONFIG="$PKG_CONFIG --static"
2342f6f3826SmrgPKG_CHECK_MODULES($@)
2352f6f3826SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2362f6f3826Smrg])dnl PKG_CHECK_MODULES_STATIC
2379b41ff1aSmrg
238fdb3d228Smrg
2392f6f3826Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2402f6f3826Smrgdnl -------------------------
2412f6f3826Smrgdnl Since: 0.27
2422f6f3826Smrgdnl
2432f6f3826Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2442f6f3826Smrgdnl should install pkg-config .pc files. By default the directory is
2452f6f3826Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2462f6f3826Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2472f6f3826Smrgdnl parameter.
2482f6f3826SmrgAC_DEFUN([PKG_INSTALLDIR],
2492f6f3826Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2502f6f3826Smrgm4_pushdef([pkg_description],
2512f6f3826Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2522f6f3826SmrgAC_ARG_WITH([pkgconfigdir],
2532f6f3826Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2542f6f3826Smrg    [with_pkgconfigdir=]pkg_default)
2552f6f3826SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2562f6f3826Smrgm4_popdef([pkg_default])
2572f6f3826Smrgm4_popdef([pkg_description])
2582f6f3826Smrg])dnl PKG_INSTALLDIR
2592f6f3826Smrg
2602f6f3826Smrg
2612f6f3826Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2622f6f3826Smrgdnl --------------------------------
2632f6f3826Smrgdnl Since: 0.27
2642f6f3826Smrgdnl
2652f6f3826Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2662f6f3826Smrgdnl module should install arch-independent pkg-config .pc files. By
2672f6f3826Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2682f6f3826Smrgdnl changed by passing DIRECTORY. The user can override through the
2692f6f3826Smrgdnl --with-noarch-pkgconfigdir parameter.
2702f6f3826SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2712f6f3826Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2722f6f3826Smrgm4_pushdef([pkg_description],
2732f6f3826Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2742f6f3826SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2752f6f3826Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2762f6f3826Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2772f6f3826SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2782f6f3826Smrgm4_popdef([pkg_default])
2792f6f3826Smrgm4_popdef([pkg_description])
2802f6f3826Smrg])dnl PKG_NOARCH_INSTALLDIR
2812f6f3826Smrg
2822f6f3826Smrg
2832f6f3826Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2842f6f3826Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2852f6f3826Smrgdnl -------------------------------------------
2862f6f3826Smrgdnl Since: 0.28
2872f6f3826Smrgdnl
2882f6f3826Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2892f6f3826SmrgAC_DEFUN([PKG_CHECK_VAR],
2902f6f3826Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2912f6f3826SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292fdb3d228Smrg
2932f6f3826Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2942f6f3826SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2952f6f3826Smrg
2962f6f3826SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2972f6f3826Smrg])dnl PKG_CHECK_VAR
2982f6f3826Smrg
2992f6f3826Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3002f6f3826Smrgdnl
3012f6f3826Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3022f6f3826Smrgdnl
3032f6f3826Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3042f6f3826Smrgdnl copy of this software and associated documentation files (the "Software"),
3052f6f3826Smrgdnl to deal in the Software without restriction, including without limitation
3062f6f3826Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3072f6f3826Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3082f6f3826Smrgdnl Software is furnished to do so, subject to the following conditions:
3092f6f3826Smrgdnl
3102f6f3826Smrgdnl The above copyright notice and this permission notice (including the next
3112f6f3826Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3122f6f3826Smrgdnl Software.
3132f6f3826Smrgdnl
3142f6f3826Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3152f6f3826Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3162f6f3826Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3172f6f3826Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3182f6f3826Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3192f6f3826Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3202f6f3826Smrgdnl DEALINGS IN THE SOFTWARE.
3212f6f3826Smrg
3222f6f3826Smrg# XORG_MACROS_VERSION(required-version)
3232f6f3826Smrg# -------------------------------------
3242f6f3826Smrg# Minimum version: 1.1.0
3252f6f3826Smrg#
3262f6f3826Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3272f6f3826Smrg# your configure.ac with the minimum required version, such as:
3282f6f3826Smrg# XORG_MACROS_VERSION(1.1)
3292f6f3826Smrg#
3302f6f3826Smrg# To ensure that this macro is defined, also add:
3312f6f3826Smrg# m4_ifndef([XORG_MACROS_VERSION],
3322f6f3826Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3332f6f3826Smrg#
3342f6f3826Smrg#
3352f6f3826Smrg# See the "minimum version" comment for each macro you use to see what
3362f6f3826Smrg# version you require.
3372f6f3826Smrgm4_defun([XORG_MACROS_VERSION],[
3382f6f3826Smrgm4_define([vers_have], [1.19.0])
3392f6f3826Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3402f6f3826Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3412f6f3826Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3422f6f3826Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3432f6f3826Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3442f6f3826Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3452f6f3826Smrgm4_undefine([vers_have])
3462f6f3826Smrgm4_undefine([maj_have])
3472f6f3826Smrgm4_undefine([maj_needed])
3482f6f3826Smrg]) # XORG_MACROS_VERSION
3492f6f3826Smrg
3502f6f3826Smrg# XORG_PROG_RAWCPP()
3512f6f3826Smrg# ------------------
3522f6f3826Smrg# Minimum version: 1.0.0
3532f6f3826Smrg#
3542f6f3826Smrg# Find cpp program and necessary flags for use in pre-processing text files
3552f6f3826Smrg# such as man pages and config files
3562f6f3826SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3572f6f3826SmrgAC_REQUIRE([AC_PROG_CPP])
3582f6f3826SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3592f6f3826Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3602f6f3826Smrg
3612f6f3826Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3622f6f3826Smrg# which is not the best choice for supporting other OS'es, but covers most
3632f6f3826Smrg# of the ones we need for now.
3642f6f3826SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3652f6f3826SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3662f6f3826Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3672f6f3826Smrg	AC_MSG_RESULT([no])
368fdb3d228Smrgelse
3692f6f3826Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3702f6f3826Smrg		RAWCPPFLAGS=-undef
3712f6f3826Smrg		AC_MSG_RESULT([yes])
3722f6f3826Smrg	# under Cygwin unix is still defined even with -undef
3732f6f3826Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3742f6f3826Smrg		RAWCPPFLAGS="-undef -ansi"
3752f6f3826Smrg		AC_MSG_RESULT([yes, with -ansi])
3762f6f3826Smrg	else
3772f6f3826Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3782f6f3826Smrg	fi
379fdb3d228Smrgfi
3802f6f3826Smrgrm -f conftest.$ac_ext
381fdb3d228Smrg
3822f6f3826SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3832f6f3826SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3842f6f3826Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3852f6f3826Smrg	AC_MSG_RESULT([no])
3862f6f3826Smrgelse
3872f6f3826Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3882f6f3826Smrg		TRADITIONALCPPFLAGS="-traditional"
3892f6f3826Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3902f6f3826Smrg		AC_MSG_RESULT([yes])
3912f6f3826Smrg	else
3922f6f3826Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3932f6f3826Smrg	fi
3942f6f3826Smrgfi
3952f6f3826Smrgrm -f conftest.$ac_ext
3962f6f3826SmrgAC_SUBST(RAWCPPFLAGS)
3972f6f3826SmrgAC_SUBST(TRADITIONALCPPFLAGS)
3982f6f3826Smrg]) # XORG_PROG_RAWCPP
399fdb3d228Smrg
4002f6f3826Smrg# XORG_MANPAGE_SECTIONS()
4012f6f3826Smrg# -----------------------
4022f6f3826Smrg# Minimum version: 1.0.0
4032f6f3826Smrg#
4042f6f3826Smrg# Determine which sections man pages go in for the different man page types
4052f6f3826Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4062f6f3826Smrg# Not sure if there's any better way than just hardcoding by OS name.
4072f6f3826Smrg# Override default settings by setting environment variables
4082f6f3826Smrg# Added MAN_SUBSTS in version 1.8
4092f6f3826Smrg# Added AC_PROG_SED in version 1.8
410fdb3d228Smrg
4112f6f3826SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4122f6f3826SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4132f6f3826SmrgAC_REQUIRE([AC_PROG_SED])
414fdb3d228Smrg
4152f6f3826Smrgif test x$APP_MAN_SUFFIX = x    ; then
4162f6f3826Smrg    APP_MAN_SUFFIX=1
4172f6f3826Smrgfi
4182f6f3826Smrgif test x$APP_MAN_DIR = x    ; then
4192f6f3826Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420fdb3d228Smrgfi
421fdb3d228Smrg
4222f6f3826Smrgif test x$LIB_MAN_SUFFIX = x    ; then
4232f6f3826Smrg    LIB_MAN_SUFFIX=3
4242f6f3826Smrgfi
4252f6f3826Smrgif test x$LIB_MAN_DIR = x    ; then
4262f6f3826Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4272f6f3826Smrgfi
428fdb3d228Smrg
4292f6f3826Smrgif test x$FILE_MAN_SUFFIX = x    ; then
4302f6f3826Smrg    case $host_os in
4312f6f3826Smrg	# Solaris 2.0 - 11 use SysV man page sections
4322f6f3826Smrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4332f6f3826Smrg	*)				FILE_MAN_SUFFIX=5  ;;
4342f6f3826Smrg    esac
4352f6f3826Smrgfi
4362f6f3826Smrgif test x$FILE_MAN_DIR = x    ; then
4372f6f3826Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4382f6f3826Smrgfi
439fdb3d228Smrg
4402f6f3826Smrgif test x$MISC_MAN_SUFFIX = x    ; then
4412f6f3826Smrg    case $host_os in
4422f6f3826Smrg	# Solaris 2.0 - 11 use SysV man page sections
4432f6f3826Smrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4442f6f3826Smrg	*)				MISC_MAN_SUFFIX=7  ;;
4452f6f3826Smrg    esac
4462f6f3826Smrgfi
4472f6f3826Smrgif test x$MISC_MAN_DIR = x    ; then
4482f6f3826Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4492f6f3826Smrgfi
450fdb3d228Smrg
4512f6f3826Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4522f6f3826Smrg    case $host_os in
4532f6f3826Smrg	# Solaris 2.0 - 11 use SysV man page sections
4542f6f3826Smrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4552f6f3826Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4562f6f3826Smrg    esac
4572f6f3826Smrgfi
4582f6f3826Smrgif test x$DRIVER_MAN_DIR = x    ; then
4592f6f3826Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4602f6f3826Smrgfi
4612f6f3826Smrg
4622f6f3826Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4632f6f3826Smrg    case $host_os in
4642f6f3826Smrg	# Solaris 2.0 - 11 use SysV man page sections
4652f6f3826Smrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4662f6f3826Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4672f6f3826Smrg    esac
4682f6f3826Smrgfi
4692f6f3826Smrgif test x$ADMIN_MAN_DIR = x    ; then
4702f6f3826Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4712f6f3826Smrgfi
472fdb3d228Smrg
473fdb3d228Smrg
4742f6f3826SmrgAC_SUBST([APP_MAN_SUFFIX])
4752f6f3826SmrgAC_SUBST([LIB_MAN_SUFFIX])
4762f6f3826SmrgAC_SUBST([FILE_MAN_SUFFIX])
4772f6f3826SmrgAC_SUBST([MISC_MAN_SUFFIX])
4782f6f3826SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4792f6f3826SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4802f6f3826SmrgAC_SUBST([APP_MAN_DIR])
4812f6f3826SmrgAC_SUBST([LIB_MAN_DIR])
4822f6f3826SmrgAC_SUBST([FILE_MAN_DIR])
4832f6f3826SmrgAC_SUBST([MISC_MAN_DIR])
4842f6f3826SmrgAC_SUBST([DRIVER_MAN_DIR])
4852f6f3826SmrgAC_SUBST([ADMIN_MAN_DIR])
4862f6f3826Smrg
4872f6f3826SmrgXORG_MAN_PAGE="X Version 11"
4882f6f3826SmrgAC_SUBST([XORG_MAN_PAGE])
4892f6f3826SmrgMAN_SUBSTS="\
4902f6f3826Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4912f6f3826Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4922f6f3826Smrg	-e 's|__xservername__|Xorg|g' \
4932f6f3826Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
4942f6f3826Smrg	-e 's|__projectroot__|\$(prefix)|g' \
4952f6f3826Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4962f6f3826Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4972f6f3826Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4982f6f3826Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4992f6f3826Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5002f6f3826Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5012f6f3826Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5022f6f3826SmrgAC_SUBST([MAN_SUBSTS])
5032f6f3826Smrg
5042f6f3826Smrg]) # XORG_MANPAGE_SECTIONS
5052f6f3826Smrg
5062f6f3826Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5072f6f3826Smrg# ------------------------
5082f6f3826Smrg# Minimum version: 1.7.0
509fdb3d228Smrg#
5102f6f3826Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5112f6f3826Smrg# provided by xorg-sgml-doctools, if installed.
5122f6f3826SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5132f6f3826SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5142f6f3826SmrgXORG_SGML_PATH=
5152f6f3826SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5162f6f3826Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5172f6f3826Smrg    [m4_ifval([$1],[:],
5182f6f3826Smrg        [if test x"$cross_compiling" != x"yes" ; then
5192f6f3826Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5202f6f3826Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5212f6f3826Smrg         fi])
5222f6f3826Smrg    ])
523fdb3d228Smrg
5242f6f3826Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5252f6f3826Smrg# the path and the name of the doc stylesheet
5262f6f3826Smrgif test "x$XORG_SGML_PATH" != "x" ; then
5272f6f3826Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5282f6f3826Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5292f6f3826Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5302f6f3826Smrgelse
5312f6f3826Smrg   AC_MSG_RESULT([no])
5322f6f3826Smrgfi
533fdb3d228Smrg
5342f6f3826SmrgAC_SUBST(XORG_SGML_PATH)
5352f6f3826SmrgAC_SUBST(STYLESHEET_SRCDIR)
5362f6f3826SmrgAC_SUBST(XSL_STYLESHEET)
5372f6f3826SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5382f6f3826Smrg]) # XORG_CHECK_SGML_DOCTOOLS
5392f6f3826Smrg
5402f6f3826Smrg# XORG_CHECK_LINUXDOC
5412f6f3826Smrg# -------------------
5422f6f3826Smrg# Minimum version: 1.0.0
5439b41ff1aSmrg#
5442f6f3826Smrg# Defines the variable MAKE_TEXT if the necessary tools and
5452f6f3826Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5462f6f3826Smrg# Whether or not the necessary tools and files are found can be checked
5472f6f3826Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5482f6f3826SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5492f6f3826SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5502f6f3826SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551fdb3d228Smrg
5522f6f3826SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5539b41ff1aSmrg
5542f6f3826SmrgAC_MSG_CHECKING([whether to build documentation])
555585aa3f7Smrg
5562f6f3826Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5572f6f3826Smrg   BUILDDOC=yes
5582f6f3826Smrgelse
5592f6f3826Smrg   BUILDDOC=no
560fdb3d228Smrgfi
5619b41ff1aSmrg
5622f6f3826SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5632f6f3826Smrg
5642f6f3826SmrgAC_MSG_RESULT([$BUILDDOC])
5652f6f3826Smrg
5662f6f3826SmrgAC_MSG_CHECKING([whether to build pdf documentation])
5672f6f3826Smrg
5682f6f3826Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5692f6f3826Smrg   BUILDPDFDOC=yes
5702f6f3826Smrgelse
5712f6f3826Smrg   BUILDPDFDOC=no
572fdb3d228Smrgfi
573fdb3d228Smrg
5742f6f3826SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575fdb3d228Smrg
5762f6f3826SmrgAC_MSG_RESULT([$BUILDPDFDOC])
577fdb3d228Smrg
5782f6f3826SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5792f6f3826SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5802f6f3826SmrgMAKE_PDF="$PS2PDF"
5812f6f3826SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582585aa3f7Smrg
5832f6f3826SmrgAC_SUBST(MAKE_TEXT)
5842f6f3826SmrgAC_SUBST(MAKE_PS)
5852f6f3826SmrgAC_SUBST(MAKE_PDF)
5862f6f3826SmrgAC_SUBST(MAKE_HTML)
5872f6f3826Smrg]) # XORG_CHECK_LINUXDOC
588585aa3f7Smrg
5892f6f3826Smrg# XORG_CHECK_DOCBOOK
5902f6f3826Smrg# -------------------
5912f6f3826Smrg# Minimum version: 1.0.0
5922f6f3826Smrg#
5932f6f3826Smrg# Checks for the ability to build output formats from SGML DocBook source.
5942f6f3826Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5952f6f3826Smrg# indicates whether the necessary tools and files are found and, if set,
5962f6f3826Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5972f6f3826SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5982f6f3826SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599585aa3f7Smrg
6002f6f3826SmrgBUILDTXTDOC=no
6012f6f3826SmrgBUILDPDFDOC=no
6022f6f3826SmrgBUILDPSDOC=no
6032f6f3826SmrgBUILDHTMLDOC=no
604585aa3f7Smrg
6052f6f3826SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6062f6f3826SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6072f6f3826SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6082f6f3826SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609585aa3f7Smrg
6102f6f3826SmrgAC_MSG_CHECKING([whether to build text documentation])
6112f6f3826Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6122f6f3826Smrg   test x$BUILD_TXTDOC != xno; then
6132f6f3826Smrg	BUILDTXTDOC=yes
6142f6f3826Smrgfi
6152f6f3826SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6162f6f3826SmrgAC_MSG_RESULT([$BUILDTXTDOC])
617585aa3f7Smrg
6182f6f3826SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6192f6f3826Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6202f6f3826Smrg   test x$BUILD_PDFDOC != xno; then
6212f6f3826Smrg	BUILDPDFDOC=yes
6222f6f3826Smrgfi
6232f6f3826SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6242f6f3826SmrgAC_MSG_RESULT([$BUILDPDFDOC])
625585aa3f7Smrg
6262f6f3826SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6272f6f3826Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6282f6f3826Smrg   test x$BUILD_PSDOC != xno; then
6292f6f3826Smrg	BUILDPSDOC=yes
630585aa3f7Smrgfi
6312f6f3826SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6322f6f3826SmrgAC_MSG_RESULT([$BUILDPSDOC])
633fdb3d228Smrg
6342f6f3826SmrgAC_MSG_CHECKING([whether to build HTML documentation])
6352f6f3826Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6362f6f3826Smrg   test x$BUILD_HTMLDOC != xno; then
6372f6f3826Smrg	BUILDHTMLDOC=yes
6382f6f3826Smrgfi
6392f6f3826SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6402f6f3826SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641fdb3d228Smrg
6422f6f3826SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6432f6f3826SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6442f6f3826SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6452f6f3826SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6469b41ff1aSmrg
6472f6f3826SmrgAC_SUBST(MAKE_TEXT)
6482f6f3826SmrgAC_SUBST(MAKE_PS)
6492f6f3826SmrgAC_SUBST(MAKE_PDF)
6502f6f3826SmrgAC_SUBST(MAKE_HTML)
6512f6f3826Smrg]) # XORG_CHECK_DOCBOOK
652fdb3d228Smrg
6532f6f3826Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6542f6f3826Smrg# ----------------
6552f6f3826Smrg# Minimum version: 1.5.0
6562f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.11.0
6579b41ff1aSmrg#
6582f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
6592f6f3826Smrg# not at the appropriate level. This macro enables a module to test for the
6602f6f3826Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
6612f6f3826Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6622f6f3826Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6632f6f3826Smrg# --with-xmlto assumes 'auto'.
6649b41ff1aSmrg#
6652f6f3826Smrg# Interface to module:
6662f6f3826Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6672f6f3826Smrg# XMLTO:	returns the path of the xmlto program found
6682f6f3826Smrg#		returns the path set by the user in the environment
6692f6f3826Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6702f6f3826Smrg#		'no' user instructs the module not to use xmlto
6712f6f3826Smrg#
6722f6f3826Smrg# Added in version 1.10.0
6732f6f3826Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6742f6f3826Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6752f6f3826Smrg#
6762f6f3826Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6772f6f3826Smrg#
6782f6f3826SmrgAC_DEFUN([XORG_WITH_XMLTO],[
6792f6f3826SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6802f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
6812f6f3826SmrgAC_ARG_WITH(xmlto,
6822f6f3826Smrg	AS_HELP_STRING([--with-xmlto],
6832f6f3826Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6842f6f3826Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6852f6f3826Smrgm4_undefine([_defopt])
686fdb3d228Smrg
6872f6f3826Smrgif test "x$use_xmlto" = x"auto"; then
6882f6f3826Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6892f6f3826Smrg   if test "x$XMLTO" = "x"; then
6902f6f3826Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6912f6f3826Smrg	have_xmlto=no
6922f6f3826Smrg   else
6932f6f3826Smrg        have_xmlto=yes
6942f6f3826Smrg   fi
6952f6f3826Smrgelif test "x$use_xmlto" = x"yes" ; then
6962f6f3826Smrg   AC_PATH_PROG([XMLTO], [xmlto])
6972f6f3826Smrg   if test "x$XMLTO" = "x"; then
6982f6f3826Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6992f6f3826Smrg   fi
7002f6f3826Smrg   have_xmlto=yes
7012f6f3826Smrgelif test "x$use_xmlto" = x"no" ; then
7022f6f3826Smrg   if test "x$XMLTO" != "x"; then
7032f6f3826Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7042f6f3826Smrg   fi
7052f6f3826Smrg   have_xmlto=no
7069b41ff1aSmrgelse
7072f6f3826Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7089b41ff1aSmrgfi
709fdb3d228Smrg
7102f6f3826Smrg# Test for a minimum version of xmlto, if provided.
7112f6f3826Smrgm4_ifval([$1],
7122f6f3826Smrg[if test "$have_xmlto" = yes; then
7132f6f3826Smrg    # scrape the xmlto version
7142f6f3826Smrg    AC_MSG_CHECKING([the xmlto version])
7152f6f3826Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7162f6f3826Smrg    AC_MSG_RESULT([$xmlto_version])
7172f6f3826Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7182f6f3826Smrg        [if test "x$use_xmlto" = xauto; then
7192f6f3826Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7202f6f3826Smrg            have_xmlto=no
7212f6f3826Smrg        else
7222f6f3826Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7232f6f3826Smrg        fi])
7242f6f3826Smrgfi])
725fdb3d228Smrg
7262f6f3826Smrg# Test for the ability of xmlto to generate a text target
7279b41ff1aSmrg#
7282f6f3826Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7292f6f3826Smrg# following test for empty XML docbook files.
7302f6f3826Smrg# For compatibility reasons use the following empty XML docbook file and if
7312f6f3826Smrg# it fails try it again with a non-empty XML file.
7322f6f3826Smrghave_xmlto_text=no
7332f6f3826Smrgcat > conftest.xml << "EOF"
7342f6f3826SmrgEOF
7352f6f3826SmrgAS_IF([test "$have_xmlto" = yes],
7362f6f3826Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7372f6f3826Smrg             [have_xmlto_text=yes],
7382f6f3826Smrg             [# Try it again with a non-empty XML file.
7392f6f3826Smrg              cat > conftest.xml << "EOF"
7402f6f3826Smrg<x></x>
7412f6f3826SmrgEOF
7422f6f3826Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7432f6f3826Smrg                    [have_xmlto_text=yes],
7442f6f3826Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7452f6f3826Smrgrm -f conftest.xml
7462f6f3826SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7472f6f3826SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7482f6f3826Smrg]) # XORG_WITH_XMLTO
749fdb3d228Smrg
7502f6f3826Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7512f6f3826Smrg# --------------------------------------------
7522f6f3826Smrg# Minimum version: 1.12.0
7532f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.12.0
7549b41ff1aSmrg#
7552f6f3826Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7562f6f3826Smrg# XML-based language used for the transformation of XML documents.
7572f6f3826Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7582f6f3826Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7592f6f3826Smrg# The XSLT processor is often used as a standalone tool for transformations.
7602f6f3826Smrg# It should not be assumed that this tool is used only to work with documnetation.
7612f6f3826Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7622f6f3826Smrg#
7632f6f3826Smrg# Interface to module:
7642f6f3826Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7652f6f3826Smrg# XSLTPROC:	 returns the path of the xsltproc program found
7662f6f3826Smrg#		 returns the path set by the user in the environment
7672f6f3826Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7682f6f3826Smrg#		  'no' user instructs the module not to use xsltproc
7692f6f3826Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7702f6f3826Smrg#
7712f6f3826Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7722f6f3826Smrg#
7732f6f3826SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7742f6f3826SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7752f6f3826Smrg# Preserves the interface, should it be implemented later
7762f6f3826Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7772f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
7782f6f3826SmrgAC_ARG_WITH(xsltproc,
7792f6f3826Smrg	AS_HELP_STRING([--with-xsltproc],
7802f6f3826Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7812f6f3826Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7822f6f3826Smrgm4_undefine([_defopt])
783fdb3d228Smrg
7842f6f3826Smrgif test "x$use_xsltproc" = x"auto"; then
7852f6f3826Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7862f6f3826Smrg   if test "x$XSLTPROC" = "x"; then
7872f6f3826Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7882f6f3826Smrg	have_xsltproc=no
7892f6f3826Smrg   else
7902f6f3826Smrg        have_xsltproc=yes
7912f6f3826Smrg   fi
7922f6f3826Smrgelif test "x$use_xsltproc" = x"yes" ; then
7932f6f3826Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7942f6f3826Smrg   if test "x$XSLTPROC" = "x"; then
7952f6f3826Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7962f6f3826Smrg   fi
7972f6f3826Smrg   have_xsltproc=yes
7982f6f3826Smrgelif test "x$use_xsltproc" = x"no" ; then
7992f6f3826Smrg   if test "x$XSLTPROC" != "x"; then
8002f6f3826Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8012f6f3826Smrg   fi
8022f6f3826Smrg   have_xsltproc=no
8039b41ff1aSmrgelse
8042f6f3826Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8059b41ff1aSmrgfi
806fdb3d228Smrg
8072f6f3826SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8082f6f3826Smrg]) # XORG_WITH_XSLTPROC
8099b41ff1aSmrg
8102f6f3826Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8112f6f3826Smrg# ----------------------------------------
8122f6f3826Smrg# Minimum version: 1.15.0
813fdb3d228Smrg#
8142f6f3826Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8152f6f3826Smrg# scanning arbitrary text files, extracting information from those text files,
8162f6f3826Smrg# and printing reports based on that information.
8172f6f3826Smrg#
8182f6f3826Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8192f6f3826Smrg#
8202f6f3826Smrg# Interface to module:
8212f6f3826Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8222f6f3826Smrg# PERL:	     returns the path of the perl program found
8232f6f3826Smrg#	     returns the path set by the user in the environment
8242f6f3826Smrg# --with-perl: 'yes' user instructs the module to use perl
8252f6f3826Smrg#	       'no' user instructs the module not to use perl
8262f6f3826Smrg# have_perl: returns yes if perl found in PATH or no
8272f6f3826Smrg#
8282f6f3826Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8292f6f3826Smrg#
8302f6f3826SmrgAC_DEFUN([XORG_WITH_PERL],[
8312f6f3826SmrgAC_ARG_VAR([PERL], [Path to perl command])
8322f6f3826Smrg# Preserves the interface, should it be implemented later
8332f6f3826Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8342f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
8352f6f3826SmrgAC_ARG_WITH(perl,
8362f6f3826Smrg	AS_HELP_STRING([--with-perl],
8372f6f3826Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8382f6f3826Smrg	   [use_perl=$withval], [use_perl=]_defopt)
8392f6f3826Smrgm4_undefine([_defopt])
840fdb3d228Smrg
8412f6f3826Smrgif test "x$use_perl" = x"auto"; then
8422f6f3826Smrg   AC_PATH_PROG([PERL], [perl])
8432f6f3826Smrg   if test "x$PERL" = "x"; then
8442f6f3826Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8452f6f3826Smrg	have_perl=no
8462f6f3826Smrg   else
8472f6f3826Smrg        have_perl=yes
8482f6f3826Smrg   fi
8492f6f3826Smrgelif test "x$use_perl" = x"yes" ; then
8502f6f3826Smrg   AC_PATH_PROG([PERL], [perl])
8512f6f3826Smrg   if test "x$PERL" = "x"; then
8522f6f3826Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8532f6f3826Smrg   fi
8542f6f3826Smrg   have_perl=yes
8552f6f3826Smrgelif test "x$use_perl" = x"no" ; then
8562f6f3826Smrg   if test "x$PERL" != "x"; then
8572f6f3826Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8582f6f3826Smrg   fi
8592f6f3826Smrg   have_perl=no
8602f6f3826Smrgelse
8612f6f3826Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8622f6f3826Smrgfi
863fdb3d228Smrg
8642f6f3826SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8652f6f3826Smrg]) # XORG_WITH_PERL
8669b41ff1aSmrg
8672f6f3826Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8682f6f3826Smrg# ----------------
8692f6f3826Smrg# Minimum version: 1.5.0
8702f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.11.0
871585aa3f7Smrg#
8722f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
8732f6f3826Smrg# not at the appropriate level. This macro enables a module to test for the
8742f6f3826Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
8752f6f3826Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8762f6f3826Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8772f6f3826Smrg# --with-asciidoc assumes 'auto'.
8782f6f3826Smrg#
8792f6f3826Smrg# Interface to module:
8802f6f3826Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8812f6f3826Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
8822f6f3826Smrg#		 returns the path set by the user in the environment
8832f6f3826Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8842f6f3826Smrg#		  'no' user instructs the module not to use asciidoc
8852f6f3826Smrg#
8862f6f3826Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8872f6f3826Smrg#
8882f6f3826SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8892f6f3826SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8902f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
8912f6f3826SmrgAC_ARG_WITH(asciidoc,
8922f6f3826Smrg	AS_HELP_STRING([--with-asciidoc],
8932f6f3826Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8942f6f3826Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8952f6f3826Smrgm4_undefine([_defopt])
8969b41ff1aSmrg
8972f6f3826Smrgif test "x$use_asciidoc" = x"auto"; then
8982f6f3826Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8992f6f3826Smrg   if test "x$ASCIIDOC" = "x"; then
9002f6f3826Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9012f6f3826Smrg	have_asciidoc=no
9022f6f3826Smrg   else
9032f6f3826Smrg        have_asciidoc=yes
9042f6f3826Smrg   fi
9052f6f3826Smrgelif test "x$use_asciidoc" = x"yes" ; then
9062f6f3826Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9072f6f3826Smrg   if test "x$ASCIIDOC" = "x"; then
9082f6f3826Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9092f6f3826Smrg   fi
9102f6f3826Smrg   have_asciidoc=yes
9112f6f3826Smrgelif test "x$use_asciidoc" = x"no" ; then
9122f6f3826Smrg   if test "x$ASCIIDOC" != "x"; then
9132f6f3826Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9142f6f3826Smrg   fi
9152f6f3826Smrg   have_asciidoc=no
9162f6f3826Smrgelse
9172f6f3826Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918585aa3f7Smrgfi
9192f6f3826Smrgm4_ifval([$1],
9202f6f3826Smrg[if test "$have_asciidoc" = yes; then
9212f6f3826Smrg    # scrape the asciidoc version
9222f6f3826Smrg    AC_MSG_CHECKING([the asciidoc version])
9232f6f3826Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9242f6f3826Smrg    AC_MSG_RESULT([$asciidoc_version])
9252f6f3826Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9262f6f3826Smrg        [if test "x$use_asciidoc" = xauto; then
9272f6f3826Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9282f6f3826Smrg            have_asciidoc=no
9292f6f3826Smrg        else
9302f6f3826Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9312f6f3826Smrg        fi])
9322f6f3826Smrgfi])
9332f6f3826SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9342f6f3826Smrg]) # XORG_WITH_ASCIIDOC
935585aa3f7Smrg
9362f6f3826Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9372f6f3826Smrg# -------------------------------------------
9382f6f3826Smrg# Minimum version: 1.5.0
9392f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9402f6f3826Smrg# Minimum version for optional DOT checking: 1.18.0
941fdb3d228Smrg#
9422f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
9432f6f3826Smrg# not at the appropriate level. This macro enables a module to test for the
9442f6f3826Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9452f6f3826Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9462f6f3826Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9472f6f3826Smrg# --with-doxygen assumes 'auto'.
948585aa3f7Smrg#
9492f6f3826Smrg# Interface to module:
9502f6f3826Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9512f6f3826Smrg# DOXYGEN:	 returns the path of the doxygen program found
9522f6f3826Smrg#		 returns the path set by the user in the environment
9532f6f3826Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9542f6f3826Smrg#		  'no' user instructs the module not to use doxygen
9552f6f3826Smrg#
9562f6f3826Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9572f6f3826Smrg#
9582f6f3826SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9592f6f3826SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9602f6f3826SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9612f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
9622f6f3826SmrgAC_ARG_WITH(doxygen,
9632f6f3826Smrg	AS_HELP_STRING([--with-doxygen],
9642f6f3826Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9652f6f3826Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9662f6f3826Smrgm4_undefine([_defopt])
967585aa3f7Smrg
9682f6f3826Smrgif test "x$use_doxygen" = x"auto"; then
9692f6f3826Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9702f6f3826Smrg   if test "x$DOXYGEN" = "x"; then
9712f6f3826Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9722f6f3826Smrg	have_doxygen=no
9732f6f3826Smrg   else
9742f6f3826Smrg        have_doxygen=yes
9752f6f3826Smrg   fi
9762f6f3826Smrgelif test "x$use_doxygen" = x"yes" ; then
9772f6f3826Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9782f6f3826Smrg   if test "x$DOXYGEN" = "x"; then
9792f6f3826Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9802f6f3826Smrg   fi
9812f6f3826Smrg   have_doxygen=yes
9822f6f3826Smrgelif test "x$use_doxygen" = x"no" ; then
9832f6f3826Smrg   if test "x$DOXYGEN" != "x"; then
9842f6f3826Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9852f6f3826Smrg   fi
9862f6f3826Smrg   have_doxygen=no
9879b41ff1aSmrgelse
9882f6f3826Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9899b41ff1aSmrgfi
9902f6f3826Smrgm4_ifval([$1],
9912f6f3826Smrg[if test "$have_doxygen" = yes; then
9922f6f3826Smrg    # scrape the doxygen version
9932f6f3826Smrg    AC_MSG_CHECKING([the doxygen version])
9942f6f3826Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9952f6f3826Smrg    AC_MSG_RESULT([$doxygen_version])
9962f6f3826Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9972f6f3826Smrg        [if test "x$use_doxygen" = xauto; then
9982f6f3826Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9992f6f3826Smrg            have_doxygen=no
10002f6f3826Smrg        else
10012f6f3826Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10022f6f3826Smrg        fi])
10032f6f3826Smrgfi])
10042f6f3826Smrg
10052f6f3826Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10062f6f3826Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10072f6f3826Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10082f6f3826SmrgHAVE_DOT=no
10092f6f3826Smrgif test "x$have_doxygen" = "xyes"; then
10102f6f3826Smrg  AC_PATH_PROG([DOT], [dot])
10112f6f3826Smrg    if test "x$DOT" != "x"; then
10122f6f3826Smrg      HAVE_DOT=yes
10132f6f3826Smrg    fi
1014585aa3f7Smrgfi
10159b41ff1aSmrg
10162f6f3826SmrgAC_SUBST([HAVE_DOT])
10172f6f3826SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10182f6f3826SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10192f6f3826Smrg]) # XORG_WITH_DOXYGEN
10209b41ff1aSmrg
10212f6f3826Smrg# XORG_WITH_GROFF([DEFAULT])
10222f6f3826Smrg# ----------------
10232f6f3826Smrg# Minimum version: 1.6.0
10242f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1025fdb3d228Smrg#
10262f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
10272f6f3826Smrg# not at the appropriate level. This macro enables a module to test for the
10282f6f3826Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10292f6f3826Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
10302f6f3826Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
10312f6f3826Smrg# --with-groff assumes 'auto'.
10322f6f3826Smrg#
10332f6f3826Smrg# Interface to module:
10342f6f3826Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10352f6f3826Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10362f6f3826Smrg# HAVE_GROFF_MS: the -ms macros package
10372f6f3826Smrg# GROFF:	 returns the path of the groff program found
10382f6f3826Smrg#		 returns the path set by the user in the environment
10392f6f3826Smrg# --with-groff:	 'yes' user instructs the module to use groff
10402f6f3826Smrg#		 'no' user instructs the module not to use groff
10412f6f3826Smrg#
10422f6f3826Smrg# Added in version 1.9.0:
10432f6f3826Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10442f6f3826Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10452f6f3826Smrg#		   psselect from the psutils package.
10462f6f3826Smrg#		   the ghostcript package. Refer to the grohtml man pages
10472f6f3826Smrg#
10482f6f3826Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10492f6f3826Smrg#
10502f6f3826Smrg# OS and distros often splits groff in a basic and full package, the former
10512f6f3826Smrg# having the groff program and the later having devices, fonts and macros
10522f6f3826Smrg# Checking for the groff executable is not enough.
10532f6f3826Smrg#
10542f6f3826Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
10552f6f3826Smrg# unset HAVE_GROFF or GROFF env variables.
10562f6f3826Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10572f6f3826Smrg#
10582f6f3826SmrgAC_DEFUN([XORG_WITH_GROFF],[
10592f6f3826SmrgAC_ARG_VAR([GROFF], [Path to groff command])
10602f6f3826Smrgm4_define([_defopt], m4_default([$1], [auto]))
10612f6f3826SmrgAC_ARG_WITH(groff,
10622f6f3826Smrg	AS_HELP_STRING([--with-groff],
10632f6f3826Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10642f6f3826Smrg	   [use_groff=$withval], [use_groff=]_defopt)
10652f6f3826Smrgm4_undefine([_defopt])
1066fdb3d228Smrg
10672f6f3826Smrgif test "x$use_groff" = x"auto"; then
10682f6f3826Smrg   AC_PATH_PROG([GROFF], [groff])
10692f6f3826Smrg   if test "x$GROFF" = "x"; then
10702f6f3826Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10712f6f3826Smrg	have_groff=no
10722f6f3826Smrg   else
10732f6f3826Smrg        have_groff=yes
10742f6f3826Smrg   fi
10752f6f3826Smrgelif test "x$use_groff" = x"yes" ; then
10762f6f3826Smrg   AC_PATH_PROG([GROFF], [groff])
10772f6f3826Smrg   if test "x$GROFF" = "x"; then
10782f6f3826Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10792f6f3826Smrg   fi
10802f6f3826Smrg   have_groff=yes
10812f6f3826Smrgelif test "x$use_groff" = x"no" ; then
10822f6f3826Smrg   if test "x$GROFF" != "x"; then
10832f6f3826Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10842f6f3826Smrg   fi
10852f6f3826Smrg   have_groff=no
10862f6f3826Smrgelse
10872f6f3826Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10889b41ff1aSmrgfi
1089fdb3d228Smrg
10902f6f3826Smrg# We have groff, test for the presence of the macro packages
10912f6f3826Smrgif test "x$have_groff" = x"yes"; then
10922f6f3826Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10932f6f3826Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10942f6f3826Smrg        groff_ms_works=yes
10952f6f3826Smrg    else
10962f6f3826Smrg        groff_ms_works=no
10972f6f3826Smrg    fi
10982f6f3826Smrg    AC_MSG_RESULT([$groff_ms_works])
10992f6f3826Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11002f6f3826Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11012f6f3826Smrg        groff_mm_works=yes
11022f6f3826Smrg    else
11032f6f3826Smrg        groff_mm_works=no
11042f6f3826Smrg    fi
11052f6f3826Smrg    AC_MSG_RESULT([$groff_mm_works])
11062f6f3826Smrgfi
1107fdb3d228Smrg
11082f6f3826Smrg# We have groff, test for HTML dependencies, one command per package
11092f6f3826Smrgif test "x$have_groff" = x"yes"; then
11102f6f3826Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11112f6f3826Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11122f6f3826Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11132f6f3826Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11142f6f3826Smrg      have_groff_html=yes
11152f6f3826Smrg   else
11162f6f3826Smrg      have_groff_html=no
11172f6f3826Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11182f6f3826Smrg   fi
11192f6f3826Smrgfi
1120fdb3d228Smrg
11212f6f3826Smrg# Set Automake conditionals for Makefiles
11222f6f3826SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11232f6f3826SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11242f6f3826SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11252f6f3826SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11262f6f3826Smrg]) # XORG_WITH_GROFF
1127fdb3d228Smrg
11282f6f3826Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11292f6f3826Smrg# ---------------------------------------
11302f6f3826Smrg# Minimum version: 1.6.0
11312f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11322f6f3826Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11339b41ff1aSmrg#
11342f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
11352f6f3826Smrg# not at the appropriate level. This macro enables a module to test for the
11362f6f3826Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11372f6f3826Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
11382f6f3826Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
11392f6f3826Smrg# --with-fop assumes 'auto'.
11409b41ff1aSmrg#
11412f6f3826Smrg# Interface to module:
11422f6f3826Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11432f6f3826Smrg# FOP:	 	returns the path of the fop program found
11442f6f3826Smrg#		returns the path set by the user in the environment
11452f6f3826Smrg# --with-fop: 	'yes' user instructs the module to use fop
11462f6f3826Smrg#		'no' user instructs the module not to use fop
11479b41ff1aSmrg#
11482f6f3826Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149585aa3f7Smrg#
11502f6f3826SmrgAC_DEFUN([XORG_WITH_FOP],[
11512f6f3826SmrgAC_ARG_VAR([FOP], [Path to fop command])
11522f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
11532f6f3826SmrgAC_ARG_WITH(fop,
11542f6f3826Smrg	AS_HELP_STRING([--with-fop],
11552f6f3826Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11562f6f3826Smrg	   [use_fop=$withval], [use_fop=]_defopt)
11572f6f3826Smrgm4_undefine([_defopt])
1158585aa3f7Smrg
11592f6f3826Smrgif test "x$use_fop" = x"auto"; then
11602f6f3826Smrg   AC_PATH_PROG([FOP], [fop])
11612f6f3826Smrg   if test "x$FOP" = "x"; then
11622f6f3826Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11632f6f3826Smrg	have_fop=no
11642f6f3826Smrg   else
11652f6f3826Smrg        have_fop=yes
11662f6f3826Smrg   fi
11672f6f3826Smrgelif test "x$use_fop" = x"yes" ; then
11682f6f3826Smrg   AC_PATH_PROG([FOP], [fop])
11692f6f3826Smrg   if test "x$FOP" = "x"; then
11702f6f3826Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11712f6f3826Smrg   fi
11722f6f3826Smrg   have_fop=yes
11732f6f3826Smrgelif test "x$use_fop" = x"no" ; then
11742f6f3826Smrg   if test "x$FOP" != "x"; then
11752f6f3826Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11762f6f3826Smrg   fi
11772f6f3826Smrg   have_fop=no
11782f6f3826Smrgelse
11792f6f3826Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11802f6f3826Smrgfi
1181585aa3f7Smrg
11822f6f3826Smrg# Test for a minimum version of fop, if provided.
11832f6f3826Smrgm4_ifval([$1],
11842f6f3826Smrg[if test "$have_fop" = yes; then
11852f6f3826Smrg    # scrape the fop version
11862f6f3826Smrg    AC_MSG_CHECKING([for fop minimum version])
11872f6f3826Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11882f6f3826Smrg    AC_MSG_RESULT([$fop_version])
11892f6f3826Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
11902f6f3826Smrg        [if test "x$use_fop" = xauto; then
11912f6f3826Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11922f6f3826Smrg            have_fop=no
11932f6f3826Smrg        else
11942f6f3826Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11952f6f3826Smrg        fi])
11962f6f3826Smrgfi])
11972f6f3826SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11982f6f3826Smrg]) # XORG_WITH_FOP
11999b41ff1aSmrg
12002f6f3826Smrg# XORG_WITH_M4([MIN-VERSION])
12012f6f3826Smrg# ---------------------------
12022f6f3826Smrg# Minimum version: 1.19.0
12037d575c90Smrg#
12042f6f3826Smrg# This macro attempts to locate an m4 macro processor which supports
12052f6f3826Smrg# -I option and is only useful for modules relying on M4 in order to
12062f6f3826Smrg# expand macros in source code files.
12077d575c90Smrg#
12082f6f3826Smrg# Interface to module:
12092f6f3826Smrg# M4:	 	returns the path of the m4 program found
12102f6f3826Smrg#		returns the path set by the user in the environment
12117d575c90Smrg#
12122f6f3826SmrgAC_DEFUN([XORG_WITH_M4], [
12132f6f3826SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12142f6f3826Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12152f6f3826Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12162f6f3826Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12172f6f3826Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12182f6f3826Smrg   [$PATH:/usr/gnu/bin])])
12197d575c90Smrg
12202f6f3826SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12212f6f3826Smrg]) # XORG_WITH_M4
12227d575c90Smrg
12232f6f3826Smrg# XORG_WITH_PS2PDF([DEFAULT])
12242f6f3826Smrg# ----------------
12252f6f3826Smrg# Minimum version: 1.6.0
12262f6f3826Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12272f6f3826Smrg#
12282f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
12292f6f3826Smrg# not at the appropriate level. This macro enables a module to test for the
12302f6f3826Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12312f6f3826Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12322f6f3826Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12332f6f3826Smrg# --with-ps2pdf assumes 'auto'.
12347d575c90Smrg#
12352f6f3826Smrg# Interface to module:
12362f6f3826Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12372f6f3826Smrg# PS2PDF:	returns the path of the ps2pdf program found
12382f6f3826Smrg#		returns the path set by the user in the environment
12392f6f3826Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12402f6f3826Smrg#		 'no' user instructs the module not to use ps2pdf
12417d575c90Smrg#
12422f6f3826Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12437d575c90Smrg#
12442f6f3826SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12452f6f3826SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12462f6f3826Smrgm4_define([_defopt], m4_default([$1], [auto]))
12472f6f3826SmrgAC_ARG_WITH(ps2pdf,
12482f6f3826Smrg	AS_HELP_STRING([--with-ps2pdf],
12492f6f3826Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12502f6f3826Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12512f6f3826Smrgm4_undefine([_defopt])
12527d575c90Smrg
12532f6f3826Smrgif test "x$use_ps2pdf" = x"auto"; then
12542f6f3826Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12552f6f3826Smrg   if test "x$PS2PDF" = "x"; then
12562f6f3826Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12572f6f3826Smrg	have_ps2pdf=no
12582f6f3826Smrg   else
12592f6f3826Smrg        have_ps2pdf=yes
12602f6f3826Smrg   fi
12612f6f3826Smrgelif test "x$use_ps2pdf" = x"yes" ; then
12622f6f3826Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12632f6f3826Smrg   if test "x$PS2PDF" = "x"; then
12642f6f3826Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12652f6f3826Smrg   fi
12662f6f3826Smrg   have_ps2pdf=yes
12672f6f3826Smrgelif test "x$use_ps2pdf" = x"no" ; then
12682f6f3826Smrg   if test "x$PS2PDF" != "x"; then
12692f6f3826Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12702f6f3826Smrg   fi
12712f6f3826Smrg   have_ps2pdf=no
12727d575c90Smrgelse
12732f6f3826Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12742f6f3826Smrgfi
12752f6f3826SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12762f6f3826Smrg]) # XORG_WITH_PS2PDF
12777d575c90Smrg
12782f6f3826Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
12792f6f3826Smrg# ----------------
12802f6f3826Smrg# Minimum version: 1.6.0
12817d575c90Smrg#
12822f6f3826Smrg# Documentation tools are not always available on all platforms and sometimes
12832f6f3826Smrg# not at the appropriate level. This macro enables a builder to skip all
12842f6f3826Smrg# documentation targets except traditional man pages.
12852f6f3826Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12862f6f3826Smrg# maximum flexibilty in controlling documentation building.
12872f6f3826Smrg# Refer to:
12882f6f3826Smrg# XORG_WITH_XMLTO         --with-xmlto
12892f6f3826Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12902f6f3826Smrg# XORG_WITH_DOXYGEN       --with-doxygen
12912f6f3826Smrg# XORG_WITH_FOP           --with-fop
12922f6f3826Smrg# XORG_WITH_GROFF         --with-groff
12932f6f3826Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
12947d575c90Smrg#
12952f6f3826Smrg# Interface to module:
12962f6f3826Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12972f6f3826Smrg# --enable-docs: 'yes' user instructs the module to generate docs
12982f6f3826Smrg#		 'no' user instructs the module not to generate docs
12992f6f3826Smrg# parm1:	specify the default value, yes or no.
13007d575c90Smrg#
13012f6f3826SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13022f6f3826Smrgm4_define([docs_default], m4_default([$1], [yes]))
13032f6f3826SmrgAC_ARG_ENABLE(docs,
13042f6f3826Smrg	AS_HELP_STRING([--enable-docs],
13052f6f3826Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13062f6f3826Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13072f6f3826Smrgm4_undefine([docs_default])
13082f6f3826SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13092f6f3826SmrgAC_MSG_CHECKING([whether to build documentation])
13102f6f3826SmrgAC_MSG_RESULT([$build_docs])
13112f6f3826Smrg]) # XORG_ENABLE_DOCS
13127d575c90Smrg
13132f6f3826Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13142f6f3826Smrg# ----------------
13152f6f3826Smrg# Minimum version: 1.6.0
13162f6f3826Smrg#
13172f6f3826Smrg# This macro enables a builder to skip all developer documentation.
13182f6f3826Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13192f6f3826Smrg# maximum flexibilty in controlling documentation building.
13202f6f3826Smrg# Refer to:
13212f6f3826Smrg# XORG_WITH_XMLTO         --with-xmlto
13222f6f3826Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13232f6f3826Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13242f6f3826Smrg# XORG_WITH_FOP           --with-fop
13252f6f3826Smrg# XORG_WITH_GROFF         --with-groff
13262f6f3826Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13272f6f3826Smrg#
13282f6f3826Smrg# Interface to module:
13292f6f3826Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13302f6f3826Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13312f6f3826Smrg#			'no' user instructs the module not to generate developer docs
13322f6f3826Smrg# parm1:		specify the default value, yes or no.
13332f6f3826Smrg#
13342f6f3826SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13352f6f3826Smrgm4_define([devel_default], m4_default([$1], [yes]))
13362f6f3826SmrgAC_ARG_ENABLE(devel-docs,
13372f6f3826Smrg	AS_HELP_STRING([--enable-devel-docs],
13382f6f3826Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13392f6f3826Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13402f6f3826Smrgm4_undefine([devel_default])
13412f6f3826SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13422f6f3826SmrgAC_MSG_CHECKING([whether to build developer documentation])
13432f6f3826SmrgAC_MSG_RESULT([$build_devel_docs])
13442f6f3826Smrg]) # XORG_ENABLE_DEVEL_DOCS
13457d575c90Smrg
13462f6f3826Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
13472f6f3826Smrg# ----------------
13482f6f3826Smrg# Minimum version: 1.6.0
13492f6f3826Smrg#
13502f6f3826Smrg# This macro enables a builder to skip all functional specification targets.
13512f6f3826Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13522f6f3826Smrg# maximum flexibilty in controlling documentation building.
13532f6f3826Smrg# Refer to:
13542f6f3826Smrg# XORG_WITH_XMLTO         --with-xmlto
13552f6f3826Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13562f6f3826Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13572f6f3826Smrg# XORG_WITH_FOP           --with-fop
13582f6f3826Smrg# XORG_WITH_GROFF         --with-groff
13592f6f3826Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13602f6f3826Smrg#
13612f6f3826Smrg# Interface to module:
13622f6f3826Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13632f6f3826Smrg# --enable-specs:	'yes' user instructs the module to generate specs
13642f6f3826Smrg#			'no' user instructs the module not to generate specs
13652f6f3826Smrg# parm1:		specify the default value, yes or no.
13662f6f3826Smrg#
13672f6f3826SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13682f6f3826Smrgm4_define([spec_default], m4_default([$1], [yes]))
13692f6f3826SmrgAC_ARG_ENABLE(specs,
13702f6f3826Smrg	AS_HELP_STRING([--enable-specs],
13712f6f3826Smrg	   [Enable building the specs (default: ]spec_default[)]),
13722f6f3826Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
13732f6f3826Smrgm4_undefine([spec_default])
13742f6f3826SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13752f6f3826SmrgAC_MSG_CHECKING([whether to build functional specifications])
13762f6f3826SmrgAC_MSG_RESULT([$build_specs])
13772f6f3826Smrg]) # XORG_ENABLE_SPECS
13787d575c90Smrg
13792f6f3826Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13802f6f3826Smrg# ----------------------------------------------
13812f6f3826Smrg# Minimum version: 1.13.0
13822f6f3826Smrg#
13832f6f3826Smrg# This macro enables a builder to enable/disable unit testing
13842f6f3826Smrg# It makes no assumption about the test cases implementation
13852f6f3826Smrg# Test cases may or may not use Automake "Support for test suites"
13862f6f3826Smrg# They may or may not use the software utility library GLib
13872f6f3826Smrg#
13882f6f3826Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13892f6f3826Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13902f6f3826Smrg# The variable enable_unit_tests is used by other macros in this file.
13912f6f3826Smrg#
13922f6f3826Smrg# Interface to module:
13932f6f3826Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13942f6f3826Smrg# enable_unit_tests:    used in configure.ac for additional configuration
13952f6f3826Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13962f6f3826Smrg#			'no' user instructs the module not to build tests
13972f6f3826Smrg# parm1:		specify the default value, yes or no.
13982f6f3826Smrg#
13992f6f3826SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14002f6f3826SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14012f6f3826SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14022f6f3826SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14032f6f3826Smrgm4_define([_defopt], m4_default([$1], [auto]))
14042f6f3826SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14052f6f3826Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14062f6f3826Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14072f6f3826Smrgm4_undefine([_defopt])
14082f6f3826SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14092f6f3826SmrgAC_MSG_CHECKING([whether to build unit test cases])
14102f6f3826SmrgAC_MSG_RESULT([$enable_unit_tests])
14112f6f3826Smrg]) # XORG_ENABLE_UNIT_TESTS
14127d575c90Smrg
14132f6f3826Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14142f6f3826Smrg# ------------------------------------------------------
14152f6f3826Smrg# Minimum version: 1.17.0
14162f6f3826Smrg#
14172f6f3826Smrg# This macro enables a builder to enable/disable integration testing
14182f6f3826Smrg# It makes no assumption about the test cases' implementation
14192f6f3826Smrg# Test cases may or may not use Automake "Support for test suites"
14202f6f3826Smrg#
14212f6f3826Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14222f6f3826Smrg# usually requires less dependencies and may be built and run under less
14232f6f3826Smrg# stringent environments than integration tests.
14242f6f3826Smrg#
14252f6f3826Smrg# Interface to module:
14262f6f3826Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14272f6f3826Smrg# enable_integration_tests:   used in configure.ac for additional configuration
14282f6f3826Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14292f6f3826Smrg#                             'no' user instructs the module not to build tests
14302f6f3826Smrg# parm1:                      specify the default value, yes or no.
14312f6f3826Smrg#
14322f6f3826SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14332f6f3826SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14342f6f3826Smrgm4_define([_defopt], m4_default([$1], [auto]))
14352f6f3826SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14362f6f3826Smrg	[Enable building integration test cases (default: ]_defopt[)]),
14372f6f3826Smrg	[enable_integration_tests=$enableval],
14382f6f3826Smrg	[enable_integration_tests=]_defopt)
14392f6f3826Smrgm4_undefine([_defopt])
14402f6f3826SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14412f6f3826Smrg	[test "x$enable_integration_tests" != xno])
14422f6f3826SmrgAC_MSG_CHECKING([whether to build unit test cases])
14432f6f3826SmrgAC_MSG_RESULT([$enable_integration_tests])
14442f6f3826Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
14457d575c90Smrg
14462f6f3826Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14472f6f3826Smrg# ----------------------------------------
14482f6f3826Smrg# Minimum version: 1.13.0
14492f6f3826Smrg#
14502f6f3826Smrg# GLib is a library which provides advanced data structures and functions.
14512f6f3826Smrg# This macro enables a module to test for the presence of Glib.
14522f6f3826Smrg#
14532f6f3826Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14542f6f3826Smrg# Otherwise the value of $enable_unit_tests is blank.
14552f6f3826Smrg#
14562f6f3826Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14572f6f3826Smrg# test support usually requires less dependencies and may be built and run under
14582f6f3826Smrg# less stringent environments than integration tests.
14592f6f3826Smrg#
14602f6f3826Smrg# Interface to module:
14612f6f3826Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
14622f6f3826Smrg# with_glib: used in configure.ac to know if GLib has been found
14632f6f3826Smrg# --with-glib:	'yes' user instructs the module to use glib
14642f6f3826Smrg#		'no' user instructs the module not to use glib
14652f6f3826Smrg#
14662f6f3826SmrgAC_DEFUN([XORG_WITH_GLIB],[
14672f6f3826SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14682f6f3826Smrgm4_define([_defopt], m4_default([$2], [auto]))
14692f6f3826SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14702f6f3826Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14712f6f3826Smrg	[with_glib=$withval], [with_glib=]_defopt)
14722f6f3826Smrgm4_undefine([_defopt])
14737d575c90Smrg
14742f6f3826Smrghave_glib=no
14752f6f3826Smrg# Do not probe GLib if user explicitly disabled unit testing
14762f6f3826Smrgif test "x$enable_unit_tests" != x"no"; then
14772f6f3826Smrg  # Do not probe GLib if user explicitly disabled it
14782f6f3826Smrg  if test "x$with_glib" != x"no"; then
14792f6f3826Smrg    m4_ifval(
14802f6f3826Smrg      [$1],
14812f6f3826Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14822f6f3826Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14832f6f3826Smrg    )
14842f6f3826Smrg  fi
14852f6f3826Smrgfi
14867d575c90Smrg
14872f6f3826Smrg# Not having GLib when unit testing has been explicitly requested is an error
14882f6f3826Smrgif test "x$enable_unit_tests" = x"yes"; then
14892f6f3826Smrg  if test "x$have_glib" = x"no"; then
14902f6f3826Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14912f6f3826Smrg  fi
14922f6f3826Smrgfi
14937d575c90Smrg
14942f6f3826Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
14952f6f3826Smrgif test "x$enable_unit_tests" = x"no"; then
14962f6f3826Smrg  if test "x$with_glib" = x"yes"; then
14972f6f3826Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14982f6f3826Smrg  fi
14992f6f3826Smrgfi
15007d575c90Smrg
15012f6f3826Smrg# Not having GLib when it has been explicitly requested is an error
15022f6f3826Smrgif test "x$with_glib" = x"yes"; then
15032f6f3826Smrg  if test "x$have_glib" = x"no"; then
15042f6f3826Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15052f6f3826Smrg  fi
15062f6f3826Smrgfi
15077d575c90Smrg
15082f6f3826SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15092f6f3826Smrg]) # XORG_WITH_GLIB
15109b41ff1aSmrg
15112f6f3826Smrg# XORG_LD_WRAP([required|optional])
15122f6f3826Smrg# ---------------------------------
15132f6f3826Smrg# Minimum version: 1.13.0
15149b41ff1aSmrg#
15152f6f3826Smrg# Check if linker supports -wrap, passed via compiler flags
15169b41ff1aSmrg#
15172f6f3826Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15182f6f3826Smrg# Otherwise the value of $enable_unit_tests is blank.
15199b41ff1aSmrg#
15202f6f3826Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15212f6f3826Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15222f6f3826Smrg# available, an argument of "optional" allows use when some unit tests require
15232f6f3826Smrg# ld -wrap and others do not.
15249b41ff1aSmrg#
15252f6f3826SmrgAC_DEFUN([XORG_LD_WRAP],[
15262f6f3826SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15272f6f3826Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15282f6f3826Smrg                      void __wrap_exit(int status) { return; }],
15292f6f3826Smrg                     [exit(0);])])
15302f6f3826Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
15312f6f3826Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15322f6f3826Smrg  if test "x$have_ld_wrap" = x"no"; then
15332f6f3826Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15342f6f3826Smrg  fi
1535fdb3d228Smrgfi
15362f6f3826SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15372f6f3826Smrg#
15382f6f3826Smrg]) # XORG_LD_WRAP
1539fdb3d228Smrg
15402f6f3826Smrg# XORG_CHECK_LINKER_FLAGS
15412f6f3826Smrg# -----------------------
15422f6f3826Smrg# SYNOPSIS
15432f6f3826Smrg#
15442f6f3826Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15452f6f3826Smrg#
15462f6f3826Smrg# DESCRIPTION
15472f6f3826Smrg#
15482f6f3826Smrg#   Check whether the given linker FLAGS work with the current language's
15492f6f3826Smrg#   linker, or whether they give an error.
15502f6f3826Smrg#
15512f6f3826Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15522f6f3826Smrg#   success/failure.
15532f6f3826Smrg#
15542f6f3826Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
15552f6f3826Smrg#
15562f6f3826Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15572f6f3826Smrg#
15582f6f3826Smrg# LICENSE
15592f6f3826Smrg#
15602f6f3826Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15612f6f3826Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15622f6f3826Smrg#   Copyright (c) 2009 Matteo Frigo
15632f6f3826Smrg#
15642f6f3826Smrg#   This program is free software: you can redistribute it and/or modify it
15652f6f3826Smrg#   under the terms of the GNU General Public License as published by the
15662f6f3826Smrg#   Free Software Foundation, either version 3 of the License, or (at your
15672f6f3826Smrg#   option) any later version.
15682f6f3826Smrg#
15692f6f3826Smrg#   This program is distributed in the hope that it will be useful, but
15702f6f3826Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15712f6f3826Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15722f6f3826Smrg#   Public License for more details.
15732f6f3826Smrg#
15742f6f3826Smrg#   You should have received a copy of the GNU General Public License along
15752f6f3826Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15762f6f3826Smrg#
15772f6f3826Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
15782f6f3826Smrg#   gives unlimited permission to copy, distribute and modify the configure
15792f6f3826Smrg#   scripts that are the output of Autoconf when processing the Macro. You
15802f6f3826Smrg#   need not follow the terms of the GNU General Public License when using
15812f6f3826Smrg#   or distributing such scripts, even though portions of the text of the
15822f6f3826Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15832f6f3826Smrg#   all other use of the material that constitutes the Autoconf Macro.
15842f6f3826Smrg#
15852f6f3826Smrg#   This special exception to the GPL applies to versions of the Autoconf
15862f6f3826Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
15872f6f3826Smrg#   modified version of the Autoconf Macro, you may extend this special
15882f6f3826Smrg#   exception to the GPL to apply to your modified version as well.#
15892f6f3826SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15902f6f3826Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
15912f6f3826Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15922f6f3826SmrgAS_LITERAL_IF([$1],
15932f6f3826Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15942f6f3826Smrg      ax_save_FLAGS=$LDFLAGS
15952f6f3826Smrg      LDFLAGS="$1"
15962f6f3826Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15972f6f3826Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15982f6f3826Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15992f6f3826Smrg      LDFLAGS=$ax_save_FLAGS])],
16002f6f3826Smrg  [ax_save_FLAGS=$LDFLAGS
16012f6f3826Smrg   LDFLAGS="$1"
16022f6f3826Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16032f6f3826Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16042f6f3826Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16052f6f3826Smrg   LDFLAGS=$ax_save_FLAGS])
16062f6f3826Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16072f6f3826SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16082f6f3826Smrgif test "x$xorg_check_linker_flags" = xyes; then
16092f6f3826Smrg	m4_default([$2], :)
1610fdb3d228Smrgelse
16112f6f3826Smrg	m4_default([$3], :)
1612fdb3d228Smrgfi
16132f6f3826Smrg]) # XORG_CHECK_LINKER_FLAGS
1614fdb3d228Smrg
16152f6f3826Smrg# XORG_MEMORY_CHECK_FLAGS
1616fdb3d228Smrg# -----------------------
16172f6f3826Smrg# Minimum version: 1.16.0
16189b41ff1aSmrg#
16192f6f3826Smrg# This macro attempts to find appropriate memory checking functionality
16202f6f3826Smrg# for various platforms which unit testing code may use to catch various
16212f6f3826Smrg# forms of memory allocation and access errors in testing.
16222f6f3826Smrg#
16232f6f3826Smrg# Interface to module:
16242f6f3826Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16252f6f3826Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16262f6f3826Smrg#
16272f6f3826Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16282f6f3826Smrg#
16292f6f3826SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1630fdb3d228Smrg
1631fdb3d228SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16322f6f3826SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16332f6f3826Smrg           [Environment variables to enable memory checking in tests])
1634fdb3d228Smrg
16352f6f3826Smrg# Check for different types of support on different platforms
16362f6f3826Smrgcase $host_os in
16372f6f3826Smrg    solaris*)
16382f6f3826Smrg        AC_CHECK_LIB([umem], [umem_alloc],
16392f6f3826Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16402f6f3826Smrg        ;;
16412f6f3826Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16422f6f3826Smrg        # both directly and inverted, so should not be 0 or 255.
16432f6f3826Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
16442f6f3826Smrg        ;;
16452f6f3826Smrg    darwin*)
16462f6f3826Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16472f6f3826Smrg        ;;
16482f6f3826Smrg    *bsd*)
16492f6f3826Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16502f6f3826Smrg        ;;
16512f6f3826Smrgesac
1652fdb3d228Smrg
16532f6f3826Smrg# User supplied flags override default flags
16542f6f3826Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16552f6f3826Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1656fdb3d228Smrgfi
1657fdb3d228Smrg
16582f6f3826SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16592f6f3826Smrg]) # XORG_WITH_LINT
1660fdb3d228Smrg
16612f6f3826Smrg# XORG_CHECK_MALLOC_ZERO
16622f6f3826Smrg# ----------------------
16632f6f3826Smrg# Minimum version: 1.0.0
16642f6f3826Smrg#
16652f6f3826Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16662f6f3826Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16672f6f3826Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16682f6f3826SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16692f6f3826SmrgAC_ARG_ENABLE(malloc0returnsnull,
16702f6f3826Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16712f6f3826Smrg		       [malloc(0) returns NULL (default: auto)]),
16722f6f3826Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16732f6f3826Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1674fdb3d228Smrg
16752f6f3826SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16762f6f3826Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16772f6f3826SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16782f6f3826Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16792f6f3826Smrg#include <stdlib.h>
16802f6f3826Smrg],[
16812f6f3826Smrg    char *m0, *r0, *c0, *p;
16822f6f3826Smrg    m0 = malloc(0);
16832f6f3826Smrg    p = malloc(10);
16842f6f3826Smrg    r0 = realloc(p,0);
16852f6f3826Smrg    c0 = calloc(0,10);
16862f6f3826Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16872f6f3826Smrg])],
16882f6f3826Smrg		[xorg_cv_malloc0_returns_null=yes],
16892f6f3826Smrg		[xorg_cv_malloc0_returns_null=no])])
16902f6f3826SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1691fdb3d228Smrgfi
16922f6f3826SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1693fdb3d228Smrg
16942f6f3826Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16952f6f3826Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16962f6f3826Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16972f6f3826Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1698f5effb2eSmrgelse
16992f6f3826Smrg	MALLOC_ZERO_CFLAGS=""
17002f6f3826Smrg	XMALLOC_ZERO_CFLAGS=""
17012f6f3826Smrg	XTMALLOC_ZERO_CFLAGS=""
1702f5effb2eSmrgfi
1703f5effb2eSmrg
17042f6f3826SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17052f6f3826SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17062f6f3826SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17072f6f3826Smrg]) # XORG_CHECK_MALLOC_ZERO
1708f5effb2eSmrg
17092f6f3826Smrg# XORG_WITH_LINT()
17102f6f3826Smrg# ----------------
17112f6f3826Smrg# Minimum version: 1.1.0
17129b41ff1aSmrg#
17132f6f3826Smrg# This macro enables the use of a tool that flags some suspicious and
17142f6f3826Smrg# non-portable constructs (likely to be bugs) in C language source code.
17152f6f3826Smrg# It will attempt to locate the tool and use appropriate options.
17162f6f3826Smrg# There are various lint type tools on different platforms.
17172f6f3826Smrg#
17182f6f3826Smrg# Interface to module:
17192f6f3826Smrg# LINT:		returns the path to the tool found on the platform
17202f6f3826Smrg#		or the value set to LINT on the configure cmd line
17212f6f3826Smrg#		also an Automake conditional
17222f6f3826Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17232f6f3826Smrg#
17242f6f3826Smrg# --with-lint:	'yes' user instructs the module to use lint
17252f6f3826Smrg#		'no' user instructs the module not to use lint (default)
17262f6f3826Smrg#
17272f6f3826Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17282f6f3826Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17292f6f3826Smrg#
17302f6f3826SmrgAC_DEFUN([XORG_WITH_LINT],[
1731fdb3d228Smrg
17322f6f3826SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17332f6f3826SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17342f6f3826SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17352f6f3826Smrg		[Use a lint-style source code checker (default: disabled)])],
17362f6f3826Smrg		[use_lint=$withval], [use_lint=no])
1737fdb3d228Smrg
17382f6f3826Smrg# Obtain platform specific info like program name and options
17392f6f3826Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17402f6f3826Smrgcase $host_os in
17412f6f3826Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17422f6f3826Smrg	lint_name=splint
17432f6f3826Smrg	lint_options="-badflag"
17442f6f3826Smrg	;;
17452f6f3826Smrg  *freebsd* | *netbsd*)
17462f6f3826Smrg	lint_name=lint
17472f6f3826Smrg	lint_options="-u -b"
17482f6f3826Smrg	;;
17492f6f3826Smrg  *solaris*)
17502f6f3826Smrg	lint_name=lint
17512f6f3826Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17522f6f3826Smrg	;;
17532f6f3826Smrgesac
1754fdb3d228Smrg
17552f6f3826Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17562f6f3826Smrgif test "x$use_lint" = x"yes" ; then
17572f6f3826Smrg   AC_PATH_PROG([LINT], [$lint_name])
17582f6f3826Smrg   if test "x$LINT" = "x"; then
17592f6f3826Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17602f6f3826Smrg   fi
17612f6f3826Smrgelif test "x$use_lint" = x"no" ; then
17622f6f3826Smrg   if test "x$LINT" != "x"; then
17632f6f3826Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17642f6f3826Smrg   fi
1765fdb3d228Smrgelse
17662f6f3826Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1767fdb3d228Smrgfi
1768fdb3d228Smrg
17692f6f3826Smrg# User supplied flags override default flags
17702f6f3826Smrgif test "x$LINT_FLAGS" != "x"; then
17712f6f3826Smrg   lint_options=$LINT_FLAGS
1772fdb3d228Smrgfi
1773fdb3d228Smrg
17742f6f3826SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17752f6f3826SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776fdb3d228Smrg
17772f6f3826Smrg]) # XORG_WITH_LINT
1778fdb3d228Smrg
17792f6f3826Smrg# XORG_LINT_LIBRARY(LIBNAME)
17802f6f3826Smrg# --------------------------
17812f6f3826Smrg# Minimum version: 1.1.0
17829b41ff1aSmrg#
17832f6f3826Smrg# Sets up flags for building lint libraries for checking programs that call
17842f6f3826Smrg# functions in the library.
17852f6f3826Smrg#
17862f6f3826Smrg# Interface to module:
17872f6f3826Smrg# LINTLIB		- Automake variable with the name of lint library file to make
17882f6f3826Smrg# MAKE_LINT_LIB		- Automake conditional
17892f6f3826Smrg#
17902f6f3826Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17912f6f3826Smrg#			  - 'no' user instructs the module not to create a lint library (default)
17929b41ff1aSmrg
17932f6f3826SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17942f6f3826SmrgAC_REQUIRE([XORG_WITH_LINT])
17952f6f3826SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17962f6f3826Smrg	[Create lint library (default: disabled)])],
17972f6f3826Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17989b41ff1aSmrg
17992f6f3826Smrgif test "x$make_lint_lib" = x"yes" ; then
18002f6f3826Smrg   LINTLIB=llib-l$1.ln
18012f6f3826Smrg   if test "x$LINT" = "x"; then
18022f6f3826Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18032f6f3826Smrg   fi
18042f6f3826Smrgelif test "x$make_lint_lib" != x"no" ; then
18052f6f3826Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18069b41ff1aSmrgfi
18079b41ff1aSmrg
18082f6f3826SmrgAC_SUBST(LINTLIB)
18092f6f3826SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18109b41ff1aSmrg
18112f6f3826Smrg]) # XORG_LINT_LIBRARY
18129b41ff1aSmrg
18132f6f3826Smrg# XORG_COMPILER_BRAND
18142f6f3826Smrg# -------------------
18152f6f3826Smrg# Minimum version: 1.14.0
1816f5effb2eSmrg#
18172f6f3826Smrg# Checks for various brands of compilers and sets flags as appropriate:
18182f6f3826Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18192f6f3826Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18202f6f3826Smrg#   clang compiler - sets CLANGCC to "yes"
18212f6f3826Smrg#   Intel compiler - sets INTELCC to "yes"
18222f6f3826Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823f5effb2eSmrg#
18242f6f3826SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18252f6f3826SmrgAC_LANG_CASE(
18262f6f3826Smrg	[C], [
18272f6f3826Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18282f6f3826Smrg	],
18292f6f3826Smrg	[C++], [
18302f6f3826Smrg		AC_REQUIRE([AC_PROG_CXX])
18312f6f3826Smrg	]
18322f6f3826Smrg)
18332f6f3826SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18342f6f3826SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18352f6f3826SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18362f6f3826Smrg]) # XORG_COMPILER_BRAND
18372f6f3826Smrg
18382f6f3826Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18392f6f3826Smrg# ---------------
18402f6f3826Smrg# Minimum version: 1.16.0
1841f5effb2eSmrg#
18422f6f3826Smrg# Test if the compiler works when passed the given flag as a command line argument.
18432f6f3826Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18442f6f3826Smrg# next flag in the list until there are no more options.
18457d575c90Smrg#
18462f6f3826Smrg# Note that this does not guarantee that the compiler supports the flag as some
18472f6f3826Smrg# compilers will simply ignore arguments that they do not understand, but we do
18482f6f3826Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18492f6f3826Smrg# -Werror=unused-command-line-argument
1850f5effb2eSmrg#
18512f6f3826SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18522f6f3826Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18532f6f3826Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854f5effb2eSmrg
18552f6f3826SmrgAC_LANG_COMPILER_REQUIRE
18562f6f3826Smrg
18572f6f3826SmrgAC_LANG_CASE(
18582f6f3826Smrg	[C], [
18592f6f3826Smrg		AC_REQUIRE([AC_PROG_CC_C99])
18602f6f3826Smrg		define([PREFIX], [C])
18612f6f3826Smrg		define([CACHE_PREFIX], [cc])
18622f6f3826Smrg		define([COMPILER], [$CC])
18632f6f3826Smrg	],
18642f6f3826Smrg	[C++], [
18652f6f3826Smrg		define([PREFIX], [CXX])
18662f6f3826Smrg		define([CACHE_PREFIX], [cxx])
18672f6f3826Smrg		define([COMPILER], [$CXX])
18682f6f3826Smrg	]
18692f6f3826Smrg)
18702f6f3826Smrg
18712f6f3826Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18722f6f3826Smrg
18732f6f3826Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18742f6f3826Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18752f6f3826Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18762f6f3826Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18772f6f3826Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18782f6f3826Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18792f6f3826Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18802f6f3826Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18812f6f3826Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882f5effb2eSmrgfi
18837d575c90Smrg
18842f6f3826Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18852f6f3826Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18862f6f3826Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18872f6f3826Smrg	fi
18882f6f3826Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18892f6f3826Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18902f6f3826Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18912f6f3826Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18922f6f3826Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18932f6f3826Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18942f6f3826Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18952f6f3826Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18962f6f3826Smrgfi
18977d575c90Smrg
18982f6f3826Smrgfound="no"
18992f6f3826Smrgm4_foreach([flag], m4_cdr($@), [
19002f6f3826Smrg	if test $found = "no" ; then
19012f6f3826Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19022f6f3826Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19032f6f3826Smrg		fi
1904f5effb2eSmrg
19052f6f3826Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19062f6f3826Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19072f6f3826Smrg		fi
19082f6f3826Smrg
19092f6f3826Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19102f6f3826Smrg
19112f6f3826Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19122f6f3826Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19132f6f3826Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19142f6f3826Smrg		AC_CACHE_VAL($cacheid,
19152f6f3826Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19162f6f3826Smrg					     [eval $cacheid=yes],
19172f6f3826Smrg					     [eval $cacheid=no])])
19182f6f3826Smrg
19192f6f3826Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19202f6f3826Smrg
19212f6f3826Smrg		eval supported=\$$cacheid
19222f6f3826Smrg		AC_MSG_RESULT([$supported])
19232f6f3826Smrg		if test "$supported" = "yes" ; then
19242f6f3826Smrg			$1="$$1 ]flag["
19252f6f3826Smrg			found="yes"
19262f6f3826Smrg		fi
19272f6f3826Smrg	fi
19282f6f3826Smrg])
19292f6f3826Smrg]) # XORG_TESTSET_CFLAG
19302f6f3826Smrg
19312f6f3826Smrg# XORG_COMPILER_FLAGS
19322f6f3826Smrg# ---------------
19332f6f3826Smrg# Minimum version: 1.16.0
19347d575c90Smrg#
19352f6f3826Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19362f6f3826Smrg# arguments supported by the selected compiler which do NOT alter the generated
19372f6f3826Smrg# code.  These arguments will cause the compiler to print various warnings
19382f6f3826Smrg# during compilation AND turn a conservative set of warnings into errors.
19397d575c90Smrg#
19402f6f3826Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19412f6f3826Smrg# future versions of util-macros as options are added to new compilers.
19427d575c90Smrg#
19432f6f3826SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19442f6f3826SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19457d575c90Smrg
19462f6f3826SmrgAC_ARG_ENABLE(selective-werror,
19472f6f3826Smrg              AS_HELP_STRING([--disable-selective-werror],
19482f6f3826Smrg                             [Turn off selective compiler errors. (default: enabled)]),
19492f6f3826Smrg              [SELECTIVE_WERROR=$enableval],
19502f6f3826Smrg              [SELECTIVE_WERROR=yes])
19512f6f3826Smrg
19522f6f3826SmrgAC_LANG_CASE(
19532f6f3826Smrg        [C], [
19542f6f3826Smrg                define([PREFIX], [C])
19552f6f3826Smrg        ],
19562f6f3826Smrg        [C++], [
19572f6f3826Smrg                define([PREFIX], [CXX])
19582f6f3826Smrg        ]
19592f6f3826Smrg)
19602f6f3826Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19612f6f3826Smrgif test "x$SUNCC" = "xyes"; then
19622f6f3826Smrg    [BASE_]PREFIX[FLAGS]="-v"
19637d575c90Smrgelse
19642f6f3826Smrg    [BASE_]PREFIX[FLAGS]=""
19657d575c90Smrgfi
19667d575c90Smrg
19672f6f3826Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19682f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19692f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19702f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19712f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19727d575c90Smrg
19732f6f3826SmrgAC_LANG_CASE(
19742f6f3826Smrg	[C], [
19752f6f3826Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19762f6f3826Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19772f6f3826Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19782f6f3826Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19792f6f3826Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19802f6f3826Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19812f6f3826Smrg	]
19822f6f3826Smrg)
19832f6f3826Smrg
19842f6f3826Smrg# This chunk adds additional warnings that could catch undesired effects.
19852f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19862f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19872f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19882f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19892f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19902f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19912f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19922f6f3826Smrg
19932f6f3826Smrg# These are currently disabled because they are noisy.  They will be enabled
19942f6f3826Smrg# in the future once the codebase is sufficiently modernized to silence
19952f6f3826Smrg# them.  For now, I don't want them to drown out the other warnings.
19962f6f3826Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19972f6f3826Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19982f6f3826Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19992f6f3826Smrg
20002f6f3826Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20012f6f3826Smrg# when there are problems that should be fixed.
20022f6f3826Smrg
20032f6f3826Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20042f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20052f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20062f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20072f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20082f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20092f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20102f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20112f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20122f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20132f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20142f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20152f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20162f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20172f6f3826Smrgelse
20182f6f3826SmrgAC_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])
20192f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20202f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20212f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20222f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20232f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20242f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20252f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20262f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20272f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20282f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20292f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20302f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20312f6f3826SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20322f6f3826Smrgfi
20332f6f3826Smrg
20342f6f3826SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20352f6f3826Smrg]) # XORG_COMPILER_FLAGS
20362f6f3826Smrg
20372f6f3826Smrg# XORG_CWARNFLAGS
20382f6f3826Smrg# ---------------
20392f6f3826Smrg# Minimum version: 1.2.0
20402f6f3826Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20417d575c90Smrg#
20422f6f3826Smrg# Defines CWARNFLAGS to enable C compiler warnings.
20437d575c90Smrg#
20442f6f3826Smrg# This function is deprecated because it defines -fno-strict-aliasing
20452f6f3826Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20462f6f3826Smrg# is needed, then it should be added explicitly in the module when
20472f6f3826Smrg# it is updated to use BASE_CFLAGS.
20487d575c90Smrg#
20492f6f3826SmrgAC_DEFUN([XORG_CWARNFLAGS], [
20502f6f3826SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20512f6f3826SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20522f6f3826SmrgAC_LANG_CASE(
20532f6f3826Smrg	[C], [
20542f6f3826Smrg		CWARNFLAGS="$BASE_CFLAGS"
20552f6f3826Smrg		if  test "x$GCC" = xyes ; then
20562f6f3826Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20572f6f3826Smrg		fi
20582f6f3826Smrg		AC_SUBST(CWARNFLAGS)
20592f6f3826Smrg	]
20602f6f3826Smrg)
20612f6f3826Smrg]) # XORG_CWARNFLAGS
20622f6f3826Smrg
20632f6f3826Smrg# XORG_STRICT_OPTION
20642f6f3826Smrg# -----------------------
20652f6f3826Smrg# Minimum version: 1.3.0
20667d575c90Smrg#
20672f6f3826Smrg# Add configure option to enable strict compilation flags, such as treating
20682f6f3826Smrg# warnings as fatal errors.
20692f6f3826Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20702f6f3826Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20717d575c90Smrg#
20722f6f3826Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20732f6f3826Smrg# when strict compilation is unconditionally desired.
20742f6f3826SmrgAC_DEFUN([XORG_STRICT_OPTION], [
20752f6f3826SmrgAC_REQUIRE([XORG_CWARNFLAGS])
20762f6f3826SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20777d575c90Smrg
20782f6f3826SmrgAC_ARG_ENABLE(strict-compilation,
20792f6f3826Smrg			  AS_HELP_STRING([--enable-strict-compilation],
20802f6f3826Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20812f6f3826Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20827d575c90Smrg
20832f6f3826SmrgAC_LANG_CASE(
20842f6f3826Smrg        [C], [
20852f6f3826Smrg                define([PREFIX], [C])
20862f6f3826Smrg        ],
20872f6f3826Smrg        [C++], [
20882f6f3826Smrg                define([PREFIX], [CXX])
20892f6f3826Smrg        ]
20902f6f3826Smrg)
20917d575c90Smrg
20922f6f3826Smrg[STRICT_]PREFIX[FLAGS]=""
20932f6f3826SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20942f6f3826SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
20952f6f3826Smrg
20962f6f3826Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20972f6f3826Smrg# activate it with -Werror, so we add it here explicitly.
20982f6f3826SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20992f6f3826Smrg
21002f6f3826Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21012f6f3826Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21022f6f3826Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21032f6f3826Smrgfi
21042f6f3826SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21052f6f3826SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21062f6f3826SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21072f6f3826Smrg]) # XORG_STRICT_OPTION
21082f6f3826Smrg
21092f6f3826Smrg# XORG_DEFAULT_OPTIONS
21102f6f3826Smrg# --------------------
21112f6f3826Smrg# Minimum version: 1.3.0
2112f5effb2eSmrg#
21132f6f3826Smrg# Defines default options for X.Org modules.
2114f5effb2eSmrg#
21152f6f3826SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21162f6f3826SmrgAC_REQUIRE([AC_PROG_INSTALL])
21172f6f3826SmrgXORG_COMPILER_FLAGS
21182f6f3826SmrgXORG_CWARNFLAGS
21192f6f3826SmrgXORG_STRICT_OPTION
21202f6f3826SmrgXORG_RELEASE_VERSION
21212f6f3826SmrgXORG_CHANGELOG
21222f6f3826SmrgXORG_INSTALL
21232f6f3826SmrgXORG_MANPAGE_SECTIONS
21242f6f3826Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21252f6f3826Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21262f6f3826Smrg]) # XORG_DEFAULT_OPTIONS
21272f6f3826Smrg
21282f6f3826Smrg# XORG_INSTALL()
21292f6f3826Smrg# ----------------
21302f6f3826Smrg# Minimum version: 1.4.0
2131f5effb2eSmrg#
21322f6f3826Smrg# Defines the variable INSTALL_CMD as the command to copy
21332f6f3826Smrg# INSTALL from $prefix/share/util-macros.
2134f5effb2eSmrg#
21352f6f3826SmrgAC_DEFUN([XORG_INSTALL], [
21362f6f3826SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21372f6f3826Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21382f6f3826SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21392f6f3826Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21402f6f3826Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21412f6f3826Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21422f6f3826SmrgAC_SUBST([INSTALL_CMD])
21432f6f3826Smrg]) # XORG_INSTALL
21442f6f3826Smrgdnl Copyright 2005 Red Hat, Inc
21452f6f3826Smrgdnl
21462f6f3826Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21472f6f3826Smrgdnl documentation for any purpose is hereby granted without fee, provided that
21482f6f3826Smrgdnl the above copyright notice appear in all copies and that both that
21492f6f3826Smrgdnl copyright notice and this permission notice appear in supporting
21502f6f3826Smrgdnl documentation.
21512f6f3826Smrgdnl
21522f6f3826Smrgdnl The above copyright notice and this permission notice shall be included
21532f6f3826Smrgdnl in all copies or substantial portions of the Software.
21542f6f3826Smrgdnl
21552f6f3826Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21562f6f3826Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21572f6f3826Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21582f6f3826Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21592f6f3826Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21602f6f3826Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21612f6f3826Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
21622f6f3826Smrgdnl
21632f6f3826Smrgdnl Except as contained in this notice, the name of the copyright holders shall
21642f6f3826Smrgdnl not be used in advertising or otherwise to promote the sale, use or
21652f6f3826Smrgdnl other dealings in this Software without prior written authorization
21662f6f3826Smrgdnl from the copyright holders.
21672f6f3826Smrgdnl
2168f5effb2eSmrg
21692f6f3826Smrg# XORG_RELEASE_VERSION
21702f6f3826Smrg# --------------------
21712f6f3826Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
21722f6f3826Smrg
21732f6f3826SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21742f6f3826Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21752f6f3826Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21762f6f3826Smrg		[Major version of this package])
21772f6f3826Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21782f6f3826Smrg	if test "x$PVM" = "x"; then
21792f6f3826Smrg		PVM="0"
21802f6f3826Smrg	fi
21812f6f3826Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21822f6f3826Smrg		[$PVM],
21832f6f3826Smrg		[Minor version of this package])
21842f6f3826Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21852f6f3826Smrg	if test "x$PVP" = "x"; then
21862f6f3826Smrg		PVP="0"
21872f6f3826Smrg	fi
21882f6f3826Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21892f6f3826Smrg		[$PVP],
21902f6f3826Smrg		[Patch version of this package])
21912f6f3826Smrg])
21922f6f3826Smrg
21932f6f3826Smrg# XORG_CHANGELOG()
21942f6f3826Smrg# ----------------
21952f6f3826Smrg# Minimum version: 1.2.0
2196f5effb2eSmrg#
21972f6f3826Smrg# Defines the variable CHANGELOG_CMD as the command to generate
21982f6f3826Smrg# ChangeLog from git.
2199f5effb2eSmrg#
2200f5effb2eSmrg#
22012f6f3826SmrgAC_DEFUN([XORG_CHANGELOG], [
22022f6f3826SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22032f6f3826Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22042f6f3826Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22052f6f3826Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22062f6f3826SmrgAC_SUBST([CHANGELOG_CMD])
22072f6f3826Smrg]) # XORG_CHANGELOG
22082f6f3826Smrg
22092f6f3826Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210f5effb2eSmrg#
22112f6f3826Smrg# This file is free software; the Free Software Foundation
22122f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
22132f6f3826Smrg# with or without modifications, as long as this notice is preserved.
2214f5effb2eSmrg
22152f6f3826Smrg# AM_AUTOMAKE_VERSION(VERSION)
22162f6f3826Smrg# ----------------------------
22172f6f3826Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22182f6f3826Smrg# generated from the m4 files accompanying Automake X.Y.
22192f6f3826Smrg# (This private macro should not be called outside this file.)
22202f6f3826SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22212f6f3826Smrg[am__api_version='1.15'
22222f6f3826Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22232f6f3826Smrgdnl require some minimum version.  Point them to the right macro.
22242f6f3826Smrgm4_if([$1], [1.15], [],
22252f6f3826Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22262f6f3826Smrg])
2227585aa3f7Smrg
22282f6f3826Smrg# _AM_AUTOCONF_VERSION(VERSION)
22292f6f3826Smrg# -----------------------------
22302f6f3826Smrg# aclocal traces this macro to find the Autoconf version.
22312f6f3826Smrg# This is a private macro too.  Using m4_define simplifies
22322f6f3826Smrg# the logic in aclocal, which can simply ignore this definition.
22332f6f3826Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2234585aa3f7Smrg
22352f6f3826Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22362f6f3826Smrg# -------------------------------
22372f6f3826Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22382f6f3826Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22392f6f3826SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22402f6f3826Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
22412f6f3826Smrgm4_ifndef([AC_AUTOCONF_VERSION],
22422f6f3826Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22432f6f3826Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244f5effb2eSmrg
22452f6f3826Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22462f6f3826Smrg
22472f6f3826Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248f5effb2eSmrg#
22492f6f3826Smrg# This file is free software; the Free Software Foundation
22502f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
22512f6f3826Smrg# with or without modifications, as long as this notice is preserved.
22522f6f3826Smrg
22532f6f3826Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22542f6f3826Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22552f6f3826Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256f5effb2eSmrg#
22572f6f3826Smrg# Of course, Automake must honor this variable whenever it calls a
22582f6f3826Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22592f6f3826Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22602f6f3826Smrg# depending on how configure is run.  This is pretty annoying, since
22612f6f3826Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22622f6f3826Smrg# source directory, any form will work fine, but in subdirectories a
22632f6f3826Smrg# relative path needs to be adjusted first.
22647d575c90Smrg#
22652f6f3826Smrg# $ac_aux_dir/missing
22662f6f3826Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22672f6f3826Smrg# $top_srcdir/$ac_aux_dir/missing
22682f6f3826Smrg#    fails if $ac_aux_dir is absolute,
22692f6f3826Smrg#    fails when called from a subdirectory in a VPATH build with
22702f6f3826Smrg#          a relative $ac_aux_dir
2271f5effb2eSmrg#
22722f6f3826Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22732f6f3826Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
22742f6f3826Smrg# harmless because $srcdir is '.', but things will broke when you
22752f6f3826Smrg# start a VPATH build or use an absolute $srcdir.
2276f5effb2eSmrg#
22772f6f3826Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22782f6f3826Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22792f6f3826Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22802f6f3826Smrg# and then we would define $MISSING as
22812f6f3826Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22822f6f3826Smrg# This will work as long as MISSING is not called from configure, because
22832f6f3826Smrg# unfortunately $(top_srcdir) has no meaning in configure.
22842f6f3826Smrg# However there are other variables, like CC, which are often used in
22852f6f3826Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286f5effb2eSmrg#
22872f6f3826Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
22882f6f3826Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
22892f6f3826Smrg# configured tree to be moved without reconfiguration.
2290f5effb2eSmrg
22912f6f3826SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22922f6f3826Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22932f6f3826Smrg# Expand $ac_aux_dir to an absolute path.
22942f6f3826Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
22952f6f3826Smrg])
22962f6f3826Smrg
22972f6f3826Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
22982f6f3826Smrg
22992f6f3826Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
23002f6f3826Smrg#
23012f6f3826Smrg# This file is free software; the Free Software Foundation
23022f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
23032f6f3826Smrg# with or without modifications, as long as this notice is preserved.
23042f6f3826Smrg
23052f6f3826Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23062f6f3826Smrg# -------------------------------------
23072f6f3826Smrg# Define a conditional.
23082f6f3826SmrgAC_DEFUN([AM_CONDITIONAL],
23092f6f3826Smrg[AC_PREREQ([2.52])dnl
23102f6f3826Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23112f6f3826Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23122f6f3826SmrgAC_SUBST([$1_TRUE])dnl
23132f6f3826SmrgAC_SUBST([$1_FALSE])dnl
23142f6f3826Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23152f6f3826Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23162f6f3826Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23172f6f3826Smrgif $2; then
23182f6f3826Smrg  $1_TRUE=
23192f6f3826Smrg  $1_FALSE='#'
2320f5effb2eSmrgelse
23212f6f3826Smrg  $1_TRUE='#'
23222f6f3826Smrg  $1_FALSE=
2323f5effb2eSmrgfi
23242f6f3826SmrgAC_CONFIG_COMMANDS_PRE(
23252f6f3826Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23262f6f3826Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23272f6f3826SmrgUsually this means the macro was only invoked conditionally.]])
23282f6f3826Smrgfi])])
23297d575c90Smrg
23302f6f3826Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
23312f6f3826Smrg#
23322f6f3826Smrg# This file is free software; the Free Software Foundation
23332f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
23342f6f3826Smrg# with or without modifications, as long as this notice is preserved.
23357d575c90Smrg
23367d575c90Smrg
23372f6f3826Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23382f6f3826Smrg# written in clear, in which case automake, when reading aclocal.m4,
23392f6f3826Smrg# will think it sees a *use*, and therefore will trigger all it's
23402f6f3826Smrg# C support machinery.  Also note that it means that autoscan, seeing
23412f6f3826Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2342f5effb2eSmrg
23432f6f3826Smrg
23442f6f3826Smrg# _AM_DEPENDENCIES(NAME)
23452f6f3826Smrg# ----------------------
23462f6f3826Smrg# See how the compiler implements dependency checking.
23472f6f3826Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23482f6f3826Smrg# We try a few techniques and use that to set a single cache variable.
2349f5effb2eSmrg#
23502f6f3826Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23512f6f3826Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23522f6f3826Smrg# dependency, and given that the user is not expected to run this macro,
23532f6f3826Smrg# just rely on AC_PROG_CC.
23542f6f3826SmrgAC_DEFUN([_AM_DEPENDENCIES],
23552f6f3826Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23562f6f3826SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23572f6f3826SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23582f6f3826SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359f5effb2eSmrg
23602f6f3826Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23612f6f3826Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23622f6f3826Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23632f6f3826Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23642f6f3826Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23652f6f3826Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23662f6f3826Smrg                    [depcc="$$1"   am_compiler_list=])
23677d575c90Smrg
23682f6f3826SmrgAC_CACHE_CHECK([dependency style of $depcc],
23692f6f3826Smrg               [am_cv_$1_dependencies_compiler_type],
23702f6f3826Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23712f6f3826Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
23722f6f3826Smrg  # making bogus files that we don't know about and never remove.  For
23732f6f3826Smrg  # instance it was reported that on HP-UX the gcc test will end up
23742f6f3826Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23752f6f3826Smrg  # in D".
23762f6f3826Smrg  rm -rf conftest.dir
23772f6f3826Smrg  mkdir conftest.dir
23782f6f3826Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23792f6f3826Smrg  # using a relative directory.
23802f6f3826Smrg  cp "$am_depcomp" conftest.dir
23812f6f3826Smrg  cd conftest.dir
23822f6f3826Smrg  # We will build objects and dependencies in a subdirectory because
23832f6f3826Smrg  # it helps to detect inapplicable dependency modes.  For instance
23842f6f3826Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23852f6f3826Smrg  # side effect of compilation, but ICC will put the dependencies in
23862f6f3826Smrg  # the current directory while Tru64 will put them in the object
23872f6f3826Smrg  # directory.
23882f6f3826Smrg  mkdir sub
2389f5effb2eSmrg
23902f6f3826Smrg  am_cv_$1_dependencies_compiler_type=none
23912f6f3826Smrg  if test "$am_compiler_list" = ""; then
23922f6f3826Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
23932f6f3826Smrg  fi
23942f6f3826Smrg  am__universal=false
23952f6f3826Smrg  m4_case([$1], [CC],
23962f6f3826Smrg    [case " $depcc " in #(
23972f6f3826Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23982f6f3826Smrg     esac],
23992f6f3826Smrg    [CXX],
24002f6f3826Smrg    [case " $depcc " in #(
24012f6f3826Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24022f6f3826Smrg     esac])
2403585aa3f7Smrg
24042f6f3826Smrg  for depmode in $am_compiler_list; do
24052f6f3826Smrg    # Setup a source with many dependencies, because some compilers
24062f6f3826Smrg    # like to wrap large dependency lists on column 80 (with \), and
24072f6f3826Smrg    # we should not choose a depcomp mode which is confused by this.
24082f6f3826Smrg    #
24092f6f3826Smrg    # We need to recreate these files for each test, as the compiler may
24102f6f3826Smrg    # overwrite some of them when testing with obscure command lines.
24112f6f3826Smrg    # This happens at least with the AIX C compiler.
24122f6f3826Smrg    : > sub/conftest.c
24132f6f3826Smrg    for i in 1 2 3 4 5 6; do
24142f6f3826Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24152f6f3826Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24162f6f3826Smrg      # Solaris 10 /bin/sh.
24172f6f3826Smrg      echo '/* dummy */' > sub/conftst$i.h
24182f6f3826Smrg    done
24192f6f3826Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2420585aa3f7Smrg
24212f6f3826Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24222f6f3826Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24232f6f3826Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24242f6f3826Smrg    # versions had trouble with output in subdirs.
24252f6f3826Smrg    am__obj=sub/conftest.${OBJEXT-o}
24262f6f3826Smrg    am__minus_obj="-o $am__obj"
24272f6f3826Smrg    case $depmode in
24282f6f3826Smrg    gcc)
24292f6f3826Smrg      # This depmode causes a compiler race in universal mode.
24302f6f3826Smrg      test "$am__universal" = false || continue
24312f6f3826Smrg      ;;
24322f6f3826Smrg    nosideeffect)
24332f6f3826Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24342f6f3826Smrg      # only be used when explicitly requested.
24352f6f3826Smrg      if test "x$enable_dependency_tracking" = xyes; then
24362f6f3826Smrg	continue
24372f6f3826Smrg      else
24382f6f3826Smrg	break
24392f6f3826Smrg      fi
24402f6f3826Smrg      ;;
24412f6f3826Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24422f6f3826Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
24432f6f3826Smrg      # not run yet.  These depmodes are late enough in the game, and
24442f6f3826Smrg      # so weak that their functioning should not be impacted.
24452f6f3826Smrg      am__obj=conftest.${OBJEXT-o}
24462f6f3826Smrg      am__minus_obj=
24472f6f3826Smrg      ;;
24482f6f3826Smrg    none) break ;;
24492f6f3826Smrg    esac
24502f6f3826Smrg    if depmode=$depmode \
24512f6f3826Smrg       source=sub/conftest.c object=$am__obj \
24522f6f3826Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24532f6f3826Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24542f6f3826Smrg         >/dev/null 2>conftest.err &&
24552f6f3826Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24562f6f3826Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24572f6f3826Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24582f6f3826Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24592f6f3826Smrg      # icc doesn't choke on unknown options, it will just issue warnings
24602f6f3826Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
24612f6f3826Smrg      # that says an option was ignored or not supported.
24622f6f3826Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24632f6f3826Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24642f6f3826Smrg      # The diagnosis changed in icc 8.0:
24652f6f3826Smrg      #   icc: Command line remark: option '-MP' not supported
24662f6f3826Smrg      if (grep 'ignoring option' conftest.err ||
24672f6f3826Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24682f6f3826Smrg        am_cv_$1_dependencies_compiler_type=$depmode
24692f6f3826Smrg        break
24702f6f3826Smrg      fi
24712f6f3826Smrg    fi
24722f6f3826Smrg  done
2473f5effb2eSmrg
24742f6f3826Smrg  cd ..
24752f6f3826Smrg  rm -rf conftest.dir
2476f5effb2eSmrgelse
24772f6f3826Smrg  am_cv_$1_dependencies_compiler_type=none
2478f5effb2eSmrgfi
24792f6f3826Smrg])
24802f6f3826SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24812f6f3826SmrgAM_CONDITIONAL([am__fastdep$1], [
24822f6f3826Smrg  test "x$enable_dependency_tracking" != xno \
24832f6f3826Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24842f6f3826Smrg])
2485f5effb2eSmrg
2486f5effb2eSmrg
24872f6f3826Smrg# AM_SET_DEPDIR
24882f6f3826Smrg# -------------
24892f6f3826Smrg# Choose a directory name for dependency files.
24902f6f3826Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24912f6f3826SmrgAC_DEFUN([AM_SET_DEPDIR],
24922f6f3826Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24932f6f3826SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24942f6f3826Smrg])
24952f6f3826Smrg
24962f6f3826Smrg
24972f6f3826Smrg# AM_DEP_TRACK
24982f6f3826Smrg# ------------
24992f6f3826SmrgAC_DEFUN([AM_DEP_TRACK],
25002f6f3826Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25012f6f3826SmrgAS_HELP_STRING(
25022f6f3826Smrg  [--enable-dependency-tracking],
25032f6f3826Smrg  [do not reject slow dependency extractors])
25042f6f3826SmrgAS_HELP_STRING(
25052f6f3826Smrg  [--disable-dependency-tracking],
25062f6f3826Smrg  [speeds up one-time build])])
25072f6f3826Smrgif test "x$enable_dependency_tracking" != xno; then
25082f6f3826Smrg  am_depcomp="$ac_aux_dir/depcomp"
25092f6f3826Smrg  AMDEPBACKSLASH='\'
25102f6f3826Smrg  am__nodep='_no'
25112f6f3826Smrgfi
25122f6f3826SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25132f6f3826SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25142f6f3826Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25152f6f3826SmrgAC_SUBST([am__nodep])dnl
25162f6f3826Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25172f6f3826Smrg])
2518f5effb2eSmrg
25192f6f3826Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2520f5effb2eSmrg
25212f6f3826Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
25227d575c90Smrg#
25232f6f3826Smrg# This file is free software; the Free Software Foundation
25242f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
25252f6f3826Smrg# with or without modifications, as long as this notice is preserved.
25267d575c90Smrg
25277d575c90Smrg
25282f6f3826Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25292f6f3826Smrg# ------------------------------
25302f6f3826SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25312f6f3826Smrg[{
25322f6f3826Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
25332f6f3826Smrg  # are listed without --file.  Let's play safe and only enable the eval
25342f6f3826Smrg  # if we detect the quoting.
25352f6f3826Smrg  case $CONFIG_FILES in
25362f6f3826Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
25372f6f3826Smrg  *)   set x $CONFIG_FILES ;;
25382f6f3826Smrg  esac
25392f6f3826Smrg  shift
25402f6f3826Smrg  for mf
25412f6f3826Smrg  do
25422f6f3826Smrg    # Strip MF so we end up with the name of the file.
25432f6f3826Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25442f6f3826Smrg    # Check whether this is an Automake generated Makefile or not.
25452f6f3826Smrg    # We used to match only the files named 'Makefile.in', but
25462f6f3826Smrg    # some people rename them; so instead we look at the file content.
25472f6f3826Smrg    # Grep'ing the first line is not enough: some people post-process
25482f6f3826Smrg    # each Makefile.in and add a new line on top of each file to say so.
25492f6f3826Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
25502f6f3826Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
25512f6f3826Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25522f6f3826Smrg      dirpart=`AS_DIRNAME("$mf")`
25532f6f3826Smrg    else
25542f6f3826Smrg      continue
25552f6f3826Smrg    fi
25562f6f3826Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
25572f6f3826Smrg    # from the Makefile without running 'make'.
25582f6f3826Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25592f6f3826Smrg    test -z "$DEPDIR" && continue
25602f6f3826Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25612f6f3826Smrg    test -z "$am__include" && continue
25622f6f3826Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25632f6f3826Smrg    # Find all dependency output files, they are included files with
25642f6f3826Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25652f6f3826Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25662f6f3826Smrg    # expansion.
25672f6f3826Smrg    for file in `sed -n "
25682f6f3826Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25692f6f3826Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25702f6f3826Smrg      # Make sure the directory exists.
25712f6f3826Smrg      test -f "$dirpart/$file" && continue
25722f6f3826Smrg      fdir=`AS_DIRNAME(["$file"])`
25732f6f3826Smrg      AS_MKDIR_P([$dirpart/$fdir])
25742f6f3826Smrg      # echo "creating $dirpart/$file"
25752f6f3826Smrg      echo '# dummy' > "$dirpart/$file"
25762f6f3826Smrg    done
25772f6f3826Smrg  done
25782f6f3826Smrg}
25792f6f3826Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25802f6f3826Smrg
25812f6f3826Smrg
25822f6f3826Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25832f6f3826Smrg# -----------------------------
25842f6f3826Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
25857d575c90Smrg#
25862f6f3826Smrg# This code is only required when automatic dependency tracking
25872f6f3826Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
25882f6f3826Smrg# need in order to bootstrap the dependency handling code.
25892f6f3826SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25902f6f3826Smrg[AC_CONFIG_COMMANDS([depfiles],
25912f6f3826Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25922f6f3826Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25932f6f3826Smrg])
25942f6f3826Smrg
25952f6f3826Smrg# Do all the work for Automake.                             -*- Autoconf -*-
25962f6f3826Smrg
25972f6f3826Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25987d575c90Smrg#
25992f6f3826Smrg# This file is free software; the Free Software Foundation
26002f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
26012f6f3826Smrg# with or without modifications, as long as this notice is preserved.
26027d575c90Smrg
26032f6f3826Smrg# This macro actually does too much.  Some checks are only needed if
26042f6f3826Smrg# your package does certain things.  But this isn't really a big deal.
26057d575c90Smrg
26062f6f3826Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26072f6f3826Smrgm4_define([AC_PROG_CC],
26082f6f3826Smrgm4_defn([AC_PROG_CC])
26092f6f3826Smrg[_AM_PROG_CC_C_O
26102f6f3826Smrg])
26117d575c90Smrg
26122f6f3826Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26132f6f3826Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26142f6f3826Smrg# -----------------------------------------------
26152f6f3826Smrg# The call with PACKAGE and VERSION arguments is the old style
26162f6f3826Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26172f6f3826Smrg# and VERSION should now be passed to AC_INIT and removed from
26182f6f3826Smrg# the call to AM_INIT_AUTOMAKE.
26192f6f3826Smrg# We support both call styles for the transition.  After
26202f6f3826Smrg# the next Automake release, Autoconf can make the AC_INIT
26212f6f3826Smrg# arguments mandatory, and then we can depend on a new Autoconf
26222f6f3826Smrg# release and drop the old call support.
26232f6f3826SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26242f6f3826Smrg[AC_PREREQ([2.65])dnl
26252f6f3826Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26262f6f3826Smrgdnl the ones we care about.
26272f6f3826Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26282f6f3826SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26292f6f3826SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26302f6f3826Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26312f6f3826Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26322f6f3826Smrg  # is not polluted with repeated "-I."
26332f6f3826Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26342f6f3826Smrg  # test to see if srcdir already configured
26352f6f3826Smrg  if test -f $srcdir/config.status; then
26362f6f3826Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
26377d575c90Smrg  fi
26387d575c90Smrgfi
26397d575c90Smrg
26402f6f3826Smrg# test whether we have cygpath
26412f6f3826Smrgif test -z "$CYGPATH_W"; then
26422f6f3826Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26432f6f3826Smrg    CYGPATH_W='cygpath -w'
26442f6f3826Smrg  else
26452f6f3826Smrg    CYGPATH_W=echo
26467d575c90Smrg  fi
26477d575c90Smrgfi
26482f6f3826SmrgAC_SUBST([CYGPATH_W])
26497d575c90Smrg
26502f6f3826Smrg# Define the identity of the package.
26512f6f3826Smrgdnl Distinguish between old-style and new-style calls.
26522f6f3826Smrgm4_ifval([$2],
26532f6f3826Smrg[AC_DIAGNOSE([obsolete],
26542f6f3826Smrg             [$0: two- and three-arguments forms are deprecated.])
26552f6f3826Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26562f6f3826Smrg AC_SUBST([PACKAGE], [$1])dnl
26572f6f3826Smrg AC_SUBST([VERSION], [$2])],
26582f6f3826Smrg[_AM_SET_OPTIONS([$1])dnl
26592f6f3826Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26602f6f3826Smrgm4_if(
26612f6f3826Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26622f6f3826Smrg  [ok:ok],,
26632f6f3826Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26642f6f3826Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26652f6f3826Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
26667d575c90Smrg
26672f6f3826Smrg_AM_IF_OPTION([no-define],,
26682f6f3826Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26692f6f3826Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
26707d575c90Smrg
26712f6f3826Smrg# Some tools Automake needs.
26722f6f3826SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26732f6f3826SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26742f6f3826SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26752f6f3826SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26762f6f3826SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26772f6f3826SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26782f6f3826SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26792f6f3826SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26802f6f3826SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26812f6f3826SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26822f6f3826Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
26832f6f3826Smrg# dies out for good.  For more background, see:
26842f6f3826Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26852f6f3826Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26862f6f3826SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26872f6f3826Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
26882f6f3826Smrg# system "awk" is bad on some platforms.
26892f6f3826SmrgAC_REQUIRE([AC_PROG_AWK])dnl
26902f6f3826SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26912f6f3826SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26922f6f3826Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26932f6f3826Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26942f6f3826Smrg			     [_AM_PROG_TAR([v7])])])
26952f6f3826Smrg_AM_IF_OPTION([no-dependencies],,
26962f6f3826Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26972f6f3826Smrg		  [_AM_DEPENDENCIES([CC])],
26982f6f3826Smrg		  [m4_define([AC_PROG_CC],
26992f6f3826Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27002f6f3826SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27012f6f3826Smrg		  [_AM_DEPENDENCIES([CXX])],
27022f6f3826Smrg		  [m4_define([AC_PROG_CXX],
27032f6f3826Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27042f6f3826SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27052f6f3826Smrg		  [_AM_DEPENDENCIES([OBJC])],
27062f6f3826Smrg		  [m4_define([AC_PROG_OBJC],
27072f6f3826Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27082f6f3826SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27092f6f3826Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27102f6f3826Smrg		  [m4_define([AC_PROG_OBJCXX],
27112f6f3826Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27122f6f3826Smrg])
27132f6f3826SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27142f6f3826Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27152f6f3826Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27162f6f3826Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27172f6f3826SmrgAC_CONFIG_COMMANDS_PRE(dnl
27182f6f3826Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27192f6f3826Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27207d575c90Smrg
27212f6f3826Smrg# POSIX will say in a future version that running "rm -f" with no argument
27222f6f3826Smrg# is OK; and we want to be able to make that assumption in our Makefile
27232f6f3826Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27242f6f3826Smrg# actually supported "in the wild" to an acceptable degree.
27252f6f3826Smrg# See automake bug#10828.
27262f6f3826Smrg# To make any issue more visible, cause the running configure to be aborted
27272f6f3826Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27282f6f3826Smrg# user can still override this though.
27292f6f3826Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27302f6f3826Smrg  cat >&2 <<'END'
27312f6f3826SmrgOops!
27327d575c90Smrg
27332f6f3826SmrgYour 'rm' program seems unable to run without file operands specified
27342f6f3826Smrgon the command line, even when the '-f' option is present.  This is contrary
27352f6f3826Smrgto the behaviour of most rm programs out there, and not conforming with
27362f6f3826Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
27377d575c90Smrg
27382f6f3826SmrgPlease tell bug-automake@gnu.org about your system, including the value
27392f6f3826Smrgof your $PATH and any error possibly output before this message.  This
27402f6f3826Smrgcan help us improve future automake versions.
27417d575c90Smrg
27422f6f3826SmrgEND
27432f6f3826Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27442f6f3826Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27452f6f3826Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27462f6f3826Smrg    echo >&2
27472f6f3826Smrg  else
27482f6f3826Smrg    cat >&2 <<'END'
27492f6f3826SmrgAborting the configuration process, to ensure you take notice of the issue.
27507d575c90Smrg
27512f6f3826SmrgYou can download and install GNU coreutils to get an 'rm' implementation
27522f6f3826Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
27537d575c90Smrg
27542f6f3826SmrgIf you want to complete the configuration process using your problematic
27552f6f3826Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27562f6f3826Smrgto "yes", and re-run configure.
2757fdb3d228Smrg
27582f6f3826SmrgEND
27592f6f3826Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27602f6f3826Smrg  fi
2761fdb3d228Smrgfi
27622f6f3826Smrgdnl The trailing newline in this macro's definition is deliberate, for
27632f6f3826Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27642f6f3826Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27652f6f3826Smrg])
2766fdb3d228Smrg
27672f6f3826Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27682f6f3826Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27692f6f3826Smrgdnl mangled by Autoconf and run in a shell conditional statement.
27702f6f3826Smrgm4_define([_AC_COMPILER_EXEEXT],
27712f6f3826Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2772fdb3d228Smrg
27732f6f3826Smrg# When config.status generates a header, we must update the stamp-h file.
27742f6f3826Smrg# This file resides in the same directory as the config header
27752f6f3826Smrg# that is generated.  The stamp files are numbered to have different names.
2776fdb3d228Smrg
27772f6f3826Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27782f6f3826Smrg# loop where config.status creates the headers, so we can generate
27792f6f3826Smrg# our stamp files there.
27802f6f3826SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27812f6f3826Smrg[# Compute $1's index in $config_headers.
27822f6f3826Smrg_am_arg=$1
27832f6f3826Smrg_am_stamp_count=1
27842f6f3826Smrgfor _am_header in $config_headers :; do
27852f6f3826Smrg  case $_am_header in
27862f6f3826Smrg    $_am_arg | $_am_arg:* )
27872f6f3826Smrg      break ;;
27882f6f3826Smrg    * )
27892f6f3826Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27902f6f3826Smrg  esac
27912f6f3826Smrgdone
27922f6f3826Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
27932f6f3826Smrg
27942f6f3826Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27959b41ff1aSmrg#
27962f6f3826Smrg# This file is free software; the Free Software Foundation
27972f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
27982f6f3826Smrg# with or without modifications, as long as this notice is preserved.
27999b41ff1aSmrg
28002f6f3826Smrg# AM_PROG_INSTALL_SH
28012f6f3826Smrg# ------------------
28022f6f3826Smrg# Define $install_sh.
28032f6f3826SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28042f6f3826Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28052f6f3826Smrgif test x"${install_sh+set}" != xset; then
28062f6f3826Smrg  case $am_aux_dir in
28072f6f3826Smrg  *\ * | *\	*)
28082f6f3826Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28092f6f3826Smrg  *)
28102f6f3826Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28112f6f3826Smrg  esac
28122f6f3826Smrgfi
28132f6f3826SmrgAC_SUBST([install_sh])])
28147d575c90Smrg
28152f6f3826Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28162f6f3826Smrg#
28172f6f3826Smrg# This file is free software; the Free Software Foundation
28182f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
28192f6f3826Smrg# with or without modifications, as long as this notice is preserved.
28207d575c90Smrg
28212f6f3826Smrg# Check whether the underlying file-system supports filenames
28222f6f3826Smrg# with a leading dot.  For instance MS-DOS doesn't.
28232f6f3826SmrgAC_DEFUN([AM_SET_LEADING_DOT],
28242f6f3826Smrg[rm -rf .tst 2>/dev/null
28252f6f3826Smrgmkdir .tst 2>/dev/null
28262f6f3826Smrgif test -d .tst; then
28272f6f3826Smrg  am__leading_dot=.
28289b41ff1aSmrgelse
28292f6f3826Smrg  am__leading_dot=_
28309b41ff1aSmrgfi
28312f6f3826Smrgrmdir .tst 2>/dev/null
28322f6f3826SmrgAC_SUBST([am__leading_dot])])
28339b41ff1aSmrg
28342f6f3826Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
28359b41ff1aSmrg
28362f6f3826Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
28377d575c90Smrg#
28382f6f3826Smrg# This file is free software; the Free Software Foundation
28392f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
28402f6f3826Smrg# with or without modifications, as long as this notice is preserved.
28417d575c90Smrg
28422f6f3826Smrg# AM_MAKE_INCLUDE()
28432f6f3826Smrg# -----------------
28442f6f3826Smrg# Check to see how make treats includes.
28452f6f3826SmrgAC_DEFUN([AM_MAKE_INCLUDE],
28462f6f3826Smrg[am_make=${MAKE-make}
28472f6f3826Smrgcat > confinc << 'END'
28482f6f3826Smrgam__doit:
28492f6f3826Smrg	@echo this is the am__doit target
28502f6f3826Smrg.PHONY: am__doit
28512f6f3826SmrgEND
28522f6f3826Smrg# If we don't find an include directive, just comment out the code.
28532f6f3826SmrgAC_MSG_CHECKING([for style of include used by $am_make])
28542f6f3826Smrgam__include="#"
28552f6f3826Smrgam__quote=
28562f6f3826Smrg_am_result=none
28572f6f3826Smrg# First try GNU make style include.
28582f6f3826Smrgecho "include confinc" > confmf
28592f6f3826Smrg# Ignore all kinds of additional output from 'make'.
28602f6f3826Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28612f6f3826Smrg*the\ am__doit\ target*)
28622f6f3826Smrg  am__include=include
28632f6f3826Smrg  am__quote=
28642f6f3826Smrg  _am_result=GNU
28652f6f3826Smrg  ;;
28662f6f3826Smrgesac
28672f6f3826Smrg# Now try BSD make style include.
28682f6f3826Smrgif test "$am__include" = "#"; then
28692f6f3826Smrg   echo '.include "confinc"' > confmf
28702f6f3826Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28712f6f3826Smrg   *the\ am__doit\ target*)
28722f6f3826Smrg     am__include=.include
28732f6f3826Smrg     am__quote="\""
28742f6f3826Smrg     _am_result=BSD
28752f6f3826Smrg     ;;
28762f6f3826Smrg   esac
28779b41ff1aSmrgfi
28782f6f3826SmrgAC_SUBST([am__include])
28792f6f3826SmrgAC_SUBST([am__quote])
28802f6f3826SmrgAC_MSG_RESULT([$_am_result])
28812f6f3826Smrgrm -f confinc confmf
28822f6f3826Smrg])
28837d575c90Smrg
28842f6f3826Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
28857d575c90Smrg
28862f6f3826Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
28877d575c90Smrg#
28882f6f3826Smrg# This file is free software; the Free Software Foundation
28892f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
28902f6f3826Smrg# with or without modifications, as long as this notice is preserved.
28917d575c90Smrg
28922f6f3826Smrg# AM_MISSING_PROG(NAME, PROGRAM)
28932f6f3826Smrg# ------------------------------
28942f6f3826SmrgAC_DEFUN([AM_MISSING_PROG],
28952f6f3826Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28962f6f3826Smrg$1=${$1-"${am_missing_run}$2"}
28972f6f3826SmrgAC_SUBST($1)])
28987d575c90Smrg
28992f6f3826Smrg# AM_MISSING_HAS_RUN
29002f6f3826Smrg# ------------------
29012f6f3826Smrg# Define MISSING if not defined so far and test if it is modern enough.
29022f6f3826Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29032f6f3826SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29042f6f3826Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29052f6f3826SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29062f6f3826Smrgif test x"${MISSING+set}" != xset; then
29072f6f3826Smrg  case $am_aux_dir in
29082f6f3826Smrg  *\ * | *\	*)
29092f6f3826Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29102f6f3826Smrg  *)
29112f6f3826Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29122f6f3826Smrg  esac
29137d575c90Smrgfi
29142f6f3826Smrg# Use eval to expand $SHELL
29152f6f3826Smrgif eval "$MISSING --is-lightweight"; then
29162f6f3826Smrg  am_missing_run="$MISSING "
29172f6f3826Smrgelse
29182f6f3826Smrg  am_missing_run=
29192f6f3826Smrg  AC_MSG_WARN(['missing' script is too old or missing])
29207d575c90Smrgfi
29212f6f3826Smrg])
29227d575c90Smrg
29232f6f3826Smrg# Helper functions for option handling.                     -*- Autoconf -*-
29247d575c90Smrg
29252f6f3826Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29262f6f3826Smrg#
29272f6f3826Smrg# This file is free software; the Free Software Foundation
29282f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
29292f6f3826Smrg# with or without modifications, as long as this notice is preserved.
29307d575c90Smrg
29312f6f3826Smrg# _AM_MANGLE_OPTION(NAME)
29322f6f3826Smrg# -----------------------
29332f6f3826SmrgAC_DEFUN([_AM_MANGLE_OPTION],
29342f6f3826Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
29357d575c90Smrg
29362f6f3826Smrg# _AM_SET_OPTION(NAME)
29372f6f3826Smrg# --------------------
29382f6f3826Smrg# Set option NAME.  Presently that only means defining a flag for this option.
29392f6f3826SmrgAC_DEFUN([_AM_SET_OPTION],
29402f6f3826Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
29417d575c90Smrg
29422f6f3826Smrg# _AM_SET_OPTIONS(OPTIONS)
29432f6f3826Smrg# ------------------------
29442f6f3826Smrg# OPTIONS is a space-separated list of Automake options.
29452f6f3826SmrgAC_DEFUN([_AM_SET_OPTIONS],
29462f6f3826Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
29477d575c90Smrg
29482f6f3826Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29492f6f3826Smrg# -------------------------------------------
29502f6f3826Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29512f6f3826SmrgAC_DEFUN([_AM_IF_OPTION],
29522f6f3826Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
29537d575c90Smrg
29542f6f3826Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
29557d575c90Smrg#
29562f6f3826Smrg# This file is free software; the Free Software Foundation
29572f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
29582f6f3826Smrg# with or without modifications, as long as this notice is preserved.
29597d575c90Smrg
29602f6f3826Smrg# _AM_PROG_CC_C_O
29612f6f3826Smrg# ---------------
29622f6f3826Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29632f6f3826Smrg# to automatically call this.
29642f6f3826SmrgAC_DEFUN([_AM_PROG_CC_C_O],
29652f6f3826Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29662f6f3826SmrgAC_REQUIRE_AUX_FILE([compile])dnl
29672f6f3826SmrgAC_LANG_PUSH([C])dnl
29682f6f3826SmrgAC_CACHE_CHECK(
29692f6f3826Smrg  [whether $CC understands -c and -o together],
29702f6f3826Smrg  [am_cv_prog_cc_c_o],
29712f6f3826Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29722f6f3826Smrg  # Make sure it works both with $CC and with simple cc.
29732f6f3826Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29742f6f3826Smrg  # compilers refuse to overwrite an existing .o file with -o,
29752f6f3826Smrg  # though they will create one.
29762f6f3826Smrg  am_cv_prog_cc_c_o=yes
29772f6f3826Smrg  for am_i in 1 2; do
29782f6f3826Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29792f6f3826Smrg         && test -f conftest2.$ac_objext; then
29802f6f3826Smrg      : OK
29812f6f3826Smrg    else
29822f6f3826Smrg      am_cv_prog_cc_c_o=no
29832f6f3826Smrg      break
29842f6f3826Smrg    fi
29852f6f3826Smrg  done
29862f6f3826Smrg  rm -f core conftest*
29872f6f3826Smrg  unset am_i])
29882f6f3826Smrgif test "$am_cv_prog_cc_c_o" != yes; then
29892f6f3826Smrg   # Losing compiler, so override with the script.
29902f6f3826Smrg   # FIXME: It is wrong to rewrite CC.
29912f6f3826Smrg   # But if we don't then we get into trouble of one sort or another.
29922f6f3826Smrg   # A longer-term fix would be to have automake use am__CC in this case,
29932f6f3826Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29942f6f3826Smrg   CC="$am_aux_dir/compile $CC"
29957d575c90Smrgfi
29962f6f3826SmrgAC_LANG_POP([C])])
29977d575c90Smrg
29982f6f3826Smrg# For backward compatibility.
29992f6f3826SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30002f6f3826Smrg
30012f6f3826Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30022f6f3826Smrg#
30032f6f3826Smrg# This file is free software; the Free Software Foundation
30042f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
30052f6f3826Smrg# with or without modifications, as long as this notice is preserved.
30062f6f3826Smrg
30072f6f3826Smrg# AM_RUN_LOG(COMMAND)
30082f6f3826Smrg# -------------------
30092f6f3826Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30102f6f3826Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30112f6f3826SmrgAC_DEFUN([AM_RUN_LOG],
30122f6f3826Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30132f6f3826Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30142f6f3826Smrg   ac_status=$?
30152f6f3826Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30162f6f3826Smrg   (exit $ac_status); }])
30177d575c90Smrg
30182f6f3826Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30197d575c90Smrg
30202f6f3826Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30212f6f3826Smrg#
30222f6f3826Smrg# This file is free software; the Free Software Foundation
30232f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
30242f6f3826Smrg# with or without modifications, as long as this notice is preserved.
30257d575c90Smrg
30262f6f3826Smrg# AM_SANITY_CHECK
30272f6f3826Smrg# ---------------
30282f6f3826SmrgAC_DEFUN([AM_SANITY_CHECK],
30292f6f3826Smrg[AC_MSG_CHECKING([whether build environment is sane])
30302f6f3826Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30312f6f3826Smrg# name.  Accept space and tab only in the latter.
30322f6f3826Smrgam_lf='
30332f6f3826Smrg'
30342f6f3826Smrgcase `pwd` in
30352f6f3826Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30362f6f3826Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30372f6f3826Smrgesac
30382f6f3826Smrgcase $srcdir in
30392f6f3826Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30402f6f3826Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30412f6f3826Smrgesac
30427d575c90Smrg
30432f6f3826Smrg# Do 'set' in a subshell so we don't clobber the current shell's
30442f6f3826Smrg# arguments.  Must try -L first in case configure is actually a
30452f6f3826Smrg# symlink; some systems play weird games with the mod time of symlinks
30462f6f3826Smrg# (eg FreeBSD returns the mod time of the symlink's containing
30472f6f3826Smrg# directory).
30482f6f3826Smrgif (
30492f6f3826Smrg   am_has_slept=no
30502f6f3826Smrg   for am_try in 1 2; do
30512f6f3826Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30522f6f3826Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30532f6f3826Smrg     if test "$[*]" = "X"; then
30542f6f3826Smrg	# -L didn't work.
30552f6f3826Smrg	set X `ls -t "$srcdir/configure" conftest.file`
30562f6f3826Smrg     fi
30572f6f3826Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30582f6f3826Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
30597d575c90Smrg
30602f6f3826Smrg	# If neither matched, then we have a broken ls.  This can happen
30612f6f3826Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30622f6f3826Smrg	# broken ls alias from the environment.  This has actually
30632f6f3826Smrg	# happened.  Such a system could not be considered "sane".
30642f6f3826Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30652f6f3826Smrg  alias in your environment])
30662f6f3826Smrg     fi
30672f6f3826Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30682f6f3826Smrg       break
30692f6f3826Smrg     fi
30702f6f3826Smrg     # Just in case.
30712f6f3826Smrg     sleep 1
30722f6f3826Smrg     am_has_slept=yes
30732f6f3826Smrg   done
30742f6f3826Smrg   test "$[2]" = conftest.file
30752f6f3826Smrg   )
30762f6f3826Smrgthen
30772f6f3826Smrg   # Ok.
30782f6f3826Smrg   :
30797d575c90Smrgelse
30802f6f3826Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
30812f6f3826SmrgCheck your system clock])
30827d575c90Smrgfi
30832f6f3826SmrgAC_MSG_RESULT([yes])
30842f6f3826Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30852f6f3826Smrg# generated files are strictly newer.
30862f6f3826Smrgam_sleep_pid=
30872f6f3826Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30882f6f3826Smrg  ( sleep 1 ) &
30892f6f3826Smrg  am_sleep_pid=$!
30902f6f3826Smrgfi
30912f6f3826SmrgAC_CONFIG_COMMANDS_PRE(
30922f6f3826Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30932f6f3826Smrg   if test -n "$am_sleep_pid"; then
30942f6f3826Smrg     # Hide warnings about reused PIDs.
30952f6f3826Smrg     wait $am_sleep_pid 2>/dev/null
30962f6f3826Smrg   fi
30972f6f3826Smrg   AC_MSG_RESULT([done])])
30982f6f3826Smrgrm -f conftest.file
30992f6f3826Smrg])
31007d575c90Smrg
31012f6f3826Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
31027d575c90Smrg#
31032f6f3826Smrg# This file is free software; the Free Software Foundation
31042f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
31052f6f3826Smrg# with or without modifications, as long as this notice is preserved.
31069b41ff1aSmrg
31072f6f3826Smrg# AM_SILENT_RULES([DEFAULT])
31082f6f3826Smrg# --------------------------
31092f6f3826Smrg# Enable less verbose build rules; with the default set to DEFAULT
31102f6f3826Smrg# ("yes" being less verbose, "no" or empty being verbose).
31112f6f3826SmrgAC_DEFUN([AM_SILENT_RULES],
31122f6f3826Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31132f6f3826SmrgAS_HELP_STRING(
31142f6f3826Smrg  [--enable-silent-rules],
31152f6f3826Smrg  [less verbose build output (undo: "make V=1")])
31162f6f3826SmrgAS_HELP_STRING(
31172f6f3826Smrg  [--disable-silent-rules],
31182f6f3826Smrg  [verbose build output (undo: "make V=0")])dnl
31192f6f3826Smrg])
31202f6f3826Smrgcase $enable_silent_rules in @%:@ (((
31212f6f3826Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31222f6f3826Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31232f6f3826Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31242f6f3826Smrgesac
31252f6f3826Smrgdnl
31262f6f3826Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31272f6f3826Smrgdnl do not support nested variable expansions.
31282f6f3826Smrgdnl See automake bug#9928 and bug#10237.
31292f6f3826Smrgam_make=${MAKE-make}
31302f6f3826SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31312f6f3826Smrg   [am_cv_make_support_nested_variables],
31322f6f3826Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31332f6f3826SmrgBAR0=false
31342f6f3826SmrgBAR1=true
31352f6f3826SmrgV=1
31362f6f3826Smrgam__doit:
31372f6f3826Smrg	@$(TRUE)
31382f6f3826Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31392f6f3826Smrg  am_cv_make_support_nested_variables=yes
31402f6f3826Smrgelse
31412f6f3826Smrg  am_cv_make_support_nested_variables=no
31422f6f3826Smrgfi])
31432f6f3826Smrgif test $am_cv_make_support_nested_variables = yes; then
31442f6f3826Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31452f6f3826Smrg  AM_V='$(V)'
31462f6f3826Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31472f6f3826Smrgelse
31482f6f3826Smrg  AM_V=$AM_DEFAULT_VERBOSITY
31492f6f3826Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31502f6f3826Smrgfi
31512f6f3826SmrgAC_SUBST([AM_V])dnl
31522f6f3826SmrgAM_SUBST_NOTMAKE([AM_V])dnl
31532f6f3826SmrgAC_SUBST([AM_DEFAULT_V])dnl
31542f6f3826SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31552f6f3826SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31562f6f3826SmrgAM_BACKSLASH='\'
31572f6f3826SmrgAC_SUBST([AM_BACKSLASH])dnl
31582f6f3826Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31592f6f3826Smrg])
31602f6f3826Smrg
31612f6f3826Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
31627d575c90Smrg#
31632f6f3826Smrg# This file is free software; the Free Software Foundation
31642f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
31652f6f3826Smrg# with or without modifications, as long as this notice is preserved.
31662f6f3826Smrg
31672f6f3826Smrg# AM_PROG_INSTALL_STRIP
31682f6f3826Smrg# ---------------------
31692f6f3826Smrg# One issue with vendor 'install' (even GNU) is that you can't
31702f6f3826Smrg# specify the program used to strip binaries.  This is especially
31712f6f3826Smrg# annoying in cross-compiling environments, where the build's strip
31722f6f3826Smrg# is unlikely to handle the host's binaries.
31732f6f3826Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31742f6f3826Smrg# always use install-sh in "make install-strip", and initialize
31752f6f3826Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
31762f6f3826SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31772f6f3826Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31782f6f3826Smrg# Installed binaries are usually stripped using 'strip' when the user
31792f6f3826Smrg# run "make install-strip".  However 'strip' might not be the right
31802f6f3826Smrg# tool to use in cross-compilation environments, therefore Automake
31812f6f3826Smrg# will honor the 'STRIP' environment variable to overrule this program.
31822f6f3826Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31832f6f3826Smrgif test "$cross_compiling" != no; then
31842f6f3826Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
31852f6f3826Smrgfi
31862f6f3826SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31872f6f3826SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31889b41ff1aSmrg
31892f6f3826Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31902f6f3826Smrg#
31912f6f3826Smrg# This file is free software; the Free Software Foundation
31922f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
31932f6f3826Smrg# with or without modifications, as long as this notice is preserved.
31947d575c90Smrg
31952f6f3826Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
31962f6f3826Smrg# ---------------------------
31972f6f3826Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31982f6f3826Smrg# This macro is traced by Automake.
31992f6f3826SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
32007d575c90Smrg
32012f6f3826Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32022f6f3826Smrg# --------------------------
32032f6f3826Smrg# Public sister of _AM_SUBST_NOTMAKE.
32042f6f3826SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32057d575c90Smrg
32062f6f3826Smrg# Check how to create a tarball.                            -*- Autoconf -*-
32077d575c90Smrg
32082f6f3826Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32092f6f3826Smrg#
32102f6f3826Smrg# This file is free software; the Free Software Foundation
32112f6f3826Smrg# gives unlimited permission to copy and/or distribute it,
32122f6f3826Smrg# with or without modifications, as long as this notice is preserved.
32139b41ff1aSmrg
32142f6f3826Smrg# _AM_PROG_TAR(FORMAT)
32159b41ff1aSmrg# --------------------
32162f6f3826Smrg# Check how to create a tarball in format FORMAT.
32172f6f3826Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32189b41ff1aSmrg#
32192f6f3826Smrg# Substitute a variable $(am__tar) that is a command
32202f6f3826Smrg# writing to stdout a FORMAT-tarball containing the directory
32212f6f3826Smrg# $tardir.
32222f6f3826Smrg#     tardir=directory && $(am__tar) > result.tar
3223f5effb2eSmrg#
32242f6f3826Smrg# Substitute a variable $(am__untar) that extract such
32252f6f3826Smrg# a tarball read from stdin.
32262f6f3826Smrg#     $(am__untar) < result.tar
3227f5effb2eSmrg#
32282f6f3826SmrgAC_DEFUN([_AM_PROG_TAR],
32292f6f3826Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32302f6f3826Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32312f6f3826SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232fdb3d228Smrg
32332f6f3826Smrg# We'll loop over all known methods to create a tar archive until one works.
32342f6f3826Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235585aa3f7Smrg
32362f6f3826Smrgm4_if([$1], [v7],
32372f6f3826Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3238fdb3d228Smrg
32392f6f3826Smrg  [m4_case([$1],
32402f6f3826Smrg    [ustar],
32412f6f3826Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32422f6f3826Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32432f6f3826Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32442f6f3826Smrg      # and bug#13588).
32452f6f3826Smrg      am_max_uid=2097151 # 2^21 - 1
32462f6f3826Smrg      am_max_gid=$am_max_uid
32472f6f3826Smrg      # The $UID and $GID variables are not portable, so we need to resort
32482f6f3826Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32492f6f3826Smrg      # below are definitely unexpected, so allow the users to see them
32502f6f3826Smrg      # (that is, avoid stderr redirection).
32512f6f3826Smrg      am_uid=`id -u || echo unknown`
32522f6f3826Smrg      am_gid=`id -g || echo unknown`
32532f6f3826Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32542f6f3826Smrg      if test $am_uid -le $am_max_uid; then
32552f6f3826Smrg         AC_MSG_RESULT([yes])
32562f6f3826Smrg      else
32572f6f3826Smrg         AC_MSG_RESULT([no])
32582f6f3826Smrg         _am_tools=none
32592f6f3826Smrg      fi
32602f6f3826Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32612f6f3826Smrg      if test $am_gid -le $am_max_gid; then
32622f6f3826Smrg         AC_MSG_RESULT([yes])
32632f6f3826Smrg      else
32642f6f3826Smrg        AC_MSG_RESULT([no])
32652f6f3826Smrg        _am_tools=none
32662f6f3826Smrg      fi],
32672f6f3826Smrg
32682f6f3826Smrg  [pax],
32692f6f3826Smrg    [],
32702f6f3826Smrg
32712f6f3826Smrg  [m4_fatal([Unknown tar format])])
32722f6f3826Smrg
32732f6f3826Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
32742f6f3826Smrg
32752f6f3826Smrg  # Go ahead even if we have the value already cached.  We do so because we
32762f6f3826Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32772f6f3826Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32782f6f3826Smrg
32792f6f3826Smrg  for _am_tool in $_am_tools; do
32802f6f3826Smrg    case $_am_tool in
32812f6f3826Smrg    gnutar)
32822f6f3826Smrg      for _am_tar in tar gnutar gtar; do
32832f6f3826Smrg        AM_RUN_LOG([$_am_tar --version]) && break
32842f6f3826Smrg      done
32852f6f3826Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32862f6f3826Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32872f6f3826Smrg      am__untar="$_am_tar -xf -"
32882f6f3826Smrg      ;;
32892f6f3826Smrg    plaintar)
32902f6f3826Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32912f6f3826Smrg      # ustar tarball either.
32922f6f3826Smrg      (tar --version) >/dev/null 2>&1 && continue
32932f6f3826Smrg      am__tar='tar chf - "$$tardir"'
32942f6f3826Smrg      am__tar_='tar chf - "$tardir"'
32952f6f3826Smrg      am__untar='tar xf -'
32962f6f3826Smrg      ;;
32972f6f3826Smrg    pax)
32982f6f3826Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
32992f6f3826Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33002f6f3826Smrg      am__untar='pax -r'
33012f6f3826Smrg      ;;
33022f6f3826Smrg    cpio)
33032f6f3826Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33042f6f3826Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33052f6f3826Smrg      am__untar='cpio -i -H $1 -d'
33062f6f3826Smrg      ;;
33072f6f3826Smrg    none)
33082f6f3826Smrg      am__tar=false
33092f6f3826Smrg      am__tar_=false
33102f6f3826Smrg      am__untar=false
33112f6f3826Smrg      ;;
33122f6f3826Smrg    esac
33132f6f3826Smrg
33142f6f3826Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33152f6f3826Smrg    # and am__untar set.
33162f6f3826Smrg    test -n "${am_cv_prog_tar_$1}" && break
33172f6f3826Smrg
33182f6f3826Smrg    # tar/untar a dummy directory, and stop if the command works.
33192f6f3826Smrg    rm -rf conftest.dir
33202f6f3826Smrg    mkdir conftest.dir
33212f6f3826Smrg    echo GrepMe > conftest.dir/file
33222f6f3826Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33232f6f3826Smrg    rm -rf conftest.dir
33242f6f3826Smrg    if test -s conftest.tar; then
33252f6f3826Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33262f6f3826Smrg      AM_RUN_LOG([cat conftest.dir/file])
33272f6f3826Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33282f6f3826Smrg    fi
33292f6f3826Smrg  done
33302f6f3826Smrg  rm -rf conftest.dir
33312f6f3826Smrg
33322f6f3826Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33332f6f3826Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33342f6f3826Smrg
33352f6f3826SmrgAC_SUBST([am__tar])
33362f6f3826SmrgAC_SUBST([am__untar])
33372f6f3826Smrg]) # _AM_PROG_TAR
33389b41ff1aSmrg
3339