aclocal.m4 revision 0568f49b
10568f49bSmrg# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
29e7bcd65Smrg
30568f49bSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
4444c061aSmrg
5444c061aSmrg# This file is free software; the Free Software Foundation
6444c061aSmrg# gives unlimited permission to copy and/or distribute it,
7444c061aSmrg# with or without modifications, as long as this notice is preserved.
8444c061aSmrg
9444c061aSmrg# This program is distributed in the hope that it will be useful,
10444c061aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11444c061aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12444c061aSmrg# PARTICULAR PURPOSE.
13444c061aSmrg
149e7bcd65Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152265a131Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162265a131Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17339a7c43Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18339a7c43Smrg[m4_warning([this file was generated for autoconf 2.69.
192265a131SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202265a131SmrgIf you have problems, you may need to regenerate the build system entirely.
219e7bcd65SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22444c061aSmrg
230568f49bSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
240568f49bSmrgdnl serial 11 (pkg-config-0.29)
250568f49bSmrgdnl
260568f49bSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
270568f49bSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
280568f49bSmrgdnl
290568f49bSmrgdnl This program is free software; you can redistribute it and/or modify
300568f49bSmrgdnl it under the terms of the GNU General Public License as published by
310568f49bSmrgdnl the Free Software Foundation; either version 2 of the License, or
320568f49bSmrgdnl (at your option) any later version.
330568f49bSmrgdnl
340568f49bSmrgdnl This program is distributed in the hope that it will be useful, but
350568f49bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
360568f49bSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
370568f49bSmrgdnl General Public License for more details.
380568f49bSmrgdnl
390568f49bSmrgdnl You should have received a copy of the GNU General Public License
400568f49bSmrgdnl along with this program; if not, write to the Free Software
410568f49bSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
420568f49bSmrgdnl 02111-1307, USA.
430568f49bSmrgdnl
440568f49bSmrgdnl As a special exception to the GNU General Public License, if you
450568f49bSmrgdnl distribute this file as part of a program that contains a
460568f49bSmrgdnl configuration script generated by Autoconf, you may include it under
470568f49bSmrgdnl the same distribution terms that you use for the rest of that
480568f49bSmrgdnl program.
490568f49bSmrg
500568f49bSmrgdnl PKG_PREREQ(MIN-VERSION)
510568f49bSmrgdnl -----------------------
520568f49bSmrgdnl Since: 0.29
530568f49bSmrgdnl
540568f49bSmrgdnl Verify that the version of the pkg-config macros are at least
550568f49bSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
560568f49bSmrgdnl installed version of pkg-config, this checks the developer's version
570568f49bSmrgdnl of pkg.m4 when generating configure.
580568f49bSmrgdnl
590568f49bSmrgdnl To ensure that this macro is defined, also add:
600568f49bSmrgdnl m4_ifndef([PKG_PREREQ],
610568f49bSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
620568f49bSmrgdnl
630568f49bSmrgdnl See the "Since" comment for each macro you use to see what version
640568f49bSmrgdnl of the macros you require.
650568f49bSmrgm4_defun([PKG_PREREQ],
660568f49bSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
670568f49bSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
680568f49bSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
690568f49bSmrg])dnl PKG_PREREQ
700568f49bSmrg
710568f49bSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
720568f49bSmrgdnl ----------------------------------
730568f49bSmrgdnl Since: 0.16
740568f49bSmrgdnl
750568f49bSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
760568f49bSmrgdnl first found in the path. Checks that the version of pkg-config found
770568f49bSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
780568f49bSmrgdnl used since that's the first version where most current features of
790568f49bSmrgdnl pkg-config existed.
800568f49bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
810568f49bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
820568f49bSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
830568f49bSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
840568f49bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
850568f49bSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
860568f49bSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87249c3046Smrg
880568f49bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
890568f49bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
900568f49bSmrgfi
910568f49bSmrgif test -n "$PKG_CONFIG"; then
920568f49bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
930568f49bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
940568f49bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
950568f49bSmrg		AC_MSG_RESULT([yes])
960568f49bSmrg	else
970568f49bSmrg		AC_MSG_RESULT([no])
980568f49bSmrg		PKG_CONFIG=""
990568f49bSmrg	fi
1000568f49bSmrgfi[]dnl
1010568f49bSmrg])dnl PKG_PROG_PKG_CONFIG
102249c3046Smrg
1030568f49bSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1040568f49bSmrgdnl -------------------------------------------------------------------
1050568f49bSmrgdnl Since: 0.18
1060568f49bSmrgdnl
1070568f49bSmrgdnl Check to see whether a particular set of modules exists. Similar to
1080568f49bSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1090568f49bSmrgdnl
1100568f49bSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1110568f49bSmrgdnl only at the first occurence in configure.ac, so if the first place
1120568f49bSmrgdnl it's called might be skipped (such as if it is within an "if", you
1130568f49bSmrgdnl have to call PKG_CHECK_EXISTS manually
1140568f49bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1150568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1160568f49bSmrgif test -n "$PKG_CONFIG" && \
1170568f49bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1180568f49bSmrg  m4_default([$2], [:])
1190568f49bSmrgm4_ifvaln([$3], [else
1200568f49bSmrg  $3])dnl
1210568f49bSmrgfi])
122249c3046Smrg
1230568f49bSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1240568f49bSmrgdnl ---------------------------------------------
1250568f49bSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1260568f49bSmrgdnl pkg_failed based on the result.
1270568f49bSmrgm4_define([_PKG_CONFIG],
1280568f49bSmrg[if test -n "$$1"; then
1290568f49bSmrg    pkg_cv_[]$1="$$1"
1300568f49bSmrg elif test -n "$PKG_CONFIG"; then
1310568f49bSmrg    PKG_CHECK_EXISTS([$3],
1320568f49bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1330568f49bSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1340568f49bSmrg		     [pkg_failed=yes])
1350568f49bSmrg else
1360568f49bSmrg    pkg_failed=untried
1370568f49bSmrgfi[]dnl
1380568f49bSmrg])dnl _PKG_CONFIG
139249c3046Smrg
1400568f49bSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1410568f49bSmrgdnl ---------------------------
1420568f49bSmrgdnl Internal check to see if pkg-config supports short errors.
1430568f49bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1440568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1450568f49bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1460568f49bSmrg        _pkg_short_errors_supported=yes
1470568f49bSmrgelse
1480568f49bSmrg        _pkg_short_errors_supported=no
1490568f49bSmrgfi[]dnl
1500568f49bSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1511477040fSmrg
152bdf0f55dSmrg
1530568f49bSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1540568f49bSmrgdnl   [ACTION-IF-NOT-FOUND])
1550568f49bSmrgdnl --------------------------------------------------------------
1560568f49bSmrgdnl Since: 0.4.0
1570568f49bSmrgdnl
1580568f49bSmrgdnl Note that if there is a possibility the first call to
1590568f49bSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1600568f49bSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1610568f49bSmrgAC_DEFUN([PKG_CHECK_MODULES],
1620568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1630568f49bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1640568f49bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1651477040fSmrg
1660568f49bSmrgpkg_failed=no
1670568f49bSmrgAC_MSG_CHECKING([for $1])
168444c061aSmrg
1690568f49bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1700568f49bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171444c061aSmrg
1720568f49bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1730568f49bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1740568f49bSmrgSee the pkg-config man page for more details.])
175444c061aSmrg
1760568f49bSmrgif test $pkg_failed = yes; then
1770568f49bSmrg   	AC_MSG_RESULT([no])
1780568f49bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1790568f49bSmrg        if test $_pkg_short_errors_supported = yes; then
1800568f49bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1810568f49bSmrg        else 
1820568f49bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1830568f49bSmrg        fi
1840568f49bSmrg	# Put the nasty error message in config.log where it belongs
1850568f49bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186444c061aSmrg
1870568f49bSmrg	m4_default([$4], [AC_MSG_ERROR(
1880568f49bSmrg[Package requirements ($2) were not met:
189444c061aSmrg
1900568f49bSmrg$$1_PKG_ERRORS
191444c061aSmrg
1920568f49bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1930568f49bSmrginstalled software in a non-standard prefix.
1942265a131Smrg
1950568f49bSmrg_PKG_TEXT])[]dnl
1960568f49bSmrg        ])
1970568f49bSmrgelif test $pkg_failed = untried; then
1980568f49bSmrg     	AC_MSG_RESULT([no])
1990568f49bSmrg	m4_default([$4], [AC_MSG_FAILURE(
2000568f49bSmrg[The pkg-config script could not be found or is too old.  Make sure it
2010568f49bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2020568f49bSmrgpath to pkg-config.
2031477040fSmrg
2040568f49bSmrg_PKG_TEXT
2051477040fSmrg
2060568f49bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2070568f49bSmrg        ])
2080568f49bSmrgelse
2090568f49bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2100568f49bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2110568f49bSmrg        AC_MSG_RESULT([yes])
2120568f49bSmrg	$3
2130568f49bSmrgfi[]dnl
2140568f49bSmrg])dnl PKG_CHECK_MODULES
2151477040fSmrg
2161477040fSmrg
2170568f49bSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2180568f49bSmrgdnl   [ACTION-IF-NOT-FOUND])
2190568f49bSmrgdnl ---------------------------------------------------------------------
2200568f49bSmrgdnl Since: 0.29
2210568f49bSmrgdnl
2220568f49bSmrgdnl Checks for existence of MODULES and gathers its build flags with
2230568f49bSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2240568f49bSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2250568f49bSmrgdnl
2260568f49bSmrgdnl Note that if there is a possibility the first call to
2270568f49bSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2280568f49bSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2290568f49bSmrgdnl configure.ac.
2300568f49bSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2310568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2320568f49bSmrg_save_PKG_CONFIG=$PKG_CONFIG
2330568f49bSmrgPKG_CONFIG="$PKG_CONFIG --static"
2340568f49bSmrgPKG_CHECK_MODULES($@)
2350568f49bSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2360568f49bSmrg])dnl PKG_CHECK_MODULES_STATIC
2371477040fSmrg
2381477040fSmrg
2390568f49bSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2400568f49bSmrgdnl -------------------------
2410568f49bSmrgdnl Since: 0.27
2420568f49bSmrgdnl
2430568f49bSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2440568f49bSmrgdnl should install pkg-config .pc files. By default the directory is
2450568f49bSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2460568f49bSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2470568f49bSmrgdnl parameter.
2480568f49bSmrgAC_DEFUN([PKG_INSTALLDIR],
2490568f49bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2500568f49bSmrgm4_pushdef([pkg_description],
2510568f49bSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2520568f49bSmrgAC_ARG_WITH([pkgconfigdir],
2530568f49bSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2540568f49bSmrg    [with_pkgconfigdir=]pkg_default)
2550568f49bSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2560568f49bSmrgm4_popdef([pkg_default])
2570568f49bSmrgm4_popdef([pkg_description])
2580568f49bSmrg])dnl PKG_INSTALLDIR
2590568f49bSmrg
2600568f49bSmrg
2610568f49bSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2620568f49bSmrgdnl --------------------------------
2630568f49bSmrgdnl Since: 0.27
2640568f49bSmrgdnl
2650568f49bSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2660568f49bSmrgdnl module should install arch-independent pkg-config .pc files. By
2670568f49bSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2680568f49bSmrgdnl changed by passing DIRECTORY. The user can override through the
2690568f49bSmrgdnl --with-noarch-pkgconfigdir parameter.
2700568f49bSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2710568f49bSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2720568f49bSmrgm4_pushdef([pkg_description],
2730568f49bSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2740568f49bSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2750568f49bSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2760568f49bSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2770568f49bSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2780568f49bSmrgm4_popdef([pkg_default])
2790568f49bSmrgm4_popdef([pkg_description])
2800568f49bSmrg])dnl PKG_NOARCH_INSTALLDIR
2810568f49bSmrg
2820568f49bSmrg
2830568f49bSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2840568f49bSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2850568f49bSmrgdnl -------------------------------------------
2860568f49bSmrgdnl Since: 0.28
2870568f49bSmrgdnl
2880568f49bSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2890568f49bSmrgAC_DEFUN([PKG_CHECK_VAR],
2900568f49bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2910568f49bSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2921477040fSmrg
2930568f49bSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2940568f49bSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2951477040fSmrg
2960568f49bSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2970568f49bSmrg])dnl PKG_CHECK_VAR
2981477040fSmrg
2990568f49bSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3000568f49bSmrgdnl
3010568f49bSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3020568f49bSmrgdnl
3030568f49bSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3040568f49bSmrgdnl copy of this software and associated documentation files (the "Software"),
3050568f49bSmrgdnl to deal in the Software without restriction, including without limitation
3060568f49bSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3070568f49bSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3080568f49bSmrgdnl Software is furnished to do so, subject to the following conditions:
3090568f49bSmrgdnl
3100568f49bSmrgdnl The above copyright notice and this permission notice (including the next
3110568f49bSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3120568f49bSmrgdnl Software.
3130568f49bSmrgdnl
3140568f49bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3150568f49bSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3160568f49bSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3170568f49bSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3180568f49bSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3190568f49bSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3200568f49bSmrgdnl DEALINGS IN THE SOFTWARE.
3211477040fSmrg
3220568f49bSmrg# XORG_MACROS_VERSION(required-version)
3230568f49bSmrg# -------------------------------------
3240568f49bSmrg# Minimum version: 1.1.0
3259e7bcd65Smrg#
3260568f49bSmrg# If you're using a macro added in Version 1.1 or newer, include this in
3270568f49bSmrg# your configure.ac with the minimum required version, such as:
3280568f49bSmrg# XORG_MACROS_VERSION(1.1)
3290568f49bSmrg#
3300568f49bSmrg# To ensure that this macro is defined, also add:
3310568f49bSmrg# m4_ifndef([XORG_MACROS_VERSION],
3320568f49bSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3330568f49bSmrg#
3340568f49bSmrg#
3350568f49bSmrg# See the "minimum version" comment for each macro you use to see what
3360568f49bSmrg# version you require.
3370568f49bSmrgm4_defun([XORG_MACROS_VERSION],[
3380568f49bSmrgm4_define([vers_have], [1.19.2])
3390568f49bSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3400568f49bSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3410568f49bSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3420568f49bSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3430568f49bSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3440568f49bSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3450568f49bSmrgm4_undefine([vers_have])
3460568f49bSmrgm4_undefine([maj_have])
3470568f49bSmrgm4_undefine([maj_needed])
3480568f49bSmrg]) # XORG_MACROS_VERSION
3491477040fSmrg
3500568f49bSmrg# XORG_PROG_RAWCPP()
3510568f49bSmrg# ------------------
3520568f49bSmrg# Minimum version: 1.0.0
3530568f49bSmrg#
3540568f49bSmrg# Find cpp program and necessary flags for use in pre-processing text files
3550568f49bSmrg# such as man pages and config files
3560568f49bSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3570568f49bSmrgAC_REQUIRE([AC_PROG_CPP])
3580568f49bSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
3590568f49bSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3601477040fSmrg
3610568f49bSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3620568f49bSmrg# which is not the best choice for supporting other OS'es, but covers most
3630568f49bSmrg# of the ones we need for now.
3640568f49bSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3650568f49bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3660568f49bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3670568f49bSmrg	AC_MSG_RESULT([no])
3680568f49bSmrgelse
3690568f49bSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3700568f49bSmrg		RAWCPPFLAGS=-undef
3710568f49bSmrg		AC_MSG_RESULT([yes])
3720568f49bSmrg	# under Cygwin unix is still defined even with -undef
3730568f49bSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3740568f49bSmrg		RAWCPPFLAGS="-undef -ansi"
3750568f49bSmrg		AC_MSG_RESULT([yes, with -ansi])
3760568f49bSmrg	else
3770568f49bSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3780568f49bSmrg	fi
3790568f49bSmrgfi
3800568f49bSmrgrm -f conftest.$ac_ext
3811477040fSmrg
3820568f49bSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3830568f49bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3840568f49bSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3850568f49bSmrg	AC_MSG_RESULT([no])
3860568f49bSmrgelse
3870568f49bSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3880568f49bSmrg		TRADITIONALCPPFLAGS="-traditional"
3890568f49bSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3900568f49bSmrg		AC_MSG_RESULT([yes])
3910568f49bSmrg	else
3920568f49bSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3930568f49bSmrg	fi
3940568f49bSmrgfi
3950568f49bSmrgrm -f conftest.$ac_ext
3960568f49bSmrgAC_SUBST(RAWCPPFLAGS)
3970568f49bSmrgAC_SUBST(TRADITIONALCPPFLAGS)
3980568f49bSmrg]) # XORG_PROG_RAWCPP
3991477040fSmrg
4000568f49bSmrg# XORG_MANPAGE_SECTIONS()
4010568f49bSmrg# -----------------------
4020568f49bSmrg# Minimum version: 1.0.0
403bdf0f55dSmrg#
4040568f49bSmrg# Determine which sections man pages go in for the different man page types
4050568f49bSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4060568f49bSmrg# Not sure if there's any better way than just hardcoding by OS name.
4070568f49bSmrg# Override default settings by setting environment variables
4080568f49bSmrg# Added MAN_SUBSTS in version 1.8
4090568f49bSmrg# Added AC_PROG_SED in version 1.8
4101477040fSmrg
4110568f49bSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4120568f49bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
4130568f49bSmrgAC_REQUIRE([AC_PROG_SED])
414bdf0f55dSmrg
4150568f49bSmrgcase $host_os in
4160568f49bSmrg    solaris*)
4170568f49bSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4180568f49bSmrg        # check for a man page file found in later versions that use
4190568f49bSmrg        # traditional section numbers instead
4200568f49bSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4210568f49bSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4220568f49bSmrg        ;;
4230568f49bSmrg    *) SYSV_MAN_SECTIONS=false ;;
4240568f49bSmrgesac
4252265a131Smrg
4260568f49bSmrgif test x$APP_MAN_SUFFIX = x    ; then
4270568f49bSmrg    APP_MAN_SUFFIX=1
4280568f49bSmrgfi
4290568f49bSmrgif test x$APP_MAN_DIR = x    ; then
4300568f49bSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4310568f49bSmrgfi
4322265a131Smrg
4330568f49bSmrgif test x$LIB_MAN_SUFFIX = x    ; then
4340568f49bSmrg    LIB_MAN_SUFFIX=3
4350568f49bSmrgfi
4360568f49bSmrgif test x$LIB_MAN_DIR = x    ; then
4370568f49bSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4380568f49bSmrgfi
439339a7c43Smrg
4400568f49bSmrgif test x$FILE_MAN_SUFFIX = x    ; then
4410568f49bSmrg    case $SYSV_MAN_SECTIONS in
4420568f49bSmrg	true)				FILE_MAN_SUFFIX=4  ;;
4430568f49bSmrg	*)				FILE_MAN_SUFFIX=5  ;;
4440568f49bSmrg    esac
4450568f49bSmrgfi
4460568f49bSmrgif test x$FILE_MAN_DIR = x    ; then
4470568f49bSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
448249c3046Smrgfi
4491477040fSmrg
4500568f49bSmrgif test x$MISC_MAN_SUFFIX = x    ; then
4510568f49bSmrg    case $SYSV_MAN_SECTIONS in
4520568f49bSmrg	true)				MISC_MAN_SUFFIX=5  ;;
4530568f49bSmrg	*)				MISC_MAN_SUFFIX=7  ;;
4540568f49bSmrg    esac
4550568f49bSmrgfi
4560568f49bSmrgif test x$MISC_MAN_DIR = x    ; then
4570568f49bSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4589e7bcd65Smrgfi
459bdf0f55dSmrg
4600568f49bSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4610568f49bSmrg    case $SYSV_MAN_SECTIONS in
4620568f49bSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
4630568f49bSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4640568f49bSmrg    esac
4650568f49bSmrgfi
4660568f49bSmrgif test x$DRIVER_MAN_DIR = x    ; then
4670568f49bSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4680568f49bSmrgfi
469bdf0f55dSmrg
4700568f49bSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4710568f49bSmrg    case $SYSV_MAN_SECTIONS in
4720568f49bSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
4730568f49bSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4740568f49bSmrg    esac
4750568f49bSmrgfi
4760568f49bSmrgif test x$ADMIN_MAN_DIR = x    ; then
4770568f49bSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4780568f49bSmrgfi
479bdf0f55dSmrg
480339a7c43Smrg
4810568f49bSmrgAC_SUBST([APP_MAN_SUFFIX])
4820568f49bSmrgAC_SUBST([LIB_MAN_SUFFIX])
4830568f49bSmrgAC_SUBST([FILE_MAN_SUFFIX])
4840568f49bSmrgAC_SUBST([MISC_MAN_SUFFIX])
4850568f49bSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4860568f49bSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4870568f49bSmrgAC_SUBST([APP_MAN_DIR])
4880568f49bSmrgAC_SUBST([LIB_MAN_DIR])
4890568f49bSmrgAC_SUBST([FILE_MAN_DIR])
4900568f49bSmrgAC_SUBST([MISC_MAN_DIR])
4910568f49bSmrgAC_SUBST([DRIVER_MAN_DIR])
4920568f49bSmrgAC_SUBST([ADMIN_MAN_DIR])
493339a7c43Smrg
4940568f49bSmrgXORG_MAN_PAGE="X Version 11"
4950568f49bSmrgAC_SUBST([XORG_MAN_PAGE])
4960568f49bSmrgMAN_SUBSTS="\
4970568f49bSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4980568f49bSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4990568f49bSmrg	-e 's|__xservername__|Xorg|g' \
5000568f49bSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
5010568f49bSmrg	-e 's|__projectroot__|\$(prefix)|g' \
5020568f49bSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5030568f49bSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5040568f49bSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5050568f49bSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5060568f49bSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5070568f49bSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5080568f49bSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5090568f49bSmrgAC_SUBST([MAN_SUBSTS])
510339a7c43Smrg
5110568f49bSmrg]) # XORG_MANPAGE_SECTIONS
512339a7c43Smrg
5130568f49bSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5140568f49bSmrg# ------------------------
5150568f49bSmrg# Minimum version: 1.7.0
5160568f49bSmrg#
5170568f49bSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5180568f49bSmrg# provided by xorg-sgml-doctools, if installed.
5190568f49bSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5200568f49bSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5210568f49bSmrgXORG_SGML_PATH=
5220568f49bSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5230568f49bSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5240568f49bSmrg    [m4_ifval([$1],[:],
5250568f49bSmrg        [if test x"$cross_compiling" != x"yes" ; then
5260568f49bSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5270568f49bSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5280568f49bSmrg         fi])
5290568f49bSmrg    ])
530339a7c43Smrg
5310568f49bSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5320568f49bSmrg# the path and the name of the doc stylesheet
5330568f49bSmrgif test "x$XORG_SGML_PATH" != "x" ; then
5340568f49bSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5350568f49bSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5360568f49bSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5370568f49bSmrgelse
5380568f49bSmrg   AC_MSG_RESULT([no])
5390568f49bSmrgfi
540339a7c43Smrg
5410568f49bSmrgAC_SUBST(XORG_SGML_PATH)
5420568f49bSmrgAC_SUBST(STYLESHEET_SRCDIR)
5430568f49bSmrgAC_SUBST(XSL_STYLESHEET)
5440568f49bSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5450568f49bSmrg]) # XORG_CHECK_SGML_DOCTOOLS
546339a7c43Smrg
5470568f49bSmrg# XORG_CHECK_LINUXDOC
5480568f49bSmrg# -------------------
5490568f49bSmrg# Minimum version: 1.0.0
5500568f49bSmrg#
5510568f49bSmrg# Defines the variable MAKE_TEXT if the necessary tools and
5520568f49bSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5530568f49bSmrg# Whether or not the necessary tools and files are found can be checked
5540568f49bSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5550568f49bSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5560568f49bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5570568f49bSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5581477040fSmrg
5590568f49bSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5601477040fSmrg
5610568f49bSmrgAC_MSG_CHECKING([whether to build documentation])
5621477040fSmrg
5630568f49bSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5640568f49bSmrg   BUILDDOC=yes
5650568f49bSmrgelse
5660568f49bSmrg   BUILDDOC=no
5670568f49bSmrgfi
5681477040fSmrg
5690568f49bSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5701477040fSmrg
5710568f49bSmrgAC_MSG_RESULT([$BUILDDOC])
5722265a131Smrg
5730568f49bSmrgAC_MSG_CHECKING([whether to build pdf documentation])
5742265a131Smrg
5750568f49bSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5760568f49bSmrg   BUILDPDFDOC=yes
5779e7bcd65Smrgelse
5780568f49bSmrg   BUILDPDFDOC=no
579249c3046Smrgfi
5802265a131Smrg
5810568f49bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5822265a131Smrg
5830568f49bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5842265a131Smrg
5850568f49bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5860568f49bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5870568f49bSmrgMAKE_PDF="$PS2PDF"
5880568f49bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5891477040fSmrg
5900568f49bSmrgAC_SUBST(MAKE_TEXT)
5910568f49bSmrgAC_SUBST(MAKE_PS)
5920568f49bSmrgAC_SUBST(MAKE_PDF)
5930568f49bSmrgAC_SUBST(MAKE_HTML)
5940568f49bSmrg]) # XORG_CHECK_LINUXDOC
595444c061aSmrg
5960568f49bSmrg# XORG_CHECK_DOCBOOK
5970568f49bSmrg# -------------------
5980568f49bSmrg# Minimum version: 1.0.0
599bdf0f55dSmrg#
6000568f49bSmrg# Checks for the ability to build output formats from SGML DocBook source.
6010568f49bSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6020568f49bSmrg# indicates whether the necessary tools and files are found and, if set,
6030568f49bSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6040568f49bSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6050568f49bSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
606444c061aSmrg
6070568f49bSmrgBUILDTXTDOC=no
6080568f49bSmrgBUILDPDFDOC=no
6090568f49bSmrgBUILDPSDOC=no
6100568f49bSmrgBUILDHTMLDOC=no
6119e7bcd65Smrg
6120568f49bSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6130568f49bSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6140568f49bSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6150568f49bSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
616444c061aSmrg
6170568f49bSmrgAC_MSG_CHECKING([whether to build text documentation])
6180568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6190568f49bSmrg   test x$BUILD_TXTDOC != xno; then
6200568f49bSmrg	BUILDTXTDOC=yes
6210568f49bSmrgfi
6220568f49bSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6230568f49bSmrgAC_MSG_RESULT([$BUILDTXTDOC])
624444c061aSmrg
6250568f49bSmrgAC_MSG_CHECKING([whether to build PDF documentation])
6260568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6270568f49bSmrg   test x$BUILD_PDFDOC != xno; then
6280568f49bSmrg	BUILDPDFDOC=yes
6290568f49bSmrgfi
6300568f49bSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6310568f49bSmrgAC_MSG_RESULT([$BUILDPDFDOC])
6321477040fSmrg
6330568f49bSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6340568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6350568f49bSmrg   test x$BUILD_PSDOC != xno; then
6360568f49bSmrg	BUILDPSDOC=yes
6370568f49bSmrgfi
6380568f49bSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6390568f49bSmrgAC_MSG_RESULT([$BUILDPSDOC])
6409e7bcd65Smrg
6410568f49bSmrgAC_MSG_CHECKING([whether to build HTML documentation])
6420568f49bSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6430568f49bSmrg   test x$BUILD_HTMLDOC != xno; then
6440568f49bSmrg	BUILDHTMLDOC=yes
6450568f49bSmrgfi
6460568f49bSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6470568f49bSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6489e7bcd65Smrg
6490568f49bSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6500568f49bSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6510568f49bSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6520568f49bSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6539e7bcd65Smrg
6540568f49bSmrgAC_SUBST(MAKE_TEXT)
6550568f49bSmrgAC_SUBST(MAKE_PS)
6560568f49bSmrgAC_SUBST(MAKE_PDF)
6570568f49bSmrgAC_SUBST(MAKE_HTML)
6580568f49bSmrg]) # XORG_CHECK_DOCBOOK
6599e7bcd65Smrg
6600568f49bSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6610568f49bSmrg# ----------------
6620568f49bSmrg# Minimum version: 1.5.0
6630568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
664339a7c43Smrg#
6650568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
6660568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
6670568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
6680568f49bSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6690568f49bSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6700568f49bSmrg# --with-xmlto assumes 'auto'.
671339a7c43Smrg#
6720568f49bSmrg# Interface to module:
6730568f49bSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6740568f49bSmrg# XMLTO:	returns the path of the xmlto program found
6750568f49bSmrg#		returns the path set by the user in the environment
6760568f49bSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6770568f49bSmrg#		'no' user instructs the module not to use xmlto
6780568f49bSmrg#
6790568f49bSmrg# Added in version 1.10.0
6800568f49bSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6810568f49bSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6820568f49bSmrg#
6830568f49bSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6840568f49bSmrg#
6850568f49bSmrgAC_DEFUN([XORG_WITH_XMLTO],[
6860568f49bSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6870568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
6880568f49bSmrgAC_ARG_WITH(xmlto,
6890568f49bSmrg	AS_HELP_STRING([--with-xmlto],
6900568f49bSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6910568f49bSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6920568f49bSmrgm4_undefine([_defopt])
693339a7c43Smrg
6940568f49bSmrgif test "x$use_xmlto" = x"auto"; then
6950568f49bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6960568f49bSmrg   if test "x$XMLTO" = "x"; then
6970568f49bSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6980568f49bSmrg	have_xmlto=no
6990568f49bSmrg   else
7000568f49bSmrg        have_xmlto=yes
7010568f49bSmrg   fi
7020568f49bSmrgelif test "x$use_xmlto" = x"yes" ; then
7030568f49bSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7040568f49bSmrg   if test "x$XMLTO" = "x"; then
7050568f49bSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7060568f49bSmrg   fi
7070568f49bSmrg   have_xmlto=yes
7080568f49bSmrgelif test "x$use_xmlto" = x"no" ; then
7090568f49bSmrg   if test "x$XMLTO" != "x"; then
7100568f49bSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7110568f49bSmrg   fi
7120568f49bSmrg   have_xmlto=no
7130568f49bSmrgelse
7140568f49bSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7150568f49bSmrgfi
716339a7c43Smrg
7170568f49bSmrg# Test for a minimum version of xmlto, if provided.
7180568f49bSmrgm4_ifval([$1],
7190568f49bSmrg[if test "$have_xmlto" = yes; then
7200568f49bSmrg    # scrape the xmlto version
7210568f49bSmrg    AC_MSG_CHECKING([the xmlto version])
7220568f49bSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7230568f49bSmrg    AC_MSG_RESULT([$xmlto_version])
7240568f49bSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7250568f49bSmrg        [if test "x$use_xmlto" = xauto; then
7260568f49bSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7270568f49bSmrg            have_xmlto=no
7280568f49bSmrg        else
7290568f49bSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7300568f49bSmrg        fi])
7310568f49bSmrgfi])
7329e7bcd65Smrg
7330568f49bSmrg# Test for the ability of xmlto to generate a text target
7349e7bcd65Smrg#
7350568f49bSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7360568f49bSmrg# following test for empty XML docbook files.
7370568f49bSmrg# For compatibility reasons use the following empty XML docbook file and if
7380568f49bSmrg# it fails try it again with a non-empty XML file.
7390568f49bSmrghave_xmlto_text=no
7400568f49bSmrgcat > conftest.xml << "EOF"
7410568f49bSmrgEOF
7420568f49bSmrgAS_IF([test "$have_xmlto" = yes],
7430568f49bSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7440568f49bSmrg             [have_xmlto_text=yes],
7450568f49bSmrg             [# Try it again with a non-empty XML file.
7460568f49bSmrg              cat > conftest.xml << "EOF"
7470568f49bSmrg<x></x>
7480568f49bSmrgEOF
7490568f49bSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7500568f49bSmrg                    [have_xmlto_text=yes],
7510568f49bSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7520568f49bSmrgrm -f conftest.xml
7530568f49bSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7540568f49bSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7550568f49bSmrg]) # XORG_WITH_XMLTO
7569e7bcd65Smrg
7570568f49bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7580568f49bSmrg# --------------------------------------------
7590568f49bSmrg# Minimum version: 1.12.0
7600568f49bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
7610568f49bSmrg#
7620568f49bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7630568f49bSmrg# XML-based language used for the transformation of XML documents.
7640568f49bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7650568f49bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7660568f49bSmrg# The XSLT processor is often used as a standalone tool for transformations.
7670568f49bSmrg# It should not be assumed that this tool is used only to work with documnetation.
7680568f49bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7690568f49bSmrg#
7700568f49bSmrg# Interface to module:
7710568f49bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7720568f49bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
7730568f49bSmrg#		 returns the path set by the user in the environment
7740568f49bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7750568f49bSmrg#		  'no' user instructs the module not to use xsltproc
7760568f49bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7770568f49bSmrg#
7780568f49bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7790568f49bSmrg#
7800568f49bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7810568f49bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7820568f49bSmrg# Preserves the interface, should it be implemented later
7830568f49bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7840568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
7850568f49bSmrgAC_ARG_WITH(xsltproc,
7860568f49bSmrg	AS_HELP_STRING([--with-xsltproc],
7870568f49bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7880568f49bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7890568f49bSmrgm4_undefine([_defopt])
7909e7bcd65Smrg
7910568f49bSmrgif test "x$use_xsltproc" = x"auto"; then
7920568f49bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7930568f49bSmrg   if test "x$XSLTPROC" = "x"; then
7940568f49bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7950568f49bSmrg	have_xsltproc=no
7960568f49bSmrg   else
7970568f49bSmrg        have_xsltproc=yes
7980568f49bSmrg   fi
7990568f49bSmrgelif test "x$use_xsltproc" = x"yes" ; then
8000568f49bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8010568f49bSmrg   if test "x$XSLTPROC" = "x"; then
8020568f49bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8030568f49bSmrg   fi
8040568f49bSmrg   have_xsltproc=yes
8050568f49bSmrgelif test "x$use_xsltproc" = x"no" ; then
8060568f49bSmrg   if test "x$XSLTPROC" != "x"; then
8070568f49bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8080568f49bSmrg   fi
8090568f49bSmrg   have_xsltproc=no
810249c3046Smrgelse
8110568f49bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8129e7bcd65Smrgfi
8139e7bcd65Smrg
8140568f49bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8150568f49bSmrg]) # XORG_WITH_XSLTPROC
8160568f49bSmrg
8170568f49bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8180568f49bSmrg# ----------------------------------------
8190568f49bSmrg# Minimum version: 1.15.0
8209e7bcd65Smrg#
8210568f49bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
8220568f49bSmrg# scanning arbitrary text files, extracting information from those text files,
8230568f49bSmrg# and printing reports based on that information.
8240568f49bSmrg#
8250568f49bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8260568f49bSmrg#
8270568f49bSmrg# Interface to module:
8280568f49bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
8290568f49bSmrg# PERL:	     returns the path of the perl program found
8300568f49bSmrg#	     returns the path set by the user in the environment
8310568f49bSmrg# --with-perl: 'yes' user instructs the module to use perl
8320568f49bSmrg#	       'no' user instructs the module not to use perl
8330568f49bSmrg# have_perl: returns yes if perl found in PATH or no
8340568f49bSmrg#
8350568f49bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8360568f49bSmrg#
8370568f49bSmrgAC_DEFUN([XORG_WITH_PERL],[
8380568f49bSmrgAC_ARG_VAR([PERL], [Path to perl command])
8390568f49bSmrg# Preserves the interface, should it be implemented later
8400568f49bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8410568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
8420568f49bSmrgAC_ARG_WITH(perl,
8430568f49bSmrg	AS_HELP_STRING([--with-perl],
8440568f49bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8450568f49bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
8460568f49bSmrgm4_undefine([_defopt])
8479e7bcd65Smrg
8480568f49bSmrgif test "x$use_perl" = x"auto"; then
8490568f49bSmrg   AC_PATH_PROG([PERL], [perl])
8500568f49bSmrg   if test "x$PERL" = "x"; then
8510568f49bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8520568f49bSmrg	have_perl=no
8530568f49bSmrg   else
8540568f49bSmrg        have_perl=yes
8550568f49bSmrg   fi
8560568f49bSmrgelif test "x$use_perl" = x"yes" ; then
8570568f49bSmrg   AC_PATH_PROG([PERL], [perl])
8580568f49bSmrg   if test "x$PERL" = "x"; then
8590568f49bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8600568f49bSmrg   fi
8610568f49bSmrg   have_perl=yes
8620568f49bSmrgelif test "x$use_perl" = x"no" ; then
8630568f49bSmrg   if test "x$PERL" != "x"; then
8640568f49bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8650568f49bSmrg   fi
8660568f49bSmrg   have_perl=no
8679e7bcd65Smrgelse
8680568f49bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8699e7bcd65Smrgfi
8709e7bcd65Smrg
8710568f49bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8720568f49bSmrg]) # XORG_WITH_PERL
8739e7bcd65Smrg
8740568f49bSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8750568f49bSmrg# ----------------
8760568f49bSmrg# Minimum version: 1.5.0
8770568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
878249c3046Smrg#
8790568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
8800568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
8810568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
8820568f49bSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8830568f49bSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8840568f49bSmrg# --with-asciidoc assumes 'auto'.
8850568f49bSmrg#
8860568f49bSmrg# Interface to module:
8870568f49bSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8880568f49bSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
8890568f49bSmrg#		 returns the path set by the user in the environment
8900568f49bSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8910568f49bSmrg#		  'no' user instructs the module not to use asciidoc
8920568f49bSmrg#
8930568f49bSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8940568f49bSmrg#
8950568f49bSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8960568f49bSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8970568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
8980568f49bSmrgAC_ARG_WITH(asciidoc,
8990568f49bSmrg	AS_HELP_STRING([--with-asciidoc],
9000568f49bSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9010568f49bSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9020568f49bSmrgm4_undefine([_defopt])
9039e7bcd65Smrg
9040568f49bSmrgif test "x$use_asciidoc" = x"auto"; then
9050568f49bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9060568f49bSmrg   if test "x$ASCIIDOC" = "x"; then
9070568f49bSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9080568f49bSmrg	have_asciidoc=no
9090568f49bSmrg   else
9100568f49bSmrg        have_asciidoc=yes
9110568f49bSmrg   fi
9120568f49bSmrgelif test "x$use_asciidoc" = x"yes" ; then
9130568f49bSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9140568f49bSmrg   if test "x$ASCIIDOC" = "x"; then
9150568f49bSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9160568f49bSmrg   fi
9170568f49bSmrg   have_asciidoc=yes
9180568f49bSmrgelif test "x$use_asciidoc" = x"no" ; then
9190568f49bSmrg   if test "x$ASCIIDOC" != "x"; then
9200568f49bSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9210568f49bSmrg   fi
9220568f49bSmrg   have_asciidoc=no
9230568f49bSmrgelse
9240568f49bSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9250568f49bSmrgfi
9260568f49bSmrgm4_ifval([$1],
9270568f49bSmrg[if test "$have_asciidoc" = yes; then
9280568f49bSmrg    # scrape the asciidoc version
9290568f49bSmrg    AC_MSG_CHECKING([the asciidoc version])
9300568f49bSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9310568f49bSmrg    AC_MSG_RESULT([$asciidoc_version])
9320568f49bSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9330568f49bSmrg        [if test "x$use_asciidoc" = xauto; then
9340568f49bSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9350568f49bSmrg            have_asciidoc=no
9360568f49bSmrg        else
9370568f49bSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9380568f49bSmrg        fi])
9390568f49bSmrgfi])
9400568f49bSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9410568f49bSmrg]) # XORG_WITH_ASCIIDOC
9429e7bcd65Smrg
9430568f49bSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9440568f49bSmrg# -------------------------------------------
9450568f49bSmrg# Minimum version: 1.5.0
9460568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9470568f49bSmrg# Minimum version for optional DOT checking: 1.18.0
948249c3046Smrg#
9490568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
9500568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
9510568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9520568f49bSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9530568f49bSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9540568f49bSmrg# --with-doxygen assumes 'auto'.
955bdf0f55dSmrg#
9560568f49bSmrg# Interface to module:
9570568f49bSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9580568f49bSmrg# DOXYGEN:	 returns the path of the doxygen program found
9590568f49bSmrg#		 returns the path set by the user in the environment
9600568f49bSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9610568f49bSmrg#		  'no' user instructs the module not to use doxygen
9629e7bcd65Smrg#
9630568f49bSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9649e7bcd65Smrg#
9650568f49bSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9660568f49bSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9670568f49bSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9680568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
9690568f49bSmrgAC_ARG_WITH(doxygen,
9700568f49bSmrg	AS_HELP_STRING([--with-doxygen],
9710568f49bSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9720568f49bSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9730568f49bSmrgm4_undefine([_defopt])
9741477040fSmrg
9750568f49bSmrgif test "x$use_doxygen" = x"auto"; then
9760568f49bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9770568f49bSmrg   if test "x$DOXYGEN" = "x"; then
9780568f49bSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9790568f49bSmrg	have_doxygen=no
9800568f49bSmrg   else
9810568f49bSmrg        have_doxygen=yes
9820568f49bSmrg   fi
9830568f49bSmrgelif test "x$use_doxygen" = x"yes" ; then
9840568f49bSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9850568f49bSmrg   if test "x$DOXYGEN" = "x"; then
9860568f49bSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9870568f49bSmrg   fi
9880568f49bSmrg   have_doxygen=yes
9890568f49bSmrgelif test "x$use_doxygen" = x"no" ; then
9900568f49bSmrg   if test "x$DOXYGEN" != "x"; then
9910568f49bSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9920568f49bSmrg   fi
9930568f49bSmrg   have_doxygen=no
9940568f49bSmrgelse
9950568f49bSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9960568f49bSmrgfi
9970568f49bSmrgm4_ifval([$1],
9980568f49bSmrg[if test "$have_doxygen" = yes; then
9990568f49bSmrg    # scrape the doxygen version
10000568f49bSmrg    AC_MSG_CHECKING([the doxygen version])
10010568f49bSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10020568f49bSmrg    AC_MSG_RESULT([$doxygen_version])
10030568f49bSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10040568f49bSmrg        [if test "x$use_doxygen" = xauto; then
10050568f49bSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10060568f49bSmrg            have_doxygen=no
10070568f49bSmrg        else
10080568f49bSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10090568f49bSmrg        fi])
10100568f49bSmrgfi])
10119e7bcd65Smrg
10120568f49bSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10130568f49bSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10140568f49bSmrgdnl 	HAVE_DOT = @HAVE_DOT@
10150568f49bSmrgHAVE_DOT=no
10160568f49bSmrgif test "x$have_doxygen" = "xyes"; then
10170568f49bSmrg  AC_PATH_PROG([DOT], [dot])
10180568f49bSmrg    if test "x$DOT" != "x"; then
10190568f49bSmrg      HAVE_DOT=yes
10209e7bcd65Smrg    fi
10219e7bcd65Smrgfi
10229e7bcd65Smrg
10230568f49bSmrgAC_SUBST([HAVE_DOT])
10240568f49bSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10250568f49bSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10260568f49bSmrg]) # XORG_WITH_DOXYGEN
10279e7bcd65Smrg
10280568f49bSmrg# XORG_WITH_GROFF([DEFAULT])
10299e7bcd65Smrg# ----------------
10300568f49bSmrg# Minimum version: 1.6.0
10310568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10320568f49bSmrg#
10330568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
10340568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
10350568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10360568f49bSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
10370568f49bSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
10380568f49bSmrg# --with-groff assumes 'auto'.
10390568f49bSmrg#
10400568f49bSmrg# Interface to module:
10410568f49bSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10420568f49bSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10430568f49bSmrg# HAVE_GROFF_MS: the -ms macros package
10440568f49bSmrg# GROFF:	 returns the path of the groff program found
10450568f49bSmrg#		 returns the path set by the user in the environment
10460568f49bSmrg# --with-groff:	 'yes' user instructs the module to use groff
10470568f49bSmrg#		 'no' user instructs the module not to use groff
10480568f49bSmrg#
10490568f49bSmrg# Added in version 1.9.0:
10500568f49bSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10510568f49bSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10520568f49bSmrg#		   psselect from the psutils package.
10530568f49bSmrg#		   the ghostcript package. Refer to the grohtml man pages
10540568f49bSmrg#
10550568f49bSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10560568f49bSmrg#
10570568f49bSmrg# OS and distros often splits groff in a basic and full package, the former
10580568f49bSmrg# having the groff program and the later having devices, fonts and macros
10590568f49bSmrg# Checking for the groff executable is not enough.
10600568f49bSmrg#
10610568f49bSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
10620568f49bSmrg# unset HAVE_GROFF or GROFF env variables.
10630568f49bSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10640568f49bSmrg#
10650568f49bSmrgAC_DEFUN([XORG_WITH_GROFF],[
10660568f49bSmrgAC_ARG_VAR([GROFF], [Path to groff command])
10670568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
10680568f49bSmrgAC_ARG_WITH(groff,
10690568f49bSmrg	AS_HELP_STRING([--with-groff],
10700568f49bSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10710568f49bSmrg	   [use_groff=$withval], [use_groff=]_defopt)
10720568f49bSmrgm4_undefine([_defopt])
10739e7bcd65Smrg
10740568f49bSmrgif test "x$use_groff" = x"auto"; then
10750568f49bSmrg   AC_PATH_PROG([GROFF], [groff])
10760568f49bSmrg   if test "x$GROFF" = "x"; then
10770568f49bSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10780568f49bSmrg	have_groff=no
10790568f49bSmrg   else
10800568f49bSmrg        have_groff=yes
10810568f49bSmrg   fi
10820568f49bSmrgelif test "x$use_groff" = x"yes" ; then
10830568f49bSmrg   AC_PATH_PROG([GROFF], [groff])
10840568f49bSmrg   if test "x$GROFF" = "x"; then
10850568f49bSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10860568f49bSmrg   fi
10870568f49bSmrg   have_groff=yes
10880568f49bSmrgelif test "x$use_groff" = x"no" ; then
10890568f49bSmrg   if test "x$GROFF" != "x"; then
10900568f49bSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10910568f49bSmrg   fi
10920568f49bSmrg   have_groff=no
10939e7bcd65Smrgelse
10940568f49bSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10959e7bcd65Smrgfi
10969e7bcd65Smrg
10970568f49bSmrg# We have groff, test for the presence of the macro packages
10980568f49bSmrgif test "x$have_groff" = x"yes"; then
10990568f49bSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11000568f49bSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11010568f49bSmrg        groff_ms_works=yes
11020568f49bSmrg    else
11030568f49bSmrg        groff_ms_works=no
11040568f49bSmrg    fi
11050568f49bSmrg    AC_MSG_RESULT([$groff_ms_works])
11060568f49bSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11070568f49bSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11080568f49bSmrg        groff_mm_works=yes
11090568f49bSmrg    else
11100568f49bSmrg        groff_mm_works=no
11110568f49bSmrg    fi
11120568f49bSmrg    AC_MSG_RESULT([$groff_mm_works])
11130568f49bSmrgfi
11149e7bcd65Smrg
11150568f49bSmrg# We have groff, test for HTML dependencies, one command per package
11160568f49bSmrgif test "x$have_groff" = x"yes"; then
11170568f49bSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11180568f49bSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11190568f49bSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11200568f49bSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11210568f49bSmrg      have_groff_html=yes
11220568f49bSmrg   else
11230568f49bSmrg      have_groff_html=no
11240568f49bSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11250568f49bSmrg   fi
11269e7bcd65Smrgfi
11279e7bcd65Smrg
11280568f49bSmrg# Set Automake conditionals for Makefiles
11290568f49bSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11300568f49bSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11310568f49bSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11320568f49bSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11330568f49bSmrg]) # XORG_WITH_GROFF
11349e7bcd65Smrg
11350568f49bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11360568f49bSmrg# ---------------------------------------
11370568f49bSmrg# Minimum version: 1.6.0
11380568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11390568f49bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11400568f49bSmrg#
11410568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
11420568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
11430568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11440568f49bSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
11450568f49bSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
11460568f49bSmrg# --with-fop assumes 'auto'.
11470568f49bSmrg#
11480568f49bSmrg# Interface to module:
11490568f49bSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11500568f49bSmrg# FOP:	 	returns the path of the fop program found
11510568f49bSmrg#		returns the path set by the user in the environment
11520568f49bSmrg# --with-fop: 	'yes' user instructs the module to use fop
11530568f49bSmrg#		'no' user instructs the module not to use fop
11540568f49bSmrg#
11550568f49bSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
11560568f49bSmrg#
11570568f49bSmrgAC_DEFUN([XORG_WITH_FOP],[
11580568f49bSmrgAC_ARG_VAR([FOP], [Path to fop command])
11590568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
11600568f49bSmrgAC_ARG_WITH(fop,
11610568f49bSmrg	AS_HELP_STRING([--with-fop],
11620568f49bSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11630568f49bSmrg	   [use_fop=$withval], [use_fop=]_defopt)
11640568f49bSmrgm4_undefine([_defopt])
11659e7bcd65Smrg
11660568f49bSmrgif test "x$use_fop" = x"auto"; then
11670568f49bSmrg   AC_PATH_PROG([FOP], [fop])
11680568f49bSmrg   if test "x$FOP" = "x"; then
11690568f49bSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11700568f49bSmrg	have_fop=no
11710568f49bSmrg   else
11720568f49bSmrg        have_fop=yes
11730568f49bSmrg   fi
11740568f49bSmrgelif test "x$use_fop" = x"yes" ; then
11750568f49bSmrg   AC_PATH_PROG([FOP], [fop])
11760568f49bSmrg   if test "x$FOP" = "x"; then
11770568f49bSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11780568f49bSmrg   fi
11790568f49bSmrg   have_fop=yes
11800568f49bSmrgelif test "x$use_fop" = x"no" ; then
11810568f49bSmrg   if test "x$FOP" != "x"; then
11820568f49bSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11830568f49bSmrg   fi
11840568f49bSmrg   have_fop=no
11859e7bcd65Smrgelse
11860568f49bSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11879e7bcd65Smrgfi
11889e7bcd65Smrg
11890568f49bSmrg# Test for a minimum version of fop, if provided.
11900568f49bSmrgm4_ifval([$1],
11910568f49bSmrg[if test "$have_fop" = yes; then
11920568f49bSmrg    # scrape the fop version
11930568f49bSmrg    AC_MSG_CHECKING([for fop minimum version])
11940568f49bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11950568f49bSmrg    AC_MSG_RESULT([$fop_version])
11960568f49bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
11970568f49bSmrg        [if test "x$use_fop" = xauto; then
11980568f49bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11990568f49bSmrg            have_fop=no
12000568f49bSmrg        else
12010568f49bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12020568f49bSmrg        fi])
12030568f49bSmrgfi])
12040568f49bSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12050568f49bSmrg]) # XORG_WITH_FOP
12069e7bcd65Smrg
12070568f49bSmrg# XORG_WITH_M4([MIN-VERSION])
12080568f49bSmrg# ---------------------------
12090568f49bSmrg# Minimum version: 1.19.0
12109e7bcd65Smrg#
12110568f49bSmrg# This macro attempts to locate an m4 macro processor which supports
12120568f49bSmrg# -I option and is only useful for modules relying on M4 in order to
12130568f49bSmrg# expand macros in source code files.
12149e7bcd65Smrg#
12150568f49bSmrg# Interface to module:
12160568f49bSmrg# M4:	 	returns the path of the m4 program found
12170568f49bSmrg#		returns the path set by the user in the environment
12180568f49bSmrg#
12190568f49bSmrgAC_DEFUN([XORG_WITH_M4], [
12200568f49bSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12210568f49bSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12220568f49bSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12230568f49bSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12240568f49bSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12250568f49bSmrg   [$PATH:/usr/gnu/bin])])
12269e7bcd65Smrg
12270568f49bSmrgAC_SUBST([M4], [$ac_cv_path_M4])
12280568f49bSmrg]) # XORG_WITH_M4
12299e7bcd65Smrg
12300568f49bSmrg# XORG_WITH_PS2PDF([DEFAULT])
12310568f49bSmrg# ----------------
12320568f49bSmrg# Minimum version: 1.6.0
12330568f49bSmrg# Minimum version for optional DEFAULT argument: 1.11.0
12340568f49bSmrg#
12350568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
12360568f49bSmrg# not at the appropriate level. This macro enables a module to test for the
12370568f49bSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12380568f49bSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12390568f49bSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12400568f49bSmrg# --with-ps2pdf assumes 'auto'.
12410568f49bSmrg#
12420568f49bSmrg# Interface to module:
12430568f49bSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12440568f49bSmrg# PS2PDF:	returns the path of the ps2pdf program found
12450568f49bSmrg#		returns the path set by the user in the environment
12460568f49bSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12470568f49bSmrg#		 'no' user instructs the module not to use ps2pdf
12489e7bcd65Smrg#
12490568f49bSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
12509e7bcd65Smrg#
12510568f49bSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12520568f49bSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12530568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
12540568f49bSmrgAC_ARG_WITH(ps2pdf,
12550568f49bSmrg	AS_HELP_STRING([--with-ps2pdf],
12560568f49bSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12570568f49bSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12580568f49bSmrgm4_undefine([_defopt])
12599e7bcd65Smrg
12600568f49bSmrgif test "x$use_ps2pdf" = x"auto"; then
12610568f49bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12620568f49bSmrg   if test "x$PS2PDF" = "x"; then
12630568f49bSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12640568f49bSmrg	have_ps2pdf=no
12650568f49bSmrg   else
12660568f49bSmrg        have_ps2pdf=yes
12670568f49bSmrg   fi
12680568f49bSmrgelif test "x$use_ps2pdf" = x"yes" ; then
12690568f49bSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12700568f49bSmrg   if test "x$PS2PDF" = "x"; then
12710568f49bSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12720568f49bSmrg   fi
12730568f49bSmrg   have_ps2pdf=yes
12740568f49bSmrgelif test "x$use_ps2pdf" = x"no" ; then
12750568f49bSmrg   if test "x$PS2PDF" != "x"; then
12760568f49bSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12770568f49bSmrg   fi
12780568f49bSmrg   have_ps2pdf=no
12790568f49bSmrgelse
12800568f49bSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12810568f49bSmrgfi
12820568f49bSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12830568f49bSmrg]) # XORG_WITH_PS2PDF
12849e7bcd65Smrg
12850568f49bSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
12860568f49bSmrg# ----------------
12870568f49bSmrg# Minimum version: 1.6.0
12880568f49bSmrg#
12890568f49bSmrg# Documentation tools are not always available on all platforms and sometimes
12900568f49bSmrg# not at the appropriate level. This macro enables a builder to skip all
12910568f49bSmrg# documentation targets except traditional man pages.
12920568f49bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12930568f49bSmrg# maximum flexibilty in controlling documentation building.
12940568f49bSmrg# Refer to:
12950568f49bSmrg# XORG_WITH_XMLTO         --with-xmlto
12960568f49bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12970568f49bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12980568f49bSmrg# XORG_WITH_FOP           --with-fop
12990568f49bSmrg# XORG_WITH_GROFF         --with-groff
13000568f49bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13010568f49bSmrg#
13020568f49bSmrg# Interface to module:
13030568f49bSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13040568f49bSmrg# --enable-docs: 'yes' user instructs the module to generate docs
13050568f49bSmrg#		 'no' user instructs the module not to generate docs
13060568f49bSmrg# parm1:	specify the default value, yes or no.
13070568f49bSmrg#
13080568f49bSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13090568f49bSmrgm4_define([docs_default], m4_default([$1], [yes]))
13100568f49bSmrgAC_ARG_ENABLE(docs,
13110568f49bSmrg	AS_HELP_STRING([--enable-docs],
13120568f49bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
13130568f49bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
13140568f49bSmrgm4_undefine([docs_default])
13150568f49bSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13160568f49bSmrgAC_MSG_CHECKING([whether to build documentation])
13170568f49bSmrgAC_MSG_RESULT([$build_docs])
13180568f49bSmrg]) # XORG_ENABLE_DOCS
13199e7bcd65Smrg
13200568f49bSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13210568f49bSmrg# ----------------
13220568f49bSmrg# Minimum version: 1.6.0
13230568f49bSmrg#
13240568f49bSmrg# This macro enables a builder to skip all developer documentation.
13250568f49bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13260568f49bSmrg# maximum flexibilty in controlling documentation building.
13270568f49bSmrg# Refer to:
13280568f49bSmrg# XORG_WITH_XMLTO         --with-xmlto
13290568f49bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13300568f49bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13310568f49bSmrg# XORG_WITH_FOP           --with-fop
13320568f49bSmrg# XORG_WITH_GROFF         --with-groff
13330568f49bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13340568f49bSmrg#
13350568f49bSmrg# Interface to module:
13360568f49bSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13370568f49bSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13380568f49bSmrg#			'no' user instructs the module not to generate developer docs
13390568f49bSmrg# parm1:		specify the default value, yes or no.
13400568f49bSmrg#
13410568f49bSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13420568f49bSmrgm4_define([devel_default], m4_default([$1], [yes]))
13430568f49bSmrgAC_ARG_ENABLE(devel-docs,
13440568f49bSmrg	AS_HELP_STRING([--enable-devel-docs],
13450568f49bSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13460568f49bSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13470568f49bSmrgm4_undefine([devel_default])
13480568f49bSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13490568f49bSmrgAC_MSG_CHECKING([whether to build developer documentation])
13500568f49bSmrgAC_MSG_RESULT([$build_devel_docs])
13510568f49bSmrg]) # XORG_ENABLE_DEVEL_DOCS
13529e7bcd65Smrg
13530568f49bSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
13540568f49bSmrg# ----------------
13550568f49bSmrg# Minimum version: 1.6.0
13560568f49bSmrg#
13570568f49bSmrg# This macro enables a builder to skip all functional specification targets.
13580568f49bSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13590568f49bSmrg# maximum flexibilty in controlling documentation building.
13600568f49bSmrg# Refer to:
13610568f49bSmrg# XORG_WITH_XMLTO         --with-xmlto
13620568f49bSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13630568f49bSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13640568f49bSmrg# XORG_WITH_FOP           --with-fop
13650568f49bSmrg# XORG_WITH_GROFF         --with-groff
13660568f49bSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13670568f49bSmrg#
13680568f49bSmrg# Interface to module:
13690568f49bSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13700568f49bSmrg# --enable-specs:	'yes' user instructs the module to generate specs
13710568f49bSmrg#			'no' user instructs the module not to generate specs
13720568f49bSmrg# parm1:		specify the default value, yes or no.
13730568f49bSmrg#
13740568f49bSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13750568f49bSmrgm4_define([spec_default], m4_default([$1], [yes]))
13760568f49bSmrgAC_ARG_ENABLE(specs,
13770568f49bSmrg	AS_HELP_STRING([--enable-specs],
13780568f49bSmrg	   [Enable building the specs (default: ]spec_default[)]),
13790568f49bSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
13800568f49bSmrgm4_undefine([spec_default])
13810568f49bSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13820568f49bSmrgAC_MSG_CHECKING([whether to build functional specifications])
13830568f49bSmrgAC_MSG_RESULT([$build_specs])
13840568f49bSmrg]) # XORG_ENABLE_SPECS
13859e7bcd65Smrg
13860568f49bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13870568f49bSmrg# ----------------------------------------------
13880568f49bSmrg# Minimum version: 1.13.0
13890568f49bSmrg#
13900568f49bSmrg# This macro enables a builder to enable/disable unit testing
13910568f49bSmrg# It makes no assumption about the test cases implementation
13920568f49bSmrg# Test cases may or may not use Automake "Support for test suites"
13930568f49bSmrg# They may or may not use the software utility library GLib
13940568f49bSmrg#
13950568f49bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13960568f49bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13970568f49bSmrg# The variable enable_unit_tests is used by other macros in this file.
13980568f49bSmrg#
13990568f49bSmrg# Interface to module:
14000568f49bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14010568f49bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
14020568f49bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14030568f49bSmrg#			'no' user instructs the module not to build tests
14040568f49bSmrg# parm1:		specify the default value, yes or no.
14050568f49bSmrg#
14060568f49bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14070568f49bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14080568f49bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14090568f49bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14100568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
14110568f49bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14120568f49bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
14130568f49bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14140568f49bSmrgm4_undefine([_defopt])
14150568f49bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14160568f49bSmrgAC_MSG_CHECKING([whether to build unit test cases])
14170568f49bSmrgAC_MSG_RESULT([$enable_unit_tests])
14180568f49bSmrg]) # XORG_ENABLE_UNIT_TESTS
14199e7bcd65Smrg
14200568f49bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14210568f49bSmrg# ------------------------------------------------------
14220568f49bSmrg# Minimum version: 1.17.0
14230568f49bSmrg#
14240568f49bSmrg# This macro enables a builder to enable/disable integration testing
14250568f49bSmrg# It makes no assumption about the test cases' implementation
14260568f49bSmrg# Test cases may or may not use Automake "Support for test suites"
14270568f49bSmrg#
14280568f49bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14290568f49bSmrg# usually requires less dependencies and may be built and run under less
14300568f49bSmrg# stringent environments than integration tests.
14310568f49bSmrg#
14320568f49bSmrg# Interface to module:
14330568f49bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14340568f49bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
14350568f49bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14360568f49bSmrg#                             'no' user instructs the module not to build tests
14370568f49bSmrg# parm1:                      specify the default value, yes or no.
14380568f49bSmrg#
14390568f49bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14400568f49bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14410568f49bSmrgm4_define([_defopt], m4_default([$1], [auto]))
14420568f49bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14430568f49bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
14440568f49bSmrg	[enable_integration_tests=$enableval],
14450568f49bSmrg	[enable_integration_tests=]_defopt)
14460568f49bSmrgm4_undefine([_defopt])
14470568f49bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14480568f49bSmrg	[test "x$enable_integration_tests" != xno])
14490568f49bSmrgAC_MSG_CHECKING([whether to build unit test cases])
14500568f49bSmrgAC_MSG_RESULT([$enable_integration_tests])
14510568f49bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
14529e7bcd65Smrg
14530568f49bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14540568f49bSmrg# ----------------------------------------
14550568f49bSmrg# Minimum version: 1.13.0
14560568f49bSmrg#
14570568f49bSmrg# GLib is a library which provides advanced data structures and functions.
14580568f49bSmrg# This macro enables a module to test for the presence of Glib.
14590568f49bSmrg#
14600568f49bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14610568f49bSmrg# Otherwise the value of $enable_unit_tests is blank.
14620568f49bSmrg#
14630568f49bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14640568f49bSmrg# test support usually requires less dependencies and may be built and run under
14650568f49bSmrg# less stringent environments than integration tests.
14660568f49bSmrg#
14670568f49bSmrg# Interface to module:
14680568f49bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
14690568f49bSmrg# with_glib: used in configure.ac to know if GLib has been found
14700568f49bSmrg# --with-glib:	'yes' user instructs the module to use glib
14710568f49bSmrg#		'no' user instructs the module not to use glib
14720568f49bSmrg#
14730568f49bSmrgAC_DEFUN([XORG_WITH_GLIB],[
14740568f49bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14750568f49bSmrgm4_define([_defopt], m4_default([$2], [auto]))
14760568f49bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14770568f49bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14780568f49bSmrg	[with_glib=$withval], [with_glib=]_defopt)
14790568f49bSmrgm4_undefine([_defopt])
14809e7bcd65Smrg
14810568f49bSmrghave_glib=no
14820568f49bSmrg# Do not probe GLib if user explicitly disabled unit testing
14830568f49bSmrgif test "x$enable_unit_tests" != x"no"; then
14840568f49bSmrg  # Do not probe GLib if user explicitly disabled it
14850568f49bSmrg  if test "x$with_glib" != x"no"; then
14860568f49bSmrg    m4_ifval(
14870568f49bSmrg      [$1],
14880568f49bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14890568f49bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14900568f49bSmrg    )
14910568f49bSmrg  fi
14920568f49bSmrgfi
14939e7bcd65Smrg
14940568f49bSmrg# Not having GLib when unit testing has been explicitly requested is an error
14950568f49bSmrgif test "x$enable_unit_tests" = x"yes"; then
14960568f49bSmrg  if test "x$have_glib" = x"no"; then
14970568f49bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14980568f49bSmrg  fi
14990568f49bSmrgfi
15009e7bcd65Smrg
15010568f49bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
15020568f49bSmrgif test "x$enable_unit_tests" = x"no"; then
15030568f49bSmrg  if test "x$with_glib" = x"yes"; then
15040568f49bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15050568f49bSmrg  fi
15060568f49bSmrgfi
15079e7bcd65Smrg
15080568f49bSmrg# Not having GLib when it has been explicitly requested is an error
15090568f49bSmrgif test "x$with_glib" = x"yes"; then
15100568f49bSmrg  if test "x$have_glib" = x"no"; then
15110568f49bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15120568f49bSmrg  fi
15130568f49bSmrgfi
15149e7bcd65Smrg
15150568f49bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15160568f49bSmrg]) # XORG_WITH_GLIB
15179e7bcd65Smrg
15180568f49bSmrg# XORG_LD_WRAP([required|optional])
15190568f49bSmrg# ---------------------------------
15200568f49bSmrg# Minimum version: 1.13.0
15219e7bcd65Smrg#
15220568f49bSmrg# Check if linker supports -wrap, passed via compiler flags
15239e7bcd65Smrg#
15240568f49bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15250568f49bSmrg# Otherwise the value of $enable_unit_tests is blank.
15260568f49bSmrg#
15270568f49bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15280568f49bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15290568f49bSmrg# available, an argument of "optional" allows use when some unit tests require
15300568f49bSmrg# ld -wrap and others do not.
15310568f49bSmrg#
15320568f49bSmrgAC_DEFUN([XORG_LD_WRAP],[
15330568f49bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15340568f49bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15350568f49bSmrg                      void __wrap_exit(int status) { return; }],
15360568f49bSmrg                     [exit(0);])])
15370568f49bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
15380568f49bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15390568f49bSmrg  if test "x$have_ld_wrap" = x"no"; then
15400568f49bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15410568f49bSmrg  fi
15429e7bcd65Smrgfi
15430568f49bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15440568f49bSmrg#
15450568f49bSmrg]) # XORG_LD_WRAP
15469e7bcd65Smrg
15470568f49bSmrg# XORG_CHECK_LINKER_FLAGS
15480568f49bSmrg# -----------------------
15490568f49bSmrg# SYNOPSIS
15509e7bcd65Smrg#
15510568f49bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15529e7bcd65Smrg#
15530568f49bSmrg# DESCRIPTION
15549e7bcd65Smrg#
15550568f49bSmrg#   Check whether the given linker FLAGS work with the current language's
15560568f49bSmrg#   linker, or whether they give an error.
15579e7bcd65Smrg#
15580568f49bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15590568f49bSmrg#   success/failure.
15609e7bcd65Smrg#
15610568f49bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
15629e7bcd65Smrg#
15630568f49bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15649e7bcd65Smrg#
15650568f49bSmrg# LICENSE
15669e7bcd65Smrg#
15670568f49bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15680568f49bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15690568f49bSmrg#   Copyright (c) 2009 Matteo Frigo
15709e7bcd65Smrg#
15710568f49bSmrg#   This program is free software: you can redistribute it and/or modify it
15720568f49bSmrg#   under the terms of the GNU General Public License as published by the
15730568f49bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
15740568f49bSmrg#   option) any later version.
15759e7bcd65Smrg#
15760568f49bSmrg#   This program is distributed in the hope that it will be useful, but
15770568f49bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15780568f49bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15790568f49bSmrg#   Public License for more details.
15809e7bcd65Smrg#
15810568f49bSmrg#   You should have received a copy of the GNU General Public License along
15820568f49bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15839e7bcd65Smrg#
15840568f49bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
15850568f49bSmrg#   gives unlimited permission to copy, distribute and modify the configure
15860568f49bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
15870568f49bSmrg#   need not follow the terms of the GNU General Public License when using
15880568f49bSmrg#   or distributing such scripts, even though portions of the text of the
15890568f49bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15900568f49bSmrg#   all other use of the material that constitutes the Autoconf Macro.
15910568f49bSmrg#
15920568f49bSmrg#   This special exception to the GPL applies to versions of the Autoconf
15930568f49bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
15940568f49bSmrg#   modified version of the Autoconf Macro, you may extend this special
15950568f49bSmrg#   exception to the GPL to apply to your modified version as well.#
15960568f49bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15970568f49bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
15980568f49bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15990568f49bSmrgAS_LITERAL_IF([$1],
16000568f49bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16010568f49bSmrg      ax_save_FLAGS=$LDFLAGS
16020568f49bSmrg      LDFLAGS="$1"
16030568f49bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16040568f49bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16050568f49bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16060568f49bSmrg      LDFLAGS=$ax_save_FLAGS])],
16070568f49bSmrg  [ax_save_FLAGS=$LDFLAGS
16080568f49bSmrg   LDFLAGS="$1"
16090568f49bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16100568f49bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16110568f49bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16120568f49bSmrg   LDFLAGS=$ax_save_FLAGS])
16130568f49bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16140568f49bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
16150568f49bSmrgif test "x$xorg_check_linker_flags" = xyes; then
16160568f49bSmrg	m4_default([$2], :)
16179e7bcd65Smrgelse
16180568f49bSmrg	m4_default([$3], :)
16199e7bcd65Smrgfi
16200568f49bSmrg]) # XORG_CHECK_LINKER_FLAGS
16219e7bcd65Smrg
16220568f49bSmrg# XORG_MEMORY_CHECK_FLAGS
16239e7bcd65Smrg# -----------------------
16240568f49bSmrg# Minimum version: 1.16.0
16259e7bcd65Smrg#
16260568f49bSmrg# This macro attempts to find appropriate memory checking functionality
16270568f49bSmrg# for various platforms which unit testing code may use to catch various
16280568f49bSmrg# forms of memory allocation and access errors in testing.
16290568f49bSmrg#
16300568f49bSmrg# Interface to module:
16310568f49bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16320568f49bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16330568f49bSmrg#
16340568f49bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16350568f49bSmrg#
16360568f49bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
16379e7bcd65Smrg
16389e7bcd65SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16390568f49bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16400568f49bSmrg           [Environment variables to enable memory checking in tests])
16419e7bcd65Smrg
16420568f49bSmrg# Check for different types of support on different platforms
16430568f49bSmrgcase $host_os in
16440568f49bSmrg    solaris*)
16450568f49bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
16460568f49bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16470568f49bSmrg        ;;
16480568f49bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16490568f49bSmrg        # both directly and inverted, so should not be 0 or 255.
16500568f49bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
16510568f49bSmrg        ;;
16520568f49bSmrg    darwin*)
16530568f49bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16540568f49bSmrg        ;;
16550568f49bSmrg    *bsd*)
16560568f49bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16570568f49bSmrg        ;;
16580568f49bSmrgesac
16599e7bcd65Smrg
16600568f49bSmrg# User supplied flags override default flags
16610568f49bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16620568f49bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16639e7bcd65Smrgfi
16649e7bcd65Smrg
16650568f49bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16660568f49bSmrg]) # XORG_WITH_LINT
16679e7bcd65Smrg
16680568f49bSmrg# XORG_CHECK_MALLOC_ZERO
16690568f49bSmrg# ----------------------
16700568f49bSmrg# Minimum version: 1.0.0
16710568f49bSmrg#
16720568f49bSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16730568f49bSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16740568f49bSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16750568f49bSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16760568f49bSmrgAC_ARG_ENABLE(malloc0returnsnull,
16770568f49bSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16780568f49bSmrg		       [malloc(0) returns NULL (default: auto)]),
16790568f49bSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16800568f49bSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16819e7bcd65Smrg
16820568f49bSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16830568f49bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16840568f49bSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16850568f49bSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16860568f49bSmrg#include <stdlib.h>
16870568f49bSmrg],[
16880568f49bSmrg    char *m0, *r0, *c0, *p;
16890568f49bSmrg    m0 = malloc(0);
16900568f49bSmrg    p = malloc(10);
16910568f49bSmrg    r0 = realloc(p,0);
16920568f49bSmrg    c0 = calloc(0,10);
16930568f49bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16940568f49bSmrg])],
16950568f49bSmrg		[xorg_cv_malloc0_returns_null=yes],
16960568f49bSmrg		[xorg_cv_malloc0_returns_null=no])])
16970568f49bSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16989e7bcd65Smrgfi
16990568f49bSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17009e7bcd65Smrg
17010568f49bSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17020568f49bSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17030568f49bSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17040568f49bSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17059e7bcd65Smrgelse
17060568f49bSmrg	MALLOC_ZERO_CFLAGS=""
17070568f49bSmrg	XMALLOC_ZERO_CFLAGS=""
17080568f49bSmrg	XTMALLOC_ZERO_CFLAGS=""
17099e7bcd65Smrgfi
17109e7bcd65Smrg
17110568f49bSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17120568f49bSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17130568f49bSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17140568f49bSmrg]) # XORG_CHECK_MALLOC_ZERO
17159e7bcd65Smrg
17160568f49bSmrg# XORG_WITH_LINT()
17170568f49bSmrg# ----------------
17180568f49bSmrg# Minimum version: 1.1.0
17199e7bcd65Smrg#
17200568f49bSmrg# This macro enables the use of a tool that flags some suspicious and
17210568f49bSmrg# non-portable constructs (likely to be bugs) in C language source code.
17220568f49bSmrg# It will attempt to locate the tool and use appropriate options.
17230568f49bSmrg# There are various lint type tools on different platforms.
17240568f49bSmrg#
17250568f49bSmrg# Interface to module:
17260568f49bSmrg# LINT:		returns the path to the tool found on the platform
17270568f49bSmrg#		or the value set to LINT on the configure cmd line
17280568f49bSmrg#		also an Automake conditional
17290568f49bSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
17300568f49bSmrg#
17310568f49bSmrg# --with-lint:	'yes' user instructs the module to use lint
17320568f49bSmrg#		'no' user instructs the module not to use lint (default)
17330568f49bSmrg#
17340568f49bSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17350568f49bSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17360568f49bSmrg#
17370568f49bSmrgAC_DEFUN([XORG_WITH_LINT],[
17389e7bcd65Smrg
17390568f49bSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17400568f49bSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17410568f49bSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17420568f49bSmrg		[Use a lint-style source code checker (default: disabled)])],
17430568f49bSmrg		[use_lint=$withval], [use_lint=no])
17449e7bcd65Smrg
17450568f49bSmrg# Obtain platform specific info like program name and options
17460568f49bSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17470568f49bSmrgcase $host_os in
17480568f49bSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17490568f49bSmrg	lint_name=splint
17500568f49bSmrg	lint_options="-badflag"
17510568f49bSmrg	;;
17520568f49bSmrg  *freebsd* | *netbsd*)
17530568f49bSmrg	lint_name=lint
17540568f49bSmrg	lint_options="-u -b"
17550568f49bSmrg	;;
17560568f49bSmrg  *solaris*)
17570568f49bSmrg	lint_name=lint
17580568f49bSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17590568f49bSmrg	;;
17600568f49bSmrgesac
17619e7bcd65Smrg
17620568f49bSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17630568f49bSmrgif test "x$use_lint" = x"yes" ; then
17640568f49bSmrg   AC_PATH_PROG([LINT], [$lint_name])
17650568f49bSmrg   if test "x$LINT" = "x"; then
17660568f49bSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17670568f49bSmrg   fi
17680568f49bSmrgelif test "x$use_lint" = x"no" ; then
17690568f49bSmrg   if test "x$LINT" != "x"; then
17700568f49bSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17710568f49bSmrg   fi
17729e7bcd65Smrgelse
17730568f49bSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17749e7bcd65Smrgfi
17759e7bcd65Smrg
17760568f49bSmrg# User supplied flags override default flags
17770568f49bSmrgif test "x$LINT_FLAGS" != "x"; then
17780568f49bSmrg   lint_options=$LINT_FLAGS
17799e7bcd65Smrgfi
17809e7bcd65Smrg
17810568f49bSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17820568f49bSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17839e7bcd65Smrg
17840568f49bSmrg]) # XORG_WITH_LINT
17859e7bcd65Smrg
17860568f49bSmrg# XORG_LINT_LIBRARY(LIBNAME)
17870568f49bSmrg# --------------------------
17880568f49bSmrg# Minimum version: 1.1.0
17899e7bcd65Smrg#
17900568f49bSmrg# Sets up flags for building lint libraries for checking programs that call
17910568f49bSmrg# functions in the library.
17920568f49bSmrg#
17930568f49bSmrg# Interface to module:
17940568f49bSmrg# LINTLIB		- Automake variable with the name of lint library file to make
17950568f49bSmrg# MAKE_LINT_LIB		- Automake conditional
17960568f49bSmrg#
17970568f49bSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17980568f49bSmrg#			  - 'no' user instructs the module not to create a lint library (default)
17999e7bcd65Smrg
18000568f49bSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18010568f49bSmrgAC_REQUIRE([XORG_WITH_LINT])
18020568f49bSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18030568f49bSmrg	[Create lint library (default: disabled)])],
18040568f49bSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18059e7bcd65Smrg
18060568f49bSmrgif test "x$make_lint_lib" = x"yes" ; then
18070568f49bSmrg   LINTLIB=llib-l$1.ln
18080568f49bSmrg   if test "x$LINT" = "x"; then
18090568f49bSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18100568f49bSmrg   fi
18110568f49bSmrgelif test "x$make_lint_lib" != x"no" ; then
18120568f49bSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18139e7bcd65Smrgfi
18149e7bcd65Smrg
18150568f49bSmrgAC_SUBST(LINTLIB)
18160568f49bSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18179e7bcd65Smrg
18180568f49bSmrg]) # XORG_LINT_LIBRARY
18199e7bcd65Smrg
18200568f49bSmrg# XORG_COMPILER_BRAND
18210568f49bSmrg# -------------------
18220568f49bSmrg# Minimum version: 1.14.0
18239e7bcd65Smrg#
18240568f49bSmrg# Checks for various brands of compilers and sets flags as appropriate:
18250568f49bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18260568f49bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18270568f49bSmrg#   clang compiler - sets CLANGCC to "yes"
18280568f49bSmrg#   Intel compiler - sets INTELCC to "yes"
18290568f49bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18309e7bcd65Smrg#
18310568f49bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18320568f49bSmrgAC_LANG_CASE(
18330568f49bSmrg	[C], [
18340568f49bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
18350568f49bSmrg	],
18360568f49bSmrg	[C++], [
18370568f49bSmrg		AC_REQUIRE([AC_PROG_CXX])
18380568f49bSmrg	]
18390568f49bSmrg)
18400568f49bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18410568f49bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18420568f49bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18430568f49bSmrg]) # XORG_COMPILER_BRAND
18440568f49bSmrg
18450568f49bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18460568f49bSmrg# ---------------
18470568f49bSmrg# Minimum version: 1.16.0
18489e7bcd65Smrg#
18490568f49bSmrg# Test if the compiler works when passed the given flag as a command line argument.
18500568f49bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18510568f49bSmrg# next flag in the list until there are no more options.
18529e7bcd65Smrg#
18530568f49bSmrg# Note that this does not guarantee that the compiler supports the flag as some
18540568f49bSmrg# compilers will simply ignore arguments that they do not understand, but we do
18550568f49bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18560568f49bSmrg# -Werror=unused-command-line-argument
18579e7bcd65Smrg#
18580568f49bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18590568f49bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18600568f49bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18619e7bcd65Smrg
18620568f49bSmrgAC_LANG_COMPILER_REQUIRE
18630568f49bSmrg
18640568f49bSmrgAC_LANG_CASE(
18650568f49bSmrg	[C], [
18660568f49bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
18670568f49bSmrg		define([PREFIX], [C])
18680568f49bSmrg		define([CACHE_PREFIX], [cc])
18690568f49bSmrg		define([COMPILER], [$CC])
18700568f49bSmrg	],
18710568f49bSmrg	[C++], [
18720568f49bSmrg		define([PREFIX], [CXX])
18730568f49bSmrg		define([CACHE_PREFIX], [cxx])
18740568f49bSmrg		define([COMPILER], [$CXX])
18750568f49bSmrg	]
18760568f49bSmrg)
18770568f49bSmrg
18780568f49bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18790568f49bSmrg
18800568f49bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18810568f49bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18820568f49bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18830568f49bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18840568f49bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18850568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18860568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18870568f49bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18880568f49bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18899e7bcd65Smrgfi
18909e7bcd65Smrg
18910568f49bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18920568f49bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18930568f49bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18940568f49bSmrg	fi
18950568f49bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18960568f49bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18970568f49bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18980568f49bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18990568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19000568f49bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19010568f49bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19020568f49bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19030568f49bSmrgfi
19049e7bcd65Smrg
19050568f49bSmrgfound="no"
19060568f49bSmrgm4_foreach([flag], m4_cdr($@), [
19070568f49bSmrg	if test $found = "no" ; then
19080568f49bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19090568f49bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19100568f49bSmrg		fi
19119e7bcd65Smrg
19120568f49bSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19130568f49bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19140568f49bSmrg		fi
19150568f49bSmrg
19160568f49bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19170568f49bSmrg
19180568f49bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19190568f49bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19200568f49bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19210568f49bSmrg		AC_CACHE_VAL($cacheid,
19220568f49bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19230568f49bSmrg					     [eval $cacheid=yes],
19240568f49bSmrg					     [eval $cacheid=no])])
19250568f49bSmrg
19260568f49bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19270568f49bSmrg
19280568f49bSmrg		eval supported=\$$cacheid
19290568f49bSmrg		AC_MSG_RESULT([$supported])
19300568f49bSmrg		if test "$supported" = "yes" ; then
19310568f49bSmrg			$1="$$1 ]flag["
19320568f49bSmrg			found="yes"
19330568f49bSmrg		fi
19340568f49bSmrg	fi
19350568f49bSmrg])
19360568f49bSmrg]) # XORG_TESTSET_CFLAG
19370568f49bSmrg
19380568f49bSmrg# XORG_COMPILER_FLAGS
19390568f49bSmrg# ---------------
19400568f49bSmrg# Minimum version: 1.16.0
19419e7bcd65Smrg#
19420568f49bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19430568f49bSmrg# arguments supported by the selected compiler which do NOT alter the generated
19440568f49bSmrg# code.  These arguments will cause the compiler to print various warnings
19450568f49bSmrg# during compilation AND turn a conservative set of warnings into errors.
19469e7bcd65Smrg#
19470568f49bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19480568f49bSmrg# future versions of util-macros as options are added to new compilers.
19499e7bcd65Smrg#
19500568f49bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19510568f49bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19529e7bcd65Smrg
19530568f49bSmrgAC_ARG_ENABLE(selective-werror,
19540568f49bSmrg              AS_HELP_STRING([--disable-selective-werror],
19550568f49bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
19560568f49bSmrg              [SELECTIVE_WERROR=$enableval],
19570568f49bSmrg              [SELECTIVE_WERROR=yes])
19580568f49bSmrg
19590568f49bSmrgAC_LANG_CASE(
19600568f49bSmrg        [C], [
19610568f49bSmrg                define([PREFIX], [C])
19620568f49bSmrg        ],
19630568f49bSmrg        [C++], [
19640568f49bSmrg                define([PREFIX], [CXX])
19650568f49bSmrg        ]
19660568f49bSmrg)
19670568f49bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19680568f49bSmrgif test "x$SUNCC" = "xyes"; then
19690568f49bSmrg    [BASE_]PREFIX[FLAGS]="-v"
19709e7bcd65Smrgelse
19710568f49bSmrg    [BASE_]PREFIX[FLAGS]=""
19729e7bcd65Smrgfi
19739e7bcd65Smrg
19740568f49bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19750568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19760568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19770568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19780568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19799e7bcd65Smrg
19800568f49bSmrgAC_LANG_CASE(
19810568f49bSmrg	[C], [
19820568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19830568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19840568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19850568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19860568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19870568f49bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19880568f49bSmrg	]
19890568f49bSmrg)
19909e7bcd65Smrg
19910568f49bSmrg# This chunk adds additional warnings that could catch undesired effects.
19920568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19930568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19940568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19950568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19960568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19970568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19980568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19990568f49bSmrg
20000568f49bSmrg# These are currently disabled because they are noisy.  They will be enabled
20010568f49bSmrg# in the future once the codebase is sufficiently modernized to silence
20020568f49bSmrg# them.  For now, I don't want them to drown out the other warnings.
20030568f49bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20040568f49bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20050568f49bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20060568f49bSmrg
20070568f49bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
20080568f49bSmrg# when there are problems that should be fixed.
20090568f49bSmrg
20100568f49bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20110568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20120568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20130568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20140568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20150568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20160568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20170568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20180568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20190568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20200568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20210568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20220568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20230568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20249e7bcd65Smrgelse
20250568f49bSmrgAC_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])
20260568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20270568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20280568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20290568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20300568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20310568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20320568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20330568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20340568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20350568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20360568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20370568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20380568f49bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20399e7bcd65Smrgfi
20409e7bcd65Smrg
20410568f49bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20420568f49bSmrg]) # XORG_COMPILER_FLAGS
20439e7bcd65Smrg
20440568f49bSmrg# XORG_CWARNFLAGS
20450568f49bSmrg# ---------------
20460568f49bSmrg# Minimum version: 1.2.0
20470568f49bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
20489e7bcd65Smrg#
20490568f49bSmrg# Defines CWARNFLAGS to enable C compiler warnings.
20509e7bcd65Smrg#
20510568f49bSmrg# This function is deprecated because it defines -fno-strict-aliasing
20520568f49bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20530568f49bSmrg# is needed, then it should be added explicitly in the module when
20540568f49bSmrg# it is updated to use BASE_CFLAGS.
20559e7bcd65Smrg#
20560568f49bSmrgAC_DEFUN([XORG_CWARNFLAGS], [
20570568f49bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20580568f49bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20590568f49bSmrgAC_LANG_CASE(
20600568f49bSmrg	[C], [
20610568f49bSmrg		CWARNFLAGS="$BASE_CFLAGS"
20620568f49bSmrg		if  test "x$GCC" = xyes ; then
20630568f49bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20640568f49bSmrg		fi
20650568f49bSmrg		AC_SUBST(CWARNFLAGS)
20660568f49bSmrg	]
20670568f49bSmrg)
20680568f49bSmrg]) # XORG_CWARNFLAGS
20690568f49bSmrg
20700568f49bSmrg# XORG_STRICT_OPTION
20710568f49bSmrg# -----------------------
20720568f49bSmrg# Minimum version: 1.3.0
20739e7bcd65Smrg#
20740568f49bSmrg# Add configure option to enable strict compilation flags, such as treating
20750568f49bSmrg# warnings as fatal errors.
20760568f49bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20770568f49bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20780568f49bSmrg#
20790568f49bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20800568f49bSmrg# when strict compilation is unconditionally desired.
20810568f49bSmrgAC_DEFUN([XORG_STRICT_OPTION], [
20820568f49bSmrgAC_REQUIRE([XORG_CWARNFLAGS])
20830568f49bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20849e7bcd65Smrg
20850568f49bSmrgAC_ARG_ENABLE(strict-compilation,
20860568f49bSmrg			  AS_HELP_STRING([--enable-strict-compilation],
20870568f49bSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20880568f49bSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20890568f49bSmrg
20900568f49bSmrgAC_LANG_CASE(
20910568f49bSmrg        [C], [
20920568f49bSmrg                define([PREFIX], [C])
20930568f49bSmrg        ],
20940568f49bSmrg        [C++], [
20950568f49bSmrg                define([PREFIX], [CXX])
20960568f49bSmrg        ]
20970568f49bSmrg)
20980568f49bSmrg
20990568f49bSmrg[STRICT_]PREFIX[FLAGS]=""
21000568f49bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21010568f49bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21020568f49bSmrg
21030568f49bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21040568f49bSmrg# activate it with -Werror, so we add it here explicitly.
21050568f49bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21060568f49bSmrg
21070568f49bSmrgif test "x$STRICT_COMPILE" = "xyes"; then
21080568f49bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21090568f49bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21109e7bcd65Smrgfi
21110568f49bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21120568f49bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21130568f49bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21140568f49bSmrg]) # XORG_STRICT_OPTION
21159e7bcd65Smrg
21160568f49bSmrg# XORG_DEFAULT_OPTIONS
21170568f49bSmrg# --------------------
21180568f49bSmrg# Minimum version: 1.3.0
21199e7bcd65Smrg#
21200568f49bSmrg# Defines default options for X.Org modules.
21219e7bcd65Smrg#
21220568f49bSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21230568f49bSmrgAC_REQUIRE([AC_PROG_INSTALL])
21240568f49bSmrgXORG_COMPILER_FLAGS
21250568f49bSmrgXORG_CWARNFLAGS
21260568f49bSmrgXORG_STRICT_OPTION
21270568f49bSmrgXORG_RELEASE_VERSION
21280568f49bSmrgXORG_CHANGELOG
21290568f49bSmrgXORG_INSTALL
21300568f49bSmrgXORG_MANPAGE_SECTIONS
21310568f49bSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21320568f49bSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21330568f49bSmrg]) # XORG_DEFAULT_OPTIONS
21340568f49bSmrg
21350568f49bSmrg# XORG_INSTALL()
21360568f49bSmrg# ----------------
21370568f49bSmrg# Minimum version: 1.4.0
21389e7bcd65Smrg#
21390568f49bSmrg# Defines the variable INSTALL_CMD as the command to copy
21400568f49bSmrg# INSTALL from $prefix/share/util-macros.
21419e7bcd65Smrg#
21420568f49bSmrgAC_DEFUN([XORG_INSTALL], [
21430568f49bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21440568f49bSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21450568f49bSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21460568f49bSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21470568f49bSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
21480568f49bSmrgtouch \$(top_srcdir)/INSTALL; \
21490568f49bSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
21500568f49bSmrgAC_SUBST([INSTALL_CMD])
21510568f49bSmrg]) # XORG_INSTALL
21520568f49bSmrgdnl Copyright 2005 Red Hat, Inc
21530568f49bSmrgdnl
21540568f49bSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21550568f49bSmrgdnl documentation for any purpose is hereby granted without fee, provided that
21560568f49bSmrgdnl the above copyright notice appear in all copies and that both that
21570568f49bSmrgdnl copyright notice and this permission notice appear in supporting
21580568f49bSmrgdnl documentation.
21590568f49bSmrgdnl
21600568f49bSmrgdnl The above copyright notice and this permission notice shall be included
21610568f49bSmrgdnl in all copies or substantial portions of the Software.
21620568f49bSmrgdnl
21630568f49bSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21640568f49bSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21650568f49bSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21660568f49bSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21670568f49bSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21680568f49bSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21690568f49bSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
21700568f49bSmrgdnl
21710568f49bSmrgdnl Except as contained in this notice, the name of the copyright holders shall
21720568f49bSmrgdnl not be used in advertising or otherwise to promote the sale, use or
21730568f49bSmrgdnl other dealings in this Software without prior written authorization
21740568f49bSmrgdnl from the copyright holders.
21750568f49bSmrgdnl
2176339a7c43Smrg
21770568f49bSmrg# XORG_RELEASE_VERSION
21780568f49bSmrg# --------------------
21790568f49bSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2180339a7c43Smrg
21810568f49bSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21820568f49bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21830568f49bSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21840568f49bSmrg		[Major version of this package])
21850568f49bSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21860568f49bSmrg	if test "x$PVM" = "x"; then
21870568f49bSmrg		PVM="0"
21880568f49bSmrg	fi
21890568f49bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21900568f49bSmrg		[$PVM],
21910568f49bSmrg		[Minor version of this package])
21920568f49bSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21930568f49bSmrg	if test "x$PVP" = "x"; then
21940568f49bSmrg		PVP="0"
21950568f49bSmrg	fi
21960568f49bSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21970568f49bSmrg		[$PVP],
21980568f49bSmrg		[Patch version of this package])
21990568f49bSmrg])
22009e7bcd65Smrg
22010568f49bSmrg# XORG_CHANGELOG()
22029e7bcd65Smrg# ----------------
22030568f49bSmrg# Minimum version: 1.2.0
22049e7bcd65Smrg#
22050568f49bSmrg# Defines the variable CHANGELOG_CMD as the command to generate
22060568f49bSmrg# ChangeLog from git.
22079e7bcd65Smrg#
22089e7bcd65Smrg#
22090568f49bSmrgAC_DEFUN([XORG_CHANGELOG], [
22100568f49bSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22110568f49bSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22120568f49bSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22130568f49bSmrgtouch \$(top_srcdir)/ChangeLog; \
22140568f49bSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22150568f49bSmrgAC_SUBST([CHANGELOG_CMD])
22160568f49bSmrg]) # XORG_CHANGELOG
22170568f49bSmrg
22180568f49bSmrg# Copyright (C) 2002-2018 Free Software Foundation, Inc.
22199e7bcd65Smrg#
22200568f49bSmrg# This file is free software; the Free Software Foundation
22210568f49bSmrg# gives unlimited permission to copy and/or distribute it,
22220568f49bSmrg# with or without modifications, as long as this notice is preserved.
22239e7bcd65Smrg
22240568f49bSmrg# AM_AUTOMAKE_VERSION(VERSION)
22250568f49bSmrg# ----------------------------
22260568f49bSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22270568f49bSmrg# generated from the m4 files accompanying Automake X.Y.
22280568f49bSmrg# (This private macro should not be called outside this file.)
22290568f49bSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22300568f49bSmrg[am__api_version='1.16'
22310568f49bSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22320568f49bSmrgdnl require some minimum version.  Point them to the right macro.
22330568f49bSmrgm4_if([$1], [1.16.1], [],
22340568f49bSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22350568f49bSmrg])
22369e7bcd65Smrg
22370568f49bSmrg# _AM_AUTOCONF_VERSION(VERSION)
22380568f49bSmrg# -----------------------------
22390568f49bSmrg# aclocal traces this macro to find the Autoconf version.
22400568f49bSmrg# This is a private macro too.  Using m4_define simplifies
22410568f49bSmrg# the logic in aclocal, which can simply ignore this definition.
22420568f49bSmrgm4_define([_AM_AUTOCONF_VERSION], [])
22439e7bcd65Smrg
22440568f49bSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22450568f49bSmrg# -------------------------------
22460568f49bSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22470568f49bSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22480568f49bSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22490568f49bSmrg[AM_AUTOMAKE_VERSION([1.16.1])dnl
22500568f49bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
22510568f49bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22520568f49bSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
22539e7bcd65Smrg
22540568f49bSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22559e7bcd65Smrg
22560568f49bSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
22579e7bcd65Smrg#
22580568f49bSmrg# This file is free software; the Free Software Foundation
22590568f49bSmrg# gives unlimited permission to copy and/or distribute it,
22600568f49bSmrg# with or without modifications, as long as this notice is preserved.
22619e7bcd65Smrg
22620568f49bSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22630568f49bSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22640568f49bSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
22650568f49bSmrg#
22660568f49bSmrg# Of course, Automake must honor this variable whenever it calls a
22670568f49bSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22680568f49bSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22690568f49bSmrg# depending on how configure is run.  This is pretty annoying, since
22700568f49bSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22710568f49bSmrg# source directory, any form will work fine, but in subdirectories a
22720568f49bSmrg# relative path needs to be adjusted first.
2273339a7c43Smrg#
22740568f49bSmrg# $ac_aux_dir/missing
22750568f49bSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22760568f49bSmrg# $top_srcdir/$ac_aux_dir/missing
22770568f49bSmrg#    fails if $ac_aux_dir is absolute,
22780568f49bSmrg#    fails when called from a subdirectory in a VPATH build with
22790568f49bSmrg#          a relative $ac_aux_dir
2280339a7c43Smrg#
22810568f49bSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22820568f49bSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
22830568f49bSmrg# harmless because $srcdir is '.', but things will broke when you
22840568f49bSmrg# start a VPATH build or use an absolute $srcdir.
2285339a7c43Smrg#
22860568f49bSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22870568f49bSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22880568f49bSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22890568f49bSmrg# and then we would define $MISSING as
22900568f49bSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22910568f49bSmrg# This will work as long as MISSING is not called from configure, because
22920568f49bSmrg# unfortunately $(top_srcdir) has no meaning in configure.
22930568f49bSmrg# However there are other variables, like CC, which are often used in
22940568f49bSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
22950568f49bSmrg#
22960568f49bSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
22970568f49bSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
22980568f49bSmrg# configured tree to be moved without reconfiguration.
2299339a7c43Smrg
23000568f49bSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23010568f49bSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23020568f49bSmrg# Expand $ac_aux_dir to an absolute path.
23030568f49bSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
23040568f49bSmrg])
2305339a7c43Smrg
23060568f49bSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
23070568f49bSmrg
23080568f49bSmrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
23099e7bcd65Smrg#
23100568f49bSmrg# This file is free software; the Free Software Foundation
23110568f49bSmrg# gives unlimited permission to copy and/or distribute it,
23120568f49bSmrg# with or without modifications, as long as this notice is preserved.
23130568f49bSmrg
23140568f49bSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23150568f49bSmrg# -------------------------------------
23160568f49bSmrg# Define a conditional.
23170568f49bSmrgAC_DEFUN([AM_CONDITIONAL],
23180568f49bSmrg[AC_PREREQ([2.52])dnl
23190568f49bSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23200568f49bSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23210568f49bSmrgAC_SUBST([$1_TRUE])dnl
23220568f49bSmrgAC_SUBST([$1_FALSE])dnl
23230568f49bSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23240568f49bSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23250568f49bSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23260568f49bSmrgif $2; then
23270568f49bSmrg  $1_TRUE=
23280568f49bSmrg  $1_FALSE='#'
23290568f49bSmrgelse
23300568f49bSmrg  $1_TRUE='#'
23310568f49bSmrg  $1_FALSE=
23320568f49bSmrgfi
23330568f49bSmrgAC_CONFIG_COMMANDS_PRE(
23340568f49bSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23350568f49bSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23360568f49bSmrgUsually this means the macro was only invoked conditionally.]])
23370568f49bSmrgfi])])
23380568f49bSmrg
23390568f49bSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
23409e7bcd65Smrg#
23410568f49bSmrg# This file is free software; the Free Software Foundation
23420568f49bSmrg# gives unlimited permission to copy and/or distribute it,
23430568f49bSmrg# with or without modifications, as long as this notice is preserved.
23440568f49bSmrg
23450568f49bSmrg
23460568f49bSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23470568f49bSmrg# written in clear, in which case automake, when reading aclocal.m4,
23480568f49bSmrg# will think it sees a *use*, and therefore will trigger all it's
23490568f49bSmrg# C support machinery.  Also note that it means that autoscan, seeing
23500568f49bSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23510568f49bSmrg
23520568f49bSmrg
23530568f49bSmrg# _AM_DEPENDENCIES(NAME)
23540568f49bSmrg# ----------------------
23550568f49bSmrg# See how the compiler implements dependency checking.
23560568f49bSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23570568f49bSmrg# We try a few techniques and use that to set a single cache variable.
23589e7bcd65Smrg#
23590568f49bSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23600568f49bSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23610568f49bSmrg# dependency, and given that the user is not expected to run this macro,
23620568f49bSmrg# just rely on AC_PROG_CC.
23630568f49bSmrgAC_DEFUN([_AM_DEPENDENCIES],
23640568f49bSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23650568f49bSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23660568f49bSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23670568f49bSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2368444c061aSmrg
23690568f49bSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23700568f49bSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23710568f49bSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23720568f49bSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23730568f49bSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23740568f49bSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23750568f49bSmrg                    [depcc="$$1"   am_compiler_list=])
23760568f49bSmrg
23770568f49bSmrgAC_CACHE_CHECK([dependency style of $depcc],
23780568f49bSmrg               [am_cv_$1_dependencies_compiler_type],
23790568f49bSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23800568f49bSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
23810568f49bSmrg  # making bogus files that we don't know about and never remove.  For
23820568f49bSmrg  # instance it was reported that on HP-UX the gcc test will end up
23830568f49bSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23840568f49bSmrg  # in D".
23850568f49bSmrg  rm -rf conftest.dir
23860568f49bSmrg  mkdir conftest.dir
23870568f49bSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23880568f49bSmrg  # using a relative directory.
23890568f49bSmrg  cp "$am_depcomp" conftest.dir
23900568f49bSmrg  cd conftest.dir
23910568f49bSmrg  # We will build objects and dependencies in a subdirectory because
23920568f49bSmrg  # it helps to detect inapplicable dependency modes.  For instance
23930568f49bSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23940568f49bSmrg  # side effect of compilation, but ICC will put the dependencies in
23950568f49bSmrg  # the current directory while Tru64 will put them in the object
23960568f49bSmrg  # directory.
23970568f49bSmrg  mkdir sub
23980568f49bSmrg
23990568f49bSmrg  am_cv_$1_dependencies_compiler_type=none
24000568f49bSmrg  if test "$am_compiler_list" = ""; then
24010568f49bSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24020568f49bSmrg  fi
24030568f49bSmrg  am__universal=false
24040568f49bSmrg  m4_case([$1], [CC],
24050568f49bSmrg    [case " $depcc " in #(
24060568f49bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24070568f49bSmrg     esac],
24080568f49bSmrg    [CXX],
24090568f49bSmrg    [case " $depcc " in #(
24100568f49bSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24110568f49bSmrg     esac])
24120568f49bSmrg
24130568f49bSmrg  for depmode in $am_compiler_list; do
24140568f49bSmrg    # Setup a source with many dependencies, because some compilers
24150568f49bSmrg    # like to wrap large dependency lists on column 80 (with \), and
24160568f49bSmrg    # we should not choose a depcomp mode which is confused by this.
24170568f49bSmrg    #
24180568f49bSmrg    # We need to recreate these files for each test, as the compiler may
24190568f49bSmrg    # overwrite some of them when testing with obscure command lines.
24200568f49bSmrg    # This happens at least with the AIX C compiler.
24210568f49bSmrg    : > sub/conftest.c
24220568f49bSmrg    for i in 1 2 3 4 5 6; do
24230568f49bSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24240568f49bSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24250568f49bSmrg      # Solaris 10 /bin/sh.
24260568f49bSmrg      echo '/* dummy */' > sub/conftst$i.h
24270568f49bSmrg    done
24280568f49bSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24290568f49bSmrg
24300568f49bSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24310568f49bSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24320568f49bSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24330568f49bSmrg    # versions had trouble with output in subdirs.
24340568f49bSmrg    am__obj=sub/conftest.${OBJEXT-o}
24350568f49bSmrg    am__minus_obj="-o $am__obj"
24360568f49bSmrg    case $depmode in
24370568f49bSmrg    gcc)
24380568f49bSmrg      # This depmode causes a compiler race in universal mode.
24390568f49bSmrg      test "$am__universal" = false || continue
24400568f49bSmrg      ;;
24410568f49bSmrg    nosideeffect)
24420568f49bSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24430568f49bSmrg      # only be used when explicitly requested.
24440568f49bSmrg      if test "x$enable_dependency_tracking" = xyes; then
24450568f49bSmrg	continue
24460568f49bSmrg      else
24470568f49bSmrg	break
24480568f49bSmrg      fi
24490568f49bSmrg      ;;
24500568f49bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24510568f49bSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
24520568f49bSmrg      # not run yet.  These depmodes are late enough in the game, and
24530568f49bSmrg      # so weak that their functioning should not be impacted.
24540568f49bSmrg      am__obj=conftest.${OBJEXT-o}
24550568f49bSmrg      am__minus_obj=
24560568f49bSmrg      ;;
24570568f49bSmrg    none) break ;;
24580568f49bSmrg    esac
24590568f49bSmrg    if depmode=$depmode \
24600568f49bSmrg       source=sub/conftest.c object=$am__obj \
24610568f49bSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24620568f49bSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24630568f49bSmrg         >/dev/null 2>conftest.err &&
24640568f49bSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24650568f49bSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24660568f49bSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24670568f49bSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24680568f49bSmrg      # icc doesn't choke on unknown options, it will just issue warnings
24690568f49bSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
24700568f49bSmrg      # that says an option was ignored or not supported.
24710568f49bSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24720568f49bSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24730568f49bSmrg      # The diagnosis changed in icc 8.0:
24740568f49bSmrg      #   icc: Command line remark: option '-MP' not supported
24750568f49bSmrg      if (grep 'ignoring option' conftest.err ||
24760568f49bSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24770568f49bSmrg        am_cv_$1_dependencies_compiler_type=$depmode
24780568f49bSmrg        break
24790568f49bSmrg      fi
24800568f49bSmrg    fi
24810568f49bSmrg  done
24820568f49bSmrg
24830568f49bSmrg  cd ..
24840568f49bSmrg  rm -rf conftest.dir
24859e7bcd65Smrgelse
24860568f49bSmrg  am_cv_$1_dependencies_compiler_type=none
24879e7bcd65Smrgfi
24880568f49bSmrg])
24890568f49bSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24900568f49bSmrgAM_CONDITIONAL([am__fastdep$1], [
24910568f49bSmrg  test "x$enable_dependency_tracking" != xno \
24920568f49bSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24930568f49bSmrg])
2494444c061aSmrg
24951477040fSmrg
24960568f49bSmrg# AM_SET_DEPDIR
24970568f49bSmrg# -------------
24980568f49bSmrg# Choose a directory name for dependency files.
24990568f49bSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25000568f49bSmrgAC_DEFUN([AM_SET_DEPDIR],
25010568f49bSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25020568f49bSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25030568f49bSmrg])
2504444c061aSmrg
2505444c061aSmrg
25060568f49bSmrg# AM_DEP_TRACK
25070568f49bSmrg# ------------
25080568f49bSmrgAC_DEFUN([AM_DEP_TRACK],
25090568f49bSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25100568f49bSmrgAS_HELP_STRING(
25110568f49bSmrg  [--enable-dependency-tracking],
25120568f49bSmrg  [do not reject slow dependency extractors])
25130568f49bSmrgAS_HELP_STRING(
25140568f49bSmrg  [--disable-dependency-tracking],
25150568f49bSmrg  [speeds up one-time build])])
25160568f49bSmrgif test "x$enable_dependency_tracking" != xno; then
25170568f49bSmrg  am_depcomp="$ac_aux_dir/depcomp"
25180568f49bSmrg  AMDEPBACKSLASH='\'
25190568f49bSmrg  am__nodep='_no'
25200568f49bSmrgfi
25210568f49bSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25220568f49bSmrgAC_SUBST([AMDEPBACKSLASH])dnl
25230568f49bSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25240568f49bSmrgAC_SUBST([am__nodep])dnl
25250568f49bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25260568f49bSmrg])
25279e7bcd65Smrg
25280568f49bSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25299e7bcd65Smrg
25300568f49bSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
25319e7bcd65Smrg#
25320568f49bSmrg# This file is free software; the Free Software Foundation
25330568f49bSmrg# gives unlimited permission to copy and/or distribute it,
25340568f49bSmrg# with or without modifications, as long as this notice is preserved.
25350568f49bSmrg
25360568f49bSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25370568f49bSmrg# ------------------------------
25380568f49bSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25390568f49bSmrg[{
25400568f49bSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
25410568f49bSmrg  # are listed without --file.  Let's play safe and only enable the eval
25420568f49bSmrg  # if we detect the quoting.
25430568f49bSmrg  # TODO: see whether this extra hack can be removed once we start
25440568f49bSmrg  # requiring Autoconf 2.70 or later.
25450568f49bSmrg  AS_CASE([$CONFIG_FILES],
25460568f49bSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
25470568f49bSmrg          [*], [set x $CONFIG_FILES])
25480568f49bSmrg  shift
25490568f49bSmrg  # Used to flag and report bootstrapping failures.
25500568f49bSmrg  am_rc=0
25510568f49bSmrg  for am_mf
25520568f49bSmrg  do
25530568f49bSmrg    # Strip MF so we end up with the name of the file.
25540568f49bSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
25550568f49bSmrg    # Check whether this is an Automake generated Makefile which includes
25560568f49bSmrg    # dependency-tracking related rules and includes.
25570568f49bSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
25580568f49bSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
25590568f49bSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
25600568f49bSmrg      || continue
25610568f49bSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
25620568f49bSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
25630568f49bSmrg    AM_RUN_LOG([cd "$am_dirpart" \
25640568f49bSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
25650568f49bSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
25660568f49bSmrg  done
25670568f49bSmrg  if test $am_rc -ne 0; then
25680568f49bSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
25690568f49bSmrg    for automatic dependency tracking.  Try re-running configure with the
25700568f49bSmrg    '--disable-dependency-tracking' option to at least be able to build
25710568f49bSmrg    the package (albeit without support for automatic dependency tracking).])
25720568f49bSmrg  fi
25730568f49bSmrg  AS_UNSET([am_dirpart])
25740568f49bSmrg  AS_UNSET([am_filepart])
25750568f49bSmrg  AS_UNSET([am_mf])
25760568f49bSmrg  AS_UNSET([am_rc])
25770568f49bSmrg  rm -f conftest-deps.mk
25780568f49bSmrg}
25790568f49bSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25800568f49bSmrg
25810568f49bSmrg
25820568f49bSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25830568f49bSmrg# -----------------------------
25840568f49bSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
25859e7bcd65Smrg#
25860568f49bSmrg# This code is only required when automatic dependency tracking is enabled.
25870568f49bSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
25880568f49bSmrg# order to bootstrap the dependency handling code.
25890568f49bSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25900568f49bSmrg[AC_CONFIG_COMMANDS([depfiles],
25910568f49bSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25920568f49bSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
25930568f49bSmrg
25940568f49bSmrg# Do all the work for Automake.                             -*- Autoconf -*-
25950568f49bSmrg
25960568f49bSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
25979e7bcd65Smrg#
25980568f49bSmrg# This file is free software; the Free Software Foundation
25990568f49bSmrg# gives unlimited permission to copy and/or distribute it,
26000568f49bSmrg# with or without modifications, as long as this notice is preserved.
26019e7bcd65Smrg
26020568f49bSmrg# This macro actually does too much.  Some checks are only needed if
26030568f49bSmrg# your package does certain things.  But this isn't really a big deal.
2604444c061aSmrg
26050568f49bSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26060568f49bSmrgm4_define([AC_PROG_CC],
26070568f49bSmrgm4_defn([AC_PROG_CC])
26080568f49bSmrg[_AM_PROG_CC_C_O
26090568f49bSmrg])
26102ae83157Smrg
26110568f49bSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26120568f49bSmrg# AM_INIT_AUTOMAKE([OPTIONS])
26130568f49bSmrg# -----------------------------------------------
26140568f49bSmrg# The call with PACKAGE and VERSION arguments is the old style
26150568f49bSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26160568f49bSmrg# and VERSION should now be passed to AC_INIT and removed from
26170568f49bSmrg# the call to AM_INIT_AUTOMAKE.
26180568f49bSmrg# We support both call styles for the transition.  After
26190568f49bSmrg# the next Automake release, Autoconf can make the AC_INIT
26200568f49bSmrg# arguments mandatory, and then we can depend on a new Autoconf
26210568f49bSmrg# release and drop the old call support.
26220568f49bSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26230568f49bSmrg[AC_PREREQ([2.65])dnl
26240568f49bSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26250568f49bSmrgdnl the ones we care about.
26260568f49bSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26270568f49bSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26280568f49bSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26290568f49bSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26300568f49bSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26310568f49bSmrg  # is not polluted with repeated "-I."
26320568f49bSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26330568f49bSmrg  # test to see if srcdir already configured
26340568f49bSmrg  if test -f $srcdir/config.status; then
26350568f49bSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
26369e7bcd65Smrg  fi
26379e7bcd65Smrgfi
26382ae83157Smrg
26390568f49bSmrg# test whether we have cygpath
26400568f49bSmrgif test -z "$CYGPATH_W"; then
26410568f49bSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26420568f49bSmrg    CYGPATH_W='cygpath -w'
26430568f49bSmrg  else
26440568f49bSmrg    CYGPATH_W=echo
26459e7bcd65Smrg  fi
26469e7bcd65Smrgfi
26470568f49bSmrgAC_SUBST([CYGPATH_W])
26482ae83157Smrg
26490568f49bSmrg# Define the identity of the package.
26500568f49bSmrgdnl Distinguish between old-style and new-style calls.
26510568f49bSmrgm4_ifval([$2],
26520568f49bSmrg[AC_DIAGNOSE([obsolete],
26530568f49bSmrg             [$0: two- and three-arguments forms are deprecated.])
26540568f49bSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26550568f49bSmrg AC_SUBST([PACKAGE], [$1])dnl
26560568f49bSmrg AC_SUBST([VERSION], [$2])],
26570568f49bSmrg[_AM_SET_OPTIONS([$1])dnl
26580568f49bSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26590568f49bSmrgm4_if(
26600568f49bSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26610568f49bSmrg  [ok:ok],,
26620568f49bSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26630568f49bSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26640568f49bSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2665444c061aSmrg
26660568f49bSmrg_AM_IF_OPTION([no-define],,
26670568f49bSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26680568f49bSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2669444c061aSmrg
26700568f49bSmrg# Some tools Automake needs.
26710568f49bSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26720568f49bSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26730568f49bSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26740568f49bSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26750568f49bSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26760568f49bSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26770568f49bSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26780568f49bSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26790568f49bSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26800568f49bSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26810568f49bSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
26820568f49bSmrg# dies out for good.  For more background, see:
26830568f49bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26840568f49bSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26850568f49bSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26860568f49bSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
26870568f49bSmrg# system "awk" is bad on some platforms.
26880568f49bSmrgAC_REQUIRE([AC_PROG_AWK])dnl
26890568f49bSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26900568f49bSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26910568f49bSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26920568f49bSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26930568f49bSmrg			     [_AM_PROG_TAR([v7])])])
26940568f49bSmrg_AM_IF_OPTION([no-dependencies],,
26950568f49bSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26960568f49bSmrg		  [_AM_DEPENDENCIES([CC])],
26970568f49bSmrg		  [m4_define([AC_PROG_CC],
26980568f49bSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
26990568f49bSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27000568f49bSmrg		  [_AM_DEPENDENCIES([CXX])],
27010568f49bSmrg		  [m4_define([AC_PROG_CXX],
27020568f49bSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27030568f49bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27040568f49bSmrg		  [_AM_DEPENDENCIES([OBJC])],
27050568f49bSmrg		  [m4_define([AC_PROG_OBJC],
27060568f49bSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27070568f49bSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27080568f49bSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
27090568f49bSmrg		  [m4_define([AC_PROG_OBJCXX],
27100568f49bSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27110568f49bSmrg])
27120568f49bSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27130568f49bSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
27140568f49bSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27150568f49bSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27160568f49bSmrgAC_CONFIG_COMMANDS_PRE(dnl
27170568f49bSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27180568f49bSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27190568f49bSmrg
27200568f49bSmrg# POSIX will say in a future version that running "rm -f" with no argument
27210568f49bSmrg# is OK; and we want to be able to make that assumption in our Makefile
27220568f49bSmrg# recipes.  So use an aggressive probe to check that the usage we want is
27230568f49bSmrg# actually supported "in the wild" to an acceptable degree.
27240568f49bSmrg# See automake bug#10828.
27250568f49bSmrg# To make any issue more visible, cause the running configure to be aborted
27260568f49bSmrg# by default if the 'rm' program in use doesn't match our expectations; the
27270568f49bSmrg# user can still override this though.
27280568f49bSmrgif rm -f && rm -fr && rm -rf; then : OK; else
27290568f49bSmrg  cat >&2 <<'END'
27300568f49bSmrgOops!
2731444c061aSmrg
27320568f49bSmrgYour 'rm' program seems unable to run without file operands specified
27330568f49bSmrgon the command line, even when the '-f' option is present.  This is contrary
27340568f49bSmrgto the behaviour of most rm programs out there, and not conforming with
27350568f49bSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2736444c061aSmrg
27370568f49bSmrgPlease tell bug-automake@gnu.org about your system, including the value
27380568f49bSmrgof your $PATH and any error possibly output before this message.  This
27390568f49bSmrgcan help us improve future automake versions.
2740444c061aSmrg
27410568f49bSmrgEND
27420568f49bSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27430568f49bSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27440568f49bSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27450568f49bSmrg    echo >&2
27460568f49bSmrg  else
27470568f49bSmrg    cat >&2 <<'END'
27480568f49bSmrgAborting the configuration process, to ensure you take notice of the issue.
2749444c061aSmrg
27500568f49bSmrgYou can download and install GNU coreutils to get an 'rm' implementation
27510568f49bSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
27520568f49bSmrg
27530568f49bSmrgIf you want to complete the configuration process using your problematic
27540568f49bSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27550568f49bSmrgto "yes", and re-run configure.
27560568f49bSmrg
27570568f49bSmrgEND
27580568f49bSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27590568f49bSmrg  fi
27609e7bcd65Smrgfi
27610568f49bSmrgdnl The trailing newline in this macro's definition is deliberate, for
27620568f49bSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27630568f49bSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27640568f49bSmrg])
2765444c061aSmrg
27660568f49bSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27670568f49bSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27680568f49bSmrgdnl mangled by Autoconf and run in a shell conditional statement.
27690568f49bSmrgm4_define([_AC_COMPILER_EXEEXT],
27700568f49bSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27712ae83157Smrg
27720568f49bSmrg# When config.status generates a header, we must update the stamp-h file.
27730568f49bSmrg# This file resides in the same directory as the config header
27740568f49bSmrg# that is generated.  The stamp files are numbered to have different names.
27750568f49bSmrg
27760568f49bSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27770568f49bSmrg# loop where config.status creates the headers, so we can generate
27780568f49bSmrg# our stamp files there.
27790568f49bSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27800568f49bSmrg[# Compute $1's index in $config_headers.
27810568f49bSmrg_am_arg=$1
27820568f49bSmrg_am_stamp_count=1
27830568f49bSmrgfor _am_header in $config_headers :; do
27840568f49bSmrg  case $_am_header in
27850568f49bSmrg    $_am_arg | $_am_arg:* )
27860568f49bSmrg      break ;;
27870568f49bSmrg    * )
27880568f49bSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27890568f49bSmrg  esac
27900568f49bSmrgdone
27910568f49bSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
27920568f49bSmrg
27930568f49bSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
2794bdf0f55dSmrg#
27950568f49bSmrg# This file is free software; the Free Software Foundation
27960568f49bSmrg# gives unlimited permission to copy and/or distribute it,
27970568f49bSmrg# with or without modifications, as long as this notice is preserved.
27982ae83157Smrg
27990568f49bSmrg# AM_PROG_INSTALL_SH
28000568f49bSmrg# ------------------
28010568f49bSmrg# Define $install_sh.
28020568f49bSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28030568f49bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28040568f49bSmrgif test x"${install_sh+set}" != xset; then
28050568f49bSmrg  case $am_aux_dir in
28060568f49bSmrg  *\ * | *\	*)
28070568f49bSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28080568f49bSmrg  *)
28090568f49bSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28100568f49bSmrg  esac
28119e7bcd65Smrgfi
28120568f49bSmrgAC_SUBST([install_sh])])
2813444c061aSmrg
28140568f49bSmrg# Copyright (C) 2003-2018 Free Software Foundation, Inc.
28150568f49bSmrg#
28160568f49bSmrg# This file is free software; the Free Software Foundation
28170568f49bSmrg# gives unlimited permission to copy and/or distribute it,
28180568f49bSmrg# with or without modifications, as long as this notice is preserved.
28190568f49bSmrg
28200568f49bSmrg# Check whether the underlying file-system supports filenames
28210568f49bSmrg# with a leading dot.  For instance MS-DOS doesn't.
28220568f49bSmrgAC_DEFUN([AM_SET_LEADING_DOT],
28230568f49bSmrg[rm -rf .tst 2>/dev/null
28240568f49bSmrgmkdir .tst 2>/dev/null
28250568f49bSmrgif test -d .tst; then
28260568f49bSmrg  am__leading_dot=.
28279e7bcd65Smrgelse
28280568f49bSmrg  am__leading_dot=_
2829bdf0f55dSmrgfi
28300568f49bSmrgrmdir .tst 2>/dev/null
28310568f49bSmrgAC_SUBST([am__leading_dot])])
28322ae83157Smrg
28330568f49bSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2834444c061aSmrg
28350568f49bSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
28369e7bcd65Smrg#
28370568f49bSmrg# This file is free software; the Free Software Foundation
28380568f49bSmrg# gives unlimited permission to copy and/or distribute it,
28390568f49bSmrg# with or without modifications, as long as this notice is preserved.
2840249c3046Smrg
28410568f49bSmrg# AM_MAKE_INCLUDE()
28420568f49bSmrg# -----------------
28430568f49bSmrg# Check whether make has an 'include' directive that can support all
28440568f49bSmrg# the idioms we need for our automatic dependency tracking code.
28450568f49bSmrgAC_DEFUN([AM_MAKE_INCLUDE],
28460568f49bSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
28470568f49bSmrgcat > confinc.mk << 'END'
28480568f49bSmrgam__doit:
28490568f49bSmrg	@echo this is the am__doit target >confinc.out
28500568f49bSmrg.PHONY: am__doit
28510568f49bSmrgEND
28520568f49bSmrgam__include="#"
28530568f49bSmrgam__quote=
28540568f49bSmrg# BSD make does it like this.
28550568f49bSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
28560568f49bSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
28570568f49bSmrgecho 'include confinc.mk # ignored' > confmf.GNU
28580568f49bSmrg_am_result=no
28590568f49bSmrgfor s in GNU BSD; do
28600568f49bSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
28610568f49bSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
28620568f49bSmrg      ['0:this is the am__doit target'],
28630568f49bSmrg      [AS_CASE([$s],
28640568f49bSmrg          [BSD], [am__include='.include' am__quote='"'],
28650568f49bSmrg          [am__include='include' am__quote=''])])
28660568f49bSmrg  if test "$am__include" != "#"; then
28670568f49bSmrg    _am_result="yes ($s style)"
28680568f49bSmrg    break
28690568f49bSmrg  fi
28700568f49bSmrgdone
28710568f49bSmrgrm -f confinc.* confmf.*
28720568f49bSmrgAC_MSG_RESULT([${_am_result}])
28730568f49bSmrgAC_SUBST([am__include])])
28740568f49bSmrgAC_SUBST([am__quote])])
2875249c3046Smrg
28760568f49bSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2877444c061aSmrg
28780568f49bSmrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
28790568f49bSmrg#
28800568f49bSmrg# This file is free software; the Free Software Foundation
28810568f49bSmrg# gives unlimited permission to copy and/or distribute it,
28820568f49bSmrg# with or without modifications, as long as this notice is preserved.
28830568f49bSmrg
28840568f49bSmrg# AM_MISSING_PROG(NAME, PROGRAM)
28850568f49bSmrg# ------------------------------
28860568f49bSmrgAC_DEFUN([AM_MISSING_PROG],
28870568f49bSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28880568f49bSmrg$1=${$1-"${am_missing_run}$2"}
28890568f49bSmrgAC_SUBST($1)])
28900568f49bSmrg
28910568f49bSmrg# AM_MISSING_HAS_RUN
28920568f49bSmrg# ------------------
28930568f49bSmrg# Define MISSING if not defined so far and test if it is modern enough.
28940568f49bSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
28950568f49bSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
28960568f49bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28970568f49bSmrgAC_REQUIRE_AUX_FILE([missing])dnl
28980568f49bSmrgif test x"${MISSING+set}" != xset; then
28990568f49bSmrg  case $am_aux_dir in
29000568f49bSmrg  *\ * | *\	*)
29010568f49bSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29020568f49bSmrg  *)
29030568f49bSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29040568f49bSmrg  esac
2905bdf0f55dSmrgfi
29060568f49bSmrg# Use eval to expand $SHELL
29070568f49bSmrgif eval "$MISSING --is-lightweight"; then
29080568f49bSmrg  am_missing_run="$MISSING "
29090568f49bSmrgelse
29100568f49bSmrg  am_missing_run=
29110568f49bSmrg  AC_MSG_WARN(['missing' script is too old or missing])
29129e7bcd65Smrgfi
29130568f49bSmrg])
2914249c3046Smrg
29150568f49bSmrg# Helper functions for option handling.                     -*- Autoconf -*-
29162ae83157Smrg
29170568f49bSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
29189e7bcd65Smrg#
29190568f49bSmrg# This file is free software; the Free Software Foundation
29200568f49bSmrg# gives unlimited permission to copy and/or distribute it,
29210568f49bSmrg# with or without modifications, as long as this notice is preserved.
2922249c3046Smrg
29230568f49bSmrg# _AM_MANGLE_OPTION(NAME)
29240568f49bSmrg# -----------------------
29250568f49bSmrgAC_DEFUN([_AM_MANGLE_OPTION],
29260568f49bSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
29272265a131Smrg
29280568f49bSmrg# _AM_SET_OPTION(NAME)
29290568f49bSmrg# --------------------
29300568f49bSmrg# Set option NAME.  Presently that only means defining a flag for this option.
29310568f49bSmrgAC_DEFUN([_AM_SET_OPTION],
29320568f49bSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2933444c061aSmrg
29340568f49bSmrg# _AM_SET_OPTIONS(OPTIONS)
29350568f49bSmrg# ------------------------
29360568f49bSmrg# OPTIONS is a space-separated list of Automake options.
29370568f49bSmrgAC_DEFUN([_AM_SET_OPTIONS],
29380568f49bSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2939444c061aSmrg
29400568f49bSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29410568f49bSmrg# -------------------------------------------
29420568f49bSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29430568f49bSmrgAC_DEFUN([_AM_IF_OPTION],
29440568f49bSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
29452265a131Smrg
29460568f49bSmrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
29479e7bcd65Smrg#
29480568f49bSmrg# This file is free software; the Free Software Foundation
29490568f49bSmrg# gives unlimited permission to copy and/or distribute it,
29500568f49bSmrg# with or without modifications, as long as this notice is preserved.
2951249c3046Smrg
29520568f49bSmrg# _AM_PROG_CC_C_O
2953bdf0f55dSmrg# ---------------
29540568f49bSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29550568f49bSmrg# to automatically call this.
29560568f49bSmrgAC_DEFUN([_AM_PROG_CC_C_O],
29570568f49bSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29580568f49bSmrgAC_REQUIRE_AUX_FILE([compile])dnl
29590568f49bSmrgAC_LANG_PUSH([C])dnl
29600568f49bSmrgAC_CACHE_CHECK(
29610568f49bSmrg  [whether $CC understands -c and -o together],
29620568f49bSmrg  [am_cv_prog_cc_c_o],
29630568f49bSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29640568f49bSmrg  # Make sure it works both with $CC and with simple cc.
29650568f49bSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29660568f49bSmrg  # compilers refuse to overwrite an existing .o file with -o,
29670568f49bSmrg  # though they will create one.
29680568f49bSmrg  am_cv_prog_cc_c_o=yes
29690568f49bSmrg  for am_i in 1 2; do
29700568f49bSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29710568f49bSmrg         && test -f conftest2.$ac_objext; then
29720568f49bSmrg      : OK
29730568f49bSmrg    else
29740568f49bSmrg      am_cv_prog_cc_c_o=no
29750568f49bSmrg      break
29760568f49bSmrg    fi
29770568f49bSmrg  done
29780568f49bSmrg  rm -f core conftest*
29790568f49bSmrg  unset am_i])
29800568f49bSmrgif test "$am_cv_prog_cc_c_o" != yes; then
29810568f49bSmrg   # Losing compiler, so override with the script.
29820568f49bSmrg   # FIXME: It is wrong to rewrite CC.
29830568f49bSmrg   # But if we don't then we get into trouble of one sort or another.
29840568f49bSmrg   # A longer-term fix would be to have automake use am__CC in this case,
29850568f49bSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29860568f49bSmrg   CC="$am_aux_dir/compile $CC"
2987bdf0f55dSmrgfi
29880568f49bSmrgAC_LANG_POP([C])])
29892265a131Smrg
29900568f49bSmrg# For backward compatibility.
29910568f49bSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
2992444c061aSmrg
29930568f49bSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
29940568f49bSmrg#
29950568f49bSmrg# This file is free software; the Free Software Foundation
29960568f49bSmrg# gives unlimited permission to copy and/or distribute it,
29970568f49bSmrg# with or without modifications, as long as this notice is preserved.
29989e7bcd65Smrg
29990568f49bSmrg# AM_RUN_LOG(COMMAND)
30000568f49bSmrg# -------------------
30010568f49bSmrg# Run COMMAND, save the exit status in ac_status, and log it.
30020568f49bSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30030568f49bSmrgAC_DEFUN([AM_RUN_LOG],
30040568f49bSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30050568f49bSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30060568f49bSmrg   ac_status=$?
30070568f49bSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30080568f49bSmrg   (exit $ac_status); }])
30099e7bcd65Smrg
30100568f49bSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30119e7bcd65Smrg
30120568f49bSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
30130568f49bSmrg#
30140568f49bSmrg# This file is free software; the Free Software Foundation
30150568f49bSmrg# gives unlimited permission to copy and/or distribute it,
30160568f49bSmrg# with or without modifications, as long as this notice is preserved.
30179e7bcd65Smrg
30180568f49bSmrg# AM_SANITY_CHECK
30190568f49bSmrg# ---------------
30200568f49bSmrgAC_DEFUN([AM_SANITY_CHECK],
30210568f49bSmrg[AC_MSG_CHECKING([whether build environment is sane])
30220568f49bSmrg# Reject unsafe characters in $srcdir or the absolute working directory
30230568f49bSmrg# name.  Accept space and tab only in the latter.
30240568f49bSmrgam_lf='
30250568f49bSmrg'
30260568f49bSmrgcase `pwd` in
30270568f49bSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30280568f49bSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30290568f49bSmrgesac
30300568f49bSmrgcase $srcdir in
30310568f49bSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30320568f49bSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30330568f49bSmrgesac
30340568f49bSmrg
30350568f49bSmrg# Do 'set' in a subshell so we don't clobber the current shell's
30360568f49bSmrg# arguments.  Must try -L first in case configure is actually a
30370568f49bSmrg# symlink; some systems play weird games with the mod time of symlinks
30380568f49bSmrg# (eg FreeBSD returns the mod time of the symlink's containing
30390568f49bSmrg# directory).
30400568f49bSmrgif (
30410568f49bSmrg   am_has_slept=no
30420568f49bSmrg   for am_try in 1 2; do
30430568f49bSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30440568f49bSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30450568f49bSmrg     if test "$[*]" = "X"; then
30460568f49bSmrg	# -L didn't work.
30470568f49bSmrg	set X `ls -t "$srcdir/configure" conftest.file`
30480568f49bSmrg     fi
30490568f49bSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30500568f49bSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
30519e7bcd65Smrg
30520568f49bSmrg	# If neither matched, then we have a broken ls.  This can happen
30530568f49bSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30540568f49bSmrg	# broken ls alias from the environment.  This has actually
30550568f49bSmrg	# happened.  Such a system could not be considered "sane".
30560568f49bSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30570568f49bSmrg  alias in your environment])
30580568f49bSmrg     fi
30590568f49bSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30600568f49bSmrg       break
30610568f49bSmrg     fi
30620568f49bSmrg     # Just in case.
30630568f49bSmrg     sleep 1
30640568f49bSmrg     am_has_slept=yes
30650568f49bSmrg   done
30660568f49bSmrg   test "$[2]" = conftest.file
30670568f49bSmrg   )
30680568f49bSmrgthen
30690568f49bSmrg   # Ok.
30700568f49bSmrg   :
30710568f49bSmrgelse
30720568f49bSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
30730568f49bSmrgCheck your system clock])
30740568f49bSmrgfi
30750568f49bSmrgAC_MSG_RESULT([yes])
30760568f49bSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30770568f49bSmrg# generated files are strictly newer.
30780568f49bSmrgam_sleep_pid=
30790568f49bSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30800568f49bSmrg  ( sleep 1 ) &
30810568f49bSmrg  am_sleep_pid=$!
30820568f49bSmrgfi
30830568f49bSmrgAC_CONFIG_COMMANDS_PRE(
30840568f49bSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30850568f49bSmrg   if test -n "$am_sleep_pid"; then
30860568f49bSmrg     # Hide warnings about reused PIDs.
30870568f49bSmrg     wait $am_sleep_pid 2>/dev/null
30880568f49bSmrg   fi
30890568f49bSmrg   AC_MSG_RESULT([done])])
30900568f49bSmrgrm -f conftest.file
3091249c3046Smrg])
30922ae83157Smrg
30930568f49bSmrg# Copyright (C) 2009-2018 Free Software Foundation, Inc.
30949e7bcd65Smrg#
30950568f49bSmrg# This file is free software; the Free Software Foundation
30960568f49bSmrg# gives unlimited permission to copy and/or distribute it,
30970568f49bSmrg# with or without modifications, as long as this notice is preserved.
30989e7bcd65Smrg
30990568f49bSmrg# AM_SILENT_RULES([DEFAULT])
31000568f49bSmrg# --------------------------
31010568f49bSmrg# Enable less verbose build rules; with the default set to DEFAULT
31020568f49bSmrg# ("yes" being less verbose, "no" or empty being verbose).
31030568f49bSmrgAC_DEFUN([AM_SILENT_RULES],
31040568f49bSmrg[AC_ARG_ENABLE([silent-rules], [dnl
31050568f49bSmrgAS_HELP_STRING(
31060568f49bSmrg  [--enable-silent-rules],
31070568f49bSmrg  [less verbose build output (undo: "make V=1")])
31080568f49bSmrgAS_HELP_STRING(
31090568f49bSmrg  [--disable-silent-rules],
31100568f49bSmrg  [verbose build output (undo: "make V=0")])dnl
31110568f49bSmrg])
31120568f49bSmrgcase $enable_silent_rules in @%:@ (((
31130568f49bSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
31140568f49bSmrg   no) AM_DEFAULT_VERBOSITY=1;;
31150568f49bSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31160568f49bSmrgesac
31170568f49bSmrgdnl
31180568f49bSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31190568f49bSmrgdnl do not support nested variable expansions.
31200568f49bSmrgdnl See automake bug#9928 and bug#10237.
31210568f49bSmrgam_make=${MAKE-make}
31220568f49bSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31230568f49bSmrg   [am_cv_make_support_nested_variables],
31240568f49bSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31250568f49bSmrgBAR0=false
31260568f49bSmrgBAR1=true
31270568f49bSmrgV=1
31280568f49bSmrgam__doit:
31290568f49bSmrg	@$(TRUE)
31300568f49bSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31310568f49bSmrg  am_cv_make_support_nested_variables=yes
31329e7bcd65Smrgelse
31330568f49bSmrg  am_cv_make_support_nested_variables=no
31340568f49bSmrgfi])
31350568f49bSmrgif test $am_cv_make_support_nested_variables = yes; then
31360568f49bSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31370568f49bSmrg  AM_V='$(V)'
31380568f49bSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31390568f49bSmrgelse
31400568f49bSmrg  AM_V=$AM_DEFAULT_VERBOSITY
31410568f49bSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31429e7bcd65Smrgfi
31430568f49bSmrgAC_SUBST([AM_V])dnl
31440568f49bSmrgAM_SUBST_NOTMAKE([AM_V])dnl
31450568f49bSmrgAC_SUBST([AM_DEFAULT_V])dnl
31460568f49bSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31470568f49bSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31480568f49bSmrgAM_BACKSLASH='\'
31490568f49bSmrgAC_SUBST([AM_BACKSLASH])dnl
31500568f49bSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31510568f49bSmrg])
3152bdf0f55dSmrg
31530568f49bSmrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
31540568f49bSmrg#
31550568f49bSmrg# This file is free software; the Free Software Foundation
31560568f49bSmrg# gives unlimited permission to copy and/or distribute it,
31570568f49bSmrg# with or without modifications, as long as this notice is preserved.
31589e7bcd65Smrg
31590568f49bSmrg# AM_PROG_INSTALL_STRIP
31600568f49bSmrg# ---------------------
31610568f49bSmrg# One issue with vendor 'install' (even GNU) is that you can't
31620568f49bSmrg# specify the program used to strip binaries.  This is especially
31630568f49bSmrg# annoying in cross-compiling environments, where the build's strip
31640568f49bSmrg# is unlikely to handle the host's binaries.
31650568f49bSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31660568f49bSmrg# always use install-sh in "make install-strip", and initialize
31670568f49bSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
31680568f49bSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31690568f49bSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31700568f49bSmrg# Installed binaries are usually stripped using 'strip' when the user
31710568f49bSmrg# run "make install-strip".  However 'strip' might not be the right
31720568f49bSmrg# tool to use in cross-compilation environments, therefore Automake
31730568f49bSmrg# will honor the 'STRIP' environment variable to overrule this program.
31740568f49bSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31750568f49bSmrgif test "$cross_compiling" != no; then
31760568f49bSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
31770568f49bSmrgfi
31780568f49bSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31790568f49bSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31809e7bcd65Smrg
31810568f49bSmrg# Copyright (C) 2006-2018 Free Software Foundation, Inc.
31820568f49bSmrg#
31830568f49bSmrg# This file is free software; the Free Software Foundation
31840568f49bSmrg# gives unlimited permission to copy and/or distribute it,
31850568f49bSmrg# with or without modifications, as long as this notice is preserved.
31869e7bcd65Smrg
31870568f49bSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
31880568f49bSmrg# ---------------------------
31890568f49bSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31900568f49bSmrg# This macro is traced by Automake.
31910568f49bSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
31929e7bcd65Smrg
31930568f49bSmrg# AM_SUBST_NOTMAKE(VARIABLE)
31940568f49bSmrg# --------------------------
31950568f49bSmrg# Public sister of _AM_SUBST_NOTMAKE.
31960568f49bSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
31979e7bcd65Smrg
31980568f49bSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3199bdf0f55dSmrg
32000568f49bSmrg# Copyright (C) 2004-2018 Free Software Foundation, Inc.
32010568f49bSmrg#
32020568f49bSmrg# This file is free software; the Free Software Foundation
32030568f49bSmrg# gives unlimited permission to copy and/or distribute it,
32040568f49bSmrg# with or without modifications, as long as this notice is preserved.
32059e7bcd65Smrg
32060568f49bSmrg# _AM_PROG_TAR(FORMAT)
32070568f49bSmrg# --------------------
32080568f49bSmrg# Check how to create a tarball in format FORMAT.
32090568f49bSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3210249c3046Smrg#
32110568f49bSmrg# Substitute a variable $(am__tar) that is a command
32120568f49bSmrg# writing to stdout a FORMAT-tarball containing the directory
32130568f49bSmrg# $tardir.
32140568f49bSmrg#     tardir=directory && $(am__tar) > result.tar
32159e7bcd65Smrg#
32160568f49bSmrg# Substitute a variable $(am__untar) that extract such
32170568f49bSmrg# a tarball read from stdin.
32180568f49bSmrg#     $(am__untar) < result.tar
32199e7bcd65Smrg#
32200568f49bSmrgAC_DEFUN([_AM_PROG_TAR],
32210568f49bSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32220568f49bSmrg# in the wild :-(  We should find a proper way to deprecate it ...
32230568f49bSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32242265a131Smrg
32250568f49bSmrg# We'll loop over all known methods to create a tar archive until one works.
32260568f49bSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32272265a131Smrg
32280568f49bSmrgm4_if([$1], [v7],
32290568f49bSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3230444c061aSmrg
32310568f49bSmrg  [m4_case([$1],
32320568f49bSmrg    [ustar],
32330568f49bSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32340568f49bSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32350568f49bSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32360568f49bSmrg      # and bug#13588).
32370568f49bSmrg      am_max_uid=2097151 # 2^21 - 1
32380568f49bSmrg      am_max_gid=$am_max_uid
32390568f49bSmrg      # The $UID and $GID variables are not portable, so we need to resort
32400568f49bSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32410568f49bSmrg      # below are definitely unexpected, so allow the users to see them
32420568f49bSmrg      # (that is, avoid stderr redirection).
32430568f49bSmrg      am_uid=`id -u || echo unknown`
32440568f49bSmrg      am_gid=`id -g || echo unknown`
32450568f49bSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32460568f49bSmrg      if test $am_uid -le $am_max_uid; then
32470568f49bSmrg         AC_MSG_RESULT([yes])
32480568f49bSmrg      else
32490568f49bSmrg         AC_MSG_RESULT([no])
32500568f49bSmrg         _am_tools=none
32510568f49bSmrg      fi
32520568f49bSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32530568f49bSmrg      if test $am_gid -le $am_max_gid; then
32540568f49bSmrg         AC_MSG_RESULT([yes])
32550568f49bSmrg      else
32560568f49bSmrg        AC_MSG_RESULT([no])
32570568f49bSmrg        _am_tools=none
32580568f49bSmrg      fi],
3259444c061aSmrg
32600568f49bSmrg  [pax],
32610568f49bSmrg    [],
3262444c061aSmrg
32630568f49bSmrg  [m4_fatal([Unknown tar format])])
3264444c061aSmrg
32650568f49bSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3266444c061aSmrg
32670568f49bSmrg  # Go ahead even if we have the value already cached.  We do so because we
32680568f49bSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32690568f49bSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3270bdf0f55dSmrg
32710568f49bSmrg  for _am_tool in $_am_tools; do
32720568f49bSmrg    case $_am_tool in
32730568f49bSmrg    gnutar)
32740568f49bSmrg      for _am_tar in tar gnutar gtar; do
32750568f49bSmrg        AM_RUN_LOG([$_am_tar --version]) && break
32760568f49bSmrg      done
32770568f49bSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32780568f49bSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32790568f49bSmrg      am__untar="$_am_tar -xf -"
32800568f49bSmrg      ;;
32810568f49bSmrg    plaintar)
32820568f49bSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32830568f49bSmrg      # ustar tarball either.
32840568f49bSmrg      (tar --version) >/dev/null 2>&1 && continue
32850568f49bSmrg      am__tar='tar chf - "$$tardir"'
32860568f49bSmrg      am__tar_='tar chf - "$tardir"'
32870568f49bSmrg      am__untar='tar xf -'
32880568f49bSmrg      ;;
32890568f49bSmrg    pax)
32900568f49bSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
32910568f49bSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
32920568f49bSmrg      am__untar='pax -r'
32930568f49bSmrg      ;;
32940568f49bSmrg    cpio)
32950568f49bSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
32960568f49bSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
32970568f49bSmrg      am__untar='cpio -i -H $1 -d'
32980568f49bSmrg      ;;
32990568f49bSmrg    none)
33000568f49bSmrg      am__tar=false
33010568f49bSmrg      am__tar_=false
33020568f49bSmrg      am__untar=false
33030568f49bSmrg      ;;
33040568f49bSmrg    esac
3305bdf0f55dSmrg
33060568f49bSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
33070568f49bSmrg    # and am__untar set.
33080568f49bSmrg    test -n "${am_cv_prog_tar_$1}" && break
3309339a7c43Smrg
33100568f49bSmrg    # tar/untar a dummy directory, and stop if the command works.
33110568f49bSmrg    rm -rf conftest.dir
33120568f49bSmrg    mkdir conftest.dir
33130568f49bSmrg    echo GrepMe > conftest.dir/file
33140568f49bSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33150568f49bSmrg    rm -rf conftest.dir
33160568f49bSmrg    if test -s conftest.tar; then
33170568f49bSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
33180568f49bSmrg      AM_RUN_LOG([cat conftest.dir/file])
33190568f49bSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33200568f49bSmrg    fi
33210568f49bSmrg  done
33220568f49bSmrg  rm -rf conftest.dir
3323bdf0f55dSmrg
33240568f49bSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33250568f49bSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33260568f49bSmrg
33270568f49bSmrgAC_SUBST([am__tar])
33280568f49bSmrgAC_SUBST([am__untar])
33290568f49bSmrg]) # _AM_PROG_TAR
3330444c061aSmrg
33310568f49bSmrgm4_include([m4/ax_define_dir.m4])
33320568f49bSmrgm4_include([m4/libtool.m4])
33330568f49bSmrgm4_include([m4/ltoptions.m4])
33340568f49bSmrgm4_include([m4/ltsugar.m4])
33350568f49bSmrgm4_include([m4/ltversion.m4])
33360568f49bSmrgm4_include([m4/lt~obsolete.m4])
3337