15212f86fSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2b8414663Smrg
35212f86fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
47d5e3a19Smrg
57d5e3a19Smrg# This file is free software; the Free Software Foundation
67d5e3a19Smrg# gives unlimited permission to copy and/or distribute it,
77d5e3a19Smrg# with or without modifications, as long as this notice is preserved.
87d5e3a19Smrg
97d5e3a19Smrg# This program is distributed in the hope that it will be useful,
107d5e3a19Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117d5e3a19Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127d5e3a19Smrg# PARTICULAR PURPOSE.
137d5e3a19Smrg
14b8414663Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
151568b75bSmrgm4_ifndef([AC_AUTOCONF_VERSION],
161568b75bSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
175212f86fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
185212f86fSmrg[m4_warning([this file was generated for autoconf 2.71.
191568b75bSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
201568b75bSmrgIf you have problems, you may need to regenerate the build system entirely.
21b8414663SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227d5e3a19Smrg
237f6d8fe2Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
247f6d8fe2Smrg# serial 11 (pkg-config-0.29.1)
257d5e3a19Smrg
267f6d8fe2Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
277f6d8fe2Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
287f6d8fe2Smrgdnl
297f6d8fe2Smrgdnl This program is free software; you can redistribute it and/or modify
307f6d8fe2Smrgdnl it under the terms of the GNU General Public License as published by
317f6d8fe2Smrgdnl the Free Software Foundation; either version 2 of the License, or
327f6d8fe2Smrgdnl (at your option) any later version.
337f6d8fe2Smrgdnl
347f6d8fe2Smrgdnl This program is distributed in the hope that it will be useful, but
357f6d8fe2Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
367f6d8fe2Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
377f6d8fe2Smrgdnl General Public License for more details.
387f6d8fe2Smrgdnl
397f6d8fe2Smrgdnl You should have received a copy of the GNU General Public License
407f6d8fe2Smrgdnl along with this program; if not, write to the Free Software
417f6d8fe2Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
427f6d8fe2Smrgdnl 02111-1307, USA.
437f6d8fe2Smrgdnl
447f6d8fe2Smrgdnl As a special exception to the GNU General Public License, if you
457f6d8fe2Smrgdnl distribute this file as part of a program that contains a
467f6d8fe2Smrgdnl configuration script generated by Autoconf, you may include it under
477f6d8fe2Smrgdnl the same distribution terms that you use for the rest of that
487f6d8fe2Smrgdnl program.
497d5e3a19Smrg
507f6d8fe2Smrgdnl PKG_PREREQ(MIN-VERSION)
517f6d8fe2Smrgdnl -----------------------
527f6d8fe2Smrgdnl Since: 0.29
537f6d8fe2Smrgdnl
547f6d8fe2Smrgdnl Verify that the version of the pkg-config macros are at least
557f6d8fe2Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
567f6d8fe2Smrgdnl installed version of pkg-config, this checks the developer's version
577f6d8fe2Smrgdnl of pkg.m4 when generating configure.
587f6d8fe2Smrgdnl
597f6d8fe2Smrgdnl To ensure that this macro is defined, also add:
607f6d8fe2Smrgdnl m4_ifndef([PKG_PREREQ],
617f6d8fe2Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
627f6d8fe2Smrgdnl
637f6d8fe2Smrgdnl See the "Since" comment for each macro you use to see what version
647f6d8fe2Smrgdnl of the macros you require.
657f6d8fe2Smrgm4_defun([PKG_PREREQ],
667f6d8fe2Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
677f6d8fe2Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
687f6d8fe2Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
697f6d8fe2Smrg])dnl PKG_PREREQ
707d5e3a19Smrg
717f6d8fe2Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
727f6d8fe2Smrgdnl ----------------------------------
737f6d8fe2Smrgdnl Since: 0.16
747f6d8fe2Smrgdnl
757f6d8fe2Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
767f6d8fe2Smrgdnl first found in the path. Checks that the version of pkg-config found
777f6d8fe2Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
787f6d8fe2Smrgdnl used since that's the first version where most current features of
797f6d8fe2Smrgdnl pkg-config existed.
807f6d8fe2SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
817f6d8fe2Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
827f6d8fe2Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
837f6d8fe2Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
847f6d8fe2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
857f6d8fe2SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
867f6d8fe2SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
877d5e3a19Smrg
887f6d8fe2Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
897f6d8fe2Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
907f6d8fe2Smrgfi
917f6d8fe2Smrgif test -n "$PKG_CONFIG"; then
927f6d8fe2Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
937f6d8fe2Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
947f6d8fe2Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
957f6d8fe2Smrg		AC_MSG_RESULT([yes])
967f6d8fe2Smrg	else
977f6d8fe2Smrg		AC_MSG_RESULT([no])
987f6d8fe2Smrg		PKG_CONFIG=""
997f6d8fe2Smrg	fi
1007f6d8fe2Smrgfi[]dnl
1017f6d8fe2Smrg])dnl PKG_PROG_PKG_CONFIG
1027d5e3a19Smrg
1037f6d8fe2Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1047f6d8fe2Smrgdnl -------------------------------------------------------------------
1057f6d8fe2Smrgdnl Since: 0.18
1067f6d8fe2Smrgdnl
1077f6d8fe2Smrgdnl Check to see whether a particular set of modules exists. Similar to
1087f6d8fe2Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1097f6d8fe2Smrgdnl
1107f6d8fe2Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1117f6d8fe2Smrgdnl only at the first occurence in configure.ac, so if the first place
1127f6d8fe2Smrgdnl it's called might be skipped (such as if it is within an "if", you
1137f6d8fe2Smrgdnl have to call PKG_CHECK_EXISTS manually
1147f6d8fe2SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1157f6d8fe2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1167f6d8fe2Smrgif test -n "$PKG_CONFIG" && \
1177f6d8fe2Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1187f6d8fe2Smrg  m4_default([$2], [:])
1197f6d8fe2Smrgm4_ifvaln([$3], [else
1207f6d8fe2Smrg  $3])dnl
1217f6d8fe2Smrgfi])
1227d5e3a19Smrg
1237f6d8fe2Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1247f6d8fe2Smrgdnl ---------------------------------------------
1257f6d8fe2Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1267f6d8fe2Smrgdnl pkg_failed based on the result.
1277f6d8fe2Smrgm4_define([_PKG_CONFIG],
1287f6d8fe2Smrg[if test -n "$$1"; then
1297f6d8fe2Smrg    pkg_cv_[]$1="$$1"
1307f6d8fe2Smrg elif test -n "$PKG_CONFIG"; then
1317f6d8fe2Smrg    PKG_CHECK_EXISTS([$3],
1327f6d8fe2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1337f6d8fe2Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1347f6d8fe2Smrg		     [pkg_failed=yes])
1357f6d8fe2Smrg else
1367f6d8fe2Smrg    pkg_failed=untried
1377f6d8fe2Smrgfi[]dnl
1387f6d8fe2Smrg])dnl _PKG_CONFIG
1397d5e3a19Smrg
1407f6d8fe2Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1417f6d8fe2Smrgdnl ---------------------------
1427f6d8fe2Smrgdnl Internal check to see if pkg-config supports short errors.
1437f6d8fe2SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1447f6d8fe2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1457f6d8fe2Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1467f6d8fe2Smrg        _pkg_short_errors_supported=yes
1475212f86fSmrgelse
1487f6d8fe2Smrg        _pkg_short_errors_supported=no
1497f6d8fe2Smrgfi[]dnl
1507f6d8fe2Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1517d5e3a19Smrg
1527d5e3a19Smrg
1537f6d8fe2Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1547f6d8fe2Smrgdnl   [ACTION-IF-NOT-FOUND])
1557f6d8fe2Smrgdnl --------------------------------------------------------------
1567f6d8fe2Smrgdnl Since: 0.4.0
1577f6d8fe2Smrgdnl
1587f6d8fe2Smrgdnl Note that if there is a possibility the first call to
1597f6d8fe2Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1607f6d8fe2Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1617f6d8fe2SmrgAC_DEFUN([PKG_CHECK_MODULES],
1627f6d8fe2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1637f6d8fe2SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1647f6d8fe2SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1657d5e3a19Smrg
1667f6d8fe2Smrgpkg_failed=no
1677f6d8fe2SmrgAC_MSG_CHECKING([for $1])
1687d5e3a19Smrg
1697f6d8fe2Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1707f6d8fe2Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1717d5e3a19Smrg
1727f6d8fe2Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1737f6d8fe2Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1747f6d8fe2SmrgSee the pkg-config man page for more details.])
1757d5e3a19Smrg
1767f6d8fe2Smrgif test $pkg_failed = yes; then
1777f6d8fe2Smrg   	AC_MSG_RESULT([no])
1787f6d8fe2Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1797f6d8fe2Smrg        if test $_pkg_short_errors_supported = yes; then
1807f6d8fe2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1817f6d8fe2Smrg        else 
1827f6d8fe2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1837f6d8fe2Smrg        fi
1847f6d8fe2Smrg	# Put the nasty error message in config.log where it belongs
1857f6d8fe2Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1867d5e3a19Smrg
1877f6d8fe2Smrg	m4_default([$4], [AC_MSG_ERROR(
1887f6d8fe2Smrg[Package requirements ($2) were not met:
1897d5e3a19Smrg
1907f6d8fe2Smrg$$1_PKG_ERRORS
1917d5e3a19Smrg
1927f6d8fe2SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1937f6d8fe2Smrginstalled software in a non-standard prefix.
1947d5e3a19Smrg
1957f6d8fe2Smrg_PKG_TEXT])[]dnl
1967f6d8fe2Smrg        ])
1977f6d8fe2Smrgelif test $pkg_failed = untried; then
1987f6d8fe2Smrg     	AC_MSG_RESULT([no])
1997f6d8fe2Smrg	m4_default([$4], [AC_MSG_FAILURE(
2007f6d8fe2Smrg[The pkg-config script could not be found or is too old.  Make sure it
2017f6d8fe2Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2027f6d8fe2Smrgpath to pkg-config.
2031568b75bSmrg
2047f6d8fe2Smrg_PKG_TEXT
2057d5e3a19Smrg
2067f6d8fe2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2077f6d8fe2Smrg        ])
2087f6d8fe2Smrgelse
2097f6d8fe2Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2107f6d8fe2Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2117f6d8fe2Smrg        AC_MSG_RESULT([yes])
2127f6d8fe2Smrg	$3
2137f6d8fe2Smrgfi[]dnl
2147f6d8fe2Smrg])dnl PKG_CHECK_MODULES
21513e6bc1cSmrg
21613e6bc1cSmrg
2177f6d8fe2Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2187f6d8fe2Smrgdnl   [ACTION-IF-NOT-FOUND])
2197f6d8fe2Smrgdnl ---------------------------------------------------------------------
2207f6d8fe2Smrgdnl Since: 0.29
2217f6d8fe2Smrgdnl
2227f6d8fe2Smrgdnl Checks for existence of MODULES and gathers its build flags with
2237f6d8fe2Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2247f6d8fe2Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2257f6d8fe2Smrgdnl
2267f6d8fe2Smrgdnl Note that if there is a possibility the first call to
2277f6d8fe2Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2287f6d8fe2Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2297f6d8fe2Smrgdnl configure.ac.
2307f6d8fe2SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2317f6d8fe2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2327f6d8fe2Smrg_save_PKG_CONFIG=$PKG_CONFIG
2337f6d8fe2SmrgPKG_CONFIG="$PKG_CONFIG --static"
2347f6d8fe2SmrgPKG_CHECK_MODULES($@)
2357f6d8fe2SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2367f6d8fe2Smrg])dnl PKG_CHECK_MODULES_STATIC
23713e6bc1cSmrg
23813e6bc1cSmrg
2397f6d8fe2Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2407f6d8fe2Smrgdnl -------------------------
2417f6d8fe2Smrgdnl Since: 0.27
2427f6d8fe2Smrgdnl
2437f6d8fe2Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2447f6d8fe2Smrgdnl should install pkg-config .pc files. By default the directory is
2457f6d8fe2Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2467f6d8fe2Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2477f6d8fe2Smrgdnl parameter.
2487f6d8fe2SmrgAC_DEFUN([PKG_INSTALLDIR],
2497f6d8fe2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2507f6d8fe2Smrgm4_pushdef([pkg_description],
2517f6d8fe2Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2527f6d8fe2SmrgAC_ARG_WITH([pkgconfigdir],
2537f6d8fe2Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2547f6d8fe2Smrg    [with_pkgconfigdir=]pkg_default)
2557f6d8fe2SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2567f6d8fe2Smrgm4_popdef([pkg_default])
2577f6d8fe2Smrgm4_popdef([pkg_description])
2587f6d8fe2Smrg])dnl PKG_INSTALLDIR
25913e6bc1cSmrg
26013e6bc1cSmrg
2617f6d8fe2Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2627f6d8fe2Smrgdnl --------------------------------
2637f6d8fe2Smrgdnl Since: 0.27
2647f6d8fe2Smrgdnl
2657f6d8fe2Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2667f6d8fe2Smrgdnl module should install arch-independent pkg-config .pc files. By
2677f6d8fe2Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2687f6d8fe2Smrgdnl changed by passing DIRECTORY. The user can override through the
2697f6d8fe2Smrgdnl --with-noarch-pkgconfigdir parameter.
2707f6d8fe2SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2717f6d8fe2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2727f6d8fe2Smrgm4_pushdef([pkg_description],
2737f6d8fe2Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2747f6d8fe2SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2757f6d8fe2Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2767f6d8fe2Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2777f6d8fe2SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2787f6d8fe2Smrgm4_popdef([pkg_default])
2797f6d8fe2Smrgm4_popdef([pkg_description])
2807f6d8fe2Smrg])dnl PKG_NOARCH_INSTALLDIR
2817d5e3a19Smrg
2827d5e3a19Smrg
2837f6d8fe2Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2847f6d8fe2Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2857f6d8fe2Smrgdnl -------------------------------------------
2867f6d8fe2Smrgdnl Since: 0.28
2877f6d8fe2Smrgdnl
2887f6d8fe2Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2897f6d8fe2SmrgAC_DEFUN([PKG_CHECK_VAR],
2907f6d8fe2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2917f6d8fe2SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2927d5e3a19Smrg
2937f6d8fe2Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2947f6d8fe2SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2957d5e3a19Smrg
2967f6d8fe2SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2977f6d8fe2Smrg])dnl PKG_CHECK_VAR
2987d5e3a19Smrg
2997f6d8fe2Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3007f6d8fe2Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3017f6d8fe2Smrgdnl   [DESCRIPTION], [DEFAULT])
3027f6d8fe2Smrgdnl ------------------------------------------
3037f6d8fe2Smrgdnl
3047f6d8fe2Smrgdnl Prepare a "--with-" configure option using the lowercase
3057f6d8fe2Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
3067f6d8fe2Smrgdnl PKG_CHECK_MODULES in a single macro.
3077f6d8fe2SmrgAC_DEFUN([PKG_WITH_MODULES],
3087f6d8fe2Smrg[
3097f6d8fe2Smrgm4_pushdef([with_arg], m4_tolower([$1]))
3107f6d8fe2Smrg
3117f6d8fe2Smrgm4_pushdef([description],
3127f6d8fe2Smrg           [m4_default([$5], [build with ]with_arg[ support])])
3137f6d8fe2Smrg
3147f6d8fe2Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
3157f6d8fe2Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
3167f6d8fe2Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
3177f6d8fe2Smrg
3187f6d8fe2Smrgm4_case(def_arg,
3197f6d8fe2Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3207f6d8fe2Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
3217f6d8fe2Smrg
3227f6d8fe2SmrgAC_ARG_WITH(with_arg,
3237f6d8fe2Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
3247f6d8fe2Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
3257f6d8fe2Smrg
3267f6d8fe2SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
3277f6d8fe2Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
3287f6d8fe2Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
3297f6d8fe2Smrg                                        [m4_n([def_action_if_found]) $3],
3307f6d8fe2Smrg                                        [m4_n([def_action_if_not_found]) $4])])
3317f6d8fe2Smrg
3327f6d8fe2Smrgm4_popdef([with_arg])
3337f6d8fe2Smrgm4_popdef([description])
3347f6d8fe2Smrgm4_popdef([def_arg])
3357f6d8fe2Smrg
3367f6d8fe2Smrg])dnl PKG_WITH_MODULES
3377f6d8fe2Smrg
3387f6d8fe2Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3397f6d8fe2Smrgdnl   [DESCRIPTION], [DEFAULT])
3407f6d8fe2Smrgdnl -----------------------------------------------
3417f6d8fe2Smrgdnl
3427f6d8fe2Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
3437f6d8fe2Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
3447f6d8fe2SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
3457f6d8fe2Smrg[
3467f6d8fe2SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3477f6d8fe2Smrg
3487f6d8fe2SmrgAM_CONDITIONAL([HAVE_][$1],
3497f6d8fe2Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3507f6d8fe2Smrg])dnl PKG_HAVE_WITH_MODULES
3517f6d8fe2Smrg
3527f6d8fe2Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3537f6d8fe2Smrgdnl   [DESCRIPTION], [DEFAULT])
3547f6d8fe2Smrgdnl ------------------------------------------------------
3557f6d8fe2Smrgdnl
3567f6d8fe2Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
3577f6d8fe2Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
3587f6d8fe2Smrgdnl and preprocessor variable.
3597f6d8fe2SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
3607f6d8fe2Smrg[
3617f6d8fe2SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
3627d5e3a19Smrg
3637f6d8fe2SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
3647f6d8fe2Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
3657f6d8fe2Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
3667d5e3a19Smrg
3677f6d8fe2Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3687f6d8fe2Smrgdnl
3697f6d8fe2Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3707f6d8fe2Smrgdnl
3717f6d8fe2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3727f6d8fe2Smrgdnl copy of this software and associated documentation files (the "Software"),
3737f6d8fe2Smrgdnl to deal in the Software without restriction, including without limitation
3747f6d8fe2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3757f6d8fe2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3767f6d8fe2Smrgdnl Software is furnished to do so, subject to the following conditions:
3777f6d8fe2Smrgdnl
3787f6d8fe2Smrgdnl The above copyright notice and this permission notice (including the next
3797f6d8fe2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3807f6d8fe2Smrgdnl Software.
3817f6d8fe2Smrgdnl
3827f6d8fe2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3837f6d8fe2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3847f6d8fe2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3857f6d8fe2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3867f6d8fe2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3877f6d8fe2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3887f6d8fe2Smrgdnl DEALINGS IN THE SOFTWARE.
3897f6d8fe2Smrg
3907f6d8fe2Smrg# XORG_MACROS_VERSION(required-version)
3917f6d8fe2Smrg# -------------------------------------
3927f6d8fe2Smrg# Minimum version: 1.1.0
3937f6d8fe2Smrg#
3947f6d8fe2Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3957f6d8fe2Smrg# your configure.ac with the minimum required version, such as:
3967f6d8fe2Smrg# XORG_MACROS_VERSION(1.1)
3977f6d8fe2Smrg#
3987f6d8fe2Smrg# To ensure that this macro is defined, also add:
3997f6d8fe2Smrg# m4_ifndef([XORG_MACROS_VERSION],
4007f6d8fe2Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4017f6d8fe2Smrg#
4027f6d8fe2Smrg#
4037f6d8fe2Smrg# See the "minimum version" comment for each macro you use to see what
4047f6d8fe2Smrg# version you require.
4057f6d8fe2Smrgm4_defun([XORG_MACROS_VERSION],[
4067f6d8fe2Smrgm4_define([vers_have], [1.19.3])
4077f6d8fe2Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4087f6d8fe2Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4097f6d8fe2Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4107f6d8fe2Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4117f6d8fe2Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4127f6d8fe2Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4137f6d8fe2Smrgm4_undefine([vers_have])
4147f6d8fe2Smrgm4_undefine([maj_have])
4157f6d8fe2Smrgm4_undefine([maj_needed])
4167f6d8fe2Smrg]) # XORG_MACROS_VERSION
4177f6d8fe2Smrg
4187f6d8fe2Smrg# XORG_PROG_RAWCPP()
4197f6d8fe2Smrg# ------------------
4207f6d8fe2Smrg# Minimum version: 1.0.0
4217f6d8fe2Smrg#
4227f6d8fe2Smrg# Find cpp program and necessary flags for use in pre-processing text files
4237f6d8fe2Smrg# such as man pages and config files
4247f6d8fe2SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4257f6d8fe2SmrgAC_REQUIRE([AC_PROG_CPP])
4267f6d8fe2SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
4277f6d8fe2Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
4287f6d8fe2Smrg
4297f6d8fe2Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4307f6d8fe2Smrg# which is not the best choice for supporting other OS'es, but covers most
4317f6d8fe2Smrg# of the ones we need for now.
4327f6d8fe2SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4337f6d8fe2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4347f6d8fe2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4357f6d8fe2Smrg	AC_MSG_RESULT([no])
4367f6d8fe2Smrgelse
4377f6d8fe2Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4387f6d8fe2Smrg		RAWCPPFLAGS=-undef
4397f6d8fe2Smrg		AC_MSG_RESULT([yes])
4407f6d8fe2Smrg	# under Cygwin unix is still defined even with -undef
4417f6d8fe2Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4427f6d8fe2Smrg		RAWCPPFLAGS="-undef -ansi"
4437f6d8fe2Smrg		AC_MSG_RESULT([yes, with -ansi])
4447f6d8fe2Smrg	else
4457f6d8fe2Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4467f6d8fe2Smrg	fi
44713e6bc1cSmrgfi
4487f6d8fe2Smrgrm -f conftest.$ac_ext
4497d5e3a19Smrg
4507f6d8fe2SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4517f6d8fe2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4527f6d8fe2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4537f6d8fe2Smrg	AC_MSG_RESULT([no])
4547f6d8fe2Smrgelse
4557f6d8fe2Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4567f6d8fe2Smrg		TRADITIONALCPPFLAGS="-traditional"
4577f6d8fe2Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4587f6d8fe2Smrg		AC_MSG_RESULT([yes])
4597f6d8fe2Smrg	else
4607f6d8fe2Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4617f6d8fe2Smrg	fi
46213e6bc1cSmrgfi
4637f6d8fe2Smrgrm -f conftest.$ac_ext
4647f6d8fe2SmrgAC_SUBST(RAWCPPFLAGS)
4657f6d8fe2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
4667f6d8fe2Smrg]) # XORG_PROG_RAWCPP
46713e6bc1cSmrg
4687f6d8fe2Smrg# XORG_MANPAGE_SECTIONS()
4697f6d8fe2Smrg# -----------------------
4707f6d8fe2Smrg# Minimum version: 1.0.0
4717f6d8fe2Smrg#
4727f6d8fe2Smrg# Determine which sections man pages go in for the different man page types
4737f6d8fe2Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4747f6d8fe2Smrg# Not sure if there's any better way than just hardcoding by OS name.
4757f6d8fe2Smrg# Override default settings by setting environment variables
4767f6d8fe2Smrg# Added MAN_SUBSTS in version 1.8
4777f6d8fe2Smrg# Added AC_PROG_SED in version 1.8
4787d5e3a19Smrg
4797f6d8fe2SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4807f6d8fe2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4817f6d8fe2SmrgAC_REQUIRE([AC_PROG_SED])
4827d5e3a19Smrg
4837f6d8fe2Smrgcase $host_os in
4847f6d8fe2Smrg    solaris*)
4857f6d8fe2Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4867f6d8fe2Smrg        # check for a man page file found in later versions that use
4877f6d8fe2Smrg        # traditional section numbers instead
4887f6d8fe2Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4897f6d8fe2Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4907f6d8fe2Smrg        ;;
4917f6d8fe2Smrg    *) SYSV_MAN_SECTIONS=false ;;
4927f6d8fe2Smrgesac
4937f6d8fe2Smrg
4947f6d8fe2Smrgif test x$APP_MAN_SUFFIX = x    ; then
4957f6d8fe2Smrg    APP_MAN_SUFFIX=1
4965212f86fSmrgfi
4977f6d8fe2Smrgif test x$APP_MAN_DIR = x    ; then
4987f6d8fe2Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4995212f86fSmrgfi
5007f6d8fe2Smrg
5017f6d8fe2Smrgif test x$LIB_MAN_SUFFIX = x    ; then
5027f6d8fe2Smrg    LIB_MAN_SUFFIX=3
5037f6d8fe2Smrgfi
5047f6d8fe2Smrgif test x$LIB_MAN_DIR = x    ; then
5057f6d8fe2Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
5065212f86fSmrgfi
50713e6bc1cSmrg
5087f6d8fe2Smrgif test x$FILE_MAN_SUFFIX = x    ; then
5097f6d8fe2Smrg    case $SYSV_MAN_SECTIONS in
5107f6d8fe2Smrg	true)				FILE_MAN_SUFFIX=4  ;;
5117f6d8fe2Smrg	*)				FILE_MAN_SUFFIX=5  ;;
5127f6d8fe2Smrg    esac
5137f6d8fe2Smrgfi
5147f6d8fe2Smrgif test x$FILE_MAN_DIR = x    ; then
5157f6d8fe2Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
5167f6d8fe2Smrgfi
51713e6bc1cSmrg
5187f6d8fe2Smrgif test x$MISC_MAN_SUFFIX = x    ; then
5197f6d8fe2Smrg    case $SYSV_MAN_SECTIONS in
5207f6d8fe2Smrg	true)				MISC_MAN_SUFFIX=5  ;;
5217f6d8fe2Smrg	*)				MISC_MAN_SUFFIX=7  ;;
5227f6d8fe2Smrg    esac
5237f6d8fe2Smrgfi
5247f6d8fe2Smrgif test x$MISC_MAN_DIR = x    ; then
5257f6d8fe2Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5267f6d8fe2Smrgfi
5277d5e3a19Smrg
5287f6d8fe2Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
5297f6d8fe2Smrg    case $SYSV_MAN_SECTIONS in
5307f6d8fe2Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
5317f6d8fe2Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5327f6d8fe2Smrg    esac
5337f6d8fe2Smrgfi
5347f6d8fe2Smrgif test x$DRIVER_MAN_DIR = x    ; then
5357f6d8fe2Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5367f6d8fe2Smrgfi
5377d5e3a19Smrg
5387f6d8fe2Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
5397f6d8fe2Smrg    case $SYSV_MAN_SECTIONS in
5407f6d8fe2Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
5417f6d8fe2Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5427f6d8fe2Smrg    esac
5437f6d8fe2Smrgfi
5447f6d8fe2Smrgif test x$ADMIN_MAN_DIR = x    ; then
5457f6d8fe2Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5467f6d8fe2Smrgfi
54713e6bc1cSmrg
5487d5e3a19Smrg
5497f6d8fe2SmrgAC_SUBST([APP_MAN_SUFFIX])
5507f6d8fe2SmrgAC_SUBST([LIB_MAN_SUFFIX])
5517f6d8fe2SmrgAC_SUBST([FILE_MAN_SUFFIX])
5527f6d8fe2SmrgAC_SUBST([MISC_MAN_SUFFIX])
5537f6d8fe2SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5547f6d8fe2SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5557f6d8fe2SmrgAC_SUBST([APP_MAN_DIR])
5567f6d8fe2SmrgAC_SUBST([LIB_MAN_DIR])
5577f6d8fe2SmrgAC_SUBST([FILE_MAN_DIR])
5587f6d8fe2SmrgAC_SUBST([MISC_MAN_DIR])
5597f6d8fe2SmrgAC_SUBST([DRIVER_MAN_DIR])
5607f6d8fe2SmrgAC_SUBST([ADMIN_MAN_DIR])
5617d5e3a19Smrg
5627f6d8fe2SmrgXORG_MAN_PAGE="X Version 11"
5637f6d8fe2SmrgAC_SUBST([XORG_MAN_PAGE])
5647f6d8fe2SmrgMAN_SUBSTS="\
5657f6d8fe2Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5667f6d8fe2Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5677f6d8fe2Smrg	-e 's|__xservername__|Xorg|g' \
5687f6d8fe2Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
5697f6d8fe2Smrg	-e 's|__projectroot__|\$(prefix)|g' \
5707f6d8fe2Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5717f6d8fe2Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5727f6d8fe2Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5737f6d8fe2Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5747f6d8fe2Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5757f6d8fe2Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5767f6d8fe2Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5777f6d8fe2SmrgAC_SUBST([MAN_SUBSTS])
578b8414663Smrg
5797f6d8fe2Smrg]) # XORG_MANPAGE_SECTIONS
5807d5e3a19Smrg
5817f6d8fe2Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5827f6d8fe2Smrg# ------------------------
5837f6d8fe2Smrg# Minimum version: 1.7.0
5847f6d8fe2Smrg#
5857f6d8fe2Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5867f6d8fe2Smrg# provided by xorg-sgml-doctools, if installed.
5877f6d8fe2SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5887f6d8fe2SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5897f6d8fe2SmrgXORG_SGML_PATH=
5907f6d8fe2SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5917f6d8fe2Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5927f6d8fe2Smrg    [m4_ifval([$1],[:],
5937f6d8fe2Smrg        [if test x"$cross_compiling" != x"yes" ; then
5947f6d8fe2Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5957f6d8fe2Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5967f6d8fe2Smrg         fi])
5977f6d8fe2Smrg    ])
59813e6bc1cSmrg
5997f6d8fe2Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6007f6d8fe2Smrg# the path and the name of the doc stylesheet
6017f6d8fe2Smrgif test "x$XORG_SGML_PATH" != "x" ; then
6027f6d8fe2Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6037f6d8fe2Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6047f6d8fe2Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6057f6d8fe2Smrgelse
6067f6d8fe2Smrg   AC_MSG_RESULT([no])
6077f6d8fe2Smrgfi
60813e6bc1cSmrg
6097f6d8fe2SmrgAC_SUBST(XORG_SGML_PATH)
6107f6d8fe2SmrgAC_SUBST(STYLESHEET_SRCDIR)
6117f6d8fe2SmrgAC_SUBST(XSL_STYLESHEET)
6127f6d8fe2SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6137f6d8fe2Smrg]) # XORG_CHECK_SGML_DOCTOOLS
61413e6bc1cSmrg
6157f6d8fe2Smrg# XORG_CHECK_LINUXDOC
6167f6d8fe2Smrg# -------------------
6177f6d8fe2Smrg# Minimum version: 1.0.0
6185212f86fSmrg#
6197f6d8fe2Smrg# Defines the variable MAKE_TEXT if the necessary tools and
6207f6d8fe2Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6217f6d8fe2Smrg# Whether or not the necessary tools and files are found can be checked
6227f6d8fe2Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6237f6d8fe2SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6247f6d8fe2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6257f6d8fe2SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
6265212f86fSmrg
6277f6d8fe2SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
6285212f86fSmrg
6297f6d8fe2SmrgAC_MSG_CHECKING([whether to build documentation])
6307f6d8fe2Smrg
6317f6d8fe2Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6327f6d8fe2Smrg   BUILDDOC=yes
63313e6bc1cSmrgelse
6347f6d8fe2Smrg   BUILDDOC=no
6357d5e3a19Smrgfi
6367d5e3a19Smrg
6377f6d8fe2SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6387d5e3a19Smrg
6397f6d8fe2SmrgAC_MSG_RESULT([$BUILDDOC])
6407d5e3a19Smrg
6417f6d8fe2SmrgAC_MSG_CHECKING([whether to build pdf documentation])
642b8414663Smrg
6437f6d8fe2Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6447f6d8fe2Smrg   BUILDPDFDOC=yes
6457f6d8fe2Smrgelse
6467f6d8fe2Smrg   BUILDPDFDOC=no
6477f6d8fe2Smrgfi
648b8414663Smrg
6497f6d8fe2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
650b8414663Smrg
6517f6d8fe2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
652b8414663Smrg
6537f6d8fe2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6547f6d8fe2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6557f6d8fe2SmrgMAKE_PDF="$PS2PDF"
6567f6d8fe2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
657b8414663Smrg
6587f6d8fe2SmrgAC_SUBST(MAKE_TEXT)
6597f6d8fe2SmrgAC_SUBST(MAKE_PS)
6607f6d8fe2SmrgAC_SUBST(MAKE_PDF)
6617f6d8fe2SmrgAC_SUBST(MAKE_HTML)
6627f6d8fe2Smrg]) # XORG_CHECK_LINUXDOC
6637d5e3a19Smrg
6647f6d8fe2Smrg# XORG_CHECK_DOCBOOK
6657f6d8fe2Smrg# -------------------
6667f6d8fe2Smrg# Minimum version: 1.0.0
6675212f86fSmrg#
6687f6d8fe2Smrg# Checks for the ability to build output formats from SGML DocBook source.
6697f6d8fe2Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6707f6d8fe2Smrg# indicates whether the necessary tools and files are found and, if set,
6717f6d8fe2Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6727f6d8fe2SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6737f6d8fe2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6741568b75bSmrg
6757f6d8fe2SmrgBUILDTXTDOC=no
6767f6d8fe2SmrgBUILDPDFDOC=no
6777f6d8fe2SmrgBUILDPSDOC=no
6787f6d8fe2SmrgBUILDHTMLDOC=no
6797d5e3a19Smrg
6807f6d8fe2SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6817f6d8fe2SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6827f6d8fe2SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6837f6d8fe2SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
6847d5e3a19Smrg
6857f6d8fe2SmrgAC_MSG_CHECKING([whether to build text documentation])
6867f6d8fe2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6877f6d8fe2Smrg   test x$BUILD_TXTDOC != xno; then
6887f6d8fe2Smrg	BUILDTXTDOC=yes
6897f6d8fe2Smrgfi
6907f6d8fe2SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6917f6d8fe2SmrgAC_MSG_RESULT([$BUILDTXTDOC])
6925212f86fSmrg
6937f6d8fe2SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6947f6d8fe2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6957f6d8fe2Smrg   test x$BUILD_PDFDOC != xno; then
6967f6d8fe2Smrg	BUILDPDFDOC=yes
6977f6d8fe2Smrgfi
6987f6d8fe2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6997f6d8fe2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
7005212f86fSmrg
7017f6d8fe2SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7027f6d8fe2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7037f6d8fe2Smrg   test x$BUILD_PSDOC != xno; then
7047f6d8fe2Smrg	BUILDPSDOC=yes
7057f6d8fe2Smrgfi
7067f6d8fe2SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7077f6d8fe2SmrgAC_MSG_RESULT([$BUILDPSDOC])
7087d5e3a19Smrg
7097f6d8fe2SmrgAC_MSG_CHECKING([whether to build HTML documentation])
7107f6d8fe2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7117f6d8fe2Smrg   test x$BUILD_HTMLDOC != xno; then
7127f6d8fe2Smrg	BUILDHTMLDOC=yes
7137d5e3a19Smrgfi
7147f6d8fe2SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7157f6d8fe2SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7167d5e3a19Smrg
7177f6d8fe2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7187f6d8fe2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7197f6d8fe2SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7207f6d8fe2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
7217d5e3a19Smrg
7227f6d8fe2SmrgAC_SUBST(MAKE_TEXT)
7237f6d8fe2SmrgAC_SUBST(MAKE_PS)
7247f6d8fe2SmrgAC_SUBST(MAKE_PDF)
7257f6d8fe2SmrgAC_SUBST(MAKE_HTML)
7267f6d8fe2Smrg]) # XORG_CHECK_DOCBOOK
7277d5e3a19Smrg
7287f6d8fe2Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7297f6d8fe2Smrg# ----------------
7307f6d8fe2Smrg# Minimum version: 1.5.0
7317f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
73213e6bc1cSmrg#
7337f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
7347f6d8fe2Smrg# not at the appropriate level. This macro enables a module to test for the
7357f6d8fe2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
7367f6d8fe2Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7377f6d8fe2Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7387f6d8fe2Smrg# --with-xmlto assumes 'auto'.
7397f6d8fe2Smrg#
7407f6d8fe2Smrg# Interface to module:
7417f6d8fe2Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7427f6d8fe2Smrg# XMLTO:	returns the path of the xmlto program found
7437f6d8fe2Smrg#		returns the path set by the user in the environment
7447f6d8fe2Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7457f6d8fe2Smrg#		'no' user instructs the module not to use xmlto
7467f6d8fe2Smrg#
7477f6d8fe2Smrg# Added in version 1.10.0
7487f6d8fe2Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7497f6d8fe2Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7507f6d8fe2Smrg#
7517f6d8fe2Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7527f6d8fe2Smrg#
7537f6d8fe2SmrgAC_DEFUN([XORG_WITH_XMLTO],[
7547f6d8fe2SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7557f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
7567f6d8fe2SmrgAC_ARG_WITH(xmlto,
7577f6d8fe2Smrg	AS_HELP_STRING([--with-xmlto],
7587f6d8fe2Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7597f6d8fe2Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7607f6d8fe2Smrgm4_undefine([_defopt])
7615212f86fSmrg
7627f6d8fe2Smrgif test "x$use_xmlto" = x"auto"; then
7637f6d8fe2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7647f6d8fe2Smrg   if test "x$XMLTO" = "x"; then
7657f6d8fe2Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7667f6d8fe2Smrg	have_xmlto=no
7677f6d8fe2Smrg   else
7687f6d8fe2Smrg        have_xmlto=yes
7697f6d8fe2Smrg   fi
7707f6d8fe2Smrgelif test "x$use_xmlto" = x"yes" ; then
7717f6d8fe2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7727f6d8fe2Smrg   if test "x$XMLTO" = "x"; then
7737f6d8fe2Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7747f6d8fe2Smrg   fi
7757f6d8fe2Smrg   have_xmlto=yes
7767f6d8fe2Smrgelif test "x$use_xmlto" = x"no" ; then
7777f6d8fe2Smrg   if test "x$XMLTO" != "x"; then
7787f6d8fe2Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7797f6d8fe2Smrg   fi
7807f6d8fe2Smrg   have_xmlto=no
7817d5e3a19Smrgelse
7827f6d8fe2Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7835212f86fSmrgfi
7847d5e3a19Smrg
7857f6d8fe2Smrg# Test for a minimum version of xmlto, if provided.
7867f6d8fe2Smrgm4_ifval([$1],
7877f6d8fe2Smrg[if test "$have_xmlto" = yes; then
7887f6d8fe2Smrg    # scrape the xmlto version
7897f6d8fe2Smrg    AC_MSG_CHECKING([the xmlto version])
7907f6d8fe2Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7917f6d8fe2Smrg    AC_MSG_RESULT([$xmlto_version])
7927f6d8fe2Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7937f6d8fe2Smrg        [if test "x$use_xmlto" = xauto; then
7947f6d8fe2Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7957f6d8fe2Smrg            have_xmlto=no
7967f6d8fe2Smrg        else
7977f6d8fe2Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7987f6d8fe2Smrg        fi])
7995212f86fSmrgfi])
8007d5e3a19Smrg
8017f6d8fe2Smrg# Test for the ability of xmlto to generate a text target
80213e6bc1cSmrg#
8037f6d8fe2Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
8047f6d8fe2Smrg# following test for empty XML docbook files.
8057f6d8fe2Smrg# For compatibility reasons use the following empty XML docbook file and if
8067f6d8fe2Smrg# it fails try it again with a non-empty XML file.
8077f6d8fe2Smrghave_xmlto_text=no
8087f6d8fe2Smrgcat > conftest.xml << "EOF"
8097f6d8fe2SmrgEOF
8107f6d8fe2SmrgAS_IF([test "$have_xmlto" = yes],
8117f6d8fe2Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8127f6d8fe2Smrg             [have_xmlto_text=yes],
8137f6d8fe2Smrg             [# Try it again with a non-empty XML file.
8147f6d8fe2Smrg              cat > conftest.xml << "EOF"
8157f6d8fe2Smrg<x></x>
8167f6d8fe2SmrgEOF
8177f6d8fe2Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8187f6d8fe2Smrg                    [have_xmlto_text=yes],
8197f6d8fe2Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8207f6d8fe2Smrgrm -f conftest.xml
8217f6d8fe2SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8227f6d8fe2SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8237f6d8fe2Smrg]) # XORG_WITH_XMLTO
8247d5e3a19Smrg
8257f6d8fe2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8267f6d8fe2Smrg# --------------------------------------------
8277f6d8fe2Smrg# Minimum version: 1.12.0
8287f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
82913e6bc1cSmrg#
8307f6d8fe2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8317f6d8fe2Smrg# XML-based language used for the transformation of XML documents.
8327f6d8fe2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8337f6d8fe2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8347f6d8fe2Smrg# The XSLT processor is often used as a standalone tool for transformations.
8357f6d8fe2Smrg# It should not be assumed that this tool is used only to work with documnetation.
8367f6d8fe2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8377f6d8fe2Smrg#
8387f6d8fe2Smrg# Interface to module:
8397f6d8fe2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8407f6d8fe2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
8417f6d8fe2Smrg#		 returns the path set by the user in the environment
8427f6d8fe2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8437f6d8fe2Smrg#		  'no' user instructs the module not to use xsltproc
8447f6d8fe2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8457f6d8fe2Smrg#
8467f6d8fe2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8477f6d8fe2Smrg#
8487f6d8fe2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8497f6d8fe2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8507f6d8fe2Smrg# Preserves the interface, should it be implemented later
8517f6d8fe2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8527f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
8537f6d8fe2SmrgAC_ARG_WITH(xsltproc,
8547f6d8fe2Smrg	AS_HELP_STRING([--with-xsltproc],
8557f6d8fe2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8567f6d8fe2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8577f6d8fe2Smrgm4_undefine([_defopt])
85813e6bc1cSmrg
8597f6d8fe2Smrgif test "x$use_xsltproc" = x"auto"; then
8607f6d8fe2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8617f6d8fe2Smrg   if test "x$XSLTPROC" = "x"; then
8627f6d8fe2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8637f6d8fe2Smrg	have_xsltproc=no
8647f6d8fe2Smrg   else
8657f6d8fe2Smrg        have_xsltproc=yes
8667f6d8fe2Smrg   fi
8677f6d8fe2Smrgelif test "x$use_xsltproc" = x"yes" ; then
8687f6d8fe2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8697f6d8fe2Smrg   if test "x$XSLTPROC" = "x"; then
8707f6d8fe2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8717f6d8fe2Smrg   fi
8727f6d8fe2Smrg   have_xsltproc=yes
8737f6d8fe2Smrgelif test "x$use_xsltproc" = x"no" ; then
8747f6d8fe2Smrg   if test "x$XSLTPROC" != "x"; then
8757f6d8fe2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8767f6d8fe2Smrg   fi
8777f6d8fe2Smrg   have_xsltproc=no
8787f6d8fe2Smrgelse
8797f6d8fe2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8807f6d8fe2Smrgfi
8817d5e3a19Smrg
8827f6d8fe2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8837f6d8fe2Smrg]) # XORG_WITH_XSLTPROC
884765486e8Smrg
8857f6d8fe2Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8867f6d8fe2Smrg# ----------------------------------------
8877f6d8fe2Smrg# Minimum version: 1.15.0
88813e6bc1cSmrg#
8897f6d8fe2Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8907f6d8fe2Smrg# scanning arbitrary text files, extracting information from those text files,
8917f6d8fe2Smrg# and printing reports based on that information.
89213e6bc1cSmrg#
8937f6d8fe2Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
89413e6bc1cSmrg#
8957f6d8fe2Smrg# Interface to module:
8967f6d8fe2Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8977f6d8fe2Smrg# PERL:	     returns the path of the perl program found
8987f6d8fe2Smrg#	     returns the path set by the user in the environment
8997f6d8fe2Smrg# --with-perl: 'yes' user instructs the module to use perl
9007f6d8fe2Smrg#	       'no' user instructs the module not to use perl
9017f6d8fe2Smrg# have_perl: returns yes if perl found in PATH or no
90213e6bc1cSmrg#
9037f6d8fe2Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9047f6d8fe2Smrg#
9057f6d8fe2SmrgAC_DEFUN([XORG_WITH_PERL],[
9067f6d8fe2SmrgAC_ARG_VAR([PERL], [Path to perl command])
9077f6d8fe2Smrg# Preserves the interface, should it be implemented later
9087f6d8fe2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9097f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
9107f6d8fe2SmrgAC_ARG_WITH(perl,
9117f6d8fe2Smrg	AS_HELP_STRING([--with-perl],
9127f6d8fe2Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9137f6d8fe2Smrg	   [use_perl=$withval], [use_perl=]_defopt)
9147f6d8fe2Smrgm4_undefine([_defopt])
915bda5b58fSmrg
9167f6d8fe2Smrgif test "x$use_perl" = x"auto"; then
9177f6d8fe2Smrg   AC_PATH_PROG([PERL], [perl])
9187f6d8fe2Smrg   if test "x$PERL" = "x"; then
9197f6d8fe2Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9207f6d8fe2Smrg	have_perl=no
9217f6d8fe2Smrg   else
9227f6d8fe2Smrg        have_perl=yes
9237f6d8fe2Smrg   fi
9247f6d8fe2Smrgelif test "x$use_perl" = x"yes" ; then
9257f6d8fe2Smrg   AC_PATH_PROG([PERL], [perl])
9267f6d8fe2Smrg   if test "x$PERL" = "x"; then
9277f6d8fe2Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9287f6d8fe2Smrg   fi
9297f6d8fe2Smrg   have_perl=yes
9307f6d8fe2Smrgelif test "x$use_perl" = x"no" ; then
9317f6d8fe2Smrg   if test "x$PERL" != "x"; then
9327f6d8fe2Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9337f6d8fe2Smrg   fi
9347f6d8fe2Smrg   have_perl=no
9357f6d8fe2Smrgelse
9367f6d8fe2Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9377f6d8fe2Smrgfi
938bda5b58fSmrg
9397f6d8fe2SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9407f6d8fe2Smrg]) # XORG_WITH_PERL
941bda5b58fSmrg
9427f6d8fe2Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9437f6d8fe2Smrg# ----------------
9447f6d8fe2Smrg# Minimum version: 1.5.0
9457f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9467f6d8fe2Smrg#
9477f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
9487f6d8fe2Smrg# not at the appropriate level. This macro enables a module to test for the
9497f6d8fe2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9507f6d8fe2Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9517f6d8fe2Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9527f6d8fe2Smrg# --with-asciidoc assumes 'auto'.
9537f6d8fe2Smrg#
9547f6d8fe2Smrg# Interface to module:
9557f6d8fe2Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9567f6d8fe2Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
9577f6d8fe2Smrg#		 returns the path set by the user in the environment
9587f6d8fe2Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9597f6d8fe2Smrg#		  'no' user instructs the module not to use asciidoc
9607f6d8fe2Smrg#
9617f6d8fe2Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9627f6d8fe2Smrg#
9637f6d8fe2SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9647f6d8fe2SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9657f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
9667f6d8fe2SmrgAC_ARG_WITH(asciidoc,
9677f6d8fe2Smrg	AS_HELP_STRING([--with-asciidoc],
9687f6d8fe2Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9697f6d8fe2Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9707f6d8fe2Smrgm4_undefine([_defopt])
971bda5b58fSmrg
9727f6d8fe2Smrgif test "x$use_asciidoc" = x"auto"; then
9737f6d8fe2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9747f6d8fe2Smrg   if test "x$ASCIIDOC" = "x"; then
9757f6d8fe2Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9767f6d8fe2Smrg	have_asciidoc=no
9777f6d8fe2Smrg   else
9787f6d8fe2Smrg        have_asciidoc=yes
9797f6d8fe2Smrg   fi
9807f6d8fe2Smrgelif test "x$use_asciidoc" = x"yes" ; then
9817f6d8fe2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9827f6d8fe2Smrg   if test "x$ASCIIDOC" = "x"; then
9837f6d8fe2Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9847f6d8fe2Smrg   fi
9857f6d8fe2Smrg   have_asciidoc=yes
9867f6d8fe2Smrgelif test "x$use_asciidoc" = x"no" ; then
9877f6d8fe2Smrg   if test "x$ASCIIDOC" != "x"; then
9887f6d8fe2Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9897f6d8fe2Smrg   fi
9907f6d8fe2Smrg   have_asciidoc=no
9917f6d8fe2Smrgelse
9927f6d8fe2Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9937f6d8fe2Smrgfi
9947f6d8fe2Smrgm4_ifval([$1],
9957f6d8fe2Smrg[if test "$have_asciidoc" = yes; then
9967f6d8fe2Smrg    # scrape the asciidoc version
9977f6d8fe2Smrg    AC_MSG_CHECKING([the asciidoc version])
9987f6d8fe2Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9997f6d8fe2Smrg    AC_MSG_RESULT([$asciidoc_version])
10007f6d8fe2Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10017f6d8fe2Smrg        [if test "x$use_asciidoc" = xauto; then
10027f6d8fe2Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10037f6d8fe2Smrg            have_asciidoc=no
10047f6d8fe2Smrg        else
10057f6d8fe2Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10067f6d8fe2Smrg        fi])
10077f6d8fe2Smrgfi])
10087f6d8fe2SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10097f6d8fe2Smrg]) # XORG_WITH_ASCIIDOC
1010bda5b58fSmrg
10117f6d8fe2Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
10127f6d8fe2Smrg# -------------------------------------------
10137f6d8fe2Smrg# Minimum version: 1.5.0
10147f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10157f6d8fe2Smrg# Minimum version for optional DOT checking: 1.18.0
10167f6d8fe2Smrg#
10177f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
10187f6d8fe2Smrg# not at the appropriate level. This macro enables a module to test for the
10197f6d8fe2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10207f6d8fe2Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
10217f6d8fe2Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10227f6d8fe2Smrg# --with-doxygen assumes 'auto'.
10237f6d8fe2Smrg#
10247f6d8fe2Smrg# Interface to module:
10257f6d8fe2Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10267f6d8fe2Smrg# DOXYGEN:	 returns the path of the doxygen program found
10277f6d8fe2Smrg#		 returns the path set by the user in the environment
10287f6d8fe2Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10297f6d8fe2Smrg#		  'no' user instructs the module not to use doxygen
10307f6d8fe2Smrg#
10317f6d8fe2Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10327f6d8fe2Smrg#
10337f6d8fe2SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10347f6d8fe2SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10357f6d8fe2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10367f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
10377f6d8fe2SmrgAC_ARG_WITH(doxygen,
10387f6d8fe2Smrg	AS_HELP_STRING([--with-doxygen],
10397f6d8fe2Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10407f6d8fe2Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10417f6d8fe2Smrgm4_undefine([_defopt])
1042bda5b58fSmrg
10437f6d8fe2Smrgif test "x$use_doxygen" = x"auto"; then
10447f6d8fe2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10457f6d8fe2Smrg   if test "x$DOXYGEN" = "x"; then
10467f6d8fe2Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10477f6d8fe2Smrg	have_doxygen=no
10487f6d8fe2Smrg   else
10497f6d8fe2Smrg        have_doxygen=yes
10507f6d8fe2Smrg   fi
10517f6d8fe2Smrgelif test "x$use_doxygen" = x"yes" ; then
10527f6d8fe2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10537f6d8fe2Smrg   if test "x$DOXYGEN" = "x"; then
10547f6d8fe2Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10557f6d8fe2Smrg   fi
10567f6d8fe2Smrg   have_doxygen=yes
10577f6d8fe2Smrgelif test "x$use_doxygen" = x"no" ; then
10587f6d8fe2Smrg   if test "x$DOXYGEN" != "x"; then
10597f6d8fe2Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10607f6d8fe2Smrg   fi
10617f6d8fe2Smrg   have_doxygen=no
10627f6d8fe2Smrgelse
10637f6d8fe2Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10647f6d8fe2Smrgfi
10657f6d8fe2Smrgm4_ifval([$1],
10667f6d8fe2Smrg[if test "$have_doxygen" = yes; then
10677f6d8fe2Smrg    # scrape the doxygen version
10687f6d8fe2Smrg    AC_MSG_CHECKING([the doxygen version])
10697f6d8fe2Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10707f6d8fe2Smrg    AC_MSG_RESULT([$doxygen_version])
10717f6d8fe2Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10727f6d8fe2Smrg        [if test "x$use_doxygen" = xauto; then
10737f6d8fe2Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10747f6d8fe2Smrg            have_doxygen=no
10757f6d8fe2Smrg        else
10767f6d8fe2Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10777f6d8fe2Smrg        fi])
10787f6d8fe2Smrgfi])
1079bda5b58fSmrg
10807f6d8fe2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10817f6d8fe2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10827f6d8fe2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10837f6d8fe2SmrgHAVE_DOT=no
10847f6d8fe2Smrgif test "x$have_doxygen" = "xyes"; then
10857f6d8fe2Smrg  AC_PATH_PROG([DOT], [dot])
10867f6d8fe2Smrg    if test "x$DOT" != "x"; then
10877f6d8fe2Smrg      HAVE_DOT=yes
10885212f86fSmrg    fi
10897d5e3a19Smrgfi
10907d5e3a19Smrg
10917f6d8fe2SmrgAC_SUBST([HAVE_DOT])
10927f6d8fe2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10937f6d8fe2SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10947f6d8fe2Smrg]) # XORG_WITH_DOXYGEN
10955212f86fSmrg
10967f6d8fe2Smrg# XORG_WITH_GROFF([DEFAULT])
10977f6d8fe2Smrg# ----------------
10987f6d8fe2Smrg# Minimum version: 1.6.0
10997f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11007f6d8fe2Smrg#
11017f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
11027f6d8fe2Smrg# not at the appropriate level. This macro enables a module to test for the
11037f6d8fe2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11047f6d8fe2Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
11057f6d8fe2Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
11067f6d8fe2Smrg# --with-groff assumes 'auto'.
11077f6d8fe2Smrg#
11087f6d8fe2Smrg# Interface to module:
11097f6d8fe2Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11107f6d8fe2Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11117f6d8fe2Smrg# HAVE_GROFF_MS: the -ms macros package
11127f6d8fe2Smrg# GROFF:	 returns the path of the groff program found
11137f6d8fe2Smrg#		 returns the path set by the user in the environment
11147f6d8fe2Smrg# --with-groff:	 'yes' user instructs the module to use groff
11157f6d8fe2Smrg#		 'no' user instructs the module not to use groff
11167f6d8fe2Smrg#
11177f6d8fe2Smrg# Added in version 1.9.0:
11187f6d8fe2Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11197f6d8fe2Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11207f6d8fe2Smrg#		   psselect from the psutils package.
11217f6d8fe2Smrg#		   the ghostcript package. Refer to the grohtml man pages
11227f6d8fe2Smrg#
11237f6d8fe2Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11247f6d8fe2Smrg#
11257f6d8fe2Smrg# OS and distros often splits groff in a basic and full package, the former
11267f6d8fe2Smrg# having the groff program and the later having devices, fonts and macros
11277f6d8fe2Smrg# Checking for the groff executable is not enough.
11287f6d8fe2Smrg#
11297f6d8fe2Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
11307f6d8fe2Smrg# unset HAVE_GROFF or GROFF env variables.
11317f6d8fe2Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11327f6d8fe2Smrg#
11337f6d8fe2SmrgAC_DEFUN([XORG_WITH_GROFF],[
11347f6d8fe2SmrgAC_ARG_VAR([GROFF], [Path to groff command])
11357f6d8fe2Smrgm4_define([_defopt], m4_default([$1], [auto]))
11367f6d8fe2SmrgAC_ARG_WITH(groff,
11377f6d8fe2Smrg	AS_HELP_STRING([--with-groff],
11387f6d8fe2Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11397f6d8fe2Smrg	   [use_groff=$withval], [use_groff=]_defopt)
11407f6d8fe2Smrgm4_undefine([_defopt])
11415212f86fSmrg
11427f6d8fe2Smrgif test "x$use_groff" = x"auto"; then
11437f6d8fe2Smrg   AC_PATH_PROG([GROFF], [groff])
11447f6d8fe2Smrg   if test "x$GROFF" = "x"; then
11457f6d8fe2Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11467f6d8fe2Smrg	have_groff=no
11477f6d8fe2Smrg   else
11487f6d8fe2Smrg        have_groff=yes
11497f6d8fe2Smrg   fi
11507f6d8fe2Smrgelif test "x$use_groff" = x"yes" ; then
11517f6d8fe2Smrg   AC_PATH_PROG([GROFF], [groff])
11527f6d8fe2Smrg   if test "x$GROFF" = "x"; then
11537f6d8fe2Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11547f6d8fe2Smrg   fi
11557f6d8fe2Smrg   have_groff=yes
11567f6d8fe2Smrgelif test "x$use_groff" = x"no" ; then
11577f6d8fe2Smrg   if test "x$GROFF" != "x"; then
11587f6d8fe2Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11597f6d8fe2Smrg   fi
11607f6d8fe2Smrg   have_groff=no
11617d5e3a19Smrgelse
11627f6d8fe2Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11637f6d8fe2Smrgfi
11647d5e3a19Smrg
11657f6d8fe2Smrg# We have groff, test for the presence of the macro packages
11667f6d8fe2Smrgif test "x$have_groff" = x"yes"; then
11677f6d8fe2Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11687f6d8fe2Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11697f6d8fe2Smrg        groff_ms_works=yes
11707f6d8fe2Smrg    else
11717f6d8fe2Smrg        groff_ms_works=no
11727f6d8fe2Smrg    fi
11737f6d8fe2Smrg    AC_MSG_RESULT([$groff_ms_works])
11747f6d8fe2Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11757f6d8fe2Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11767f6d8fe2Smrg        groff_mm_works=yes
11777f6d8fe2Smrg    else
11787f6d8fe2Smrg        groff_mm_works=no
11797f6d8fe2Smrg    fi
11807f6d8fe2Smrg    AC_MSG_RESULT([$groff_mm_works])
11817f6d8fe2Smrgfi
11827d5e3a19Smrg
11837f6d8fe2Smrg# We have groff, test for HTML dependencies, one command per package
11847f6d8fe2Smrgif test "x$have_groff" = x"yes"; then
11857f6d8fe2Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11867f6d8fe2Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11877f6d8fe2Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11887f6d8fe2Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11897f6d8fe2Smrg      have_groff_html=yes
11907f6d8fe2Smrg   else
11917f6d8fe2Smrg      have_groff_html=no
11927f6d8fe2Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11937f6d8fe2Smrg   fi
11947f6d8fe2Smrgfi
11957d5e3a19Smrg
11967f6d8fe2Smrg# Set Automake conditionals for Makefiles
11977f6d8fe2SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11987f6d8fe2SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11997f6d8fe2SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12007f6d8fe2SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12017f6d8fe2Smrg]) # XORG_WITH_GROFF
12027d5e3a19Smrg
12037f6d8fe2Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12047f6d8fe2Smrg# ---------------------------------------
12057f6d8fe2Smrg# Minimum version: 1.6.0
12067f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12077f6d8fe2Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12087f6d8fe2Smrg#
12097f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
12107f6d8fe2Smrg# not at the appropriate level. This macro enables a module to test for the
12117f6d8fe2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12127f6d8fe2Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
12137f6d8fe2Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
12147f6d8fe2Smrg# --with-fop assumes 'auto'.
12157f6d8fe2Smrg#
12167f6d8fe2Smrg# Interface to module:
12177f6d8fe2Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12187f6d8fe2Smrg# FOP:	 	returns the path of the fop program found
12197f6d8fe2Smrg#		returns the path set by the user in the environment
12207f6d8fe2Smrg# --with-fop: 	'yes' user instructs the module to use fop
12217f6d8fe2Smrg#		'no' user instructs the module not to use fop
12227f6d8fe2Smrg#
12237f6d8fe2Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12247f6d8fe2Smrg#
12257f6d8fe2SmrgAC_DEFUN([XORG_WITH_FOP],[
12267f6d8fe2SmrgAC_ARG_VAR([FOP], [Path to fop command])
12277f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
12287f6d8fe2SmrgAC_ARG_WITH(fop,
12297f6d8fe2Smrg	AS_HELP_STRING([--with-fop],
12307f6d8fe2Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12317f6d8fe2Smrg	   [use_fop=$withval], [use_fop=]_defopt)
12327f6d8fe2Smrgm4_undefine([_defopt])
12337d5e3a19Smrg
12347f6d8fe2Smrgif test "x$use_fop" = x"auto"; then
12357f6d8fe2Smrg   AC_PATH_PROG([FOP], [fop])
12367f6d8fe2Smrg   if test "x$FOP" = "x"; then
12377f6d8fe2Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12387f6d8fe2Smrg	have_fop=no
12397f6d8fe2Smrg   else
12407f6d8fe2Smrg        have_fop=yes
12417f6d8fe2Smrg   fi
12427f6d8fe2Smrgelif test "x$use_fop" = x"yes" ; then
12437f6d8fe2Smrg   AC_PATH_PROG([FOP], [fop])
12447f6d8fe2Smrg   if test "x$FOP" = "x"; then
12457f6d8fe2Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12467f6d8fe2Smrg   fi
12477f6d8fe2Smrg   have_fop=yes
12487f6d8fe2Smrgelif test "x$use_fop" = x"no" ; then
12497f6d8fe2Smrg   if test "x$FOP" != "x"; then
12507f6d8fe2Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12517f6d8fe2Smrg   fi
12527f6d8fe2Smrg   have_fop=no
12537f6d8fe2Smrgelse
12547f6d8fe2Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12557f6d8fe2Smrgfi
12567d5e3a19Smrg
12577f6d8fe2Smrg# Test for a minimum version of fop, if provided.
12587f6d8fe2Smrgm4_ifval([$1],
12597f6d8fe2Smrg[if test "$have_fop" = yes; then
12607f6d8fe2Smrg    # scrape the fop version
12617f6d8fe2Smrg    AC_MSG_CHECKING([for fop minimum version])
12627f6d8fe2Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12637f6d8fe2Smrg    AC_MSG_RESULT([$fop_version])
12647f6d8fe2Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
12657f6d8fe2Smrg        [if test "x$use_fop" = xauto; then
12667f6d8fe2Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12677f6d8fe2Smrg            have_fop=no
12687f6d8fe2Smrg        else
12697f6d8fe2Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12707f6d8fe2Smrg        fi])
12717f6d8fe2Smrgfi])
12727f6d8fe2SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12737f6d8fe2Smrg]) # XORG_WITH_FOP
12745212f86fSmrg
12757f6d8fe2Smrg# XORG_WITH_M4([MIN-VERSION])
12767f6d8fe2Smrg# ---------------------------
12777f6d8fe2Smrg# Minimum version: 1.19.0
12787f6d8fe2Smrg#
12797f6d8fe2Smrg# This macro attempts to locate an m4 macro processor which supports
12807f6d8fe2Smrg# -I option and is only useful for modules relying on M4 in order to
12817f6d8fe2Smrg# expand macros in source code files.
12827f6d8fe2Smrg#
12837f6d8fe2Smrg# Interface to module:
12847f6d8fe2Smrg# M4:	 	returns the path of the m4 program found
12857f6d8fe2Smrg#		returns the path set by the user in the environment
12867f6d8fe2Smrg#
12877f6d8fe2SmrgAC_DEFUN([XORG_WITH_M4], [
12887f6d8fe2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12897f6d8fe2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12907f6d8fe2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12917f6d8fe2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12927f6d8fe2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12937f6d8fe2Smrg   [$PATH:/usr/gnu/bin])])
12945212f86fSmrg
12957f6d8fe2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12967f6d8fe2Smrg]) # XORG_WITH_M4
12975212f86fSmrg
12987f6d8fe2Smrg# XORG_WITH_PS2PDF([DEFAULT])
12997f6d8fe2Smrg# ----------------
13007f6d8fe2Smrg# Minimum version: 1.6.0
13017f6d8fe2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13027f6d8fe2Smrg#
13037f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
13047f6d8fe2Smrg# not at the appropriate level. This macro enables a module to test for the
13057f6d8fe2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
13067f6d8fe2Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
13077f6d8fe2Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13087f6d8fe2Smrg# --with-ps2pdf assumes 'auto'.
13097f6d8fe2Smrg#
13107f6d8fe2Smrg# Interface to module:
13117f6d8fe2Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13127f6d8fe2Smrg# PS2PDF:	returns the path of the ps2pdf program found
13137f6d8fe2Smrg#		returns the path set by the user in the environment
13147f6d8fe2Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13157f6d8fe2Smrg#		 'no' user instructs the module not to use ps2pdf
13167f6d8fe2Smrg#
13177f6d8fe2Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13187f6d8fe2Smrg#
13197f6d8fe2SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13207f6d8fe2SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13217f6d8fe2Smrgm4_define([_defopt], m4_default([$1], [auto]))
13227f6d8fe2SmrgAC_ARG_WITH(ps2pdf,
13237f6d8fe2Smrg	AS_HELP_STRING([--with-ps2pdf],
13247f6d8fe2Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13257f6d8fe2Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13267f6d8fe2Smrgm4_undefine([_defopt])
13275212f86fSmrg
13287f6d8fe2Smrgif test "x$use_ps2pdf" = x"auto"; then
13297f6d8fe2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13307f6d8fe2Smrg   if test "x$PS2PDF" = "x"; then
13317f6d8fe2Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13327f6d8fe2Smrg	have_ps2pdf=no
13337f6d8fe2Smrg   else
13347f6d8fe2Smrg        have_ps2pdf=yes
13357f6d8fe2Smrg   fi
13367f6d8fe2Smrgelif test "x$use_ps2pdf" = x"yes" ; then
13377f6d8fe2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13387f6d8fe2Smrg   if test "x$PS2PDF" = "x"; then
13397f6d8fe2Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13407f6d8fe2Smrg   fi
13417f6d8fe2Smrg   have_ps2pdf=yes
13427f6d8fe2Smrgelif test "x$use_ps2pdf" = x"no" ; then
13437f6d8fe2Smrg   if test "x$PS2PDF" != "x"; then
13447f6d8fe2Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13457f6d8fe2Smrg   fi
13467f6d8fe2Smrg   have_ps2pdf=no
1347765486e8Smrgelse
13487f6d8fe2Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13497f6d8fe2Smrgfi
13507f6d8fe2SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13517f6d8fe2Smrg]) # XORG_WITH_PS2PDF
1352765486e8Smrg
13537f6d8fe2Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
13547f6d8fe2Smrg# ----------------
13557f6d8fe2Smrg# Minimum version: 1.6.0
13567f6d8fe2Smrg#
13577f6d8fe2Smrg# Documentation tools are not always available on all platforms and sometimes
13587f6d8fe2Smrg# not at the appropriate level. This macro enables a builder to skip all
13597f6d8fe2Smrg# documentation targets except traditional man pages.
13607f6d8fe2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13617f6d8fe2Smrg# maximum flexibilty in controlling documentation building.
13627f6d8fe2Smrg# Refer to:
13637f6d8fe2Smrg# XORG_WITH_XMLTO         --with-xmlto
13647f6d8fe2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13657f6d8fe2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13667f6d8fe2Smrg# XORG_WITH_FOP           --with-fop
13677f6d8fe2Smrg# XORG_WITH_GROFF         --with-groff
13687f6d8fe2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13697f6d8fe2Smrg#
13707f6d8fe2Smrg# Interface to module:
13717f6d8fe2Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13727f6d8fe2Smrg# --enable-docs: 'yes' user instructs the module to generate docs
13737f6d8fe2Smrg#		 'no' user instructs the module not to generate docs
13747f6d8fe2Smrg# parm1:	specify the default value, yes or no.
13757f6d8fe2Smrg#
13767f6d8fe2SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13777f6d8fe2Smrgm4_define([docs_default], m4_default([$1], [yes]))
13787f6d8fe2SmrgAC_ARG_ENABLE(docs,
13797f6d8fe2Smrg	AS_HELP_STRING([--enable-docs],
13807f6d8fe2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13817f6d8fe2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13827f6d8fe2Smrgm4_undefine([docs_default])
13837f6d8fe2SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13847f6d8fe2SmrgAC_MSG_CHECKING([whether to build documentation])
13857f6d8fe2SmrgAC_MSG_RESULT([$build_docs])
13867f6d8fe2Smrg]) # XORG_ENABLE_DOCS
1387765486e8Smrg
13887f6d8fe2Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13897f6d8fe2Smrg# ----------------
13907f6d8fe2Smrg# Minimum version: 1.6.0
13917f6d8fe2Smrg#
13927f6d8fe2Smrg# This macro enables a builder to skip all developer documentation.
13937f6d8fe2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13947f6d8fe2Smrg# maximum flexibilty in controlling documentation building.
13957f6d8fe2Smrg# Refer to:
13967f6d8fe2Smrg# XORG_WITH_XMLTO         --with-xmlto
13977f6d8fe2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13987f6d8fe2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13997f6d8fe2Smrg# XORG_WITH_FOP           --with-fop
14007f6d8fe2Smrg# XORG_WITH_GROFF         --with-groff
14017f6d8fe2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14027f6d8fe2Smrg#
14037f6d8fe2Smrg# Interface to module:
14047f6d8fe2Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14057f6d8fe2Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14067f6d8fe2Smrg#			'no' user instructs the module not to generate developer docs
14077f6d8fe2Smrg# parm1:		specify the default value, yes or no.
14087f6d8fe2Smrg#
14097f6d8fe2SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14107f6d8fe2Smrgm4_define([devel_default], m4_default([$1], [yes]))
14117f6d8fe2SmrgAC_ARG_ENABLE(devel-docs,
14127f6d8fe2Smrg	AS_HELP_STRING([--enable-devel-docs],
14137f6d8fe2Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14147f6d8fe2Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14157f6d8fe2Smrgm4_undefine([devel_default])
14167f6d8fe2SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14177f6d8fe2SmrgAC_MSG_CHECKING([whether to build developer documentation])
14187f6d8fe2SmrgAC_MSG_RESULT([$build_devel_docs])
14197f6d8fe2Smrg]) # XORG_ENABLE_DEVEL_DOCS
14207d5e3a19Smrg
14217f6d8fe2Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
14227f6d8fe2Smrg# ----------------
14237f6d8fe2Smrg# Minimum version: 1.6.0
14247f6d8fe2Smrg#
14257f6d8fe2Smrg# This macro enables a builder to skip all functional specification targets.
14267f6d8fe2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14277f6d8fe2Smrg# maximum flexibilty in controlling documentation building.
14287f6d8fe2Smrg# Refer to:
14297f6d8fe2Smrg# XORG_WITH_XMLTO         --with-xmlto
14307f6d8fe2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14317f6d8fe2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
14327f6d8fe2Smrg# XORG_WITH_FOP           --with-fop
14337f6d8fe2Smrg# XORG_WITH_GROFF         --with-groff
14347f6d8fe2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14357f6d8fe2Smrg#
14367f6d8fe2Smrg# Interface to module:
14377f6d8fe2Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14387f6d8fe2Smrg# --enable-specs:	'yes' user instructs the module to generate specs
14397f6d8fe2Smrg#			'no' user instructs the module not to generate specs
14407f6d8fe2Smrg# parm1:		specify the default value, yes or no.
14417f6d8fe2Smrg#
14427f6d8fe2SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14437f6d8fe2Smrgm4_define([spec_default], m4_default([$1], [yes]))
14447f6d8fe2SmrgAC_ARG_ENABLE(specs,
14457f6d8fe2Smrg	AS_HELP_STRING([--enable-specs],
14467f6d8fe2Smrg	   [Enable building the specs (default: ]spec_default[)]),
14477f6d8fe2Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
14487f6d8fe2Smrgm4_undefine([spec_default])
14497f6d8fe2SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14507f6d8fe2SmrgAC_MSG_CHECKING([whether to build functional specifications])
14517f6d8fe2SmrgAC_MSG_RESULT([$build_specs])
14527f6d8fe2Smrg]) # XORG_ENABLE_SPECS
14537d5e3a19Smrg
14547f6d8fe2Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14557f6d8fe2Smrg# ----------------------------------------------
14567f6d8fe2Smrg# Minimum version: 1.13.0
14577f6d8fe2Smrg#
14587f6d8fe2Smrg# This macro enables a builder to enable/disable unit testing
14597f6d8fe2Smrg# It makes no assumption about the test cases implementation
14607f6d8fe2Smrg# Test cases may or may not use Automake "Support for test suites"
14617f6d8fe2Smrg# They may or may not use the software utility library GLib
14627f6d8fe2Smrg#
14637f6d8fe2Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14647f6d8fe2Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14657f6d8fe2Smrg# The variable enable_unit_tests is used by other macros in this file.
14667f6d8fe2Smrg#
14677f6d8fe2Smrg# Interface to module:
14687f6d8fe2Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14697f6d8fe2Smrg# enable_unit_tests:    used in configure.ac for additional configuration
14707f6d8fe2Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14717f6d8fe2Smrg#			'no' user instructs the module not to build tests
14727f6d8fe2Smrg# parm1:		specify the default value, yes or no.
14737f6d8fe2Smrg#
14747f6d8fe2SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14757f6d8fe2SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14767f6d8fe2SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14777f6d8fe2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14787f6d8fe2Smrgm4_define([_defopt], m4_default([$1], [auto]))
14797f6d8fe2SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14807f6d8fe2Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14817f6d8fe2Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14827f6d8fe2Smrgm4_undefine([_defopt])
14837f6d8fe2SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14847f6d8fe2SmrgAC_MSG_CHECKING([whether to build unit test cases])
14857f6d8fe2SmrgAC_MSG_RESULT([$enable_unit_tests])
14867f6d8fe2Smrg]) # XORG_ENABLE_UNIT_TESTS
14877f6d8fe2Smrg
14887f6d8fe2Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14897f6d8fe2Smrg# ------------------------------------------------------
14907f6d8fe2Smrg# Minimum version: 1.17.0
14917f6d8fe2Smrg#
14927f6d8fe2Smrg# This macro enables a builder to enable/disable integration testing
14937f6d8fe2Smrg# It makes no assumption about the test cases' implementation
14947f6d8fe2Smrg# Test cases may or may not use Automake "Support for test suites"
14957f6d8fe2Smrg#
14967f6d8fe2Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14977f6d8fe2Smrg# usually requires less dependencies and may be built and run under less
14987f6d8fe2Smrg# stringent environments than integration tests.
14997f6d8fe2Smrg#
15007f6d8fe2Smrg# Interface to module:
15017f6d8fe2Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15027f6d8fe2Smrg# enable_integration_tests:   used in configure.ac for additional configuration
15037f6d8fe2Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15047f6d8fe2Smrg#                             'no' user instructs the module not to build tests
15057f6d8fe2Smrg# parm1:                      specify the default value, yes or no.
15067f6d8fe2Smrg#
15077f6d8fe2SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15087f6d8fe2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15097f6d8fe2Smrgm4_define([_defopt], m4_default([$1], [auto]))
15107f6d8fe2SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15117f6d8fe2Smrg	[Enable building integration test cases (default: ]_defopt[)]),
15127f6d8fe2Smrg	[enable_integration_tests=$enableval],
15137f6d8fe2Smrg	[enable_integration_tests=]_defopt)
15147f6d8fe2Smrgm4_undefine([_defopt])
15157f6d8fe2SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15167f6d8fe2Smrg	[test "x$enable_integration_tests" != xno])
15177f6d8fe2SmrgAC_MSG_CHECKING([whether to build unit test cases])
15187f6d8fe2SmrgAC_MSG_RESULT([$enable_integration_tests])
15197f6d8fe2Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
15205212f86fSmrg
15217f6d8fe2Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15227f6d8fe2Smrg# ----------------------------------------
15237f6d8fe2Smrg# Minimum version: 1.13.0
15247f6d8fe2Smrg#
15257f6d8fe2Smrg# GLib is a library which provides advanced data structures and functions.
15267f6d8fe2Smrg# This macro enables a module to test for the presence of Glib.
15277f6d8fe2Smrg#
15287f6d8fe2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15297f6d8fe2Smrg# Otherwise the value of $enable_unit_tests is blank.
15307f6d8fe2Smrg#
15317f6d8fe2Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15327f6d8fe2Smrg# test support usually requires less dependencies and may be built and run under
15337f6d8fe2Smrg# less stringent environments than integration tests.
15347f6d8fe2Smrg#
15357f6d8fe2Smrg# Interface to module:
15367f6d8fe2Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
15377f6d8fe2Smrg# with_glib: used in configure.ac to know if GLib has been found
15387f6d8fe2Smrg# --with-glib:	'yes' user instructs the module to use glib
15397f6d8fe2Smrg#		'no' user instructs the module not to use glib
15407f6d8fe2Smrg#
15417f6d8fe2SmrgAC_DEFUN([XORG_WITH_GLIB],[
15427f6d8fe2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15437f6d8fe2Smrgm4_define([_defopt], m4_default([$2], [auto]))
15447f6d8fe2SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15457f6d8fe2Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15467f6d8fe2Smrg	[with_glib=$withval], [with_glib=]_defopt)
15477f6d8fe2Smrgm4_undefine([_defopt])
15485212f86fSmrg
15497f6d8fe2Smrghave_glib=no
15507f6d8fe2Smrg# Do not probe GLib if user explicitly disabled unit testing
15517f6d8fe2Smrgif test "x$enable_unit_tests" != x"no"; then
15527f6d8fe2Smrg  # Do not probe GLib if user explicitly disabled it
15537f6d8fe2Smrg  if test "x$with_glib" != x"no"; then
15547f6d8fe2Smrg    m4_ifval(
15557f6d8fe2Smrg      [$1],
15567f6d8fe2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15577f6d8fe2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15587f6d8fe2Smrg    )
15597f6d8fe2Smrg  fi
15607f6d8fe2Smrgfi
15615212f86fSmrg
15627f6d8fe2Smrg# Not having GLib when unit testing has been explicitly requested is an error
15637f6d8fe2Smrgif test "x$enable_unit_tests" = x"yes"; then
15647f6d8fe2Smrg  if test "x$have_glib" = x"no"; then
15657f6d8fe2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15667f6d8fe2Smrg  fi
15677f6d8fe2Smrgfi
15687d5e3a19Smrg
15697f6d8fe2Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
15707f6d8fe2Smrgif test "x$enable_unit_tests" = x"no"; then
15717f6d8fe2Smrg  if test "x$with_glib" = x"yes"; then
15727f6d8fe2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15737f6d8fe2Smrg  fi
15747f6d8fe2Smrgfi
15757d5e3a19Smrg
15767f6d8fe2Smrg# Not having GLib when it has been explicitly requested is an error
15777f6d8fe2Smrgif test "x$with_glib" = x"yes"; then
15787f6d8fe2Smrg  if test "x$have_glib" = x"no"; then
15797f6d8fe2Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15807f6d8fe2Smrg  fi
15817f6d8fe2Smrgfi
15827d5e3a19Smrg
15837f6d8fe2SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15847f6d8fe2Smrg]) # XORG_WITH_GLIB
15857d5e3a19Smrg
15867f6d8fe2Smrg# XORG_LD_WRAP([required|optional])
15877f6d8fe2Smrg# ---------------------------------
15887f6d8fe2Smrg# Minimum version: 1.13.0
15897f6d8fe2Smrg#
15907f6d8fe2Smrg# Check if linker supports -wrap, passed via compiler flags
15917f6d8fe2Smrg#
15927f6d8fe2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15937f6d8fe2Smrg# Otherwise the value of $enable_unit_tests is blank.
15947f6d8fe2Smrg#
15957f6d8fe2Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15967f6d8fe2Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15977f6d8fe2Smrg# available, an argument of "optional" allows use when some unit tests require
15987f6d8fe2Smrg# ld -wrap and others do not.
15997f6d8fe2Smrg#
16007f6d8fe2SmrgAC_DEFUN([XORG_LD_WRAP],[
16017f6d8fe2SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16027f6d8fe2Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16037f6d8fe2Smrg                      void __wrap_exit(int status) { return; }],
16047f6d8fe2Smrg                     [exit(0);])])
16057f6d8fe2Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
16067f6d8fe2Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16077f6d8fe2Smrg  if test "x$have_ld_wrap" = x"no"; then
16087f6d8fe2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16097f6d8fe2Smrg  fi
16107f6d8fe2Smrgfi
16117f6d8fe2SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16127f6d8fe2Smrg#
16137f6d8fe2Smrg]) # XORG_LD_WRAP
16147d5e3a19Smrg
16157f6d8fe2Smrg# XORG_CHECK_LINKER_FLAGS
16167f6d8fe2Smrg# -----------------------
16177f6d8fe2Smrg# SYNOPSIS
16187d5e3a19Smrg#
16197f6d8fe2Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
162013e6bc1cSmrg#
16217f6d8fe2Smrg# DESCRIPTION
16227f6d8fe2Smrg#
16237f6d8fe2Smrg#   Check whether the given linker FLAGS work with the current language's
16247f6d8fe2Smrg#   linker, or whether they give an error.
162513e6bc1cSmrg#
16267f6d8fe2Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16277f6d8fe2Smrg#   success/failure.
16285212f86fSmrg#
16297f6d8fe2Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
16307f6d8fe2Smrg#
16317f6d8fe2Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16327f6d8fe2Smrg#
16337f6d8fe2Smrg# LICENSE
16347f6d8fe2Smrg#
16357f6d8fe2Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16367f6d8fe2Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16377f6d8fe2Smrg#   Copyright (c) 2009 Matteo Frigo
16387f6d8fe2Smrg#
16397f6d8fe2Smrg#   This program is free software: you can redistribute it and/or modify it
16407f6d8fe2Smrg#   under the terms of the GNU General Public License as published by the
16417f6d8fe2Smrg#   Free Software Foundation, either version 3 of the License, or (at your
16427f6d8fe2Smrg#   option) any later version.
16437f6d8fe2Smrg#
16447f6d8fe2Smrg#   This program is distributed in the hope that it will be useful, but
16457f6d8fe2Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16467f6d8fe2Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16477f6d8fe2Smrg#   Public License for more details.
16487f6d8fe2Smrg#
16497f6d8fe2Smrg#   You should have received a copy of the GNU General Public License along
16507f6d8fe2Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16517f6d8fe2Smrg#
16527f6d8fe2Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
16537f6d8fe2Smrg#   gives unlimited permission to copy, distribute and modify the configure
16547f6d8fe2Smrg#   scripts that are the output of Autoconf when processing the Macro. You
16557f6d8fe2Smrg#   need not follow the terms of the GNU General Public License when using
16567f6d8fe2Smrg#   or distributing such scripts, even though portions of the text of the
16577f6d8fe2Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16587f6d8fe2Smrg#   all other use of the material that constitutes the Autoconf Macro.
16597f6d8fe2Smrg#
16607f6d8fe2Smrg#   This special exception to the GPL applies to versions of the Autoconf
16617f6d8fe2Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
16627f6d8fe2Smrg#   modified version of the Autoconf Macro, you may extend this special
16637f6d8fe2Smrg#   exception to the GPL to apply to your modified version as well.#
16647f6d8fe2SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16657f6d8fe2Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
16667f6d8fe2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16677f6d8fe2SmrgAS_LITERAL_IF([$1],
16687f6d8fe2Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16697f6d8fe2Smrg      ax_save_FLAGS=$LDFLAGS
16707f6d8fe2Smrg      LDFLAGS="$1"
16717f6d8fe2Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16727f6d8fe2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16737f6d8fe2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16747f6d8fe2Smrg      LDFLAGS=$ax_save_FLAGS])],
16757f6d8fe2Smrg  [ax_save_FLAGS=$LDFLAGS
16767f6d8fe2Smrg   LDFLAGS="$1"
16777f6d8fe2Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16787f6d8fe2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16797f6d8fe2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16807f6d8fe2Smrg   LDFLAGS=$ax_save_FLAGS])
16817f6d8fe2Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16827f6d8fe2SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16837f6d8fe2Smrgif test "x$xorg_check_linker_flags" = xyes; then
16847f6d8fe2Smrg	m4_default([$2], :)
16857f6d8fe2Smrgelse
16867f6d8fe2Smrg	m4_default([$3], :)
16877f6d8fe2Smrgfi
16887f6d8fe2Smrg]) # XORG_CHECK_LINKER_FLAGS
16897d5e3a19Smrg
16907f6d8fe2Smrg# XORG_MEMORY_CHECK_FLAGS
16917f6d8fe2Smrg# -----------------------
16927f6d8fe2Smrg# Minimum version: 1.16.0
16937f6d8fe2Smrg#
16947f6d8fe2Smrg# This macro attempts to find appropriate memory checking functionality
16957f6d8fe2Smrg# for various platforms which unit testing code may use to catch various
16967f6d8fe2Smrg# forms of memory allocation and access errors in testing.
16977f6d8fe2Smrg#
16987f6d8fe2Smrg# Interface to module:
16997f6d8fe2Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17007f6d8fe2Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17017f6d8fe2Smrg#
17027f6d8fe2Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17037f6d8fe2Smrg#
17047f6d8fe2SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17057f6d8fe2Smrg
17067f6d8fe2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
17077f6d8fe2SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17087f6d8fe2Smrg           [Environment variables to enable memory checking in tests])
17097f6d8fe2Smrg
17107f6d8fe2Smrg# Check for different types of support on different platforms
17117f6d8fe2Smrgcase $host_os in
17127f6d8fe2Smrg    solaris*)
17137f6d8fe2Smrg        AC_CHECK_LIB([umem], [umem_alloc],
17147f6d8fe2Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17157f6d8fe2Smrg        ;;
17167f6d8fe2Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17177f6d8fe2Smrg        # both directly and inverted, so should not be 0 or 255.
17187f6d8fe2Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
17197f6d8fe2Smrg        ;;
17207f6d8fe2Smrg    darwin*)
17217f6d8fe2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17227f6d8fe2Smrg        ;;
17237f6d8fe2Smrg    *bsd*)
17247f6d8fe2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17257f6d8fe2Smrg        ;;
17267f6d8fe2Smrgesac
17277f6d8fe2Smrg
17287f6d8fe2Smrg# User supplied flags override default flags
17297f6d8fe2Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17307f6d8fe2Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
17317f6d8fe2Smrgfi
17327f6d8fe2Smrg
17337f6d8fe2SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17347f6d8fe2Smrg]) # XORG_WITH_LINT
17357f6d8fe2Smrg
17367f6d8fe2Smrg# XORG_CHECK_MALLOC_ZERO
17377f6d8fe2Smrg# ----------------------
17385212f86fSmrg# Minimum version: 1.0.0
17395212f86fSmrg#
17407f6d8fe2Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17417f6d8fe2Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17427f6d8fe2Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17437f6d8fe2SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17447f6d8fe2SmrgAC_ARG_ENABLE(malloc0returnsnull,
17457f6d8fe2Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17467f6d8fe2Smrg		       [malloc(0) returns NULL (default: auto)]),
17477f6d8fe2Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17487f6d8fe2Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
17497d5e3a19Smrg
17507f6d8fe2SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17517f6d8fe2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17527f6d8fe2SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17537f6d8fe2Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17547f6d8fe2Smrg#include <stdlib.h>
17557f6d8fe2Smrg],[
17567f6d8fe2Smrg    char *m0, *r0, *c0, *p;
17577f6d8fe2Smrg    m0 = malloc(0);
17587f6d8fe2Smrg    p = malloc(10);
17597f6d8fe2Smrg    r0 = realloc(p,0);
17607f6d8fe2Smrg    c0 = calloc(0,10);
17617f6d8fe2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17627f6d8fe2Smrg])],
17637f6d8fe2Smrg		[xorg_cv_malloc0_returns_null=yes],
17647f6d8fe2Smrg		[xorg_cv_malloc0_returns_null=no])])
17657f6d8fe2SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
17667d5e3a19Smrgfi
17677f6d8fe2SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17687d5e3a19Smrg
17697f6d8fe2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17707f6d8fe2Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17717f6d8fe2Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17727f6d8fe2Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17735212f86fSmrgelse
17747f6d8fe2Smrg	MALLOC_ZERO_CFLAGS=""
17757f6d8fe2Smrg	XMALLOC_ZERO_CFLAGS=""
17767f6d8fe2Smrg	XTMALLOC_ZERO_CFLAGS=""
17775212f86fSmrgfi
17787d5e3a19Smrg
17797f6d8fe2SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17807f6d8fe2SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17817f6d8fe2SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17827f6d8fe2Smrg]) # XORG_CHECK_MALLOC_ZERO
17837f6d8fe2Smrg
17847f6d8fe2Smrg# XORG_WITH_LINT()
17857f6d8fe2Smrg# ----------------
17867f6d8fe2Smrg# Minimum version: 1.1.0
17877f6d8fe2Smrg#
17887f6d8fe2Smrg# This macro enables the use of a tool that flags some suspicious and
17897f6d8fe2Smrg# non-portable constructs (likely to be bugs) in C language source code.
17907f6d8fe2Smrg# It will attempt to locate the tool and use appropriate options.
17917f6d8fe2Smrg# There are various lint type tools on different platforms.
17927f6d8fe2Smrg#
17937f6d8fe2Smrg# Interface to module:
17947f6d8fe2Smrg# LINT:		returns the path to the tool found on the platform
17957f6d8fe2Smrg#		or the value set to LINT on the configure cmd line
17967f6d8fe2Smrg#		also an Automake conditional
17977f6d8fe2Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17987f6d8fe2Smrg#
17997f6d8fe2Smrg# --with-lint:	'yes' user instructs the module to use lint
18007f6d8fe2Smrg#		'no' user instructs the module not to use lint (default)
1801765486e8Smrg#
18027f6d8fe2Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18037f6d8fe2Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18047f6d8fe2Smrg#
18057f6d8fe2SmrgAC_DEFUN([XORG_WITH_LINT],[
180613e6bc1cSmrg
18077f6d8fe2SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18087f6d8fe2SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18097f6d8fe2SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18107f6d8fe2Smrg		[Use a lint-style source code checker (default: disabled)])],
18117f6d8fe2Smrg		[use_lint=$withval], [use_lint=no])
1812765486e8Smrg
18137f6d8fe2Smrg# Obtain platform specific info like program name and options
18147f6d8fe2Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18155212f86fSmrgcase $host_os in
18167f6d8fe2Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18177f6d8fe2Smrg	lint_name=splint
18187f6d8fe2Smrg	lint_options="-badflag"
18197f6d8fe2Smrg	;;
18207f6d8fe2Smrg  *freebsd* | *netbsd*)
18217f6d8fe2Smrg	lint_name=lint
18227f6d8fe2Smrg	lint_options="-u -b"
18237f6d8fe2Smrg	;;
18247f6d8fe2Smrg  *solaris*)
18257f6d8fe2Smrg	lint_name=lint
18267f6d8fe2Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18277f6d8fe2Smrg	;;
18285212f86fSmrgesac
182913e6bc1cSmrg
18307f6d8fe2Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18317f6d8fe2Smrgif test "x$use_lint" = x"yes" ; then
18327f6d8fe2Smrg   AC_PATH_PROG([LINT], [$lint_name])
18337f6d8fe2Smrg   if test "x$LINT" = "x"; then
18347f6d8fe2Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18357f6d8fe2Smrg   fi
18367f6d8fe2Smrgelif test "x$use_lint" = x"no" ; then
18377f6d8fe2Smrg   if test "x$LINT" != "x"; then
18387f6d8fe2Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18397f6d8fe2Smrg   fi
18407f6d8fe2Smrgelse
18417f6d8fe2Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18425212f86fSmrgfi
184313e6bc1cSmrg
18447f6d8fe2Smrg# User supplied flags override default flags
18457f6d8fe2Smrgif test "x$LINT_FLAGS" != "x"; then
18467f6d8fe2Smrg   lint_options=$LINT_FLAGS
1847765486e8Smrgfi
1848765486e8Smrg
18497f6d8fe2SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18507f6d8fe2SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1851765486e8Smrg
18527f6d8fe2Smrg]) # XORG_WITH_LINT
1853765486e8Smrg
18547f6d8fe2Smrg# XORG_LINT_LIBRARY(LIBNAME)
18557f6d8fe2Smrg# --------------------------
18567f6d8fe2Smrg# Minimum version: 1.1.0
18577f6d8fe2Smrg#
18587f6d8fe2Smrg# Sets up flags for building lint libraries for checking programs that call
18597f6d8fe2Smrg# functions in the library.
18607f6d8fe2Smrg#
18617f6d8fe2Smrg# Interface to module:
18627f6d8fe2Smrg# LINTLIB		- Automake variable with the name of lint library file to make
18637f6d8fe2Smrg# MAKE_LINT_LIB		- Automake conditional
18647f6d8fe2Smrg#
18657f6d8fe2Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18667f6d8fe2Smrg#			  - 'no' user instructs the module not to create a lint library (default)
186713e6bc1cSmrg
18687f6d8fe2SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18697f6d8fe2SmrgAC_REQUIRE([XORG_WITH_LINT])
18707f6d8fe2SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18717f6d8fe2Smrg	[Create lint library (default: disabled)])],
18727f6d8fe2Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
187313e6bc1cSmrg
18747f6d8fe2Smrgif test "x$make_lint_lib" = x"yes" ; then
18757f6d8fe2Smrg   LINTLIB=llib-l$1.ln
18767f6d8fe2Smrg   if test "x$LINT" = "x"; then
18777f6d8fe2Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18787f6d8fe2Smrg   fi
18797f6d8fe2Smrgelif test "x$make_lint_lib" != x"no" ; then
18807f6d8fe2Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18817f6d8fe2Smrgfi
188213e6bc1cSmrg
18837f6d8fe2SmrgAC_SUBST(LINTLIB)
18847f6d8fe2SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
188513e6bc1cSmrg
18867f6d8fe2Smrg]) # XORG_LINT_LIBRARY
188713e6bc1cSmrg
18887f6d8fe2Smrg# XORG_COMPILER_BRAND
18897f6d8fe2Smrg# -------------------
18907f6d8fe2Smrg# Minimum version: 1.14.0
1891bda5b58fSmrg#
18927f6d8fe2Smrg# Checks for various brands of compilers and sets flags as appropriate:
18937f6d8fe2Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18947f6d8fe2Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18957f6d8fe2Smrg#   clang compiler - sets CLANGCC to "yes"
18967f6d8fe2Smrg#   Intel compiler - sets INTELCC to "yes"
18977f6d8fe2Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18987f6d8fe2Smrg#
18997f6d8fe2SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19007f6d8fe2SmrgAC_LANG_CASE(
19017f6d8fe2Smrg	[C], [
19027f6d8fe2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19037f6d8fe2Smrg	],
19047f6d8fe2Smrg	[C++], [
19057f6d8fe2Smrg		AC_REQUIRE([AC_PROG_CXX])
19067f6d8fe2Smrg	]
19077f6d8fe2Smrg)
19087f6d8fe2SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19097f6d8fe2SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19107f6d8fe2SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19117f6d8fe2Smrg]) # XORG_COMPILER_BRAND
19125212f86fSmrg
19137f6d8fe2Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19147f6d8fe2Smrg# ---------------
19157f6d8fe2Smrg# Minimum version: 1.16.0
1916bda5b58fSmrg#
19177f6d8fe2Smrg# Test if the compiler works when passed the given flag as a command line argument.
19187f6d8fe2Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
19197f6d8fe2Smrg# next flag in the list until there are no more options.
19207f6d8fe2Smrg#
19217f6d8fe2Smrg# Note that this does not guarantee that the compiler supports the flag as some
19227f6d8fe2Smrg# compilers will simply ignore arguments that they do not understand, but we do
19237f6d8fe2Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19247f6d8fe2Smrg# -Werror=unused-command-line-argument
19257f6d8fe2Smrg#
19267f6d8fe2SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19277f6d8fe2Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19287f6d8fe2Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1929bda5b58fSmrg
19307f6d8fe2SmrgAC_LANG_COMPILER_REQUIRE
19317f6d8fe2Smrg
19327f6d8fe2SmrgAC_LANG_CASE(
19337f6d8fe2Smrg	[C], [
19347f6d8fe2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19357f6d8fe2Smrg		define([PREFIX], [C])
19367f6d8fe2Smrg		define([CACHE_PREFIX], [cc])
19377f6d8fe2Smrg		define([COMPILER], [$CC])
19387f6d8fe2Smrg	],
19397f6d8fe2Smrg	[C++], [
19407f6d8fe2Smrg		define([PREFIX], [CXX])
19417f6d8fe2Smrg		define([CACHE_PREFIX], [cxx])
19427f6d8fe2Smrg		define([COMPILER], [$CXX])
19437f6d8fe2Smrg	]
19447f6d8fe2Smrg)
194513e6bc1cSmrg
19467f6d8fe2Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19475212f86fSmrg
19487f6d8fe2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19497f6d8fe2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19507f6d8fe2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19517f6d8fe2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19527f6d8fe2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19537f6d8fe2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19547f6d8fe2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19557f6d8fe2Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19567f6d8fe2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1957bda5b58fSmrgfi
1958bda5b58fSmrg
19597f6d8fe2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19607f6d8fe2Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19617f6d8fe2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19627f6d8fe2Smrg	fi
19637f6d8fe2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19647f6d8fe2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19657f6d8fe2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19667f6d8fe2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19677f6d8fe2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19687f6d8fe2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19697f6d8fe2Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19707f6d8fe2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19715212f86fSmrgfi
19725212f86fSmrg
19737f6d8fe2Smrgfound="no"
19747f6d8fe2Smrgm4_foreach([flag], m4_cdr($@), [
19757f6d8fe2Smrg	if test $found = "no" ; then
19767f6d8fe2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19777f6d8fe2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19787f6d8fe2Smrg		fi
19795212f86fSmrg
19807f6d8fe2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19817f6d8fe2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19827f6d8fe2Smrg		fi
19835212f86fSmrg
19847f6d8fe2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19855212f86fSmrg
19867f6d8fe2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19877f6d8fe2Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19887f6d8fe2Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19897f6d8fe2Smrg		AC_CACHE_VAL($cacheid,
19907f6d8fe2Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19917f6d8fe2Smrg					     [eval $cacheid=yes],
19927f6d8fe2Smrg					     [eval $cacheid=no])])
19935212f86fSmrg
19947f6d8fe2Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19955212f86fSmrg
19967f6d8fe2Smrg		eval supported=\$$cacheid
19977f6d8fe2Smrg		AC_MSG_RESULT([$supported])
19987f6d8fe2Smrg		if test "$supported" = "yes" ; then
19997f6d8fe2Smrg			$1="$$1 ]flag["
20007f6d8fe2Smrg			found="yes"
20017f6d8fe2Smrg		fi
20027f6d8fe2Smrg	fi
20037f6d8fe2Smrg])
20047f6d8fe2Smrg]) # XORG_TESTSET_CFLAG
20055212f86fSmrg
20067f6d8fe2Smrg# XORG_COMPILER_FLAGS
20077f6d8fe2Smrg# ---------------
20087f6d8fe2Smrg# Minimum version: 1.16.0
20097f6d8fe2Smrg#
20107f6d8fe2Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20117f6d8fe2Smrg# arguments supported by the selected compiler which do NOT alter the generated
20127f6d8fe2Smrg# code.  These arguments will cause the compiler to print various warnings
20137f6d8fe2Smrg# during compilation AND turn a conservative set of warnings into errors.
20147f6d8fe2Smrg#
20157f6d8fe2Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20167f6d8fe2Smrg# future versions of util-macros as options are added to new compilers.
20177f6d8fe2Smrg#
20187f6d8fe2SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20197f6d8fe2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
202013e6bc1cSmrg
20217f6d8fe2SmrgAC_ARG_ENABLE(selective-werror,
20227f6d8fe2Smrg              AS_HELP_STRING([--disable-selective-werror],
20237f6d8fe2Smrg                             [Turn off selective compiler errors. (default: enabled)]),
20247f6d8fe2Smrg              [SELECTIVE_WERROR=$enableval],
20257f6d8fe2Smrg              [SELECTIVE_WERROR=yes])
202613e6bc1cSmrg
20277f6d8fe2SmrgAC_LANG_CASE(
20287f6d8fe2Smrg        [C], [
20297f6d8fe2Smrg                define([PREFIX], [C])
20307f6d8fe2Smrg        ],
20317f6d8fe2Smrg        [C++], [
20327f6d8fe2Smrg                define([PREFIX], [CXX])
20337f6d8fe2Smrg        ]
20347f6d8fe2Smrg)
20357f6d8fe2Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20367f6d8fe2Smrgif test "x$SUNCC" = "xyes"; then
20377f6d8fe2Smrg    [BASE_]PREFIX[FLAGS]="-v"
20387f6d8fe2Smrgelse
20397f6d8fe2Smrg    [BASE_]PREFIX[FLAGS]=""
20405212f86fSmrgfi
204113e6bc1cSmrg
20427f6d8fe2Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20437f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20447f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20457f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20467f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
204713e6bc1cSmrg
20487f6d8fe2SmrgAC_LANG_CASE(
20497f6d8fe2Smrg	[C], [
20507f6d8fe2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20517f6d8fe2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20527f6d8fe2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20537f6d8fe2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20547f6d8fe2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20557f6d8fe2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20567f6d8fe2Smrg	]
20577f6d8fe2Smrg)
205813e6bc1cSmrg
20597f6d8fe2Smrg# This chunk adds additional warnings that could catch undesired effects.
20607f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20617f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20627f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20637f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20647f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20657f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20667f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20675212f86fSmrg
20687f6d8fe2Smrg# These are currently disabled because they are noisy.  They will be enabled
20697f6d8fe2Smrg# in the future once the codebase is sufficiently modernized to silence
20707f6d8fe2Smrg# them.  For now, I don't want them to drown out the other warnings.
20717f6d8fe2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20727f6d8fe2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20737f6d8fe2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20745212f86fSmrg
20757f6d8fe2Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20767f6d8fe2Smrg# when there are problems that should be fixed.
2077bda5b58fSmrg
20787f6d8fe2Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20797f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20807f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20817f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20827f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20837f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20847f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20857f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20867f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20877f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20887f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20897f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20907f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20917f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20925212f86fSmrgelse
20937f6d8fe2SmrgAC_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])
20947f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20957f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20967f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20977f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20987f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20997f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21007f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21017f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21027f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21037f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21047f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21057f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21067f6d8fe2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
21075212f86fSmrgfi
2108bda5b58fSmrg
21097f6d8fe2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21107f6d8fe2Smrg]) # XORG_COMPILER_FLAGS
2111bda5b58fSmrg
21127f6d8fe2Smrg# XORG_CWARNFLAGS
21137f6d8fe2Smrg# ---------------
21147f6d8fe2Smrg# Minimum version: 1.2.0
21157f6d8fe2Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21165212f86fSmrg#
21177f6d8fe2Smrg# Defines CWARNFLAGS to enable C compiler warnings.
21185212f86fSmrg#
21197f6d8fe2Smrg# This function is deprecated because it defines -fno-strict-aliasing
21207f6d8fe2Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21217f6d8fe2Smrg# is needed, then it should be added explicitly in the module when
21227f6d8fe2Smrg# it is updated to use BASE_CFLAGS.
21235212f86fSmrg#
21247f6d8fe2SmrgAC_DEFUN([XORG_CWARNFLAGS], [
21257f6d8fe2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21267f6d8fe2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21277f6d8fe2SmrgAC_LANG_CASE(
21287f6d8fe2Smrg	[C], [
21297f6d8fe2Smrg		CWARNFLAGS="$BASE_CFLAGS"
21307f6d8fe2Smrg		if  test "x$GCC" = xyes ; then
21317f6d8fe2Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21327f6d8fe2Smrg		fi
21337f6d8fe2Smrg		AC_SUBST(CWARNFLAGS)
21347f6d8fe2Smrg	]
21357f6d8fe2Smrg)
21367f6d8fe2Smrg]) # XORG_CWARNFLAGS
21377f6d8fe2Smrg
21387f6d8fe2Smrg# XORG_STRICT_OPTION
21397f6d8fe2Smrg# -----------------------
21407f6d8fe2Smrg# Minimum version: 1.3.0
21415212f86fSmrg#
21427f6d8fe2Smrg# Add configure option to enable strict compilation flags, such as treating
21437f6d8fe2Smrg# warnings as fatal errors.
21447f6d8fe2Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21457f6d8fe2Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21465212f86fSmrg#
21477f6d8fe2Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21487f6d8fe2Smrg# when strict compilation is unconditionally desired.
21497f6d8fe2SmrgAC_DEFUN([XORG_STRICT_OPTION], [
21507f6d8fe2SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21517f6d8fe2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
215213e6bc1cSmrg
21537f6d8fe2SmrgAC_ARG_ENABLE(strict-compilation,
21547f6d8fe2Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21557f6d8fe2Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21567f6d8fe2Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
215713e6bc1cSmrg
21587f6d8fe2SmrgAC_LANG_CASE(
21597f6d8fe2Smrg        [C], [
21607f6d8fe2Smrg                define([PREFIX], [C])
21617f6d8fe2Smrg        ],
21627f6d8fe2Smrg        [C++], [
21637f6d8fe2Smrg                define([PREFIX], [CXX])
21647f6d8fe2Smrg        ]
21657f6d8fe2Smrg)
21665212f86fSmrg
21677f6d8fe2Smrg[STRICT_]PREFIX[FLAGS]=""
21687f6d8fe2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21697f6d8fe2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21707f6d8fe2Smrg
21717f6d8fe2Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21727f6d8fe2Smrg# activate it with -Werror, so we add it here explicitly.
21737f6d8fe2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21747f6d8fe2Smrg
21757f6d8fe2Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21767f6d8fe2Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21777f6d8fe2Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21787f6d8fe2Smrgfi
21797f6d8fe2SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21807f6d8fe2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21817f6d8fe2SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21827f6d8fe2Smrg]) # XORG_STRICT_OPTION
21837f6d8fe2Smrg
21847f6d8fe2Smrg# XORG_DEFAULT_OPTIONS
21857f6d8fe2Smrg# --------------------
21867f6d8fe2Smrg# Minimum version: 1.3.0
2187765486e8Smrg#
21887f6d8fe2Smrg# Defines default options for X.Org modules.
2189765486e8Smrg#
21907f6d8fe2SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21917f6d8fe2SmrgAC_REQUIRE([AC_PROG_INSTALL])
21927f6d8fe2SmrgXORG_COMPILER_FLAGS
21937f6d8fe2SmrgXORG_CWARNFLAGS
21947f6d8fe2SmrgXORG_STRICT_OPTION
21957f6d8fe2SmrgXORG_RELEASE_VERSION
21967f6d8fe2SmrgXORG_CHANGELOG
21977f6d8fe2SmrgXORG_INSTALL
21987f6d8fe2SmrgXORG_MANPAGE_SECTIONS
21997f6d8fe2Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
22007f6d8fe2Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
22017f6d8fe2Smrg]) # XORG_DEFAULT_OPTIONS
22027f6d8fe2Smrg
22037f6d8fe2Smrg# XORG_INSTALL()
22047f6d8fe2Smrg# ----------------
22057f6d8fe2Smrg# Minimum version: 1.4.0
2206765486e8Smrg#
22077f6d8fe2Smrg# Defines the variable INSTALL_CMD as the command to copy
22087f6d8fe2Smrg# INSTALL from $prefix/share/util-macros.
22095212f86fSmrg#
22107f6d8fe2SmrgAC_DEFUN([XORG_INSTALL], [
22117f6d8fe2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22127f6d8fe2Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22137f6d8fe2SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22147f6d8fe2Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
22157f6d8fe2Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
22167f6d8fe2Smrgtouch \$(top_srcdir)/INSTALL; \
22177f6d8fe2Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22187f6d8fe2SmrgAC_SUBST([INSTALL_CMD])
22197f6d8fe2Smrg]) # XORG_INSTALL
22207f6d8fe2Smrgdnl Copyright 2005 Red Hat, Inc
22217f6d8fe2Smrgdnl
22227f6d8fe2Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22237f6d8fe2Smrgdnl documentation for any purpose is hereby granted without fee, provided that
22247f6d8fe2Smrgdnl the above copyright notice appear in all copies and that both that
22257f6d8fe2Smrgdnl copyright notice and this permission notice appear in supporting
22267f6d8fe2Smrgdnl documentation.
22277f6d8fe2Smrgdnl
22287f6d8fe2Smrgdnl The above copyright notice and this permission notice shall be included
22297f6d8fe2Smrgdnl in all copies or substantial portions of the Software.
22307f6d8fe2Smrgdnl
22317f6d8fe2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22327f6d8fe2Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22337f6d8fe2Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22347f6d8fe2Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22357f6d8fe2Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22367f6d8fe2Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22377f6d8fe2Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
22387f6d8fe2Smrgdnl
22397f6d8fe2Smrgdnl Except as contained in this notice, the name of the copyright holders shall
22407f6d8fe2Smrgdnl not be used in advertising or otherwise to promote the sale, use or
22417f6d8fe2Smrgdnl other dealings in this Software without prior written authorization
22427f6d8fe2Smrgdnl from the copyright holders.
22437f6d8fe2Smrgdnl
2244765486e8Smrg
22457f6d8fe2Smrg# XORG_RELEASE_VERSION
22467f6d8fe2Smrg# --------------------
22477f6d8fe2Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
224813e6bc1cSmrg
22497f6d8fe2SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22507f6d8fe2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22517f6d8fe2Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22527f6d8fe2Smrg		[Major version of this package])
22537f6d8fe2Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22547f6d8fe2Smrg	if test "x$PVM" = "x"; then
22557f6d8fe2Smrg		PVM="0"
22567f6d8fe2Smrg	fi
22577f6d8fe2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22587f6d8fe2Smrg		[$PVM],
22597f6d8fe2Smrg		[Minor version of this package])
22607f6d8fe2Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22617f6d8fe2Smrg	if test "x$PVP" = "x"; then
22627f6d8fe2Smrg		PVP="0"
22637f6d8fe2Smrg	fi
22647f6d8fe2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22657f6d8fe2Smrg		[$PVP],
22667f6d8fe2Smrg		[Patch version of this package])
22677f6d8fe2Smrg])
226813e6bc1cSmrg
22697f6d8fe2Smrg# XORG_CHANGELOG()
227013e6bc1cSmrg# ----------------
22717f6d8fe2Smrg# Minimum version: 1.2.0
2272765486e8Smrg#
22737f6d8fe2Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22747f6d8fe2Smrg# ChangeLog from git.
2275765486e8Smrg#
2276765486e8Smrg#
22777f6d8fe2SmrgAC_DEFUN([XORG_CHANGELOG], [
22787f6d8fe2SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22797f6d8fe2Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22807f6d8fe2Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22817f6d8fe2Smrgtouch \$(top_srcdir)/ChangeLog; \
22827f6d8fe2Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22837f6d8fe2SmrgAC_SUBST([CHANGELOG_CMD])
22847f6d8fe2Smrg]) # XORG_CHANGELOG
228513e6bc1cSmrg
22867f6d8fe2Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
228713e6bc1cSmrg#
22887f6d8fe2Smrg# This file is free software; the Free Software Foundation
22897f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
22907f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
229113e6bc1cSmrg
22927f6d8fe2Smrg# AM_AUTOMAKE_VERSION(VERSION)
22937f6d8fe2Smrg# ----------------------------
22947f6d8fe2Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22957f6d8fe2Smrg# generated from the m4 files accompanying Automake X.Y.
22967f6d8fe2Smrg# (This private macro should not be called outside this file.)
22977f6d8fe2SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22987f6d8fe2Smrg[am__api_version='1.16'
22997f6d8fe2Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
23007f6d8fe2Smrgdnl require some minimum version.  Point them to the right macro.
23017f6d8fe2Smrgm4_if([$1], [1.16.5], [],
23027f6d8fe2Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
23037f6d8fe2Smrg])
2304765486e8Smrg
23057f6d8fe2Smrg# _AM_AUTOCONF_VERSION(VERSION)
23067f6d8fe2Smrg# -----------------------------
23077f6d8fe2Smrg# aclocal traces this macro to find the Autoconf version.
23087f6d8fe2Smrg# This is a private macro too.  Using m4_define simplifies
23097f6d8fe2Smrg# the logic in aclocal, which can simply ignore this definition.
23107f6d8fe2Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2311765486e8Smrg
23127f6d8fe2Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
23137f6d8fe2Smrg# -------------------------------
23147f6d8fe2Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23157f6d8fe2Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
23167f6d8fe2SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
23177f6d8fe2Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
23187f6d8fe2Smrgm4_ifndef([AC_AUTOCONF_VERSION],
23197f6d8fe2Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23207f6d8fe2Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
232113e6bc1cSmrg
23227f6d8fe2Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
23237f6d8fe2Smrg
23247f6d8fe2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2325765486e8Smrg#
23267f6d8fe2Smrg# This file is free software; the Free Software Foundation
23277f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
23287f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
23297f6d8fe2Smrg
23307f6d8fe2Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23317f6d8fe2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23327f6d8fe2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
23335212f86fSmrg#
23347f6d8fe2Smrg# Of course, Automake must honor this variable whenever it calls a
23357f6d8fe2Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
23367f6d8fe2Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
23377f6d8fe2Smrg# depending on how configure is run.  This is pretty annoying, since
23387f6d8fe2Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
23397f6d8fe2Smrg# source directory, any form will work fine, but in subdirectories a
23407f6d8fe2Smrg# relative path needs to be adjusted first.
23415212f86fSmrg#
23427f6d8fe2Smrg# $ac_aux_dir/missing
23437f6d8fe2Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
23447f6d8fe2Smrg# $top_srcdir/$ac_aux_dir/missing
23457f6d8fe2Smrg#    fails if $ac_aux_dir is absolute,
23467f6d8fe2Smrg#    fails when called from a subdirectory in a VPATH build with
23477f6d8fe2Smrg#          a relative $ac_aux_dir
23485212f86fSmrg#
23497f6d8fe2Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
23507f6d8fe2Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
23517f6d8fe2Smrg# harmless because $srcdir is '.', but things will broke when you
23527f6d8fe2Smrg# start a VPATH build or use an absolute $srcdir.
23535212f86fSmrg#
23547f6d8fe2Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
23557f6d8fe2Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
23567f6d8fe2Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
23577f6d8fe2Smrg# and then we would define $MISSING as
23587f6d8fe2Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
23597f6d8fe2Smrg# This will work as long as MISSING is not called from configure, because
23607f6d8fe2Smrg# unfortunately $(top_srcdir) has no meaning in configure.
23617f6d8fe2Smrg# However there are other variables, like CC, which are often used in
23627f6d8fe2Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
23635212f86fSmrg#
23647f6d8fe2Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
23657f6d8fe2Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
23667f6d8fe2Smrg# configured tree to be moved without reconfiguration.
23677f6d8fe2Smrg
23687f6d8fe2SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23697f6d8fe2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23707f6d8fe2Smrg# Expand $ac_aux_dir to an absolute path.
23717f6d8fe2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
23727f6d8fe2Smrg])
23737f6d8fe2Smrg
23747f6d8fe2Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
23757f6d8fe2Smrg
23767f6d8fe2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
23775212f86fSmrg#
23787f6d8fe2Smrg# This file is free software; the Free Software Foundation
23797f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
23807f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
2381b8414663Smrg
23827f6d8fe2Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23837f6d8fe2Smrg# -------------------------------------
23847f6d8fe2Smrg# Define a conditional.
23857f6d8fe2SmrgAC_DEFUN([AM_CONDITIONAL],
23867f6d8fe2Smrg[AC_PREREQ([2.52])dnl
23877f6d8fe2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23887f6d8fe2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23897f6d8fe2SmrgAC_SUBST([$1_TRUE])dnl
23907f6d8fe2SmrgAC_SUBST([$1_FALSE])dnl
23917f6d8fe2Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23927f6d8fe2Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23937f6d8fe2Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23947f6d8fe2Smrgif $2; then
23957f6d8fe2Smrg  $1_TRUE=
23967f6d8fe2Smrg  $1_FALSE='#'
23975212f86fSmrgelse
23987f6d8fe2Smrg  $1_TRUE='#'
23997f6d8fe2Smrg  $1_FALSE=
24005212f86fSmrgfi
24017f6d8fe2SmrgAC_CONFIG_COMMANDS_PRE(
24027f6d8fe2Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
24037f6d8fe2Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
24047f6d8fe2SmrgUsually this means the macro was only invoked conditionally.]])
24057f6d8fe2Smrgfi])])
2406b8414663Smrg
24077f6d8fe2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
24087f6d8fe2Smrg#
24097f6d8fe2Smrg# This file is free software; the Free Software Foundation
24107f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
24117f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
2412765486e8Smrg
24135212f86fSmrg
24147f6d8fe2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
24157f6d8fe2Smrg# written in clear, in which case automake, when reading aclocal.m4,
24167f6d8fe2Smrg# will think it sees a *use*, and therefore will trigger all it's
24177f6d8fe2Smrg# C support machinery.  Also note that it means that autoscan, seeing
24187f6d8fe2Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
24195212f86fSmrg
24207f6d8fe2Smrg
24217f6d8fe2Smrg# _AM_DEPENDENCIES(NAME)
24227f6d8fe2Smrg# ----------------------
24237f6d8fe2Smrg# See how the compiler implements dependency checking.
24247f6d8fe2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
24257f6d8fe2Smrg# We try a few techniques and use that to set a single cache variable.
24265212f86fSmrg#
24277f6d8fe2Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
24287f6d8fe2Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
24297f6d8fe2Smrg# dependency, and given that the user is not expected to run this macro,
24307f6d8fe2Smrg# just rely on AC_PROG_CC.
24317f6d8fe2SmrgAC_DEFUN([_AM_DEPENDENCIES],
24327f6d8fe2Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
24337f6d8fe2SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
24347f6d8fe2SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
24357f6d8fe2SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
24365212f86fSmrg
24377f6d8fe2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24387f6d8fe2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24397f6d8fe2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24407f6d8fe2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24417f6d8fe2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24427f6d8fe2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24437f6d8fe2Smrg                    [depcc="$$1"   am_compiler_list=])
2444765486e8Smrg
24457f6d8fe2SmrgAC_CACHE_CHECK([dependency style of $depcc],
24467f6d8fe2Smrg               [am_cv_$1_dependencies_compiler_type],
24477f6d8fe2Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
24487f6d8fe2Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
24497f6d8fe2Smrg  # making bogus files that we don't know about and never remove.  For
24507f6d8fe2Smrg  # instance it was reported that on HP-UX the gcc test will end up
24517f6d8fe2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24527f6d8fe2Smrg  # in D".
24537f6d8fe2Smrg  rm -rf conftest.dir
24547f6d8fe2Smrg  mkdir conftest.dir
24557f6d8fe2Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
24567f6d8fe2Smrg  # using a relative directory.
24577f6d8fe2Smrg  cp "$am_depcomp" conftest.dir
24587f6d8fe2Smrg  cd conftest.dir
24597f6d8fe2Smrg  # We will build objects and dependencies in a subdirectory because
24607f6d8fe2Smrg  # it helps to detect inapplicable dependency modes.  For instance
24617f6d8fe2Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
24627f6d8fe2Smrg  # side effect of compilation, but ICC will put the dependencies in
24637f6d8fe2Smrg  # the current directory while Tru64 will put them in the object
24647f6d8fe2Smrg  # directory.
24657f6d8fe2Smrg  mkdir sub
24665212f86fSmrg
24677f6d8fe2Smrg  am_cv_$1_dependencies_compiler_type=none
24687f6d8fe2Smrg  if test "$am_compiler_list" = ""; then
24697f6d8fe2Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24707f6d8fe2Smrg  fi
24717f6d8fe2Smrg  am__universal=false
24727f6d8fe2Smrg  m4_case([$1], [CC],
24737f6d8fe2Smrg    [case " $depcc " in #(
24747f6d8fe2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24757f6d8fe2Smrg     esac],
24767f6d8fe2Smrg    [CXX],
24777f6d8fe2Smrg    [case " $depcc " in #(
24787f6d8fe2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24797f6d8fe2Smrg     esac])
2480765486e8Smrg
24817f6d8fe2Smrg  for depmode in $am_compiler_list; do
24827f6d8fe2Smrg    # Setup a source with many dependencies, because some compilers
24837f6d8fe2Smrg    # like to wrap large dependency lists on column 80 (with \), and
24847f6d8fe2Smrg    # we should not choose a depcomp mode which is confused by this.
24857f6d8fe2Smrg    #
24867f6d8fe2Smrg    # We need to recreate these files for each test, as the compiler may
24877f6d8fe2Smrg    # overwrite some of them when testing with obscure command lines.
24887f6d8fe2Smrg    # This happens at least with the AIX C compiler.
24897f6d8fe2Smrg    : > sub/conftest.c
24907f6d8fe2Smrg    for i in 1 2 3 4 5 6; do
24917f6d8fe2Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24927f6d8fe2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24937f6d8fe2Smrg      # Solaris 10 /bin/sh.
24947f6d8fe2Smrg      echo '/* dummy */' > sub/conftst$i.h
24957f6d8fe2Smrg    done
24967f6d8fe2Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
249713e6bc1cSmrg
24987f6d8fe2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24997f6d8fe2Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25007f6d8fe2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25017f6d8fe2Smrg    # versions had trouble with output in subdirs.
25027f6d8fe2Smrg    am__obj=sub/conftest.${OBJEXT-o}
25037f6d8fe2Smrg    am__minus_obj="-o $am__obj"
25047f6d8fe2Smrg    case $depmode in
25057f6d8fe2Smrg    gcc)
25067f6d8fe2Smrg      # This depmode causes a compiler race in universal mode.
25077f6d8fe2Smrg      test "$am__universal" = false || continue
25087f6d8fe2Smrg      ;;
25097f6d8fe2Smrg    nosideeffect)
25107f6d8fe2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
25117f6d8fe2Smrg      # only be used when explicitly requested.
25127f6d8fe2Smrg      if test "x$enable_dependency_tracking" = xyes; then
25137f6d8fe2Smrg	continue
25147f6d8fe2Smrg      else
25157f6d8fe2Smrg	break
25167f6d8fe2Smrg      fi
25177f6d8fe2Smrg      ;;
25187f6d8fe2Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25197f6d8fe2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25207f6d8fe2Smrg      # not run yet.  These depmodes are late enough in the game, and
25217f6d8fe2Smrg      # so weak that their functioning should not be impacted.
25227f6d8fe2Smrg      am__obj=conftest.${OBJEXT-o}
25237f6d8fe2Smrg      am__minus_obj=
25247f6d8fe2Smrg      ;;
25257f6d8fe2Smrg    none) break ;;
25267f6d8fe2Smrg    esac
25277f6d8fe2Smrg    if depmode=$depmode \
25287f6d8fe2Smrg       source=sub/conftest.c object=$am__obj \
25297f6d8fe2Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25307f6d8fe2Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
25317f6d8fe2Smrg         >/dev/null 2>conftest.err &&
25327f6d8fe2Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
25337f6d8fe2Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25347f6d8fe2Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
25357f6d8fe2Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
25367f6d8fe2Smrg      # icc doesn't choke on unknown options, it will just issue warnings
25377f6d8fe2Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
25387f6d8fe2Smrg      # that says an option was ignored or not supported.
25397f6d8fe2Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
25407f6d8fe2Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
25417f6d8fe2Smrg      # The diagnosis changed in icc 8.0:
25427f6d8fe2Smrg      #   icc: Command line remark: option '-MP' not supported
25437f6d8fe2Smrg      if (grep 'ignoring option' conftest.err ||
25447f6d8fe2Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
25457f6d8fe2Smrg        am_cv_$1_dependencies_compiler_type=$depmode
25467f6d8fe2Smrg        break
25477f6d8fe2Smrg      fi
25487f6d8fe2Smrg    fi
25497f6d8fe2Smrg  done
255013e6bc1cSmrg
25517f6d8fe2Smrg  cd ..
25527f6d8fe2Smrg  rm -rf conftest.dir
25535212f86fSmrgelse
25547f6d8fe2Smrg  am_cv_$1_dependencies_compiler_type=none
255513e6bc1cSmrgfi
25567f6d8fe2Smrg])
25577f6d8fe2SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
25587f6d8fe2SmrgAM_CONDITIONAL([am__fastdep$1], [
25597f6d8fe2Smrg  test "x$enable_dependency_tracking" != xno \
25607f6d8fe2Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
25617f6d8fe2Smrg])
2562765486e8Smrg
2563bda5b58fSmrg
25647f6d8fe2Smrg# AM_SET_DEPDIR
25657f6d8fe2Smrg# -------------
25667f6d8fe2Smrg# Choose a directory name for dependency files.
25677f6d8fe2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25687f6d8fe2SmrgAC_DEFUN([AM_SET_DEPDIR],
25697f6d8fe2Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25707f6d8fe2SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25717f6d8fe2Smrg])
25727f6d8fe2Smrg
25737f6d8fe2Smrg
25747f6d8fe2Smrg# AM_DEP_TRACK
25757f6d8fe2Smrg# ------------
25767f6d8fe2SmrgAC_DEFUN([AM_DEP_TRACK],
25777f6d8fe2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25787f6d8fe2SmrgAS_HELP_STRING(
25797f6d8fe2Smrg  [--enable-dependency-tracking],
25807f6d8fe2Smrg  [do not reject slow dependency extractors])
25817f6d8fe2SmrgAS_HELP_STRING(
25827f6d8fe2Smrg  [--disable-dependency-tracking],
25837f6d8fe2Smrg  [speeds up one-time build])])
25847f6d8fe2Smrgif test "x$enable_dependency_tracking" != xno; then
25857f6d8fe2Smrg  am_depcomp="$ac_aux_dir/depcomp"
25867f6d8fe2Smrg  AMDEPBACKSLASH='\'
25877f6d8fe2Smrg  am__nodep='_no'
25887f6d8fe2Smrgfi
25897f6d8fe2SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25907f6d8fe2SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25917f6d8fe2Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25927f6d8fe2SmrgAC_SUBST([am__nodep])dnl
25937f6d8fe2Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25947f6d8fe2Smrg])
259513e6bc1cSmrg
25967f6d8fe2Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
259713e6bc1cSmrg
25987f6d8fe2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
25995212f86fSmrg#
26007f6d8fe2Smrg# This file is free software; the Free Software Foundation
26017f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
26027f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
260313e6bc1cSmrg
26047f6d8fe2Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
26057f6d8fe2Smrg# ------------------------------
26067f6d8fe2SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26077f6d8fe2Smrg[{
26087f6d8fe2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
26097f6d8fe2Smrg  # are listed without --file.  Let's play safe and only enable the eval
26107f6d8fe2Smrg  # if we detect the quoting.
26117f6d8fe2Smrg  # TODO: see whether this extra hack can be removed once we start
26127f6d8fe2Smrg  # requiring Autoconf 2.70 or later.
26137f6d8fe2Smrg  AS_CASE([$CONFIG_FILES],
26147f6d8fe2Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
26157f6d8fe2Smrg          [*], [set x $CONFIG_FILES])
26167f6d8fe2Smrg  shift
26177f6d8fe2Smrg  # Used to flag and report bootstrapping failures.
26187f6d8fe2Smrg  am_rc=0
26197f6d8fe2Smrg  for am_mf
26207f6d8fe2Smrg  do
26217f6d8fe2Smrg    # Strip MF so we end up with the name of the file.
26227f6d8fe2Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
26237f6d8fe2Smrg    # Check whether this is an Automake generated Makefile which includes
26247f6d8fe2Smrg    # dependency-tracking related rules and includes.
26257f6d8fe2Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
26267f6d8fe2Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
26277f6d8fe2Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
26287f6d8fe2Smrg      || continue
26297f6d8fe2Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
26307f6d8fe2Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
26317f6d8fe2Smrg    AM_RUN_LOG([cd "$am_dirpart" \
26327f6d8fe2Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
26337f6d8fe2Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
26347f6d8fe2Smrg  done
26357f6d8fe2Smrg  if test $am_rc -ne 0; then
26367f6d8fe2Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
26377f6d8fe2Smrg    for automatic dependency tracking.  If GNU make was not used, consider
26387f6d8fe2Smrg    re-running the configure script with MAKE="gmake" (or whatever is
26397f6d8fe2Smrg    necessary).  You can also try re-running configure with the
26407f6d8fe2Smrg    '--disable-dependency-tracking' option to at least be able to build
26417f6d8fe2Smrg    the package (albeit without support for automatic dependency tracking).])
26427f6d8fe2Smrg  fi
26437f6d8fe2Smrg  AS_UNSET([am_dirpart])
26447f6d8fe2Smrg  AS_UNSET([am_filepart])
26457f6d8fe2Smrg  AS_UNSET([am_mf])
26467f6d8fe2Smrg  AS_UNSET([am_rc])
26477f6d8fe2Smrg  rm -f conftest-deps.mk
26487f6d8fe2Smrg}
26497f6d8fe2Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
265013e6bc1cSmrg
26517f6d8fe2Smrg
26527f6d8fe2Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
26537f6d8fe2Smrg# -----------------------------
26547f6d8fe2Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2655bda5b58fSmrg#
26567f6d8fe2Smrg# This code is only required when automatic dependency tracking is enabled.
26577f6d8fe2Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
26587f6d8fe2Smrg# order to bootstrap the dependency handling code.
26597f6d8fe2SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
26607f6d8fe2Smrg[AC_CONFIG_COMMANDS([depfiles],
26617f6d8fe2Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
26627f6d8fe2Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
26637f6d8fe2Smrg
26647f6d8fe2Smrg# Do all the work for Automake.                             -*- Autoconf -*-
26657f6d8fe2Smrg
26667f6d8fe2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
26675212f86fSmrg#
26687f6d8fe2Smrg# This file is free software; the Free Software Foundation
26697f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
26707f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
2671bda5b58fSmrg
26727f6d8fe2Smrg# This macro actually does too much.  Some checks are only needed if
26737f6d8fe2Smrg# your package does certain things.  But this isn't really a big deal.
2674bda5b58fSmrg
26757f6d8fe2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26767f6d8fe2Smrgm4_define([AC_PROG_CC],
26777f6d8fe2Smrgm4_defn([AC_PROG_CC])
26787f6d8fe2Smrg[_AM_PROG_CC_C_O
26797f6d8fe2Smrg])
26807f6d8fe2Smrg
26817f6d8fe2Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26827f6d8fe2Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26837f6d8fe2Smrg# -----------------------------------------------
26847f6d8fe2Smrg# The call with PACKAGE and VERSION arguments is the old style
26857f6d8fe2Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26867f6d8fe2Smrg# and VERSION should now be passed to AC_INIT and removed from
26877f6d8fe2Smrg# the call to AM_INIT_AUTOMAKE.
26887f6d8fe2Smrg# We support both call styles for the transition.  After
26897f6d8fe2Smrg# the next Automake release, Autoconf can make the AC_INIT
26907f6d8fe2Smrg# arguments mandatory, and then we can depend on a new Autoconf
26917f6d8fe2Smrg# release and drop the old call support.
26927f6d8fe2SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26937f6d8fe2Smrg[AC_PREREQ([2.65])dnl
26947f6d8fe2Smrgm4_ifdef([_$0_ALREADY_INIT],
26957f6d8fe2Smrg  [m4_fatal([$0 expanded multiple times
26967f6d8fe2Smrg]m4_defn([_$0_ALREADY_INIT]))],
26977f6d8fe2Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
26987f6d8fe2Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26997f6d8fe2Smrgdnl the ones we care about.
27007f6d8fe2Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
27017f6d8fe2SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
27027f6d8fe2SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
27037f6d8fe2Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
27047f6d8fe2Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
27057f6d8fe2Smrg  # is not polluted with repeated "-I."
27067f6d8fe2Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27077f6d8fe2Smrg  # test to see if srcdir already configured
27087f6d8fe2Smrg  if test -f $srcdir/config.status; then
27097f6d8fe2Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2710bda5b58fSmrg  fi
2711bda5b58fSmrgfi
2712bda5b58fSmrg
27137f6d8fe2Smrg# test whether we have cygpath
27147f6d8fe2Smrgif test -z "$CYGPATH_W"; then
27157f6d8fe2Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
27167f6d8fe2Smrg    CYGPATH_W='cygpath -w'
27177f6d8fe2Smrg  else
27187f6d8fe2Smrg    CYGPATH_W=echo
27195212f86fSmrg  fi
27205212f86fSmrgfi
27217f6d8fe2SmrgAC_SUBST([CYGPATH_W])
2722bda5b58fSmrg
27237f6d8fe2Smrg# Define the identity of the package.
27247f6d8fe2Smrgdnl Distinguish between old-style and new-style calls.
27257f6d8fe2Smrgm4_ifval([$2],
27267f6d8fe2Smrg[AC_DIAGNOSE([obsolete],
27277f6d8fe2Smrg             [$0: two- and three-arguments forms are deprecated.])
27287f6d8fe2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
27297f6d8fe2Smrg AC_SUBST([PACKAGE], [$1])dnl
27307f6d8fe2Smrg AC_SUBST([VERSION], [$2])],
27317f6d8fe2Smrg[_AM_SET_OPTIONS([$1])dnl
27327f6d8fe2Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27337f6d8fe2Smrgm4_if(
27347f6d8fe2Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
27357f6d8fe2Smrg  [ok:ok],,
27367f6d8fe2Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
27377f6d8fe2Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
27387f6d8fe2Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2739bda5b58fSmrg
27407f6d8fe2Smrg_AM_IF_OPTION([no-define],,
27417f6d8fe2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27427f6d8fe2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2743bda5b58fSmrg
27447f6d8fe2Smrg# Some tools Automake needs.
27457f6d8fe2SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
27467f6d8fe2SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27477f6d8fe2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27487f6d8fe2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27497f6d8fe2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27507f6d8fe2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27517f6d8fe2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27527f6d8fe2SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27537f6d8fe2SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27547f6d8fe2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27557f6d8fe2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
27567f6d8fe2Smrg# dies out for good.  For more background, see:
27577f6d8fe2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27587f6d8fe2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27597f6d8fe2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
27607f6d8fe2Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
27617f6d8fe2Smrg# system "awk" is bad on some platforms.
27627f6d8fe2SmrgAC_REQUIRE([AC_PROG_AWK])dnl
27637f6d8fe2SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
27647f6d8fe2SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
27657f6d8fe2Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27667f6d8fe2Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27677f6d8fe2Smrg			     [_AM_PROG_TAR([v7])])])
27687f6d8fe2Smrg_AM_IF_OPTION([no-dependencies],,
27697f6d8fe2Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27707f6d8fe2Smrg		  [_AM_DEPENDENCIES([CC])],
27717f6d8fe2Smrg		  [m4_define([AC_PROG_CC],
27727f6d8fe2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27737f6d8fe2SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27747f6d8fe2Smrg		  [_AM_DEPENDENCIES([CXX])],
27757f6d8fe2Smrg		  [m4_define([AC_PROG_CXX],
27767f6d8fe2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27777f6d8fe2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27787f6d8fe2Smrg		  [_AM_DEPENDENCIES([OBJC])],
27797f6d8fe2Smrg		  [m4_define([AC_PROG_OBJC],
27807f6d8fe2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27817f6d8fe2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27827f6d8fe2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27837f6d8fe2Smrg		  [m4_define([AC_PROG_OBJCXX],
27847f6d8fe2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27857f6d8fe2Smrg])
27867f6d8fe2Smrg# Variables for tags utilities; see am/tags.am
27877f6d8fe2Smrgif test -z "$CTAGS"; then
27887f6d8fe2Smrg  CTAGS=ctags
27895212f86fSmrgfi
27907f6d8fe2SmrgAC_SUBST([CTAGS])
27917f6d8fe2Smrgif test -z "$ETAGS"; then
27927f6d8fe2Smrg  ETAGS=etags
27935212f86fSmrgfi
27947f6d8fe2SmrgAC_SUBST([ETAGS])
27957f6d8fe2Smrgif test -z "$CSCOPE"; then
27967f6d8fe2Smrg  CSCOPE=cscope
27977f6d8fe2Smrgfi
27987f6d8fe2SmrgAC_SUBST([CSCOPE])
2799bda5b58fSmrg
28007f6d8fe2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
28017f6d8fe2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
28027f6d8fe2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
28037f6d8fe2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
28047f6d8fe2SmrgAC_CONFIG_COMMANDS_PRE(dnl
28057f6d8fe2Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
28067f6d8fe2Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2807bda5b58fSmrg
28087f6d8fe2Smrg# POSIX will say in a future version that running "rm -f" with no argument
28097f6d8fe2Smrg# is OK; and we want to be able to make that assumption in our Makefile
28107f6d8fe2Smrg# recipes.  So use an aggressive probe to check that the usage we want is
28117f6d8fe2Smrg# actually supported "in the wild" to an acceptable degree.
28127f6d8fe2Smrg# See automake bug#10828.
28137f6d8fe2Smrg# To make any issue more visible, cause the running configure to be aborted
28147f6d8fe2Smrg# by default if the 'rm' program in use doesn't match our expectations; the
28157f6d8fe2Smrg# user can still override this though.
28167f6d8fe2Smrgif rm -f && rm -fr && rm -rf; then : OK; else
28177f6d8fe2Smrg  cat >&2 <<'END'
28187f6d8fe2SmrgOops!
2819bda5b58fSmrg
28207f6d8fe2SmrgYour 'rm' program seems unable to run without file operands specified
28217f6d8fe2Smrgon the command line, even when the '-f' option is present.  This is contrary
28227f6d8fe2Smrgto the behaviour of most rm programs out there, and not conforming with
28237f6d8fe2Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
28247f6d8fe2Smrg
28257f6d8fe2SmrgPlease tell bug-automake@gnu.org about your system, including the value
28267f6d8fe2Smrgof your $PATH and any error possibly output before this message.  This
28277f6d8fe2Smrgcan help us improve future automake versions.
28287d5e3a19Smrg
28297f6d8fe2SmrgEND
28307f6d8fe2Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28317f6d8fe2Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28327f6d8fe2Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28337f6d8fe2Smrg    echo >&2
28347f6d8fe2Smrg  else
28357f6d8fe2Smrg    cat >&2 <<'END'
28367f6d8fe2SmrgAborting the configuration process, to ensure you take notice of the issue.
28377f6d8fe2Smrg
28387f6d8fe2SmrgYou can download and install GNU coreutils to get an 'rm' implementation
28397f6d8fe2Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28407f6d8fe2Smrg
28417f6d8fe2SmrgIf you want to complete the configuration process using your problematic
28427f6d8fe2Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28437f6d8fe2Smrgto "yes", and re-run configure.
28447f6d8fe2Smrg
28457f6d8fe2SmrgEND
28467f6d8fe2Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28477f6d8fe2Smrg  fi
28487d5e3a19Smrgfi
28497f6d8fe2Smrgdnl The trailing newline in this macro's definition is deliberate, for
28507f6d8fe2Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
28517f6d8fe2Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28527f6d8fe2Smrg])
28537d5e3a19Smrg
28547f6d8fe2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28557f6d8fe2Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28567f6d8fe2Smrgdnl mangled by Autoconf and run in a shell conditional statement.
28577f6d8fe2Smrgm4_define([_AC_COMPILER_EXEEXT],
28587f6d8fe2Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
285913e6bc1cSmrg
28607f6d8fe2Smrg# When config.status generates a header, we must update the stamp-h file.
28617f6d8fe2Smrg# This file resides in the same directory as the config header
28627f6d8fe2Smrg# that is generated.  The stamp files are numbered to have different names.
28637f6d8fe2Smrg
28647f6d8fe2Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
28657f6d8fe2Smrg# loop where config.status creates the headers, so we can generate
28667f6d8fe2Smrg# our stamp files there.
28677f6d8fe2SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
28687f6d8fe2Smrg[# Compute $1's index in $config_headers.
28697f6d8fe2Smrg_am_arg=$1
28707f6d8fe2Smrg_am_stamp_count=1
28717f6d8fe2Smrgfor _am_header in $config_headers :; do
28727f6d8fe2Smrg  case $_am_header in
28737f6d8fe2Smrg    $_am_arg | $_am_arg:* )
28747f6d8fe2Smrg      break ;;
28757f6d8fe2Smrg    * )
28767f6d8fe2Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
28777f6d8fe2Smrg  esac
28787f6d8fe2Smrgdone
28797f6d8fe2Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
28807f6d8fe2Smrg
28817f6d8fe2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
28827d5e3a19Smrg#
28837f6d8fe2Smrg# This file is free software; the Free Software Foundation
28847f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
28857f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
28867d5e3a19Smrg
28877f6d8fe2Smrg# AM_PROG_INSTALL_SH
28887f6d8fe2Smrg# ------------------
28897f6d8fe2Smrg# Define $install_sh.
28907f6d8fe2SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28917f6d8fe2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28927f6d8fe2Smrgif test x"${install_sh+set}" != xset; then
28937f6d8fe2Smrg  case $am_aux_dir in
28947f6d8fe2Smrg  *\ * | *\	*)
28957f6d8fe2Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28967f6d8fe2Smrg  *)
28977f6d8fe2Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28987f6d8fe2Smrg  esac
289913e6bc1cSmrgfi
29007f6d8fe2SmrgAC_SUBST([install_sh])])
2901765486e8Smrg
29027f6d8fe2Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
29037f6d8fe2Smrg#
29047f6d8fe2Smrg# This file is free software; the Free Software Foundation
29057f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
29067f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
29077f6d8fe2Smrg
29087f6d8fe2Smrg# Check whether the underlying file-system supports filenames
29097f6d8fe2Smrg# with a leading dot.  For instance MS-DOS doesn't.
29107f6d8fe2SmrgAC_DEFUN([AM_SET_LEADING_DOT],
29117f6d8fe2Smrg[rm -rf .tst 2>/dev/null
29127f6d8fe2Smrgmkdir .tst 2>/dev/null
29137f6d8fe2Smrgif test -d .tst; then
29147f6d8fe2Smrg  am__leading_dot=.
29157d5e3a19Smrgelse
29167f6d8fe2Smrg  am__leading_dot=_
29177d5e3a19Smrgfi
29187f6d8fe2Smrgrmdir .tst 2>/dev/null
29197f6d8fe2SmrgAC_SUBST([am__leading_dot])])
29207d5e3a19Smrg
29217f6d8fe2Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
29227d5e3a19Smrg
29237f6d8fe2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
29245212f86fSmrg#
29257f6d8fe2Smrg# This file is free software; the Free Software Foundation
29267f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
29277f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
2928bda5b58fSmrg
29297f6d8fe2Smrg# AM_MAKE_INCLUDE()
29307f6d8fe2Smrg# -----------------
29317f6d8fe2Smrg# Check whether make has an 'include' directive that can support all
29327f6d8fe2Smrg# the idioms we need for our automatic dependency tracking code.
29337f6d8fe2SmrgAC_DEFUN([AM_MAKE_INCLUDE],
29347f6d8fe2Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
29357f6d8fe2Smrgcat > confinc.mk << 'END'
29367f6d8fe2Smrgam__doit:
29377f6d8fe2Smrg	@echo this is the am__doit target >confinc.out
29387f6d8fe2Smrg.PHONY: am__doit
29397f6d8fe2SmrgEND
29407f6d8fe2Smrgam__include="#"
29417f6d8fe2Smrgam__quote=
29427f6d8fe2Smrg# BSD make does it like this.
29437f6d8fe2Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
29447f6d8fe2Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
29457f6d8fe2Smrgecho 'include confinc.mk # ignored' > confmf.GNU
29467f6d8fe2Smrg_am_result=no
29477f6d8fe2Smrgfor s in GNU BSD; do
29487f6d8fe2Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
29497f6d8fe2Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
29507f6d8fe2Smrg      ['0:this is the am__doit target'],
29517f6d8fe2Smrg      [AS_CASE([$s],
29527f6d8fe2Smrg          [BSD], [am__include='.include' am__quote='"'],
29537f6d8fe2Smrg          [am__include='include' am__quote=''])])
29547f6d8fe2Smrg  if test "$am__include" != "#"; then
29557f6d8fe2Smrg    _am_result="yes ($s style)"
29567f6d8fe2Smrg    break
29577f6d8fe2Smrg  fi
29587f6d8fe2Smrgdone
29597f6d8fe2Smrgrm -f confinc.* confmf.*
29607f6d8fe2SmrgAC_MSG_RESULT([${_am_result}])
29617f6d8fe2SmrgAC_SUBST([am__include])])
29627f6d8fe2SmrgAC_SUBST([am__quote])])
2963bda5b58fSmrg
29647f6d8fe2Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
29655212f86fSmrg
29667f6d8fe2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
29677f6d8fe2Smrg#
29687f6d8fe2Smrg# This file is free software; the Free Software Foundation
29697f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
29707f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
2971bda5b58fSmrg
29727f6d8fe2Smrg# AM_MISSING_PROG(NAME, PROGRAM)
29737f6d8fe2Smrg# ------------------------------
29747f6d8fe2SmrgAC_DEFUN([AM_MISSING_PROG],
29757f6d8fe2Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
29767f6d8fe2Smrg$1=${$1-"${am_missing_run}$2"}
29777f6d8fe2SmrgAC_SUBST($1)])
2978bda5b58fSmrg
29797f6d8fe2Smrg# AM_MISSING_HAS_RUN
29807f6d8fe2Smrg# ------------------
29817f6d8fe2Smrg# Define MISSING if not defined so far and test if it is modern enough.
29827f6d8fe2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29837f6d8fe2SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29847f6d8fe2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29857f6d8fe2SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29867f6d8fe2Smrgif test x"${MISSING+set}" != xset; then
29877f6d8fe2Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
29887f6d8fe2Smrgfi
29897f6d8fe2Smrg# Use eval to expand $SHELL
29907f6d8fe2Smrgif eval "$MISSING --is-lightweight"; then
29917f6d8fe2Smrg  am_missing_run="$MISSING "
29927f6d8fe2Smrgelse
29937f6d8fe2Smrg  am_missing_run=
29947f6d8fe2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
29957f6d8fe2Smrgfi
29967f6d8fe2Smrg])
2997bda5b58fSmrg
29987f6d8fe2Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2999bda5b58fSmrg
30007f6d8fe2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
30015212f86fSmrg#
30027f6d8fe2Smrg# This file is free software; the Free Software Foundation
30037f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
30047f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
3005bda5b58fSmrg
30067f6d8fe2Smrg# _AM_MANGLE_OPTION(NAME)
30077f6d8fe2Smrg# -----------------------
30087f6d8fe2SmrgAC_DEFUN([_AM_MANGLE_OPTION],
30097f6d8fe2Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
30105212f86fSmrg
30117f6d8fe2Smrg# _AM_SET_OPTION(NAME)
30127f6d8fe2Smrg# --------------------
30137f6d8fe2Smrg# Set option NAME.  Presently that only means defining a flag for this option.
30147f6d8fe2SmrgAC_DEFUN([_AM_SET_OPTION],
30157f6d8fe2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3016bda5b58fSmrg
30177f6d8fe2Smrg# _AM_SET_OPTIONS(OPTIONS)
30187f6d8fe2Smrg# ------------------------
30197f6d8fe2Smrg# OPTIONS is a space-separated list of Automake options.
30207f6d8fe2SmrgAC_DEFUN([_AM_SET_OPTIONS],
30217f6d8fe2Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
302213e6bc1cSmrg
30237f6d8fe2Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
30247f6d8fe2Smrg# -------------------------------------------
30257f6d8fe2Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
30267f6d8fe2SmrgAC_DEFUN([_AM_IF_OPTION],
30277f6d8fe2Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
302813e6bc1cSmrg
30297f6d8fe2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
30305212f86fSmrg#
30317f6d8fe2Smrg# This file is free software; the Free Software Foundation
30327f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
30337f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
3034bda5b58fSmrg
30357f6d8fe2Smrg# _AM_PROG_CC_C_O
303613e6bc1cSmrg# ---------------
30377f6d8fe2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30387f6d8fe2Smrg# to automatically call this.
30397f6d8fe2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
30407f6d8fe2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30417f6d8fe2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
30427f6d8fe2SmrgAC_LANG_PUSH([C])dnl
30437f6d8fe2SmrgAC_CACHE_CHECK(
30447f6d8fe2Smrg  [whether $CC understands -c and -o together],
30457f6d8fe2Smrg  [am_cv_prog_cc_c_o],
30467f6d8fe2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30477f6d8fe2Smrg  # Make sure it works both with $CC and with simple cc.
30487f6d8fe2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30497f6d8fe2Smrg  # compilers refuse to overwrite an existing .o file with -o,
30507f6d8fe2Smrg  # though they will create one.
30517f6d8fe2Smrg  am_cv_prog_cc_c_o=yes
30527f6d8fe2Smrg  for am_i in 1 2; do
30537f6d8fe2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30547f6d8fe2Smrg         && test -f conftest2.$ac_objext; then
30557f6d8fe2Smrg      : OK
30567f6d8fe2Smrg    else
30577f6d8fe2Smrg      am_cv_prog_cc_c_o=no
30587f6d8fe2Smrg      break
30597f6d8fe2Smrg    fi
30607f6d8fe2Smrg  done
30617f6d8fe2Smrg  rm -f core conftest*
30627f6d8fe2Smrg  unset am_i])
30637f6d8fe2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
30647f6d8fe2Smrg   # Losing compiler, so override with the script.
30657f6d8fe2Smrg   # FIXME: It is wrong to rewrite CC.
30667f6d8fe2Smrg   # But if we don't then we get into trouble of one sort or another.
30677f6d8fe2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
30687f6d8fe2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30697f6d8fe2Smrg   CC="$am_aux_dir/compile $CC"
30707f6d8fe2Smrgfi
30717f6d8fe2SmrgAC_LANG_POP([C])])
30727f6d8fe2Smrg
30737f6d8fe2Smrg# For backward compatibility.
30747f6d8fe2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30757f6d8fe2Smrg
30767f6d8fe2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
30775212f86fSmrg#
30787f6d8fe2Smrg# This file is free software; the Free Software Foundation
30797f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
30807f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
3081bda5b58fSmrg
30827f6d8fe2Smrg# AM_RUN_LOG(COMMAND)
30837f6d8fe2Smrg# -------------------
30847f6d8fe2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30857f6d8fe2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30867f6d8fe2SmrgAC_DEFUN([AM_RUN_LOG],
30877f6d8fe2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30887f6d8fe2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30897f6d8fe2Smrg   ac_status=$?
30907f6d8fe2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30917f6d8fe2Smrg   (exit $ac_status); }])
3092bda5b58fSmrg
30937f6d8fe2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
30945212f86fSmrg
30957f6d8fe2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
30967f6d8fe2Smrg#
30977f6d8fe2Smrg# This file is free software; the Free Software Foundation
30987f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
30997f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
31005212f86fSmrg
31017f6d8fe2Smrg# AM_SANITY_CHECK
31027f6d8fe2Smrg# ---------------
31037f6d8fe2SmrgAC_DEFUN([AM_SANITY_CHECK],
31047f6d8fe2Smrg[AC_MSG_CHECKING([whether build environment is sane])
31057f6d8fe2Smrg# Reject unsafe characters in $srcdir or the absolute working directory
31067f6d8fe2Smrg# name.  Accept space and tab only in the latter.
31077f6d8fe2Smrgam_lf='
31087f6d8fe2Smrg'
31097f6d8fe2Smrgcase `pwd` in
31107f6d8fe2Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
31117f6d8fe2Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
31127f6d8fe2Smrgesac
31137f6d8fe2Smrgcase $srcdir in
31147f6d8fe2Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31157f6d8fe2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31167f6d8fe2Smrgesac
31175212f86fSmrg
31187f6d8fe2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
31197f6d8fe2Smrg# arguments.  Must try -L first in case configure is actually a
31207f6d8fe2Smrg# symlink; some systems play weird games with the mod time of symlinks
31217f6d8fe2Smrg# (eg FreeBSD returns the mod time of the symlink's containing
31227f6d8fe2Smrg# directory).
31237f6d8fe2Smrgif (
31247f6d8fe2Smrg   am_has_slept=no
31257f6d8fe2Smrg   for am_try in 1 2; do
31267f6d8fe2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31277f6d8fe2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31287f6d8fe2Smrg     if test "$[*]" = "X"; then
31297f6d8fe2Smrg	# -L didn't work.
31307f6d8fe2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
31317f6d8fe2Smrg     fi
31327f6d8fe2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31337f6d8fe2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
31347f6d8fe2Smrg
31357f6d8fe2Smrg	# If neither matched, then we have a broken ls.  This can happen
31367f6d8fe2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31377f6d8fe2Smrg	# broken ls alias from the environment.  This has actually
31387f6d8fe2Smrg	# happened.  Such a system could not be considered "sane".
31397f6d8fe2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31407f6d8fe2Smrg  alias in your environment])
31417f6d8fe2Smrg     fi
31427f6d8fe2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31437f6d8fe2Smrg       break
31447f6d8fe2Smrg     fi
31457f6d8fe2Smrg     # Just in case.
31467f6d8fe2Smrg     sleep 1
31477f6d8fe2Smrg     am_has_slept=yes
31487f6d8fe2Smrg   done
31497f6d8fe2Smrg   test "$[2]" = conftest.file
31507f6d8fe2Smrg   )
31517f6d8fe2Smrgthen
31527f6d8fe2Smrg   # Ok.
31537f6d8fe2Smrg   :
31547f6d8fe2Smrgelse
31557f6d8fe2Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
31567f6d8fe2SmrgCheck your system clock])
31577f6d8fe2Smrgfi
31587f6d8fe2SmrgAC_MSG_RESULT([yes])
31597f6d8fe2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31607f6d8fe2Smrg# generated files are strictly newer.
31617f6d8fe2Smrgam_sleep_pid=
31627f6d8fe2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31637f6d8fe2Smrg  ( sleep 1 ) &
31647f6d8fe2Smrg  am_sleep_pid=$!
31655212f86fSmrgfi
31667f6d8fe2SmrgAC_CONFIG_COMMANDS_PRE(
31677f6d8fe2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31687f6d8fe2Smrg   if test -n "$am_sleep_pid"; then
31697f6d8fe2Smrg     # Hide warnings about reused PIDs.
31707f6d8fe2Smrg     wait $am_sleep_pid 2>/dev/null
31717f6d8fe2Smrg   fi
31727f6d8fe2Smrg   AC_MSG_RESULT([done])])
31737f6d8fe2Smrgrm -f conftest.file
317413e6bc1cSmrg])
3175bda5b58fSmrg
31767f6d8fe2Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
31775212f86fSmrg#
31787f6d8fe2Smrg# This file is free software; the Free Software Foundation
31797f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
31807f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
31815212f86fSmrg
31827f6d8fe2Smrg# AM_SILENT_RULES([DEFAULT])
31837f6d8fe2Smrg# --------------------------
31847f6d8fe2Smrg# Enable less verbose build rules; with the default set to DEFAULT
31857f6d8fe2Smrg# ("yes" being less verbose, "no" or empty being verbose).
31867f6d8fe2SmrgAC_DEFUN([AM_SILENT_RULES],
31877f6d8fe2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31887f6d8fe2SmrgAS_HELP_STRING(
31897f6d8fe2Smrg  [--enable-silent-rules],
31907f6d8fe2Smrg  [less verbose build output (undo: "make V=1")])
31917f6d8fe2SmrgAS_HELP_STRING(
31927f6d8fe2Smrg  [--disable-silent-rules],
31937f6d8fe2Smrg  [verbose build output (undo: "make V=0")])dnl
31947f6d8fe2Smrg])
31957f6d8fe2Smrgcase $enable_silent_rules in @%:@ (((
31967f6d8fe2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31977f6d8fe2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31987f6d8fe2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31997f6d8fe2Smrgesac
32007f6d8fe2Smrgdnl
32017f6d8fe2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
32027f6d8fe2Smrgdnl do not support nested variable expansions.
32037f6d8fe2Smrgdnl See automake bug#9928 and bug#10237.
32047f6d8fe2Smrgam_make=${MAKE-make}
32057f6d8fe2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
32067f6d8fe2Smrg   [am_cv_make_support_nested_variables],
32077f6d8fe2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
32087f6d8fe2SmrgBAR0=false
32097f6d8fe2SmrgBAR1=true
32107f6d8fe2SmrgV=1
32117f6d8fe2Smrgam__doit:
32127f6d8fe2Smrg	@$(TRUE)
32137f6d8fe2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
32147f6d8fe2Smrg  am_cv_make_support_nested_variables=yes
321513e6bc1cSmrgelse
32167f6d8fe2Smrg  am_cv_make_support_nested_variables=no
32177f6d8fe2Smrgfi])
32187f6d8fe2Smrgif test $am_cv_make_support_nested_variables = yes; then
32197f6d8fe2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32207f6d8fe2Smrg  AM_V='$(V)'
32217f6d8fe2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32227f6d8fe2Smrgelse
32237f6d8fe2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
32247f6d8fe2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
322513e6bc1cSmrgfi
32267f6d8fe2SmrgAC_SUBST([AM_V])dnl
32277f6d8fe2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
32287f6d8fe2SmrgAC_SUBST([AM_DEFAULT_V])dnl
32297f6d8fe2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32307f6d8fe2SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32317f6d8fe2SmrgAM_BACKSLASH='\'
32327f6d8fe2SmrgAC_SUBST([AM_BACKSLASH])dnl
32337f6d8fe2Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32347f6d8fe2Smrg])
323513e6bc1cSmrg
32367f6d8fe2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
32377f6d8fe2Smrg#
32387f6d8fe2Smrg# This file is free software; the Free Software Foundation
32397f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
32407f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
3241bda5b58fSmrg
32427f6d8fe2Smrg# AM_PROG_INSTALL_STRIP
32437f6d8fe2Smrg# ---------------------
32447f6d8fe2Smrg# One issue with vendor 'install' (even GNU) is that you can't
32457f6d8fe2Smrg# specify the program used to strip binaries.  This is especially
32467f6d8fe2Smrg# annoying in cross-compiling environments, where the build's strip
32477f6d8fe2Smrg# is unlikely to handle the host's binaries.
32487f6d8fe2Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32497f6d8fe2Smrg# always use install-sh in "make install-strip", and initialize
32507f6d8fe2Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
32517f6d8fe2SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
32527f6d8fe2Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32537f6d8fe2Smrg# Installed binaries are usually stripped using 'strip' when the user
32547f6d8fe2Smrg# run "make install-strip".  However 'strip' might not be the right
32557f6d8fe2Smrg# tool to use in cross-compilation environments, therefore Automake
32567f6d8fe2Smrg# will honor the 'STRIP' environment variable to overrule this program.
32577f6d8fe2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
32587f6d8fe2Smrgif test "$cross_compiling" != no; then
32597f6d8fe2Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
32605212f86fSmrgfi
32617f6d8fe2SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
32627f6d8fe2SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3263bda5b58fSmrg
32647f6d8fe2Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
3265765486e8Smrg#
32667f6d8fe2Smrg# This file is free software; the Free Software Foundation
32677f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
32687f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
32697f6d8fe2Smrg
32707f6d8fe2Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
32717f6d8fe2Smrg# ---------------------------
32727f6d8fe2Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
32737f6d8fe2Smrg# This macro is traced by Automake.
32747f6d8fe2SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
32757f6d8fe2Smrg
32767f6d8fe2Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32777f6d8fe2Smrg# --------------------------
32787f6d8fe2Smrg# Public sister of _AM_SUBST_NOTMAKE.
32797f6d8fe2SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3280b8414663Smrg
32817f6d8fe2Smrg# Check how to create a tarball.                            -*- Autoconf -*-
32827f6d8fe2Smrg
32837f6d8fe2Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
32845212f86fSmrg#
32857f6d8fe2Smrg# This file is free software; the Free Software Foundation
32867f6d8fe2Smrg# gives unlimited permission to copy and/or distribute it,
32877f6d8fe2Smrg# with or without modifications, as long as this notice is preserved.
32887f6d8fe2Smrg
32897f6d8fe2Smrg# _AM_PROG_TAR(FORMAT)
32907f6d8fe2Smrg# --------------------
32917f6d8fe2Smrg# Check how to create a tarball in format FORMAT.
32927f6d8fe2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32935212f86fSmrg#
32947f6d8fe2Smrg# Substitute a variable $(am__tar) that is a command
32957f6d8fe2Smrg# writing to stdout a FORMAT-tarball containing the directory
32967f6d8fe2Smrg# $tardir.
32977f6d8fe2Smrg#     tardir=directory && $(am__tar) > result.tar
32987f6d8fe2Smrg#
32997f6d8fe2Smrg# Substitute a variable $(am__untar) that extract such
33007f6d8fe2Smrg# a tarball read from stdin.
33017f6d8fe2Smrg#     $(am__untar) < result.tar
33027f6d8fe2Smrg#
33037f6d8fe2SmrgAC_DEFUN([_AM_PROG_TAR],
33047f6d8fe2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
33057f6d8fe2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
33067f6d8fe2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
33077d5e3a19Smrg
33087f6d8fe2Smrg# We'll loop over all known methods to create a tar archive until one works.
33097f6d8fe2Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
331013e6bc1cSmrg
33117f6d8fe2Smrgm4_if([$1], [v7],
33127f6d8fe2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
331313e6bc1cSmrg
33147f6d8fe2Smrg  [m4_case([$1],
33157f6d8fe2Smrg    [ustar],
33167f6d8fe2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33177f6d8fe2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33187f6d8fe2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33197f6d8fe2Smrg      # and bug#13588).
33207f6d8fe2Smrg      am_max_uid=2097151 # 2^21 - 1
33217f6d8fe2Smrg      am_max_gid=$am_max_uid
33227f6d8fe2Smrg      # The $UID and $GID variables are not portable, so we need to resort
33237f6d8fe2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33247f6d8fe2Smrg      # below are definitely unexpected, so allow the users to see them
33257f6d8fe2Smrg      # (that is, avoid stderr redirection).
33267f6d8fe2Smrg      am_uid=`id -u || echo unknown`
33277f6d8fe2Smrg      am_gid=`id -g || echo unknown`
33287f6d8fe2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33297f6d8fe2Smrg      if test $am_uid -le $am_max_uid; then
33307f6d8fe2Smrg         AC_MSG_RESULT([yes])
33317f6d8fe2Smrg      else
33327f6d8fe2Smrg         AC_MSG_RESULT([no])
33337f6d8fe2Smrg         _am_tools=none
33347f6d8fe2Smrg      fi
33357f6d8fe2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33367f6d8fe2Smrg      if test $am_gid -le $am_max_gid; then
33377f6d8fe2Smrg         AC_MSG_RESULT([yes])
33387f6d8fe2Smrg      else
33397f6d8fe2Smrg        AC_MSG_RESULT([no])
33407f6d8fe2Smrg        _am_tools=none
33417f6d8fe2Smrg      fi],
334213e6bc1cSmrg
33437f6d8fe2Smrg  [pax],
33447f6d8fe2Smrg    [],
334513e6bc1cSmrg
33467f6d8fe2Smrg  [m4_fatal([Unknown tar format])])
334713e6bc1cSmrg
33487f6d8fe2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
334913e6bc1cSmrg
33507f6d8fe2Smrg  # Go ahead even if we have the value already cached.  We do so because we
33517f6d8fe2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33527f6d8fe2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
335313e6bc1cSmrg
33547f6d8fe2Smrg  for _am_tool in $_am_tools; do
33557f6d8fe2Smrg    case $_am_tool in
33567f6d8fe2Smrg    gnutar)
33577f6d8fe2Smrg      for _am_tar in tar gnutar gtar; do
33587f6d8fe2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
33597f6d8fe2Smrg      done
33607f6d8fe2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33617f6d8fe2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33627f6d8fe2Smrg      am__untar="$_am_tar -xf -"
33637f6d8fe2Smrg      ;;
33647f6d8fe2Smrg    plaintar)
33657f6d8fe2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33667f6d8fe2Smrg      # ustar tarball either.
33677f6d8fe2Smrg      (tar --version) >/dev/null 2>&1 && continue
33687f6d8fe2Smrg      am__tar='tar chf - "$$tardir"'
33697f6d8fe2Smrg      am__tar_='tar chf - "$tardir"'
33707f6d8fe2Smrg      am__untar='tar xf -'
33717f6d8fe2Smrg      ;;
33727f6d8fe2Smrg    pax)
33737f6d8fe2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
33747f6d8fe2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33757f6d8fe2Smrg      am__untar='pax -r'
33767f6d8fe2Smrg      ;;
33777f6d8fe2Smrg    cpio)
33787f6d8fe2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33797f6d8fe2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33807f6d8fe2Smrg      am__untar='cpio -i -H $1 -d'
33817f6d8fe2Smrg      ;;
33827f6d8fe2Smrg    none)
33837f6d8fe2Smrg      am__tar=false
33847f6d8fe2Smrg      am__tar_=false
33857f6d8fe2Smrg      am__untar=false
33867f6d8fe2Smrg      ;;
33877f6d8fe2Smrg    esac
338813e6bc1cSmrg
33897f6d8fe2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33907f6d8fe2Smrg    # and am__untar set.
33917f6d8fe2Smrg    test -n "${am_cv_prog_tar_$1}" && break
339213e6bc1cSmrg
33937f6d8fe2Smrg    # tar/untar a dummy directory, and stop if the command works.
33947f6d8fe2Smrg    rm -rf conftest.dir
33957f6d8fe2Smrg    mkdir conftest.dir
33967f6d8fe2Smrg    echo GrepMe > conftest.dir/file
33977f6d8fe2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33987f6d8fe2Smrg    rm -rf conftest.dir
33997f6d8fe2Smrg    if test -s conftest.tar; then
34007f6d8fe2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
34017f6d8fe2Smrg      AM_RUN_LOG([cat conftest.dir/file])
34027f6d8fe2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
34037f6d8fe2Smrg    fi
34047f6d8fe2Smrg  done
34057f6d8fe2Smrg  rm -rf conftest.dir
34067f6d8fe2Smrg
34077f6d8fe2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
34087f6d8fe2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
34097f6d8fe2Smrg
34107f6d8fe2SmrgAC_SUBST([am__tar])
34117f6d8fe2SmrgAC_SUBST([am__untar])
34127f6d8fe2Smrg]) # _AM_PROG_TAR
34137d5e3a19Smrg
3414