aclocal.m4 revision 0d22642b
10d22642bSmrg# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
28abc0ccfSmrg
30d22642bSmrg# Copyright (C) 1996-2020 Free Software Foundation, Inc.
47a0395d0Smrg
57a0395d0Smrg# This file is free software; the Free Software Foundation
67a0395d0Smrg# gives unlimited permission to copy and/or distribute it,
77a0395d0Smrg# with or without modifications, as long as this notice is preserved.
87a0395d0Smrg
97a0395d0Smrg# This program is distributed in the hope that it will be useful,
107a0395d0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117a0395d0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127a0395d0Smrg# PARTICULAR PURPOSE.
137a0395d0Smrg
149a011757Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157a0395d0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167a0395d0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178abc0ccfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
188abc0ccfSmrg[m4_warning([this file was generated for autoconf 2.69.
197a0395d0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207a0395d0SmrgIf you have problems, you may need to regenerate the build system entirely.
218abc0ccfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227a0395d0Smrg
230d22642bSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
240d22642bSmrgdnl serial 11 (pkg-config-0.29)
250d22642bSmrgdnl
266c3c2bceSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
276c3c2bceSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
286c3c2bceSmrgdnl
296c3c2bceSmrgdnl This program is free software; you can redistribute it and/or modify
306c3c2bceSmrgdnl it under the terms of the GNU General Public License as published by
316c3c2bceSmrgdnl the Free Software Foundation; either version 2 of the License, or
326c3c2bceSmrgdnl (at your option) any later version.
336c3c2bceSmrgdnl
346c3c2bceSmrgdnl This program is distributed in the hope that it will be useful, but
356c3c2bceSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
366c3c2bceSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376c3c2bceSmrgdnl General Public License for more details.
386c3c2bceSmrgdnl
396c3c2bceSmrgdnl You should have received a copy of the GNU General Public License
406c3c2bceSmrgdnl along with this program; if not, write to the Free Software
416c3c2bceSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
426c3c2bceSmrgdnl 02111-1307, USA.
436c3c2bceSmrgdnl
446c3c2bceSmrgdnl As a special exception to the GNU General Public License, if you
456c3c2bceSmrgdnl distribute this file as part of a program that contains a
466c3c2bceSmrgdnl configuration script generated by Autoconf, you may include it under
476c3c2bceSmrgdnl the same distribution terms that you use for the rest of that
486c3c2bceSmrgdnl program.
496c3c2bceSmrg
506c3c2bceSmrgdnl PKG_PREREQ(MIN-VERSION)
516c3c2bceSmrgdnl -----------------------
526c3c2bceSmrgdnl Since: 0.29
536c3c2bceSmrgdnl
546c3c2bceSmrgdnl Verify that the version of the pkg-config macros are at least
556c3c2bceSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
566c3c2bceSmrgdnl installed version of pkg-config, this checks the developer's version
576c3c2bceSmrgdnl of pkg.m4 when generating configure.
586c3c2bceSmrgdnl
596c3c2bceSmrgdnl To ensure that this macro is defined, also add:
606c3c2bceSmrgdnl m4_ifndef([PKG_PREREQ],
616c3c2bceSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
626c3c2bceSmrgdnl
636c3c2bceSmrgdnl See the "Since" comment for each macro you use to see what version
646c3c2bceSmrgdnl of the macros you require.
656c3c2bceSmrgm4_defun([PKG_PREREQ],
660d22642bSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
676c3c2bceSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
686c3c2bceSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
696c3c2bceSmrg])dnl PKG_PREREQ
706c3c2bceSmrg
716c3c2bceSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
726c3c2bceSmrgdnl ----------------------------------
736c3c2bceSmrgdnl Since: 0.16
746c3c2bceSmrgdnl
756c3c2bceSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
766c3c2bceSmrgdnl first found in the path. Checks that the version of pkg-config found
776c3c2bceSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
786c3c2bceSmrgdnl used since that's the first version where most current features of
796c3c2bceSmrgdnl pkg-config existed.
808abc0ccfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
818abc0ccfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
828abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
838abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
848abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
858abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
868abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
877a0395d0Smrg
888abc0ccfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
898abc0ccfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
908abc0ccfSmrgfi
918abc0ccfSmrgif test -n "$PKG_CONFIG"; then
928abc0ccfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
938abc0ccfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
948abc0ccfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
958abc0ccfSmrg		AC_MSG_RESULT([yes])
968abc0ccfSmrg	else
978abc0ccfSmrg		AC_MSG_RESULT([no])
988abc0ccfSmrg		PKG_CONFIG=""
998abc0ccfSmrg	fi
1008abc0ccfSmrgfi[]dnl
1016c3c2bceSmrg])dnl PKG_PROG_PKG_CONFIG
1027a0395d0Smrg
1036c3c2bceSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1046c3c2bceSmrgdnl -------------------------------------------------------------------
1056c3c2bceSmrgdnl Since: 0.18
1066c3c2bceSmrgdnl
1076c3c2bceSmrgdnl Check to see whether a particular set of modules exists. Similar to
1086c3c2bceSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1096c3c2bceSmrgdnl
1106c3c2bceSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1116c3c2bceSmrgdnl only at the first occurence in configure.ac, so if the first place
1126c3c2bceSmrgdnl it's called might be skipped (such as if it is within an "if", you
1136c3c2bceSmrgdnl have to call PKG_CHECK_EXISTS manually
1148abc0ccfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1158abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1168abc0ccfSmrgif test -n "$PKG_CONFIG" && \
1178abc0ccfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1188abc0ccfSmrg  m4_default([$2], [:])
1198abc0ccfSmrgm4_ifvaln([$3], [else
1208abc0ccfSmrg  $3])dnl
1218abc0ccfSmrgfi])
1227a0395d0Smrg
1236c3c2bceSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1246c3c2bceSmrgdnl ---------------------------------------------
1256c3c2bceSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1266c3c2bceSmrgdnl pkg_failed based on the result.
1278abc0ccfSmrgm4_define([_PKG_CONFIG],
1288abc0ccfSmrg[if test -n "$$1"; then
1298abc0ccfSmrg    pkg_cv_[]$1="$$1"
1308abc0ccfSmrg elif test -n "$PKG_CONFIG"; then
1318abc0ccfSmrg    PKG_CHECK_EXISTS([$3],
1328abc0ccfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1338abc0ccfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1348abc0ccfSmrg		     [pkg_failed=yes])
1358abc0ccfSmrg else
1368abc0ccfSmrg    pkg_failed=untried
1378abc0ccfSmrgfi[]dnl
1386c3c2bceSmrg])dnl _PKG_CONFIG
1397a0395d0Smrg
1406c3c2bceSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1416c3c2bceSmrgdnl ---------------------------
1426c3c2bceSmrgdnl Internal check to see if pkg-config supports short errors.
1438abc0ccfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1448abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1458abc0ccfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1468abc0ccfSmrg        _pkg_short_errors_supported=yes
1478abc0ccfSmrgelse
1488abc0ccfSmrg        _pkg_short_errors_supported=no
1498abc0ccfSmrgfi[]dnl
1506c3c2bceSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1517a0395d0Smrg
1528abc0ccfSmrg
1536c3c2bceSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1546c3c2bceSmrgdnl   [ACTION-IF-NOT-FOUND])
1556c3c2bceSmrgdnl --------------------------------------------------------------
1566c3c2bceSmrgdnl Since: 0.4.0
1576c3c2bceSmrgdnl
1586c3c2bceSmrgdnl Note that if there is a possibility the first call to
1596c3c2bceSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1606c3c2bceSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1618abc0ccfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1628abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1638abc0ccfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1648abc0ccfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1657a0395d0Smrg
1668abc0ccfSmrgpkg_failed=no
1678abc0ccfSmrgAC_MSG_CHECKING([for $1])
1687a0395d0Smrg
1698abc0ccfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1708abc0ccfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1717a0395d0Smrg
1728abc0ccfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1738abc0ccfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1748abc0ccfSmrgSee the pkg-config man page for more details.])
1757a0395d0Smrg
1768abc0ccfSmrgif test $pkg_failed = yes; then
1778abc0ccfSmrg   	AC_MSG_RESULT([no])
1788abc0ccfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1798abc0ccfSmrg        if test $_pkg_short_errors_supported = yes; then
1808abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1818abc0ccfSmrg        else 
1828abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1838abc0ccfSmrg        fi
1848abc0ccfSmrg	# Put the nasty error message in config.log where it belongs
1858abc0ccfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1867a0395d0Smrg
1878abc0ccfSmrg	m4_default([$4], [AC_MSG_ERROR(
1888abc0ccfSmrg[Package requirements ($2) were not met:
1897a0395d0Smrg
1908abc0ccfSmrg$$1_PKG_ERRORS
1917a0395d0Smrg
1928abc0ccfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1938abc0ccfSmrginstalled software in a non-standard prefix.
1947a0395d0Smrg
1958abc0ccfSmrg_PKG_TEXT])[]dnl
1968abc0ccfSmrg        ])
1978abc0ccfSmrgelif test $pkg_failed = untried; then
1988abc0ccfSmrg     	AC_MSG_RESULT([no])
1998abc0ccfSmrg	m4_default([$4], [AC_MSG_FAILURE(
2008abc0ccfSmrg[The pkg-config script could not be found or is too old.  Make sure it
2018abc0ccfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2028abc0ccfSmrgpath to pkg-config.
2037a0395d0Smrg
2048abc0ccfSmrg_PKG_TEXT
2057a0395d0Smrg
2068abc0ccfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2078abc0ccfSmrg        ])
2088abc0ccfSmrgelse
2098abc0ccfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2108abc0ccfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2118abc0ccfSmrg        AC_MSG_RESULT([yes])
2128abc0ccfSmrg	$3
2138abc0ccfSmrgfi[]dnl
2146c3c2bceSmrg])dnl PKG_CHECK_MODULES
2157a0395d0Smrg
2167a0395d0Smrg
2176c3c2bceSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2186c3c2bceSmrgdnl   [ACTION-IF-NOT-FOUND])
2196c3c2bceSmrgdnl ---------------------------------------------------------------------
2206c3c2bceSmrgdnl Since: 0.29
2216c3c2bceSmrgdnl
2226c3c2bceSmrgdnl Checks for existence of MODULES and gathers its build flags with
2236c3c2bceSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2246c3c2bceSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2256c3c2bceSmrgdnl
2266c3c2bceSmrgdnl Note that if there is a possibility the first call to
2276c3c2bceSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2286c3c2bceSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2296c3c2bceSmrgdnl configure.ac.
2306c3c2bceSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2316c3c2bceSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2326c3c2bceSmrg_save_PKG_CONFIG=$PKG_CONFIG
2336c3c2bceSmrgPKG_CONFIG="$PKG_CONFIG --static"
2346c3c2bceSmrgPKG_CHECK_MODULES($@)
2356c3c2bceSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2366c3c2bceSmrg])dnl PKG_CHECK_MODULES_STATIC
2376c3c2bceSmrg
2386c3c2bceSmrg
2396c3c2bceSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2406c3c2bceSmrgdnl -------------------------
2416c3c2bceSmrgdnl Since: 0.27
2426c3c2bceSmrgdnl
2436c3c2bceSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2446c3c2bceSmrgdnl should install pkg-config .pc files. By default the directory is
2456c3c2bceSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2466c3c2bceSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2476c3c2bceSmrgdnl parameter.
2488abc0ccfSmrgAC_DEFUN([PKG_INSTALLDIR],
2498abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2508abc0ccfSmrgm4_pushdef([pkg_description],
2518abc0ccfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2528abc0ccfSmrgAC_ARG_WITH([pkgconfigdir],
2538abc0ccfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2548abc0ccfSmrg    [with_pkgconfigdir=]pkg_default)
2558abc0ccfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2568abc0ccfSmrgm4_popdef([pkg_default])
2578abc0ccfSmrgm4_popdef([pkg_description])
2586c3c2bceSmrg])dnl PKG_INSTALLDIR
2598abc0ccfSmrg
2608abc0ccfSmrg
2616c3c2bceSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2626c3c2bceSmrgdnl --------------------------------
2636c3c2bceSmrgdnl Since: 0.27
2646c3c2bceSmrgdnl
2656c3c2bceSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2666c3c2bceSmrgdnl module should install arch-independent pkg-config .pc files. By
2676c3c2bceSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2686c3c2bceSmrgdnl changed by passing DIRECTORY. The user can override through the
2696c3c2bceSmrgdnl --with-noarch-pkgconfigdir parameter.
2708abc0ccfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2718abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2728abc0ccfSmrgm4_pushdef([pkg_description],
2738abc0ccfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2748abc0ccfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2758abc0ccfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2768abc0ccfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2778abc0ccfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2788abc0ccfSmrgm4_popdef([pkg_default])
2798abc0ccfSmrgm4_popdef([pkg_description])
2806c3c2bceSmrg])dnl PKG_NOARCH_INSTALLDIR
2817a0395d0Smrg
2829a011757Smrg
2836c3c2bceSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2846c3c2bceSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2856c3c2bceSmrgdnl -------------------------------------------
2866c3c2bceSmrgdnl Since: 0.28
2876c3c2bceSmrgdnl
2886c3c2bceSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2899a011757SmrgAC_DEFUN([PKG_CHECK_VAR],
2909a011757Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2919a011757SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2929a011757Smrg
2939a011757Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2949a011757SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2959a011757Smrg
2969a011757SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2976c3c2bceSmrg])dnl PKG_CHECK_VAR
2986c3c2bceSmrg
2998abc0ccfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3008abc0ccfSmrgdnl
30140c5344fSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
30240c5344fSmrgdnl
3038abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3048abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
3058abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
3068abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3078abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3088abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
3098abc0ccfSmrgdnl
3108abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
3118abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3128abc0ccfSmrgdnl Software.
3138abc0ccfSmrgdnl
3148abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3158abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3168abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3178abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3188abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3198abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3208abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
3217a0395d0Smrg
3228abc0ccfSmrg# XORG_MACROS_VERSION(required-version)
3238abc0ccfSmrg# -------------------------------------
3248abc0ccfSmrg# Minimum version: 1.1.0
3258abc0ccfSmrg#
3268abc0ccfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
3278abc0ccfSmrg# your configure.ac with the minimum required version, such as:
3288abc0ccfSmrg# XORG_MACROS_VERSION(1.1)
3298abc0ccfSmrg#
3308abc0ccfSmrg# To ensure that this macro is defined, also add:
3318abc0ccfSmrg# m4_ifndef([XORG_MACROS_VERSION],
3328abc0ccfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3338abc0ccfSmrg#
3348abc0ccfSmrg#
33540c5344fSmrg# See the "minimum version" comment for each macro you use to see what
3368abc0ccfSmrg# version you require.
3378abc0ccfSmrgm4_defun([XORG_MACROS_VERSION],[
3380d22642bSmrgm4_define([vers_have], [1.19.3])
3398abc0ccfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3408abc0ccfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3418abc0ccfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3428abc0ccfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3438abc0ccfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3448abc0ccfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3458abc0ccfSmrgm4_undefine([vers_have])
3468abc0ccfSmrgm4_undefine([maj_have])
3478abc0ccfSmrgm4_undefine([maj_needed])
3488abc0ccfSmrg]) # XORG_MACROS_VERSION
3497a0395d0Smrg
3508abc0ccfSmrg# XORG_PROG_RAWCPP()
3518abc0ccfSmrg# ------------------
3528abc0ccfSmrg# Minimum version: 1.0.0
3538abc0ccfSmrg#
3548abc0ccfSmrg# Find cpp program and necessary flags for use in pre-processing text files
3558abc0ccfSmrg# such as man pages and config files
3568abc0ccfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3578abc0ccfSmrgAC_REQUIRE([AC_PROG_CPP])
3580d22642bSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
3598abc0ccfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3607a0395d0Smrg
3618abc0ccfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3628abc0ccfSmrg# which is not the best choice for supporting other OS'es, but covers most
3638abc0ccfSmrg# of the ones we need for now.
3648abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3658abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3668abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3678abc0ccfSmrg	AC_MSG_RESULT([no])
3687366012aSmrgelse
3698abc0ccfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3708abc0ccfSmrg		RAWCPPFLAGS=-undef
3718abc0ccfSmrg		AC_MSG_RESULT([yes])
3728abc0ccfSmrg	# under Cygwin unix is still defined even with -undef
3738abc0ccfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3748abc0ccfSmrg		RAWCPPFLAGS="-undef -ansi"
3758abc0ccfSmrg		AC_MSG_RESULT([yes, with -ansi])
3768abc0ccfSmrg	else
3778abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3788abc0ccfSmrg	fi
3797a0395d0Smrgfi
3808abc0ccfSmrgrm -f conftest.$ac_ext
3817a0395d0Smrg
3828abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3838abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3848abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3858abc0ccfSmrg	AC_MSG_RESULT([no])
3868abc0ccfSmrgelse
3878abc0ccfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
38840c5344fSmrg		TRADITIONALCPPFLAGS="-traditional"
3898abc0ccfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3908abc0ccfSmrg		AC_MSG_RESULT([yes])
3918abc0ccfSmrg	else
3928abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3938abc0ccfSmrg	fi
3948abc0ccfSmrgfi
3958abc0ccfSmrgrm -f conftest.$ac_ext
3968abc0ccfSmrgAC_SUBST(RAWCPPFLAGS)
39740c5344fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
3988abc0ccfSmrg]) # XORG_PROG_RAWCPP
3997a0395d0Smrg
4008abc0ccfSmrg# XORG_MANPAGE_SECTIONS()
4018abc0ccfSmrg# -----------------------
4028abc0ccfSmrg# Minimum version: 1.0.0
4038abc0ccfSmrg#
4048abc0ccfSmrg# Determine which sections man pages go in for the different man page types
4058abc0ccfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4068abc0ccfSmrg# Not sure if there's any better way than just hardcoding by OS name.
4078abc0ccfSmrg# Override default settings by setting environment variables
4088abc0ccfSmrg# Added MAN_SUBSTS in version 1.8
4098abc0ccfSmrg# Added AC_PROG_SED in version 1.8
4107a0395d0Smrg
4118abc0ccfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4128abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
4138abc0ccfSmrgAC_REQUIRE([AC_PROG_SED])
4147a0395d0Smrg
4156c3c2bceSmrgcase $host_os in
4166c3c2bceSmrg    solaris*)
4176c3c2bceSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4186c3c2bceSmrg        # check for a man page file found in later versions that use
4196c3c2bceSmrg        # traditional section numbers instead
4206c3c2bceSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4216c3c2bceSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4226c3c2bceSmrg        ;;
4236c3c2bceSmrg    *) SYSV_MAN_SECTIONS=false ;;
4246c3c2bceSmrgesac
4256c3c2bceSmrg
4268abc0ccfSmrgif test x$APP_MAN_SUFFIX = x    ; then
4278abc0ccfSmrg    APP_MAN_SUFFIX=1
4288abc0ccfSmrgfi
4298abc0ccfSmrgif test x$APP_MAN_DIR = x    ; then
4308abc0ccfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4317a0395d0Smrgfi
4327a0395d0Smrg
4338abc0ccfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
4348abc0ccfSmrg    LIB_MAN_SUFFIX=3
4358abc0ccfSmrgfi
4368abc0ccfSmrgif test x$LIB_MAN_DIR = x    ; then
4378abc0ccfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4388abc0ccfSmrgfi
4397a0395d0Smrg
4408abc0ccfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
4416c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
4426c3c2bceSmrg	true)				FILE_MAN_SUFFIX=4  ;;
44340c5344fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
4448abc0ccfSmrg    esac
4458abc0ccfSmrgfi
4468abc0ccfSmrgif test x$FILE_MAN_DIR = x    ; then
4478abc0ccfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4488abc0ccfSmrgfi
4497a0395d0Smrg
4508abc0ccfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
4516c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
4526c3c2bceSmrg	true)				MISC_MAN_SUFFIX=5  ;;
45340c5344fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
4548abc0ccfSmrg    esac
4558abc0ccfSmrgfi
4568abc0ccfSmrgif test x$MISC_MAN_DIR = x    ; then
4578abc0ccfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4588abc0ccfSmrgfi
4597a0395d0Smrg
4608abc0ccfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4616c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
4626c3c2bceSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
46340c5344fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4648abc0ccfSmrg    esac
4658abc0ccfSmrgfi
4668abc0ccfSmrgif test x$DRIVER_MAN_DIR = x    ; then
4678abc0ccfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4688abc0ccfSmrgfi
4698abc0ccfSmrg
4708abc0ccfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4716c3c2bceSmrg    case $SYSV_MAN_SECTIONS in
4726c3c2bceSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
47340c5344fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4748abc0ccfSmrg    esac
4758abc0ccfSmrgfi
4768abc0ccfSmrgif test x$ADMIN_MAN_DIR = x    ; then
4778abc0ccfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4788abc0ccfSmrgfi
4797366012aSmrg
4807366012aSmrg
4818abc0ccfSmrgAC_SUBST([APP_MAN_SUFFIX])
4828abc0ccfSmrgAC_SUBST([LIB_MAN_SUFFIX])
4838abc0ccfSmrgAC_SUBST([FILE_MAN_SUFFIX])
4848abc0ccfSmrgAC_SUBST([MISC_MAN_SUFFIX])
4858abc0ccfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4868abc0ccfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4878abc0ccfSmrgAC_SUBST([APP_MAN_DIR])
4888abc0ccfSmrgAC_SUBST([LIB_MAN_DIR])
4898abc0ccfSmrgAC_SUBST([FILE_MAN_DIR])
4908abc0ccfSmrgAC_SUBST([MISC_MAN_DIR])
4918abc0ccfSmrgAC_SUBST([DRIVER_MAN_DIR])
4928abc0ccfSmrgAC_SUBST([ADMIN_MAN_DIR])
4938abc0ccfSmrg
4948abc0ccfSmrgXORG_MAN_PAGE="X Version 11"
4958abc0ccfSmrgAC_SUBST([XORG_MAN_PAGE])
4968abc0ccfSmrgMAN_SUBSTS="\
4978abc0ccfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4988abc0ccfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4998abc0ccfSmrg	-e 's|__xservername__|Xorg|g' \
5008abc0ccfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
5018abc0ccfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
5028abc0ccfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5038abc0ccfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5048abc0ccfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5058abc0ccfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5068abc0ccfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5078abc0ccfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5088abc0ccfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5098abc0ccfSmrgAC_SUBST([MAN_SUBSTS])
5108abc0ccfSmrg
5118abc0ccfSmrg]) # XORG_MANPAGE_SECTIONS
5128abc0ccfSmrg
5138abc0ccfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5148abc0ccfSmrg# ------------------------
5158abc0ccfSmrg# Minimum version: 1.7.0
5167a0395d0Smrg#
5178abc0ccfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5188abc0ccfSmrg# provided by xorg-sgml-doctools, if installed.
5198abc0ccfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5208abc0ccfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5218abc0ccfSmrgXORG_SGML_PATH=
5228abc0ccfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5238abc0ccfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5248abc0ccfSmrg    [m4_ifval([$1],[:],
5258abc0ccfSmrg        [if test x"$cross_compiling" != x"yes" ; then
5268abc0ccfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5278abc0ccfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5288abc0ccfSmrg         fi])
5298abc0ccfSmrg    ])
5307a0395d0Smrg
5318abc0ccfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5328abc0ccfSmrg# the path and the name of the doc stylesheet
5338abc0ccfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
5348abc0ccfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5358abc0ccfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5368abc0ccfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5378abc0ccfSmrgelse
5388abc0ccfSmrg   AC_MSG_RESULT([no])
5398abc0ccfSmrgfi
5408abc0ccfSmrg
5418abc0ccfSmrgAC_SUBST(XORG_SGML_PATH)
5428abc0ccfSmrgAC_SUBST(STYLESHEET_SRCDIR)
5438abc0ccfSmrgAC_SUBST(XSL_STYLESHEET)
5448abc0ccfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5458abc0ccfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
5467a0395d0Smrg
5478abc0ccfSmrg# XORG_CHECK_LINUXDOC
5488abc0ccfSmrg# -------------------
5498abc0ccfSmrg# Minimum version: 1.0.0
5507366012aSmrg#
5518abc0ccfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
5528abc0ccfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5538abc0ccfSmrg# Whether or not the necessary tools and files are found can be checked
5548abc0ccfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5558abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5568abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5578abc0ccfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5587a0395d0Smrg
5598abc0ccfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5607a0395d0Smrg
5618abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
5627a0395d0Smrg
5638abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5648abc0ccfSmrg   BUILDDOC=yes
5658abc0ccfSmrgelse
5668abc0ccfSmrg   BUILDDOC=no
5677a0395d0Smrgfi
5687a0395d0Smrg
5698abc0ccfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5707a0395d0Smrg
5718abc0ccfSmrgAC_MSG_RESULT([$BUILDDOC])
5727a0395d0Smrg
5738abc0ccfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
5747a0395d0Smrg
5758abc0ccfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5768abc0ccfSmrg   BUILDPDFDOC=yes
5778abc0ccfSmrgelse
5788abc0ccfSmrg   BUILDPDFDOC=no
5798abc0ccfSmrgfi
5807a0395d0Smrg
5818abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5827a0395d0Smrg
5838abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5847a0395d0Smrg
5858abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5868abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5878abc0ccfSmrgMAKE_PDF="$PS2PDF"
5888abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5897a0395d0Smrg
5908abc0ccfSmrgAC_SUBST(MAKE_TEXT)
5918abc0ccfSmrgAC_SUBST(MAKE_PS)
5928abc0ccfSmrgAC_SUBST(MAKE_PDF)
5938abc0ccfSmrgAC_SUBST(MAKE_HTML)
5948abc0ccfSmrg]) # XORG_CHECK_LINUXDOC
5957a0395d0Smrg
5968abc0ccfSmrg# XORG_CHECK_DOCBOOK
5978abc0ccfSmrg# -------------------
5988abc0ccfSmrg# Minimum version: 1.0.0
5997366012aSmrg#
6008abc0ccfSmrg# Checks for the ability to build output formats from SGML DocBook source.
6018abc0ccfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6028abc0ccfSmrg# indicates whether the necessary tools and files are found and, if set,
6038abc0ccfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6048abc0ccfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6058abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6067a0395d0Smrg
6078abc0ccfSmrgBUILDTXTDOC=no
6088abc0ccfSmrgBUILDPDFDOC=no
6098abc0ccfSmrgBUILDPSDOC=no
6108abc0ccfSmrgBUILDHTMLDOC=no
6117a0395d0Smrg
6128abc0ccfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6138abc0ccfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6148abc0ccfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6158abc0ccfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6167a0395d0Smrg
6178abc0ccfSmrgAC_MSG_CHECKING([whether to build text documentation])
6188abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6198abc0ccfSmrg   test x$BUILD_TXTDOC != xno; then
6208abc0ccfSmrg	BUILDTXTDOC=yes
6217366012aSmrgfi
6228abc0ccfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6238abc0ccfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
6247366012aSmrg
6258abc0ccfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
6268abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6278abc0ccfSmrg   test x$BUILD_PDFDOC != xno; then
6288abc0ccfSmrg	BUILDPDFDOC=yes
6298abc0ccfSmrgfi
6308abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6318abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
6327a0395d0Smrg
6338abc0ccfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6348abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6358abc0ccfSmrg   test x$BUILD_PSDOC != xno; then
6368abc0ccfSmrg	BUILDPSDOC=yes
6378abc0ccfSmrgfi
6388abc0ccfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6398abc0ccfSmrgAC_MSG_RESULT([$BUILDPSDOC])
6407a0395d0Smrg
6418abc0ccfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
6428abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6438abc0ccfSmrg   test x$BUILD_HTMLDOC != xno; then
6448abc0ccfSmrg	BUILDHTMLDOC=yes
6458abc0ccfSmrgfi
6468abc0ccfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6478abc0ccfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6487a0395d0Smrg
6498abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6508abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6518abc0ccfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6528abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6537a0395d0Smrg
6548abc0ccfSmrgAC_SUBST(MAKE_TEXT)
6558abc0ccfSmrgAC_SUBST(MAKE_PS)
6568abc0ccfSmrgAC_SUBST(MAKE_PDF)
6578abc0ccfSmrgAC_SUBST(MAKE_HTML)
6588abc0ccfSmrg]) # XORG_CHECK_DOCBOOK
6597366012aSmrg
6608abc0ccfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6618abc0ccfSmrg# ----------------
6628abc0ccfSmrg# Minimum version: 1.5.0
6638abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
6647a0395d0Smrg#
6658abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
6668abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
6678abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
6688abc0ccfSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6698abc0ccfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6708abc0ccfSmrg# --with-xmlto assumes 'auto'.
6717a0395d0Smrg#
6728abc0ccfSmrg# Interface to module:
6738abc0ccfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6748abc0ccfSmrg# XMLTO:	returns the path of the xmlto program found
6758abc0ccfSmrg#		returns the path set by the user in the environment
6768abc0ccfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6778abc0ccfSmrg#		'no' user instructs the module not to use xmlto
6788abc0ccfSmrg#
6798abc0ccfSmrg# Added in version 1.10.0
6808abc0ccfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6818abc0ccfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6828abc0ccfSmrg#
6838abc0ccfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6848abc0ccfSmrg#
6858abc0ccfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
6868abc0ccfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6878abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
6888abc0ccfSmrgAC_ARG_WITH(xmlto,
6898abc0ccfSmrg	AS_HELP_STRING([--with-xmlto],
6908abc0ccfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6918abc0ccfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6928abc0ccfSmrgm4_undefine([_defopt])
6937366012aSmrg
6948abc0ccfSmrgif test "x$use_xmlto" = x"auto"; then
6958abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6968abc0ccfSmrg   if test "x$XMLTO" = "x"; then
6978abc0ccfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6988abc0ccfSmrg	have_xmlto=no
6998abc0ccfSmrg   else
7008abc0ccfSmrg        have_xmlto=yes
7018abc0ccfSmrg   fi
7028abc0ccfSmrgelif test "x$use_xmlto" = x"yes" ; then
7038abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7048abc0ccfSmrg   if test "x$XMLTO" = "x"; then
7058abc0ccfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7068abc0ccfSmrg   fi
7078abc0ccfSmrg   have_xmlto=yes
7088abc0ccfSmrgelif test "x$use_xmlto" = x"no" ; then
7098abc0ccfSmrg   if test "x$XMLTO" != "x"; then
7108abc0ccfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7118abc0ccfSmrg   fi
7128abc0ccfSmrg   have_xmlto=no
7137366012aSmrgelse
7148abc0ccfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7157a0395d0Smrgfi
7167a0395d0Smrg
7178abc0ccfSmrg# Test for a minimum version of xmlto, if provided.
7188abc0ccfSmrgm4_ifval([$1],
7198abc0ccfSmrg[if test "$have_xmlto" = yes; then
7208abc0ccfSmrg    # scrape the xmlto version
7218abc0ccfSmrg    AC_MSG_CHECKING([the xmlto version])
7228abc0ccfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7238abc0ccfSmrg    AC_MSG_RESULT([$xmlto_version])
7248abc0ccfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7258abc0ccfSmrg        [if test "x$use_xmlto" = xauto; then
7268abc0ccfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7278abc0ccfSmrg            have_xmlto=no
7288abc0ccfSmrg        else
7298abc0ccfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7308abc0ccfSmrg        fi])
7318abc0ccfSmrgfi])
7327a0395d0Smrg
7338abc0ccfSmrg# Test for the ability of xmlto to generate a text target
73440c5344fSmrg#
73540c5344fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
73640c5344fSmrg# following test for empty XML docbook files.
73740c5344fSmrg# For compatibility reasons use the following empty XML docbook file and if
73840c5344fSmrg# it fails try it again with a non-empty XML file.
7398abc0ccfSmrghave_xmlto_text=no
7408abc0ccfSmrgcat > conftest.xml << "EOF"
7418abc0ccfSmrgEOF
7428abc0ccfSmrgAS_IF([test "$have_xmlto" = yes],
7438abc0ccfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7448abc0ccfSmrg             [have_xmlto_text=yes],
74540c5344fSmrg             [# Try it again with a non-empty XML file.
74640c5344fSmrg              cat > conftest.xml << "EOF"
74740c5344fSmrg<x></x>
74840c5344fSmrgEOF
74940c5344fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
75040c5344fSmrg                    [have_xmlto_text=yes],
75140c5344fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7528abc0ccfSmrgrm -f conftest.xml
7538abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7548abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7558abc0ccfSmrg]) # XORG_WITH_XMLTO
7567a0395d0Smrg
7578abc0ccfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7588abc0ccfSmrg# --------------------------------------------
7598abc0ccfSmrg# Minimum version: 1.12.0
7608abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
7617366012aSmrg#
7628abc0ccfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7638abc0ccfSmrg# XML-based language used for the transformation of XML documents.
7648abc0ccfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7658abc0ccfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7668abc0ccfSmrg# The XSLT processor is often used as a standalone tool for transformations.
7678abc0ccfSmrg# It should not be assumed that this tool is used only to work with documnetation.
7688abc0ccfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7698abc0ccfSmrg#
7708abc0ccfSmrg# Interface to module:
7718abc0ccfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7728abc0ccfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
7738abc0ccfSmrg#		 returns the path set by the user in the environment
7748abc0ccfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7758abc0ccfSmrg#		  'no' user instructs the module not to use xsltproc
7768abc0ccfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7778abc0ccfSmrg#
7788abc0ccfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7798abc0ccfSmrg#
7808abc0ccfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7818abc0ccfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7828abc0ccfSmrg# Preserves the interface, should it be implemented later
7838abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7848abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
7858abc0ccfSmrgAC_ARG_WITH(xsltproc,
7868abc0ccfSmrg	AS_HELP_STRING([--with-xsltproc],
7878abc0ccfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7888abc0ccfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7898abc0ccfSmrgm4_undefine([_defopt])
7907366012aSmrg
7918abc0ccfSmrgif test "x$use_xsltproc" = x"auto"; then
7928abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7938abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
7948abc0ccfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7958abc0ccfSmrg	have_xsltproc=no
7968abc0ccfSmrg   else
7978abc0ccfSmrg        have_xsltproc=yes
7987366012aSmrg   fi
7998abc0ccfSmrgelif test "x$use_xsltproc" = x"yes" ; then
8008abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8018abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
8028abc0ccfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8037366012aSmrg   fi
8048abc0ccfSmrg   have_xsltproc=yes
8058abc0ccfSmrgelif test "x$use_xsltproc" = x"no" ; then
8068abc0ccfSmrg   if test "x$XSLTPROC" != "x"; then
8078abc0ccfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8088abc0ccfSmrg   fi
8098abc0ccfSmrg   have_xsltproc=no
8107366012aSmrgelse
8118abc0ccfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8127366012aSmrgfi
8137a0395d0Smrg
8148abc0ccfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8158abc0ccfSmrg]) # XORG_WITH_XSLTPROC
8167a0395d0Smrg
8178abc0ccfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8188abc0ccfSmrg# ----------------------------------------
8198abc0ccfSmrg# Minimum version: 1.15.0
8207a0395d0Smrg#
8218abc0ccfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
8228abc0ccfSmrg# scanning arbitrary text files, extracting information from those text files,
8238abc0ccfSmrg# and printing reports based on that information.
8247366012aSmrg#
8258abc0ccfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8268abc0ccfSmrg#
8278abc0ccfSmrg# Interface to module:
8288abc0ccfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
8298abc0ccfSmrg# PERL:	     returns the path of the perl program found
8308abc0ccfSmrg#	     returns the path set by the user in the environment
8318abc0ccfSmrg# --with-perl: 'yes' user instructs the module to use perl
8328abc0ccfSmrg#	       'no' user instructs the module not to use perl
8338abc0ccfSmrg# have_perl: returns yes if perl found in PATH or no
8348abc0ccfSmrg#
8358abc0ccfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8368abc0ccfSmrg#
8378abc0ccfSmrgAC_DEFUN([XORG_WITH_PERL],[
8388abc0ccfSmrgAC_ARG_VAR([PERL], [Path to perl command])
8398abc0ccfSmrg# Preserves the interface, should it be implemented later
8408abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8418abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
8428abc0ccfSmrgAC_ARG_WITH(perl,
8438abc0ccfSmrg	AS_HELP_STRING([--with-perl],
8448abc0ccfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8458abc0ccfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
8468abc0ccfSmrgm4_undefine([_defopt])
8477a0395d0Smrg
8488abc0ccfSmrgif test "x$use_perl" = x"auto"; then
8498abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
8508abc0ccfSmrg   if test "x$PERL" = "x"; then
8518abc0ccfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8528abc0ccfSmrg	have_perl=no
8538abc0ccfSmrg   else
8548abc0ccfSmrg        have_perl=yes
8558abc0ccfSmrg   fi
8568abc0ccfSmrgelif test "x$use_perl" = x"yes" ; then
8578abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
8588abc0ccfSmrg   if test "x$PERL" = "x"; then
8598abc0ccfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8608abc0ccfSmrg   fi
8618abc0ccfSmrg   have_perl=yes
8628abc0ccfSmrgelif test "x$use_perl" = x"no" ; then
8638abc0ccfSmrg   if test "x$PERL" != "x"; then
8648abc0ccfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8658abc0ccfSmrg   fi
8668abc0ccfSmrg   have_perl=no
8678abc0ccfSmrgelse
8688abc0ccfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8698abc0ccfSmrgfi
8707366012aSmrg
8718abc0ccfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8728abc0ccfSmrg]) # XORG_WITH_PERL
8737366012aSmrg
8748abc0ccfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8758abc0ccfSmrg# ----------------
8768abc0ccfSmrg# Minimum version: 1.5.0
8778abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
8787a0395d0Smrg#
8798abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
8808abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
8818abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
8828abc0ccfSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8838abc0ccfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8848abc0ccfSmrg# --with-asciidoc assumes 'auto'.
8857a0395d0Smrg#
8868abc0ccfSmrg# Interface to module:
8878abc0ccfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8888abc0ccfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
8898abc0ccfSmrg#		 returns the path set by the user in the environment
8908abc0ccfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8918abc0ccfSmrg#		  'no' user instructs the module not to use asciidoc
8927a0395d0Smrg#
8938abc0ccfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8948abc0ccfSmrg#
8958abc0ccfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8968abc0ccfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8978abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
8988abc0ccfSmrgAC_ARG_WITH(asciidoc,
8998abc0ccfSmrg	AS_HELP_STRING([--with-asciidoc],
9008abc0ccfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9018abc0ccfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9028abc0ccfSmrgm4_undefine([_defopt])
9037366012aSmrg
9048abc0ccfSmrgif test "x$use_asciidoc" = x"auto"; then
9058abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9068abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
9078abc0ccfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9088abc0ccfSmrg	have_asciidoc=no
9098abc0ccfSmrg   else
9108abc0ccfSmrg        have_asciidoc=yes
9118abc0ccfSmrg   fi
9128abc0ccfSmrgelif test "x$use_asciidoc" = x"yes" ; then
9138abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9148abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
9158abc0ccfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9168abc0ccfSmrg   fi
9178abc0ccfSmrg   have_asciidoc=yes
9188abc0ccfSmrgelif test "x$use_asciidoc" = x"no" ; then
9198abc0ccfSmrg   if test "x$ASCIIDOC" != "x"; then
9208abc0ccfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9218abc0ccfSmrg   fi
9228abc0ccfSmrg   have_asciidoc=no
9238abc0ccfSmrgelse
9248abc0ccfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9258abc0ccfSmrgfi
9268abc0ccfSmrgm4_ifval([$1],
9278abc0ccfSmrg[if test "$have_asciidoc" = yes; then
9288abc0ccfSmrg    # scrape the asciidoc version
9298abc0ccfSmrg    AC_MSG_CHECKING([the asciidoc version])
9308abc0ccfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9318abc0ccfSmrg    AC_MSG_RESULT([$asciidoc_version])
9328abc0ccfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9338abc0ccfSmrg        [if test "x$use_asciidoc" = xauto; then
9348abc0ccfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9358abc0ccfSmrg            have_asciidoc=no
9368abc0ccfSmrg        else
9378abc0ccfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9388abc0ccfSmrg        fi])
9398abc0ccfSmrgfi])
9408abc0ccfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9418abc0ccfSmrg]) # XORG_WITH_ASCIIDOC
9427366012aSmrg
9438abc0ccfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
94440c5344fSmrg# -------------------------------------------
9458abc0ccfSmrg# Minimum version: 1.5.0
9468abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
94740c5344fSmrg# Minimum version for optional DOT checking: 1.18.0
9482852888eSmrg#
9498abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
9508abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
9518abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9528abc0ccfSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9538abc0ccfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9548abc0ccfSmrg# --with-doxygen assumes 'auto'.
9552852888eSmrg#
9568abc0ccfSmrg# Interface to module:
9578abc0ccfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9588abc0ccfSmrg# DOXYGEN:	 returns the path of the doxygen program found
9598abc0ccfSmrg#		 returns the path set by the user in the environment
9608abc0ccfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9618abc0ccfSmrg#		  'no' user instructs the module not to use doxygen
9622852888eSmrg#
9638abc0ccfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9642852888eSmrg#
9658abc0ccfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9668abc0ccfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
96740c5344fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9688abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
9698abc0ccfSmrgAC_ARG_WITH(doxygen,
9708abc0ccfSmrg	AS_HELP_STRING([--with-doxygen],
9718abc0ccfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9728abc0ccfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9738abc0ccfSmrgm4_undefine([_defopt])
9742852888eSmrg
9758abc0ccfSmrgif test "x$use_doxygen" = x"auto"; then
9768abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9778abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
9788abc0ccfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9798abc0ccfSmrg	have_doxygen=no
9808abc0ccfSmrg   else
9818abc0ccfSmrg        have_doxygen=yes
9828abc0ccfSmrg   fi
9838abc0ccfSmrgelif test "x$use_doxygen" = x"yes" ; then
9848abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9858abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
9868abc0ccfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9878abc0ccfSmrg   fi
9888abc0ccfSmrg   have_doxygen=yes
9898abc0ccfSmrgelif test "x$use_doxygen" = x"no" ; then
9908abc0ccfSmrg   if test "x$DOXYGEN" != "x"; then
9918abc0ccfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9928abc0ccfSmrg   fi
9938abc0ccfSmrg   have_doxygen=no
9948abc0ccfSmrgelse
9958abc0ccfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9962852888eSmrgfi
9978abc0ccfSmrgm4_ifval([$1],
9988abc0ccfSmrg[if test "$have_doxygen" = yes; then
9998abc0ccfSmrg    # scrape the doxygen version
10008abc0ccfSmrg    AC_MSG_CHECKING([the doxygen version])
10018abc0ccfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10028abc0ccfSmrg    AC_MSG_RESULT([$doxygen_version])
10038abc0ccfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10048abc0ccfSmrg        [if test "x$use_doxygen" = xauto; then
10058abc0ccfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10068abc0ccfSmrg            have_doxygen=no
10078abc0ccfSmrg        else
10088abc0ccfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10098abc0ccfSmrg        fi])
10108abc0ccfSmrgfi])
101140c5344fSmrg
101240c5344fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
101340c5344fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
101440c5344fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
101540c5344fSmrgHAVE_DOT=no
101640c5344fSmrgif test "x$have_doxygen" = "xyes"; then
101740c5344fSmrg  AC_PATH_PROG([DOT], [dot])
101840c5344fSmrg    if test "x$DOT" != "x"; then
101940c5344fSmrg      HAVE_DOT=yes
102040c5344fSmrg    fi
102140c5344fSmrgfi
102240c5344fSmrg
102340c5344fSmrgAC_SUBST([HAVE_DOT])
102440c5344fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10258abc0ccfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10268abc0ccfSmrg]) # XORG_WITH_DOXYGEN
10272852888eSmrg
10288abc0ccfSmrg# XORG_WITH_GROFF([DEFAULT])
10298abc0ccfSmrg# ----------------
10308abc0ccfSmrg# Minimum version: 1.6.0
10318abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10322852888eSmrg#
10338abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
10348abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
10358abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10368abc0ccfSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
10378abc0ccfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
10388abc0ccfSmrg# --with-groff assumes 'auto'.
10392852888eSmrg#
10408abc0ccfSmrg# Interface to module:
10418abc0ccfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10428abc0ccfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10438abc0ccfSmrg# HAVE_GROFF_MS: the -ms macros package
10448abc0ccfSmrg# GROFF:	 returns the path of the groff program found
10458abc0ccfSmrg#		 returns the path set by the user in the environment
10468abc0ccfSmrg# --with-groff:	 'yes' user instructs the module to use groff
10478abc0ccfSmrg#		 'no' user instructs the module not to use groff
104896402570Smrg#
10498abc0ccfSmrg# Added in version 1.9.0:
10508abc0ccfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10518abc0ccfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10528abc0ccfSmrg#		   psselect from the psutils package.
10538abc0ccfSmrg#		   the ghostcript package. Refer to the grohtml man pages
10542852888eSmrg#
10558abc0ccfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10562852888eSmrg#
10578abc0ccfSmrg# OS and distros often splits groff in a basic and full package, the former
10588abc0ccfSmrg# having the groff program and the later having devices, fonts and macros
10598abc0ccfSmrg# Checking for the groff executable is not enough.
10602852888eSmrg#
10618abc0ccfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
10628abc0ccfSmrg# unset HAVE_GROFF or GROFF env variables.
10638abc0ccfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10642852888eSmrg#
10658abc0ccfSmrgAC_DEFUN([XORG_WITH_GROFF],[
10668abc0ccfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
10678abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
10688abc0ccfSmrgAC_ARG_WITH(groff,
10698abc0ccfSmrg	AS_HELP_STRING([--with-groff],
10708abc0ccfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10718abc0ccfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
10728abc0ccfSmrgm4_undefine([_defopt])
10732852888eSmrg
10748abc0ccfSmrgif test "x$use_groff" = x"auto"; then
10758abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
10768abc0ccfSmrg   if test "x$GROFF" = "x"; then
10778abc0ccfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10788abc0ccfSmrg	have_groff=no
10798abc0ccfSmrg   else
10808abc0ccfSmrg        have_groff=yes
10818abc0ccfSmrg   fi
10828abc0ccfSmrgelif test "x$use_groff" = x"yes" ; then
10838abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
10848abc0ccfSmrg   if test "x$GROFF" = "x"; then
10858abc0ccfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10868abc0ccfSmrg   fi
10878abc0ccfSmrg   have_groff=yes
10888abc0ccfSmrgelif test "x$use_groff" = x"no" ; then
10898abc0ccfSmrg   if test "x$GROFF" != "x"; then
10908abc0ccfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10918abc0ccfSmrg   fi
10928abc0ccfSmrg   have_groff=no
10938abc0ccfSmrgelse
10948abc0ccfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10958abc0ccfSmrgfi
10962852888eSmrg
10978abc0ccfSmrg# We have groff, test for the presence of the macro packages
10988abc0ccfSmrgif test "x$have_groff" = x"yes"; then
10998abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11008abc0ccfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11018abc0ccfSmrg        groff_ms_works=yes
11028abc0ccfSmrg    else
11038abc0ccfSmrg        groff_ms_works=no
11048abc0ccfSmrg    fi
11058abc0ccfSmrg    AC_MSG_RESULT([$groff_ms_works])
11068abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11078abc0ccfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11088abc0ccfSmrg        groff_mm_works=yes
11098abc0ccfSmrg    else
11108abc0ccfSmrg        groff_mm_works=no
11118abc0ccfSmrg    fi
11128abc0ccfSmrg    AC_MSG_RESULT([$groff_mm_works])
11138abc0ccfSmrgfi
11142852888eSmrg
11158abc0ccfSmrg# We have groff, test for HTML dependencies, one command per package
11168abc0ccfSmrgif test "x$have_groff" = x"yes"; then
11178abc0ccfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11188abc0ccfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11198abc0ccfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11208abc0ccfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11218abc0ccfSmrg      have_groff_html=yes
11228abc0ccfSmrg   else
11238abc0ccfSmrg      have_groff_html=no
11248abc0ccfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11258abc0ccfSmrg   fi
11268abc0ccfSmrgfi
11272852888eSmrg
11288abc0ccfSmrg# Set Automake conditionals for Makefiles
11298abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11308abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11318abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11328abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11338abc0ccfSmrg]) # XORG_WITH_GROFF
11347366012aSmrg
11358abc0ccfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11368abc0ccfSmrg# ---------------------------------------
11378abc0ccfSmrg# Minimum version: 1.6.0
11388abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11398abc0ccfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11407a0395d0Smrg#
11418abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
11428abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
11438abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11448abc0ccfSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
11458abc0ccfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
11468abc0ccfSmrg# --with-fop assumes 'auto'.
11477a0395d0Smrg#
11488abc0ccfSmrg# Interface to module:
11498abc0ccfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11508abc0ccfSmrg# FOP:	 	returns the path of the fop program found
11518abc0ccfSmrg#		returns the path set by the user in the environment
11528abc0ccfSmrg# --with-fop: 	'yes' user instructs the module to use fop
11538abc0ccfSmrg#		'no' user instructs the module not to use fop
11547a0395d0Smrg#
11558abc0ccfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
11567a0395d0Smrg#
11578abc0ccfSmrgAC_DEFUN([XORG_WITH_FOP],[
11588abc0ccfSmrgAC_ARG_VAR([FOP], [Path to fop command])
11598abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
11608abc0ccfSmrgAC_ARG_WITH(fop,
11618abc0ccfSmrg	AS_HELP_STRING([--with-fop],
11628abc0ccfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11638abc0ccfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
11648abc0ccfSmrgm4_undefine([_defopt])
11657a0395d0Smrg
11668abc0ccfSmrgif test "x$use_fop" = x"auto"; then
11678abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
11688abc0ccfSmrg   if test "x$FOP" = "x"; then
11698abc0ccfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11708abc0ccfSmrg	have_fop=no
11718abc0ccfSmrg   else
11728abc0ccfSmrg        have_fop=yes
11738abc0ccfSmrg   fi
11748abc0ccfSmrgelif test "x$use_fop" = x"yes" ; then
11758abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
11768abc0ccfSmrg   if test "x$FOP" = "x"; then
11778abc0ccfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11788abc0ccfSmrg   fi
11798abc0ccfSmrg   have_fop=yes
11808abc0ccfSmrgelif test "x$use_fop" = x"no" ; then
11818abc0ccfSmrg   if test "x$FOP" != "x"; then
11828abc0ccfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11838abc0ccfSmrg   fi
11848abc0ccfSmrg   have_fop=no
11857366012aSmrgelse
11868abc0ccfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11877a0395d0Smrgfi
11887a0395d0Smrg
11898abc0ccfSmrg# Test for a minimum version of fop, if provided.
11908abc0ccfSmrgm4_ifval([$1],
11918abc0ccfSmrg[if test "$have_fop" = yes; then
11928abc0ccfSmrg    # scrape the fop version
11938abc0ccfSmrg    AC_MSG_CHECKING([for fop minimum version])
11948abc0ccfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11958abc0ccfSmrg    AC_MSG_RESULT([$fop_version])
11968abc0ccfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
11978abc0ccfSmrg        [if test "x$use_fop" = xauto; then
11988abc0ccfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11998abc0ccfSmrg            have_fop=no
12008abc0ccfSmrg        else
12018abc0ccfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12028abc0ccfSmrg        fi])
12038abc0ccfSmrgfi])
12048abc0ccfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12058abc0ccfSmrg]) # XORG_WITH_FOP
12067a0395d0Smrg
120740c5344fSmrg# XORG_WITH_M4([MIN-VERSION])
120840c5344fSmrg# ---------------------------
120940c5344fSmrg# Minimum version: 1.19.0
121040c5344fSmrg#
121140c5344fSmrg# This macro attempts to locate an m4 macro processor which supports
121240c5344fSmrg# -I option and is only useful for modules relying on M4 in order to
121340c5344fSmrg# expand macros in source code files.
121440c5344fSmrg#
121540c5344fSmrg# Interface to module:
121640c5344fSmrg# M4:	 	returns the path of the m4 program found
121740c5344fSmrg#		returns the path set by the user in the environment
121840c5344fSmrg#
121940c5344fSmrgAC_DEFUN([XORG_WITH_M4], [
122040c5344fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
122140c5344fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
122240c5344fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
122340c5344fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
122440c5344fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
122540c5344fSmrg   [$PATH:/usr/gnu/bin])])
122640c5344fSmrg
122740c5344fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
122840c5344fSmrg]) # XORG_WITH_M4
122940c5344fSmrg
12308abc0ccfSmrg# XORG_WITH_PS2PDF([DEFAULT])
12318abc0ccfSmrg# ----------------
12328abc0ccfSmrg# Minimum version: 1.6.0
12338abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
12342adc0320Smrg#
12358abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
12368abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
12378abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12388abc0ccfSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12398abc0ccfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12408abc0ccfSmrg# --with-ps2pdf assumes 'auto'.
12417a0395d0Smrg#
12428abc0ccfSmrg# Interface to module:
12438abc0ccfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12448abc0ccfSmrg# PS2PDF:	returns the path of the ps2pdf program found
12458abc0ccfSmrg#		returns the path set by the user in the environment
12468abc0ccfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12478abc0ccfSmrg#		 'no' user instructs the module not to use ps2pdf
12488abc0ccfSmrg#
12498abc0ccfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12508abc0ccfSmrg#
12518abc0ccfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12528abc0ccfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12538abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
12548abc0ccfSmrgAC_ARG_WITH(ps2pdf,
12558abc0ccfSmrg	AS_HELP_STRING([--with-ps2pdf],
12568abc0ccfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12578abc0ccfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12588abc0ccfSmrgm4_undefine([_defopt])
12597a0395d0Smrg
12608abc0ccfSmrgif test "x$use_ps2pdf" = x"auto"; then
12618abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12628abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
12638abc0ccfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12648abc0ccfSmrg	have_ps2pdf=no
12658abc0ccfSmrg   else
12668abc0ccfSmrg        have_ps2pdf=yes
12678abc0ccfSmrg   fi
12688abc0ccfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
12698abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12708abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
12718abc0ccfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12728abc0ccfSmrg   fi
12738abc0ccfSmrg   have_ps2pdf=yes
12748abc0ccfSmrgelif test "x$use_ps2pdf" = x"no" ; then
12758abc0ccfSmrg   if test "x$PS2PDF" != "x"; then
12768abc0ccfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12778abc0ccfSmrg   fi
12788abc0ccfSmrg   have_ps2pdf=no
12797366012aSmrgelse
12808abc0ccfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12817366012aSmrgfi
12828abc0ccfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12838abc0ccfSmrg]) # XORG_WITH_PS2PDF
12847a0395d0Smrg
12858abc0ccfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
12862adc0320Smrg# ----------------
12878abc0ccfSmrg# Minimum version: 1.6.0
12882adc0320Smrg#
12892adc0320Smrg# Documentation tools are not always available on all platforms and sometimes
12908abc0ccfSmrg# not at the appropriate level. This macro enables a builder to skip all
12918abc0ccfSmrg# documentation targets except traditional man pages.
12928abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12938abc0ccfSmrg# maximum flexibilty in controlling documentation building.
12948abc0ccfSmrg# Refer to:
12958abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
12968abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12978abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12988abc0ccfSmrg# XORG_WITH_FOP           --with-fop
12998abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
13008abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13012adc0320Smrg#
13022adc0320Smrg# Interface to module:
13038abc0ccfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13048abc0ccfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
13058abc0ccfSmrg#		 'no' user instructs the module not to generate docs
13068abc0ccfSmrg# parm1:	specify the default value, yes or no.
13072adc0320Smrg#
13088abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13098abc0ccfSmrgm4_define([docs_default], m4_default([$1], [yes]))
13108abc0ccfSmrgAC_ARG_ENABLE(docs,
13118abc0ccfSmrg	AS_HELP_STRING([--enable-docs],
13128abc0ccfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
13138abc0ccfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
13148abc0ccfSmrgm4_undefine([docs_default])
13158abc0ccfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13168abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
13178abc0ccfSmrgAC_MSG_RESULT([$build_docs])
13188abc0ccfSmrg]) # XORG_ENABLE_DOCS
13192adc0320Smrg
13208abc0ccfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13218abc0ccfSmrg# ----------------
13228abc0ccfSmrg# Minimum version: 1.6.0
13232852888eSmrg#
13248abc0ccfSmrg# This macro enables a builder to skip all developer documentation.
13258abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13268abc0ccfSmrg# maximum flexibilty in controlling documentation building.
13278abc0ccfSmrg# Refer to:
13288abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
13298abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13308abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13318abc0ccfSmrg# XORG_WITH_FOP           --with-fop
13328abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
13338abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13342852888eSmrg#
13352852888eSmrg# Interface to module:
13368abc0ccfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13378abc0ccfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13388abc0ccfSmrg#			'no' user instructs the module not to generate developer docs
13398abc0ccfSmrg# parm1:		specify the default value, yes or no.
13402852888eSmrg#
13418abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13428abc0ccfSmrgm4_define([devel_default], m4_default([$1], [yes]))
13438abc0ccfSmrgAC_ARG_ENABLE(devel-docs,
13448abc0ccfSmrg	AS_HELP_STRING([--enable-devel-docs],
13458abc0ccfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13468abc0ccfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13478abc0ccfSmrgm4_undefine([devel_default])
13488abc0ccfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13498abc0ccfSmrgAC_MSG_CHECKING([whether to build developer documentation])
13508abc0ccfSmrgAC_MSG_RESULT([$build_devel_docs])
13518abc0ccfSmrg]) # XORG_ENABLE_DEVEL_DOCS
13522852888eSmrg
13538abc0ccfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
13548abc0ccfSmrg# ----------------
13558abc0ccfSmrg# Minimum version: 1.6.0
13568abc0ccfSmrg#
13578abc0ccfSmrg# This macro enables a builder to skip all functional specification targets.
13588abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13598abc0ccfSmrg# maximum flexibilty in controlling documentation building.
13608abc0ccfSmrg# Refer to:
13618abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
13628abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13638abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13648abc0ccfSmrg# XORG_WITH_FOP           --with-fop
13658abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
13668abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13678abc0ccfSmrg#
13688abc0ccfSmrg# Interface to module:
13698abc0ccfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13708abc0ccfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
13718abc0ccfSmrg#			'no' user instructs the module not to generate specs
13728abc0ccfSmrg# parm1:		specify the default value, yes or no.
13738abc0ccfSmrg#
13748abc0ccfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13758abc0ccfSmrgm4_define([spec_default], m4_default([$1], [yes]))
13768abc0ccfSmrgAC_ARG_ENABLE(specs,
13778abc0ccfSmrg	AS_HELP_STRING([--enable-specs],
13788abc0ccfSmrg	   [Enable building the specs (default: ]spec_default[)]),
13798abc0ccfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
13808abc0ccfSmrgm4_undefine([spec_default])
13818abc0ccfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13828abc0ccfSmrgAC_MSG_CHECKING([whether to build functional specifications])
13838abc0ccfSmrgAC_MSG_RESULT([$build_specs])
13848abc0ccfSmrg]) # XORG_ENABLE_SPECS
13852852888eSmrg
13868abc0ccfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13878abc0ccfSmrg# ----------------------------------------------
13888abc0ccfSmrg# Minimum version: 1.13.0
138996402570Smrg#
13908abc0ccfSmrg# This macro enables a builder to enable/disable unit testing
13918abc0ccfSmrg# It makes no assumption about the test cases implementation
13928abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
13938abc0ccfSmrg# They may or may not use the software utility library GLib
139496402570Smrg#
13958abc0ccfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13968abc0ccfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13978abc0ccfSmrg# The variable enable_unit_tests is used by other macros in this file.
139896402570Smrg#
139996402570Smrg# Interface to module:
14008abc0ccfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14018abc0ccfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
14028abc0ccfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14038abc0ccfSmrg#			'no' user instructs the module not to build tests
14048abc0ccfSmrg# parm1:		specify the default value, yes or no.
140596402570Smrg#
14068abc0ccfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14078abc0ccfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14088abc0ccfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14098abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14108abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
14118abc0ccfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14128abc0ccfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
14138abc0ccfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
141496402570Smrgm4_undefine([_defopt])
14158abc0ccfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14168abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
14178abc0ccfSmrgAC_MSG_RESULT([$enable_unit_tests])
14188abc0ccfSmrg]) # XORG_ENABLE_UNIT_TESTS
141996402570Smrg
14208abc0ccfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14218abc0ccfSmrg# ------------------------------------------------------
14228abc0ccfSmrg# Minimum version: 1.17.0
14232adc0320Smrg#
14248abc0ccfSmrg# This macro enables a builder to enable/disable integration testing
14258abc0ccfSmrg# It makes no assumption about the test cases' implementation
14268abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
14272adc0320Smrg#
14288abc0ccfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14298abc0ccfSmrg# usually requires less dependencies and may be built and run under less
14308abc0ccfSmrg# stringent environments than integration tests.
14312adc0320Smrg#
14328abc0ccfSmrg# Interface to module:
14338abc0ccfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14348abc0ccfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
14358abc0ccfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14368abc0ccfSmrg#                             'no' user instructs the module not to build tests
14378abc0ccfSmrg# parm1:                      specify the default value, yes or no.
14382adc0320Smrg#
14398abc0ccfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14408abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14418abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
14428abc0ccfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14438abc0ccfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
14448abc0ccfSmrg	[enable_integration_tests=$enableval],
14458abc0ccfSmrg	[enable_integration_tests=]_defopt)
14462852888eSmrgm4_undefine([_defopt])
14478abc0ccfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14488abc0ccfSmrg	[test "x$enable_integration_tests" != xno])
14498abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
14508abc0ccfSmrgAC_MSG_RESULT([$enable_integration_tests])
14518abc0ccfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
14522adc0320Smrg
14538abc0ccfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14548abc0ccfSmrg# ----------------------------------------
14558abc0ccfSmrg# Minimum version: 1.13.0
14562adc0320Smrg#
14578abc0ccfSmrg# GLib is a library which provides advanced data structures and functions.
14588abc0ccfSmrg# This macro enables a module to test for the presence of Glib.
14592adc0320Smrg#
14608abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14618abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
14622adc0320Smrg#
14638abc0ccfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14648abc0ccfSmrg# test support usually requires less dependencies and may be built and run under
14658abc0ccfSmrg# less stringent environments than integration tests.
14662adc0320Smrg#
14672adc0320Smrg# Interface to module:
14688abc0ccfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
14698abc0ccfSmrg# with_glib: used in configure.ac to know if GLib has been found
14708abc0ccfSmrg# --with-glib:	'yes' user instructs the module to use glib
14718abc0ccfSmrg#		'no' user instructs the module not to use glib
14722adc0320Smrg#
14738abc0ccfSmrgAC_DEFUN([XORG_WITH_GLIB],[
14748abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14758abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
14768abc0ccfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14778abc0ccfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14788abc0ccfSmrg	[with_glib=$withval], [with_glib=]_defopt)
14792852888eSmrgm4_undefine([_defopt])
14802adc0320Smrg
14818abc0ccfSmrghave_glib=no
14828abc0ccfSmrg# Do not probe GLib if user explicitly disabled unit testing
14838abc0ccfSmrgif test "x$enable_unit_tests" != x"no"; then
14848abc0ccfSmrg  # Do not probe GLib if user explicitly disabled it
14858abc0ccfSmrg  if test "x$with_glib" != x"no"; then
14868abc0ccfSmrg    m4_ifval(
14878abc0ccfSmrg      [$1],
14888abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14898abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14908abc0ccfSmrg    )
14918abc0ccfSmrg  fi
14922adc0320Smrgfi
14932adc0320Smrg
14948abc0ccfSmrg# Not having GLib when unit testing has been explicitly requested is an error
14958abc0ccfSmrgif test "x$enable_unit_tests" = x"yes"; then
14968abc0ccfSmrg  if test "x$have_glib" = x"no"; then
14978abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14988abc0ccfSmrg  fi
14992adc0320Smrgfi
15002adc0320Smrg
15018abc0ccfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
15028abc0ccfSmrgif test "x$enable_unit_tests" = x"no"; then
15038abc0ccfSmrg  if test "x$with_glib" = x"yes"; then
15048abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15058abc0ccfSmrg  fi
15062adc0320Smrgfi
15072adc0320Smrg
15088abc0ccfSmrg# Not having GLib when it has been explicitly requested is an error
15098abc0ccfSmrgif test "x$with_glib" = x"yes"; then
15108abc0ccfSmrg  if test "x$have_glib" = x"no"; then
15118abc0ccfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15128abc0ccfSmrg  fi
15138abc0ccfSmrgfi
15142adc0320Smrg
15158abc0ccfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15168abc0ccfSmrg]) # XORG_WITH_GLIB
15178abc0ccfSmrg
15188abc0ccfSmrg# XORG_LD_WRAP([required|optional])
15198abc0ccfSmrg# ---------------------------------
15208abc0ccfSmrg# Minimum version: 1.13.0
15212adc0320Smrg#
15228abc0ccfSmrg# Check if linker supports -wrap, passed via compiler flags
15232adc0320Smrg#
15248abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15258abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
15262adc0320Smrg#
15278abc0ccfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15288abc0ccfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15298abc0ccfSmrg# available, an argument of "optional" allows use when some unit tests require
15308abc0ccfSmrg# ld -wrap and others do not.
15312adc0320Smrg#
15328abc0ccfSmrgAC_DEFUN([XORG_LD_WRAP],[
15338abc0ccfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15348abc0ccfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15358abc0ccfSmrg                      void __wrap_exit(int status) { return; }],
15368abc0ccfSmrg                     [exit(0);])])
15378abc0ccfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
15388abc0ccfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15398abc0ccfSmrg  if test "x$have_ld_wrap" = x"no"; then
15408abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15418abc0ccfSmrg  fi
15422adc0320Smrgfi
15438abc0ccfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15448abc0ccfSmrg#
15458abc0ccfSmrg]) # XORG_LD_WRAP
154696402570Smrg
15478abc0ccfSmrg# XORG_CHECK_LINKER_FLAGS
15488abc0ccfSmrg# -----------------------
15498abc0ccfSmrg# SYNOPSIS
15502adc0320Smrg#
15518abc0ccfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15522adc0320Smrg#
15538abc0ccfSmrg# DESCRIPTION
15542adc0320Smrg#
15558abc0ccfSmrg#   Check whether the given linker FLAGS work with the current language's
15568abc0ccfSmrg#   linker, or whether they give an error.
15572adc0320Smrg#
15588abc0ccfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15598abc0ccfSmrg#   success/failure.
15602adc0320Smrg#
15618abc0ccfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
15622adc0320Smrg#
15638abc0ccfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15642adc0320Smrg#
15658abc0ccfSmrg# LICENSE
15662adc0320Smrg#
15678abc0ccfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15688abc0ccfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15698abc0ccfSmrg#   Copyright (c) 2009 Matteo Frigo
15702adc0320Smrg#
15718abc0ccfSmrg#   This program is free software: you can redistribute it and/or modify it
15728abc0ccfSmrg#   under the terms of the GNU General Public License as published by the
15738abc0ccfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
15748abc0ccfSmrg#   option) any later version.
15752adc0320Smrg#
15768abc0ccfSmrg#   This program is distributed in the hope that it will be useful, but
15778abc0ccfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15788abc0ccfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15798abc0ccfSmrg#   Public License for more details.
15802adc0320Smrg#
15818abc0ccfSmrg#   You should have received a copy of the GNU General Public License along
15828abc0ccfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15832adc0320Smrg#
15848abc0ccfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
15858abc0ccfSmrg#   gives unlimited permission to copy, distribute and modify the configure
15868abc0ccfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
15878abc0ccfSmrg#   need not follow the terms of the GNU General Public License when using
15888abc0ccfSmrg#   or distributing such scripts, even though portions of the text of the
15898abc0ccfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15908abc0ccfSmrg#   all other use of the material that constitutes the Autoconf Macro.
15912adc0320Smrg#
15928abc0ccfSmrg#   This special exception to the GPL applies to versions of the Autoconf
15938abc0ccfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
15948abc0ccfSmrg#   modified version of the Autoconf Macro, you may extend this special
15958abc0ccfSmrg#   exception to the GPL to apply to your modified version as well.#
15968abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15978abc0ccfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
15988abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15998abc0ccfSmrgAS_LITERAL_IF([$1],
16008abc0ccfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16018abc0ccfSmrg      ax_save_FLAGS=$LDFLAGS
16028abc0ccfSmrg      LDFLAGS="$1"
16038abc0ccfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16048abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16058abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16068abc0ccfSmrg      LDFLAGS=$ax_save_FLAGS])],
16078abc0ccfSmrg  [ax_save_FLAGS=$LDFLAGS
16088abc0ccfSmrg   LDFLAGS="$1"
16098abc0ccfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16108abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16118abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16128abc0ccfSmrg   LDFLAGS=$ax_save_FLAGS])
16138abc0ccfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16148abc0ccfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
16158abc0ccfSmrgif test "x$xorg_check_linker_flags" = xyes; then
16168abc0ccfSmrg	m4_default([$2], :)
16178abc0ccfSmrgelse
16188abc0ccfSmrg	m4_default([$3], :)
16198abc0ccfSmrgfi
16208abc0ccfSmrg]) # XORG_CHECK_LINKER_FLAGS
16212adc0320Smrg
16228abc0ccfSmrg# XORG_MEMORY_CHECK_FLAGS
16238abc0ccfSmrg# -----------------------
16248abc0ccfSmrg# Minimum version: 1.16.0
16252852888eSmrg#
16268abc0ccfSmrg# This macro attempts to find appropriate memory checking functionality
16278abc0ccfSmrg# for various platforms which unit testing code may use to catch various
16288abc0ccfSmrg# forms of memory allocation and access errors in testing.
16292852888eSmrg#
16302852888eSmrg# Interface to module:
16318abc0ccfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16328abc0ccfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16332852888eSmrg#
16348abc0ccfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
163596402570Smrg#
16368abc0ccfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16378abc0ccfSmrg
16388abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
16398abc0ccfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16408abc0ccfSmrg           [Environment variables to enable memory checking in tests])
16418abc0ccfSmrg
16428abc0ccfSmrg# Check for different types of support on different platforms
16438abc0ccfSmrgcase $host_os in
16448abc0ccfSmrg    solaris*)
16458abc0ccfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
16468abc0ccfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16478abc0ccfSmrg        ;;
16488abc0ccfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16498abc0ccfSmrg        # both directly and inverted, so should not be 0 or 255.
16508abc0ccfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
16518abc0ccfSmrg        ;;
16528abc0ccfSmrg    darwin*)
16538abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16548abc0ccfSmrg        ;;
16558abc0ccfSmrg    *bsd*)
16568abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16578abc0ccfSmrg        ;;
16588abc0ccfSmrgesac
16598abc0ccfSmrg
16608abc0ccfSmrg# User supplied flags override default flags
16618abc0ccfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16628abc0ccfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16638abc0ccfSmrgfi
16648abc0ccfSmrg
16658abc0ccfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16668abc0ccfSmrg]) # XORG_WITH_LINT
16678abc0ccfSmrg
16688abc0ccfSmrg# XORG_CHECK_MALLOC_ZERO
16698abc0ccfSmrg# ----------------------
16708abc0ccfSmrg# Minimum version: 1.0.0
167196402570Smrg#
16728abc0ccfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16738abc0ccfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16748abc0ccfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16758abc0ccfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16768abc0ccfSmrgAC_ARG_ENABLE(malloc0returnsnull,
16778abc0ccfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16788abc0ccfSmrg		       [malloc(0) returns NULL (default: auto)]),
16798abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16808abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16818abc0ccfSmrg
16828abc0ccfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16838abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
168440c5344fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
168540c5344fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16868abc0ccfSmrg#include <stdlib.h>
16878abc0ccfSmrg],[
16888abc0ccfSmrg    char *m0, *r0, *c0, *p;
16898abc0ccfSmrg    m0 = malloc(0);
16908abc0ccfSmrg    p = malloc(10);
16918abc0ccfSmrg    r0 = realloc(p,0);
16928abc0ccfSmrg    c0 = calloc(0,10);
16938abc0ccfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16948abc0ccfSmrg])],
169540c5344fSmrg		[xorg_cv_malloc0_returns_null=yes],
169640c5344fSmrg		[xorg_cv_malloc0_returns_null=no])])
169740c5344fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16988abc0ccfSmrgfi
16998abc0ccfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17008abc0ccfSmrg
17018abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17028abc0ccfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17038abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17048abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17058abc0ccfSmrgelse
17068abc0ccfSmrg	MALLOC_ZERO_CFLAGS=""
17078abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=""
17088abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS=""
17098abc0ccfSmrgfi
17108abc0ccfSmrg
17118abc0ccfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17128abc0ccfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17138abc0ccfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17148abc0ccfSmrg]) # XORG_CHECK_MALLOC_ZERO
17158abc0ccfSmrg
17168abc0ccfSmrg# XORG_WITH_LINT()
17178abc0ccfSmrg# ----------------
17188abc0ccfSmrg# Minimum version: 1.1.0
17198abc0ccfSmrg#
17208abc0ccfSmrg# This macro enables the use of a tool that flags some suspicious and
17218abc0ccfSmrg# non-portable constructs (likely to be bugs) in C language source code.
17228abc0ccfSmrg# It will attempt to locate the tool and use appropriate options.
17238abc0ccfSmrg# There are various lint type tools on different platforms.
172496402570Smrg#
172596402570Smrg# Interface to module:
17268abc0ccfSmrg# LINT:		returns the path to the tool found on the platform
17278abc0ccfSmrg#		or the value set to LINT on the configure cmd line
17288abc0ccfSmrg#		also an Automake conditional
17298abc0ccfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
17308abc0ccfSmrg#
17318abc0ccfSmrg# --with-lint:	'yes' user instructs the module to use lint
17328abc0ccfSmrg#		'no' user instructs the module not to use lint (default)
17338abc0ccfSmrg#
17348abc0ccfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17358abc0ccfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17368abc0ccfSmrg#
17378abc0ccfSmrgAC_DEFUN([XORG_WITH_LINT],[
17388abc0ccfSmrg
17398abc0ccfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17408abc0ccfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17418abc0ccfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17428abc0ccfSmrg		[Use a lint-style source code checker (default: disabled)])],
17438abc0ccfSmrg		[use_lint=$withval], [use_lint=no])
17448abc0ccfSmrg
17458abc0ccfSmrg# Obtain platform specific info like program name and options
17468abc0ccfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17478abc0ccfSmrgcase $host_os in
17488abc0ccfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17498abc0ccfSmrg	lint_name=splint
17508abc0ccfSmrg	lint_options="-badflag"
17518abc0ccfSmrg	;;
17528abc0ccfSmrg  *freebsd* | *netbsd*)
17538abc0ccfSmrg	lint_name=lint
17548abc0ccfSmrg	lint_options="-u -b"
17558abc0ccfSmrg	;;
17568abc0ccfSmrg  *solaris*)
17578abc0ccfSmrg	lint_name=lint
17588abc0ccfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17598abc0ccfSmrg	;;
17608abc0ccfSmrgesac
17618abc0ccfSmrg
17628abc0ccfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17638abc0ccfSmrgif test "x$use_lint" = x"yes" ; then
17648abc0ccfSmrg   AC_PATH_PROG([LINT], [$lint_name])
17658abc0ccfSmrg   if test "x$LINT" = "x"; then
17668abc0ccfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17678abc0ccfSmrg   fi
17688abc0ccfSmrgelif test "x$use_lint" = x"no" ; then
17698abc0ccfSmrg   if test "x$LINT" != "x"; then
17708abc0ccfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17718abc0ccfSmrg   fi
17728abc0ccfSmrgelse
17738abc0ccfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17748abc0ccfSmrgfi
17758abc0ccfSmrg
17768abc0ccfSmrg# User supplied flags override default flags
17778abc0ccfSmrgif test "x$LINT_FLAGS" != "x"; then
17788abc0ccfSmrg   lint_options=$LINT_FLAGS
17798abc0ccfSmrgfi
17808abc0ccfSmrg
17818abc0ccfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17828abc0ccfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17838abc0ccfSmrg
17848abc0ccfSmrg]) # XORG_WITH_LINT
17858abc0ccfSmrg
17868abc0ccfSmrg# XORG_LINT_LIBRARY(LIBNAME)
17878abc0ccfSmrg# --------------------------
17888abc0ccfSmrg# Minimum version: 1.1.0
17898abc0ccfSmrg#
17908abc0ccfSmrg# Sets up flags for building lint libraries for checking programs that call
17918abc0ccfSmrg# functions in the library.
17928abc0ccfSmrg#
17938abc0ccfSmrg# Interface to module:
17948abc0ccfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
17958abc0ccfSmrg# MAKE_LINT_LIB		- Automake conditional
17968abc0ccfSmrg#
17978abc0ccfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17988abc0ccfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
17998abc0ccfSmrg
18008abc0ccfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18018abc0ccfSmrgAC_REQUIRE([XORG_WITH_LINT])
18028abc0ccfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18038abc0ccfSmrg	[Create lint library (default: disabled)])],
18048abc0ccfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18058abc0ccfSmrg
18068abc0ccfSmrgif test "x$make_lint_lib" = x"yes" ; then
18078abc0ccfSmrg   LINTLIB=llib-l$1.ln
18088abc0ccfSmrg   if test "x$LINT" = "x"; then
18098abc0ccfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18108abc0ccfSmrg   fi
18118abc0ccfSmrgelif test "x$make_lint_lib" != x"no" ; then
18128abc0ccfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18138abc0ccfSmrgfi
18148abc0ccfSmrg
18158abc0ccfSmrgAC_SUBST(LINTLIB)
18168abc0ccfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18178abc0ccfSmrg
18188abc0ccfSmrg]) # XORG_LINT_LIBRARY
18198abc0ccfSmrg
18208abc0ccfSmrg# XORG_COMPILER_BRAND
18218abc0ccfSmrg# -------------------
18228abc0ccfSmrg# Minimum version: 1.14.0
18238abc0ccfSmrg#
18248abc0ccfSmrg# Checks for various brands of compilers and sets flags as appropriate:
18258abc0ccfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18268abc0ccfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18278abc0ccfSmrg#   clang compiler - sets CLANGCC to "yes"
18288abc0ccfSmrg#   Intel compiler - sets INTELCC to "yes"
18298abc0ccfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18308abc0ccfSmrg#
18318abc0ccfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18328abc0ccfSmrgAC_LANG_CASE(
18338abc0ccfSmrg	[C], [
18348abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
18358abc0ccfSmrg	],
18368abc0ccfSmrg	[C++], [
18378abc0ccfSmrg		AC_REQUIRE([AC_PROG_CXX])
18388abc0ccfSmrg	]
18398abc0ccfSmrg)
18408abc0ccfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18418abc0ccfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18428abc0ccfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18438abc0ccfSmrg]) # XORG_COMPILER_BRAND
18448abc0ccfSmrg
18458abc0ccfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18468abc0ccfSmrg# ---------------
18478abc0ccfSmrg# Minimum version: 1.16.0
18488abc0ccfSmrg#
18498abc0ccfSmrg# Test if the compiler works when passed the given flag as a command line argument.
18508abc0ccfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18518abc0ccfSmrg# next flag in the list until there are no more options.
18528abc0ccfSmrg#
18538abc0ccfSmrg# Note that this does not guarantee that the compiler supports the flag as some
18548abc0ccfSmrg# compilers will simply ignore arguments that they do not understand, but we do
18558abc0ccfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18568abc0ccfSmrg# -Werror=unused-command-line-argument
18578abc0ccfSmrg#
18588abc0ccfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18598abc0ccfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18608abc0ccfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18618abc0ccfSmrg
18628abc0ccfSmrgAC_LANG_COMPILER_REQUIRE
18638abc0ccfSmrg
18648abc0ccfSmrgAC_LANG_CASE(
18658abc0ccfSmrg	[C], [
18668abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
18678abc0ccfSmrg		define([PREFIX], [C])
18688abc0ccfSmrg		define([CACHE_PREFIX], [cc])
18698abc0ccfSmrg		define([COMPILER], [$CC])
18708abc0ccfSmrg	],
18718abc0ccfSmrg	[C++], [
18728abc0ccfSmrg		define([PREFIX], [CXX])
18738abc0ccfSmrg		define([CACHE_PREFIX], [cxx])
18748abc0ccfSmrg		define([COMPILER], [$CXX])
18758abc0ccfSmrg	]
18768abc0ccfSmrg)
18778abc0ccfSmrg
18788abc0ccfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18798abc0ccfSmrg
18808abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18818abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18828abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18838abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18848abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18858abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18868abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18878abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18888abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18898abc0ccfSmrgfi
18908abc0ccfSmrg
18918abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18928abc0ccfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18938abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18948abc0ccfSmrg	fi
18958abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18968abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18978abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18988abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18998abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19008abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19018abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19028abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19038abc0ccfSmrgfi
19048abc0ccfSmrg
19058abc0ccfSmrgfound="no"
19068abc0ccfSmrgm4_foreach([flag], m4_cdr($@), [
19078abc0ccfSmrg	if test $found = "no" ; then
190840c5344fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19098abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19108abc0ccfSmrg		fi
19118abc0ccfSmrg
191240c5344fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19138abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19148abc0ccfSmrg		fi
19158abc0ccfSmrg
19168abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19178abc0ccfSmrg
19188abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
191940c5344fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19208abc0ccfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19218abc0ccfSmrg		AC_CACHE_VAL($cacheid,
19228abc0ccfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19238abc0ccfSmrg					     [eval $cacheid=yes],
19248abc0ccfSmrg					     [eval $cacheid=no])])
19258abc0ccfSmrg
19268abc0ccfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19278abc0ccfSmrg
19288abc0ccfSmrg		eval supported=\$$cacheid
19298abc0ccfSmrg		AC_MSG_RESULT([$supported])
19308abc0ccfSmrg		if test "$supported" = "yes" ; then
19318abc0ccfSmrg			$1="$$1 ]flag["
19328abc0ccfSmrg			found="yes"
19338abc0ccfSmrg		fi
19348abc0ccfSmrg	fi
19358abc0ccfSmrg])
19368abc0ccfSmrg]) # XORG_TESTSET_CFLAG
19378abc0ccfSmrg
19388abc0ccfSmrg# XORG_COMPILER_FLAGS
19398abc0ccfSmrg# ---------------
19408abc0ccfSmrg# Minimum version: 1.16.0
19418abc0ccfSmrg#
19428abc0ccfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19438abc0ccfSmrg# arguments supported by the selected compiler which do NOT alter the generated
19448abc0ccfSmrg# code.  These arguments will cause the compiler to print various warnings
19458abc0ccfSmrg# during compilation AND turn a conservative set of warnings into errors.
19468abc0ccfSmrg#
19478abc0ccfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19488abc0ccfSmrg# future versions of util-macros as options are added to new compilers.
19498abc0ccfSmrg#
19508abc0ccfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19518abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19528abc0ccfSmrg
19538abc0ccfSmrgAC_ARG_ENABLE(selective-werror,
19548abc0ccfSmrg              AS_HELP_STRING([--disable-selective-werror],
19558abc0ccfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
19568abc0ccfSmrg              [SELECTIVE_WERROR=$enableval],
19578abc0ccfSmrg              [SELECTIVE_WERROR=yes])
19588abc0ccfSmrg
19598abc0ccfSmrgAC_LANG_CASE(
19608abc0ccfSmrg        [C], [
19618abc0ccfSmrg                define([PREFIX], [C])
19628abc0ccfSmrg        ],
19638abc0ccfSmrg        [C++], [
19648abc0ccfSmrg                define([PREFIX], [CXX])
19658abc0ccfSmrg        ]
19668abc0ccfSmrg)
19678abc0ccfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19688abc0ccfSmrgif test "x$SUNCC" = "xyes"; then
19698abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="-v"
19708abc0ccfSmrgelse
19718abc0ccfSmrg    [BASE_]PREFIX[FLAGS]=""
19728abc0ccfSmrgfi
19738abc0ccfSmrg
19748abc0ccfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19758abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19768abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19778abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19788abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19798abc0ccfSmrg
19808abc0ccfSmrgAC_LANG_CASE(
19818abc0ccfSmrg	[C], [
19828abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19838abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19848abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19858abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
198640c5344fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19878abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19888abc0ccfSmrg	]
19898abc0ccfSmrg)
19908abc0ccfSmrg
19918abc0ccfSmrg# This chunk adds additional warnings that could catch undesired effects.
19928abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19938abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19948abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19958abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19968abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19978abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
199840c5344fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19998abc0ccfSmrg
20008abc0ccfSmrg# These are currently disabled because they are noisy.  They will be enabled
20018abc0ccfSmrg# in the future once the codebase is sufficiently modernized to silence
20028abc0ccfSmrg# them.  For now, I don't want them to drown out the other warnings.
20038abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20048abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
200540c5344fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20068abc0ccfSmrg
20078abc0ccfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
20088abc0ccfSmrg# when there are problems that should be fixed.
20098abc0ccfSmrg
20108abc0ccfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20118abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20128abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20138abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20148abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20158abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20168abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20178abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20188abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20198abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20208abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20218abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20228abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20238abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20248abc0ccfSmrgelse
20258abc0ccfSmrgAC_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])
20268abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20278abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20288abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20298abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20308abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20318abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20328abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20338abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20348abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20358abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20368abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20378abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20388abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20398abc0ccfSmrgfi
20408abc0ccfSmrg
20418abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20428abc0ccfSmrg]) # XORG_COMPILER_FLAGS
20438abc0ccfSmrg
20448abc0ccfSmrg# XORG_CWARNFLAGS
20458abc0ccfSmrg# ---------------
20468abc0ccfSmrg# Minimum version: 1.2.0
20478abc0ccfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20488abc0ccfSmrg#
20498abc0ccfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
20508abc0ccfSmrg#
20518abc0ccfSmrg# This function is deprecated because it defines -fno-strict-aliasing
20528abc0ccfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20538abc0ccfSmrg# is needed, then it should be added explicitly in the module when
20548abc0ccfSmrg# it is updated to use BASE_CFLAGS.
20558abc0ccfSmrg#
20568abc0ccfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
20578abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20588abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20598abc0ccfSmrgAC_LANG_CASE(
20608abc0ccfSmrg	[C], [
20618abc0ccfSmrg		CWARNFLAGS="$BASE_CFLAGS"
20628abc0ccfSmrg		if  test "x$GCC" = xyes ; then
20638abc0ccfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20648abc0ccfSmrg		fi
20658abc0ccfSmrg		AC_SUBST(CWARNFLAGS)
20668abc0ccfSmrg	]
20678abc0ccfSmrg)
20688abc0ccfSmrg]) # XORG_CWARNFLAGS
20698abc0ccfSmrg
20708abc0ccfSmrg# XORG_STRICT_OPTION
20718abc0ccfSmrg# -----------------------
20728abc0ccfSmrg# Minimum version: 1.3.0
20738abc0ccfSmrg#
20748abc0ccfSmrg# Add configure option to enable strict compilation flags, such as treating
20758abc0ccfSmrg# warnings as fatal errors.
20768abc0ccfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20778abc0ccfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20788abc0ccfSmrg#
20798abc0ccfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20808abc0ccfSmrg# when strict compilation is unconditionally desired.
20818abc0ccfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
20828abc0ccfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
20838abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20848abc0ccfSmrg
20858abc0ccfSmrgAC_ARG_ENABLE(strict-compilation,
20868abc0ccfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
20878abc0ccfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20888abc0ccfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20898abc0ccfSmrg
20908abc0ccfSmrgAC_LANG_CASE(
20918abc0ccfSmrg        [C], [
20928abc0ccfSmrg                define([PREFIX], [C])
20938abc0ccfSmrg        ],
20948abc0ccfSmrg        [C++], [
20958abc0ccfSmrg                define([PREFIX], [CXX])
20968abc0ccfSmrg        ]
20978abc0ccfSmrg)
20988abc0ccfSmrg
20998abc0ccfSmrg[STRICT_]PREFIX[FLAGS]=""
21008abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21018abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21028abc0ccfSmrg
21038abc0ccfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21048abc0ccfSmrg# activate it with -Werror, so we add it here explicitly.
21058abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21068abc0ccfSmrg
21078abc0ccfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
21088abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21098abc0ccfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21108abc0ccfSmrgfi
21118abc0ccfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21128abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21138abc0ccfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21148abc0ccfSmrg]) # XORG_STRICT_OPTION
21158abc0ccfSmrg
21168abc0ccfSmrg# XORG_DEFAULT_OPTIONS
21178abc0ccfSmrg# --------------------
21188abc0ccfSmrg# Minimum version: 1.3.0
21198abc0ccfSmrg#
21208abc0ccfSmrg# Defines default options for X.Org modules.
21218abc0ccfSmrg#
21228abc0ccfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21238abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])
21248abc0ccfSmrgXORG_COMPILER_FLAGS
21258abc0ccfSmrgXORG_CWARNFLAGS
21268abc0ccfSmrgXORG_STRICT_OPTION
21278abc0ccfSmrgXORG_RELEASE_VERSION
21288abc0ccfSmrgXORG_CHANGELOG
21298abc0ccfSmrgXORG_INSTALL
21308abc0ccfSmrgXORG_MANPAGE_SECTIONS
21318abc0ccfSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21328abc0ccfSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21338abc0ccfSmrg]) # XORG_DEFAULT_OPTIONS
21348abc0ccfSmrg
21358abc0ccfSmrg# XORG_INSTALL()
21368abc0ccfSmrg# ----------------
21378abc0ccfSmrg# Minimum version: 1.4.0
21388abc0ccfSmrg#
21398abc0ccfSmrg# Defines the variable INSTALL_CMD as the command to copy
21408abc0ccfSmrg# INSTALL from $prefix/share/util-macros.
21418abc0ccfSmrg#
21428abc0ccfSmrgAC_DEFUN([XORG_INSTALL], [
21438abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21448abc0ccfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21458abc0ccfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21468abc0ccfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21476c3c2bceSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
21486c3c2bceSmrgtouch \$(top_srcdir)/INSTALL; \
21496c3c2bceSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
21508abc0ccfSmrgAC_SUBST([INSTALL_CMD])
21518abc0ccfSmrg]) # XORG_INSTALL
21528abc0ccfSmrgdnl Copyright 2005 Red Hat, Inc
21538abc0ccfSmrgdnl
21548abc0ccfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21558abc0ccfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
21568abc0ccfSmrgdnl the above copyright notice appear in all copies and that both that
21578abc0ccfSmrgdnl copyright notice and this permission notice appear in supporting
21588abc0ccfSmrgdnl documentation.
21598abc0ccfSmrgdnl
21608abc0ccfSmrgdnl The above copyright notice and this permission notice shall be included
21618abc0ccfSmrgdnl in all copies or substantial portions of the Software.
21628abc0ccfSmrgdnl
21638abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21648abc0ccfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21658abc0ccfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21668abc0ccfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21678abc0ccfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21688abc0ccfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21698abc0ccfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
21708abc0ccfSmrgdnl
21718abc0ccfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
21728abc0ccfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
21738abc0ccfSmrgdnl other dealings in this Software without prior written authorization
21748abc0ccfSmrgdnl from the copyright holders.
21758abc0ccfSmrgdnl
21768abc0ccfSmrg
21778abc0ccfSmrg# XORG_RELEASE_VERSION
21788abc0ccfSmrg# --------------------
21798abc0ccfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
218040c5344fSmrg
21818abc0ccfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21828abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21838abc0ccfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21848abc0ccfSmrg		[Major version of this package])
21858abc0ccfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21868abc0ccfSmrg	if test "x$PVM" = "x"; then
21878abc0ccfSmrg		PVM="0"
21888abc0ccfSmrg	fi
21898abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21908abc0ccfSmrg		[$PVM],
21918abc0ccfSmrg		[Minor version of this package])
21928abc0ccfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21938abc0ccfSmrg	if test "x$PVP" = "x"; then
21948abc0ccfSmrg		PVP="0"
21958abc0ccfSmrg	fi
21968abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21978abc0ccfSmrg		[$PVP],
21988abc0ccfSmrg		[Patch version of this package])
21998abc0ccfSmrg])
22008abc0ccfSmrg
22018abc0ccfSmrg# XORG_CHANGELOG()
22028abc0ccfSmrg# ----------------
22038abc0ccfSmrg# Minimum version: 1.2.0
22048abc0ccfSmrg#
22058abc0ccfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
22068abc0ccfSmrg# ChangeLog from git.
22078abc0ccfSmrg#
22088abc0ccfSmrg#
22098abc0ccfSmrgAC_DEFUN([XORG_CHANGELOG], [
22106c3c2bceSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22118abc0ccfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22126c3c2bceSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22136c3c2bceSmrgtouch \$(top_srcdir)/ChangeLog; \
22146c3c2bceSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22158abc0ccfSmrgAC_SUBST([CHANGELOG_CMD])
22168abc0ccfSmrg]) # XORG_CHANGELOG
22178abc0ccfSmrg
22188abc0ccfSmrgdnl
22198abc0ccfSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
22208abc0ccfSmrgdnl
22218abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
22228abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
22238abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
22248abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
22258abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
22268abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
22278abc0ccfSmrgdnl
22288abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
22298abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
22308abc0ccfSmrgdnl Software.
22318abc0ccfSmrgdnl
22328abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22338abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22348abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22358abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22368abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22378abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22388abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
22398abc0ccfSmrgdnl
22408abc0ccfSmrg
22418abc0ccfSmrg# XTRANS_TCP_FLAGS()
22428abc0ccfSmrg# ------------------
22438abc0ccfSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
22448abc0ccfSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
22458abc0ccfSmrg # SVR4 hides these in libraries other than libc
22468abc0ccfSmrg AC_SEARCH_LIBS(socket, [socket])
22478abc0ccfSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
22488abc0ccfSmrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
22499a011757Smrg   AC_CHECK_LIB([ws2_32],[main])
22508abc0ccfSmrg fi
22518abc0ccfSmrg
22528abc0ccfSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
22538abc0ccfSmrg AC_ARG_ENABLE(ipv6,
22549a011757Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
22558abc0ccfSmrg	[IPV6CONN=$enableval],
22568abc0ccfSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
22578abc0ccfSmrg AC_MSG_CHECKING([if IPv6 support should be built])
22588abc0ccfSmrg if test "$IPV6CONN" = "yes"; then
22598abc0ccfSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
22608abc0ccfSmrg fi
22618abc0ccfSmrg AC_MSG_RESULT($IPV6CONN)
22628abc0ccfSmrg
22638abc0ccfSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
22648abc0ccfSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
22658abc0ccfSmrg	AC_DEFINE([BSD44SOCKETS],1,
22668abc0ccfSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
22678abc0ccfSmrg#include <sys/types.h>
22688abc0ccfSmrg#include <sys/socket.h>
22698abc0ccfSmrg#include <netinet/in.h>
22708abc0ccfSmrg ])
22718abc0ccfSmrg
22728abc0ccfSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
22738abc0ccfSmrg AC_CHECK_TYPES([socklen_t], [], [], [
22748abc0ccfSmrgAC_INCLUDES_DEFAULT
22758abc0ccfSmrg#include <sys/socket.h>])
22768abc0ccfSmrg
22779a011757Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
22789a011757Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
22799a011757Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
22809a011757Smrg                 [
22819a011757SmrgAC_INCLUDES_DEFAULT
22829a011757Smrg#include <sys/socket.h>
22839a011757Smrg                 ])
22849a011757Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
22859a011757Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
22869a011757Smrg     unset ac_cv_member_struct_msghdr_msg_control
22879a011757Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
22889a011757Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
22899a011757Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
22909a011757Smrg                       [Defined if needed to expose struct msghdr.msg_control])
22919a011757Smrg                     ], [], [
22929a011757Smrg#define _XOPEN_SOURCE 600
22939a011757SmrgAC_INCLUDES_DEFAULT
22949a011757Smrg#include <sys/socket.h>
22959a011757Smrg                     ])
22969a011757Smrg fi
22979a011757Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
22989a011757Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
22999a011757Smrg     unset ac_cv_member_struct_msghdr_msg_control
23009a011757Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
23019a011757Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
23029a011757Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
23039a011757Smrg                       [Defined if needed to expose struct msghdr.msg_control])
23049a011757Smrg                     ], [], [
23059a011757Smrg#define _XOPEN_SOURCE 500
23069a011757SmrgAC_INCLUDES_DEFAULT
23079a011757Smrg#include <sys/socket.h>
23089a011757Smrg                     ])
23099a011757Smrg fi
23109a011757Smrg
23119a011757Smrg
23128abc0ccfSmrg]) # XTRANS_TCP_FLAGS
23138abc0ccfSmrg
23148abc0ccfSmrg# XTRANS_CONNECTION_FLAGS()
23158abc0ccfSmrg# -------------------------
23168abc0ccfSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
23178abc0ccfSmrg# that use Xtrans functions
23188abc0ccfSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
23198abc0ccfSmrg AC_REQUIRE([AC_CANONICAL_HOST])
23208abc0ccfSmrg [case $host_os in
23218abc0ccfSmrg	mingw*)	unixdef="no"   ;;
23228abc0ccfSmrg	*)	unixdef="yes"  ;;
23238abc0ccfSmrg esac]
23248abc0ccfSmrg AC_ARG_ENABLE(unix-transport,
23259a011757Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
23268abc0ccfSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
23278abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
23288abc0ccfSmrg if test "$UNIXCONN" = "yes"; then
23298abc0ccfSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
23308abc0ccfSmrg fi
23318abc0ccfSmrg AC_MSG_RESULT($UNIXCONN)
23328abc0ccfSmrg AC_ARG_ENABLE(tcp-transport,
23339a011757Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
23348abc0ccfSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
23358abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
23368abc0ccfSmrg AC_MSG_RESULT($TCPCONN)
23378abc0ccfSmrg if test "$TCPCONN" = "yes"; then
23388abc0ccfSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
23398abc0ccfSmrg	XTRANS_TCP_FLAGS
23408abc0ccfSmrg fi
23418abc0ccfSmrg [case $host_os in
23428abc0ccfSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
23438abc0ccfSmrg	*)			localdef="no"  ;;
23448abc0ccfSmrg esac]
23458abc0ccfSmrg AC_ARG_ENABLE(local-transport,
23469a011757Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
23478abc0ccfSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
23488abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
23498abc0ccfSmrg AC_MSG_RESULT($LOCALCONN)
23508abc0ccfSmrg if test "$LOCALCONN" = "yes"; then
23518abc0ccfSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
23528abc0ccfSmrg fi
23538abc0ccfSmrg
23540d22642bSmrg # Other functions Xtrans may need
23550d22642bSmrg AC_CHECK_FUNCS([strcasecmp strlcpy])
23560d22642bSmrg
23578abc0ccfSmrg]) # XTRANS_CONNECTION_FLAGS
23588abc0ccfSmrg
23598abc0ccfSmrg
23608abc0ccfSmrg# XTRANS_SECURE_RPC_FLAGS()
23618abc0ccfSmrg# -------------------------
23628abc0ccfSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
23638abc0ccfSmrg# so that any necessary networking libraries are already found
23648abc0ccfSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
23658abc0ccfSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
23668abc0ccfSmrg AC_ARG_ENABLE(secure-rpc,
23679a011757Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
23688abc0ccfSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
23698abc0ccfSmrg
23708abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
23718abc0ccfSmrg	FOUND_SECURE_RPC="no"
23728abc0ccfSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
23738abc0ccfSmrg			[FOUND_SECURE_RPC="yes"])
23748abc0ccfSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
23758abc0ccfSmrg		if test "x$SECURE_RPC" = "xyes" ; then
23768abc0ccfSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
23778abc0ccfSmrg		fi
23788abc0ccfSmrg		SECURE_RPC="no"
23798abc0ccfSmrg	else
23808abc0ccfSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
23818abc0ccfSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
23828abc0ccfSmrg		SECURE_RPC="yes"
23838abc0ccfSmrg	fi
23848abc0ccfSmrg fi
23858abc0ccfSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
23868abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" ; then
23878abc0ccfSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
23888abc0ccfSmrg fi
23898abc0ccfSmrg AC_MSG_RESULT($SECURE_RPC)
23908abc0ccfSmrg]) # XTRANS_SECURE_RPC_FLAGS
23918abc0ccfSmrg
23928abc0ccfSmrg
23930d22642bSmrg# Copyright (C) 2002-2020 Free Software Foundation, Inc.
23948abc0ccfSmrg#
23958abc0ccfSmrg# This file is free software; the Free Software Foundation
23968abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
23978abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
23988abc0ccfSmrg
23998abc0ccfSmrg# AM_AUTOMAKE_VERSION(VERSION)
24008abc0ccfSmrg# ----------------------------
24018abc0ccfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
24028abc0ccfSmrg# generated from the m4 files accompanying Automake X.Y.
24038abc0ccfSmrg# (This private macro should not be called outside this file.)
24048abc0ccfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
24056c3c2bceSmrg[am__api_version='1.16'
24068abc0ccfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
24078abc0ccfSmrgdnl require some minimum version.  Point them to the right macro.
24080d22642bSmrgm4_if([$1], [1.16.3], [],
24098abc0ccfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
24108abc0ccfSmrg])
24118abc0ccfSmrg
24128abc0ccfSmrg# _AM_AUTOCONF_VERSION(VERSION)
24138abc0ccfSmrg# -----------------------------
24148abc0ccfSmrg# aclocal traces this macro to find the Autoconf version.
24158abc0ccfSmrg# This is a private macro too.  Using m4_define simplifies
24168abc0ccfSmrg# the logic in aclocal, which can simply ignore this definition.
24178abc0ccfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
24188abc0ccfSmrg
24198abc0ccfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
24208abc0ccfSmrg# -------------------------------
24218abc0ccfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
24228abc0ccfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
24238abc0ccfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
24240d22642bSmrg[AM_AUTOMAKE_VERSION([1.16.3])dnl
24258abc0ccfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
24268abc0ccfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
24278abc0ccfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
24288abc0ccfSmrg
24298abc0ccfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
24308abc0ccfSmrg
24310d22642bSmrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
243296402570Smrg#
24338abc0ccfSmrg# This file is free software; the Free Software Foundation
24348abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
24358abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
243696402570Smrg
24378abc0ccfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
24388abc0ccfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
24398abc0ccfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
24402852888eSmrg#
24418abc0ccfSmrg# Of course, Automake must honor this variable whenever it calls a
24428abc0ccfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
24438abc0ccfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
24448abc0ccfSmrg# depending on how configure is run.  This is pretty annoying, since
24458abc0ccfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
24468abc0ccfSmrg# source directory, any form will work fine, but in subdirectories a
24478abc0ccfSmrg# relative path needs to be adjusted first.
24482852888eSmrg#
24498abc0ccfSmrg# $ac_aux_dir/missing
24508abc0ccfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
24518abc0ccfSmrg# $top_srcdir/$ac_aux_dir/missing
24528abc0ccfSmrg#    fails if $ac_aux_dir is absolute,
24538abc0ccfSmrg#    fails when called from a subdirectory in a VPATH build with
24548abc0ccfSmrg#          a relative $ac_aux_dir
24552852888eSmrg#
24568abc0ccfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
24578abc0ccfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
24588abc0ccfSmrg# harmless because $srcdir is '.', but things will broke when you
24598abc0ccfSmrg# start a VPATH build or use an absolute $srcdir.
246096402570Smrg#
24618abc0ccfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
24628abc0ccfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
24638abc0ccfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
24648abc0ccfSmrg# and then we would define $MISSING as
24658abc0ccfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
24668abc0ccfSmrg# This will work as long as MISSING is not called from configure, because
24678abc0ccfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
24688abc0ccfSmrg# However there are other variables, like CC, which are often used in
24698abc0ccfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
24702852888eSmrg#
24718abc0ccfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
24728abc0ccfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
24738abc0ccfSmrg# configured tree to be moved without reconfiguration.
24742852888eSmrg
24758abc0ccfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
247640c5344fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
247740c5344fSmrg# Expand $ac_aux_dir to an absolute path.
247840c5344fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
24798abc0ccfSmrg])
24802852888eSmrg
24818abc0ccfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
24822852888eSmrg
24830d22642bSmrg# Copyright (C) 1997-2020 Free Software Foundation, Inc.
24848abc0ccfSmrg#
24858abc0ccfSmrg# This file is free software; the Free Software Foundation
24868abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
24878abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
24882852888eSmrg
24898abc0ccfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
24908abc0ccfSmrg# -------------------------------------
24918abc0ccfSmrg# Define a conditional.
24928abc0ccfSmrgAC_DEFUN([AM_CONDITIONAL],
24938abc0ccfSmrg[AC_PREREQ([2.52])dnl
24948abc0ccfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
24958abc0ccfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
24968abc0ccfSmrgAC_SUBST([$1_TRUE])dnl
24978abc0ccfSmrgAC_SUBST([$1_FALSE])dnl
24988abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
24998abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
25008abc0ccfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
25018abc0ccfSmrgif $2; then
25028abc0ccfSmrg  $1_TRUE=
25038abc0ccfSmrg  $1_FALSE='#'
25048abc0ccfSmrgelse
25058abc0ccfSmrg  $1_TRUE='#'
25068abc0ccfSmrg  $1_FALSE=
25078abc0ccfSmrgfi
25088abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
25098abc0ccfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
25108abc0ccfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
25118abc0ccfSmrgUsually this means the macro was only invoked conditionally.]])
25128abc0ccfSmrgfi])])
25132852888eSmrg
25140d22642bSmrg# Copyright (C) 1999-2020 Free Software Foundation, Inc.
25152852888eSmrg#
25168abc0ccfSmrg# This file is free software; the Free Software Foundation
25178abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
25188abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
25198abc0ccfSmrg
25208abc0ccfSmrg
25218abc0ccfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
25228abc0ccfSmrg# written in clear, in which case automake, when reading aclocal.m4,
25238abc0ccfSmrg# will think it sees a *use*, and therefore will trigger all it's
25248abc0ccfSmrg# C support machinery.  Also note that it means that autoscan, seeing
25258abc0ccfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
25268abc0ccfSmrg
25278abc0ccfSmrg
25288abc0ccfSmrg# _AM_DEPENDENCIES(NAME)
25298abc0ccfSmrg# ----------------------
25308abc0ccfSmrg# See how the compiler implements dependency checking.
25318abc0ccfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
25328abc0ccfSmrg# We try a few techniques and use that to set a single cache variable.
253396402570Smrg#
25348abc0ccfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
25358abc0ccfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
25368abc0ccfSmrg# dependency, and given that the user is not expected to run this macro,
25378abc0ccfSmrg# just rely on AC_PROG_CC.
25388abc0ccfSmrgAC_DEFUN([_AM_DEPENDENCIES],
25398abc0ccfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
25408abc0ccfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
25418abc0ccfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
25428abc0ccfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
25438abc0ccfSmrg
25448abc0ccfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
25458abc0ccfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
25468abc0ccfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
25478abc0ccfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
25488abc0ccfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
25498abc0ccfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
25508abc0ccfSmrg                    [depcc="$$1"   am_compiler_list=])
25518abc0ccfSmrg
25528abc0ccfSmrgAC_CACHE_CHECK([dependency style of $depcc],
25538abc0ccfSmrg               [am_cv_$1_dependencies_compiler_type],
25548abc0ccfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
25558abc0ccfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
25568abc0ccfSmrg  # making bogus files that we don't know about and never remove.  For
25578abc0ccfSmrg  # instance it was reported that on HP-UX the gcc test will end up
25588abc0ccfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
25598abc0ccfSmrg  # in D".
25608abc0ccfSmrg  rm -rf conftest.dir
25618abc0ccfSmrg  mkdir conftest.dir
25628abc0ccfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
25638abc0ccfSmrg  # using a relative directory.
25648abc0ccfSmrg  cp "$am_depcomp" conftest.dir
25658abc0ccfSmrg  cd conftest.dir
25668abc0ccfSmrg  # We will build objects and dependencies in a subdirectory because
25678abc0ccfSmrg  # it helps to detect inapplicable dependency modes.  For instance
25688abc0ccfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
25698abc0ccfSmrg  # side effect of compilation, but ICC will put the dependencies in
25708abc0ccfSmrg  # the current directory while Tru64 will put them in the object
25718abc0ccfSmrg  # directory.
25728abc0ccfSmrg  mkdir sub
25738abc0ccfSmrg
25748abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
25758abc0ccfSmrg  if test "$am_compiler_list" = ""; then
25768abc0ccfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
25772852888eSmrg  fi
25788abc0ccfSmrg  am__universal=false
25798abc0ccfSmrg  m4_case([$1], [CC],
25808abc0ccfSmrg    [case " $depcc " in #(
25818abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
25828abc0ccfSmrg     esac],
25838abc0ccfSmrg    [CXX],
25848abc0ccfSmrg    [case " $depcc " in #(
25858abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
25868abc0ccfSmrg     esac])
25878abc0ccfSmrg
25888abc0ccfSmrg  for depmode in $am_compiler_list; do
25898abc0ccfSmrg    # Setup a source with many dependencies, because some compilers
25908abc0ccfSmrg    # like to wrap large dependency lists on column 80 (with \), and
25918abc0ccfSmrg    # we should not choose a depcomp mode which is confused by this.
25928abc0ccfSmrg    #
25938abc0ccfSmrg    # We need to recreate these files for each test, as the compiler may
25948abc0ccfSmrg    # overwrite some of them when testing with obscure command lines.
25958abc0ccfSmrg    # This happens at least with the AIX C compiler.
25968abc0ccfSmrg    : > sub/conftest.c
25978abc0ccfSmrg    for i in 1 2 3 4 5 6; do
25988abc0ccfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
25998abc0ccfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
26008abc0ccfSmrg      # Solaris 10 /bin/sh.
26018abc0ccfSmrg      echo '/* dummy */' > sub/conftst$i.h
26028abc0ccfSmrg    done
26038abc0ccfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
26048abc0ccfSmrg
26058abc0ccfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
26068abc0ccfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
26078abc0ccfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
26088abc0ccfSmrg    # versions had trouble with output in subdirs.
26098abc0ccfSmrg    am__obj=sub/conftest.${OBJEXT-o}
26108abc0ccfSmrg    am__minus_obj="-o $am__obj"
26118abc0ccfSmrg    case $depmode in
26128abc0ccfSmrg    gcc)
26138abc0ccfSmrg      # This depmode causes a compiler race in universal mode.
26148abc0ccfSmrg      test "$am__universal" = false || continue
26158abc0ccfSmrg      ;;
26168abc0ccfSmrg    nosideeffect)
26178abc0ccfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
26188abc0ccfSmrg      # only be used when explicitly requested.
26198abc0ccfSmrg      if test "x$enable_dependency_tracking" = xyes; then
26208abc0ccfSmrg	continue
26218abc0ccfSmrg      else
26228abc0ccfSmrg	break
26238abc0ccfSmrg      fi
26248abc0ccfSmrg      ;;
26258abc0ccfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
26268abc0ccfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
26278abc0ccfSmrg      # not run yet.  These depmodes are late enough in the game, and
26288abc0ccfSmrg      # so weak that their functioning should not be impacted.
26298abc0ccfSmrg      am__obj=conftest.${OBJEXT-o}
26308abc0ccfSmrg      am__minus_obj=
26318abc0ccfSmrg      ;;
26328abc0ccfSmrg    none) break ;;
26338abc0ccfSmrg    esac
26348abc0ccfSmrg    if depmode=$depmode \
26358abc0ccfSmrg       source=sub/conftest.c object=$am__obj \
26368abc0ccfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26378abc0ccfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26388abc0ccfSmrg         >/dev/null 2>conftest.err &&
26398abc0ccfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
26408abc0ccfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
26418abc0ccfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
26428abc0ccfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
26438abc0ccfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
26448abc0ccfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
26458abc0ccfSmrg      # that says an option was ignored or not supported.
26468abc0ccfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
26478abc0ccfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
26488abc0ccfSmrg      # The diagnosis changed in icc 8.0:
26498abc0ccfSmrg      #   icc: Command line remark: option '-MP' not supported
26508abc0ccfSmrg      if (grep 'ignoring option' conftest.err ||
26518abc0ccfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
26528abc0ccfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
26538abc0ccfSmrg        break
26548abc0ccfSmrg      fi
26558abc0ccfSmrg    fi
26568abc0ccfSmrg  done
26572852888eSmrg
26588abc0ccfSmrg  cd ..
26598abc0ccfSmrg  rm -rf conftest.dir
26602852888eSmrgelse
26618abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
26622852888eSmrgfi
26638abc0ccfSmrg])
26648abc0ccfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
26658abc0ccfSmrgAM_CONDITIONAL([am__fastdep$1], [
26668abc0ccfSmrg  test "x$enable_dependency_tracking" != xno \
26678abc0ccfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
26688abc0ccfSmrg])
26692852888eSmrg
267096402570Smrg
26718abc0ccfSmrg# AM_SET_DEPDIR
26728abc0ccfSmrg# -------------
26738abc0ccfSmrg# Choose a directory name for dependency files.
26748abc0ccfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
26758abc0ccfSmrgAC_DEFUN([AM_SET_DEPDIR],
26768abc0ccfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
26778abc0ccfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
26788abc0ccfSmrg])
267996402570Smrg
268096402570Smrg
26818abc0ccfSmrg# AM_DEP_TRACK
26828abc0ccfSmrg# ------------
26838abc0ccfSmrgAC_DEFUN([AM_DEP_TRACK],
26848abc0ccfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
26858abc0ccfSmrgAS_HELP_STRING(
26868abc0ccfSmrg  [--enable-dependency-tracking],
26878abc0ccfSmrg  [do not reject slow dependency extractors])
26888abc0ccfSmrgAS_HELP_STRING(
26898abc0ccfSmrg  [--disable-dependency-tracking],
26908abc0ccfSmrg  [speeds up one-time build])])
26918abc0ccfSmrgif test "x$enable_dependency_tracking" != xno; then
26928abc0ccfSmrg  am_depcomp="$ac_aux_dir/depcomp"
26938abc0ccfSmrg  AMDEPBACKSLASH='\'
26948abc0ccfSmrg  am__nodep='_no'
269596402570Smrgfi
26968abc0ccfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
26978abc0ccfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
26988abc0ccfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
26998abc0ccfSmrgAC_SUBST([am__nodep])dnl
27008abc0ccfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
27018abc0ccfSmrg])
270296402570Smrg
27038abc0ccfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
270496402570Smrg
27050d22642bSmrg# Copyright (C) 1999-2020 Free Software Foundation, Inc.
27067a0395d0Smrg#
27078abc0ccfSmrg# This file is free software; the Free Software Foundation
27088abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
27098abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
27107a0395d0Smrg
27118abc0ccfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
27128abc0ccfSmrg# ------------------------------
27138abc0ccfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
27148abc0ccfSmrg[{
27159a011757Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
27168abc0ccfSmrg  # are listed without --file.  Let's play safe and only enable the eval
27178abc0ccfSmrg  # if we detect the quoting.
27186c3c2bceSmrg  # TODO: see whether this extra hack can be removed once we start
27196c3c2bceSmrg  # requiring Autoconf 2.70 or later.
27206c3c2bceSmrg  AS_CASE([$CONFIG_FILES],
27216c3c2bceSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
27226c3c2bceSmrg          [*], [set x $CONFIG_FILES])
27238abc0ccfSmrg  shift
27246c3c2bceSmrg  # Used to flag and report bootstrapping failures.
27256c3c2bceSmrg  am_rc=0
27266c3c2bceSmrg  for am_mf
27278abc0ccfSmrg  do
27288abc0ccfSmrg    # Strip MF so we end up with the name of the file.
27296c3c2bceSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
27306c3c2bceSmrg    # Check whether this is an Automake generated Makefile which includes
27316c3c2bceSmrg    # dependency-tracking related rules and includes.
27326c3c2bceSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
27338abc0ccfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
27346c3c2bceSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
27356c3c2bceSmrg      || continue
27366c3c2bceSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
27376c3c2bceSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
27386c3c2bceSmrg    AM_RUN_LOG([cd "$am_dirpart" \
27396c3c2bceSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
27406c3c2bceSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
27418abc0ccfSmrg  done
27426c3c2bceSmrg  if test $am_rc -ne 0; then
27436c3c2bceSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
27440d22642bSmrg    for automatic dependency tracking.  If GNU make was not used, consider
27450d22642bSmrg    re-running the configure script with MAKE="gmake" (or whatever is
27460d22642bSmrg    necessary).  You can also try re-running configure with the
27476c3c2bceSmrg    '--disable-dependency-tracking' option to at least be able to build
27486c3c2bceSmrg    the package (albeit without support for automatic dependency tracking).])
27496c3c2bceSmrg  fi
27506c3c2bceSmrg  AS_UNSET([am_dirpart])
27516c3c2bceSmrg  AS_UNSET([am_filepart])
27526c3c2bceSmrg  AS_UNSET([am_mf])
27536c3c2bceSmrg  AS_UNSET([am_rc])
27546c3c2bceSmrg  rm -f conftest-deps.mk
27558abc0ccfSmrg}
27568abc0ccfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
27577a0395d0Smrg
27587a0395d0Smrg
27598abc0ccfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
27608abc0ccfSmrg# -----------------------------
27618abc0ccfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
27622adc0320Smrg#
27636c3c2bceSmrg# This code is only required when automatic dependency tracking is enabled.
27646c3c2bceSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
27656c3c2bceSmrg# order to bootstrap the dependency handling code.
27668abc0ccfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
27678abc0ccfSmrg[AC_CONFIG_COMMANDS([depfiles],
27688abc0ccfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
27696c3c2bceSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
27708abc0ccfSmrg
27718abc0ccfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
27728abc0ccfSmrg
27730d22642bSmrg# Copyright (C) 1996-2020 Free Software Foundation, Inc.
27747366012aSmrg#
27758abc0ccfSmrg# This file is free software; the Free Software Foundation
27768abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
27778abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
27787a0395d0Smrg
27798abc0ccfSmrg# This macro actually does too much.  Some checks are only needed if
27808abc0ccfSmrg# your package does certain things.  But this isn't really a big deal.
27812adc0320Smrg
278240c5344fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
278340c5344fSmrgm4_define([AC_PROG_CC],
278440c5344fSmrgm4_defn([AC_PROG_CC])
278540c5344fSmrg[_AM_PROG_CC_C_O
278640c5344fSmrg])
278740c5344fSmrg
27888abc0ccfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
27898abc0ccfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
27908abc0ccfSmrg# -----------------------------------------------
27918abc0ccfSmrg# The call with PACKAGE and VERSION arguments is the old style
27928abc0ccfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
27938abc0ccfSmrg# and VERSION should now be passed to AC_INIT and removed from
27948abc0ccfSmrg# the call to AM_INIT_AUTOMAKE.
27958abc0ccfSmrg# We support both call styles for the transition.  After
27968abc0ccfSmrg# the next Automake release, Autoconf can make the AC_INIT
27978abc0ccfSmrg# arguments mandatory, and then we can depend on a new Autoconf
27988abc0ccfSmrg# release and drop the old call support.
27998abc0ccfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
28009a011757Smrg[AC_PREREQ([2.65])dnl
28018abc0ccfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
28028abc0ccfSmrgdnl the ones we care about.
28038abc0ccfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
28048abc0ccfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
28058abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
28068abc0ccfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
28078abc0ccfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
28088abc0ccfSmrg  # is not polluted with repeated "-I."
28098abc0ccfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
28108abc0ccfSmrg  # test to see if srcdir already configured
28118abc0ccfSmrg  if test -f $srcdir/config.status; then
28128abc0ccfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
28138abc0ccfSmrg  fi
28147366012aSmrgfi
28152adc0320Smrg
28168abc0ccfSmrg# test whether we have cygpath
28178abc0ccfSmrgif test -z "$CYGPATH_W"; then
28188abc0ccfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
28198abc0ccfSmrg    CYGPATH_W='cygpath -w'
28208abc0ccfSmrg  else
28218abc0ccfSmrg    CYGPATH_W=echo
28228abc0ccfSmrg  fi
28237366012aSmrgfi
28248abc0ccfSmrgAC_SUBST([CYGPATH_W])
28257a0395d0Smrg
28268abc0ccfSmrg# Define the identity of the package.
28278abc0ccfSmrgdnl Distinguish between old-style and new-style calls.
28288abc0ccfSmrgm4_ifval([$2],
28298abc0ccfSmrg[AC_DIAGNOSE([obsolete],
28309a011757Smrg             [$0: two- and three-arguments forms are deprecated.])
28318abc0ccfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
28328abc0ccfSmrg AC_SUBST([PACKAGE], [$1])dnl
28338abc0ccfSmrg AC_SUBST([VERSION], [$2])],
28348abc0ccfSmrg[_AM_SET_OPTIONS([$1])dnl
28358abc0ccfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
28368abc0ccfSmrgm4_if(
28378abc0ccfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
28388abc0ccfSmrg  [ok:ok],,
28398abc0ccfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
28408abc0ccfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
28418abc0ccfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
28422adc0320Smrg
28438abc0ccfSmrg_AM_IF_OPTION([no-define],,
28448abc0ccfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
28458abc0ccfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
28462adc0320Smrg
28478abc0ccfSmrg# Some tools Automake needs.
28488abc0ccfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
28498abc0ccfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
28508abc0ccfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
28518abc0ccfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
28528abc0ccfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
28538abc0ccfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
28548abc0ccfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
28558abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
28568abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
28578abc0ccfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
28588abc0ccfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
28598abc0ccfSmrg# dies out for good.  For more background, see:
28606c3c2bceSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
28616c3c2bceSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
28628abc0ccfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
286340c5344fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
286440c5344fSmrg# system "awk" is bad on some platforms.
28658abc0ccfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
28668abc0ccfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
28678abc0ccfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
28688abc0ccfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
28698abc0ccfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
28708abc0ccfSmrg			     [_AM_PROG_TAR([v7])])])
28718abc0ccfSmrg_AM_IF_OPTION([no-dependencies],,
28728abc0ccfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
28738abc0ccfSmrg		  [_AM_DEPENDENCIES([CC])],
28748abc0ccfSmrg		  [m4_define([AC_PROG_CC],
28758abc0ccfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
28768abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
28778abc0ccfSmrg		  [_AM_DEPENDENCIES([CXX])],
28788abc0ccfSmrg		  [m4_define([AC_PROG_CXX],
28798abc0ccfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
28808abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
28818abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJC])],
28828abc0ccfSmrg		  [m4_define([AC_PROG_OBJC],
28838abc0ccfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
28849a011757SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
28858abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
28868abc0ccfSmrg		  [m4_define([AC_PROG_OBJCXX],
28879a011757Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
28888abc0ccfSmrg])
28899a011757SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
28909a011757Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
28919a011757Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
28929a011757Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
28938abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(dnl
28948abc0ccfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
28958abc0ccfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
289640c5344fSmrg
289740c5344fSmrg# POSIX will say in a future version that running "rm -f" with no argument
289840c5344fSmrg# is OK; and we want to be able to make that assumption in our Makefile
289940c5344fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
290040c5344fSmrg# actually supported "in the wild" to an acceptable degree.
290140c5344fSmrg# See automake bug#10828.
290240c5344fSmrg# To make any issue more visible, cause the running configure to be aborted
290340c5344fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
290440c5344fSmrg# user can still override this though.
290540c5344fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
290640c5344fSmrg  cat >&2 <<'END'
290740c5344fSmrgOops!
290840c5344fSmrg
290940c5344fSmrgYour 'rm' program seems unable to run without file operands specified
291040c5344fSmrgon the command line, even when the '-f' option is present.  This is contrary
291140c5344fSmrgto the behaviour of most rm programs out there, and not conforming with
291240c5344fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
291340c5344fSmrg
291440c5344fSmrgPlease tell bug-automake@gnu.org about your system, including the value
291540c5344fSmrgof your $PATH and any error possibly output before this message.  This
291640c5344fSmrgcan help us improve future automake versions.
291740c5344fSmrg
291840c5344fSmrgEND
291940c5344fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
292040c5344fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
292140c5344fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
292240c5344fSmrg    echo >&2
292340c5344fSmrg  else
292440c5344fSmrg    cat >&2 <<'END'
292540c5344fSmrgAborting the configuration process, to ensure you take notice of the issue.
292640c5344fSmrg
292740c5344fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
29286c3c2bceSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
292940c5344fSmrg
293040c5344fSmrgIf you want to complete the configuration process using your problematic
293140c5344fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
293240c5344fSmrgto "yes", and re-run configure.
293340c5344fSmrg
293440c5344fSmrgEND
293540c5344fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
293640c5344fSmrg  fi
293740c5344fSmrgfi
293840c5344fSmrgdnl The trailing newline in this macro's definition is deliberate, for
293940c5344fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
294040c5344fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
29418abc0ccfSmrg])
29427a0395d0Smrg
29438abc0ccfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
29448abc0ccfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
29458abc0ccfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
29468abc0ccfSmrgm4_define([_AC_COMPILER_EXEEXT],
29478abc0ccfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
29487a0395d0Smrg
29498abc0ccfSmrg# When config.status generates a header, we must update the stamp-h file.
29508abc0ccfSmrg# This file resides in the same directory as the config header
29518abc0ccfSmrg# that is generated.  The stamp files are numbered to have different names.
295296402570Smrg
29538abc0ccfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
29548abc0ccfSmrg# loop where config.status creates the headers, so we can generate
29558abc0ccfSmrg# our stamp files there.
29568abc0ccfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
29578abc0ccfSmrg[# Compute $1's index in $config_headers.
29588abc0ccfSmrg_am_arg=$1
29598abc0ccfSmrg_am_stamp_count=1
29608abc0ccfSmrgfor _am_header in $config_headers :; do
29618abc0ccfSmrg  case $_am_header in
29628abc0ccfSmrg    $_am_arg | $_am_arg:* )
29638abc0ccfSmrg      break ;;
29648abc0ccfSmrg    * )
29658abc0ccfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
29668abc0ccfSmrg  esac
29678abc0ccfSmrgdone
29688abc0ccfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
296996402570Smrg
29700d22642bSmrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
29718abc0ccfSmrg#
29728abc0ccfSmrg# This file is free software; the Free Software Foundation
29738abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29748abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
297596402570Smrg
29768abc0ccfSmrg# AM_PROG_INSTALL_SH
29778abc0ccfSmrg# ------------------
29788abc0ccfSmrg# Define $install_sh.
29798abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
29808abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
298140c5344fSmrgif test x"${install_sh+set}" != xset; then
29828abc0ccfSmrg  case $am_aux_dir in
29838abc0ccfSmrg  *\ * | *\	*)
29848abc0ccfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
29858abc0ccfSmrg  *)
29868abc0ccfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
29878abc0ccfSmrg  esac
298896402570Smrgfi
29898abc0ccfSmrgAC_SUBST([install_sh])])
299096402570Smrg
29910d22642bSmrg# Copyright (C) 2003-2020 Free Software Foundation, Inc.
29928abc0ccfSmrg#
29938abc0ccfSmrg# This file is free software; the Free Software Foundation
29948abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29958abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
29968abc0ccfSmrg
29978abc0ccfSmrg# Check whether the underlying file-system supports filenames
29988abc0ccfSmrg# with a leading dot.  For instance MS-DOS doesn't.
29998abc0ccfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
30008abc0ccfSmrg[rm -rf .tst 2>/dev/null
30018abc0ccfSmrgmkdir .tst 2>/dev/null
30028abc0ccfSmrgif test -d .tst; then
30038abc0ccfSmrg  am__leading_dot=.
30048abc0ccfSmrgelse
30058abc0ccfSmrg  am__leading_dot=_
300696402570Smrgfi
30078abc0ccfSmrgrmdir .tst 2>/dev/null
30088abc0ccfSmrgAC_SUBST([am__leading_dot])])
300996402570Smrg
30108abc0ccfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
301196402570Smrg
30120d22642bSmrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
301396402570Smrg#
30148abc0ccfSmrg# This file is free software; the Free Software Foundation
30158abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30168abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
301796402570Smrg
30188abc0ccfSmrg# AM_MAKE_INCLUDE()
30198abc0ccfSmrg# -----------------
30206c3c2bceSmrg# Check whether make has an 'include' directive that can support all
30216c3c2bceSmrg# the idioms we need for our automatic dependency tracking code.
30228abc0ccfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
30236c3c2bceSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
30246c3c2bceSmrgcat > confinc.mk << 'END'
30258abc0ccfSmrgam__doit:
30266c3c2bceSmrg	@echo this is the am__doit target >confinc.out
30278abc0ccfSmrg.PHONY: am__doit
30288abc0ccfSmrgEND
30298abc0ccfSmrgam__include="#"
30308abc0ccfSmrgam__quote=
30316c3c2bceSmrg# BSD make does it like this.
30326c3c2bceSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
30336c3c2bceSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
30346c3c2bceSmrgecho 'include confinc.mk # ignored' > confmf.GNU
30356c3c2bceSmrg_am_result=no
30366c3c2bceSmrgfor s in GNU BSD; do
30376c3c2bceSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
30386c3c2bceSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
30396c3c2bceSmrg      ['0:this is the am__doit target'],
30406c3c2bceSmrg      [AS_CASE([$s],
30416c3c2bceSmrg          [BSD], [am__include='.include' am__quote='"'],
30426c3c2bceSmrg          [am__include='include' am__quote=''])])
30436c3c2bceSmrg  if test "$am__include" != "#"; then
30446c3c2bceSmrg    _am_result="yes ($s style)"
30456c3c2bceSmrg    break
30466c3c2bceSmrg  fi
30476c3c2bceSmrgdone
30486c3c2bceSmrgrm -f confinc.* confmf.*
30496c3c2bceSmrgAC_MSG_RESULT([${_am_result}])
30506c3c2bceSmrgAC_SUBST([am__include])])
30516c3c2bceSmrgAC_SUBST([am__quote])])
305296402570Smrg
30538abc0ccfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
305496402570Smrg
30550d22642bSmrg# Copyright (C) 1997-2020 Free Software Foundation, Inc.
30568abc0ccfSmrg#
30578abc0ccfSmrg# This file is free software; the Free Software Foundation
30588abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30598abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
306096402570Smrg
30618abc0ccfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
30628abc0ccfSmrg# ------------------------------
30638abc0ccfSmrgAC_DEFUN([AM_MISSING_PROG],
30648abc0ccfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
30658abc0ccfSmrg$1=${$1-"${am_missing_run}$2"}
30668abc0ccfSmrgAC_SUBST($1)])
306796402570Smrg
30688abc0ccfSmrg# AM_MISSING_HAS_RUN
30698abc0ccfSmrg# ------------------
30709a011757Smrg# Define MISSING if not defined so far and test if it is modern enough.
30719a011757Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
30728abc0ccfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
30738abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30748abc0ccfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
30758abc0ccfSmrgif test x"${MISSING+set}" != xset; then
30760d22642bSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
30778abc0ccfSmrgfi
30788abc0ccfSmrg# Use eval to expand $SHELL
30799a011757Smrgif eval "$MISSING --is-lightweight"; then
30809a011757Smrg  am_missing_run="$MISSING "
308196402570Smrgelse
30828abc0ccfSmrg  am_missing_run=
30838abc0ccfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
308496402570Smrgfi
30858abc0ccfSmrg])
308696402570Smrg
30878abc0ccfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
308896402570Smrg
30890d22642bSmrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
30907366012aSmrg#
30918abc0ccfSmrg# This file is free software; the Free Software Foundation
30928abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30938abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
30947366012aSmrg
30958abc0ccfSmrg# _AM_MANGLE_OPTION(NAME)
30967366012aSmrg# -----------------------
30978abc0ccfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
30988abc0ccfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
30997366012aSmrg
31008abc0ccfSmrg# _AM_SET_OPTION(NAME)
31018abc0ccfSmrg# --------------------
31028abc0ccfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
31038abc0ccfSmrgAC_DEFUN([_AM_SET_OPTION],
31048abc0ccfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
310596402570Smrg
31068abc0ccfSmrg# _AM_SET_OPTIONS(OPTIONS)
31078abc0ccfSmrg# ------------------------
31088abc0ccfSmrg# OPTIONS is a space-separated list of Automake options.
31098abc0ccfSmrgAC_DEFUN([_AM_SET_OPTIONS],
31108abc0ccfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
311196402570Smrg
31128abc0ccfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
31138abc0ccfSmrg# -------------------------------------------
31148abc0ccfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
31158abc0ccfSmrgAC_DEFUN([_AM_IF_OPTION],
31168abc0ccfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
311796402570Smrg
31180d22642bSmrg# Copyright (C) 1999-2020 Free Software Foundation, Inc.
311940c5344fSmrg#
312040c5344fSmrg# This file is free software; the Free Software Foundation
312140c5344fSmrg# gives unlimited permission to copy and/or distribute it,
312240c5344fSmrg# with or without modifications, as long as this notice is preserved.
312340c5344fSmrg
312440c5344fSmrg# _AM_PROG_CC_C_O
312540c5344fSmrg# ---------------
312640c5344fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
312740c5344fSmrg# to automatically call this.
312840c5344fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
312940c5344fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
313040c5344fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
313140c5344fSmrgAC_LANG_PUSH([C])dnl
313240c5344fSmrgAC_CACHE_CHECK(
313340c5344fSmrg  [whether $CC understands -c and -o together],
313440c5344fSmrg  [am_cv_prog_cc_c_o],
313540c5344fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
313640c5344fSmrg  # Make sure it works both with $CC and with simple cc.
313740c5344fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
313840c5344fSmrg  # compilers refuse to overwrite an existing .o file with -o,
313940c5344fSmrg  # though they will create one.
314040c5344fSmrg  am_cv_prog_cc_c_o=yes
314140c5344fSmrg  for am_i in 1 2; do
314240c5344fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
314340c5344fSmrg         && test -f conftest2.$ac_objext; then
314440c5344fSmrg      : OK
314540c5344fSmrg    else
314640c5344fSmrg      am_cv_prog_cc_c_o=no
314740c5344fSmrg      break
314840c5344fSmrg    fi
314940c5344fSmrg  done
315040c5344fSmrg  rm -f core conftest*
315140c5344fSmrg  unset am_i])
315240c5344fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
315340c5344fSmrg   # Losing compiler, so override with the script.
315440c5344fSmrg   # FIXME: It is wrong to rewrite CC.
315540c5344fSmrg   # But if we don't then we get into trouble of one sort or another.
315640c5344fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
315740c5344fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
315840c5344fSmrg   CC="$am_aux_dir/compile $CC"
315940c5344fSmrgfi
316040c5344fSmrgAC_LANG_POP([C])])
316140c5344fSmrg
316240c5344fSmrg# For backward compatibility.
316340c5344fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
316440c5344fSmrg
31650d22642bSmrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
316640c5344fSmrg#
316740c5344fSmrg# This file is free software; the Free Software Foundation
316840c5344fSmrg# gives unlimited permission to copy and/or distribute it,
316940c5344fSmrg# with or without modifications, as long as this notice is preserved.
317040c5344fSmrg
317140c5344fSmrg# AM_RUN_LOG(COMMAND)
317240c5344fSmrg# -------------------
317340c5344fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
317440c5344fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
317540c5344fSmrgAC_DEFUN([AM_RUN_LOG],
317640c5344fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
317740c5344fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
317840c5344fSmrg   ac_status=$?
317940c5344fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
318040c5344fSmrg   (exit $ac_status); }])
318140c5344fSmrg
31828abc0ccfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
318396402570Smrg
31840d22642bSmrg# Copyright (C) 1996-2020 Free Software Foundation, Inc.
31858abc0ccfSmrg#
31868abc0ccfSmrg# This file is free software; the Free Software Foundation
31878abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31888abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
31898abc0ccfSmrg
31908abc0ccfSmrg# AM_SANITY_CHECK
31918abc0ccfSmrg# ---------------
31928abc0ccfSmrgAC_DEFUN([AM_SANITY_CHECK],
31938abc0ccfSmrg[AC_MSG_CHECKING([whether build environment is sane])
31948abc0ccfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
31958abc0ccfSmrg# name.  Accept space and tab only in the latter.
31968abc0ccfSmrgam_lf='
31978abc0ccfSmrg'
31988abc0ccfSmrgcase `pwd` in
31998abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
32008abc0ccfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
32018abc0ccfSmrgesac
32028abc0ccfSmrgcase $srcdir in
32038abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
32048abc0ccfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
32058abc0ccfSmrgesac
32068abc0ccfSmrg
32078abc0ccfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
32088abc0ccfSmrg# arguments.  Must try -L first in case configure is actually a
32098abc0ccfSmrg# symlink; some systems play weird games with the mod time of symlinks
32108abc0ccfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
32118abc0ccfSmrg# directory).
32128abc0ccfSmrgif (
32138abc0ccfSmrg   am_has_slept=no
32148abc0ccfSmrg   for am_try in 1 2; do
32158abc0ccfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
32168abc0ccfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
32178abc0ccfSmrg     if test "$[*]" = "X"; then
32188abc0ccfSmrg	# -L didn't work.
32198abc0ccfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
32208abc0ccfSmrg     fi
32218abc0ccfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
32228abc0ccfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
32238abc0ccfSmrg
32248abc0ccfSmrg	# If neither matched, then we have a broken ls.  This can happen
32258abc0ccfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
32268abc0ccfSmrg	# broken ls alias from the environment.  This has actually
32278abc0ccfSmrg	# happened.  Such a system could not be considered "sane".
32288abc0ccfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
32298abc0ccfSmrg  alias in your environment])
32308abc0ccfSmrg     fi
32318abc0ccfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
32328abc0ccfSmrg       break
32338abc0ccfSmrg     fi
32348abc0ccfSmrg     # Just in case.
32358abc0ccfSmrg     sleep 1
32368abc0ccfSmrg     am_has_slept=yes
32378abc0ccfSmrg   done
32388abc0ccfSmrg   test "$[2]" = conftest.file
32398abc0ccfSmrg   )
32408abc0ccfSmrgthen
32418abc0ccfSmrg   # Ok.
32428abc0ccfSmrg   :
32438abc0ccfSmrgelse
32448abc0ccfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
32458abc0ccfSmrgCheck your system clock])
32467a0395d0Smrgfi
32478abc0ccfSmrgAC_MSG_RESULT([yes])
32488abc0ccfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
32498abc0ccfSmrg# generated files are strictly newer.
32508abc0ccfSmrgam_sleep_pid=
32518abc0ccfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
32528abc0ccfSmrg  ( sleep 1 ) &
32538abc0ccfSmrg  am_sleep_pid=$!
32548abc0ccfSmrgfi
32558abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
32568abc0ccfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
32578abc0ccfSmrg   if test -n "$am_sleep_pid"; then
32588abc0ccfSmrg     # Hide warnings about reused PIDs.
32598abc0ccfSmrg     wait $am_sleep_pid 2>/dev/null
32608abc0ccfSmrg   fi
32618abc0ccfSmrg   AC_MSG_RESULT([done])])
32628abc0ccfSmrgrm -f conftest.file
32638abc0ccfSmrg])
32647366012aSmrg
32650d22642bSmrg# Copyright (C) 2009-2020 Free Software Foundation, Inc.
32667366012aSmrg#
32678abc0ccfSmrg# This file is free software; the Free Software Foundation
32688abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
32698abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
32702adc0320Smrg
32718abc0ccfSmrg# AM_SILENT_RULES([DEFAULT])
32728abc0ccfSmrg# --------------------------
32738abc0ccfSmrg# Enable less verbose build rules; with the default set to DEFAULT
32748abc0ccfSmrg# ("yes" being less verbose, "no" or empty being verbose).
32758abc0ccfSmrgAC_DEFUN([AM_SILENT_RULES],
32768abc0ccfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
32778abc0ccfSmrgAS_HELP_STRING(
32788abc0ccfSmrg  [--enable-silent-rules],
32798abc0ccfSmrg  [less verbose build output (undo: "make V=1")])
32808abc0ccfSmrgAS_HELP_STRING(
32818abc0ccfSmrg  [--disable-silent-rules],
32828abc0ccfSmrg  [verbose build output (undo: "make V=0")])dnl
32838abc0ccfSmrg])
32848abc0ccfSmrgcase $enable_silent_rules in @%:@ (((
32858abc0ccfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
32868abc0ccfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
32878abc0ccfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
32888abc0ccfSmrgesac
32898abc0ccfSmrgdnl
32908abc0ccfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
32918abc0ccfSmrgdnl do not support nested variable expansions.
32928abc0ccfSmrgdnl See automake bug#9928 and bug#10237.
32938abc0ccfSmrgam_make=${MAKE-make}
32948abc0ccfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
32958abc0ccfSmrg   [am_cv_make_support_nested_variables],
32968abc0ccfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
32978abc0ccfSmrgBAR0=false
32988abc0ccfSmrgBAR1=true
32998abc0ccfSmrgV=1
33008abc0ccfSmrgam__doit:
33018abc0ccfSmrg	@$(TRUE)
33028abc0ccfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
33038abc0ccfSmrg  am_cv_make_support_nested_variables=yes
33048abc0ccfSmrgelse
33058abc0ccfSmrg  am_cv_make_support_nested_variables=no
33068abc0ccfSmrgfi])
33078abc0ccfSmrgif test $am_cv_make_support_nested_variables = yes; then
33088abc0ccfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
33098abc0ccfSmrg  AM_V='$(V)'
33108abc0ccfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
33118abc0ccfSmrgelse
33128abc0ccfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
33138abc0ccfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
33148abc0ccfSmrgfi
33158abc0ccfSmrgAC_SUBST([AM_V])dnl
33168abc0ccfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
33178abc0ccfSmrgAC_SUBST([AM_DEFAULT_V])dnl
33188abc0ccfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
33198abc0ccfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
33208abc0ccfSmrgAM_BACKSLASH='\'
33218abc0ccfSmrgAC_SUBST([AM_BACKSLASH])dnl
33228abc0ccfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
33237a0395d0Smrg])
33247a0395d0Smrg
33250d22642bSmrg# Copyright (C) 2001-2020 Free Software Foundation, Inc.
33267366012aSmrg#
33278abc0ccfSmrg# This file is free software; the Free Software Foundation
33288abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33298abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33307a0395d0Smrg
33318abc0ccfSmrg# AM_PROG_INSTALL_STRIP
33328abc0ccfSmrg# ---------------------
33338abc0ccfSmrg# One issue with vendor 'install' (even GNU) is that you can't
33348abc0ccfSmrg# specify the program used to strip binaries.  This is especially
33358abc0ccfSmrg# annoying in cross-compiling environments, where the build's strip
33368abc0ccfSmrg# is unlikely to handle the host's binaries.
33378abc0ccfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
33388abc0ccfSmrg# always use install-sh in "make install-strip", and initialize
33398abc0ccfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
33408abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
33418abc0ccfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
33428abc0ccfSmrg# Installed binaries are usually stripped using 'strip' when the user
33438abc0ccfSmrg# run "make install-strip".  However 'strip' might not be the right
33448abc0ccfSmrg# tool to use in cross-compilation environments, therefore Automake
33458abc0ccfSmrg# will honor the 'STRIP' environment variable to overrule this program.
33468abc0ccfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
33478abc0ccfSmrgif test "$cross_compiling" != no; then
33488abc0ccfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
33498abc0ccfSmrgfi
33508abc0ccfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
33518abc0ccfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
33527a0395d0Smrg
33530d22642bSmrg# Copyright (C) 2006-2020 Free Software Foundation, Inc.
33548abc0ccfSmrg#
33558abc0ccfSmrg# This file is free software; the Free Software Foundation
33568abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33578abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33587a0395d0Smrg
33598abc0ccfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
33608abc0ccfSmrg# ---------------------------
33618abc0ccfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
33628abc0ccfSmrg# This macro is traced by Automake.
33638abc0ccfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
336496402570Smrg
33658abc0ccfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
33668abc0ccfSmrg# --------------------------
33678abc0ccfSmrg# Public sister of _AM_SUBST_NOTMAKE.
33688abc0ccfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
33697a0395d0Smrg
33708abc0ccfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
337196402570Smrg
33720d22642bSmrg# Copyright (C) 2004-2020 Free Software Foundation, Inc.
33738abc0ccfSmrg#
33748abc0ccfSmrg# This file is free software; the Free Software Foundation
33758abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33768abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33777a0395d0Smrg
33788abc0ccfSmrg# _AM_PROG_TAR(FORMAT)
33798abc0ccfSmrg# --------------------
33808abc0ccfSmrg# Check how to create a tarball in format FORMAT.
33818abc0ccfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
33828abc0ccfSmrg#
33838abc0ccfSmrg# Substitute a variable $(am__tar) that is a command
33848abc0ccfSmrg# writing to stdout a FORMAT-tarball containing the directory
33858abc0ccfSmrg# $tardir.
33868abc0ccfSmrg#     tardir=directory && $(am__tar) > result.tar
33878abc0ccfSmrg#
33888abc0ccfSmrg# Substitute a variable $(am__untar) that extract such
33898abc0ccfSmrg# a tarball read from stdin.
33908abc0ccfSmrg#     $(am__untar) < result.tar
33919a011757Smrg#
33928abc0ccfSmrgAC_DEFUN([_AM_PROG_TAR],
33938abc0ccfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
33948abc0ccfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
33958abc0ccfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
33969a011757Smrg
33979a011757Smrg# We'll loop over all known methods to create a tar archive until one works.
33988abc0ccfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
33997a0395d0Smrg
34009a011757Smrgm4_if([$1], [v7],
34019a011757Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
34029a011757Smrg
34039a011757Smrg  [m4_case([$1],
34049a011757Smrg    [ustar],
34059a011757Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
34069a011757Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
34079a011757Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
34089a011757Smrg      # and bug#13588).
34099a011757Smrg      am_max_uid=2097151 # 2^21 - 1
34109a011757Smrg      am_max_gid=$am_max_uid
34119a011757Smrg      # The $UID and $GID variables are not portable, so we need to resort
34129a011757Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
34139a011757Smrg      # below are definitely unexpected, so allow the users to see them
34149a011757Smrg      # (that is, avoid stderr redirection).
34159a011757Smrg      am_uid=`id -u || echo unknown`
34169a011757Smrg      am_gid=`id -g || echo unknown`
34179a011757Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
34189a011757Smrg      if test $am_uid -le $am_max_uid; then
34199a011757Smrg         AC_MSG_RESULT([yes])
34209a011757Smrg      else
34219a011757Smrg         AC_MSG_RESULT([no])
34229a011757Smrg         _am_tools=none
34239a011757Smrg      fi
34249a011757Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
34259a011757Smrg      if test $am_gid -le $am_max_gid; then
34269a011757Smrg         AC_MSG_RESULT([yes])
34279a011757Smrg      else
34289a011757Smrg        AC_MSG_RESULT([no])
34299a011757Smrg        _am_tools=none
34309a011757Smrg      fi],
34319a011757Smrg
34329a011757Smrg  [pax],
34339a011757Smrg    [],
34349a011757Smrg
34359a011757Smrg  [m4_fatal([Unknown tar format])])
34369a011757Smrg
34379a011757Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
34389a011757Smrg
34399a011757Smrg  # Go ahead even if we have the value already cached.  We do so because we
34409a011757Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
34419a011757Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
34429a011757Smrg
34439a011757Smrg  for _am_tool in $_am_tools; do
34449a011757Smrg    case $_am_tool in
34459a011757Smrg    gnutar)
34469a011757Smrg      for _am_tar in tar gnutar gtar; do
34479a011757Smrg        AM_RUN_LOG([$_am_tar --version]) && break
34489a011757Smrg      done
34499a011757Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
34509a011757Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
34519a011757Smrg      am__untar="$_am_tar -xf -"
34529a011757Smrg      ;;
34539a011757Smrg    plaintar)
34549a011757Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
34559a011757Smrg      # ustar tarball either.
34569a011757Smrg      (tar --version) >/dev/null 2>&1 && continue
34579a011757Smrg      am__tar='tar chf - "$$tardir"'
34589a011757Smrg      am__tar_='tar chf - "$tardir"'
34599a011757Smrg      am__untar='tar xf -'
34609a011757Smrg      ;;
34619a011757Smrg    pax)
34629a011757Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
34639a011757Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
34649a011757Smrg      am__untar='pax -r'
34659a011757Smrg      ;;
34669a011757Smrg    cpio)
34679a011757Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
34689a011757Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
34699a011757Smrg      am__untar='cpio -i -H $1 -d'
34709a011757Smrg      ;;
34719a011757Smrg    none)
34729a011757Smrg      am__tar=false
34739a011757Smrg      am__tar_=false
34749a011757Smrg      am__untar=false
34759a011757Smrg      ;;
34769a011757Smrg    esac
34778abc0ccfSmrg
34789a011757Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
34799a011757Smrg    # and am__untar set.
34809a011757Smrg    test -n "${am_cv_prog_tar_$1}" && break
34819a011757Smrg
34829a011757Smrg    # tar/untar a dummy directory, and stop if the command works.
34839a011757Smrg    rm -rf conftest.dir
34849a011757Smrg    mkdir conftest.dir
34859a011757Smrg    echo GrepMe > conftest.dir/file
34869a011757Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
34879a011757Smrg    rm -rf conftest.dir
34889a011757Smrg    if test -s conftest.tar; then
34899a011757Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
34909a011757Smrg      AM_RUN_LOG([cat conftest.dir/file])
34919a011757Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
34929a011757Smrg    fi
34939a011757Smrg  done
34948abc0ccfSmrg  rm -rf conftest.dir
34957a0395d0Smrg
34969a011757Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
34979a011757Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
34989a011757Smrg
34998abc0ccfSmrgAC_SUBST([am__tar])
35008abc0ccfSmrgAC_SUBST([am__untar])
35018abc0ccfSmrg]) # _AM_PROG_TAR
35027a0395d0Smrg
3503