10ea508b1Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2e6d5e4e0Smrg
30ea508b1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
47914d74bSmrg
57914d74bSmrg# This file is free software; the Free Software Foundation
67914d74bSmrg# gives unlimited permission to copy and/or distribute it,
77914d74bSmrg# with or without modifications, as long as this notice is preserved.
87914d74bSmrg
97914d74bSmrg# This program is distributed in the hope that it will be useful,
107914d74bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117914d74bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127914d74bSmrg# PARTICULAR PURPOSE.
137914d74bSmrg
14e6d5e4e0Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15e169010aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16e169010aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176b7436aeSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
186b7436aeSmrg[m4_warning([this file was generated for autoconf 2.71.
19e169010aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20e169010aSmrgIf you have problems, you may need to regenerate the build system entirely.
21e6d5e4e0SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227914d74bSmrg
236b7436aeSmrg# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
246b7436aeSmrg# serial 12 (pkg-config-0.29.2)
25e6d5e4e0Smrg
266b7436aeSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
276b7436aeSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
286b7436aeSmrgdnl
296b7436aeSmrgdnl This program is free software; you can redistribute it and/or modify
306b7436aeSmrgdnl it under the terms of the GNU General Public License as published by
316b7436aeSmrgdnl the Free Software Foundation; either version 2 of the License, or
326b7436aeSmrgdnl (at your option) any later version.
336b7436aeSmrgdnl
346b7436aeSmrgdnl This program is distributed in the hope that it will be useful, but
356b7436aeSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
366b7436aeSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376b7436aeSmrgdnl General Public License for more details.
386b7436aeSmrgdnl
396b7436aeSmrgdnl You should have received a copy of the GNU General Public License
406b7436aeSmrgdnl along with this program; if not, write to the Free Software
416b7436aeSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
426b7436aeSmrgdnl 02111-1307, USA.
436b7436aeSmrgdnl
446b7436aeSmrgdnl As a special exception to the GNU General Public License, if you
456b7436aeSmrgdnl distribute this file as part of a program that contains a
466b7436aeSmrgdnl configuration script generated by Autoconf, you may include it under
476b7436aeSmrgdnl the same distribution terms that you use for the rest of that
486b7436aeSmrgdnl program.
499d0ccd10Smrg
506b7436aeSmrgdnl PKG_PREREQ(MIN-VERSION)
516b7436aeSmrgdnl -----------------------
526b7436aeSmrgdnl Since: 0.29
536b7436aeSmrgdnl
546b7436aeSmrgdnl Verify that the version of the pkg-config macros are at least
556b7436aeSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
566b7436aeSmrgdnl installed version of pkg-config, this checks the developer's version
576b7436aeSmrgdnl of pkg.m4 when generating configure.
586b7436aeSmrgdnl
596b7436aeSmrgdnl To ensure that this macro is defined, also add:
606b7436aeSmrgdnl m4_ifndef([PKG_PREREQ],
616b7436aeSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
626b7436aeSmrgdnl
636b7436aeSmrgdnl See the "Since" comment for each macro you use to see what version
646b7436aeSmrgdnl of the macros you require.
656b7436aeSmrgm4_defun([PKG_PREREQ],
666b7436aeSmrg[m4_define([PKG_MACROS_VERSION], [0.29.2])
676b7436aeSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
686b7436aeSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
696b7436aeSmrg])dnl PKG_PREREQ
709d0ccd10Smrg
716b7436aeSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
726b7436aeSmrgdnl ----------------------------------
736b7436aeSmrgdnl Since: 0.16
746b7436aeSmrgdnl
756b7436aeSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
766b7436aeSmrgdnl first found in the path. Checks that the version of pkg-config found
776b7436aeSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
786b7436aeSmrgdnl used since that's the first version where most current features of
796b7436aeSmrgdnl pkg-config existed.
806b7436aeSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
816b7436aeSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
826b7436aeSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
836b7436aeSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
846b7436aeSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
856b7436aeSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
866b7436aeSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
879d0ccd10Smrg
886b7436aeSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
896b7436aeSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
906b7436aeSmrgfi
916b7436aeSmrgif test -n "$PKG_CONFIG"; then
926b7436aeSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
936b7436aeSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
946b7436aeSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
956b7436aeSmrg		AC_MSG_RESULT([yes])
966b7436aeSmrg	else
976b7436aeSmrg		AC_MSG_RESULT([no])
986b7436aeSmrg		PKG_CONFIG=""
996b7436aeSmrg	fi
1006b7436aeSmrgfi[]dnl
1016b7436aeSmrg])dnl PKG_PROG_PKG_CONFIG
102e169010aSmrg
1036b7436aeSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1046b7436aeSmrgdnl -------------------------------------------------------------------
1056b7436aeSmrgdnl Since: 0.18
1066b7436aeSmrgdnl
1076b7436aeSmrgdnl Check to see whether a particular set of modules exists. Similar to
1086b7436aeSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1096b7436aeSmrgdnl
1106b7436aeSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1116b7436aeSmrgdnl only at the first occurrence in configure.ac, so if the first place
1126b7436aeSmrgdnl it's called might be skipped (such as if it is within an "if", you
1136b7436aeSmrgdnl have to call PKG_CHECK_EXISTS manually
1146b7436aeSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1156b7436aeSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1166b7436aeSmrgif test -n "$PKG_CONFIG" && \
1176b7436aeSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1186b7436aeSmrg  m4_default([$2], [:])
1196b7436aeSmrgm4_ifvaln([$3], [else
1206b7436aeSmrg  $3])dnl
1216b7436aeSmrgfi])
1229d0ccd10Smrg
1236b7436aeSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1246b7436aeSmrgdnl ---------------------------------------------
1256b7436aeSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1266b7436aeSmrgdnl pkg_failed based on the result.
1276b7436aeSmrgm4_define([_PKG_CONFIG],
1286b7436aeSmrg[if test -n "$$1"; then
1296b7436aeSmrg    pkg_cv_[]$1="$$1"
1306b7436aeSmrg elif test -n "$PKG_CONFIG"; then
1316b7436aeSmrg    PKG_CHECK_EXISTS([$3],
1326b7436aeSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1336b7436aeSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1346b7436aeSmrg		     [pkg_failed=yes])
1356b7436aeSmrg else
1366b7436aeSmrg    pkg_failed=untried
1376b7436aeSmrgfi[]dnl
1386b7436aeSmrg])dnl _PKG_CONFIG
1399d0ccd10Smrg
1406b7436aeSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1416b7436aeSmrgdnl ---------------------------
1426b7436aeSmrgdnl Internal check to see if pkg-config supports short errors.
1436b7436aeSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1446b7436aeSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1456b7436aeSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1466b7436aeSmrg        _pkg_short_errors_supported=yes
1470ea508b1Smrgelse
1486b7436aeSmrg        _pkg_short_errors_supported=no
1496b7436aeSmrgfi[]dnl
1506b7436aeSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1519d0ccd10Smrg
1527914d74bSmrg
1536b7436aeSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1546b7436aeSmrgdnl   [ACTION-IF-NOT-FOUND])
1556b7436aeSmrgdnl --------------------------------------------------------------
1566b7436aeSmrgdnl Since: 0.4.0
1576b7436aeSmrgdnl
1586b7436aeSmrgdnl Note that if there is a possibility the first call to
1596b7436aeSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1606b7436aeSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1616b7436aeSmrgAC_DEFUN([PKG_CHECK_MODULES],
1626b7436aeSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1636b7436aeSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1646b7436aeSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1657914d74bSmrg
1666b7436aeSmrgpkg_failed=no
1676b7436aeSmrgAC_MSG_CHECKING([for $2])
168e169010aSmrg
1696b7436aeSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1706b7436aeSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1717914d74bSmrg
1726b7436aeSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1736b7436aeSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1746b7436aeSmrgSee the pkg-config man page for more details.])
1757914d74bSmrg
1766b7436aeSmrgif test $pkg_failed = yes; then
1776b7436aeSmrg        AC_MSG_RESULT([no])
1786b7436aeSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1796b7436aeSmrg        if test $_pkg_short_errors_supported = yes; then
1806b7436aeSmrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1816b7436aeSmrg        else
1826b7436aeSmrg                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1836b7436aeSmrg        fi
1846b7436aeSmrg        # Put the nasty error message in config.log where it belongs
1856b7436aeSmrg        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1867914d74bSmrg
1876b7436aeSmrg        m4_default([$4], [AC_MSG_ERROR(
1886b7436aeSmrg[Package requirements ($2) were not met:
1897914d74bSmrg
1906b7436aeSmrg$$1_PKG_ERRORS
1917914d74bSmrg
1926b7436aeSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1936b7436aeSmrginstalled software in a non-standard prefix.
1949d0ccd10Smrg
1956b7436aeSmrg_PKG_TEXT])[]dnl
1966b7436aeSmrg        ])
1976b7436aeSmrgelif test $pkg_failed = untried; then
1986b7436aeSmrg        AC_MSG_RESULT([no])
1996b7436aeSmrg        m4_default([$4], [AC_MSG_FAILURE(
2006b7436aeSmrg[The pkg-config script could not be found or is too old.  Make sure it
2016b7436aeSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2026b7436aeSmrgpath to pkg-config.
2037914d74bSmrg
2046b7436aeSmrg_PKG_TEXT
2056b7436aeSmrg
2066b7436aeSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2076b7436aeSmrg        ])
2080ea508b1Smrgelse
2096b7436aeSmrg        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2106b7436aeSmrg        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2116b7436aeSmrg        AC_MSG_RESULT([yes])
2126b7436aeSmrg        $3
2136b7436aeSmrgfi[]dnl
2146b7436aeSmrg])dnl PKG_CHECK_MODULES
215e8ead290Smrg
2167914d74bSmrg
2176b7436aeSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2186b7436aeSmrgdnl   [ACTION-IF-NOT-FOUND])
2196b7436aeSmrgdnl ---------------------------------------------------------------------
2206b7436aeSmrgdnl Since: 0.29
2216b7436aeSmrgdnl
2226b7436aeSmrgdnl Checks for existence of MODULES and gathers its build flags with
2236b7436aeSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2246b7436aeSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2256b7436aeSmrgdnl
2266b7436aeSmrgdnl Note that if there is a possibility the first call to
2276b7436aeSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2286b7436aeSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2296b7436aeSmrgdnl configure.ac.
2306b7436aeSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2316b7436aeSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2326b7436aeSmrg_save_PKG_CONFIG=$PKG_CONFIG
2336b7436aeSmrgPKG_CONFIG="$PKG_CONFIG --static"
2346b7436aeSmrgPKG_CHECK_MODULES($@)
2356b7436aeSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2366b7436aeSmrg])dnl PKG_CHECK_MODULES_STATIC
2377914d74bSmrg
238e8ead290Smrg
2396b7436aeSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2406b7436aeSmrgdnl -------------------------
2416b7436aeSmrgdnl Since: 0.27
2426b7436aeSmrgdnl
2436b7436aeSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2446b7436aeSmrgdnl should install pkg-config .pc files. By default the directory is
2456b7436aeSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2466b7436aeSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2476b7436aeSmrgdnl parameter.
2486b7436aeSmrgAC_DEFUN([PKG_INSTALLDIR],
2496b7436aeSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2506b7436aeSmrgm4_pushdef([pkg_description],
2516b7436aeSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2526b7436aeSmrgAC_ARG_WITH([pkgconfigdir],
2536b7436aeSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2546b7436aeSmrg    [with_pkgconfigdir=]pkg_default)
2556b7436aeSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2566b7436aeSmrgm4_popdef([pkg_default])
2576b7436aeSmrgm4_popdef([pkg_description])
2586b7436aeSmrg])dnl PKG_INSTALLDIR
259e6d5e4e0Smrg
260e6d5e4e0Smrg
2616b7436aeSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2626b7436aeSmrgdnl --------------------------------
2636b7436aeSmrgdnl Since: 0.27
2646b7436aeSmrgdnl
2656b7436aeSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2666b7436aeSmrgdnl module should install arch-independent pkg-config .pc files. By
2676b7436aeSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2686b7436aeSmrgdnl changed by passing DIRECTORY. The user can override through the
2696b7436aeSmrgdnl --with-noarch-pkgconfigdir parameter.
2706b7436aeSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2716b7436aeSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2726b7436aeSmrgm4_pushdef([pkg_description],
2736b7436aeSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2746b7436aeSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2756b7436aeSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2766b7436aeSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2776b7436aeSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2786b7436aeSmrgm4_popdef([pkg_default])
2796b7436aeSmrgm4_popdef([pkg_description])
2806b7436aeSmrg])dnl PKG_NOARCH_INSTALLDIR
281e8ead290Smrg
2827914d74bSmrg
2836b7436aeSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2846b7436aeSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2856b7436aeSmrgdnl -------------------------------------------
2866b7436aeSmrgdnl Since: 0.28
2876b7436aeSmrgdnl
2886b7436aeSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2896b7436aeSmrgAC_DEFUN([PKG_CHECK_VAR],
2906b7436aeSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2916b7436aeSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292e8ead290Smrg
2936b7436aeSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2946b7436aeSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
295e8ead290Smrg
2966b7436aeSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2976b7436aeSmrg])dnl PKG_CHECK_VAR
2987914d74bSmrg
2996b7436aeSmrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3006b7436aeSmrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
3016b7436aeSmrgdnl   [DESCRIPTION], [DEFAULT])
3026b7436aeSmrgdnl ------------------------------------------
3036b7436aeSmrgdnl
3046b7436aeSmrgdnl Prepare a "--with-" configure option using the lowercase
3056b7436aeSmrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
3066b7436aeSmrgdnl PKG_CHECK_MODULES in a single macro.
3076b7436aeSmrgAC_DEFUN([PKG_WITH_MODULES],
3086b7436aeSmrg[
3096b7436aeSmrgm4_pushdef([with_arg], m4_tolower([$1]))
3106b7436aeSmrg
3116b7436aeSmrgm4_pushdef([description],
3126b7436aeSmrg           [m4_default([$5], [build with ]with_arg[ support])])
3136b7436aeSmrg
3146b7436aeSmrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
3156b7436aeSmrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
3166b7436aeSmrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
3176b7436aeSmrg
3186b7436aeSmrgm4_case(def_arg,
3196b7436aeSmrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
3206b7436aeSmrg            [m4_pushdef([with_without],[--with-]with_arg)])
3216b7436aeSmrg
3226b7436aeSmrgAC_ARG_WITH(with_arg,
3236b7436aeSmrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
3246b7436aeSmrg    [AS_TR_SH([with_]with_arg)=def_arg])
3256b7436aeSmrg
3266b7436aeSmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
3276b7436aeSmrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
3286b7436aeSmrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
3296b7436aeSmrg                                        [m4_n([def_action_if_found]) $3],
3306b7436aeSmrg                                        [m4_n([def_action_if_not_found]) $4])])
3316b7436aeSmrg
3326b7436aeSmrgm4_popdef([with_arg])
3336b7436aeSmrgm4_popdef([description])
3346b7436aeSmrgm4_popdef([def_arg])
3356b7436aeSmrg
3366b7436aeSmrg])dnl PKG_WITH_MODULES
3376b7436aeSmrg
3386b7436aeSmrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3396b7436aeSmrgdnl   [DESCRIPTION], [DEFAULT])
3406b7436aeSmrgdnl -----------------------------------------------
3416b7436aeSmrgdnl
3426b7436aeSmrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
3436b7436aeSmrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
3446b7436aeSmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
3456b7436aeSmrg[
3466b7436aeSmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
3476b7436aeSmrg
3486b7436aeSmrgAM_CONDITIONAL([HAVE_][$1],
3496b7436aeSmrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
3506b7436aeSmrg])dnl PKG_HAVE_WITH_MODULES
3516b7436aeSmrg
3526b7436aeSmrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
3536b7436aeSmrgdnl   [DESCRIPTION], [DEFAULT])
3546b7436aeSmrgdnl ------------------------------------------------------
3556b7436aeSmrgdnl
3566b7436aeSmrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
3576b7436aeSmrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
3586b7436aeSmrgdnl and preprocessor variable.
3596b7436aeSmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
3606b7436aeSmrg[
3616b7436aeSmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
362c63293b5Smrg
3636b7436aeSmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
3646b7436aeSmrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
3656b7436aeSmrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
366c63293b5Smrg
3676b7436aeSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3686b7436aeSmrgdnl
3696b7436aeSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3706b7436aeSmrgdnl
3716b7436aeSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3726b7436aeSmrgdnl copy of this software and associated documentation files (the "Software"),
3736b7436aeSmrgdnl to deal in the Software without restriction, including without limitation
3746b7436aeSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3756b7436aeSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3766b7436aeSmrgdnl Software is furnished to do so, subject to the following conditions:
3776b7436aeSmrgdnl
3786b7436aeSmrgdnl The above copyright notice and this permission notice (including the next
3796b7436aeSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3806b7436aeSmrgdnl Software.
3816b7436aeSmrgdnl
3826b7436aeSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3836b7436aeSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3846b7436aeSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3856b7436aeSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3866b7436aeSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3876b7436aeSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3886b7436aeSmrgdnl DEALINGS IN THE SOFTWARE.
389e6d5e4e0Smrg
3906b7436aeSmrg# XORG_MACROS_VERSION(required-version)
3916b7436aeSmrg# -------------------------------------
3926b7436aeSmrg# Minimum version: 1.1.0
3936b7436aeSmrg#
3946b7436aeSmrg# If you're using a macro added in Version 1.1 or newer, include this in
3956b7436aeSmrg# your configure.ac with the minimum required version, such as:
3966b7436aeSmrg# XORG_MACROS_VERSION(1.1)
3976b7436aeSmrg#
3986b7436aeSmrg# To ensure that this macro is defined, also add:
3996b7436aeSmrg# m4_ifndef([XORG_MACROS_VERSION],
4006b7436aeSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4016b7436aeSmrg#
4026b7436aeSmrg#
4036b7436aeSmrg# See the "minimum version" comment for each macro you use to see what
4046b7436aeSmrg# version you require.
4056b7436aeSmrgm4_defun([XORG_MACROS_VERSION],[
4066b7436aeSmrgm4_define([vers_have], [1.19.3])
4076b7436aeSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4086b7436aeSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4096b7436aeSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4106b7436aeSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4116b7436aeSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4126b7436aeSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4136b7436aeSmrgm4_undefine([vers_have])
4146b7436aeSmrgm4_undefine([maj_have])
4156b7436aeSmrgm4_undefine([maj_needed])
4166b7436aeSmrg]) # XORG_MACROS_VERSION
4176b7436aeSmrg
4186b7436aeSmrg# XORG_PROG_RAWCPP()
4196b7436aeSmrg# ------------------
4206b7436aeSmrg# Minimum version: 1.0.0
4216b7436aeSmrg#
4226b7436aeSmrg# Find cpp program and necessary flags for use in pre-processing text files
4236b7436aeSmrg# such as man pages and config files
4246b7436aeSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4256b7436aeSmrgAC_REQUIRE([AC_PROG_CPP])
4266b7436aeSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
4276b7436aeSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
4286b7436aeSmrg
4296b7436aeSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4306b7436aeSmrg# which is not the best choice for supporting other OS'es, but covers most
4316b7436aeSmrg# of the ones we need for now.
4326b7436aeSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4336b7436aeSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4346b7436aeSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4356b7436aeSmrg	AC_MSG_RESULT([no])
4366b7436aeSmrgelse
4376b7436aeSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4386b7436aeSmrg		RAWCPPFLAGS=-undef
4396b7436aeSmrg		AC_MSG_RESULT([yes])
4406b7436aeSmrg	# under Cygwin unix is still defined even with -undef
4416b7436aeSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4426b7436aeSmrg		RAWCPPFLAGS="-undef -ansi"
4436b7436aeSmrg		AC_MSG_RESULT([yes, with -ansi])
4446b7436aeSmrg	else
4456b7436aeSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4466b7436aeSmrg	fi
4470ea508b1Smrgfi
4486b7436aeSmrgrm -f conftest.$ac_ext
449e6d5e4e0Smrg
4506b7436aeSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4516b7436aeSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4526b7436aeSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4536b7436aeSmrg	AC_MSG_RESULT([no])
4546b7436aeSmrgelse
4556b7436aeSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4566b7436aeSmrg		TRADITIONALCPPFLAGS="-traditional"
4576b7436aeSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4586b7436aeSmrg		AC_MSG_RESULT([yes])
4596b7436aeSmrg	else
4606b7436aeSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4616b7436aeSmrg	fi
4629d0ccd10Smrgfi
4636b7436aeSmrgrm -f conftest.$ac_ext
4646b7436aeSmrgAC_SUBST(RAWCPPFLAGS)
4656b7436aeSmrgAC_SUBST(TRADITIONALCPPFLAGS)
4666b7436aeSmrg]) # XORG_PROG_RAWCPP
467e6d5e4e0Smrg
4686b7436aeSmrg# XORG_MANPAGE_SECTIONS()
4696b7436aeSmrg# -----------------------
4706b7436aeSmrg# Minimum version: 1.0.0
4716b7436aeSmrg#
4726b7436aeSmrg# Determine which sections man pages go in for the different man page types
4736b7436aeSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4746b7436aeSmrg# Not sure if there's any better way than just hardcoding by OS name.
4756b7436aeSmrg# Override default settings by setting environment variables
4766b7436aeSmrg# Added MAN_SUBSTS in version 1.8
4776b7436aeSmrg# Added AC_PROG_SED in version 1.8
478c63293b5Smrg
4796b7436aeSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4806b7436aeSmrgAC_REQUIRE([AC_CANONICAL_HOST])
4816b7436aeSmrgAC_REQUIRE([AC_PROG_SED])
4827914d74bSmrg
4836b7436aeSmrgcase $host_os in
4846b7436aeSmrg    solaris*)
4856b7436aeSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
4866b7436aeSmrg        # check for a man page file found in later versions that use
4876b7436aeSmrg        # traditional section numbers instead
4886b7436aeSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
4896b7436aeSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
4906b7436aeSmrg        ;;
4916b7436aeSmrg    *) SYSV_MAN_SECTIONS=false ;;
4926b7436aeSmrgesac
4936b7436aeSmrg
4946b7436aeSmrgif test x$APP_MAN_SUFFIX = x    ; then
4956b7436aeSmrg    APP_MAN_SUFFIX=1
4969d0ccd10Smrgfi
4976b7436aeSmrgif test x$APP_MAN_DIR = x    ; then
4986b7436aeSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4990ea508b1Smrgfi
5007914d74bSmrg
5016b7436aeSmrgif test x$LIB_MAN_SUFFIX = x    ; then
5026b7436aeSmrg    LIB_MAN_SUFFIX=3
5036b7436aeSmrgfi
5046b7436aeSmrgif test x$LIB_MAN_DIR = x    ; then
5056b7436aeSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
5066b7436aeSmrgfi
5077914d74bSmrg
5086b7436aeSmrgif test x$FILE_MAN_SUFFIX = x    ; then
5096b7436aeSmrg    case $SYSV_MAN_SECTIONS in
5106b7436aeSmrg	true)				FILE_MAN_SUFFIX=4  ;;
5116b7436aeSmrg	*)				FILE_MAN_SUFFIX=5  ;;
5126b7436aeSmrg    esac
5136b7436aeSmrgfi
5146b7436aeSmrgif test x$FILE_MAN_DIR = x    ; then
5156b7436aeSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
5166b7436aeSmrgfi
5177914d74bSmrg
5186b7436aeSmrgif test x$MISC_MAN_SUFFIX = x    ; then
5196b7436aeSmrg    case $SYSV_MAN_SECTIONS in
5206b7436aeSmrg	true)				MISC_MAN_SUFFIX=5  ;;
5216b7436aeSmrg	*)				MISC_MAN_SUFFIX=7  ;;
5226b7436aeSmrg    esac
5236b7436aeSmrgfi
5246b7436aeSmrgif test x$MISC_MAN_DIR = x    ; then
5256b7436aeSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5266b7436aeSmrgfi
5277914d74bSmrg
5286b7436aeSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
5296b7436aeSmrg    case $SYSV_MAN_SECTIONS in
5306b7436aeSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
5316b7436aeSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5326b7436aeSmrg    esac
5336b7436aeSmrgfi
5346b7436aeSmrgif test x$DRIVER_MAN_DIR = x    ; then
5356b7436aeSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5369d0ccd10Smrgfi
537e6d5e4e0Smrg
5386b7436aeSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
5396b7436aeSmrg    case $SYSV_MAN_SECTIONS in
5406b7436aeSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
5416b7436aeSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5426b7436aeSmrg    esac
5436b7436aeSmrgfi
5446b7436aeSmrgif test x$ADMIN_MAN_DIR = x    ; then
5456b7436aeSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5466b7436aeSmrgfi
547e6d5e4e0Smrg
5487914d74bSmrg
5496b7436aeSmrgAC_SUBST([APP_MAN_SUFFIX])
5506b7436aeSmrgAC_SUBST([LIB_MAN_SUFFIX])
5516b7436aeSmrgAC_SUBST([FILE_MAN_SUFFIX])
5526b7436aeSmrgAC_SUBST([MISC_MAN_SUFFIX])
5536b7436aeSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5546b7436aeSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5556b7436aeSmrgAC_SUBST([APP_MAN_DIR])
5566b7436aeSmrgAC_SUBST([LIB_MAN_DIR])
5576b7436aeSmrgAC_SUBST([FILE_MAN_DIR])
5586b7436aeSmrgAC_SUBST([MISC_MAN_DIR])
5596b7436aeSmrgAC_SUBST([DRIVER_MAN_DIR])
5606b7436aeSmrgAC_SUBST([ADMIN_MAN_DIR])
561e6d5e4e0Smrg
5626b7436aeSmrgXORG_MAN_PAGE="X Version 11"
5636b7436aeSmrgAC_SUBST([XORG_MAN_PAGE])
5646b7436aeSmrgMAN_SUBSTS="\
5656b7436aeSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5666b7436aeSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5676b7436aeSmrg	-e 's|__xservername__|Xorg|g' \
5686b7436aeSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
5696b7436aeSmrg	-e 's|__projectroot__|\$(prefix)|g' \
5706b7436aeSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5716b7436aeSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5726b7436aeSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5736b7436aeSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5746b7436aeSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5756b7436aeSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5766b7436aeSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5776b7436aeSmrgAC_SUBST([MAN_SUBSTS])
578e6d5e4e0Smrg
5796b7436aeSmrg]) # XORG_MANPAGE_SECTIONS
580e169010aSmrg
5816b7436aeSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5826b7436aeSmrg# ------------------------
5836b7436aeSmrg# Minimum version: 1.7.0
5840ea508b1Smrg#
5856b7436aeSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5866b7436aeSmrg# provided by xorg-sgml-doctools, if installed.
5876b7436aeSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5886b7436aeSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5896b7436aeSmrgXORG_SGML_PATH=
5906b7436aeSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5916b7436aeSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5926b7436aeSmrg    [m4_ifval([$1],[:],
5936b7436aeSmrg        [if test x"$cross_compiling" != x"yes" ; then
5946b7436aeSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5956b7436aeSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5966b7436aeSmrg         fi])
5976b7436aeSmrg    ])
598e169010aSmrg
5996b7436aeSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6006b7436aeSmrg# the path and the name of the doc stylesheet
6016b7436aeSmrgif test "x$XORG_SGML_PATH" != "x" ; then
6026b7436aeSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6036b7436aeSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6046b7436aeSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6059d0ccd10Smrgelse
6066b7436aeSmrg   AC_MSG_RESULT([no])
6079d0ccd10Smrgfi
6087914d74bSmrg
6096b7436aeSmrgAC_SUBST(XORG_SGML_PATH)
6106b7436aeSmrgAC_SUBST(STYLESHEET_SRCDIR)
6116b7436aeSmrgAC_SUBST(XSL_STYLESHEET)
6126b7436aeSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6136b7436aeSmrg]) # XORG_CHECK_SGML_DOCTOOLS
6147914d74bSmrg
6156b7436aeSmrg# XORG_CHECK_LINUXDOC
6166b7436aeSmrg# -------------------
6176b7436aeSmrg# Minimum version: 1.0.0
6180ea508b1Smrg#
6196b7436aeSmrg# Defines the variable MAKE_TEXT if the necessary tools and
6206b7436aeSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6216b7436aeSmrg# Whether or not the necessary tools and files are found can be checked
6226b7436aeSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6236b7436aeSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6246b7436aeSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6256b7436aeSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
626e8ead290Smrg
6276b7436aeSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
6287914d74bSmrg
6296b7436aeSmrgAC_MSG_CHECKING([whether to build documentation])
6307914d74bSmrg
6316b7436aeSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6326b7436aeSmrg   BUILDDOC=yes
6336b7436aeSmrgelse
6346b7436aeSmrg   BUILDDOC=no
6356b7436aeSmrgfi
6367914d74bSmrg
6376b7436aeSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6387914d74bSmrg
6396b7436aeSmrgAC_MSG_RESULT([$BUILDDOC])
6406b7436aeSmrg
6416b7436aeSmrgAC_MSG_CHECKING([whether to build pdf documentation])
6426b7436aeSmrg
6436b7436aeSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6446b7436aeSmrg   BUILDPDFDOC=yes
6459d0ccd10Smrgelse
6466b7436aeSmrg   BUILDPDFDOC=no
6479d0ccd10Smrgfi
6487914d74bSmrg
6496b7436aeSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6507914d74bSmrg
6516b7436aeSmrgAC_MSG_RESULT([$BUILDPDFDOC])
6527914d74bSmrg
6536b7436aeSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6546b7436aeSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6556b7436aeSmrgMAKE_PDF="$PS2PDF"
6566b7436aeSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
6577914d74bSmrg
6586b7436aeSmrgAC_SUBST(MAKE_TEXT)
6596b7436aeSmrgAC_SUBST(MAKE_PS)
6606b7436aeSmrgAC_SUBST(MAKE_PDF)
6616b7436aeSmrgAC_SUBST(MAKE_HTML)
6626b7436aeSmrg]) # XORG_CHECK_LINUXDOC
6637914d74bSmrg
6646b7436aeSmrg# XORG_CHECK_DOCBOOK
6656b7436aeSmrg# -------------------
6666b7436aeSmrg# Minimum version: 1.0.0
6676b7436aeSmrg#
6686b7436aeSmrg# Checks for the ability to build output formats from SGML DocBook source.
6696b7436aeSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6706b7436aeSmrg# indicates whether the necessary tools and files are found and, if set,
6716b7436aeSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6726b7436aeSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6736b7436aeSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
674e169010aSmrg
6756b7436aeSmrgBUILDTXTDOC=no
6766b7436aeSmrgBUILDPDFDOC=no
6776b7436aeSmrgBUILDPSDOC=no
6786b7436aeSmrgBUILDHTMLDOC=no
679e8ead290Smrg
6806b7436aeSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6816b7436aeSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6826b7436aeSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6836b7436aeSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
684e8ead290Smrg
6856b7436aeSmrgAC_MSG_CHECKING([whether to build text documentation])
6866b7436aeSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6876b7436aeSmrg   test x$BUILD_TXTDOC != xno; then
6886b7436aeSmrg	BUILDTXTDOC=yes
689e6d5e4e0Smrgfi
6906b7436aeSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6916b7436aeSmrgAC_MSG_RESULT([$BUILDTXTDOC])
6929d0ccd10Smrg
6936b7436aeSmrgAC_MSG_CHECKING([whether to build PDF documentation])
6946b7436aeSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6956b7436aeSmrg   test x$BUILD_PDFDOC != xno; then
6966b7436aeSmrg	BUILDPDFDOC=yes
6976b7436aeSmrgfi
6986b7436aeSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6996b7436aeSmrgAC_MSG_RESULT([$BUILDPDFDOC])
7009d0ccd10Smrg
7016b7436aeSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7026b7436aeSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7036b7436aeSmrg   test x$BUILD_PSDOC != xno; then
7046b7436aeSmrg	BUILDPSDOC=yes
7056b7436aeSmrgfi
7066b7436aeSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7076b7436aeSmrgAC_MSG_RESULT([$BUILDPSDOC])
7089d0ccd10Smrg
7096b7436aeSmrgAC_MSG_CHECKING([whether to build HTML documentation])
7106b7436aeSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7116b7436aeSmrg   test x$BUILD_HTMLDOC != xno; then
7126b7436aeSmrg	BUILDHTMLDOC=yes
7136b7436aeSmrgfi
7146b7436aeSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7156b7436aeSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7167914d74bSmrg
7176b7436aeSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7186b7436aeSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7196b7436aeSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7206b7436aeSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
721e8ead290Smrg
7226b7436aeSmrgAC_SUBST(MAKE_TEXT)
7236b7436aeSmrgAC_SUBST(MAKE_PS)
7246b7436aeSmrgAC_SUBST(MAKE_PDF)
7256b7436aeSmrgAC_SUBST(MAKE_HTML)
7266b7436aeSmrg]) # XORG_CHECK_DOCBOOK
727e8ead290Smrg
7286b7436aeSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7296b7436aeSmrg# ----------------
7306b7436aeSmrg# Minimum version: 1.5.0
7316b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.11.0
7320ea508b1Smrg#
7336b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
7346b7436aeSmrg# not at the appropriate level. This macro enables a module to test for the
7356b7436aeSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
7366b7436aeSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7376b7436aeSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7386b7436aeSmrg# --with-xmlto assumes 'auto'.
7396b7436aeSmrg#
7406b7436aeSmrg# Interface to module:
7416b7436aeSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7426b7436aeSmrg# XMLTO:	returns the path of the xmlto program found
7436b7436aeSmrg#		returns the path set by the user in the environment
7446b7436aeSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7456b7436aeSmrg#		'no' user instructs the module not to use xmlto
7466b7436aeSmrg#
7476b7436aeSmrg# Added in version 1.10.0
7486b7436aeSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7496b7436aeSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7506b7436aeSmrg#
7516b7436aeSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7526b7436aeSmrg#
7536b7436aeSmrgAC_DEFUN([XORG_WITH_XMLTO],[
7546b7436aeSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7556b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
7566b7436aeSmrgAC_ARG_WITH(xmlto,
7576b7436aeSmrg	AS_HELP_STRING([--with-xmlto],
7586b7436aeSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7596b7436aeSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7606b7436aeSmrgm4_undefine([_defopt])
761e6d5e4e0Smrg
7626b7436aeSmrgif test "x$use_xmlto" = x"auto"; then
7636b7436aeSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7646b7436aeSmrg   if test "x$XMLTO" = "x"; then
7656b7436aeSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7666b7436aeSmrg	have_xmlto=no
7676b7436aeSmrg   else
7686b7436aeSmrg        have_xmlto=yes
7696b7436aeSmrg   fi
7706b7436aeSmrgelif test "x$use_xmlto" = x"yes" ; then
7716b7436aeSmrg   AC_PATH_PROG([XMLTO], [xmlto])
7726b7436aeSmrg   if test "x$XMLTO" = "x"; then
7736b7436aeSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7746b7436aeSmrg   fi
7756b7436aeSmrg   have_xmlto=yes
7766b7436aeSmrgelif test "x$use_xmlto" = x"no" ; then
7776b7436aeSmrg   if test "x$XMLTO" != "x"; then
7786b7436aeSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7796b7436aeSmrg   fi
7806b7436aeSmrg   have_xmlto=no
7816b7436aeSmrgelse
7826b7436aeSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7836b7436aeSmrgfi
784e6d5e4e0Smrg
7856b7436aeSmrg# Test for a minimum version of xmlto, if provided.
7866b7436aeSmrgm4_ifval([$1],
7876b7436aeSmrg[if test "$have_xmlto" = yes; then
7886b7436aeSmrg    # scrape the xmlto version
7896b7436aeSmrg    AC_MSG_CHECKING([the xmlto version])
7906b7436aeSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7916b7436aeSmrg    AC_MSG_RESULT([$xmlto_version])
7926b7436aeSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7936b7436aeSmrg        [if test "x$use_xmlto" = xauto; then
7946b7436aeSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7956b7436aeSmrg            have_xmlto=no
7966b7436aeSmrg        else
7976b7436aeSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7986b7436aeSmrg        fi])
7996b7436aeSmrgfi])
800e6d5e4e0Smrg
8016b7436aeSmrg# Test for the ability of xmlto to generate a text target
8020ea508b1Smrg#
8036b7436aeSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
8046b7436aeSmrg# following test for empty XML docbook files.
8056b7436aeSmrg# For compatibility reasons use the following empty XML docbook file and if
8066b7436aeSmrg# it fails try it again with a non-empty XML file.
8076b7436aeSmrghave_xmlto_text=no
8086b7436aeSmrgcat > conftest.xml << "EOF"
8096b7436aeSmrgEOF
8106b7436aeSmrgAS_IF([test "$have_xmlto" = yes],
8116b7436aeSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8126b7436aeSmrg             [have_xmlto_text=yes],
8136b7436aeSmrg             [# Try it again with a non-empty XML file.
8146b7436aeSmrg              cat > conftest.xml << "EOF"
8156b7436aeSmrg<x></x>
8166b7436aeSmrgEOF
8176b7436aeSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8186b7436aeSmrg                    [have_xmlto_text=yes],
8196b7436aeSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8206b7436aeSmrgrm -f conftest.xml
8216b7436aeSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8226b7436aeSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8236b7436aeSmrg]) # XORG_WITH_XMLTO
8246b7436aeSmrg
8256b7436aeSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8266b7436aeSmrg# --------------------------------------------
8276b7436aeSmrg# Minimum version: 1.12.0
8286b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.12.0
8290ea508b1Smrg#
8306b7436aeSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8316b7436aeSmrg# XML-based language used for the transformation of XML documents.
8326b7436aeSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8336b7436aeSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8346b7436aeSmrg# The XSLT processor is often used as a standalone tool for transformations.
8356b7436aeSmrg# It should not be assumed that this tool is used only to work with documnetation.
8366b7436aeSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8370ea508b1Smrg#
8386b7436aeSmrg# Interface to module:
8396b7436aeSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8406b7436aeSmrg# XSLTPROC:	 returns the path of the xsltproc program found
8416b7436aeSmrg#		 returns the path set by the user in the environment
8426b7436aeSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8436b7436aeSmrg#		  'no' user instructs the module not to use xsltproc
8446b7436aeSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8450ea508b1Smrg#
8466b7436aeSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8470ea508b1Smrg#
8486b7436aeSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8496b7436aeSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8506b7436aeSmrg# Preserves the interface, should it be implemented later
8516b7436aeSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8526b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
8536b7436aeSmrgAC_ARG_WITH(xsltproc,
8546b7436aeSmrg	AS_HELP_STRING([--with-xsltproc],
8556b7436aeSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8566b7436aeSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8576b7436aeSmrgm4_undefine([_defopt])
8589d0ccd10Smrg
8596b7436aeSmrgif test "x$use_xsltproc" = x"auto"; then
8606b7436aeSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8616b7436aeSmrg   if test "x$XSLTPROC" = "x"; then
8626b7436aeSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8636b7436aeSmrg	have_xsltproc=no
8646b7436aeSmrg   else
8656b7436aeSmrg        have_xsltproc=yes
8666b7436aeSmrg   fi
8676b7436aeSmrgelif test "x$use_xsltproc" = x"yes" ; then
8686b7436aeSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8696b7436aeSmrg   if test "x$XSLTPROC" = "x"; then
8706b7436aeSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8716b7436aeSmrg   fi
8726b7436aeSmrg   have_xsltproc=yes
8736b7436aeSmrgelif test "x$use_xsltproc" = x"no" ; then
8746b7436aeSmrg   if test "x$XSLTPROC" != "x"; then
8756b7436aeSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8766b7436aeSmrg   fi
8776b7436aeSmrg   have_xsltproc=no
8780ea508b1Smrgelse
8796b7436aeSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8800ea508b1Smrgfi
881e6d5e4e0Smrg
8826b7436aeSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8836b7436aeSmrg]) # XORG_WITH_XSLTPROC
884e6d5e4e0Smrg
8856b7436aeSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8866b7436aeSmrg# ----------------------------------------
8876b7436aeSmrg# Minimum version: 1.15.0
8880ea508b1Smrg#
8896b7436aeSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
8906b7436aeSmrg# scanning arbitrary text files, extracting information from those text files,
8916b7436aeSmrg# and printing reports based on that information.
8926b7436aeSmrg#
8936b7436aeSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8946b7436aeSmrg#
8956b7436aeSmrg# Interface to module:
8966b7436aeSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
8976b7436aeSmrg# PERL:	     returns the path of the perl program found
8986b7436aeSmrg#	     returns the path set by the user in the environment
8996b7436aeSmrg# --with-perl: 'yes' user instructs the module to use perl
9006b7436aeSmrg#	       'no' user instructs the module not to use perl
9016b7436aeSmrg# have_perl: returns yes if perl found in PATH or no
9026b7436aeSmrg#
9036b7436aeSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9046b7436aeSmrg#
9056b7436aeSmrgAC_DEFUN([XORG_WITH_PERL],[
9066b7436aeSmrgAC_ARG_VAR([PERL], [Path to perl command])
9076b7436aeSmrg# Preserves the interface, should it be implemented later
9086b7436aeSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9096b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
9106b7436aeSmrgAC_ARG_WITH(perl,
9116b7436aeSmrg	AS_HELP_STRING([--with-perl],
9126b7436aeSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9136b7436aeSmrg	   [use_perl=$withval], [use_perl=]_defopt)
9146b7436aeSmrgm4_undefine([_defopt])
915e6d5e4e0Smrg
9166b7436aeSmrgif test "x$use_perl" = x"auto"; then
9176b7436aeSmrg   AC_PATH_PROG([PERL], [perl])
9186b7436aeSmrg   if test "x$PERL" = "x"; then
9196b7436aeSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9206b7436aeSmrg	have_perl=no
9216b7436aeSmrg   else
9226b7436aeSmrg        have_perl=yes
9236b7436aeSmrg   fi
9246b7436aeSmrgelif test "x$use_perl" = x"yes" ; then
9256b7436aeSmrg   AC_PATH_PROG([PERL], [perl])
9266b7436aeSmrg   if test "x$PERL" = "x"; then
9276b7436aeSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9286b7436aeSmrg   fi
9296b7436aeSmrg   have_perl=yes
9306b7436aeSmrgelif test "x$use_perl" = x"no" ; then
9316b7436aeSmrg   if test "x$PERL" != "x"; then
9326b7436aeSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9336b7436aeSmrg   fi
9346b7436aeSmrg   have_perl=no
9356b7436aeSmrgelse
9366b7436aeSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9370ea508b1Smrgfi
938e6d5e4e0Smrg
9396b7436aeSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9406b7436aeSmrg]) # XORG_WITH_PERL
941e6d5e4e0Smrg
9426b7436aeSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9436b7436aeSmrg# ----------------
9446b7436aeSmrg# Minimum version: 1.5.0
9456b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9466b7436aeSmrg#
9476b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
9486b7436aeSmrg# not at the appropriate level. This macro enables a module to test for the
9496b7436aeSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9506b7436aeSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9516b7436aeSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9526b7436aeSmrg# --with-asciidoc assumes 'auto'.
9536b7436aeSmrg#
9546b7436aeSmrg# Interface to module:
9556b7436aeSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9566b7436aeSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
9576b7436aeSmrg#		 returns the path set by the user in the environment
9586b7436aeSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9596b7436aeSmrg#		  'no' user instructs the module not to use asciidoc
9606b7436aeSmrg#
9616b7436aeSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9626b7436aeSmrg#
9636b7436aeSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9646b7436aeSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9656b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
9666b7436aeSmrgAC_ARG_WITH(asciidoc,
9676b7436aeSmrg	AS_HELP_STRING([--with-asciidoc],
9686b7436aeSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9696b7436aeSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9706b7436aeSmrgm4_undefine([_defopt])
971e6d5e4e0Smrg
9726b7436aeSmrgif test "x$use_asciidoc" = x"auto"; then
9736b7436aeSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9746b7436aeSmrg   if test "x$ASCIIDOC" = "x"; then
9756b7436aeSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9766b7436aeSmrg	have_asciidoc=no
9776b7436aeSmrg   else
9786b7436aeSmrg        have_asciidoc=yes
9796b7436aeSmrg   fi
9806b7436aeSmrgelif test "x$use_asciidoc" = x"yes" ; then
9816b7436aeSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9826b7436aeSmrg   if test "x$ASCIIDOC" = "x"; then
9836b7436aeSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9846b7436aeSmrg   fi
9856b7436aeSmrg   have_asciidoc=yes
9866b7436aeSmrgelif test "x$use_asciidoc" = x"no" ; then
9876b7436aeSmrg   if test "x$ASCIIDOC" != "x"; then
9886b7436aeSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9896b7436aeSmrg   fi
9906b7436aeSmrg   have_asciidoc=no
9916b7436aeSmrgelse
9926b7436aeSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9930ea508b1Smrgfi
9946b7436aeSmrgm4_ifval([$1],
9956b7436aeSmrg[if test "$have_asciidoc" = yes; then
9966b7436aeSmrg    # scrape the asciidoc version
9976b7436aeSmrg    AC_MSG_CHECKING([the asciidoc version])
9986b7436aeSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9996b7436aeSmrg    AC_MSG_RESULT([$asciidoc_version])
10006b7436aeSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10016b7436aeSmrg        [if test "x$use_asciidoc" = xauto; then
10026b7436aeSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10036b7436aeSmrg            have_asciidoc=no
10046b7436aeSmrg        else
10056b7436aeSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10066b7436aeSmrg        fi])
10076b7436aeSmrgfi])
10086b7436aeSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10096b7436aeSmrg]) # XORG_WITH_ASCIIDOC
1010e6d5e4e0Smrg
10116b7436aeSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
10126b7436aeSmrg# -------------------------------------------
10136b7436aeSmrg# Minimum version: 1.5.0
10146b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10156b7436aeSmrg# Minimum version for optional DOT checking: 1.18.0
10166b7436aeSmrg#
10176b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
10186b7436aeSmrg# not at the appropriate level. This macro enables a module to test for the
10196b7436aeSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10206b7436aeSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
10216b7436aeSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10226b7436aeSmrg# --with-doxygen assumes 'auto'.
10236b7436aeSmrg#
10246b7436aeSmrg# Interface to module:
10256b7436aeSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10266b7436aeSmrg# DOXYGEN:	 returns the path of the doxygen program found
10276b7436aeSmrg#		 returns the path set by the user in the environment
10286b7436aeSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10296b7436aeSmrg#		  'no' user instructs the module not to use doxygen
10306b7436aeSmrg#
10316b7436aeSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10326b7436aeSmrg#
10336b7436aeSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10346b7436aeSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10356b7436aeSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10366b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
10376b7436aeSmrgAC_ARG_WITH(doxygen,
10386b7436aeSmrg	AS_HELP_STRING([--with-doxygen],
10396b7436aeSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10406b7436aeSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10416b7436aeSmrgm4_undefine([_defopt])
10427914d74bSmrg
10436b7436aeSmrgif test "x$use_doxygen" = x"auto"; then
10446b7436aeSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10456b7436aeSmrg   if test "x$DOXYGEN" = "x"; then
10466b7436aeSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10476b7436aeSmrg	have_doxygen=no
10486b7436aeSmrg   else
10496b7436aeSmrg        have_doxygen=yes
10506b7436aeSmrg   fi
10516b7436aeSmrgelif test "x$use_doxygen" = x"yes" ; then
10526b7436aeSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10536b7436aeSmrg   if test "x$DOXYGEN" = "x"; then
10546b7436aeSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10556b7436aeSmrg   fi
10566b7436aeSmrg   have_doxygen=yes
10576b7436aeSmrgelif test "x$use_doxygen" = x"no" ; then
10586b7436aeSmrg   if test "x$DOXYGEN" != "x"; then
10596b7436aeSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10606b7436aeSmrg   fi
10616b7436aeSmrg   have_doxygen=no
10626b7436aeSmrgelse
10636b7436aeSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10640ea508b1Smrgfi
10656b7436aeSmrgm4_ifval([$1],
10666b7436aeSmrg[if test "$have_doxygen" = yes; then
10676b7436aeSmrg    # scrape the doxygen version
10686b7436aeSmrg    AC_MSG_CHECKING([the doxygen version])
10696b7436aeSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10706b7436aeSmrg    AC_MSG_RESULT([$doxygen_version])
10716b7436aeSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10726b7436aeSmrg        [if test "x$use_doxygen" = xauto; then
10736b7436aeSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10746b7436aeSmrg            have_doxygen=no
10756b7436aeSmrg        else
10766b7436aeSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10776b7436aeSmrg        fi])
10786b7436aeSmrgfi])
1079e6d5e4e0Smrg
10806b7436aeSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10816b7436aeSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10826b7436aeSmrgdnl 	HAVE_DOT = @HAVE_DOT@
10836b7436aeSmrgHAVE_DOT=no
10846b7436aeSmrgif test "x$have_doxygen" = "xyes"; then
10856b7436aeSmrg  AC_PATH_PROG([DOT], [dot])
10866b7436aeSmrg    if test "x$DOT" != "x"; then
10876b7436aeSmrg      HAVE_DOT=yes
10886b7436aeSmrg    fi
10896b7436aeSmrgfi
1090e6d5e4e0Smrg
10916b7436aeSmrgAC_SUBST([HAVE_DOT])
10926b7436aeSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10936b7436aeSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10946b7436aeSmrg]) # XORG_WITH_DOXYGEN
10957914d74bSmrg
10966b7436aeSmrg# XORG_WITH_GROFF([DEFAULT])
10976b7436aeSmrg# ----------------
10986b7436aeSmrg# Minimum version: 1.6.0
10996b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11000ea508b1Smrg#
11016b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
11026b7436aeSmrg# not at the appropriate level. This macro enables a module to test for the
11036b7436aeSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11046b7436aeSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
11056b7436aeSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
11066b7436aeSmrg# --with-groff assumes 'auto'.
11076b7436aeSmrg#
11086b7436aeSmrg# Interface to module:
11096b7436aeSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11106b7436aeSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11116b7436aeSmrg# HAVE_GROFF_MS: the -ms macros package
11126b7436aeSmrg# GROFF:	 returns the path of the groff program found
11136b7436aeSmrg#		 returns the path set by the user in the environment
11146b7436aeSmrg# --with-groff:	 'yes' user instructs the module to use groff
11156b7436aeSmrg#		 'no' user instructs the module not to use groff
11166b7436aeSmrg#
11176b7436aeSmrg# Added in version 1.9.0:
11186b7436aeSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11196b7436aeSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11206b7436aeSmrg#		   psselect from the psutils package.
11216b7436aeSmrg#		   the ghostcript package. Refer to the grohtml man pages
11226b7436aeSmrg#
11236b7436aeSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11246b7436aeSmrg#
11256b7436aeSmrg# OS and distros often splits groff in a basic and full package, the former
11266b7436aeSmrg# having the groff program and the later having devices, fonts and macros
11276b7436aeSmrg# Checking for the groff executable is not enough.
11286b7436aeSmrg#
11296b7436aeSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
11306b7436aeSmrg# unset HAVE_GROFF or GROFF env variables.
11316b7436aeSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11326b7436aeSmrg#
11336b7436aeSmrgAC_DEFUN([XORG_WITH_GROFF],[
11346b7436aeSmrgAC_ARG_VAR([GROFF], [Path to groff command])
11356b7436aeSmrgm4_define([_defopt], m4_default([$1], [auto]))
11366b7436aeSmrgAC_ARG_WITH(groff,
11376b7436aeSmrg	AS_HELP_STRING([--with-groff],
11386b7436aeSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11396b7436aeSmrg	   [use_groff=$withval], [use_groff=]_defopt)
11406b7436aeSmrgm4_undefine([_defopt])
11417914d74bSmrg
11426b7436aeSmrgif test "x$use_groff" = x"auto"; then
11436b7436aeSmrg   AC_PATH_PROG([GROFF], [groff])
11446b7436aeSmrg   if test "x$GROFF" = "x"; then
11456b7436aeSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11466b7436aeSmrg	have_groff=no
11476b7436aeSmrg   else
11486b7436aeSmrg        have_groff=yes
11496b7436aeSmrg   fi
11506b7436aeSmrgelif test "x$use_groff" = x"yes" ; then
11516b7436aeSmrg   AC_PATH_PROG([GROFF], [groff])
11526b7436aeSmrg   if test "x$GROFF" = "x"; then
11536b7436aeSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11546b7436aeSmrg   fi
11556b7436aeSmrg   have_groff=yes
11566b7436aeSmrgelif test "x$use_groff" = x"no" ; then
11576b7436aeSmrg   if test "x$GROFF" != "x"; then
11586b7436aeSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11596b7436aeSmrg   fi
11606b7436aeSmrg   have_groff=no
11610ea508b1Smrgelse
11626b7436aeSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11630ea508b1Smrgfi
11647914d74bSmrg
11656b7436aeSmrg# We have groff, test for the presence of the macro packages
11666b7436aeSmrgif test "x$have_groff" = x"yes"; then
11676b7436aeSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11686b7436aeSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11696b7436aeSmrg        groff_ms_works=yes
11706b7436aeSmrg    else
11716b7436aeSmrg        groff_ms_works=no
11726b7436aeSmrg    fi
11736b7436aeSmrg    AC_MSG_RESULT([$groff_ms_works])
11746b7436aeSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11756b7436aeSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11766b7436aeSmrg        groff_mm_works=yes
11776b7436aeSmrg    else
11786b7436aeSmrg        groff_mm_works=no
11796b7436aeSmrg    fi
11806b7436aeSmrg    AC_MSG_RESULT([$groff_mm_works])
11816b7436aeSmrgfi
11827914d74bSmrg
11836b7436aeSmrg# We have groff, test for HTML dependencies, one command per package
11846b7436aeSmrgif test "x$have_groff" = x"yes"; then
11856b7436aeSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11866b7436aeSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11876b7436aeSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11886b7436aeSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11896b7436aeSmrg      have_groff_html=yes
11906b7436aeSmrg   else
11916b7436aeSmrg      have_groff_html=no
11926b7436aeSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11936b7436aeSmrg   fi
11946b7436aeSmrgfi
1195e169010aSmrg
11966b7436aeSmrg# Set Automake conditionals for Makefiles
11976b7436aeSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11986b7436aeSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11996b7436aeSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12006b7436aeSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12016b7436aeSmrg]) # XORG_WITH_GROFF
12027914d74bSmrg
12036b7436aeSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12046b7436aeSmrg# ---------------------------------------
12056b7436aeSmrg# Minimum version: 1.6.0
12066b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.11.0
12076b7436aeSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12086b7436aeSmrg#
12096b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
12106b7436aeSmrg# not at the appropriate level. This macro enables a module to test for the
12116b7436aeSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12126b7436aeSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
12136b7436aeSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
12146b7436aeSmrg# --with-fop assumes 'auto'.
12156b7436aeSmrg#
12166b7436aeSmrg# Interface to module:
12176b7436aeSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12186b7436aeSmrg# FOP:	 	returns the path of the fop program found
12196b7436aeSmrg#		returns the path set by the user in the environment
12206b7436aeSmrg# --with-fop: 	'yes' user instructs the module to use fop
12216b7436aeSmrg#		'no' user instructs the module not to use fop
12226b7436aeSmrg#
12236b7436aeSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12246b7436aeSmrg#
12256b7436aeSmrgAC_DEFUN([XORG_WITH_FOP],[
12266b7436aeSmrgAC_ARG_VAR([FOP], [Path to fop command])
12276b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
12286b7436aeSmrgAC_ARG_WITH(fop,
12296b7436aeSmrg	AS_HELP_STRING([--with-fop],
12306b7436aeSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12316b7436aeSmrg	   [use_fop=$withval], [use_fop=]_defopt)
12326b7436aeSmrgm4_undefine([_defopt])
12337914d74bSmrg
12346b7436aeSmrgif test "x$use_fop" = x"auto"; then
12356b7436aeSmrg   AC_PATH_PROG([FOP], [fop])
12366b7436aeSmrg   if test "x$FOP" = "x"; then
12376b7436aeSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12386b7436aeSmrg	have_fop=no
12396b7436aeSmrg   else
12406b7436aeSmrg        have_fop=yes
12416b7436aeSmrg   fi
12426b7436aeSmrgelif test "x$use_fop" = x"yes" ; then
12436b7436aeSmrg   AC_PATH_PROG([FOP], [fop])
12446b7436aeSmrg   if test "x$FOP" = "x"; then
12456b7436aeSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12466b7436aeSmrg   fi
12476b7436aeSmrg   have_fop=yes
12486b7436aeSmrgelif test "x$use_fop" = x"no" ; then
12496b7436aeSmrg   if test "x$FOP" != "x"; then
12506b7436aeSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12516b7436aeSmrg   fi
12526b7436aeSmrg   have_fop=no
12530ea508b1Smrgelse
12546b7436aeSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12550ea508b1Smrgfi
12567914d74bSmrg
12576b7436aeSmrg# Test for a minimum version of fop, if provided.
12586b7436aeSmrgm4_ifval([$1],
12596b7436aeSmrg[if test "$have_fop" = yes; then
12606b7436aeSmrg    # scrape the fop version
12616b7436aeSmrg    AC_MSG_CHECKING([for fop minimum version])
12626b7436aeSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12636b7436aeSmrg    AC_MSG_RESULT([$fop_version])
12646b7436aeSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
12656b7436aeSmrg        [if test "x$use_fop" = xauto; then
12666b7436aeSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12676b7436aeSmrg            have_fop=no
12686b7436aeSmrg        else
12696b7436aeSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12706b7436aeSmrg        fi])
12716b7436aeSmrgfi])
12726b7436aeSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12736b7436aeSmrg]) # XORG_WITH_FOP
1274e6d5e4e0Smrg
12756b7436aeSmrg# XORG_WITH_M4([MIN-VERSION])
12766b7436aeSmrg# ---------------------------
12776b7436aeSmrg# Minimum version: 1.19.0
12786b7436aeSmrg#
12796b7436aeSmrg# This macro attempts to locate an m4 macro processor which supports
12806b7436aeSmrg# -I option and is only useful for modules relying on M4 in order to
12816b7436aeSmrg# expand macros in source code files.
12826b7436aeSmrg#
12836b7436aeSmrg# Interface to module:
12846b7436aeSmrg# M4:	 	returns the path of the m4 program found
12856b7436aeSmrg#		returns the path set by the user in the environment
12866b7436aeSmrg#
12876b7436aeSmrgAC_DEFUN([XORG_WITH_M4], [
12886b7436aeSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12896b7436aeSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12906b7436aeSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12916b7436aeSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12926b7436aeSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12936b7436aeSmrg   [$PATH:/usr/gnu/bin])])
1294e6d5e4e0Smrg
12956b7436aeSmrgAC_SUBST([M4], [$ac_cv_path_M4])
12966b7436aeSmrg]) # XORG_WITH_M4
12976b7436aeSmrg
12986b7436aeSmrg# XORG_WITH_PS2PDF([DEFAULT])
12996b7436aeSmrg# ----------------
13006b7436aeSmrg# Minimum version: 1.6.0
13016b7436aeSmrg# Minimum version for optional DEFAULT argument: 1.11.0
13026b7436aeSmrg#
13036b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
13046b7436aeSmrg# not at the appropriate level. This macro enables a module to test for the
13056b7436aeSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
13066b7436aeSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
13076b7436aeSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13086b7436aeSmrg# --with-ps2pdf assumes 'auto'.
13096b7436aeSmrg#
13106b7436aeSmrg# Interface to module:
13116b7436aeSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13126b7436aeSmrg# PS2PDF:	returns the path of the ps2pdf program found
13136b7436aeSmrg#		returns the path set by the user in the environment
13146b7436aeSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13156b7436aeSmrg#		 'no' user instructs the module not to use ps2pdf
13166b7436aeSmrg#
13176b7436aeSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13186b7436aeSmrg#
13196b7436aeSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13206b7436aeSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13216b7436aeSmrgm4_define([_defopt], m4_default([$1], [auto]))
13226b7436aeSmrgAC_ARG_WITH(ps2pdf,
13236b7436aeSmrg	AS_HELP_STRING([--with-ps2pdf],
13246b7436aeSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13256b7436aeSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13266b7436aeSmrgm4_undefine([_defopt])
1327e6d5e4e0Smrg
13286b7436aeSmrgif test "x$use_ps2pdf" = x"auto"; then
13296b7436aeSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13306b7436aeSmrg   if test "x$PS2PDF" = "x"; then
13316b7436aeSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13326b7436aeSmrg	have_ps2pdf=no
13336b7436aeSmrg   else
13346b7436aeSmrg        have_ps2pdf=yes
13356b7436aeSmrg   fi
13366b7436aeSmrgelif test "x$use_ps2pdf" = x"yes" ; then
13376b7436aeSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13386b7436aeSmrg   if test "x$PS2PDF" = "x"; then
13396b7436aeSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13406b7436aeSmrg   fi
13416b7436aeSmrg   have_ps2pdf=yes
13426b7436aeSmrgelif test "x$use_ps2pdf" = x"no" ; then
13436b7436aeSmrg   if test "x$PS2PDF" != "x"; then
13446b7436aeSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13456b7436aeSmrg   fi
13466b7436aeSmrg   have_ps2pdf=no
13470ea508b1Smrgelse
13486b7436aeSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13490ea508b1Smrgfi
13506b7436aeSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13516b7436aeSmrg]) # XORG_WITH_PS2PDF
13527914d74bSmrg
13536b7436aeSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
13546b7436aeSmrg# ----------------
13556b7436aeSmrg# Minimum version: 1.6.0
13566b7436aeSmrg#
13576b7436aeSmrg# Documentation tools are not always available on all platforms and sometimes
13586b7436aeSmrg# not at the appropriate level. This macro enables a builder to skip all
13596b7436aeSmrg# documentation targets except traditional man pages.
13606b7436aeSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13616b7436aeSmrg# maximum flexibilty in controlling documentation building.
13626b7436aeSmrg# Refer to:
13636b7436aeSmrg# XORG_WITH_XMLTO         --with-xmlto
13646b7436aeSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13656b7436aeSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13666b7436aeSmrg# XORG_WITH_FOP           --with-fop
13676b7436aeSmrg# XORG_WITH_GROFF         --with-groff
13686b7436aeSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
13696b7436aeSmrg#
13706b7436aeSmrg# Interface to module:
13716b7436aeSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13726b7436aeSmrg# --enable-docs: 'yes' user instructs the module to generate docs
13736b7436aeSmrg#		 'no' user instructs the module not to generate docs
13746b7436aeSmrg# parm1:	specify the default value, yes or no.
13756b7436aeSmrg#
13766b7436aeSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13776b7436aeSmrgm4_define([docs_default], m4_default([$1], [yes]))
13786b7436aeSmrgAC_ARG_ENABLE(docs,
13796b7436aeSmrg	AS_HELP_STRING([--enable-docs],
13806b7436aeSmrg	   [Enable building the documentation (default: ]docs_default[)]),
13816b7436aeSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
13826b7436aeSmrgm4_undefine([docs_default])
13836b7436aeSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13846b7436aeSmrgAC_MSG_CHECKING([whether to build documentation])
13856b7436aeSmrgAC_MSG_RESULT([$build_docs])
13866b7436aeSmrg]) # XORG_ENABLE_DOCS
1387e6d5e4e0Smrg
13886b7436aeSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13896b7436aeSmrg# ----------------
13906b7436aeSmrg# Minimum version: 1.6.0
13916b7436aeSmrg#
13926b7436aeSmrg# This macro enables a builder to skip all developer documentation.
13936b7436aeSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13946b7436aeSmrg# maximum flexibilty in controlling documentation building.
13956b7436aeSmrg# Refer to:
13966b7436aeSmrg# XORG_WITH_XMLTO         --with-xmlto
13976b7436aeSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13986b7436aeSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13996b7436aeSmrg# XORG_WITH_FOP           --with-fop
14006b7436aeSmrg# XORG_WITH_GROFF         --with-groff
14016b7436aeSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
14026b7436aeSmrg#
14036b7436aeSmrg# Interface to module:
14046b7436aeSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14056b7436aeSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14066b7436aeSmrg#			'no' user instructs the module not to generate developer docs
14076b7436aeSmrg# parm1:		specify the default value, yes or no.
14086b7436aeSmrg#
14096b7436aeSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14106b7436aeSmrgm4_define([devel_default], m4_default([$1], [yes]))
14116b7436aeSmrgAC_ARG_ENABLE(devel-docs,
14126b7436aeSmrg	AS_HELP_STRING([--enable-devel-docs],
14136b7436aeSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14146b7436aeSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14156b7436aeSmrgm4_undefine([devel_default])
14166b7436aeSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14176b7436aeSmrgAC_MSG_CHECKING([whether to build developer documentation])
14186b7436aeSmrgAC_MSG_RESULT([$build_devel_docs])
14196b7436aeSmrg]) # XORG_ENABLE_DEVEL_DOCS
14207914d74bSmrg
14216b7436aeSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
14226b7436aeSmrg# ----------------
14236b7436aeSmrg# Minimum version: 1.6.0
14240ea508b1Smrg#
14256b7436aeSmrg# This macro enables a builder to skip all functional specification targets.
14266b7436aeSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14276b7436aeSmrg# maximum flexibilty in controlling documentation building.
14286b7436aeSmrg# Refer to:
14296b7436aeSmrg# XORG_WITH_XMLTO         --with-xmlto
14306b7436aeSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14316b7436aeSmrg# XORG_WITH_DOXYGEN       --with-doxygen
14326b7436aeSmrg# XORG_WITH_FOP           --with-fop
14336b7436aeSmrg# XORG_WITH_GROFF         --with-groff
14346b7436aeSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
14356b7436aeSmrg#
14366b7436aeSmrg# Interface to module:
14376b7436aeSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14386b7436aeSmrg# --enable-specs:	'yes' user instructs the module to generate specs
14396b7436aeSmrg#			'no' user instructs the module not to generate specs
14406b7436aeSmrg# parm1:		specify the default value, yes or no.
14416b7436aeSmrg#
14426b7436aeSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14436b7436aeSmrgm4_define([spec_default], m4_default([$1], [yes]))
14446b7436aeSmrgAC_ARG_ENABLE(specs,
14456b7436aeSmrg	AS_HELP_STRING([--enable-specs],
14466b7436aeSmrg	   [Enable building the specs (default: ]spec_default[)]),
14476b7436aeSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
14486b7436aeSmrgm4_undefine([spec_default])
14496b7436aeSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14506b7436aeSmrgAC_MSG_CHECKING([whether to build functional specifications])
14516b7436aeSmrgAC_MSG_RESULT([$build_specs])
14526b7436aeSmrg]) # XORG_ENABLE_SPECS
14537914d74bSmrg
14546b7436aeSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14556b7436aeSmrg# ----------------------------------------------
14566b7436aeSmrg# Minimum version: 1.13.0
14576b7436aeSmrg#
14586b7436aeSmrg# This macro enables a builder to enable/disable unit testing
14596b7436aeSmrg# It makes no assumption about the test cases implementation
14606b7436aeSmrg# Test cases may or may not use Automake "Support for test suites"
14616b7436aeSmrg# They may or may not use the software utility library GLib
14626b7436aeSmrg#
14636b7436aeSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14646b7436aeSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14656b7436aeSmrg# The variable enable_unit_tests is used by other macros in this file.
14666b7436aeSmrg#
14676b7436aeSmrg# Interface to module:
14686b7436aeSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14696b7436aeSmrg# enable_unit_tests:    used in configure.ac for additional configuration
14706b7436aeSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14716b7436aeSmrg#			'no' user instructs the module not to build tests
14726b7436aeSmrg# parm1:		specify the default value, yes or no.
14736b7436aeSmrg#
14746b7436aeSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14756b7436aeSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14766b7436aeSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14776b7436aeSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14786b7436aeSmrgm4_define([_defopt], m4_default([$1], [auto]))
14796b7436aeSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14806b7436aeSmrg	[Enable building unit test cases (default: ]_defopt[)]),
14816b7436aeSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14826b7436aeSmrgm4_undefine([_defopt])
14836b7436aeSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14846b7436aeSmrgAC_MSG_CHECKING([whether to build unit test cases])
14856b7436aeSmrgAC_MSG_RESULT([$enable_unit_tests])
14866b7436aeSmrg]) # XORG_ENABLE_UNIT_TESTS
1487e6d5e4e0Smrg
14886b7436aeSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14896b7436aeSmrg# ------------------------------------------------------
14906b7436aeSmrg# Minimum version: 1.17.0
14916b7436aeSmrg#
14926b7436aeSmrg# This macro enables a builder to enable/disable integration testing
14936b7436aeSmrg# It makes no assumption about the test cases' implementation
14946b7436aeSmrg# Test cases may or may not use Automake "Support for test suites"
14956b7436aeSmrg#
14966b7436aeSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14976b7436aeSmrg# usually requires less dependencies and may be built and run under less
14986b7436aeSmrg# stringent environments than integration tests.
14996b7436aeSmrg#
15006b7436aeSmrg# Interface to module:
15016b7436aeSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15026b7436aeSmrg# enable_integration_tests:   used in configure.ac for additional configuration
15036b7436aeSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15046b7436aeSmrg#                             'no' user instructs the module not to build tests
15056b7436aeSmrg# parm1:                      specify the default value, yes or no.
15066b7436aeSmrg#
15076b7436aeSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15086b7436aeSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15096b7436aeSmrgm4_define([_defopt], m4_default([$1], [auto]))
15106b7436aeSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15116b7436aeSmrg	[Enable building integration test cases (default: ]_defopt[)]),
15126b7436aeSmrg	[enable_integration_tests=$enableval],
15136b7436aeSmrg	[enable_integration_tests=]_defopt)
15146b7436aeSmrgm4_undefine([_defopt])
15156b7436aeSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15166b7436aeSmrg	[test "x$enable_integration_tests" != xno])
15176b7436aeSmrgAC_MSG_CHECKING([whether to build unit test cases])
15186b7436aeSmrgAC_MSG_RESULT([$enable_integration_tests])
15196b7436aeSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
15207914d74bSmrg
15216b7436aeSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15226b7436aeSmrg# ----------------------------------------
15236b7436aeSmrg# Minimum version: 1.13.0
15246b7436aeSmrg#
15256b7436aeSmrg# GLib is a library which provides advanced data structures and functions.
15266b7436aeSmrg# This macro enables a module to test for the presence of Glib.
15276b7436aeSmrg#
15286b7436aeSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15296b7436aeSmrg# Otherwise the value of $enable_unit_tests is blank.
15306b7436aeSmrg#
15316b7436aeSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15326b7436aeSmrg# test support usually requires less dependencies and may be built and run under
15336b7436aeSmrg# less stringent environments than integration tests.
15346b7436aeSmrg#
15356b7436aeSmrg# Interface to module:
15366b7436aeSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
15376b7436aeSmrg# with_glib: used in configure.ac to know if GLib has been found
15386b7436aeSmrg# --with-glib:	'yes' user instructs the module to use glib
15396b7436aeSmrg#		'no' user instructs the module not to use glib
15406b7436aeSmrg#
15416b7436aeSmrgAC_DEFUN([XORG_WITH_GLIB],[
15426b7436aeSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15436b7436aeSmrgm4_define([_defopt], m4_default([$2], [auto]))
15446b7436aeSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15456b7436aeSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15466b7436aeSmrg	[with_glib=$withval], [with_glib=]_defopt)
15476b7436aeSmrgm4_undefine([_defopt])
15487914d74bSmrg
15496b7436aeSmrghave_glib=no
15506b7436aeSmrg# Do not probe GLib if user explicitly disabled unit testing
15516b7436aeSmrgif test "x$enable_unit_tests" != x"no"; then
15526b7436aeSmrg  # Do not probe GLib if user explicitly disabled it
15536b7436aeSmrg  if test "x$with_glib" != x"no"; then
15546b7436aeSmrg    m4_ifval(
15556b7436aeSmrg      [$1],
15566b7436aeSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15576b7436aeSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15586b7436aeSmrg    )
15596b7436aeSmrg  fi
15600ea508b1Smrgfi
15617914d74bSmrg
15626b7436aeSmrg# Not having GLib when unit testing has been explicitly requested is an error
15636b7436aeSmrgif test "x$enable_unit_tests" = x"yes"; then
15646b7436aeSmrg  if test "x$have_glib" = x"no"; then
15656b7436aeSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15666b7436aeSmrg  fi
15670ea508b1Smrgfi
1568e6d5e4e0Smrg
15696b7436aeSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
15706b7436aeSmrgif test "x$enable_unit_tests" = x"no"; then
15716b7436aeSmrg  if test "x$with_glib" = x"yes"; then
15726b7436aeSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15736b7436aeSmrg  fi
15740ea508b1Smrgfi
1575c63293b5Smrg
15766b7436aeSmrg# Not having GLib when it has been explicitly requested is an error
15776b7436aeSmrgif test "x$with_glib" = x"yes"; then
15786b7436aeSmrg  if test "x$have_glib" = x"no"; then
15796b7436aeSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15806b7436aeSmrg  fi
15816b7436aeSmrgfi
1582e169010aSmrg
15836b7436aeSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15846b7436aeSmrg]) # XORG_WITH_GLIB
1585e169010aSmrg
15866b7436aeSmrg# XORG_LD_WRAP([required|optional])
15876b7436aeSmrg# ---------------------------------
15886b7436aeSmrg# Minimum version: 1.13.0
1589e8ead290Smrg#
15906b7436aeSmrg# Check if linker supports -wrap, passed via compiler flags
15910ea508b1Smrg#
15926b7436aeSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15936b7436aeSmrg# Otherwise the value of $enable_unit_tests is blank.
15940ea508b1Smrg#
15956b7436aeSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15966b7436aeSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15976b7436aeSmrg# available, an argument of "optional" allows use when some unit tests require
15986b7436aeSmrg# ld -wrap and others do not.
15990ea508b1Smrg#
16006b7436aeSmrgAC_DEFUN([XORG_LD_WRAP],[
16016b7436aeSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16026b7436aeSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16036b7436aeSmrg                      void __wrap_exit(int status) { return; }],
16046b7436aeSmrg                     [exit(0);])])
16056b7436aeSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
16066b7436aeSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16076b7436aeSmrg  if test "x$have_ld_wrap" = x"no"; then
16086b7436aeSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16096b7436aeSmrg  fi
1610e6d5e4e0Smrgfi
16116b7436aeSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16120ea508b1Smrg#
16136b7436aeSmrg]) # XORG_LD_WRAP
1614e169010aSmrg
16156b7436aeSmrg# XORG_CHECK_LINKER_FLAGS
16166b7436aeSmrg# -----------------------
16176b7436aeSmrg# SYNOPSIS
16180ea508b1Smrg#
16196b7436aeSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16200ea508b1Smrg#
16216b7436aeSmrg# DESCRIPTION
16220ea508b1Smrg#
16236b7436aeSmrg#   Check whether the given linker FLAGS work with the current language's
16246b7436aeSmrg#   linker, or whether they give an error.
16250ea508b1Smrg#
16266b7436aeSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16276b7436aeSmrg#   success/failure.
16286b7436aeSmrg#
16296b7436aeSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
16306b7436aeSmrg#
16316b7436aeSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16326b7436aeSmrg#
16336b7436aeSmrg# LICENSE
16346b7436aeSmrg#
16356b7436aeSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16366b7436aeSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16376b7436aeSmrg#   Copyright (c) 2009 Matteo Frigo
16386b7436aeSmrg#
16396b7436aeSmrg#   This program is free software: you can redistribute it and/or modify it
16406b7436aeSmrg#   under the terms of the GNU General Public License as published by the
16416b7436aeSmrg#   Free Software Foundation, either version 3 of the License, or (at your
16426b7436aeSmrg#   option) any later version.
16436b7436aeSmrg#
16446b7436aeSmrg#   This program is distributed in the hope that it will be useful, but
16456b7436aeSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16466b7436aeSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16476b7436aeSmrg#   Public License for more details.
16486b7436aeSmrg#
16496b7436aeSmrg#   You should have received a copy of the GNU General Public License along
16506b7436aeSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16516b7436aeSmrg#
16526b7436aeSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
16536b7436aeSmrg#   gives unlimited permission to copy, distribute and modify the configure
16546b7436aeSmrg#   scripts that are the output of Autoconf when processing the Macro. You
16556b7436aeSmrg#   need not follow the terms of the GNU General Public License when using
16566b7436aeSmrg#   or distributing such scripts, even though portions of the text of the
16576b7436aeSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16586b7436aeSmrg#   all other use of the material that constitutes the Autoconf Macro.
16596b7436aeSmrg#
16606b7436aeSmrg#   This special exception to the GPL applies to versions of the Autoconf
16616b7436aeSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
16626b7436aeSmrg#   modified version of the Autoconf Macro, you may extend this special
16636b7436aeSmrg#   exception to the GPL to apply to your modified version as well.#
16646b7436aeSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16656b7436aeSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
16666b7436aeSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16676b7436aeSmrgAS_LITERAL_IF([$1],
16686b7436aeSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16696b7436aeSmrg      ax_save_FLAGS=$LDFLAGS
16706b7436aeSmrg      LDFLAGS="$1"
16716b7436aeSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16726b7436aeSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16736b7436aeSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16746b7436aeSmrg      LDFLAGS=$ax_save_FLAGS])],
16756b7436aeSmrg  [ax_save_FLAGS=$LDFLAGS
16766b7436aeSmrg   LDFLAGS="$1"
16776b7436aeSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16786b7436aeSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16796b7436aeSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16806b7436aeSmrg   LDFLAGS=$ax_save_FLAGS])
16816b7436aeSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16826b7436aeSmrgAC_MSG_RESULT($xorg_check_linker_flags)
16836b7436aeSmrgif test "x$xorg_check_linker_flags" = xyes; then
16846b7436aeSmrg	m4_default([$2], :)
1685e6d5e4e0Smrgelse
16866b7436aeSmrg	m4_default([$3], :)
1687e6d5e4e0Smrgfi
16886b7436aeSmrg]) # XORG_CHECK_LINKER_FLAGS
1689e169010aSmrg
16906b7436aeSmrg# XORG_MEMORY_CHECK_FLAGS
16916b7436aeSmrg# -----------------------
16926b7436aeSmrg# Minimum version: 1.16.0
16930ea508b1Smrg#
16946b7436aeSmrg# This macro attempts to find appropriate memory checking functionality
16956b7436aeSmrg# for various platforms which unit testing code may use to catch various
16966b7436aeSmrg# forms of memory allocation and access errors in testing.
16970ea508b1Smrg#
16980ea508b1Smrg# Interface to module:
16996b7436aeSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17006b7436aeSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17010ea508b1Smrg#
17026b7436aeSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17030ea508b1Smrg#
17046b7436aeSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1705e169010aSmrg
17066b7436aeSmrgAC_REQUIRE([AC_CANONICAL_HOST])
17076b7436aeSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17086b7436aeSmrg           [Environment variables to enable memory checking in tests])
17096b7436aeSmrg
17106b7436aeSmrg# Check for different types of support on different platforms
17116b7436aeSmrgcase $host_os in
17126b7436aeSmrg    solaris*)
17136b7436aeSmrg        AC_CHECK_LIB([umem], [umem_alloc],
17146b7436aeSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17156b7436aeSmrg        ;;
17166b7436aeSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17176b7436aeSmrg        # both directly and inverted, so should not be 0 or 255.
17186b7436aeSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
17196b7436aeSmrg        ;;
17206b7436aeSmrg    darwin*)
17216b7436aeSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17226b7436aeSmrg        ;;
17236b7436aeSmrg    *bsd*)
17246b7436aeSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17256b7436aeSmrg        ;;
17266b7436aeSmrgesac
17276b7436aeSmrg
17286b7436aeSmrg# User supplied flags override default flags
17296b7436aeSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17306b7436aeSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1731e6d5e4e0Smrgfi
1732e6d5e4e0Smrg
17336b7436aeSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17346b7436aeSmrg]) # XORG_WITH_LINT
1735e6d5e4e0Smrg
17366b7436aeSmrg# XORG_CHECK_MALLOC_ZERO
17376b7436aeSmrg# ----------------------
17386b7436aeSmrg# Minimum version: 1.0.0
17390ea508b1Smrg#
17406b7436aeSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17416b7436aeSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17426b7436aeSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17436b7436aeSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17446b7436aeSmrgAC_ARG_ENABLE(malloc0returnsnull,
17456b7436aeSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17466b7436aeSmrg		       [malloc(0) returns NULL (default: auto)]),
17476b7436aeSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17486b7436aeSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1749c63293b5Smrg
17506b7436aeSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17516b7436aeSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17526b7436aeSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17536b7436aeSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17546b7436aeSmrg#include <stdlib.h>
17556b7436aeSmrg],[
17566b7436aeSmrg    char *m0, *r0, *c0, *p;
17576b7436aeSmrg    m0 = malloc(0);
17586b7436aeSmrg    p = malloc(10);
17596b7436aeSmrg    r0 = realloc(p,0);
17606b7436aeSmrg    c0 = calloc(0,10);
17616b7436aeSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17626b7436aeSmrg])],
17636b7436aeSmrg		[xorg_cv_malloc0_returns_null=yes],
17646b7436aeSmrg		[xorg_cv_malloc0_returns_null=no])])
17656b7436aeSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
17666b7436aeSmrgfi
17676b7436aeSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17686b7436aeSmrg
17696b7436aeSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17706b7436aeSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17716b7436aeSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17726b7436aeSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17730ea508b1Smrgelse
17746b7436aeSmrg	MALLOC_ZERO_CFLAGS=""
17756b7436aeSmrg	XMALLOC_ZERO_CFLAGS=""
17766b7436aeSmrg	XTMALLOC_ZERO_CFLAGS=""
1777e6d5e4e0Smrgfi
1778e6d5e4e0Smrg
17796b7436aeSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17806b7436aeSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17816b7436aeSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17826b7436aeSmrg]) # XORG_CHECK_MALLOC_ZERO
17836b7436aeSmrg
17846b7436aeSmrg# XORG_WITH_LINT()
17856b7436aeSmrg# ----------------
17866b7436aeSmrg# Minimum version: 1.1.0
17870ea508b1Smrg#
17886b7436aeSmrg# This macro enables the use of a tool that flags some suspicious and
17896b7436aeSmrg# non-portable constructs (likely to be bugs) in C language source code.
17906b7436aeSmrg# It will attempt to locate the tool and use appropriate options.
17916b7436aeSmrg# There are various lint type tools on different platforms.
17920ea508b1Smrg#
17930ea508b1Smrg# Interface to module:
17946b7436aeSmrg# LINT:		returns the path to the tool found on the platform
17956b7436aeSmrg#		or the value set to LINT on the configure cmd line
17966b7436aeSmrg#		also an Automake conditional
17976b7436aeSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
17986b7436aeSmrg#
17996b7436aeSmrg# --with-lint:	'yes' user instructs the module to use lint
18006b7436aeSmrg#		'no' user instructs the module not to use lint (default)
18010ea508b1Smrg#
18026b7436aeSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18036b7436aeSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18040ea508b1Smrg#
18056b7436aeSmrgAC_DEFUN([XORG_WITH_LINT],[
1806e169010aSmrg
18076b7436aeSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18086b7436aeSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18096b7436aeSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18106b7436aeSmrg		[Use a lint-style source code checker (default: disabled)])],
18116b7436aeSmrg		[use_lint=$withval], [use_lint=no])
18126b7436aeSmrg
18136b7436aeSmrg# Obtain platform specific info like program name and options
18146b7436aeSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18156b7436aeSmrgcase $host_os in
18166b7436aeSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18176b7436aeSmrg	lint_name=splint
18186b7436aeSmrg	lint_options="-badflag"
18196b7436aeSmrg	;;
18206b7436aeSmrg  *freebsd* | *netbsd*)
18216b7436aeSmrg	lint_name=lint
18226b7436aeSmrg	lint_options="-u -b"
18236b7436aeSmrg	;;
18246b7436aeSmrg  *solaris*)
18256b7436aeSmrg	lint_name=lint
18266b7436aeSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18276b7436aeSmrg	;;
18286b7436aeSmrgesac
18296b7436aeSmrg
18306b7436aeSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18316b7436aeSmrgif test "x$use_lint" = x"yes" ; then
18326b7436aeSmrg   AC_PATH_PROG([LINT], [$lint_name])
18336b7436aeSmrg   if test "x$LINT" = "x"; then
18346b7436aeSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18350ea508b1Smrg   fi
18366b7436aeSmrgelif test "x$use_lint" = x"no" ; then
18376b7436aeSmrg   if test "x$LINT" != "x"; then
18386b7436aeSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18390ea508b1Smrg   fi
18400ea508b1Smrgelse
18416b7436aeSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1842e6d5e4e0Smrgfi
1843e169010aSmrg
18446b7436aeSmrg# User supplied flags override default flags
18456b7436aeSmrgif test "x$LINT_FLAGS" != "x"; then
18466b7436aeSmrg   lint_options=$LINT_FLAGS
1847e6d5e4e0Smrgfi
1848e169010aSmrg
18496b7436aeSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18506b7436aeSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1851e169010aSmrg
18526b7436aeSmrg]) # XORG_WITH_LINT
18536b7436aeSmrg
18546b7436aeSmrg# XORG_LINT_LIBRARY(LIBNAME)
18556b7436aeSmrg# --------------------------
18566b7436aeSmrg# Minimum version: 1.1.0
18570ea508b1Smrg#
18586b7436aeSmrg# Sets up flags for building lint libraries for checking programs that call
18596b7436aeSmrg# functions in the library.
18600ea508b1Smrg#
18610ea508b1Smrg# Interface to module:
18626b7436aeSmrg# LINTLIB		- Automake variable with the name of lint library file to make
18636b7436aeSmrg# MAKE_LINT_LIB		- Automake conditional
18640ea508b1Smrg#
18656b7436aeSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18666b7436aeSmrg#			  - 'no' user instructs the module not to create a lint library (default)
18676b7436aeSmrg
18686b7436aeSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18696b7436aeSmrgAC_REQUIRE([XORG_WITH_LINT])
18706b7436aeSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18716b7436aeSmrg	[Create lint library (default: disabled)])],
18726b7436aeSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18736b7436aeSmrg
18746b7436aeSmrgif test "x$make_lint_lib" = x"yes" ; then
18756b7436aeSmrg   LINTLIB=llib-l$1.ln
18766b7436aeSmrg   if test "x$LINT" = "x"; then
18776b7436aeSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18786b7436aeSmrg   fi
18796b7436aeSmrgelif test "x$make_lint_lib" != x"no" ; then
18806b7436aeSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18816b7436aeSmrgfi
18826b7436aeSmrg
18836b7436aeSmrgAC_SUBST(LINTLIB)
18846b7436aeSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18856b7436aeSmrg
18866b7436aeSmrg]) # XORG_LINT_LIBRARY
18876b7436aeSmrg
18886b7436aeSmrg# XORG_COMPILER_BRAND
18896b7436aeSmrg# -------------------
18906b7436aeSmrg# Minimum version: 1.14.0
18910ea508b1Smrg#
18926b7436aeSmrg# Checks for various brands of compilers and sets flags as appropriate:
18936b7436aeSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18946b7436aeSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18956b7436aeSmrg#   clang compiler - sets CLANGCC to "yes"
18966b7436aeSmrg#   Intel compiler - sets INTELCC to "yes"
18976b7436aeSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18980ea508b1Smrg#
18996b7436aeSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19006b7436aeSmrgAC_LANG_CASE(
19016b7436aeSmrg	[C], [
19026b7436aeSmrg		AC_REQUIRE([AC_PROG_CC_C99])
19036b7436aeSmrg	],
19046b7436aeSmrg	[C++], [
19056b7436aeSmrg		AC_REQUIRE([AC_PROG_CXX])
19066b7436aeSmrg	]
19076b7436aeSmrg)
19086b7436aeSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19096b7436aeSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19106b7436aeSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19116b7436aeSmrg]) # XORG_COMPILER_BRAND
19126b7436aeSmrg
19136b7436aeSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19146b7436aeSmrg# ---------------
19156b7436aeSmrg# Minimum version: 1.16.0
19160ea508b1Smrg#
19176b7436aeSmrg# Test if the compiler works when passed the given flag as a command line argument.
19186b7436aeSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
19196b7436aeSmrg# next flag in the list until there are no more options.
19200ea508b1Smrg#
19216b7436aeSmrg# Note that this does not guarantee that the compiler supports the flag as some
19226b7436aeSmrg# compilers will simply ignore arguments that they do not understand, but we do
19236b7436aeSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19246b7436aeSmrg# -Werror=unused-command-line-argument
19256b7436aeSmrg#
19266b7436aeSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19276b7436aeSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19286b7436aeSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1929e169010aSmrg
19306b7436aeSmrgAC_LANG_COMPILER_REQUIRE
19319d0ccd10Smrg
19326b7436aeSmrgAC_LANG_CASE(
19336b7436aeSmrg	[C], [
19346b7436aeSmrg		AC_REQUIRE([AC_PROG_CC_C99])
19356b7436aeSmrg		define([PREFIX], [C])
19366b7436aeSmrg		define([CACHE_PREFIX], [cc])
19376b7436aeSmrg		define([COMPILER], [$CC])
19386b7436aeSmrg	],
19396b7436aeSmrg	[C++], [
19406b7436aeSmrg		define([PREFIX], [CXX])
19416b7436aeSmrg		define([CACHE_PREFIX], [cxx])
19426b7436aeSmrg		define([COMPILER], [$CXX])
19436b7436aeSmrg	]
19446b7436aeSmrg)
19456b7436aeSmrg
19466b7436aeSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19476b7436aeSmrg
19486b7436aeSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19496b7436aeSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19506b7436aeSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19516b7436aeSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19526b7436aeSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19536b7436aeSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19546b7436aeSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19556b7436aeSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19566b7436aeSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19570ea508b1Smrgfi
19589d0ccd10Smrg
19596b7436aeSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19606b7436aeSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19616b7436aeSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19626b7436aeSmrg	fi
19636b7436aeSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19646b7436aeSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19656b7436aeSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19666b7436aeSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19676b7436aeSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19686b7436aeSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19696b7436aeSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19706b7436aeSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19719d0ccd10Smrgfi
19729d0ccd10Smrg
19736b7436aeSmrgfound="no"
19746b7436aeSmrgm4_foreach([flag], m4_cdr($@), [
19756b7436aeSmrg	if test $found = "no" ; then
19766b7436aeSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19776b7436aeSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19786b7436aeSmrg		fi
19799d0ccd10Smrg
19806b7436aeSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19816b7436aeSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19826b7436aeSmrg		fi
19836b7436aeSmrg
19846b7436aeSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19856b7436aeSmrg
19866b7436aeSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19876b7436aeSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19886b7436aeSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19896b7436aeSmrg		AC_CACHE_VAL($cacheid,
19906b7436aeSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19916b7436aeSmrg					     [eval $cacheid=yes],
19926b7436aeSmrg					     [eval $cacheid=no])])
19936b7436aeSmrg
19946b7436aeSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19956b7436aeSmrg
19966b7436aeSmrg		eval supported=\$$cacheid
19976b7436aeSmrg		AC_MSG_RESULT([$supported])
19986b7436aeSmrg		if test "$supported" = "yes" ; then
19996b7436aeSmrg			$1="$$1 ]flag["
20006b7436aeSmrg			found="yes"
20016b7436aeSmrg		fi
20026b7436aeSmrg	fi
20036b7436aeSmrg])
20046b7436aeSmrg]) # XORG_TESTSET_CFLAG
20056b7436aeSmrg
20066b7436aeSmrg# XORG_COMPILER_FLAGS
20076b7436aeSmrg# ---------------
20086b7436aeSmrg# Minimum version: 1.16.0
20099d0ccd10Smrg#
20106b7436aeSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20116b7436aeSmrg# arguments supported by the selected compiler which do NOT alter the generated
20126b7436aeSmrg# code.  These arguments will cause the compiler to print various warnings
20136b7436aeSmrg# during compilation AND turn a conservative set of warnings into errors.
2014e6d5e4e0Smrg#
20156b7436aeSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20166b7436aeSmrg# future versions of util-macros as options are added to new compilers.
2017e6d5e4e0Smrg#
20186b7436aeSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20196b7436aeSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2020e6d5e4e0Smrg
20216b7436aeSmrgAC_ARG_ENABLE(selective-werror,
20226b7436aeSmrg              AS_HELP_STRING([--disable-selective-werror],
20236b7436aeSmrg                             [Turn off selective compiler errors. (default: enabled)]),
20246b7436aeSmrg              [SELECTIVE_WERROR=$enableval],
20256b7436aeSmrg              [SELECTIVE_WERROR=yes])
20266b7436aeSmrg
20276b7436aeSmrgAC_LANG_CASE(
20286b7436aeSmrg        [C], [
20296b7436aeSmrg                define([PREFIX], [C])
20306b7436aeSmrg        ],
20316b7436aeSmrg        [C++], [
20326b7436aeSmrg                define([PREFIX], [CXX])
20336b7436aeSmrg        ]
20346b7436aeSmrg)
20356b7436aeSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20366b7436aeSmrgif test "x$SUNCC" = "xyes"; then
20376b7436aeSmrg    [BASE_]PREFIX[FLAGS]="-v"
20380ea508b1Smrgelse
20396b7436aeSmrg    [BASE_]PREFIX[FLAGS]=""
20400ea508b1Smrgfi
2041e6d5e4e0Smrg
20426b7436aeSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20436b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20446b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20456b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20466b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2047e169010aSmrg
20486b7436aeSmrgAC_LANG_CASE(
20496b7436aeSmrg	[C], [
20506b7436aeSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20516b7436aeSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20526b7436aeSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20536b7436aeSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20546b7436aeSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20556b7436aeSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20566b7436aeSmrg	]
20576b7436aeSmrg)
2058e169010aSmrg
20596b7436aeSmrg# This chunk adds additional warnings that could catch undesired effects.
20606b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20616b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20626b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20636b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20646b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20656b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20666b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2067e169010aSmrg
20686b7436aeSmrg# These are currently disabled because they are noisy.  They will be enabled
20696b7436aeSmrg# in the future once the codebase is sufficiently modernized to silence
20706b7436aeSmrg# them.  For now, I don't want them to drown out the other warnings.
20716b7436aeSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20726b7436aeSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20736b7436aeSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20746b7436aeSmrg
20756b7436aeSmrg# Turn some warnings into errors, so we don't accidently get successful builds
20766b7436aeSmrg# when there are problems that should be fixed.
20776b7436aeSmrg
20786b7436aeSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20796b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20806b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20816b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20826b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20836b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20846b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20856b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20866b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20876b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20886b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20896b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20906b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20916b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20920ea508b1Smrgelse
20936b7436aeSmrgAC_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])
20946b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20956b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20966b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20976b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20986b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20996b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21006b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21016b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21026b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21036b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21046b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21056b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21066b7436aeSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
21070ea508b1Smrgfi
2108e8ead290Smrg
21096b7436aeSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21106b7436aeSmrg]) # XORG_COMPILER_FLAGS
21116b7436aeSmrg
21126b7436aeSmrg# XORG_CWARNFLAGS
21136b7436aeSmrg# ---------------
21146b7436aeSmrg# Minimum version: 1.2.0
21156b7436aeSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2116e6d5e4e0Smrg#
21176b7436aeSmrg# Defines CWARNFLAGS to enable C compiler warnings.
21180ea508b1Smrg#
21196b7436aeSmrg# This function is deprecated because it defines -fno-strict-aliasing
21206b7436aeSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21216b7436aeSmrg# is needed, then it should be added explicitly in the module when
21226b7436aeSmrg# it is updated to use BASE_CFLAGS.
21230ea508b1Smrg#
21246b7436aeSmrgAC_DEFUN([XORG_CWARNFLAGS], [
21256b7436aeSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21266b7436aeSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21276b7436aeSmrgAC_LANG_CASE(
21286b7436aeSmrg	[C], [
21296b7436aeSmrg		CWARNFLAGS="$BASE_CFLAGS"
21306b7436aeSmrg		if  test "x$GCC" = xyes ; then
21316b7436aeSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21326b7436aeSmrg		fi
21336b7436aeSmrg		AC_SUBST(CWARNFLAGS)
21346b7436aeSmrg	]
21356b7436aeSmrg)
21366b7436aeSmrg]) # XORG_CWARNFLAGS
21377914d74bSmrg
21386b7436aeSmrg# XORG_STRICT_OPTION
21396b7436aeSmrg# -----------------------
21406b7436aeSmrg# Minimum version: 1.3.0
21410ea508b1Smrg#
21426b7436aeSmrg# Add configure option to enable strict compilation flags, such as treating
21436b7436aeSmrg# warnings as fatal errors.
21446b7436aeSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21456b7436aeSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21460ea508b1Smrg#
21476b7436aeSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21486b7436aeSmrg# when strict compilation is unconditionally desired.
21496b7436aeSmrgAC_DEFUN([XORG_STRICT_OPTION], [
21506b7436aeSmrgAC_REQUIRE([XORG_CWARNFLAGS])
21516b7436aeSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21526b7436aeSmrg
21536b7436aeSmrgAC_ARG_ENABLE(strict-compilation,
21546b7436aeSmrg			  AS_HELP_STRING([--enable-strict-compilation],
21556b7436aeSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21566b7436aeSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21576b7436aeSmrg
21586b7436aeSmrgAC_LANG_CASE(
21596b7436aeSmrg        [C], [
21606b7436aeSmrg                define([PREFIX], [C])
21616b7436aeSmrg        ],
21626b7436aeSmrg        [C++], [
21636b7436aeSmrg                define([PREFIX], [CXX])
21646b7436aeSmrg        ]
21656b7436aeSmrg)
21666b7436aeSmrg
21676b7436aeSmrg[STRICT_]PREFIX[FLAGS]=""
21686b7436aeSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21696b7436aeSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21706b7436aeSmrg
21716b7436aeSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21726b7436aeSmrg# activate it with -Werror, so we add it here explicitly.
21736b7436aeSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21746b7436aeSmrg
21756b7436aeSmrgif test "x$STRICT_COMPILE" = "xyes"; then
21766b7436aeSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21776b7436aeSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21786b7436aeSmrgfi
21796b7436aeSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21806b7436aeSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21816b7436aeSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21826b7436aeSmrg]) # XORG_STRICT_OPTION
21836b7436aeSmrg
21846b7436aeSmrg# XORG_DEFAULT_OPTIONS
21856b7436aeSmrg# --------------------
21866b7436aeSmrg# Minimum version: 1.3.0
21870ea508b1Smrg#
21886b7436aeSmrg# Defines default options for X.Org modules.
21896b7436aeSmrg#
21906b7436aeSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21916b7436aeSmrgAC_REQUIRE([AC_PROG_INSTALL])
21926b7436aeSmrgXORG_COMPILER_FLAGS
21936b7436aeSmrgXORG_CWARNFLAGS
21946b7436aeSmrgXORG_STRICT_OPTION
21956b7436aeSmrgXORG_RELEASE_VERSION
21966b7436aeSmrgXORG_CHANGELOG
21976b7436aeSmrgXORG_INSTALL
21986b7436aeSmrgXORG_MANPAGE_SECTIONS
21996b7436aeSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
22006b7436aeSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
22016b7436aeSmrg]) # XORG_DEFAULT_OPTIONS
22029d0ccd10Smrg
22036b7436aeSmrg# XORG_INSTALL()
22040ea508b1Smrg# ----------------
22056b7436aeSmrg# Minimum version: 1.4.0
22060ea508b1Smrg#
22076b7436aeSmrg# Defines the variable INSTALL_CMD as the command to copy
22086b7436aeSmrg# INSTALL from $prefix/share/util-macros.
22090ea508b1Smrg#
22106b7436aeSmrgAC_DEFUN([XORG_INSTALL], [
22116b7436aeSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22126b7436aeSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22136b7436aeSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22146b7436aeSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
22156b7436aeSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
22166b7436aeSmrgtouch \$(top_srcdir)/INSTALL; \
22176b7436aeSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22186b7436aeSmrgAC_SUBST([INSTALL_CMD])
22196b7436aeSmrg]) # XORG_INSTALL
22206b7436aeSmrgdnl Copyright 2005 Red Hat, Inc
22216b7436aeSmrgdnl
22226b7436aeSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22236b7436aeSmrgdnl documentation for any purpose is hereby granted without fee, provided that
22246b7436aeSmrgdnl the above copyright notice appear in all copies and that both that
22256b7436aeSmrgdnl copyright notice and this permission notice appear in supporting
22266b7436aeSmrgdnl documentation.
22276b7436aeSmrgdnl
22286b7436aeSmrgdnl The above copyright notice and this permission notice shall be included
22296b7436aeSmrgdnl in all copies or substantial portions of the Software.
22306b7436aeSmrgdnl
22316b7436aeSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22326b7436aeSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22336b7436aeSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22346b7436aeSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22356b7436aeSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22366b7436aeSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22376b7436aeSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
22386b7436aeSmrgdnl
22396b7436aeSmrgdnl Except as contained in this notice, the name of the copyright holders shall
22406b7436aeSmrgdnl not be used in advertising or otherwise to promote the sale, use or
22416b7436aeSmrgdnl other dealings in this Software without prior written authorization
22426b7436aeSmrgdnl from the copyright holders.
22436b7436aeSmrgdnl
22446b7436aeSmrg
22456b7436aeSmrg# XORG_RELEASE_VERSION
22466b7436aeSmrg# --------------------
22476b7436aeSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
22486b7436aeSmrg
22496b7436aeSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22506b7436aeSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22516b7436aeSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22526b7436aeSmrg		[Major version of this package])
22536b7436aeSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22546b7436aeSmrg	if test "x$PVM" = "x"; then
22556b7436aeSmrg		PVM="0"
22566b7436aeSmrg	fi
22576b7436aeSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22586b7436aeSmrg		[$PVM],
22596b7436aeSmrg		[Minor version of this package])
22606b7436aeSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22616b7436aeSmrg	if test "x$PVP" = "x"; then
22626b7436aeSmrg		PVP="0"
22636b7436aeSmrg	fi
22646b7436aeSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22656b7436aeSmrg		[$PVP],
22666b7436aeSmrg		[Patch version of this package])
22676b7436aeSmrg])
22689d0ccd10Smrg
22696b7436aeSmrg# XORG_CHANGELOG()
22706b7436aeSmrg# ----------------
22716b7436aeSmrg# Minimum version: 1.2.0
2272e6d5e4e0Smrg#
22736b7436aeSmrg# Defines the variable CHANGELOG_CMD as the command to generate
22746b7436aeSmrg# ChangeLog from git.
22750ea508b1Smrg#
22760ea508b1Smrg#
22776b7436aeSmrgAC_DEFUN([XORG_CHANGELOG], [
22786b7436aeSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22796b7436aeSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22806b7436aeSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
22816b7436aeSmrgtouch \$(top_srcdir)/ChangeLog; \
22826b7436aeSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22836b7436aeSmrgAC_SUBST([CHANGELOG_CMD])
22846b7436aeSmrg]) # XORG_CHANGELOG
22856b7436aeSmrg
22866b7436aeSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
22870ea508b1Smrg#
22886b7436aeSmrg# This file is free software; the Free Software Foundation
22896b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
22906b7436aeSmrg# with or without modifications, as long as this notice is preserved.
22919d0ccd10Smrg
22926b7436aeSmrg# AM_AUTOMAKE_VERSION(VERSION)
22936b7436aeSmrg# ----------------------------
22946b7436aeSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22956b7436aeSmrg# generated from the m4 files accompanying Automake X.Y.
22966b7436aeSmrg# (This private macro should not be called outside this file.)
22976b7436aeSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22986b7436aeSmrg[am__api_version='1.16'
22996b7436aeSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
23006b7436aeSmrgdnl require some minimum version.  Point them to the right macro.
23016b7436aeSmrgm4_if([$1], [1.16.5], [],
23026b7436aeSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
23036b7436aeSmrg])
23046b7436aeSmrg
23056b7436aeSmrg# _AM_AUTOCONF_VERSION(VERSION)
23066b7436aeSmrg# -----------------------------
23076b7436aeSmrg# aclocal traces this macro to find the Autoconf version.
23086b7436aeSmrg# This is a private macro too.  Using m4_define simplifies
23096b7436aeSmrg# the logic in aclocal, which can simply ignore this definition.
23106b7436aeSmrgm4_define([_AM_AUTOCONF_VERSION], [])
23116b7436aeSmrg
23126b7436aeSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
23136b7436aeSmrg# -------------------------------
23146b7436aeSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23156b7436aeSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
23166b7436aeSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
23176b7436aeSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
23186b7436aeSmrgm4_ifndef([AC_AUTOCONF_VERSION],
23196b7436aeSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23206b7436aeSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
23216b7436aeSmrg
23226b7436aeSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
23236b7436aeSmrg
23246b7436aeSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
23250ea508b1Smrg#
23266b7436aeSmrg# This file is free software; the Free Software Foundation
23276b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
23286b7436aeSmrg# with or without modifications, as long as this notice is preserved.
23296b7436aeSmrg
23306b7436aeSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23316b7436aeSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23326b7436aeSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
23330ea508b1Smrg#
23346b7436aeSmrg# Of course, Automake must honor this variable whenever it calls a
23356b7436aeSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
23366b7436aeSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
23376b7436aeSmrg# depending on how configure is run.  This is pretty annoying, since
23386b7436aeSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
23396b7436aeSmrg# source directory, any form will work fine, but in subdirectories a
23406b7436aeSmrg# relative path needs to be adjusted first.
23410ea508b1Smrg#
23426b7436aeSmrg# $ac_aux_dir/missing
23436b7436aeSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
23446b7436aeSmrg# $top_srcdir/$ac_aux_dir/missing
23456b7436aeSmrg#    fails if $ac_aux_dir is absolute,
23466b7436aeSmrg#    fails when called from a subdirectory in a VPATH build with
23476b7436aeSmrg#          a relative $ac_aux_dir
23480ea508b1Smrg#
23496b7436aeSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
23506b7436aeSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
23516b7436aeSmrg# harmless because $srcdir is '.', but things will broke when you
23526b7436aeSmrg# start a VPATH build or use an absolute $srcdir.
23530ea508b1Smrg#
23546b7436aeSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
23556b7436aeSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
23566b7436aeSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
23576b7436aeSmrg# and then we would define $MISSING as
23586b7436aeSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
23596b7436aeSmrg# This will work as long as MISSING is not called from configure, because
23606b7436aeSmrg# unfortunately $(top_srcdir) has no meaning in configure.
23616b7436aeSmrg# However there are other variables, like CC, which are often used in
23626b7436aeSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
23630ea508b1Smrg#
23646b7436aeSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
23656b7436aeSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
23666b7436aeSmrg# configured tree to be moved without reconfiguration.
23676b7436aeSmrg
23686b7436aeSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23696b7436aeSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23706b7436aeSmrg# Expand $ac_aux_dir to an absolute path.
23716b7436aeSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
23726b7436aeSmrg])
23736b7436aeSmrg
23746b7436aeSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
23756b7436aeSmrg
23766b7436aeSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
23770ea508b1Smrg#
23786b7436aeSmrg# This file is free software; the Free Software Foundation
23796b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
23806b7436aeSmrg# with or without modifications, as long as this notice is preserved.
23816b7436aeSmrg
23826b7436aeSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23836b7436aeSmrg# -------------------------------------
23846b7436aeSmrg# Define a conditional.
23856b7436aeSmrgAC_DEFUN([AM_CONDITIONAL],
23866b7436aeSmrg[AC_PREREQ([2.52])dnl
23876b7436aeSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23886b7436aeSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23896b7436aeSmrgAC_SUBST([$1_TRUE])dnl
23906b7436aeSmrgAC_SUBST([$1_FALSE])dnl
23916b7436aeSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23926b7436aeSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23936b7436aeSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23946b7436aeSmrgif $2; then
23956b7436aeSmrg  $1_TRUE=
23966b7436aeSmrg  $1_FALSE='#'
23976b7436aeSmrgelse
23986b7436aeSmrg  $1_TRUE='#'
23996b7436aeSmrg  $1_FALSE=
24006b7436aeSmrgfi
24016b7436aeSmrgAC_CONFIG_COMMANDS_PRE(
24026b7436aeSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
24036b7436aeSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
24046b7436aeSmrgUsually this means the macro was only invoked conditionally.]])
24056b7436aeSmrgfi])])
24066b7436aeSmrg
24076b7436aeSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2408e6d5e4e0Smrg#
24096b7436aeSmrg# This file is free software; the Free Software Foundation
24106b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
24116b7436aeSmrg# with or without modifications, as long as this notice is preserved.
24126b7436aeSmrg
24136b7436aeSmrg
24146b7436aeSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
24156b7436aeSmrg# written in clear, in which case automake, when reading aclocal.m4,
24166b7436aeSmrg# will think it sees a *use*, and therefore will trigger all it's
24176b7436aeSmrg# C support machinery.  Also note that it means that autoscan, seeing
24186b7436aeSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
24196b7436aeSmrg
24206b7436aeSmrg
24216b7436aeSmrg# _AM_DEPENDENCIES(NAME)
24226b7436aeSmrg# ----------------------
24236b7436aeSmrg# See how the compiler implements dependency checking.
24246b7436aeSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
24256b7436aeSmrg# We try a few techniques and use that to set a single cache variable.
24260ea508b1Smrg#
24276b7436aeSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
24286b7436aeSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
24296b7436aeSmrg# dependency, and given that the user is not expected to run this macro,
24306b7436aeSmrg# just rely on AC_PROG_CC.
24316b7436aeSmrgAC_DEFUN([_AM_DEPENDENCIES],
24326b7436aeSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
24336b7436aeSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
24346b7436aeSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
24356b7436aeSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
24366b7436aeSmrg
24376b7436aeSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24386b7436aeSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24396b7436aeSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24406b7436aeSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24416b7436aeSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24426b7436aeSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24436b7436aeSmrg                    [depcc="$$1"   am_compiler_list=])
24446b7436aeSmrg
24456b7436aeSmrgAC_CACHE_CHECK([dependency style of $depcc],
24466b7436aeSmrg               [am_cv_$1_dependencies_compiler_type],
24476b7436aeSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
24486b7436aeSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
24496b7436aeSmrg  # making bogus files that we don't know about and never remove.  For
24506b7436aeSmrg  # instance it was reported that on HP-UX the gcc test will end up
24516b7436aeSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24526b7436aeSmrg  # in D".
24536b7436aeSmrg  rm -rf conftest.dir
24546b7436aeSmrg  mkdir conftest.dir
24556b7436aeSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
24566b7436aeSmrg  # using a relative directory.
24576b7436aeSmrg  cp "$am_depcomp" conftest.dir
24586b7436aeSmrg  cd conftest.dir
24596b7436aeSmrg  # We will build objects and dependencies in a subdirectory because
24606b7436aeSmrg  # it helps to detect inapplicable dependency modes.  For instance
24616b7436aeSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
24626b7436aeSmrg  # side effect of compilation, but ICC will put the dependencies in
24636b7436aeSmrg  # the current directory while Tru64 will put them in the object
24646b7436aeSmrg  # directory.
24656b7436aeSmrg  mkdir sub
2466e169010aSmrg
24676b7436aeSmrg  am_cv_$1_dependencies_compiler_type=none
24686b7436aeSmrg  if test "$am_compiler_list" = ""; then
24696b7436aeSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24709d0ccd10Smrg  fi
24716b7436aeSmrg  am__universal=false
24726b7436aeSmrg  m4_case([$1], [CC],
24736b7436aeSmrg    [case " $depcc " in #(
24746b7436aeSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24756b7436aeSmrg     esac],
24766b7436aeSmrg    [CXX],
24776b7436aeSmrg    [case " $depcc " in #(
24786b7436aeSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24796b7436aeSmrg     esac])
24809d0ccd10Smrg
24816b7436aeSmrg  for depmode in $am_compiler_list; do
24826b7436aeSmrg    # Setup a source with many dependencies, because some compilers
24836b7436aeSmrg    # like to wrap large dependency lists on column 80 (with \), and
24846b7436aeSmrg    # we should not choose a depcomp mode which is confused by this.
24856b7436aeSmrg    #
24866b7436aeSmrg    # We need to recreate these files for each test, as the compiler may
24876b7436aeSmrg    # overwrite some of them when testing with obscure command lines.
24886b7436aeSmrg    # This happens at least with the AIX C compiler.
24896b7436aeSmrg    : > sub/conftest.c
24906b7436aeSmrg    for i in 1 2 3 4 5 6; do
24916b7436aeSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24926b7436aeSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24936b7436aeSmrg      # Solaris 10 /bin/sh.
24946b7436aeSmrg      echo '/* dummy */' > sub/conftst$i.h
24956b7436aeSmrg    done
24966b7436aeSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2497e169010aSmrg
24986b7436aeSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24996b7436aeSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25006b7436aeSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25016b7436aeSmrg    # versions had trouble with output in subdirs.
25026b7436aeSmrg    am__obj=sub/conftest.${OBJEXT-o}
25036b7436aeSmrg    am__minus_obj="-o $am__obj"
25046b7436aeSmrg    case $depmode in
25056b7436aeSmrg    gcc)
25066b7436aeSmrg      # This depmode causes a compiler race in universal mode.
25076b7436aeSmrg      test "$am__universal" = false || continue
25086b7436aeSmrg      ;;
25096b7436aeSmrg    nosideeffect)
25106b7436aeSmrg      # After this tag, mechanisms are not by side-effect, so they'll
25116b7436aeSmrg      # only be used when explicitly requested.
25126b7436aeSmrg      if test "x$enable_dependency_tracking" = xyes; then
25136b7436aeSmrg	continue
25146b7436aeSmrg      else
25156b7436aeSmrg	break
25166b7436aeSmrg      fi
25176b7436aeSmrg      ;;
25186b7436aeSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25196b7436aeSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25206b7436aeSmrg      # not run yet.  These depmodes are late enough in the game, and
25216b7436aeSmrg      # so weak that their functioning should not be impacted.
25226b7436aeSmrg      am__obj=conftest.${OBJEXT-o}
25236b7436aeSmrg      am__minus_obj=
25246b7436aeSmrg      ;;
25256b7436aeSmrg    none) break ;;
25266b7436aeSmrg    esac
25276b7436aeSmrg    if depmode=$depmode \
25286b7436aeSmrg       source=sub/conftest.c object=$am__obj \
25296b7436aeSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25306b7436aeSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
25316b7436aeSmrg         >/dev/null 2>conftest.err &&
25326b7436aeSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
25336b7436aeSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25346b7436aeSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
25356b7436aeSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
25366b7436aeSmrg      # icc doesn't choke on unknown options, it will just issue warnings
25376b7436aeSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
25386b7436aeSmrg      # that says an option was ignored or not supported.
25396b7436aeSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
25406b7436aeSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
25416b7436aeSmrg      # The diagnosis changed in icc 8.0:
25426b7436aeSmrg      #   icc: Command line remark: option '-MP' not supported
25436b7436aeSmrg      if (grep 'ignoring option' conftest.err ||
25446b7436aeSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
25456b7436aeSmrg        am_cv_$1_dependencies_compiler_type=$depmode
25466b7436aeSmrg        break
25476b7436aeSmrg      fi
25486b7436aeSmrg    fi
25496b7436aeSmrg  done
2550e6d5e4e0Smrg
25516b7436aeSmrg  cd ..
25526b7436aeSmrg  rm -rf conftest.dir
25536b7436aeSmrgelse
25546b7436aeSmrg  am_cv_$1_dependencies_compiler_type=none
25550ea508b1Smrgfi
25566b7436aeSmrg])
25576b7436aeSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
25586b7436aeSmrgAM_CONDITIONAL([am__fastdep$1], [
25596b7436aeSmrg  test "x$enable_dependency_tracking" != xno \
25606b7436aeSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
25616b7436aeSmrg])
2562e169010aSmrg
25639d0ccd10Smrg
25646b7436aeSmrg# AM_SET_DEPDIR
25656b7436aeSmrg# -------------
25666b7436aeSmrg# Choose a directory name for dependency files.
25676b7436aeSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25686b7436aeSmrgAC_DEFUN([AM_SET_DEPDIR],
25696b7436aeSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25706b7436aeSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25716b7436aeSmrg])
25729d0ccd10Smrg
25736b7436aeSmrg
25746b7436aeSmrg# AM_DEP_TRACK
25756b7436aeSmrg# ------------
25766b7436aeSmrgAC_DEFUN([AM_DEP_TRACK],
25776b7436aeSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25786b7436aeSmrgAS_HELP_STRING(
25796b7436aeSmrg  [--enable-dependency-tracking],
25806b7436aeSmrg  [do not reject slow dependency extractors])
25816b7436aeSmrgAS_HELP_STRING(
25826b7436aeSmrg  [--disable-dependency-tracking],
25836b7436aeSmrg  [speeds up one-time build])])
25846b7436aeSmrgif test "x$enable_dependency_tracking" != xno; then
25856b7436aeSmrg  am_depcomp="$ac_aux_dir/depcomp"
25866b7436aeSmrg  AMDEPBACKSLASH='\'
25876b7436aeSmrg  am__nodep='_no'
25880ea508b1Smrgfi
25896b7436aeSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25906b7436aeSmrgAC_SUBST([AMDEPBACKSLASH])dnl
25916b7436aeSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25926b7436aeSmrgAC_SUBST([am__nodep])dnl
25936b7436aeSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25946b7436aeSmrg])
2595e169010aSmrg
25966b7436aeSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25976b7436aeSmrg
25986b7436aeSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
25990ea508b1Smrg#
26006b7436aeSmrg# This file is free software; the Free Software Foundation
26016b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
26026b7436aeSmrg# with or without modifications, as long as this notice is preserved.
26036b7436aeSmrg
26046b7436aeSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
26056b7436aeSmrg# ------------------------------
26066b7436aeSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26076b7436aeSmrg[{
26086b7436aeSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
26096b7436aeSmrg  # are listed without --file.  Let's play safe and only enable the eval
26106b7436aeSmrg  # if we detect the quoting.
26116b7436aeSmrg  # TODO: see whether this extra hack can be removed once we start
26126b7436aeSmrg  # requiring Autoconf 2.70 or later.
26136b7436aeSmrg  AS_CASE([$CONFIG_FILES],
26146b7436aeSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
26156b7436aeSmrg          [*], [set x $CONFIG_FILES])
26166b7436aeSmrg  shift
26176b7436aeSmrg  # Used to flag and report bootstrapping failures.
26186b7436aeSmrg  am_rc=0
26196b7436aeSmrg  for am_mf
26206b7436aeSmrg  do
26216b7436aeSmrg    # Strip MF so we end up with the name of the file.
26226b7436aeSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
26236b7436aeSmrg    # Check whether this is an Automake generated Makefile which includes
26246b7436aeSmrg    # dependency-tracking related rules and includes.
26256b7436aeSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
26266b7436aeSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
26276b7436aeSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
26286b7436aeSmrg      || continue
26296b7436aeSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
26306b7436aeSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
26316b7436aeSmrg    AM_RUN_LOG([cd "$am_dirpart" \
26326b7436aeSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
26336b7436aeSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
26346b7436aeSmrg  done
26356b7436aeSmrg  if test $am_rc -ne 0; then
26366b7436aeSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
26376b7436aeSmrg    for automatic dependency tracking.  If GNU make was not used, consider
26386b7436aeSmrg    re-running the configure script with MAKE="gmake" (or whatever is
26396b7436aeSmrg    necessary).  You can also try re-running configure with the
26406b7436aeSmrg    '--disable-dependency-tracking' option to at least be able to build
26416b7436aeSmrg    the package (albeit without support for automatic dependency tracking).])
26426b7436aeSmrg  fi
26436b7436aeSmrg  AS_UNSET([am_dirpart])
26446b7436aeSmrg  AS_UNSET([am_filepart])
26456b7436aeSmrg  AS_UNSET([am_mf])
26466b7436aeSmrg  AS_UNSET([am_rc])
26476b7436aeSmrg  rm -f conftest-deps.mk
26486b7436aeSmrg}
26496b7436aeSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
26506b7436aeSmrg
26516b7436aeSmrg
26526b7436aeSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
26536b7436aeSmrg# -----------------------------
26546b7436aeSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
26550ea508b1Smrg#
26566b7436aeSmrg# This code is only required when automatic dependency tracking is enabled.
26576b7436aeSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
26586b7436aeSmrg# order to bootstrap the dependency handling code.
26596b7436aeSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
26606b7436aeSmrg[AC_CONFIG_COMMANDS([depfiles],
26616b7436aeSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
26626b7436aeSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
26636b7436aeSmrg
26646b7436aeSmrg# Do all the work for Automake.                             -*- Autoconf -*-
26656b7436aeSmrg
26666b7436aeSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
26670ea508b1Smrg#
26686b7436aeSmrg# This file is free software; the Free Software Foundation
26696b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
26706b7436aeSmrg# with or without modifications, as long as this notice is preserved.
26717914d74bSmrg
26726b7436aeSmrg# This macro actually does too much.  Some checks are only needed if
26736b7436aeSmrg# your package does certain things.  But this isn't really a big deal.
26747914d74bSmrg
26756b7436aeSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26766b7436aeSmrgm4_define([AC_PROG_CC],
26776b7436aeSmrgm4_defn([AC_PROG_CC])
26786b7436aeSmrg[_AM_PROG_CC_C_O
26796b7436aeSmrg])
26807914d74bSmrg
26816b7436aeSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26826b7436aeSmrg# AM_INIT_AUTOMAKE([OPTIONS])
26836b7436aeSmrg# -----------------------------------------------
26846b7436aeSmrg# The call with PACKAGE and VERSION arguments is the old style
26856b7436aeSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26866b7436aeSmrg# and VERSION should now be passed to AC_INIT and removed from
26876b7436aeSmrg# the call to AM_INIT_AUTOMAKE.
26886b7436aeSmrg# We support both call styles for the transition.  After
26896b7436aeSmrg# the next Automake release, Autoconf can make the AC_INIT
26906b7436aeSmrg# arguments mandatory, and then we can depend on a new Autoconf
26916b7436aeSmrg# release and drop the old call support.
26926b7436aeSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26936b7436aeSmrg[AC_PREREQ([2.65])dnl
26946b7436aeSmrgm4_ifdef([_$0_ALREADY_INIT],
26956b7436aeSmrg  [m4_fatal([$0 expanded multiple times
26966b7436aeSmrg]m4_defn([_$0_ALREADY_INIT]))],
26976b7436aeSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
26986b7436aeSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26996b7436aeSmrgdnl the ones we care about.
27006b7436aeSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
27016b7436aeSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
27026b7436aeSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
27036b7436aeSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
27046b7436aeSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
27056b7436aeSmrg  # is not polluted with repeated "-I."
27066b7436aeSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27076b7436aeSmrg  # test to see if srcdir already configured
27086b7436aeSmrg  if test -f $srcdir/config.status; then
27096b7436aeSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
27106b7436aeSmrg  fi
2711e6d5e4e0Smrgfi
2712e8ead290Smrg
27136b7436aeSmrg# test whether we have cygpath
27146b7436aeSmrgif test -z "$CYGPATH_W"; then
27156b7436aeSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
27166b7436aeSmrg    CYGPATH_W='cygpath -w'
27176b7436aeSmrg  else
27186b7436aeSmrg    CYGPATH_W=echo
27196b7436aeSmrg  fi
27206b7436aeSmrgfi
27216b7436aeSmrgAC_SUBST([CYGPATH_W])
2722e8ead290Smrg
27236b7436aeSmrg# Define the identity of the package.
27246b7436aeSmrgdnl Distinguish between old-style and new-style calls.
27256b7436aeSmrgm4_ifval([$2],
27266b7436aeSmrg[AC_DIAGNOSE([obsolete],
27276b7436aeSmrg             [$0: two- and three-arguments forms are deprecated.])
27286b7436aeSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
27296b7436aeSmrg AC_SUBST([PACKAGE], [$1])dnl
27306b7436aeSmrg AC_SUBST([VERSION], [$2])],
27316b7436aeSmrg[_AM_SET_OPTIONS([$1])dnl
27326b7436aeSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27336b7436aeSmrgm4_if(
27346b7436aeSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
27356b7436aeSmrg  [ok:ok],,
27366b7436aeSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
27376b7436aeSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
27386b7436aeSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2739e169010aSmrg
27406b7436aeSmrg_AM_IF_OPTION([no-define],,
27416b7436aeSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27426b7436aeSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
27436b7436aeSmrg
27446b7436aeSmrg# Some tools Automake needs.
27456b7436aeSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
27466b7436aeSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27476b7436aeSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27486b7436aeSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27496b7436aeSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27506b7436aeSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27516b7436aeSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27526b7436aeSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27536b7436aeSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27546b7436aeSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27556b7436aeSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
27566b7436aeSmrg# dies out for good.  For more background, see:
27576b7436aeSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27586b7436aeSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27596b7436aeSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
27606b7436aeSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
27616b7436aeSmrg# system "awk" is bad on some platforms.
27626b7436aeSmrgAC_REQUIRE([AC_PROG_AWK])dnl
27636b7436aeSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
27646b7436aeSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
27656b7436aeSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27666b7436aeSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27676b7436aeSmrg			     [_AM_PROG_TAR([v7])])])
27686b7436aeSmrg_AM_IF_OPTION([no-dependencies],,
27696b7436aeSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27706b7436aeSmrg		  [_AM_DEPENDENCIES([CC])],
27716b7436aeSmrg		  [m4_define([AC_PROG_CC],
27726b7436aeSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27736b7436aeSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27746b7436aeSmrg		  [_AM_DEPENDENCIES([CXX])],
27756b7436aeSmrg		  [m4_define([AC_PROG_CXX],
27766b7436aeSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27776b7436aeSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27786b7436aeSmrg		  [_AM_DEPENDENCIES([OBJC])],
27796b7436aeSmrg		  [m4_define([AC_PROG_OBJC],
27806b7436aeSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27816b7436aeSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27826b7436aeSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
27836b7436aeSmrg		  [m4_define([AC_PROG_OBJCXX],
27846b7436aeSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27856b7436aeSmrg])
27866b7436aeSmrg# Variables for tags utilities; see am/tags.am
27876b7436aeSmrgif test -z "$CTAGS"; then
27886b7436aeSmrg  CTAGS=ctags
27899d0ccd10Smrgfi
27906b7436aeSmrgAC_SUBST([CTAGS])
27916b7436aeSmrgif test -z "$ETAGS"; then
27926b7436aeSmrg  ETAGS=etags
27936b7436aeSmrgfi
27946b7436aeSmrgAC_SUBST([ETAGS])
27956b7436aeSmrgif test -z "$CSCOPE"; then
27966b7436aeSmrg  CSCOPE=cscope
2797e6d5e4e0Smrgfi
27986b7436aeSmrgAC_SUBST([CSCOPE])
27997914d74bSmrg
28006b7436aeSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
28016b7436aeSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
28026b7436aeSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
28036b7436aeSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
28046b7436aeSmrgAC_CONFIG_COMMANDS_PRE(dnl
28056b7436aeSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
28066b7436aeSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2807e6d5e4e0Smrg
28086b7436aeSmrg# POSIX will say in a future version that running "rm -f" with no argument
28096b7436aeSmrg# is OK; and we want to be able to make that assumption in our Makefile
28106b7436aeSmrg# recipes.  So use an aggressive probe to check that the usage we want is
28116b7436aeSmrg# actually supported "in the wild" to an acceptable degree.
28126b7436aeSmrg# See automake bug#10828.
28136b7436aeSmrg# To make any issue more visible, cause the running configure to be aborted
28146b7436aeSmrg# by default if the 'rm' program in use doesn't match our expectations; the
28156b7436aeSmrg# user can still override this though.
28166b7436aeSmrgif rm -f && rm -fr && rm -rf; then : OK; else
28176b7436aeSmrg  cat >&2 <<'END'
28186b7436aeSmrgOops!
2819e8ead290Smrg
28206b7436aeSmrgYour 'rm' program seems unable to run without file operands specified
28216b7436aeSmrgon the command line, even when the '-f' option is present.  This is contrary
28226b7436aeSmrgto the behaviour of most rm programs out there, and not conforming with
28236b7436aeSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2824e6d5e4e0Smrg
28256b7436aeSmrgPlease tell bug-automake@gnu.org about your system, including the value
28266b7436aeSmrgof your $PATH and any error possibly output before this message.  This
28276b7436aeSmrgcan help us improve future automake versions.
28280ea508b1Smrg
28296b7436aeSmrgEND
28306b7436aeSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28316b7436aeSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28326b7436aeSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28336b7436aeSmrg    echo >&2
28346b7436aeSmrg  else
28356b7436aeSmrg    cat >&2 <<'END'
28366b7436aeSmrgAborting the configuration process, to ensure you take notice of the issue.
2837e6d5e4e0Smrg
28386b7436aeSmrgYou can download and install GNU coreutils to get an 'rm' implementation
28396b7436aeSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2840e6d5e4e0Smrg
28416b7436aeSmrgIf you want to complete the configuration process using your problematic
28426b7436aeSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28436b7436aeSmrgto "yes", and re-run configure.
2844e6d5e4e0Smrg
28456b7436aeSmrgEND
28466b7436aeSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28476b7436aeSmrg  fi
28486b7436aeSmrgfi
28496b7436aeSmrgdnl The trailing newline in this macro's definition is deliberate, for
28506b7436aeSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
28516b7436aeSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28526b7436aeSmrg])
2853e8ead290Smrg
28546b7436aeSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28556b7436aeSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28566b7436aeSmrgdnl mangled by Autoconf and run in a shell conditional statement.
28576b7436aeSmrgm4_define([_AC_COMPILER_EXEEXT],
28586b7436aeSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2859e6d5e4e0Smrg
28606b7436aeSmrg# When config.status generates a header, we must update the stamp-h file.
28616b7436aeSmrg# This file resides in the same directory as the config header
28626b7436aeSmrg# that is generated.  The stamp files are numbered to have different names.
28630ea508b1Smrg
28646b7436aeSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
28656b7436aeSmrg# loop where config.status creates the headers, so we can generate
28666b7436aeSmrg# our stamp files there.
28676b7436aeSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
28686b7436aeSmrg[# Compute $1's index in $config_headers.
28696b7436aeSmrg_am_arg=$1
28706b7436aeSmrg_am_stamp_count=1
28716b7436aeSmrgfor _am_header in $config_headers :; do
28726b7436aeSmrg  case $_am_header in
28736b7436aeSmrg    $_am_arg | $_am_arg:* )
28746b7436aeSmrg      break ;;
28756b7436aeSmrg    * )
28766b7436aeSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
28776b7436aeSmrg  esac
28786b7436aeSmrgdone
28796b7436aeSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
28809d0ccd10Smrg
28816b7436aeSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
28826b7436aeSmrg#
28836b7436aeSmrg# This file is free software; the Free Software Foundation
28846b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
28856b7436aeSmrg# with or without modifications, as long as this notice is preserved.
28869d0ccd10Smrg
28876b7436aeSmrg# AM_PROG_INSTALL_SH
28886b7436aeSmrg# ------------------
28896b7436aeSmrg# Define $install_sh.
28906b7436aeSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28916b7436aeSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28926b7436aeSmrgif test x"${install_sh+set}" != xset; then
28936b7436aeSmrg  case $am_aux_dir in
28946b7436aeSmrg  *\ * | *\	*)
28956b7436aeSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28966b7436aeSmrg  *)
28976b7436aeSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28986b7436aeSmrg  esac
28996b7436aeSmrgfi
29006b7436aeSmrgAC_SUBST([install_sh])])
29017914d74bSmrg
29026b7436aeSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
29030ea508b1Smrg#
29046b7436aeSmrg# This file is free software; the Free Software Foundation
29056b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
29066b7436aeSmrg# with or without modifications, as long as this notice is preserved.
2907e6d5e4e0Smrg
29086b7436aeSmrg# Check whether the underlying file-system supports filenames
29096b7436aeSmrg# with a leading dot.  For instance MS-DOS doesn't.
29106b7436aeSmrgAC_DEFUN([AM_SET_LEADING_DOT],
29116b7436aeSmrg[rm -rf .tst 2>/dev/null
29126b7436aeSmrgmkdir .tst 2>/dev/null
29136b7436aeSmrgif test -d .tst; then
29146b7436aeSmrg  am__leading_dot=.
29156b7436aeSmrgelse
29166b7436aeSmrg  am__leading_dot=_
29176b7436aeSmrgfi
29186b7436aeSmrgrmdir .tst 2>/dev/null
29196b7436aeSmrgAC_SUBST([am__leading_dot])])
29206b7436aeSmrg
29216b7436aeSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
29226b7436aeSmrg
29236b7436aeSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
29240ea508b1Smrg#
29256b7436aeSmrg# This file is free software; the Free Software Foundation
29266b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
29276b7436aeSmrg# with or without modifications, as long as this notice is preserved.
2928e6d5e4e0Smrg
29296b7436aeSmrg# AM_MAKE_INCLUDE()
29306b7436aeSmrg# -----------------
29316b7436aeSmrg# Check whether make has an 'include' directive that can support all
29326b7436aeSmrg# the idioms we need for our automatic dependency tracking code.
29336b7436aeSmrgAC_DEFUN([AM_MAKE_INCLUDE],
29346b7436aeSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
29356b7436aeSmrgcat > confinc.mk << 'END'
29366b7436aeSmrgam__doit:
29376b7436aeSmrg	@echo this is the am__doit target >confinc.out
29386b7436aeSmrg.PHONY: am__doit
29396b7436aeSmrgEND
29406b7436aeSmrgam__include="#"
29416b7436aeSmrgam__quote=
29426b7436aeSmrg# BSD make does it like this.
29436b7436aeSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
29446b7436aeSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
29456b7436aeSmrgecho 'include confinc.mk # ignored' > confmf.GNU
29466b7436aeSmrg_am_result=no
29476b7436aeSmrgfor s in GNU BSD; do
29486b7436aeSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
29496b7436aeSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
29506b7436aeSmrg      ['0:this is the am__doit target'],
29516b7436aeSmrg      [AS_CASE([$s],
29526b7436aeSmrg          [BSD], [am__include='.include' am__quote='"'],
29536b7436aeSmrg          [am__include='include' am__quote=''])])
29546b7436aeSmrg  if test "$am__include" != "#"; then
29556b7436aeSmrg    _am_result="yes ($s style)"
29566b7436aeSmrg    break
29576b7436aeSmrg  fi
29586b7436aeSmrgdone
29596b7436aeSmrgrm -f confinc.* confmf.*
29606b7436aeSmrgAC_MSG_RESULT([${_am_result}])
29616b7436aeSmrgAC_SUBST([am__include])])
29626b7436aeSmrgAC_SUBST([am__quote])])
2963e6d5e4e0Smrg
29646b7436aeSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
29650ea508b1Smrg
29666b7436aeSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
29676b7436aeSmrg#
29686b7436aeSmrg# This file is free software; the Free Software Foundation
29696b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
29706b7436aeSmrg# with or without modifications, as long as this notice is preserved.
29710ea508b1Smrg
29726b7436aeSmrg# AM_MISSING_PROG(NAME, PROGRAM)
29736b7436aeSmrg# ------------------------------
29746b7436aeSmrgAC_DEFUN([AM_MISSING_PROG],
29756b7436aeSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
29766b7436aeSmrg$1=${$1-"${am_missing_run}$2"}
29776b7436aeSmrgAC_SUBST($1)])
29780ea508b1Smrg
29796b7436aeSmrg# AM_MISSING_HAS_RUN
29806b7436aeSmrg# ------------------
29816b7436aeSmrg# Define MISSING if not defined so far and test if it is modern enough.
29826b7436aeSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29836b7436aeSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29846b7436aeSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29856b7436aeSmrgAC_REQUIRE_AUX_FILE([missing])dnl
29866b7436aeSmrgif test x"${MISSING+set}" != xset; then
29876b7436aeSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
29886b7436aeSmrgfi
29896b7436aeSmrg# Use eval to expand $SHELL
29906b7436aeSmrgif eval "$MISSING --is-lightweight"; then
29916b7436aeSmrg  am_missing_run="$MISSING "
29926b7436aeSmrgelse
29936b7436aeSmrg  am_missing_run=
29946b7436aeSmrg  AC_MSG_WARN(['missing' script is too old or missing])
29950ea508b1Smrgfi
29966b7436aeSmrg])
29970ea508b1Smrg
29986b7436aeSmrg# Helper functions for option handling.                     -*- Autoconf -*-
29990ea508b1Smrg
30006b7436aeSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
30016b7436aeSmrg#
30026b7436aeSmrg# This file is free software; the Free Software Foundation
30036b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
30046b7436aeSmrg# with or without modifications, as long as this notice is preserved.
30050ea508b1Smrg
30066b7436aeSmrg# _AM_MANGLE_OPTION(NAME)
30076b7436aeSmrg# -----------------------
30086b7436aeSmrgAC_DEFUN([_AM_MANGLE_OPTION],
30096b7436aeSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
30100ea508b1Smrg
30116b7436aeSmrg# _AM_SET_OPTION(NAME)
30126b7436aeSmrg# --------------------
30136b7436aeSmrg# Set option NAME.  Presently that only means defining a flag for this option.
30146b7436aeSmrgAC_DEFUN([_AM_SET_OPTION],
30156b7436aeSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
30160ea508b1Smrg
30176b7436aeSmrg# _AM_SET_OPTIONS(OPTIONS)
30186b7436aeSmrg# ------------------------
30196b7436aeSmrg# OPTIONS is a space-separated list of Automake options.
30206b7436aeSmrgAC_DEFUN([_AM_SET_OPTIONS],
30216b7436aeSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
30220ea508b1Smrg
30236b7436aeSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
30246b7436aeSmrg# -------------------------------------------
30256b7436aeSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
30266b7436aeSmrgAC_DEFUN([_AM_IF_OPTION],
30276b7436aeSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3028e8ead290Smrg
30296b7436aeSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
30300ea508b1Smrg#
30316b7436aeSmrg# This file is free software; the Free Software Foundation
30326b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
30336b7436aeSmrg# with or without modifications, as long as this notice is preserved.
30340ea508b1Smrg
30356b7436aeSmrg# _AM_PROG_CC_C_O
30366b7436aeSmrg# ---------------
30376b7436aeSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30386b7436aeSmrg# to automatically call this.
30396b7436aeSmrgAC_DEFUN([_AM_PROG_CC_C_O],
30406b7436aeSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30416b7436aeSmrgAC_REQUIRE_AUX_FILE([compile])dnl
30426b7436aeSmrgAC_LANG_PUSH([C])dnl
30436b7436aeSmrgAC_CACHE_CHECK(
30446b7436aeSmrg  [whether $CC understands -c and -o together],
30456b7436aeSmrg  [am_cv_prog_cc_c_o],
30466b7436aeSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30476b7436aeSmrg  # Make sure it works both with $CC and with simple cc.
30486b7436aeSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30496b7436aeSmrg  # compilers refuse to overwrite an existing .o file with -o,
30506b7436aeSmrg  # though they will create one.
30516b7436aeSmrg  am_cv_prog_cc_c_o=yes
30526b7436aeSmrg  for am_i in 1 2; do
30536b7436aeSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30546b7436aeSmrg         && test -f conftest2.$ac_objext; then
30556b7436aeSmrg      : OK
30566b7436aeSmrg    else
30576b7436aeSmrg      am_cv_prog_cc_c_o=no
30586b7436aeSmrg      break
30596b7436aeSmrg    fi
30606b7436aeSmrg  done
30616b7436aeSmrg  rm -f core conftest*
30626b7436aeSmrg  unset am_i])
30636b7436aeSmrgif test "$am_cv_prog_cc_c_o" != yes; then
30646b7436aeSmrg   # Losing compiler, so override with the script.
30656b7436aeSmrg   # FIXME: It is wrong to rewrite CC.
30666b7436aeSmrg   # But if we don't then we get into trouble of one sort or another.
30676b7436aeSmrg   # A longer-term fix would be to have automake use am__CC in this case,
30686b7436aeSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30696b7436aeSmrg   CC="$am_aux_dir/compile $CC"
30709d0ccd10Smrgfi
30716b7436aeSmrgAC_LANG_POP([C])])
30729d0ccd10Smrg
30736b7436aeSmrg# For backward compatibility.
30746b7436aeSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30756b7436aeSmrg
30766b7436aeSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
30776b7436aeSmrg#
30786b7436aeSmrg# This file is free software; the Free Software Foundation
30796b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
30806b7436aeSmrg# with or without modifications, as long as this notice is preserved.
30816b7436aeSmrg
30826b7436aeSmrg# AM_RUN_LOG(COMMAND)
30836b7436aeSmrg# -------------------
30846b7436aeSmrg# Run COMMAND, save the exit status in ac_status, and log it.
30856b7436aeSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30866b7436aeSmrgAC_DEFUN([AM_RUN_LOG],
30876b7436aeSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30886b7436aeSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30896b7436aeSmrg   ac_status=$?
30906b7436aeSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30916b7436aeSmrg   (exit $ac_status); }])
30929d0ccd10Smrg
30936b7436aeSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3094e169010aSmrg
30956b7436aeSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
30966b7436aeSmrg#
30976b7436aeSmrg# This file is free software; the Free Software Foundation
30986b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
30996b7436aeSmrg# with or without modifications, as long as this notice is preserved.
3100e6d5e4e0Smrg
31016b7436aeSmrg# AM_SANITY_CHECK
31026b7436aeSmrg# ---------------
31036b7436aeSmrgAC_DEFUN([AM_SANITY_CHECK],
31046b7436aeSmrg[AC_MSG_CHECKING([whether build environment is sane])
31056b7436aeSmrg# Reject unsafe characters in $srcdir or the absolute working directory
31066b7436aeSmrg# name.  Accept space and tab only in the latter.
31076b7436aeSmrgam_lf='
31086b7436aeSmrg'
31096b7436aeSmrgcase `pwd` in
31106b7436aeSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
31116b7436aeSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
31126b7436aeSmrgesac
31136b7436aeSmrgcase $srcdir in
31146b7436aeSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31156b7436aeSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31166b7436aeSmrgesac
3117e6d5e4e0Smrg
31186b7436aeSmrg# Do 'set' in a subshell so we don't clobber the current shell's
31196b7436aeSmrg# arguments.  Must try -L first in case configure is actually a
31206b7436aeSmrg# symlink; some systems play weird games with the mod time of symlinks
31216b7436aeSmrg# (eg FreeBSD returns the mod time of the symlink's containing
31226b7436aeSmrg# directory).
31236b7436aeSmrgif (
31246b7436aeSmrg   am_has_slept=no
31256b7436aeSmrg   for am_try in 1 2; do
31266b7436aeSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31276b7436aeSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31286b7436aeSmrg     if test "$[*]" = "X"; then
31296b7436aeSmrg	# -L didn't work.
31306b7436aeSmrg	set X `ls -t "$srcdir/configure" conftest.file`
31316b7436aeSmrg     fi
31326b7436aeSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31336b7436aeSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3134e6d5e4e0Smrg
31356b7436aeSmrg	# If neither matched, then we have a broken ls.  This can happen
31366b7436aeSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31376b7436aeSmrg	# broken ls alias from the environment.  This has actually
31386b7436aeSmrg	# happened.  Such a system could not be considered "sane".
31396b7436aeSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31406b7436aeSmrg  alias in your environment])
31416b7436aeSmrg     fi
31426b7436aeSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31436b7436aeSmrg       break
31446b7436aeSmrg     fi
31456b7436aeSmrg     # Just in case.
31466b7436aeSmrg     sleep 1
31476b7436aeSmrg     am_has_slept=yes
31486b7436aeSmrg   done
31496b7436aeSmrg   test "$[2]" = conftest.file
31506b7436aeSmrg   )
31516b7436aeSmrgthen
31526b7436aeSmrg   # Ok.
31536b7436aeSmrg   :
31540ea508b1Smrgelse
31556b7436aeSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
31566b7436aeSmrgCheck your system clock])
31570ea508b1Smrgfi
31586b7436aeSmrgAC_MSG_RESULT([yes])
31596b7436aeSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31606b7436aeSmrg# generated files are strictly newer.
31616b7436aeSmrgam_sleep_pid=
31626b7436aeSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31636b7436aeSmrg  ( sleep 1 ) &
31646b7436aeSmrg  am_sleep_pid=$!
31656b7436aeSmrgfi
31666b7436aeSmrgAC_CONFIG_COMMANDS_PRE(
31676b7436aeSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31686b7436aeSmrg   if test -n "$am_sleep_pid"; then
31696b7436aeSmrg     # Hide warnings about reused PIDs.
31706b7436aeSmrg     wait $am_sleep_pid 2>/dev/null
31716b7436aeSmrg   fi
31726b7436aeSmrg   AC_MSG_RESULT([done])])
31736b7436aeSmrgrm -f conftest.file
31746b7436aeSmrg])
3175e6d5e4e0Smrg
31766b7436aeSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
3177e8ead290Smrg#
31786b7436aeSmrg# This file is free software; the Free Software Foundation
31796b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
31806b7436aeSmrg# with or without modifications, as long as this notice is preserved.
3181e8ead290Smrg
31826b7436aeSmrg# AM_SILENT_RULES([DEFAULT])
31836b7436aeSmrg# --------------------------
31846b7436aeSmrg# Enable less verbose build rules; with the default set to DEFAULT
31856b7436aeSmrg# ("yes" being less verbose, "no" or empty being verbose).
31866b7436aeSmrgAC_DEFUN([AM_SILENT_RULES],
31876b7436aeSmrg[AC_ARG_ENABLE([silent-rules], [dnl
31886b7436aeSmrgAS_HELP_STRING(
31896b7436aeSmrg  [--enable-silent-rules],
31906b7436aeSmrg  [less verbose build output (undo: "make V=1")])
31916b7436aeSmrgAS_HELP_STRING(
31926b7436aeSmrg  [--disable-silent-rules],
31936b7436aeSmrg  [verbose build output (undo: "make V=0")])dnl
31946b7436aeSmrg])
31956b7436aeSmrgcase $enable_silent_rules in @%:@ (((
31966b7436aeSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
31976b7436aeSmrg   no) AM_DEFAULT_VERBOSITY=1;;
31986b7436aeSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31996b7436aeSmrgesac
32006b7436aeSmrgdnl
32016b7436aeSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
32026b7436aeSmrgdnl do not support nested variable expansions.
32036b7436aeSmrgdnl See automake bug#9928 and bug#10237.
32046b7436aeSmrgam_make=${MAKE-make}
32056b7436aeSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
32066b7436aeSmrg   [am_cv_make_support_nested_variables],
32076b7436aeSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
32086b7436aeSmrgBAR0=false
32096b7436aeSmrgBAR1=true
32106b7436aeSmrgV=1
32116b7436aeSmrgam__doit:
32126b7436aeSmrg	@$(TRUE)
32136b7436aeSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
32146b7436aeSmrg  am_cv_make_support_nested_variables=yes
32156b7436aeSmrgelse
32166b7436aeSmrg  am_cv_make_support_nested_variables=no
32176b7436aeSmrgfi])
32186b7436aeSmrgif test $am_cv_make_support_nested_variables = yes; then
32196b7436aeSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32206b7436aeSmrg  AM_V='$(V)'
32216b7436aeSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32226b7436aeSmrgelse
32236b7436aeSmrg  AM_V=$AM_DEFAULT_VERBOSITY
32246b7436aeSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32256b7436aeSmrgfi
32266b7436aeSmrgAC_SUBST([AM_V])dnl
32276b7436aeSmrgAM_SUBST_NOTMAKE([AM_V])dnl
32286b7436aeSmrgAC_SUBST([AM_DEFAULT_V])dnl
32296b7436aeSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32306b7436aeSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32316b7436aeSmrgAM_BACKSLASH='\'
32326b7436aeSmrgAC_SUBST([AM_BACKSLASH])dnl
32336b7436aeSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32346b7436aeSmrg])
32356b7436aeSmrg
32366b7436aeSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
32370ea508b1Smrg#
32386b7436aeSmrg# This file is free software; the Free Software Foundation
32396b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
32406b7436aeSmrg# with or without modifications, as long as this notice is preserved.
3241e8ead290Smrg
32426b7436aeSmrg# AM_PROG_INSTALL_STRIP
32436b7436aeSmrg# ---------------------
32446b7436aeSmrg# One issue with vendor 'install' (even GNU) is that you can't
32456b7436aeSmrg# specify the program used to strip binaries.  This is especially
32466b7436aeSmrg# annoying in cross-compiling environments, where the build's strip
32476b7436aeSmrg# is unlikely to handle the host's binaries.
32486b7436aeSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32496b7436aeSmrg# always use install-sh in "make install-strip", and initialize
32506b7436aeSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
32516b7436aeSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
32526b7436aeSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32536b7436aeSmrg# Installed binaries are usually stripped using 'strip' when the user
32546b7436aeSmrg# run "make install-strip".  However 'strip' might not be the right
32556b7436aeSmrg# tool to use in cross-compilation environments, therefore Automake
32566b7436aeSmrg# will honor the 'STRIP' environment variable to overrule this program.
32576b7436aeSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
32586b7436aeSmrgif test "$cross_compiling" != no; then
32596b7436aeSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
32606b7436aeSmrgfi
32616b7436aeSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
32626b7436aeSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
32639d0ccd10Smrg
32646b7436aeSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
32656b7436aeSmrg#
32666b7436aeSmrg# This file is free software; the Free Software Foundation
32676b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
32686b7436aeSmrg# with or without modifications, as long as this notice is preserved.
32699d0ccd10Smrg
32706b7436aeSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
32716b7436aeSmrg# ---------------------------
32726b7436aeSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
32736b7436aeSmrg# This macro is traced by Automake.
32746b7436aeSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
32759d0ccd10Smrg
32766b7436aeSmrg# AM_SUBST_NOTMAKE(VARIABLE)
32776b7436aeSmrg# --------------------------
32786b7436aeSmrg# Public sister of _AM_SUBST_NOTMAKE.
32796b7436aeSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
32809d0ccd10Smrg
32816b7436aeSmrg# Check how to create a tarball.                            -*- Autoconf -*-
32829d0ccd10Smrg
32836b7436aeSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
32840ea508b1Smrg#
32856b7436aeSmrg# This file is free software; the Free Software Foundation
32866b7436aeSmrg# gives unlimited permission to copy and/or distribute it,
32876b7436aeSmrg# with or without modifications, as long as this notice is preserved.
32889d0ccd10Smrg
32896b7436aeSmrg# _AM_PROG_TAR(FORMAT)
32900ea508b1Smrg# --------------------
32916b7436aeSmrg# Check how to create a tarball in format FORMAT.
32926b7436aeSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32930ea508b1Smrg#
32946b7436aeSmrg# Substitute a variable $(am__tar) that is a command
32956b7436aeSmrg# writing to stdout a FORMAT-tarball containing the directory
32966b7436aeSmrg# $tardir.
32976b7436aeSmrg#     tardir=directory && $(am__tar) > result.tar
32980ea508b1Smrg#
32996b7436aeSmrg# Substitute a variable $(am__untar) that extract such
33006b7436aeSmrg# a tarball read from stdin.
33016b7436aeSmrg#     $(am__untar) < result.tar
33020ea508b1Smrg#
33036b7436aeSmrgAC_DEFUN([_AM_PROG_TAR],
33046b7436aeSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
33056b7436aeSmrg# in the wild :-(  We should find a proper way to deprecate it ...
33066b7436aeSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
33079d0ccd10Smrg
33086b7436aeSmrg# We'll loop over all known methods to create a tar archive until one works.
33096b7436aeSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
33109d0ccd10Smrg
33116b7436aeSmrgm4_if([$1], [v7],
33126b7436aeSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
33139d0ccd10Smrg
33146b7436aeSmrg  [m4_case([$1],
33156b7436aeSmrg    [ustar],
33166b7436aeSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33176b7436aeSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33186b7436aeSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33196b7436aeSmrg      # and bug#13588).
33206b7436aeSmrg      am_max_uid=2097151 # 2^21 - 1
33216b7436aeSmrg      am_max_gid=$am_max_uid
33226b7436aeSmrg      # The $UID and $GID variables are not portable, so we need to resort
33236b7436aeSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33246b7436aeSmrg      # below are definitely unexpected, so allow the users to see them
33256b7436aeSmrg      # (that is, avoid stderr redirection).
33266b7436aeSmrg      am_uid=`id -u || echo unknown`
33276b7436aeSmrg      am_gid=`id -g || echo unknown`
33286b7436aeSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33296b7436aeSmrg      if test $am_uid -le $am_max_uid; then
33306b7436aeSmrg         AC_MSG_RESULT([yes])
33316b7436aeSmrg      else
33326b7436aeSmrg         AC_MSG_RESULT([no])
33336b7436aeSmrg         _am_tools=none
33346b7436aeSmrg      fi
33356b7436aeSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33366b7436aeSmrg      if test $am_gid -le $am_max_gid; then
33376b7436aeSmrg         AC_MSG_RESULT([yes])
33386b7436aeSmrg      else
33396b7436aeSmrg        AC_MSG_RESULT([no])
33406b7436aeSmrg        _am_tools=none
33416b7436aeSmrg      fi],
33426b7436aeSmrg
33436b7436aeSmrg  [pax],
33446b7436aeSmrg    [],
33456b7436aeSmrg
33466b7436aeSmrg  [m4_fatal([Unknown tar format])])
33476b7436aeSmrg
33486b7436aeSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
33496b7436aeSmrg
33506b7436aeSmrg  # Go ahead even if we have the value already cached.  We do so because we
33516b7436aeSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33526b7436aeSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
33536b7436aeSmrg
33546b7436aeSmrg  for _am_tool in $_am_tools; do
33556b7436aeSmrg    case $_am_tool in
33566b7436aeSmrg    gnutar)
33576b7436aeSmrg      for _am_tar in tar gnutar gtar; do
33586b7436aeSmrg        AM_RUN_LOG([$_am_tar --version]) && break
33596b7436aeSmrg      done
33606b7436aeSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33616b7436aeSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33626b7436aeSmrg      am__untar="$_am_tar -xf -"
33636b7436aeSmrg      ;;
33646b7436aeSmrg    plaintar)
33656b7436aeSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33666b7436aeSmrg      # ustar tarball either.
33676b7436aeSmrg      (tar --version) >/dev/null 2>&1 && continue
33686b7436aeSmrg      am__tar='tar chf - "$$tardir"'
33696b7436aeSmrg      am__tar_='tar chf - "$tardir"'
33706b7436aeSmrg      am__untar='tar xf -'
33716b7436aeSmrg      ;;
33726b7436aeSmrg    pax)
33736b7436aeSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
33746b7436aeSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
33756b7436aeSmrg      am__untar='pax -r'
33766b7436aeSmrg      ;;
33776b7436aeSmrg    cpio)
33786b7436aeSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33796b7436aeSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33806b7436aeSmrg      am__untar='cpio -i -H $1 -d'
33816b7436aeSmrg      ;;
33826b7436aeSmrg    none)
33836b7436aeSmrg      am__tar=false
33846b7436aeSmrg      am__tar_=false
33856b7436aeSmrg      am__untar=false
33866b7436aeSmrg      ;;
33876b7436aeSmrg    esac
33886b7436aeSmrg
33896b7436aeSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
33906b7436aeSmrg    # and am__untar set.
33916b7436aeSmrg    test -n "${am_cv_prog_tar_$1}" && break
33926b7436aeSmrg
33936b7436aeSmrg    # tar/untar a dummy directory, and stop if the command works.
33946b7436aeSmrg    rm -rf conftest.dir
33956b7436aeSmrg    mkdir conftest.dir
33966b7436aeSmrg    echo GrepMe > conftest.dir/file
33976b7436aeSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33986b7436aeSmrg    rm -rf conftest.dir
33996b7436aeSmrg    if test -s conftest.tar; then
34006b7436aeSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
34016b7436aeSmrg      AM_RUN_LOG([cat conftest.dir/file])
34026b7436aeSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
34036b7436aeSmrg    fi
34046b7436aeSmrg  done
34056b7436aeSmrg  rm -rf conftest.dir
34066b7436aeSmrg
34076b7436aeSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
34086b7436aeSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
34096b7436aeSmrg
34106b7436aeSmrgAC_SUBST([am__tar])
34116b7436aeSmrgAC_SUBST([am__untar])
34126b7436aeSmrg]) # _AM_PROG_TAR
34137914d74bSmrg
34140ea508b1Smrgm4_include([m4/libtool.m4])
34150ea508b1Smrgm4_include([m4/ltoptions.m4])
34160ea508b1Smrgm4_include([m4/ltsugar.m4])
34170ea508b1Smrgm4_include([m4/ltversion.m4])
34180ea508b1Smrgm4_include([m4/lt~obsolete.m4])
3419