aclocal.m4 revision 74835918
174835918Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2ac92798bSmrg
374835918Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4a966c04fSmrg
5a966c04fSmrg# This file is free software; the Free Software Foundation
6a966c04fSmrg# gives unlimited permission to copy and/or distribute it,
7a966c04fSmrg# with or without modifications, as long as this notice is preserved.
8a966c04fSmrg
9a966c04fSmrg# This program is distributed in the hope that it will be useful,
10a966c04fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a966c04fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a966c04fSmrg# PARTICULAR PURPOSE.
13a966c04fSmrg
14ac92798bSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152e2dd055Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162e2dd055Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1774835918Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1874835918Smrg[m4_warning([this file was generated for autoconf 2.71.
192e2dd055SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202e2dd055SmrgIf you have problems, you may need to regenerate the build system entirely.
21ac92798bSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a966c04fSmrg
2374835918Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2474835918Smrg# serial 11 (pkg-config-0.29.1)
2574835918Smrg
261c235774Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
271c235774Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
281c235774Smrgdnl
291c235774Smrgdnl This program is free software; you can redistribute it and/or modify
301c235774Smrgdnl it under the terms of the GNU General Public License as published by
311c235774Smrgdnl the Free Software Foundation; either version 2 of the License, or
321c235774Smrgdnl (at your option) any later version.
331c235774Smrgdnl
341c235774Smrgdnl This program is distributed in the hope that it will be useful, but
351c235774Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
361c235774Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
371c235774Smrgdnl General Public License for more details.
381c235774Smrgdnl
391c235774Smrgdnl You should have received a copy of the GNU General Public License
401c235774Smrgdnl along with this program; if not, write to the Free Software
411c235774Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
421c235774Smrgdnl 02111-1307, USA.
431c235774Smrgdnl
441c235774Smrgdnl As a special exception to the GNU General Public License, if you
451c235774Smrgdnl distribute this file as part of a program that contains a
461c235774Smrgdnl configuration script generated by Autoconf, you may include it under
471c235774Smrgdnl the same distribution terms that you use for the rest of that
481c235774Smrgdnl program.
49a966c04fSmrg
501c235774Smrgdnl PKG_PREREQ(MIN-VERSION)
511c235774Smrgdnl -----------------------
521c235774Smrgdnl Since: 0.29
531c235774Smrgdnl
541c235774Smrgdnl Verify that the version of the pkg-config macros are at least
551c235774Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
561c235774Smrgdnl installed version of pkg-config, this checks the developer's version
571c235774Smrgdnl of pkg.m4 when generating configure.
581c235774Smrgdnl
591c235774Smrgdnl To ensure that this macro is defined, also add:
601c235774Smrgdnl m4_ifndef([PKG_PREREQ],
611c235774Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
621c235774Smrgdnl
631c235774Smrgdnl See the "Since" comment for each macro you use to see what version
641c235774Smrgdnl of the macros you require.
651c235774Smrgm4_defun([PKG_PREREQ],
6674835918Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
671c235774Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
681c235774Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
691c235774Smrg])dnl PKG_PREREQ
70a966c04fSmrg
711c235774Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
721c235774Smrgdnl ----------------------------------
731c235774Smrgdnl Since: 0.16
741c235774Smrgdnl
751c235774Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
761c235774Smrgdnl first found in the path. Checks that the version of pkg-config found
771c235774Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
781c235774Smrgdnl used since that's the first version where most current features of
791c235774Smrgdnl pkg-config existed.
801c235774SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
811c235774Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
821c235774Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
831c235774Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
841c235774SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
851c235774SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
861c235774SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87a966c04fSmrg
881c235774Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
891c235774Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
901c235774Smrgfi
911c235774Smrgif test -n "$PKG_CONFIG"; then
921c235774Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
931c235774Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
941c235774Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
951c235774Smrg		AC_MSG_RESULT([yes])
961c235774Smrg	else
971c235774Smrg		AC_MSG_RESULT([no])
981c235774Smrg		PKG_CONFIG=""
991c235774Smrg	fi
1001c235774Smrgfi[]dnl
1011c235774Smrg])dnl PKG_PROG_PKG_CONFIG
102a966c04fSmrg
1031c235774Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1041c235774Smrgdnl -------------------------------------------------------------------
1051c235774Smrgdnl Since: 0.18
1061c235774Smrgdnl
1071c235774Smrgdnl Check to see whether a particular set of modules exists. Similar to
1081c235774Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1091c235774Smrgdnl
1101c235774Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1111c235774Smrgdnl only at the first occurence in configure.ac, so if the first place
1121c235774Smrgdnl it's called might be skipped (such as if it is within an "if", you
1131c235774Smrgdnl have to call PKG_CHECK_EXISTS manually
1141c235774SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1151c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1161c235774Smrgif test -n "$PKG_CONFIG" && \
1171c235774Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1181c235774Smrg  m4_default([$2], [:])
1191c235774Smrgm4_ifvaln([$3], [else
1201c235774Smrg  $3])dnl
1211c235774Smrgfi])
1229f00f3a1Smrg
1231c235774Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1241c235774Smrgdnl ---------------------------------------------
1251c235774Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1261c235774Smrgdnl pkg_failed based on the result.
1271c235774Smrgm4_define([_PKG_CONFIG],
1281c235774Smrg[if test -n "$$1"; then
1291c235774Smrg    pkg_cv_[]$1="$$1"
1301c235774Smrg elif test -n "$PKG_CONFIG"; then
1311c235774Smrg    PKG_CHECK_EXISTS([$3],
1321c235774Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1331c235774Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1341c235774Smrg		     [pkg_failed=yes])
1351c235774Smrg else
1361c235774Smrg    pkg_failed=untried
1371c235774Smrgfi[]dnl
1381c235774Smrg])dnl _PKG_CONFIG
139a966c04fSmrg
1401c235774Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1411c235774Smrgdnl ---------------------------
1421c235774Smrgdnl Internal check to see if pkg-config supports short errors.
1431c235774SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1441c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1451c235774Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1461c235774Smrg        _pkg_short_errors_supported=yes
14719569120Smrgelse
1481c235774Smrg        _pkg_short_errors_supported=no
1491c235774Smrgfi[]dnl
1501c235774Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151a966c04fSmrg
152a966c04fSmrg
1531c235774Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1541c235774Smrgdnl   [ACTION-IF-NOT-FOUND])
1551c235774Smrgdnl --------------------------------------------------------------
1561c235774Smrgdnl Since: 0.4.0
1571c235774Smrgdnl
1581c235774Smrgdnl Note that if there is a possibility the first call to
1591c235774Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1601c235774Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1611c235774SmrgAC_DEFUN([PKG_CHECK_MODULES],
1621c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1631c235774SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1641c235774SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165a966c04fSmrg
1661c235774Smrgpkg_failed=no
1671c235774SmrgAC_MSG_CHECKING([for $1])
168a966c04fSmrg
1691c235774Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1701c235774Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171a966c04fSmrg
1721c235774Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1731c235774Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1741c235774SmrgSee the pkg-config man page for more details.])
175a966c04fSmrg
1761c235774Smrgif test $pkg_failed = yes; then
1771c235774Smrg   	AC_MSG_RESULT([no])
1781c235774Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1791c235774Smrg        if test $_pkg_short_errors_supported = yes; then
1801c235774Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1811c235774Smrg        else 
1821c235774Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1831c235774Smrg        fi
1841c235774Smrg	# Put the nasty error message in config.log where it belongs
1851c235774Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186a966c04fSmrg
1871c235774Smrg	m4_default([$4], [AC_MSG_ERROR(
1881c235774Smrg[Package requirements ($2) were not met:
189a966c04fSmrg
1901c235774Smrg$$1_PKG_ERRORS
191a966c04fSmrg
1921c235774SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1931c235774Smrginstalled software in a non-standard prefix.
194edce3322Smrg
1951c235774Smrg_PKG_TEXT])[]dnl
1961c235774Smrg        ])
1971c235774Smrgelif test $pkg_failed = untried; then
1981c235774Smrg     	AC_MSG_RESULT([no])
1991c235774Smrg	m4_default([$4], [AC_MSG_FAILURE(
2001c235774Smrg[The pkg-config script could not be found or is too old.  Make sure it
2011c235774Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2021c235774Smrgpath to pkg-config.
203edce3322Smrg
2041c235774Smrg_PKG_TEXT
205edce3322Smrg
2061c235774SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2071c235774Smrg        ])
2081c235774Smrgelse
2091c235774Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2101c235774Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2111c235774Smrg        AC_MSG_RESULT([yes])
2121c235774Smrg	$3
2131c235774Smrgfi[]dnl
2141c235774Smrg])dnl PKG_CHECK_MODULES
215edce3322Smrg
216edce3322Smrg
2171c235774Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2181c235774Smrgdnl   [ACTION-IF-NOT-FOUND])
2191c235774Smrgdnl ---------------------------------------------------------------------
2201c235774Smrgdnl Since: 0.29
2211c235774Smrgdnl
2221c235774Smrgdnl Checks for existence of MODULES and gathers its build flags with
2231c235774Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2241c235774Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2251c235774Smrgdnl
2261c235774Smrgdnl Note that if there is a possibility the first call to
2271c235774Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2281c235774Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2291c235774Smrgdnl configure.ac.
2301c235774SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2311c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2321c235774Smrg_save_PKG_CONFIG=$PKG_CONFIG
2331c235774SmrgPKG_CONFIG="$PKG_CONFIG --static"
2341c235774SmrgPKG_CHECK_MODULES($@)
2351c235774SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2361c235774Smrg])dnl PKG_CHECK_MODULES_STATIC
237edce3322Smrg
238edce3322Smrg
2391c235774Smrgdnl PKG_INSTALLDIR([DIRECTORY])
2401c235774Smrgdnl -------------------------
2411c235774Smrgdnl Since: 0.27
2421c235774Smrgdnl
2431c235774Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
2441c235774Smrgdnl should install pkg-config .pc files. By default the directory is
2451c235774Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
2461c235774Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2471c235774Smrgdnl parameter.
2481c235774SmrgAC_DEFUN([PKG_INSTALLDIR],
2491c235774Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2501c235774Smrgm4_pushdef([pkg_description],
2511c235774Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2521c235774SmrgAC_ARG_WITH([pkgconfigdir],
2531c235774Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2541c235774Smrg    [with_pkgconfigdir=]pkg_default)
2551c235774SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2561c235774Smrgm4_popdef([pkg_default])
2571c235774Smrgm4_popdef([pkg_description])
2581c235774Smrg])dnl PKG_INSTALLDIR
259edce3322Smrg
260a966c04fSmrg
2611c235774Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2621c235774Smrgdnl --------------------------------
2631c235774Smrgdnl Since: 0.27
2641c235774Smrgdnl
2651c235774Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2661c235774Smrgdnl module should install arch-independent pkg-config .pc files. By
2671c235774Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
2681c235774Smrgdnl changed by passing DIRECTORY. The user can override through the
2691c235774Smrgdnl --with-noarch-pkgconfigdir parameter.
2701c235774SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2711c235774Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2721c235774Smrgm4_pushdef([pkg_description],
2731c235774Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2741c235774SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2751c235774Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2761c235774Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2771c235774SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2781c235774Smrgm4_popdef([pkg_default])
2791c235774Smrgm4_popdef([pkg_description])
2801c235774Smrg])dnl PKG_NOARCH_INSTALLDIR
281a966c04fSmrg
2822e2dd055Smrg
2831c235774Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2841c235774Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2851c235774Smrgdnl -------------------------------------------
2861c235774Smrgdnl Since: 0.28
2871c235774Smrgdnl
2881c235774Smrgdnl Retrieves the value of the pkg-config variable for the given module.
2891c235774SmrgAC_DEFUN([PKG_CHECK_VAR],
2901c235774Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2911c235774SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292a966c04fSmrg
2931c235774Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2941c235774SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
295a966c04fSmrg
2961c235774SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2971c235774Smrg])dnl PKG_CHECK_VAR
298a966c04fSmrg
29974835918Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
30074835918Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
30174835918Smrgdnl   [DESCRIPTION], [DEFAULT])
30274835918Smrgdnl ------------------------------------------
30374835918Smrgdnl
30474835918Smrgdnl Prepare a "--with-" configure option using the lowercase
30574835918Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
30674835918Smrgdnl PKG_CHECK_MODULES in a single macro.
30774835918SmrgAC_DEFUN([PKG_WITH_MODULES],
30874835918Smrg[
30974835918Smrgm4_pushdef([with_arg], m4_tolower([$1]))
31074835918Smrg
31174835918Smrgm4_pushdef([description],
31274835918Smrg           [m4_default([$5], [build with ]with_arg[ support])])
31374835918Smrg
31474835918Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
31574835918Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
31674835918Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
31774835918Smrg
31874835918Smrgm4_case(def_arg,
31974835918Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
32074835918Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
32174835918Smrg
32274835918SmrgAC_ARG_WITH(with_arg,
32374835918Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
32474835918Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
32574835918Smrg
32674835918SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
32774835918Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
32874835918Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
32974835918Smrg                                        [m4_n([def_action_if_found]) $3],
33074835918Smrg                                        [m4_n([def_action_if_not_found]) $4])])
33174835918Smrg
33274835918Smrgm4_popdef([with_arg])
33374835918Smrgm4_popdef([description])
33474835918Smrgm4_popdef([def_arg])
33574835918Smrg
33674835918Smrg])dnl PKG_WITH_MODULES
33774835918Smrg
33874835918Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
33974835918Smrgdnl   [DESCRIPTION], [DEFAULT])
34074835918Smrgdnl -----------------------------------------------
34174835918Smrgdnl
34274835918Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
34374835918Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
34474835918SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
34574835918Smrg[
34674835918SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
34774835918Smrg
34874835918SmrgAM_CONDITIONAL([HAVE_][$1],
34974835918Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
35074835918Smrg])dnl PKG_HAVE_WITH_MODULES
35174835918Smrg
35274835918Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
35374835918Smrgdnl   [DESCRIPTION], [DEFAULT])
35474835918Smrgdnl ------------------------------------------------------
35574835918Smrgdnl
35674835918Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
35774835918Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
35874835918Smrgdnl and preprocessor variable.
35974835918SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
36074835918Smrg[
36174835918SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
36274835918Smrg
36374835918SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
36474835918Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
36574835918Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
36674835918Smrg
3671c235774Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3681c235774Smrgdnl
36974835918Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
3701c235774Smrgdnl
3711c235774Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3721c235774Smrgdnl copy of this software and associated documentation files (the "Software"),
3731c235774Smrgdnl to deal in the Software without restriction, including without limitation
3741c235774Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3751c235774Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3761c235774Smrgdnl Software is furnished to do so, subject to the following conditions:
3771c235774Smrgdnl
3781c235774Smrgdnl The above copyright notice and this permission notice (including the next
3791c235774Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3801c235774Smrgdnl Software.
3811c235774Smrgdnl
3821c235774Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3831c235774Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3841c235774Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3851c235774Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3861c235774Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3871c235774Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3881c235774Smrgdnl DEALINGS IN THE SOFTWARE.
389edce3322Smrg
3901c235774Smrg# XORG_MACROS_VERSION(required-version)
3911c235774Smrg# -------------------------------------
3921c235774Smrg# Minimum version: 1.1.0
3931c235774Smrg#
3941c235774Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3951c235774Smrg# your configure.ac with the minimum required version, such as:
3961c235774Smrg# XORG_MACROS_VERSION(1.1)
3971c235774Smrg#
3981c235774Smrg# To ensure that this macro is defined, also add:
3991c235774Smrg# m4_ifndef([XORG_MACROS_VERSION],
4001c235774Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4011c235774Smrg#
4021c235774Smrg#
4031c235774Smrg# See the "minimum version" comment for each macro you use to see what
4041c235774Smrg# version you require.
4051c235774Smrgm4_defun([XORG_MACROS_VERSION],[
40674835918Smrgm4_define([vers_have], [1.20.0])
4071c235774Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4081c235774Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4091c235774Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4101c235774Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4111c235774Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4121c235774Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4131c235774Smrgm4_undefine([vers_have])
4141c235774Smrgm4_undefine([maj_have])
4151c235774Smrgm4_undefine([maj_needed])
4161c235774Smrg]) # XORG_MACROS_VERSION
417a966c04fSmrg
4181c235774Smrg# XORG_PROG_RAWCPP()
4191c235774Smrg# ------------------
4201c235774Smrg# Minimum version: 1.0.0
4211c235774Smrg#
4221c235774Smrg# Find cpp program and necessary flags for use in pre-processing text files
4231c235774Smrg# such as man pages and config files
4241c235774SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4251c235774SmrgAC_REQUIRE([AC_PROG_CPP])
42674835918SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
4271c235774Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
4281c235774Smrg
4291c235774Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4301c235774Smrg# which is not the best choice for supporting other OS'es, but covers most
4311c235774Smrg# of the ones we need for now.
4321c235774SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4331c235774SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4341c235774Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4351c235774Smrg	AC_MSG_RESULT([no])
4361c235774Smrgelse
4371c235774Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4381c235774Smrg		RAWCPPFLAGS=-undef
4391c235774Smrg		AC_MSG_RESULT([yes])
4401c235774Smrg	# under Cygwin unix is still defined even with -undef
4411c235774Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4421c235774Smrg		RAWCPPFLAGS="-undef -ansi"
4431c235774Smrg		AC_MSG_RESULT([yes, with -ansi])
4441c235774Smrg	else
4451c235774Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4461c235774Smrg	fi
447a966c04fSmrgfi
4481c235774Smrgrm -f conftest.$ac_ext
449a966c04fSmrg
4501c235774SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4511c235774SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4521c235774Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4531c235774Smrg	AC_MSG_RESULT([no])
4541c235774Smrgelse
4551c235774Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4561c235774Smrg		TRADITIONALCPPFLAGS="-traditional"
4571c235774Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4581c235774Smrg		AC_MSG_RESULT([yes])
4591c235774Smrg	else
4601c235774Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4611c235774Smrg	fi
4629f00f3a1Smrgfi
4631c235774Smrgrm -f conftest.$ac_ext
4641c235774SmrgAC_SUBST(RAWCPPFLAGS)
4651c235774SmrgAC_SUBST(TRADITIONALCPPFLAGS)
4661c235774Smrg]) # XORG_PROG_RAWCPP
467a966c04fSmrg
4681c235774Smrg# XORG_MANPAGE_SECTIONS()
4691c235774Smrg# -----------------------
4701c235774Smrg# Minimum version: 1.0.0
4711c235774Smrg#
4721c235774Smrg# Determine which sections man pages go in for the different man page types
4731c235774Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4741c235774Smrg# Not sure if there's any better way than just hardcoding by OS name.
4751c235774Smrg# Override default settings by setting environment variables
4761c235774Smrg# Added MAN_SUBSTS in version 1.8
4771c235774Smrg# Added AC_PROG_SED in version 1.8
478a966c04fSmrg
4791c235774SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4801c235774SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4811c235774SmrgAC_REQUIRE([AC_PROG_SED])
482a966c04fSmrg
48374835918Smrgcase $host_os in
48474835918Smrg    solaris*)
48574835918Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
48674835918Smrg        # check for a man page file found in later versions that use
48774835918Smrg        # traditional section numbers instead
48874835918Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
48974835918Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
49074835918Smrg        ;;
49174835918Smrg    *) SYSV_MAN_SECTIONS=false ;;
49274835918Smrgesac
49374835918Smrg
4941c235774Smrgif test x$APP_MAN_SUFFIX = x    ; then
4951c235774Smrg    APP_MAN_SUFFIX=1
4969f00f3a1Smrgfi
4971c235774Smrgif test x$APP_MAN_DIR = x    ; then
4981c235774Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
49919569120Smrgfi
500a966c04fSmrg
5011c235774Smrgif test x$LIB_MAN_SUFFIX = x    ; then
5021c235774Smrg    LIB_MAN_SUFFIX=3
5031c235774Smrgfi
5041c235774Smrgif test x$LIB_MAN_DIR = x    ; then
5051c235774Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
5061c235774Smrgfi
507a966c04fSmrg
5081c235774Smrgif test x$FILE_MAN_SUFFIX = x    ; then
50974835918Smrg    case $SYSV_MAN_SECTIONS in
51074835918Smrg	true)				FILE_MAN_SUFFIX=4  ;;
5111c235774Smrg	*)				FILE_MAN_SUFFIX=5  ;;
5121c235774Smrg    esac
5131c235774Smrgfi
5141c235774Smrgif test x$FILE_MAN_DIR = x    ; then
5151c235774Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
5161c235774Smrgfi
51719569120Smrg
5181c235774Smrgif test x$MISC_MAN_SUFFIX = x    ; then
51974835918Smrg    case $SYSV_MAN_SECTIONS in
52074835918Smrg	true)				MISC_MAN_SUFFIX=5  ;;
5211c235774Smrg	*)				MISC_MAN_SUFFIX=7  ;;
5221c235774Smrg    esac
5231c235774Smrgfi
5241c235774Smrgif test x$MISC_MAN_DIR = x    ; then
5251c235774Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5261c235774Smrgfi
52719569120Smrg
5281c235774Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
52974835918Smrg    case $SYSV_MAN_SECTIONS in
53074835918Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
5311c235774Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5321c235774Smrg    esac
5331c235774Smrgfi
5341c235774Smrgif test x$DRIVER_MAN_DIR = x    ; then
5351c235774Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5369f00f3a1Smrgfi
537a966c04fSmrg
5381c235774Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
53974835918Smrg    case $SYSV_MAN_SECTIONS in
54074835918Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
5411c235774Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5421c235774Smrg    esac
5431c235774Smrgfi
5441c235774Smrgif test x$ADMIN_MAN_DIR = x    ; then
5451c235774Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5461c235774Smrgfi
5479f00f3a1Smrg
548a966c04fSmrg
5491c235774SmrgAC_SUBST([APP_MAN_SUFFIX])
5501c235774SmrgAC_SUBST([LIB_MAN_SUFFIX])
5511c235774SmrgAC_SUBST([FILE_MAN_SUFFIX])
5521c235774SmrgAC_SUBST([MISC_MAN_SUFFIX])
5531c235774SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5541c235774SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5551c235774SmrgAC_SUBST([APP_MAN_DIR])
5561c235774SmrgAC_SUBST([LIB_MAN_DIR])
5571c235774SmrgAC_SUBST([FILE_MAN_DIR])
5581c235774SmrgAC_SUBST([MISC_MAN_DIR])
5591c235774SmrgAC_SUBST([DRIVER_MAN_DIR])
5601c235774SmrgAC_SUBST([ADMIN_MAN_DIR])
561a966c04fSmrg
5621c235774SmrgXORG_MAN_PAGE="X Version 11"
5631c235774SmrgAC_SUBST([XORG_MAN_PAGE])
5641c235774SmrgMAN_SUBSTS="\
5651c235774Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5661c235774Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5671c235774Smrg	-e 's|__xservername__|Xorg|g' \
5681c235774Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
5691c235774Smrg	-e 's|__projectroot__|\$(prefix)|g' \
5701c235774Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5711c235774Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5721c235774Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5731c235774Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5741c235774Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5751c235774Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5761c235774Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5771c235774SmrgAC_SUBST([MAN_SUBSTS])
578ac92798bSmrg
5791c235774Smrg]) # XORG_MANPAGE_SECTIONS
580a966c04fSmrg
5811c235774Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5821c235774Smrg# ------------------------
5831c235774Smrg# Minimum version: 1.7.0
58419569120Smrg#
5851c235774Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5861c235774Smrg# provided by xorg-sgml-doctools, if installed.
5871c235774SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5881c235774SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5891c235774SmrgXORG_SGML_PATH=
5901c235774SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5911c235774Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5921c235774Smrg    [m4_ifval([$1],[:],
5931c235774Smrg        [if test x"$cross_compiling" != x"yes" ; then
5941c235774Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5951c235774Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5961c235774Smrg         fi])
5971c235774Smrg    ])
5989f00f3a1Smrg
5991c235774Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6001c235774Smrg# the path and the name of the doc stylesheet
6011c235774Smrgif test "x$XORG_SGML_PATH" != "x" ; then
6021c235774Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6031c235774Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6041c235774Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6059f00f3a1Smrgelse
6061c235774Smrg   AC_MSG_RESULT([no])
607a966c04fSmrgfi
608a966c04fSmrg
6091c235774SmrgAC_SUBST(XORG_SGML_PATH)
6101c235774SmrgAC_SUBST(STYLESHEET_SRCDIR)
6111c235774SmrgAC_SUBST(XSL_STYLESHEET)
6121c235774SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6131c235774Smrg]) # XORG_CHECK_SGML_DOCTOOLS
614a966c04fSmrg
6151c235774Smrg# XORG_CHECK_LINUXDOC
6161c235774Smrg# -------------------
6171c235774Smrg# Minimum version: 1.0.0
61819569120Smrg#
6191c235774Smrg# Defines the variable MAKE_TEXT if the necessary tools and
6201c235774Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6211c235774Smrg# Whether or not the necessary tools and files are found can be checked
6221c235774Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6231c235774SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6241c235774SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6251c235774SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
626ac92798bSmrg
6271c235774SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
628ac92798bSmrg
6291c235774SmrgAC_MSG_CHECKING([whether to build documentation])
630ac92798bSmrg
6311c235774Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6321c235774Smrg   BUILDDOC=yes
63319569120Smrgelse
6341c235774Smrg   BUILDDOC=no
6359f00f3a1Smrgfi
636ac92798bSmrg
6371c235774SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6382e2dd055Smrg
6391c235774SmrgAC_MSG_RESULT([$BUILDDOC])
640a966c04fSmrg
6411c235774SmrgAC_MSG_CHECKING([whether to build pdf documentation])
642a966c04fSmrg
6431c235774Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6441c235774Smrg   BUILDPDFDOC=yes
6451c235774Smrgelse
6461c235774Smrg   BUILDPDFDOC=no
6471c235774Smrgfi
648a966c04fSmrg
6491c235774SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
650a966c04fSmrg
6511c235774SmrgAC_MSG_RESULT([$BUILDPDFDOC])
652a966c04fSmrg
6531c235774SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6541c235774SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6551c235774SmrgMAKE_PDF="$PS2PDF"
6561c235774SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
657a966c04fSmrg
6581c235774SmrgAC_SUBST(MAKE_TEXT)
6591c235774SmrgAC_SUBST(MAKE_PS)
6601c235774SmrgAC_SUBST(MAKE_PDF)
6611c235774SmrgAC_SUBST(MAKE_HTML)
6621c235774Smrg]) # XORG_CHECK_LINUXDOC
663a966c04fSmrg
6641c235774Smrg# XORG_CHECK_DOCBOOK
66519569120Smrg# -------------------
6661c235774Smrg# Minimum version: 1.0.0
6671c235774Smrg#
6681c235774Smrg# Checks for the ability to build output formats from SGML DocBook source.
6691c235774Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6701c235774Smrg# indicates whether the necessary tools and files are found and, if set,
6711c235774Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6721c235774SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6731c235774SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
674a966c04fSmrg
6751c235774SmrgBUILDTXTDOC=no
6761c235774SmrgBUILDPDFDOC=no
6771c235774SmrgBUILDPSDOC=no
6781c235774SmrgBUILDHTMLDOC=no
679a966c04fSmrg
6801c235774SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6811c235774SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6821c235774SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6831c235774SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
684a966c04fSmrg
6851c235774SmrgAC_MSG_CHECKING([whether to build text documentation])
6861c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6871c235774Smrg   test x$BUILD_TXTDOC != xno; then
6881c235774Smrg	BUILDTXTDOC=yes
6891c235774Smrgfi
6901c235774SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6911c235774SmrgAC_MSG_RESULT([$BUILDTXTDOC])
6922e2dd055Smrg
6931c235774SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6941c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6951c235774Smrg   test x$BUILD_PDFDOC != xno; then
6961c235774Smrg	BUILDPDFDOC=yes
6971c235774Smrgfi
6981c235774SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6991c235774SmrgAC_MSG_RESULT([$BUILDPDFDOC])
700ac92798bSmrg
7011c235774SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7021c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7031c235774Smrg   test x$BUILD_PSDOC != xno; then
7041c235774Smrg	BUILDPSDOC=yes
705ac92798bSmrgfi
7061c235774SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7071c235774SmrgAC_MSG_RESULT([$BUILDPSDOC])
7081c235774Smrg
7091c235774SmrgAC_MSG_CHECKING([whether to build HTML documentation])
7101c235774Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7111c235774Smrg   test x$BUILD_HTMLDOC != xno; then
7121c235774Smrg	BUILDHTMLDOC=yes
713edce3322Smrgfi
7141c235774SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7151c235774SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
716edce3322Smrg
7171c235774SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7181c235774SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7191c235774SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7201c235774SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
7212e2dd055Smrg
7221c235774SmrgAC_SUBST(MAKE_TEXT)
7231c235774SmrgAC_SUBST(MAKE_PS)
7241c235774SmrgAC_SUBST(MAKE_PDF)
7251c235774SmrgAC_SUBST(MAKE_HTML)
7261c235774Smrg]) # XORG_CHECK_DOCBOOK
727a966c04fSmrg
7281c235774Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7291c235774Smrg# ----------------
7301c235774Smrg# Minimum version: 1.5.0
7311c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
732a966c04fSmrg#
7331c235774Smrg# Documentation tools are not always available on all platforms and sometimes
7341c235774Smrg# not at the appropriate level. This macro enables a module to test for the
7351c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
73674835918Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
7371c235774Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7381c235774Smrg# --with-xmlto assumes 'auto'.
7391c235774Smrg#
7401c235774Smrg# Interface to module:
7411c235774Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7421c235774Smrg# XMLTO:	returns the path of the xmlto program found
7431c235774Smrg#		returns the path set by the user in the environment
7441c235774Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7451c235774Smrg#		'no' user instructs the module not to use xmlto
7461c235774Smrg#
7471c235774Smrg# Added in version 1.10.0
7481c235774Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7491c235774Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7501c235774Smrg#
7511c235774Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7521c235774Smrg#
7531c235774SmrgAC_DEFUN([XORG_WITH_XMLTO],[
7541c235774SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7551c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
7561c235774SmrgAC_ARG_WITH(xmlto,
7571c235774Smrg	AS_HELP_STRING([--with-xmlto],
7581c235774Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7591c235774Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7601c235774Smrgm4_undefine([_defopt])
761ac92798bSmrg
7621c235774Smrgif test "x$use_xmlto" = x"auto"; then
7631c235774Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7641c235774Smrg   if test "x$XMLTO" = "x"; then
7651c235774Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7661c235774Smrg	have_xmlto=no
7671c235774Smrg   else
7681c235774Smrg        have_xmlto=yes
7691c235774Smrg   fi
7701c235774Smrgelif test "x$use_xmlto" = x"yes" ; then
7711c235774Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7721c235774Smrg   if test "x$XMLTO" = "x"; then
7731c235774Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7741c235774Smrg   fi
7751c235774Smrg   have_xmlto=yes
7761c235774Smrgelif test "x$use_xmlto" = x"no" ; then
7771c235774Smrg   if test "x$XMLTO" != "x"; then
7781c235774Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7791c235774Smrg   fi
7801c235774Smrg   have_xmlto=no
7811c235774Smrgelse
7821c235774Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7839f00f3a1Smrgfi
784ac92798bSmrg
7851c235774Smrg# Test for a minimum version of xmlto, if provided.
7861c235774Smrgm4_ifval([$1],
7871c235774Smrg[if test "$have_xmlto" = yes; then
7881c235774Smrg    # scrape the xmlto version
7891c235774Smrg    AC_MSG_CHECKING([the xmlto version])
7901c235774Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7911c235774Smrg    AC_MSG_RESULT([$xmlto_version])
7921c235774Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7931c235774Smrg        [if test "x$use_xmlto" = xauto; then
7941c235774Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7951c235774Smrg            have_xmlto=no
7961c235774Smrg        else
7971c235774Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7981c235774Smrg        fi])
7991c235774Smrgfi])
8001c235774Smrg
8011c235774Smrg# Test for the ability of xmlto to generate a text target
80219569120Smrg#
8031c235774Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
8041c235774Smrg# following test for empty XML docbook files.
8051c235774Smrg# For compatibility reasons use the following empty XML docbook file and if
8061c235774Smrg# it fails try it again with a non-empty XML file.
8071c235774Smrghave_xmlto_text=no
8081c235774Smrgcat > conftest.xml << "EOF"
8091c235774SmrgEOF
8101c235774SmrgAS_IF([test "$have_xmlto" = yes],
8111c235774Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8121c235774Smrg             [have_xmlto_text=yes],
8131c235774Smrg             [# Try it again with a non-empty XML file.
8141c235774Smrg              cat > conftest.xml << "EOF"
8151c235774Smrg<x></x>
8161c235774SmrgEOF
8171c235774Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8181c235774Smrg                    [have_xmlto_text=yes],
8191c235774Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8201c235774Smrgrm -f conftest.xml
8211c235774SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8221c235774SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8231c235774Smrg]) # XORG_WITH_XMLTO
824a966c04fSmrg
8251c235774Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8261c235774Smrg# --------------------------------------------
8271c235774Smrg# Minimum version: 1.12.0
8281c235774Smrg# Minimum version for optional DEFAULT argument: 1.12.0
8291c235774Smrg#
8301c235774Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8311c235774Smrg# XML-based language used for the transformation of XML documents.
8321c235774Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8331c235774Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8341c235774Smrg# The XSLT processor is often used as a standalone tool for transformations.
8351c235774Smrg# It should not be assumed that this tool is used only to work with documnetation.
8361c235774Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8371c235774Smrg#
8381c235774Smrg# Interface to module:
8391c235774Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8401c235774Smrg# XSLTPROC:	 returns the path of the xsltproc program found
8411c235774Smrg#		 returns the path set by the user in the environment
8421c235774Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8431c235774Smrg#		  'no' user instructs the module not to use xsltproc
8441c235774Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8451c235774Smrg#
8461c235774Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8471c235774Smrg#
8481c235774SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8491c235774SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8501c235774Smrg# Preserves the interface, should it be implemented later
8511c235774Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8521c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
8531c235774SmrgAC_ARG_WITH(xsltproc,
8541c235774Smrg	AS_HELP_STRING([--with-xsltproc],
8551c235774Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8561c235774Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8571c235774Smrgm4_undefine([_defopt])
858edce3322Smrg
8591c235774Smrgif test "x$use_xsltproc" = x"auto"; then
8601c235774Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8611c235774Smrg   if test "x$XSLTPROC" = "x"; then
8621c235774Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8631c235774Smrg	have_xsltproc=no
8641c235774Smrg   else
8651c235774Smrg        have_xsltproc=yes
8661c235774Smrg   fi
8671c235774Smrgelif test "x$use_xsltproc" = x"yes" ; then
8681c235774Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8691c235774Smrg   if test "x$XSLTPROC" = "x"; then
8701c235774Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8711c235774Smrg   fi
8721c235774Smrg   have_xsltproc=yes
8731c235774Smrgelif test "x$use_xsltproc" = x"no" ; then
8741c235774Smrg   if test "x$XSLTPROC" != "x"; then
8751c235774Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8761c235774Smrg   fi
8771c235774Smrg   have_xsltproc=no
8781c235774Smrgelse
8791c235774Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8801c235774Smrgfi
881edce3322Smrg
8821c235774SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8831c235774Smrg]) # XORG_WITH_XSLTPROC
88419569120Smrg
8851c235774Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8861c235774Smrg# ----------------------------------------
8871c235774Smrg# Minimum version: 1.15.0
8889f00f3a1Smrg#
8891c235774Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8901c235774Smrg# scanning arbitrary text files, extracting information from those text files,
8911c235774Smrg# and printing reports based on that information.
8929f00f3a1Smrg#
8931c235774Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8949f00f3a1Smrg#
8951c235774Smrg# Interface to module:
8961c235774Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8971c235774Smrg# PERL:	     returns the path of the perl program found
8981c235774Smrg#	     returns the path set by the user in the environment
8991c235774Smrg# --with-perl: 'yes' user instructs the module to use perl
9001c235774Smrg#	       'no' user instructs the module not to use perl
9011c235774Smrg# have_perl: returns yes if perl found in PATH or no
9029f00f3a1Smrg#
9031c235774Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9041c235774Smrg#
9051c235774SmrgAC_DEFUN([XORG_WITH_PERL],[
9061c235774SmrgAC_ARG_VAR([PERL], [Path to perl command])
9071c235774Smrg# Preserves the interface, should it be implemented later
9081c235774Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9091c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
9101c235774SmrgAC_ARG_WITH(perl,
9111c235774Smrg	AS_HELP_STRING([--with-perl],
9121c235774Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9131c235774Smrg	   [use_perl=$withval], [use_perl=]_defopt)
9141c235774Smrgm4_undefine([_defopt])
915a966c04fSmrg
9161c235774Smrgif test "x$use_perl" = x"auto"; then
9171c235774Smrg   AC_PATH_PROG([PERL], [perl])
9181c235774Smrg   if test "x$PERL" = "x"; then
9191c235774Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9201c235774Smrg	have_perl=no
9211c235774Smrg   else
9221c235774Smrg        have_perl=yes
9231c235774Smrg   fi
9241c235774Smrgelif test "x$use_perl" = x"yes" ; then
9251c235774Smrg   AC_PATH_PROG([PERL], [perl])
9261c235774Smrg   if test "x$PERL" = "x"; then
9271c235774Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9281c235774Smrg   fi
9291c235774Smrg   have_perl=yes
9301c235774Smrgelif test "x$use_perl" = x"no" ; then
9311c235774Smrg   if test "x$PERL" != "x"; then
9321c235774Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9331c235774Smrg   fi
9341c235774Smrg   have_perl=no
9351c235774Smrgelse
9361c235774Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9371c235774Smrgfi
93819569120Smrg
9391c235774SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9401c235774Smrg]) # XORG_WITH_PERL
94119569120Smrg
9421c235774Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9431c235774Smrg# ----------------
9441c235774Smrg# Minimum version: 1.5.0
9451c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
9461c235774Smrg#
9471c235774Smrg# Documentation tools are not always available on all platforms and sometimes
9481c235774Smrg# not at the appropriate level. This macro enables a module to test for the
9491c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
95074835918Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
9511c235774Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9521c235774Smrg# --with-asciidoc assumes 'auto'.
9531c235774Smrg#
9541c235774Smrg# Interface to module:
9551c235774Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9561c235774Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
9571c235774Smrg#		 returns the path set by the user in the environment
9581c235774Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9591c235774Smrg#		  'no' user instructs the module not to use asciidoc
9601c235774Smrg#
9611c235774Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9621c235774Smrg#
9631c235774SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9641c235774SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9651c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
9661c235774SmrgAC_ARG_WITH(asciidoc,
9671c235774Smrg	AS_HELP_STRING([--with-asciidoc],
9681c235774Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9691c235774Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9701c235774Smrgm4_undefine([_defopt])
97119569120Smrg
9721c235774Smrgif test "x$use_asciidoc" = x"auto"; then
9731c235774Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9741c235774Smrg   if test "x$ASCIIDOC" = "x"; then
9751c235774Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9761c235774Smrg	have_asciidoc=no
9771c235774Smrg   else
9781c235774Smrg        have_asciidoc=yes
9791c235774Smrg   fi
9801c235774Smrgelif test "x$use_asciidoc" = x"yes" ; then
9811c235774Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9821c235774Smrg   if test "x$ASCIIDOC" = "x"; then
9831c235774Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9841c235774Smrg   fi
9851c235774Smrg   have_asciidoc=yes
9861c235774Smrgelif test "x$use_asciidoc" = x"no" ; then
9871c235774Smrg   if test "x$ASCIIDOC" != "x"; then
9881c235774Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9891c235774Smrg   fi
9901c235774Smrg   have_asciidoc=no
9911c235774Smrgelse
9921c235774Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9931c235774Smrgfi
9941c235774Smrgm4_ifval([$1],
9951c235774Smrg[if test "$have_asciidoc" = yes; then
9961c235774Smrg    # scrape the asciidoc version
9971c235774Smrg    AC_MSG_CHECKING([the asciidoc version])
9981c235774Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9991c235774Smrg    AC_MSG_RESULT([$asciidoc_version])
10001c235774Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10011c235774Smrg        [if test "x$use_asciidoc" = xauto; then
10021c235774Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10031c235774Smrg            have_asciidoc=no
10041c235774Smrg        else
10051c235774Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10061c235774Smrg        fi])
10071c235774Smrgfi])
10081c235774SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10091c235774Smrg]) # XORG_WITH_ASCIIDOC
101019569120Smrg
10111c235774Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
10121c235774Smrg# -------------------------------------------
10131c235774Smrg# Minimum version: 1.5.0
10141c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
10151c235774Smrg# Minimum version for optional DOT checking: 1.18.0
10161c235774Smrg#
10171c235774Smrg# Documentation tools are not always available on all platforms and sometimes
10181c235774Smrg# not at the appropriate level. This macro enables a module to test for the
10191c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
102074835918Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
10211c235774Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10221c235774Smrg# --with-doxygen assumes 'auto'.
10231c235774Smrg#
10241c235774Smrg# Interface to module:
10251c235774Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10261c235774Smrg# DOXYGEN:	 returns the path of the doxygen program found
10271c235774Smrg#		 returns the path set by the user in the environment
10281c235774Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10291c235774Smrg#		  'no' user instructs the module not to use doxygen
10301c235774Smrg#
10311c235774Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10321c235774Smrg#
10331c235774SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10341c235774SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
10351c235774SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10361c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
10371c235774SmrgAC_ARG_WITH(doxygen,
10381c235774Smrg	AS_HELP_STRING([--with-doxygen],
10391c235774Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10401c235774Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10411c235774Smrgm4_undefine([_defopt])
104219569120Smrg
10431c235774Smrgif test "x$use_doxygen" = x"auto"; then
10441c235774Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10451c235774Smrg   if test "x$DOXYGEN" = "x"; then
10461c235774Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10471c235774Smrg	have_doxygen=no
10481c235774Smrg   else
10491c235774Smrg        have_doxygen=yes
10501c235774Smrg   fi
10511c235774Smrgelif test "x$use_doxygen" = x"yes" ; then
10521c235774Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10531c235774Smrg   if test "x$DOXYGEN" = "x"; then
10541c235774Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10551c235774Smrg   fi
10561c235774Smrg   have_doxygen=yes
10571c235774Smrgelif test "x$use_doxygen" = x"no" ; then
10581c235774Smrg   if test "x$DOXYGEN" != "x"; then
10591c235774Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10601c235774Smrg   fi
10611c235774Smrg   have_doxygen=no
10621c235774Smrgelse
10631c235774Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
10641c235774Smrgfi
10651c235774Smrgm4_ifval([$1],
10661c235774Smrg[if test "$have_doxygen" = yes; then
10671c235774Smrg    # scrape the doxygen version
10681c235774Smrg    AC_MSG_CHECKING([the doxygen version])
10691c235774Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10701c235774Smrg    AC_MSG_RESULT([$doxygen_version])
10711c235774Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10721c235774Smrg        [if test "x$use_doxygen" = xauto; then
10731c235774Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10741c235774Smrg            have_doxygen=no
10751c235774Smrg        else
10761c235774Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10771c235774Smrg        fi])
10781c235774Smrgfi])
107919569120Smrg
10801c235774Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10811c235774Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10821c235774Smrgdnl 	HAVE_DOT = @HAVE_DOT@
10831c235774SmrgHAVE_DOT=no
10841c235774Smrgif test "x$have_doxygen" = "xyes"; then
10851c235774Smrg  AC_PATH_PROG([DOT], [dot])
10861c235774Smrg    if test "x$DOT" != "x"; then
10871c235774Smrg      HAVE_DOT=yes
108819569120Smrg    fi
10891c235774Smrgfi
109019569120Smrg
10911c235774SmrgAC_SUBST([HAVE_DOT])
10921c235774SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10931c235774SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10941c235774Smrg]) # XORG_WITH_DOXYGEN
109519569120Smrg
10961c235774Smrg# XORG_WITH_GROFF([DEFAULT])
10971c235774Smrg# ----------------
10981c235774Smrg# Minimum version: 1.6.0
10991c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11001c235774Smrg#
11011c235774Smrg# Documentation tools are not always available on all platforms and sometimes
11021c235774Smrg# not at the appropriate level. This macro enables a module to test for the
11031c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
110474835918Smrg# the --with-groff option, it allows maximum flexibility in making decisions
11051c235774Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
11061c235774Smrg# --with-groff assumes 'auto'.
11071c235774Smrg#
11081c235774Smrg# Interface to module:
11091c235774Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11101c235774Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11111c235774Smrg# HAVE_GROFF_MS: the -ms macros package
11121c235774Smrg# GROFF:	 returns the path of the groff program found
11131c235774Smrg#		 returns the path set by the user in the environment
11141c235774Smrg# --with-groff:	 'yes' user instructs the module to use groff
11151c235774Smrg#		 'no' user instructs the module not to use groff
11161c235774Smrg#
11171c235774Smrg# Added in version 1.9.0:
11181c235774Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11191c235774Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11201c235774Smrg#		   psselect from the psutils package.
11211c235774Smrg#		   the ghostcript package. Refer to the grohtml man pages
11221c235774Smrg#
11231c235774Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11241c235774Smrg#
11251c235774Smrg# OS and distros often splits groff in a basic and full package, the former
11261c235774Smrg# having the groff program and the later having devices, fonts and macros
11271c235774Smrg# Checking for the groff executable is not enough.
11281c235774Smrg#
11291c235774Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
11301c235774Smrg# unset HAVE_GROFF or GROFF env variables.
11311c235774Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11321c235774Smrg#
11331c235774SmrgAC_DEFUN([XORG_WITH_GROFF],[
11341c235774SmrgAC_ARG_VAR([GROFF], [Path to groff command])
11351c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
11361c235774SmrgAC_ARG_WITH(groff,
11371c235774Smrg	AS_HELP_STRING([--with-groff],
11381c235774Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11391c235774Smrg	   [use_groff=$withval], [use_groff=]_defopt)
11401c235774Smrgm4_undefine([_defopt])
114119569120Smrg
11421c235774Smrgif test "x$use_groff" = x"auto"; then
11431c235774Smrg   AC_PATH_PROG([GROFF], [groff])
11441c235774Smrg   if test "x$GROFF" = "x"; then
11451c235774Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11461c235774Smrg	have_groff=no
11471c235774Smrg   else
11481c235774Smrg        have_groff=yes
11491c235774Smrg   fi
11501c235774Smrgelif test "x$use_groff" = x"yes" ; then
11511c235774Smrg   AC_PATH_PROG([GROFF], [groff])
11521c235774Smrg   if test "x$GROFF" = "x"; then
11531c235774Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11541c235774Smrg   fi
11551c235774Smrg   have_groff=yes
11561c235774Smrgelif test "x$use_groff" = x"no" ; then
11571c235774Smrg   if test "x$GROFF" != "x"; then
11581c235774Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11591c235774Smrg   fi
11601c235774Smrg   have_groff=no
11611c235774Smrgelse
11621c235774Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
11631c235774Smrgfi
116419569120Smrg
11651c235774Smrg# We have groff, test for the presence of the macro packages
11661c235774Smrgif test "x$have_groff" = x"yes"; then
11671c235774Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11681c235774Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11691c235774Smrg        groff_ms_works=yes
11701c235774Smrg    else
11711c235774Smrg        groff_ms_works=no
11721c235774Smrg    fi
11731c235774Smrg    AC_MSG_RESULT([$groff_ms_works])
11741c235774Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11751c235774Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11761c235774Smrg        groff_mm_works=yes
11771c235774Smrg    else
11781c235774Smrg        groff_mm_works=no
11791c235774Smrg    fi
11801c235774Smrg    AC_MSG_RESULT([$groff_mm_works])
11811c235774Smrgfi
118219569120Smrg
11831c235774Smrg# We have groff, test for HTML dependencies, one command per package
11841c235774Smrgif test "x$have_groff" = x"yes"; then
11851c235774Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11861c235774Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11871c235774Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11881c235774Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11891c235774Smrg      have_groff_html=yes
11901c235774Smrg   else
11911c235774Smrg      have_groff_html=no
11921c235774Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11931c235774Smrg   fi
119419569120Smrgfi
119519569120Smrg
11961c235774Smrg# Set Automake conditionals for Makefiles
11971c235774SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11981c235774SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11991c235774SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12001c235774SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12011c235774Smrg]) # XORG_WITH_GROFF
120219569120Smrg
12031c235774Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12041c235774Smrg# ---------------------------------------
12051c235774Smrg# Minimum version: 1.6.0
12061c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12071c235774Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
12081c235774Smrg#
12091c235774Smrg# Documentation tools are not always available on all platforms and sometimes
12101c235774Smrg# not at the appropriate level. This macro enables a module to test for the
12111c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
121274835918Smrg# the --with-fop option, it allows maximum flexibility in making decisions
12131c235774Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
12141c235774Smrg# --with-fop assumes 'auto'.
12151c235774Smrg#
12161c235774Smrg# Interface to module:
12171c235774Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12181c235774Smrg# FOP:	 	returns the path of the fop program found
12191c235774Smrg#		returns the path set by the user in the environment
12201c235774Smrg# --with-fop: 	'yes' user instructs the module to use fop
12211c235774Smrg#		'no' user instructs the module not to use fop
12221c235774Smrg#
12231c235774Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
12241c235774Smrg#
12251c235774SmrgAC_DEFUN([XORG_WITH_FOP],[
12261c235774SmrgAC_ARG_VAR([FOP], [Path to fop command])
12271c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
12281c235774SmrgAC_ARG_WITH(fop,
12291c235774Smrg	AS_HELP_STRING([--with-fop],
12301c235774Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12311c235774Smrg	   [use_fop=$withval], [use_fop=]_defopt)
12321c235774Smrgm4_undefine([_defopt])
123319569120Smrg
12341c235774Smrgif test "x$use_fop" = x"auto"; then
12351c235774Smrg   AC_PATH_PROG([FOP], [fop])
12361c235774Smrg   if test "x$FOP" = "x"; then
12371c235774Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12381c235774Smrg	have_fop=no
12391c235774Smrg   else
12401c235774Smrg        have_fop=yes
12411c235774Smrg   fi
12421c235774Smrgelif test "x$use_fop" = x"yes" ; then
12431c235774Smrg   AC_PATH_PROG([FOP], [fop])
12441c235774Smrg   if test "x$FOP" = "x"; then
12451c235774Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12461c235774Smrg   fi
12471c235774Smrg   have_fop=yes
12481c235774Smrgelif test "x$use_fop" = x"no" ; then
12491c235774Smrg   if test "x$FOP" != "x"; then
12501c235774Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12511c235774Smrg   fi
12521c235774Smrg   have_fop=no
125319569120Smrgelse
12541c235774Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12551c235774Smrgfi
1256a966c04fSmrg
12571c235774Smrg# Test for a minimum version of fop, if provided.
12581c235774Smrgm4_ifval([$1],
12591c235774Smrg[if test "$have_fop" = yes; then
12601c235774Smrg    # scrape the fop version
12611c235774Smrg    AC_MSG_CHECKING([for fop minimum version])
12621c235774Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12631c235774Smrg    AC_MSG_RESULT([$fop_version])
12641c235774Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
12651c235774Smrg        [if test "x$use_fop" = xauto; then
12661c235774Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12671c235774Smrg            have_fop=no
12681c235774Smrg        else
12691c235774Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12701c235774Smrg        fi])
12711c235774Smrgfi])
12721c235774SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12731c235774Smrg]) # XORG_WITH_FOP
1274a966c04fSmrg
12751c235774Smrg# XORG_WITH_M4([MIN-VERSION])
12761c235774Smrg# ---------------------------
12771c235774Smrg# Minimum version: 1.19.0
12781c235774Smrg#
12791c235774Smrg# This macro attempts to locate an m4 macro processor which supports
12801c235774Smrg# -I option and is only useful for modules relying on M4 in order to
12811c235774Smrg# expand macros in source code files.
12821c235774Smrg#
12831c235774Smrg# Interface to module:
12841c235774Smrg# M4:	 	returns the path of the m4 program found
12851c235774Smrg#		returns the path set by the user in the environment
12861c235774Smrg#
12871c235774SmrgAC_DEFUN([XORG_WITH_M4], [
12881c235774SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12891c235774Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12901c235774Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12911c235774Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12921c235774Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12931c235774Smrg   [$PATH:/usr/gnu/bin])])
12946e7d3316Smrg
12951c235774SmrgAC_SUBST([M4], [$ac_cv_path_M4])
12961c235774Smrg]) # XORG_WITH_M4
12976e7d3316Smrg
12981c235774Smrg# XORG_WITH_PS2PDF([DEFAULT])
12991c235774Smrg# ----------------
13001c235774Smrg# Minimum version: 1.6.0
13011c235774Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13021c235774Smrg#
13031c235774Smrg# Documentation tools are not always available on all platforms and sometimes
13041c235774Smrg# not at the appropriate level. This macro enables a module to test for the
13051c235774Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
130674835918Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
13071c235774Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13081c235774Smrg# --with-ps2pdf assumes 'auto'.
13091c235774Smrg#
13101c235774Smrg# Interface to module:
13111c235774Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13121c235774Smrg# PS2PDF:	returns the path of the ps2pdf program found
13131c235774Smrg#		returns the path set by the user in the environment
13141c235774Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13151c235774Smrg#		 'no' user instructs the module not to use ps2pdf
13161c235774Smrg#
13171c235774Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13181c235774Smrg#
13191c235774SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13201c235774SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13211c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
13221c235774SmrgAC_ARG_WITH(ps2pdf,
13231c235774Smrg	AS_HELP_STRING([--with-ps2pdf],
13241c235774Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13251c235774Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13261c235774Smrgm4_undefine([_defopt])
13276e7d3316Smrg
13281c235774Smrgif test "x$use_ps2pdf" = x"auto"; then
13291c235774Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13301c235774Smrg   if test "x$PS2PDF" = "x"; then
13311c235774Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13321c235774Smrg	have_ps2pdf=no
13331c235774Smrg   else
13341c235774Smrg        have_ps2pdf=yes
13351c235774Smrg   fi
13361c235774Smrgelif test "x$use_ps2pdf" = x"yes" ; then
13371c235774Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13381c235774Smrg   if test "x$PS2PDF" = "x"; then
13391c235774Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13401c235774Smrg   fi
13411c235774Smrg   have_ps2pdf=yes
13421c235774Smrgelif test "x$use_ps2pdf" = x"no" ; then
13431c235774Smrg   if test "x$PS2PDF" != "x"; then
13441c235774Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13451c235774Smrg   fi
13461c235774Smrg   have_ps2pdf=no
134719569120Smrgelse
13481c235774Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13491c235774Smrgfi
13501c235774SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13511c235774Smrg]) # XORG_WITH_PS2PDF
13526e7d3316Smrg
13531c235774Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
13541c235774Smrg# ----------------
13551c235774Smrg# Minimum version: 1.6.0
13561c235774Smrg#
13571c235774Smrg# Documentation tools are not always available on all platforms and sometimes
13581c235774Smrg# not at the appropriate level. This macro enables a builder to skip all
13591c235774Smrg# documentation targets except traditional man pages.
13601c235774Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
136174835918Smrg# maximum flexibility in controlling documentation building.
13621c235774Smrg# Refer to:
13631c235774Smrg# XORG_WITH_XMLTO         --with-xmlto
13641c235774Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13651c235774Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13661c235774Smrg# XORG_WITH_FOP           --with-fop
13671c235774Smrg# XORG_WITH_GROFF         --with-groff
13681c235774Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13691c235774Smrg#
13701c235774Smrg# Interface to module:
13711c235774Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13721c235774Smrg# --enable-docs: 'yes' user instructs the module to generate docs
13731c235774Smrg#		 'no' user instructs the module not to generate docs
13741c235774Smrg# parm1:	specify the default value, yes or no.
13751c235774Smrg#
13761c235774SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13771c235774Smrgm4_define([docs_default], m4_default([$1], [yes]))
13781c235774SmrgAC_ARG_ENABLE(docs,
13791c235774Smrg	AS_HELP_STRING([--enable-docs],
13801c235774Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13811c235774Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13821c235774Smrgm4_undefine([docs_default])
13831c235774SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13841c235774SmrgAC_MSG_CHECKING([whether to build documentation])
13851c235774SmrgAC_MSG_RESULT([$build_docs])
13861c235774Smrg]) # XORG_ENABLE_DOCS
13876e7d3316Smrg
13881c235774Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13891c235774Smrg# ----------------
13901c235774Smrg# Minimum version: 1.6.0
13911c235774Smrg#
13921c235774Smrg# This macro enables a builder to skip all developer documentation.
13931c235774Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
139474835918Smrg# maximum flexibility in controlling documentation building.
13951c235774Smrg# Refer to:
13961c235774Smrg# XORG_WITH_XMLTO         --with-xmlto
13971c235774Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13981c235774Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13991c235774Smrg# XORG_WITH_FOP           --with-fop
14001c235774Smrg# XORG_WITH_GROFF         --with-groff
14011c235774Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14021c235774Smrg#
14031c235774Smrg# Interface to module:
14041c235774Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14051c235774Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14061c235774Smrg#			'no' user instructs the module not to generate developer docs
14071c235774Smrg# parm1:		specify the default value, yes or no.
14081c235774Smrg#
14091c235774SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14101c235774Smrgm4_define([devel_default], m4_default([$1], [yes]))
14111c235774SmrgAC_ARG_ENABLE(devel-docs,
14121c235774Smrg	AS_HELP_STRING([--enable-devel-docs],
14131c235774Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14141c235774Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14151c235774Smrgm4_undefine([devel_default])
14161c235774SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14171c235774SmrgAC_MSG_CHECKING([whether to build developer documentation])
14181c235774SmrgAC_MSG_RESULT([$build_devel_docs])
14191c235774Smrg]) # XORG_ENABLE_DEVEL_DOCS
142019569120Smrg
14211c235774Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
14221c235774Smrg# ----------------
14231c235774Smrg# Minimum version: 1.6.0
14241c235774Smrg#
14251c235774Smrg# This macro enables a builder to skip all functional specification targets.
14261c235774Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
142774835918Smrg# maximum flexibility in controlling documentation building.
14281c235774Smrg# Refer to:
14291c235774Smrg# XORG_WITH_XMLTO         --with-xmlto
14301c235774Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14311c235774Smrg# XORG_WITH_DOXYGEN       --with-doxygen
14321c235774Smrg# XORG_WITH_FOP           --with-fop
14331c235774Smrg# XORG_WITH_GROFF         --with-groff
14341c235774Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
14351c235774Smrg#
14361c235774Smrg# Interface to module:
14371c235774Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14381c235774Smrg# --enable-specs:	'yes' user instructs the module to generate specs
14391c235774Smrg#			'no' user instructs the module not to generate specs
14401c235774Smrg# parm1:		specify the default value, yes or no.
14411c235774Smrg#
14421c235774SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14431c235774Smrgm4_define([spec_default], m4_default([$1], [yes]))
14441c235774SmrgAC_ARG_ENABLE(specs,
14451c235774Smrg	AS_HELP_STRING([--enable-specs],
14461c235774Smrg	   [Enable building the specs (default: ]spec_default[)]),
14471c235774Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
14481c235774Smrgm4_undefine([spec_default])
14491c235774SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14501c235774SmrgAC_MSG_CHECKING([whether to build functional specifications])
14511c235774SmrgAC_MSG_RESULT([$build_specs])
14521c235774Smrg]) # XORG_ENABLE_SPECS
145319569120Smrg
14541c235774Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14551c235774Smrg# ----------------------------------------------
14561c235774Smrg# Minimum version: 1.13.0
14571c235774Smrg#
14581c235774Smrg# This macro enables a builder to enable/disable unit testing
14591c235774Smrg# It makes no assumption about the test cases implementation
14601c235774Smrg# Test cases may or may not use Automake "Support for test suites"
14611c235774Smrg# They may or may not use the software utility library GLib
14621c235774Smrg#
14631c235774Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14641c235774Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14651c235774Smrg# The variable enable_unit_tests is used by other macros in this file.
14661c235774Smrg#
14671c235774Smrg# Interface to module:
14681c235774Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14691c235774Smrg# enable_unit_tests:    used in configure.ac for additional configuration
14701c235774Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14711c235774Smrg#			'no' user instructs the module not to build tests
14721c235774Smrg# parm1:		specify the default value, yes or no.
14731c235774Smrg#
14741c235774SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14751c235774SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14761c235774SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14771c235774SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14781c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
14791c235774SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14801c235774Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14811c235774Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14821c235774Smrgm4_undefine([_defopt])
14831c235774SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14841c235774SmrgAC_MSG_CHECKING([whether to build unit test cases])
14851c235774SmrgAC_MSG_RESULT([$enable_unit_tests])
14861c235774Smrg]) # XORG_ENABLE_UNIT_TESTS
148719569120Smrg
14881c235774Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14891c235774Smrg# ------------------------------------------------------
14901c235774Smrg# Minimum version: 1.17.0
14911c235774Smrg#
14921c235774Smrg# This macro enables a builder to enable/disable integration testing
14931c235774Smrg# It makes no assumption about the test cases' implementation
14941c235774Smrg# Test cases may or may not use Automake "Support for test suites"
14951c235774Smrg#
14961c235774Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14971c235774Smrg# usually requires less dependencies and may be built and run under less
14981c235774Smrg# stringent environments than integration tests.
14991c235774Smrg#
15001c235774Smrg# Interface to module:
15011c235774Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15021c235774Smrg# enable_integration_tests:   used in configure.ac for additional configuration
15031c235774Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15041c235774Smrg#                             'no' user instructs the module not to build tests
15051c235774Smrg# parm1:                      specify the default value, yes or no.
15061c235774Smrg#
15071c235774SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15081c235774SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15091c235774Smrgm4_define([_defopt], m4_default([$1], [auto]))
15101c235774SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15111c235774Smrg	[Enable building integration test cases (default: ]_defopt[)]),
15121c235774Smrg	[enable_integration_tests=$enableval],
15131c235774Smrg	[enable_integration_tests=]_defopt)
15141c235774Smrgm4_undefine([_defopt])
15151c235774SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15161c235774Smrg	[test "x$enable_integration_tests" != xno])
15171c235774SmrgAC_MSG_CHECKING([whether to build unit test cases])
15181c235774SmrgAC_MSG_RESULT([$enable_integration_tests])
15191c235774Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
152019569120Smrg
15211c235774Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15221c235774Smrg# ----------------------------------------
15231c235774Smrg# Minimum version: 1.13.0
15241c235774Smrg#
15251c235774Smrg# GLib is a library which provides advanced data structures and functions.
15261c235774Smrg# This macro enables a module to test for the presence of Glib.
15271c235774Smrg#
15281c235774Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15291c235774Smrg# Otherwise the value of $enable_unit_tests is blank.
15301c235774Smrg#
15311c235774Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15321c235774Smrg# test support usually requires less dependencies and may be built and run under
15331c235774Smrg# less stringent environments than integration tests.
15341c235774Smrg#
15351c235774Smrg# Interface to module:
15361c235774Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
15371c235774Smrg# with_glib: used in configure.ac to know if GLib has been found
15381c235774Smrg# --with-glib:	'yes' user instructs the module to use glib
15391c235774Smrg#		'no' user instructs the module not to use glib
15401c235774Smrg#
15411c235774SmrgAC_DEFUN([XORG_WITH_GLIB],[
15421c235774SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15431c235774Smrgm4_define([_defopt], m4_default([$2], [auto]))
15441c235774SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15451c235774Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15461c235774Smrg	[with_glib=$withval], [with_glib=]_defopt)
15471c235774Smrgm4_undefine([_defopt])
154819569120Smrg
15491c235774Smrghave_glib=no
15501c235774Smrg# Do not probe GLib if user explicitly disabled unit testing
15511c235774Smrgif test "x$enable_unit_tests" != x"no"; then
15521c235774Smrg  # Do not probe GLib if user explicitly disabled it
15531c235774Smrg  if test "x$with_glib" != x"no"; then
15541c235774Smrg    m4_ifval(
15551c235774Smrg      [$1],
15561c235774Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15571c235774Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15581c235774Smrg    )
15591c235774Smrg  fi
15601c235774Smrgfi
156119569120Smrg
15621c235774Smrg# Not having GLib when unit testing has been explicitly requested is an error
15631c235774Smrgif test "x$enable_unit_tests" = x"yes"; then
15641c235774Smrg  if test "x$have_glib" = x"no"; then
15651c235774Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15661c235774Smrg  fi
15671c235774Smrgfi
15686e7d3316Smrg
15691c235774Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
15701c235774Smrgif test "x$enable_unit_tests" = x"no"; then
15711c235774Smrg  if test "x$with_glib" = x"yes"; then
15721c235774Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
15731c235774Smrg  fi
15741c235774Smrgfi
15756e7d3316Smrg
15761c235774Smrg# Not having GLib when it has been explicitly requested is an error
15771c235774Smrgif test "x$with_glib" = x"yes"; then
15781c235774Smrg  if test "x$have_glib" = x"no"; then
15791c235774Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15801c235774Smrg  fi
15811c235774Smrgfi
15826e7d3316Smrg
15831c235774SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15841c235774Smrg]) # XORG_WITH_GLIB
15856e7d3316Smrg
15861c235774Smrg# XORG_LD_WRAP([required|optional])
15871c235774Smrg# ---------------------------------
15881c235774Smrg# Minimum version: 1.13.0
15899f00f3a1Smrg#
15901c235774Smrg# Check if linker supports -wrap, passed via compiler flags
15919f00f3a1Smrg#
15921c235774Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15931c235774Smrg# Otherwise the value of $enable_unit_tests is blank.
15949f00f3a1Smrg#
15951c235774Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15961c235774Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15971c235774Smrg# available, an argument of "optional" allows use when some unit tests require
15981c235774Smrg# ld -wrap and others do not.
15999f00f3a1Smrg#
16001c235774SmrgAC_DEFUN([XORG_LD_WRAP],[
16011c235774SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16021c235774Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16031c235774Smrg                      void __wrap_exit(int status) { return; }],
16041c235774Smrg                     [exit(0);])])
16051c235774Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
16061c235774Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16071c235774Smrg  if test "x$have_ld_wrap" = x"no"; then
16081c235774Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16091c235774Smrg  fi
1610ac92798bSmrgfi
16111c235774SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16121c235774Smrg#
16131c235774Smrg]) # XORG_LD_WRAP
16149f00f3a1Smrg
16151c235774Smrg# XORG_CHECK_LINKER_FLAGS
16161c235774Smrg# -----------------------
16171c235774Smrg# SYNOPSIS
16181c235774Smrg#
16191c235774Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16201c235774Smrg#
16211c235774Smrg# DESCRIPTION
16221c235774Smrg#
16231c235774Smrg#   Check whether the given linker FLAGS work with the current language's
16241c235774Smrg#   linker, or whether they give an error.
16251c235774Smrg#
16261c235774Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16271c235774Smrg#   success/failure.
16281c235774Smrg#
16291c235774Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
16301c235774Smrg#
16311c235774Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16321c235774Smrg#
16331c235774Smrg# LICENSE
16341c235774Smrg#
16351c235774Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16361c235774Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16371c235774Smrg#   Copyright (c) 2009 Matteo Frigo
16381c235774Smrg#
16391c235774Smrg#   This program is free software: you can redistribute it and/or modify it
16401c235774Smrg#   under the terms of the GNU General Public License as published by the
16411c235774Smrg#   Free Software Foundation, either version 3 of the License, or (at your
16421c235774Smrg#   option) any later version.
16431c235774Smrg#
16441c235774Smrg#   This program is distributed in the hope that it will be useful, but
16451c235774Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16461c235774Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16471c235774Smrg#   Public License for more details.
16481c235774Smrg#
16491c235774Smrg#   You should have received a copy of the GNU General Public License along
16501c235774Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16511c235774Smrg#
16521c235774Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
16531c235774Smrg#   gives unlimited permission to copy, distribute and modify the configure
16541c235774Smrg#   scripts that are the output of Autoconf when processing the Macro. You
16551c235774Smrg#   need not follow the terms of the GNU General Public License when using
16561c235774Smrg#   or distributing such scripts, even though portions of the text of the
16571c235774Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16581c235774Smrg#   all other use of the material that constitutes the Autoconf Macro.
16591c235774Smrg#
16601c235774Smrg#   This special exception to the GPL applies to versions of the Autoconf
16611c235774Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
16621c235774Smrg#   modified version of the Autoconf Macro, you may extend this special
16631c235774Smrg#   exception to the GPL to apply to your modified version as well.#
16641c235774SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16651c235774Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
16661c235774Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16671c235774SmrgAS_LITERAL_IF([$1],
16681c235774Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16691c235774Smrg      ax_save_FLAGS=$LDFLAGS
16701c235774Smrg      LDFLAGS="$1"
16711c235774Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16721c235774Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16731c235774Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16741c235774Smrg      LDFLAGS=$ax_save_FLAGS])],
16751c235774Smrg  [ax_save_FLAGS=$LDFLAGS
16761c235774Smrg   LDFLAGS="$1"
16771c235774Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16781c235774Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16791c235774Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16801c235774Smrg   LDFLAGS=$ax_save_FLAGS])
16811c235774Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16821c235774SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16831c235774Smrgif test "x$xorg_check_linker_flags" = xyes; then
16841c235774Smrg	m4_default([$2], :)
16859f00f3a1Smrgelse
16861c235774Smrg	m4_default([$3], :)
1687ac92798bSmrgfi
16881c235774Smrg]) # XORG_CHECK_LINKER_FLAGS
1689ac92798bSmrg
16901c235774Smrg# XORG_MEMORY_CHECK_FLAGS
169119569120Smrg# -----------------------
16921c235774Smrg# Minimum version: 1.16.0
16939f00f3a1Smrg#
16941c235774Smrg# This macro attempts to find appropriate memory checking functionality
16951c235774Smrg# for various platforms which unit testing code may use to catch various
16961c235774Smrg# forms of memory allocation and access errors in testing.
16971c235774Smrg#
16981c235774Smrg# Interface to module:
16991c235774Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17001c235774Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17011c235774Smrg#
17021c235774Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17031c235774Smrg#
17041c235774SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17056e7d3316Smrg
170619569120SmrgAC_REQUIRE([AC_CANONICAL_HOST])
17071c235774SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17081c235774Smrg           [Environment variables to enable memory checking in tests])
17096e7d3316Smrg
17101c235774Smrg# Check for different types of support on different platforms
17119f00f3a1Smrgcase $host_os in
171219569120Smrg    solaris*)
17131c235774Smrg        AC_CHECK_LIB([umem], [umem_alloc],
17141c235774Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17151c235774Smrg        ;;
17161c235774Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17171c235774Smrg        # both directly and inverted, so should not be 0 or 255.
17181c235774Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
17191c235774Smrg        ;;
17201c235774Smrg    darwin*)
17211c235774Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17221c235774Smrg        ;;
17231c235774Smrg    *bsd*)
17241c235774Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
172519569120Smrg        ;;
17269f00f3a1Smrgesac
17276e7d3316Smrg
17281c235774Smrg# User supplied flags override default flags
17291c235774Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17301c235774Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
173119569120Smrgfi
17326e7d3316Smrg
17331c235774SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17341c235774Smrg]) # XORG_WITH_LINT
17356e7d3316Smrg
17361c235774Smrg# XORG_CHECK_MALLOC_ZERO
17371c235774Smrg# ----------------------
17381c235774Smrg# Minimum version: 1.0.0
17391c235774Smrg#
17401c235774Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17411c235774Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17421c235774Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17431c235774SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17441c235774SmrgAC_ARG_ENABLE(malloc0returnsnull,
17451c235774Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17461c235774Smrg		       [malloc(0) returns NULL (default: auto)]),
17471c235774Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17481c235774Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
17496e7d3316Smrg
17501c235774SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17511c235774Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
17521c235774SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
17531c235774Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17541c235774Smrg#include <stdlib.h>
17551c235774Smrg],[
17561c235774Smrg    char *m0, *r0, *c0, *p;
17571c235774Smrg    m0 = malloc(0);
17581c235774Smrg    p = malloc(10);
17591c235774Smrg    r0 = realloc(p,0);
17601c235774Smrg    c0 = calloc(0,10);
17611c235774Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17621c235774Smrg])],
17631c235774Smrg		[xorg_cv_malloc0_returns_null=yes],
17641c235774Smrg		[xorg_cv_malloc0_returns_null=no])])
17651c235774SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
176697cf2ee2Smrgfi
17671c235774SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17686e7d3316Smrg
17691c235774Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17701c235774Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17711c235774Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17721c235774Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
177319569120Smrgelse
17741c235774Smrg	MALLOC_ZERO_CFLAGS=""
17751c235774Smrg	XMALLOC_ZERO_CFLAGS=""
17761c235774Smrg	XTMALLOC_ZERO_CFLAGS=""
177719569120Smrgfi
17786e7d3316Smrg
17791c235774SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17801c235774SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17811c235774SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17821c235774Smrg]) # XORG_CHECK_MALLOC_ZERO
17836e7d3316Smrg
17841c235774Smrg# XORG_WITH_LINT()
17851c235774Smrg# ----------------
17861c235774Smrg# Minimum version: 1.1.0
178719569120Smrg#
17881c235774Smrg# This macro enables the use of a tool that flags some suspicious and
17891c235774Smrg# non-portable constructs (likely to be bugs) in C language source code.
17901c235774Smrg# It will attempt to locate the tool and use appropriate options.
17911c235774Smrg# There are various lint type tools on different platforms.
17921c235774Smrg#
17931c235774Smrg# Interface to module:
17941c235774Smrg# LINT:		returns the path to the tool found on the platform
17951c235774Smrg#		or the value set to LINT on the configure cmd line
17961c235774Smrg#		also an Automake conditional
17971c235774Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17981c235774Smrg#
17991c235774Smrg# --with-lint:	'yes' user instructs the module to use lint
18001c235774Smrg#		'no' user instructs the module not to use lint (default)
18011c235774Smrg#
18021c235774Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18031c235774Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18041c235774Smrg#
18051c235774SmrgAC_DEFUN([XORG_WITH_LINT],[
18066e7d3316Smrg
18071c235774SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18081c235774SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18091c235774SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18101c235774Smrg		[Use a lint-style source code checker (default: disabled)])],
18111c235774Smrg		[use_lint=$withval], [use_lint=no])
18126e7d3316Smrg
18131c235774Smrg# Obtain platform specific info like program name and options
18141c235774Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18151c235774Smrgcase $host_os in
18161c235774Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18171c235774Smrg	lint_name=splint
18181c235774Smrg	lint_options="-badflag"
18191c235774Smrg	;;
18201c235774Smrg  *freebsd* | *netbsd*)
18211c235774Smrg	lint_name=lint
18221c235774Smrg	lint_options="-u -b"
18231c235774Smrg	;;
18241c235774Smrg  *solaris*)
18251c235774Smrg	lint_name=lint
18261c235774Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18271c235774Smrg	;;
18281c235774Smrgesac
18296e7d3316Smrg
18301c235774Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18311c235774Smrgif test "x$use_lint" = x"yes" ; then
18321c235774Smrg   AC_PATH_PROG([LINT], [$lint_name])
18331c235774Smrg   if test "x$LINT" = "x"; then
18341c235774Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18351c235774Smrg   fi
18361c235774Smrgelif test "x$use_lint" = x"no" ; then
18371c235774Smrg   if test "x$LINT" != "x"; then
18381c235774Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18391c235774Smrg   fi
184019569120Smrgelse
18411c235774Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
184219569120Smrgfi
18436e7d3316Smrg
18441c235774Smrg# User supplied flags override default flags
18451c235774Smrgif test "x$LINT_FLAGS" != "x"; then
18461c235774Smrg   lint_options=$LINT_FLAGS
18471c235774Smrgfi
18486e7d3316Smrg
18491c235774SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18501c235774SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
18519f00f3a1Smrg
18521c235774Smrg]) # XORG_WITH_LINT
18536e7d3316Smrg
18541c235774Smrg# XORG_LINT_LIBRARY(LIBNAME)
18551c235774Smrg# --------------------------
18561c235774Smrg# Minimum version: 1.1.0
185719569120Smrg#
18581c235774Smrg# Sets up flags for building lint libraries for checking programs that call
18591c235774Smrg# functions in the library.
18601c235774Smrg#
18611c235774Smrg# Interface to module:
18621c235774Smrg# LINTLIB		- Automake variable with the name of lint library file to make
18631c235774Smrg# MAKE_LINT_LIB		- Automake conditional
18641c235774Smrg#
18651c235774Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18661c235774Smrg#			  - 'no' user instructs the module not to create a lint library (default)
18676e7d3316Smrg
18681c235774SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18691c235774SmrgAC_REQUIRE([XORG_WITH_LINT])
18701c235774SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18711c235774Smrg	[Create lint library (default: disabled)])],
18721c235774Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18736e7d3316Smrg
18741c235774Smrgif test "x$make_lint_lib" = x"yes" ; then
18751c235774Smrg   LINTLIB=llib-l$1.ln
18761c235774Smrg   if test "x$LINT" = "x"; then
18771c235774Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18781c235774Smrg   fi
18791c235774Smrgelif test "x$make_lint_lib" != x"no" ; then
18801c235774Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
188197cf2ee2Smrgfi
188219569120Smrg
18831c235774SmrgAC_SUBST(LINTLIB)
18841c235774SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18856e7d3316Smrg
18861c235774Smrg]) # XORG_LINT_LIBRARY
1887a966c04fSmrg
18881c235774Smrg# XORG_COMPILER_BRAND
18891c235774Smrg# -------------------
18901c235774Smrg# Minimum version: 1.14.0
18919f00f3a1Smrg#
18921c235774Smrg# Checks for various brands of compilers and sets flags as appropriate:
18931c235774Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18941c235774Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18951c235774Smrg#   clang compiler - sets CLANGCC to "yes"
18961c235774Smrg#   Intel compiler - sets INTELCC to "yes"
18971c235774Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18989f00f3a1Smrg#
18991c235774SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19001c235774SmrgAC_LANG_CASE(
19011c235774Smrg	[C], [
190274835918Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
190374835918Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
190474835918Smrg		m4_version_prereq([2.70],
190574835918Smrg			[AC_REQUIRE([AC_PROG_CC])],
190674835918Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
19071c235774Smrg	],
19081c235774Smrg	[C++], [
19091c235774Smrg		AC_REQUIRE([AC_PROG_CXX])
19101c235774Smrg	]
19111c235774Smrg)
19121c235774SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19131c235774SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19141c235774SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19151c235774Smrg]) # XORG_COMPILER_BRAND
19161c235774Smrg
19171c235774Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19181c235774Smrg# ---------------
19191c235774Smrg# Minimum version: 1.16.0
19209f00f3a1Smrg#
19211c235774Smrg# Test if the compiler works when passed the given flag as a command line argument.
192274835918Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
19231c235774Smrg# next flag in the list until there are no more options.
19249f00f3a1Smrg#
19251c235774Smrg# Note that this does not guarantee that the compiler supports the flag as some
19261c235774Smrg# compilers will simply ignore arguments that they do not understand, but we do
19271c235774Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19281c235774Smrg# -Werror=unused-command-line-argument
19299f00f3a1Smrg#
19301c235774SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19311c235774Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19321c235774Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1933a966c04fSmrg
19341c235774SmrgAC_LANG_COMPILER_REQUIRE
19351c235774Smrg
19361c235774SmrgAC_LANG_CASE(
19371c235774Smrg	[C], [
193874835918Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
193974835918Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
194074835918Smrg		m4_version_prereq([2.70],
194174835918Smrg			[AC_REQUIRE([AC_PROG_CC])],
194274835918Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
19431c235774Smrg		define([PREFIX], [C])
19441c235774Smrg		define([CACHE_PREFIX], [cc])
19451c235774Smrg		define([COMPILER], [$CC])
19461c235774Smrg	],
19471c235774Smrg	[C++], [
19481c235774Smrg		define([PREFIX], [CXX])
19491c235774Smrg		define([CACHE_PREFIX], [cxx])
19501c235774Smrg		define([COMPILER], [$CXX])
19511c235774Smrg	]
19521c235774Smrg)
19531c235774Smrg
19541c235774Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19551c235774Smrg
19561c235774Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19571c235774Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19581c235774Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19591c235774Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19601c235774Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19611c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19621c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19631c235774Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19641c235774Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19651c235774Smrgfi
19661c235774Smrg
19671c235774Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19681c235774Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19691c235774Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19701c235774Smrg	fi
19711c235774Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19721c235774Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19731c235774Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19741c235774Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19751c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19761c235774Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19771c235774Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19781c235774Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
197919569120Smrgfi
1980a966c04fSmrg
19811c235774Smrgfound="no"
19821c235774Smrgm4_foreach([flag], m4_cdr($@), [
19831c235774Smrg	if test $found = "no" ; then
19841c235774Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19851c235774Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19861c235774Smrg		fi
19876e7d3316Smrg
19881c235774Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19891c235774Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19901c235774Smrg		fi
1991a966c04fSmrg
19921c235774Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19931c235774Smrg
19941c235774Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19951c235774Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19961c235774Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19971c235774Smrg		AC_CACHE_VAL($cacheid,
19981c235774Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19991c235774Smrg					     [eval $cacheid=yes],
20001c235774Smrg					     [eval $cacheid=no])])
20011c235774Smrg
20021c235774Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
20031c235774Smrg
20041c235774Smrg		eval supported=\$$cacheid
20051c235774Smrg		AC_MSG_RESULT([$supported])
20061c235774Smrg		if test "$supported" = "yes" ; then
20071c235774Smrg			$1="$$1 ]flag["
20081c235774Smrg			found="yes"
20091c235774Smrg		fi
20101c235774Smrg	fi
20111c235774Smrg])
20121c235774Smrg]) # XORG_TESTSET_CFLAG
20131c235774Smrg
20141c235774Smrg# XORG_COMPILER_FLAGS
20151c235774Smrg# ---------------
20161c235774Smrg# Minimum version: 1.16.0
20179f00f3a1Smrg#
20181c235774Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20191c235774Smrg# arguments supported by the selected compiler which do NOT alter the generated
20201c235774Smrg# code.  These arguments will cause the compiler to print various warnings
20211c235774Smrg# during compilation AND turn a conservative set of warnings into errors.
20229f00f3a1Smrg#
20231c235774Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20241c235774Smrg# future versions of util-macros as options are added to new compilers.
20259f00f3a1Smrg#
20261c235774SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20271c235774SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2028a966c04fSmrg
20291c235774SmrgAC_ARG_ENABLE(selective-werror,
20301c235774Smrg              AS_HELP_STRING([--disable-selective-werror],
20311c235774Smrg                             [Turn off selective compiler errors. (default: enabled)]),
20321c235774Smrg              [SELECTIVE_WERROR=$enableval],
20331c235774Smrg              [SELECTIVE_WERROR=yes])
20341c235774Smrg
20351c235774SmrgAC_LANG_CASE(
20361c235774Smrg        [C], [
20371c235774Smrg                define([PREFIX], [C])
20381c235774Smrg        ],
20391c235774Smrg        [C++], [
20401c235774Smrg                define([PREFIX], [CXX])
20411c235774Smrg        ]
20421c235774Smrg)
20431c235774Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20441c235774Smrgif test "x$SUNCC" = "xyes"; then
20451c235774Smrg    [BASE_]PREFIX[FLAGS]="-v"
204619569120Smrgelse
20471c235774Smrg    [BASE_]PREFIX[FLAGS]=""
204819569120Smrgfi
2049edce3322Smrg
20501c235774Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20511c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20521c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20531c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20541c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20556e7d3316Smrg
20561c235774SmrgAC_LANG_CASE(
20571c235774Smrg	[C], [
20581c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20591c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20601c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20611c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
20621c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20631c235774Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20641c235774Smrg	]
20651c235774Smrg)
2066a966c04fSmrg
20671c235774Smrg# This chunk adds additional warnings that could catch undesired effects.
20681c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20691c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20701c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20711c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20721c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20731c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
20741c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20751c235774Smrg
20761c235774Smrg# These are currently disabled because they are noisy.  They will be enabled
20771c235774Smrg# in the future once the codebase is sufficiently modernized to silence
20781c235774Smrg# them.  For now, I don't want them to drown out the other warnings.
20791c235774Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20801c235774Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
20811c235774Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20821c235774Smrg
208374835918Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
20841c235774Smrg# when there are problems that should be fixed.
20851c235774Smrg
20861c235774Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20871c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20881c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20891c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20901c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20911c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20921c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20931c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20941c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20951c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20961c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20971c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20981c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20991c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
210019569120Smrgelse
21011c235774SmrgAC_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])
21021c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
21031c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
21041c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
21051c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
21061c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
21071c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21081c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21091c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21101c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21111c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21121c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21131c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21141c235774SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
211519569120Smrgfi
2116a966c04fSmrg
21171c235774SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21181c235774Smrg]) # XORG_COMPILER_FLAGS
2119a966c04fSmrg
21201c235774Smrg# XORG_CWARNFLAGS
21211c235774Smrg# ---------------
21221c235774Smrg# Minimum version: 1.2.0
21231c235774Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21249f00f3a1Smrg#
21251c235774Smrg# Defines CWARNFLAGS to enable C compiler warnings.
21269f00f3a1Smrg#
21271c235774Smrg# This function is deprecated because it defines -fno-strict-aliasing
21281c235774Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21291c235774Smrg# is needed, then it should be added explicitly in the module when
21301c235774Smrg# it is updated to use BASE_CFLAGS.
21319f00f3a1Smrg#
21321c235774SmrgAC_DEFUN([XORG_CWARNFLAGS], [
21331c235774SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21341c235774SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21351c235774SmrgAC_LANG_CASE(
21361c235774Smrg	[C], [
21371c235774Smrg		CWARNFLAGS="$BASE_CFLAGS"
21381c235774Smrg		if  test "x$GCC" = xyes ; then
21391c235774Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21401c235774Smrg		fi
21411c235774Smrg		AC_SUBST(CWARNFLAGS)
21421c235774Smrg	]
21431c235774Smrg)
21441c235774Smrg]) # XORG_CWARNFLAGS
21451c235774Smrg
21461c235774Smrg# XORG_STRICT_OPTION
21471c235774Smrg# -----------------------
21481c235774Smrg# Minimum version: 1.3.0
21499f00f3a1Smrg#
21501c235774Smrg# Add configure option to enable strict compilation flags, such as treating
21511c235774Smrg# warnings as fatal errors.
21521c235774Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21531c235774Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21541c235774Smrg#
21551c235774Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21561c235774Smrg# when strict compilation is unconditionally desired.
21571c235774SmrgAC_DEFUN([XORG_STRICT_OPTION], [
21581c235774SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21591c235774SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2160a966c04fSmrg
21611c235774SmrgAC_ARG_ENABLE(strict-compilation,
21621c235774Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21631c235774Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21641c235774Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
21651c235774Smrg
21661c235774SmrgAC_LANG_CASE(
21671c235774Smrg        [C], [
21681c235774Smrg                define([PREFIX], [C])
21691c235774Smrg        ],
21701c235774Smrg        [C++], [
21711c235774Smrg                define([PREFIX], [CXX])
21721c235774Smrg        ]
21731c235774Smrg)
21741c235774Smrg
21751c235774Smrg[STRICT_]PREFIX[FLAGS]=""
21761c235774SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21771c235774SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
21781c235774Smrg
21791c235774Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21801c235774Smrg# activate it with -Werror, so we add it here explicitly.
21811c235774SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21821c235774Smrg
21831c235774Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21841c235774Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21851c235774Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
218619569120Smrgfi
21871c235774SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21881c235774SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21891c235774SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21901c235774Smrg]) # XORG_STRICT_OPTION
2191a966c04fSmrg
219274835918Smrg# XORG_DEFAULT_NOCODE_OPTIONS
219374835918Smrg# ---------------------------
219474835918Smrg# Minimum version: 1.20.0
219574835918Smrg#
219674835918Smrg# Defines default options for X.Org modules which don't compile code,
219774835918Smrg# such as fonts, bitmaps, cursors, and docs.
219874835918Smrg#
219974835918SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
220074835918SmrgAC_REQUIRE([AC_PROG_INSTALL])
220174835918SmrgXORG_RELEASE_VERSION
220274835918SmrgXORG_CHANGELOG
220374835918SmrgXORG_INSTALL
220474835918SmrgXORG_MANPAGE_SECTIONS
220574835918Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
220674835918Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
220774835918Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
220874835918Smrg
22091c235774Smrg# XORG_DEFAULT_OPTIONS
22101c235774Smrg# --------------------
22111c235774Smrg# Minimum version: 1.3.0
221219569120Smrg#
221374835918Smrg# Defines default options for X.Org modules which compile code.
221419569120Smrg#
22151c235774SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
22161c235774SmrgAC_REQUIRE([AC_PROG_INSTALL])
22171c235774SmrgXORG_COMPILER_FLAGS
22181c235774SmrgXORG_CWARNFLAGS
22191c235774SmrgXORG_STRICT_OPTION
222074835918SmrgXORG_DEFAULT_NOCODE_OPTIONS
22211c235774Smrg]) # XORG_DEFAULT_OPTIONS
22221c235774Smrg
22231c235774Smrg# XORG_INSTALL()
22241c235774Smrg# ----------------
22251c235774Smrg# Minimum version: 1.4.0
22269f00f3a1Smrg#
22271c235774Smrg# Defines the variable INSTALL_CMD as the command to copy
22281c235774Smrg# INSTALL from $prefix/share/util-macros.
222919569120Smrg#
22301c235774SmrgAC_DEFUN([XORG_INSTALL], [
22311c235774SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22321c235774Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22331c235774SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22341c235774Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
223574835918Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
223674835918Smrgtouch \$(top_srcdir)/INSTALL; \
223774835918Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22381c235774SmrgAC_SUBST([INSTALL_CMD])
22391c235774Smrg]) # XORG_INSTALL
22401c235774Smrgdnl Copyright 2005 Red Hat, Inc
22411c235774Smrgdnl
22421c235774Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22431c235774Smrgdnl documentation for any purpose is hereby granted without fee, provided that
22441c235774Smrgdnl the above copyright notice appear in all copies and that both that
22451c235774Smrgdnl copyright notice and this permission notice appear in supporting
22461c235774Smrgdnl documentation.
22471c235774Smrgdnl
22481c235774Smrgdnl The above copyright notice and this permission notice shall be included
22491c235774Smrgdnl in all copies or substantial portions of the Software.
22501c235774Smrgdnl
22511c235774Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22521c235774Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22531c235774Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22541c235774Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22551c235774Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22561c235774Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22571c235774Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
22581c235774Smrgdnl
22591c235774Smrgdnl Except as contained in this notice, the name of the copyright holders shall
22601c235774Smrgdnl not be used in advertising or otherwise to promote the sale, use or
22611c235774Smrgdnl other dealings in this Software without prior written authorization
22621c235774Smrgdnl from the copyright holders.
22631c235774Smrgdnl
2264a966c04fSmrg
22651c235774Smrg# XORG_RELEASE_VERSION
22661c235774Smrg# --------------------
22671c235774Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2268a966c04fSmrg
22691c235774SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22701c235774Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22711c235774Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22721c235774Smrg		[Major version of this package])
22731c235774Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22741c235774Smrg	if test "x$PVM" = "x"; then
22751c235774Smrg		PVM="0"
22761c235774Smrg	fi
22771c235774Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22781c235774Smrg		[$PVM],
22791c235774Smrg		[Minor version of this package])
22801c235774Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22811c235774Smrg	if test "x$PVP" = "x"; then
22821c235774Smrg		PVP="0"
22831c235774Smrg	fi
22841c235774Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22851c235774Smrg		[$PVP],
22861c235774Smrg		[Patch version of this package])
22871c235774Smrg])
22886e7d3316Smrg
22891c235774Smrg# XORG_CHANGELOG()
229019569120Smrg# ----------------
22911c235774Smrg# Minimum version: 1.2.0
229219569120Smrg#
22931c235774Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22941c235774Smrg# ChangeLog from git.
229519569120Smrg#
229619569120Smrg#
22971c235774SmrgAC_DEFUN([XORG_CHANGELOG], [
229874835918SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22991c235774Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
230074835918Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
230174835918Smrgtouch \$(top_srcdir)/ChangeLog; \
230274835918Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
23031c235774SmrgAC_SUBST([CHANGELOG_CMD])
23041c235774Smrg]) # XORG_CHANGELOG
23051c235774Smrg
230674835918Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
230719569120Smrg#
23081c235774Smrg# This file is free software; the Free Software Foundation
23091c235774Smrg# gives unlimited permission to copy and/or distribute it,
23101c235774Smrg# with or without modifications, as long as this notice is preserved.
23116e7d3316Smrg
23121c235774Smrg# AM_AUTOMAKE_VERSION(VERSION)
23131c235774Smrg# ----------------------------
23141c235774Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
23151c235774Smrg# generated from the m4 files accompanying Automake X.Y.
23161c235774Smrg# (This private macro should not be called outside this file.)
23171c235774SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
231874835918Smrg[am__api_version='1.16'
23191c235774Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
23201c235774Smrgdnl require some minimum version.  Point them to the right macro.
232174835918Smrgm4_if([$1], [1.16.5], [],
23221c235774Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
23231c235774Smrg])
232497cf2ee2Smrg
23251c235774Smrg# _AM_AUTOCONF_VERSION(VERSION)
23261c235774Smrg# -----------------------------
23271c235774Smrg# aclocal traces this macro to find the Autoconf version.
23281c235774Smrg# This is a private macro too.  Using m4_define simplifies
23291c235774Smrg# the logic in aclocal, which can simply ignore this definition.
23301c235774Smrgm4_define([_AM_AUTOCONF_VERSION], [])
233197cf2ee2Smrg
23321c235774Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
23331c235774Smrg# -------------------------------
23341c235774Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23351c235774Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
23361c235774SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
233774835918Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
23381c235774Smrgm4_ifndef([AC_AUTOCONF_VERSION],
23391c235774Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23401c235774Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
234197cf2ee2Smrg
23421c235774Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2343a966c04fSmrg
234474835918Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
234519569120Smrg#
23461c235774Smrg# This file is free software; the Free Software Foundation
23471c235774Smrg# gives unlimited permission to copy and/or distribute it,
23481c235774Smrg# with or without modifications, as long as this notice is preserved.
2349a966c04fSmrg
23501c235774Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23511c235774Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23521c235774Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
23531c235774Smrg#
23541c235774Smrg# Of course, Automake must honor this variable whenever it calls a
23551c235774Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
23561c235774Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
23571c235774Smrg# depending on how configure is run.  This is pretty annoying, since
23581c235774Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
23591c235774Smrg# source directory, any form will work fine, but in subdirectories a
23601c235774Smrg# relative path needs to be adjusted first.
2361ac92798bSmrg#
23621c235774Smrg# $ac_aux_dir/missing
23631c235774Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
23641c235774Smrg# $top_srcdir/$ac_aux_dir/missing
23651c235774Smrg#    fails if $ac_aux_dir is absolute,
23661c235774Smrg#    fails when called from a subdirectory in a VPATH build with
23671c235774Smrg#          a relative $ac_aux_dir
236819569120Smrg#
23691c235774Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
23701c235774Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
23711c235774Smrg# harmless because $srcdir is '.', but things will broke when you
23721c235774Smrg# start a VPATH build or use an absolute $srcdir.
237319569120Smrg#
23741c235774Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
23751c235774Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
23761c235774Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
23771c235774Smrg# and then we would define $MISSING as
23781c235774Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
23791c235774Smrg# This will work as long as MISSING is not called from configure, because
23801c235774Smrg# unfortunately $(top_srcdir) has no meaning in configure.
23811c235774Smrg# However there are other variables, like CC, which are often used in
23821c235774Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
23831c235774Smrg#
23841c235774Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
23851c235774Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
23861c235774Smrg# configured tree to be moved without reconfiguration.
2387ac92798bSmrg
23881c235774SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23891c235774Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
23901c235774Smrg# Expand $ac_aux_dir to an absolute path.
23911c235774Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
23921c235774Smrg])
239319569120Smrg
23941c235774Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
23951c235774Smrg
239674835918Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
239719569120Smrg#
23981c235774Smrg# This file is free software; the Free Software Foundation
23991c235774Smrg# gives unlimited permission to copy and/or distribute it,
24001c235774Smrg# with or without modifications, as long as this notice is preserved.
24011c235774Smrg
24021c235774Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
24031c235774Smrg# -------------------------------------
24041c235774Smrg# Define a conditional.
24051c235774SmrgAC_DEFUN([AM_CONDITIONAL],
24061c235774Smrg[AC_PREREQ([2.52])dnl
24071c235774Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
24081c235774Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
24091c235774SmrgAC_SUBST([$1_TRUE])dnl
24101c235774SmrgAC_SUBST([$1_FALSE])dnl
24111c235774Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
24121c235774Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
24131c235774Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
24141c235774Smrgif $2; then
24151c235774Smrg  $1_TRUE=
24161c235774Smrg  $1_FALSE='#'
24171c235774Smrgelse
24181c235774Smrg  $1_TRUE='#'
24191c235774Smrg  $1_FALSE=
24201c235774Smrgfi
24211c235774SmrgAC_CONFIG_COMMANDS_PRE(
24221c235774Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
24231c235774Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
24241c235774SmrgUsually this means the macro was only invoked conditionally.]])
24251c235774Smrgfi])])
24261c235774Smrg
242774835918Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
242819569120Smrg#
24291c235774Smrg# This file is free software; the Free Software Foundation
24301c235774Smrg# gives unlimited permission to copy and/or distribute it,
24311c235774Smrg# with or without modifications, as long as this notice is preserved.
24321c235774Smrg
24331c235774Smrg
24341c235774Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
24351c235774Smrg# written in clear, in which case automake, when reading aclocal.m4,
24361c235774Smrg# will think it sees a *use*, and therefore will trigger all it's
24371c235774Smrg# C support machinery.  Also note that it means that autoscan, seeing
24381c235774Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
24391c235774Smrg
24401c235774Smrg
24411c235774Smrg# _AM_DEPENDENCIES(NAME)
24421c235774Smrg# ----------------------
24431c235774Smrg# See how the compiler implements dependency checking.
24441c235774Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
24451c235774Smrg# We try a few techniques and use that to set a single cache variable.
244619569120Smrg#
24471c235774Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
24481c235774Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
24491c235774Smrg# dependency, and given that the user is not expected to run this macro,
24501c235774Smrg# just rely on AC_PROG_CC.
24511c235774SmrgAC_DEFUN([_AM_DEPENDENCIES],
24521c235774Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
24531c235774SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
24541c235774SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
24551c235774SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
24569f00f3a1Smrg
24571c235774Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24581c235774Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24591c235774Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24601c235774Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24611c235774Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24621c235774Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24631c235774Smrg                    [depcc="$$1"   am_compiler_list=])
24641c235774Smrg
24651c235774SmrgAC_CACHE_CHECK([dependency style of $depcc],
24661c235774Smrg               [am_cv_$1_dependencies_compiler_type],
24671c235774Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
24681c235774Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
24691c235774Smrg  # making bogus files that we don't know about and never remove.  For
24701c235774Smrg  # instance it was reported that on HP-UX the gcc test will end up
24711c235774Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24721c235774Smrg  # in D".
24731c235774Smrg  rm -rf conftest.dir
24741c235774Smrg  mkdir conftest.dir
24751c235774Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
24761c235774Smrg  # using a relative directory.
24771c235774Smrg  cp "$am_depcomp" conftest.dir
24781c235774Smrg  cd conftest.dir
24791c235774Smrg  # We will build objects and dependencies in a subdirectory because
24801c235774Smrg  # it helps to detect inapplicable dependency modes.  For instance
24811c235774Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
24821c235774Smrg  # side effect of compilation, but ICC will put the dependencies in
24831c235774Smrg  # the current directory while Tru64 will put them in the object
24841c235774Smrg  # directory.
24851c235774Smrg  mkdir sub
24861c235774Smrg
24871c235774Smrg  am_cv_$1_dependencies_compiler_type=none
24881c235774Smrg  if test "$am_compiler_list" = ""; then
24891c235774Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24901c235774Smrg  fi
24911c235774Smrg  am__universal=false
24921c235774Smrg  m4_case([$1], [CC],
24931c235774Smrg    [case " $depcc " in #(
24941c235774Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24951c235774Smrg     esac],
24961c235774Smrg    [CXX],
24971c235774Smrg    [case " $depcc " in #(
24981c235774Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24991c235774Smrg     esac])
25001c235774Smrg
25011c235774Smrg  for depmode in $am_compiler_list; do
25021c235774Smrg    # Setup a source with many dependencies, because some compilers
25031c235774Smrg    # like to wrap large dependency lists on column 80 (with \), and
25041c235774Smrg    # we should not choose a depcomp mode which is confused by this.
25051c235774Smrg    #
25061c235774Smrg    # We need to recreate these files for each test, as the compiler may
25071c235774Smrg    # overwrite some of them when testing with obscure command lines.
25081c235774Smrg    # This happens at least with the AIX C compiler.
25091c235774Smrg    : > sub/conftest.c
25101c235774Smrg    for i in 1 2 3 4 5 6; do
25111c235774Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
25121c235774Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
25131c235774Smrg      # Solaris 10 /bin/sh.
25141c235774Smrg      echo '/* dummy */' > sub/conftst$i.h
25151c235774Smrg    done
25161c235774Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
25171c235774Smrg
25181c235774Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
25191c235774Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25201c235774Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25211c235774Smrg    # versions had trouble with output in subdirs.
25221c235774Smrg    am__obj=sub/conftest.${OBJEXT-o}
25231c235774Smrg    am__minus_obj="-o $am__obj"
25241c235774Smrg    case $depmode in
25251c235774Smrg    gcc)
25261c235774Smrg      # This depmode causes a compiler race in universal mode.
25271c235774Smrg      test "$am__universal" = false || continue
25281c235774Smrg      ;;
25291c235774Smrg    nosideeffect)
25301c235774Smrg      # After this tag, mechanisms are not by side-effect, so they'll
25311c235774Smrg      # only be used when explicitly requested.
25321c235774Smrg      if test "x$enable_dependency_tracking" = xyes; then
25331c235774Smrg	continue
25341c235774Smrg      else
25351c235774Smrg	break
25361c235774Smrg      fi
25371c235774Smrg      ;;
25381c235774Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25391c235774Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25401c235774Smrg      # not run yet.  These depmodes are late enough in the game, and
25411c235774Smrg      # so weak that their functioning should not be impacted.
25421c235774Smrg      am__obj=conftest.${OBJEXT-o}
25431c235774Smrg      am__minus_obj=
25441c235774Smrg      ;;
25451c235774Smrg    none) break ;;
25461c235774Smrg    esac
25471c235774Smrg    if depmode=$depmode \
25481c235774Smrg       source=sub/conftest.c object=$am__obj \
25491c235774Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25501c235774Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
25511c235774Smrg         >/dev/null 2>conftest.err &&
25521c235774Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
25531c235774Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25541c235774Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
25551c235774Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
25561c235774Smrg      # icc doesn't choke on unknown options, it will just issue warnings
25571c235774Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
25581c235774Smrg      # that says an option was ignored or not supported.
25591c235774Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
25601c235774Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
25611c235774Smrg      # The diagnosis changed in icc 8.0:
25621c235774Smrg      #   icc: Command line remark: option '-MP' not supported
25631c235774Smrg      if (grep 'ignoring option' conftest.err ||
25641c235774Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
25651c235774Smrg        am_cv_$1_dependencies_compiler_type=$depmode
25661c235774Smrg        break
25671c235774Smrg      fi
25681c235774Smrg    fi
25691c235774Smrg  done
25701c235774Smrg
25711c235774Smrg  cd ..
25721c235774Smrg  rm -rf conftest.dir
257319569120Smrgelse
25741c235774Smrg  am_cv_$1_dependencies_compiler_type=none
257519569120Smrgfi
25761c235774Smrg])
25771c235774SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
25781c235774SmrgAM_CONDITIONAL([am__fastdep$1], [
25791c235774Smrg  test "x$enable_dependency_tracking" != xno \
25801c235774Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
25811c235774Smrg])
25829f00f3a1Smrg
25839f00f3a1Smrg
25841c235774Smrg# AM_SET_DEPDIR
25851c235774Smrg# -------------
25861c235774Smrg# Choose a directory name for dependency files.
25871c235774Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25881c235774SmrgAC_DEFUN([AM_SET_DEPDIR],
25891c235774Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25901c235774SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25911c235774Smrg])
25929f00f3a1Smrg
2593a966c04fSmrg
25941c235774Smrg# AM_DEP_TRACK
25951c235774Smrg# ------------
25961c235774SmrgAC_DEFUN([AM_DEP_TRACK],
25971c235774Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25981c235774SmrgAS_HELP_STRING(
25991c235774Smrg  [--enable-dependency-tracking],
26001c235774Smrg  [do not reject slow dependency extractors])
26011c235774SmrgAS_HELP_STRING(
26021c235774Smrg  [--disable-dependency-tracking],
26031c235774Smrg  [speeds up one-time build])])
26041c235774Smrgif test "x$enable_dependency_tracking" != xno; then
26051c235774Smrg  am_depcomp="$ac_aux_dir/depcomp"
26061c235774Smrg  AMDEPBACKSLASH='\'
26071c235774Smrg  am__nodep='_no'
26081c235774Smrgfi
26091c235774SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
26101c235774SmrgAC_SUBST([AMDEPBACKSLASH])dnl
26111c235774Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
26121c235774SmrgAC_SUBST([am__nodep])dnl
26131c235774Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
26141c235774Smrg])
2615a966c04fSmrg
26161c235774Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
26179f00f3a1Smrg
261874835918Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
261919569120Smrg#
26201c235774Smrg# This file is free software; the Free Software Foundation
26211c235774Smrg# gives unlimited permission to copy and/or distribute it,
26221c235774Smrg# with or without modifications, as long as this notice is preserved.
26231c235774Smrg
26241c235774Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
26251c235774Smrg# ------------------------------
26261c235774SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26271c235774Smrg[{
26281c235774Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
26291c235774Smrg  # are listed without --file.  Let's play safe and only enable the eval
26301c235774Smrg  # if we detect the quoting.
263174835918Smrg  # TODO: see whether this extra hack can be removed once we start
263274835918Smrg  # requiring Autoconf 2.70 or later.
263374835918Smrg  AS_CASE([$CONFIG_FILES],
263474835918Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
263574835918Smrg          [*], [set x $CONFIG_FILES])
26361c235774Smrg  shift
263774835918Smrg  # Used to flag and report bootstrapping failures.
263874835918Smrg  am_rc=0
263974835918Smrg  for am_mf
26401c235774Smrg  do
26411c235774Smrg    # Strip MF so we end up with the name of the file.
264274835918Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
264374835918Smrg    # Check whether this is an Automake generated Makefile which includes
264474835918Smrg    # dependency-tracking related rules and includes.
264574835918Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
26461c235774Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
264774835918Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
264874835918Smrg      || continue
264974835918Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
265074835918Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
265174835918Smrg    AM_RUN_LOG([cd "$am_dirpart" \
265274835918Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
265374835918Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
26541c235774Smrg  done
265574835918Smrg  if test $am_rc -ne 0; then
265674835918Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
265774835918Smrg    for automatic dependency tracking.  If GNU make was not used, consider
265874835918Smrg    re-running the configure script with MAKE="gmake" (or whatever is
265974835918Smrg    necessary).  You can also try re-running configure with the
266074835918Smrg    '--disable-dependency-tracking' option to at least be able to build
266174835918Smrg    the package (albeit without support for automatic dependency tracking).])
266274835918Smrg  fi
266374835918Smrg  AS_UNSET([am_dirpart])
266474835918Smrg  AS_UNSET([am_filepart])
266574835918Smrg  AS_UNSET([am_mf])
266674835918Smrg  AS_UNSET([am_rc])
266774835918Smrg  rm -f conftest-deps.mk
26681c235774Smrg}
26691c235774Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
26701c235774Smrg
26711c235774Smrg
26721c235774Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
26731c235774Smrg# -----------------------------
26741c235774Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
267519569120Smrg#
267674835918Smrg# This code is only required when automatic dependency tracking is enabled.
267774835918Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
267874835918Smrg# order to bootstrap the dependency handling code.
26791c235774SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
26801c235774Smrg[AC_CONFIG_COMMANDS([depfiles],
26811c235774Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
268274835918Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
268319569120Smrg
26841c235774Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2685a966c04fSmrg
268674835918Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
26871c235774Smrg#
26881c235774Smrg# This file is free software; the Free Software Foundation
26891c235774Smrg# gives unlimited permission to copy and/or distribute it,
26901c235774Smrg# with or without modifications, as long as this notice is preserved.
2691a966c04fSmrg
26921c235774Smrg# This macro actually does too much.  Some checks are only needed if
26931c235774Smrg# your package does certain things.  But this isn't really a big deal.
26941c235774Smrg
26951c235774Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26961c235774Smrgm4_define([AC_PROG_CC],
26971c235774Smrgm4_defn([AC_PROG_CC])
26981c235774Smrg[_AM_PROG_CC_C_O
26991c235774Smrg])
27001c235774Smrg
27011c235774Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
27021c235774Smrg# AM_INIT_AUTOMAKE([OPTIONS])
27031c235774Smrg# -----------------------------------------------
27041c235774Smrg# The call with PACKAGE and VERSION arguments is the old style
27051c235774Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
27061c235774Smrg# and VERSION should now be passed to AC_INIT and removed from
27071c235774Smrg# the call to AM_INIT_AUTOMAKE.
27081c235774Smrg# We support both call styles for the transition.  After
27091c235774Smrg# the next Automake release, Autoconf can make the AC_INIT
27101c235774Smrg# arguments mandatory, and then we can depend on a new Autoconf
27111c235774Smrg# release and drop the old call support.
27121c235774SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
27131c235774Smrg[AC_PREREQ([2.65])dnl
271474835918Smrgm4_ifdef([_$0_ALREADY_INIT],
271574835918Smrg  [m4_fatal([$0 expanded multiple times
271674835918Smrg]m4_defn([_$0_ALREADY_INIT]))],
271774835918Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
27181c235774Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
27191c235774Smrgdnl the ones we care about.
27201c235774Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
27211c235774SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
27221c235774SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
27231c235774Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
27241c235774Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
27251c235774Smrg  # is not polluted with repeated "-I."
27261c235774Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27271c235774Smrg  # test to see if srcdir already configured
27281c235774Smrg  if test -f $srcdir/config.status; then
27291c235774Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
273019569120Smrg  fi
273119569120Smrgfi
2732a966c04fSmrg
27331c235774Smrg# test whether we have cygpath
27341c235774Smrgif test -z "$CYGPATH_W"; then
27351c235774Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
27361c235774Smrg    CYGPATH_W='cygpath -w'
27371c235774Smrg  else
27381c235774Smrg    CYGPATH_W=echo
273919569120Smrg  fi
274019569120Smrgfi
27411c235774SmrgAC_SUBST([CYGPATH_W])
2742a966c04fSmrg
27431c235774Smrg# Define the identity of the package.
27441c235774Smrgdnl Distinguish between old-style and new-style calls.
27451c235774Smrgm4_ifval([$2],
27461c235774Smrg[AC_DIAGNOSE([obsolete],
27471c235774Smrg             [$0: two- and three-arguments forms are deprecated.])
27481c235774Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
27491c235774Smrg AC_SUBST([PACKAGE], [$1])dnl
27501c235774Smrg AC_SUBST([VERSION], [$2])],
27511c235774Smrg[_AM_SET_OPTIONS([$1])dnl
27521c235774Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27531c235774Smrgm4_if(
275474835918Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
27551c235774Smrg  [ok:ok],,
27561c235774Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
27571c235774Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
27581c235774Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2759a966c04fSmrg
27601c235774Smrg_AM_IF_OPTION([no-define],,
27611c235774Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27621c235774Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
27632e2dd055Smrg
27641c235774Smrg# Some tools Automake needs.
27651c235774SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
27661c235774SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27671c235774SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27681c235774SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27691c235774SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27701c235774SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27711c235774SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27721c235774SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27731c235774SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27741c235774SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27751c235774Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
27761c235774Smrg# dies out for good.  For more background, see:
277774835918Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
277874835918Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27791c235774SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
27801c235774Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
27811c235774Smrg# system "awk" is bad on some platforms.
27821c235774SmrgAC_REQUIRE([AC_PROG_AWK])dnl
27831c235774SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
27841c235774SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
27851c235774Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27861c235774Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27871c235774Smrg			     [_AM_PROG_TAR([v7])])])
27881c235774Smrg_AM_IF_OPTION([no-dependencies],,
27891c235774Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27901c235774Smrg		  [_AM_DEPENDENCIES([CC])],
27911c235774Smrg		  [m4_define([AC_PROG_CC],
27921c235774Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27931c235774SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27941c235774Smrg		  [_AM_DEPENDENCIES([CXX])],
27951c235774Smrg		  [m4_define([AC_PROG_CXX],
27961c235774Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27971c235774SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27981c235774Smrg		  [_AM_DEPENDENCIES([OBJC])],
27991c235774Smrg		  [m4_define([AC_PROG_OBJC],
28001c235774Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
28011c235774SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
28021c235774Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
28031c235774Smrg		  [m4_define([AC_PROG_OBJCXX],
28041c235774Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
28051c235774Smrg])
280674835918Smrg# Variables for tags utilities; see am/tags.am
280774835918Smrgif test -z "$CTAGS"; then
280874835918Smrg  CTAGS=ctags
280974835918Smrgfi
281074835918SmrgAC_SUBST([CTAGS])
281174835918Smrgif test -z "$ETAGS"; then
281274835918Smrg  ETAGS=etags
281374835918Smrgfi
281474835918SmrgAC_SUBST([ETAGS])
281574835918Smrgif test -z "$CSCOPE"; then
281674835918Smrg  CSCOPE=cscope
281774835918Smrgfi
281874835918SmrgAC_SUBST([CSCOPE])
281974835918Smrg
28201c235774SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
28211c235774Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
28221c235774Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
28231c235774Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
28241c235774SmrgAC_CONFIG_COMMANDS_PRE(dnl
28251c235774Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
28261c235774Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
28271c235774Smrg
28281c235774Smrg# POSIX will say in a future version that running "rm -f" with no argument
28291c235774Smrg# is OK; and we want to be able to make that assumption in our Makefile
28301c235774Smrg# recipes.  So use an aggressive probe to check that the usage we want is
28311c235774Smrg# actually supported "in the wild" to an acceptable degree.
28321c235774Smrg# See automake bug#10828.
28331c235774Smrg# To make any issue more visible, cause the running configure to be aborted
28341c235774Smrg# by default if the 'rm' program in use doesn't match our expectations; the
28351c235774Smrg# user can still override this though.
28361c235774Smrgif rm -f && rm -fr && rm -rf; then : OK; else
28371c235774Smrg  cat >&2 <<'END'
28381c235774SmrgOops!
28392e2dd055Smrg
28401c235774SmrgYour 'rm' program seems unable to run without file operands specified
28411c235774Smrgon the command line, even when the '-f' option is present.  This is contrary
28421c235774Smrgto the behaviour of most rm programs out there, and not conforming with
28431c235774Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
28442e2dd055Smrg
28451c235774SmrgPlease tell bug-automake@gnu.org about your system, including the value
28461c235774Smrgof your $PATH and any error possibly output before this message.  This
28471c235774Smrgcan help us improve future automake versions.
28482e2dd055Smrg
28491c235774SmrgEND
28501c235774Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28511c235774Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28521c235774Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28531c235774Smrg    echo >&2
28541c235774Smrg  else
28551c235774Smrg    cat >&2 <<'END'
28561c235774SmrgAborting the configuration process, to ensure you take notice of the issue.
2857a966c04fSmrg
28581c235774SmrgYou can download and install GNU coreutils to get an 'rm' implementation
285974835918Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28601c235774Smrg
28611c235774SmrgIf you want to complete the configuration process using your problematic
28621c235774Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28631c235774Smrgto "yes", and re-run configure.
28641c235774Smrg
28651c235774SmrgEND
28661c235774Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28671c235774Smrg  fi
2868edce3322Smrgfi
28691c235774Smrgdnl The trailing newline in this macro's definition is deliberate, for
28701c235774Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
28711c235774Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28721c235774Smrg])
28736e7d3316Smrg
28741c235774Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28751c235774Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28761c235774Smrgdnl mangled by Autoconf and run in a shell conditional statement.
28771c235774Smrgm4_define([_AC_COMPILER_EXEEXT],
28781c235774Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
28796e7d3316Smrg
28801c235774Smrg# When config.status generates a header, we must update the stamp-h file.
28811c235774Smrg# This file resides in the same directory as the config header
28821c235774Smrg# that is generated.  The stamp files are numbered to have different names.
28831c235774Smrg
28841c235774Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
28851c235774Smrg# loop where config.status creates the headers, so we can generate
28861c235774Smrg# our stamp files there.
28871c235774SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
28881c235774Smrg[# Compute $1's index in $config_headers.
28891c235774Smrg_am_arg=$1
28901c235774Smrg_am_stamp_count=1
28911c235774Smrgfor _am_header in $config_headers :; do
28921c235774Smrg  case $_am_header in
28931c235774Smrg    $_am_arg | $_am_arg:* )
28941c235774Smrg      break ;;
28951c235774Smrg    * )
28961c235774Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
28971c235774Smrg  esac
28981c235774Smrgdone
28991c235774Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
29001c235774Smrg
290174835918Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
290297cf2ee2Smrg#
29031c235774Smrg# This file is free software; the Free Software Foundation
29041c235774Smrg# gives unlimited permission to copy and/or distribute it,
29051c235774Smrg# with or without modifications, as long as this notice is preserved.
29066e7d3316Smrg
29071c235774Smrg# AM_PROG_INSTALL_SH
29081c235774Smrg# ------------------
29091c235774Smrg# Define $install_sh.
29101c235774SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
29111c235774Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29121c235774Smrgif test x"${install_sh+set}" != xset; then
29131c235774Smrg  case $am_aux_dir in
29141c235774Smrg  *\ * | *\	*)
29151c235774Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
29161c235774Smrg  *)
29171c235774Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
29181c235774Smrg  esac
29199f00f3a1Smrgfi
29201c235774SmrgAC_SUBST([install_sh])])
29216e7d3316Smrg
292274835918Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
29231c235774Smrg#
29241c235774Smrg# This file is free software; the Free Software Foundation
29251c235774Smrg# gives unlimited permission to copy and/or distribute it,
29261c235774Smrg# with or without modifications, as long as this notice is preserved.
29271c235774Smrg
29281c235774Smrg# Check whether the underlying file-system supports filenames
29291c235774Smrg# with a leading dot.  For instance MS-DOS doesn't.
29301c235774SmrgAC_DEFUN([AM_SET_LEADING_DOT],
29311c235774Smrg[rm -rf .tst 2>/dev/null
29321c235774Smrgmkdir .tst 2>/dev/null
29331c235774Smrgif test -d .tst; then
29341c235774Smrg  am__leading_dot=.
293597cf2ee2Smrgelse
29361c235774Smrg  am__leading_dot=_
293797cf2ee2Smrgfi
29381c235774Smrgrmdir .tst 2>/dev/null
29391c235774SmrgAC_SUBST([am__leading_dot])])
29406e7d3316Smrg
29411c235774Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
29426e7d3316Smrg
294374835918Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
294419569120Smrg#
29451c235774Smrg# This file is free software; the Free Software Foundation
29461c235774Smrg# gives unlimited permission to copy and/or distribute it,
29471c235774Smrg# with or without modifications, as long as this notice is preserved.
294897cf2ee2Smrg
29491c235774Smrg# AM_MAKE_INCLUDE()
29501c235774Smrg# -----------------
295174835918Smrg# Check whether make has an 'include' directive that can support all
295274835918Smrg# the idioms we need for our automatic dependency tracking code.
29531c235774SmrgAC_DEFUN([AM_MAKE_INCLUDE],
295474835918Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
295574835918Smrgcat > confinc.mk << 'END'
29561c235774Smrgam__doit:
295774835918Smrg	@echo this is the am__doit target >confinc.out
29581c235774Smrg.PHONY: am__doit
29591c235774SmrgEND
29601c235774Smrgam__include="#"
29611c235774Smrgam__quote=
296274835918Smrg# BSD make does it like this.
296374835918Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
296474835918Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
296574835918Smrgecho 'include confinc.mk # ignored' > confmf.GNU
296674835918Smrg_am_result=no
296774835918Smrgfor s in GNU BSD; do
296874835918Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
296974835918Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
297074835918Smrg      ['0:this is the am__doit target'],
297174835918Smrg      [AS_CASE([$s],
297274835918Smrg          [BSD], [am__include='.include' am__quote='"'],
297374835918Smrg          [am__include='include' am__quote=''])])
297474835918Smrg  if test "$am__include" != "#"; then
297574835918Smrg    _am_result="yes ($s style)"
297674835918Smrg    break
297774835918Smrg  fi
297874835918Smrgdone
297974835918Smrgrm -f confinc.* confmf.*
298074835918SmrgAC_MSG_RESULT([${_am_result}])
298174835918SmrgAC_SUBST([am__include])])
298274835918SmrgAC_SUBST([am__quote])])
298319569120Smrg
29841c235774Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
29851c235774Smrg
298674835918Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
29871c235774Smrg#
29881c235774Smrg# This file is free software; the Free Software Foundation
29891c235774Smrg# gives unlimited permission to copy and/or distribute it,
29901c235774Smrg# with or without modifications, as long as this notice is preserved.
29911c235774Smrg
29921c235774Smrg# AM_MISSING_PROG(NAME, PROGRAM)
29931c235774Smrg# ------------------------------
29941c235774SmrgAC_DEFUN([AM_MISSING_PROG],
29951c235774Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
29961c235774Smrg$1=${$1-"${am_missing_run}$2"}
29971c235774SmrgAC_SUBST($1)])
29981c235774Smrg
29991c235774Smrg# AM_MISSING_HAS_RUN
30001c235774Smrg# ------------------
30011c235774Smrg# Define MISSING if not defined so far and test if it is modern enough.
30021c235774Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
30031c235774SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
30041c235774Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30051c235774SmrgAC_REQUIRE_AUX_FILE([missing])dnl
30061c235774Smrgif test x"${MISSING+set}" != xset; then
300774835918Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
300897cf2ee2Smrgfi
30091c235774Smrg# Use eval to expand $SHELL
30101c235774Smrgif eval "$MISSING --is-lightweight"; then
30111c235774Smrg  am_missing_run="$MISSING "
30121c235774Smrgelse
30131c235774Smrg  am_missing_run=
30141c235774Smrg  AC_MSG_WARN(['missing' script is too old or missing])
301519569120Smrgfi
30161c235774Smrg])
301797cf2ee2Smrg
30181c235774Smrg# Helper functions for option handling.                     -*- Autoconf -*-
30192e2dd055Smrg
302074835918Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
302119569120Smrg#
30221c235774Smrg# This file is free software; the Free Software Foundation
30231c235774Smrg# gives unlimited permission to copy and/or distribute it,
30241c235774Smrg# with or without modifications, as long as this notice is preserved.
302597cf2ee2Smrg
30261c235774Smrg# _AM_MANGLE_OPTION(NAME)
30271c235774Smrg# -----------------------
30281c235774SmrgAC_DEFUN([_AM_MANGLE_OPTION],
30291c235774Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
303019569120Smrg
30311c235774Smrg# _AM_SET_OPTION(NAME)
30321c235774Smrg# --------------------
30331c235774Smrg# Set option NAME.  Presently that only means defining a flag for this option.
30341c235774SmrgAC_DEFUN([_AM_SET_OPTION],
30351c235774Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3036a966c04fSmrg
30371c235774Smrg# _AM_SET_OPTIONS(OPTIONS)
30381c235774Smrg# ------------------------
30391c235774Smrg# OPTIONS is a space-separated list of Automake options.
30401c235774SmrgAC_DEFUN([_AM_SET_OPTIONS],
30411c235774Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
30429f00f3a1Smrg
30431c235774Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
30441c235774Smrg# -------------------------------------------
30451c235774Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
30461c235774SmrgAC_DEFUN([_AM_IF_OPTION],
30471c235774Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
30489f00f3a1Smrg
304974835918Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
30509f00f3a1Smrg#
30511c235774Smrg# This file is free software; the Free Software Foundation
30521c235774Smrg# gives unlimited permission to copy and/or distribute it,
30531c235774Smrg# with or without modifications, as long as this notice is preserved.
305497cf2ee2Smrg
30551c235774Smrg# _AM_PROG_CC_C_O
30569f00f3a1Smrg# ---------------
30571c235774Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30581c235774Smrg# to automatically call this.
30591c235774SmrgAC_DEFUN([_AM_PROG_CC_C_O],
30601c235774Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30611c235774SmrgAC_REQUIRE_AUX_FILE([compile])dnl
30621c235774SmrgAC_LANG_PUSH([C])dnl
30631c235774SmrgAC_CACHE_CHECK(
30641c235774Smrg  [whether $CC understands -c and -o together],
30651c235774Smrg  [am_cv_prog_cc_c_o],
30661c235774Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30671c235774Smrg  # Make sure it works both with $CC and with simple cc.
30681c235774Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30691c235774Smrg  # compilers refuse to overwrite an existing .o file with -o,
30701c235774Smrg  # though they will create one.
30711c235774Smrg  am_cv_prog_cc_c_o=yes
30721c235774Smrg  for am_i in 1 2; do
30731c235774Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30741c235774Smrg         && test -f conftest2.$ac_objext; then
30751c235774Smrg      : OK
30761c235774Smrg    else
30771c235774Smrg      am_cv_prog_cc_c_o=no
30781c235774Smrg      break
30791c235774Smrg    fi
30801c235774Smrg  done
30811c235774Smrg  rm -f core conftest*
30821c235774Smrg  unset am_i])
30831c235774Smrgif test "$am_cv_prog_cc_c_o" != yes; then
30841c235774Smrg   # Losing compiler, so override with the script.
30851c235774Smrg   # FIXME: It is wrong to rewrite CC.
30861c235774Smrg   # But if we don't then we get into trouble of one sort or another.
30871c235774Smrg   # A longer-term fix would be to have automake use am__CC in this case,
30881c235774Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30891c235774Smrg   CC="$am_aux_dir/compile $CC"
309097cf2ee2Smrgfi
30911c235774SmrgAC_LANG_POP([C])])
309219569120Smrg
30931c235774Smrg# For backward compatibility.
30941c235774SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
309519569120Smrg
309674835918Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
30971c235774Smrg#
30981c235774Smrg# This file is free software; the Free Software Foundation
30991c235774Smrg# gives unlimited permission to copy and/or distribute it,
31001c235774Smrg# with or without modifications, as long as this notice is preserved.
310119569120Smrg
31021c235774Smrg# AM_RUN_LOG(COMMAND)
31031c235774Smrg# -------------------
31041c235774Smrg# Run COMMAND, save the exit status in ac_status, and log it.
31051c235774Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
31061c235774SmrgAC_DEFUN([AM_RUN_LOG],
31071c235774Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
31081c235774Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
31091c235774Smrg   ac_status=$?
31101c235774Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
31111c235774Smrg   (exit $ac_status); }])
311219569120Smrg
31131c235774Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
311419569120Smrg
311574835918Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
31161c235774Smrg#
31171c235774Smrg# This file is free software; the Free Software Foundation
31181c235774Smrg# gives unlimited permission to copy and/or distribute it,
31191c235774Smrg# with or without modifications, as long as this notice is preserved.
312019569120Smrg
31211c235774Smrg# AM_SANITY_CHECK
31221c235774Smrg# ---------------
31231c235774SmrgAC_DEFUN([AM_SANITY_CHECK],
31241c235774Smrg[AC_MSG_CHECKING([whether build environment is sane])
31251c235774Smrg# Reject unsafe characters in $srcdir or the absolute working directory
31261c235774Smrg# name.  Accept space and tab only in the latter.
31271c235774Smrgam_lf='
31281c235774Smrg'
31291c235774Smrgcase `pwd` in
31301c235774Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
31311c235774Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
31321c235774Smrgesac
31331c235774Smrgcase $srcdir in
31341c235774Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31351c235774Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31361c235774Smrgesac
31371c235774Smrg
31381c235774Smrg# Do 'set' in a subshell so we don't clobber the current shell's
31391c235774Smrg# arguments.  Must try -L first in case configure is actually a
31401c235774Smrg# symlink; some systems play weird games with the mod time of symlinks
31411c235774Smrg# (eg FreeBSD returns the mod time of the symlink's containing
31421c235774Smrg# directory).
31431c235774Smrgif (
31441c235774Smrg   am_has_slept=no
31451c235774Smrg   for am_try in 1 2; do
31461c235774Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31471c235774Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31481c235774Smrg     if test "$[*]" = "X"; then
31491c235774Smrg	# -L didn't work.
31501c235774Smrg	set X `ls -t "$srcdir/configure" conftest.file`
31511c235774Smrg     fi
31521c235774Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31531c235774Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
315419569120Smrg
31551c235774Smrg	# If neither matched, then we have a broken ls.  This can happen
31561c235774Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31571c235774Smrg	# broken ls alias from the environment.  This has actually
31581c235774Smrg	# happened.  Such a system could not be considered "sane".
31591c235774Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31601c235774Smrg  alias in your environment])
31611c235774Smrg     fi
31621c235774Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31631c235774Smrg       break
31641c235774Smrg     fi
31651c235774Smrg     # Just in case.
31661c235774Smrg     sleep 1
31671c235774Smrg     am_has_slept=yes
31681c235774Smrg   done
31691c235774Smrg   test "$[2]" = conftest.file
31701c235774Smrg   )
31711c235774Smrgthen
31721c235774Smrg   # Ok.
31731c235774Smrg   :
31741c235774Smrgelse
31751c235774Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
31761c235774SmrgCheck your system clock])
31771c235774Smrgfi
31781c235774SmrgAC_MSG_RESULT([yes])
31791c235774Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31801c235774Smrg# generated files are strictly newer.
31811c235774Smrgam_sleep_pid=
31821c235774Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31831c235774Smrg  ( sleep 1 ) &
31841c235774Smrg  am_sleep_pid=$!
31851c235774Smrgfi
31861c235774SmrgAC_CONFIG_COMMANDS_PRE(
31871c235774Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31881c235774Smrg   if test -n "$am_sleep_pid"; then
31891c235774Smrg     # Hide warnings about reused PIDs.
31901c235774Smrg     wait $am_sleep_pid 2>/dev/null
31911c235774Smrg   fi
31921c235774Smrg   AC_MSG_RESULT([done])])
31931c235774Smrgrm -f conftest.file
31949f00f3a1Smrg])
3195a966c04fSmrg
319674835918Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
319719569120Smrg#
31981c235774Smrg# This file is free software; the Free Software Foundation
31991c235774Smrg# gives unlimited permission to copy and/or distribute it,
32001c235774Smrg# with or without modifications, as long as this notice is preserved.
320119569120Smrg
32021c235774Smrg# AM_SILENT_RULES([DEFAULT])
32031c235774Smrg# --------------------------
32041c235774Smrg# Enable less verbose build rules; with the default set to DEFAULT
32051c235774Smrg# ("yes" being less verbose, "no" or empty being verbose).
32061c235774SmrgAC_DEFUN([AM_SILENT_RULES],
32071c235774Smrg[AC_ARG_ENABLE([silent-rules], [dnl
32081c235774SmrgAS_HELP_STRING(
32091c235774Smrg  [--enable-silent-rules],
32101c235774Smrg  [less verbose build output (undo: "make V=1")])
32111c235774SmrgAS_HELP_STRING(
32121c235774Smrg  [--disable-silent-rules],
32131c235774Smrg  [verbose build output (undo: "make V=0")])dnl
32141c235774Smrg])
32151c235774Smrgcase $enable_silent_rules in @%:@ (((
32161c235774Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
32171c235774Smrg   no) AM_DEFAULT_VERBOSITY=1;;
32181c235774Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
32191c235774Smrgesac
32201c235774Smrgdnl
32211c235774Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
32221c235774Smrgdnl do not support nested variable expansions.
32231c235774Smrgdnl See automake bug#9928 and bug#10237.
32241c235774Smrgam_make=${MAKE-make}
32251c235774SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
32261c235774Smrg   [am_cv_make_support_nested_variables],
32271c235774Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
32281c235774SmrgBAR0=false
32291c235774SmrgBAR1=true
32301c235774SmrgV=1
32311c235774Smrgam__doit:
32321c235774Smrg	@$(TRUE)
32331c235774Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
32341c235774Smrg  am_cv_make_support_nested_variables=yes
32359f00f3a1Smrgelse
32361c235774Smrg  am_cv_make_support_nested_variables=no
32371c235774Smrgfi])
32381c235774Smrgif test $am_cv_make_support_nested_variables = yes; then
32391c235774Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32401c235774Smrg  AM_V='$(V)'
32411c235774Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32421c235774Smrgelse
32431c235774Smrg  AM_V=$AM_DEFAULT_VERBOSITY
32441c235774Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32459f00f3a1Smrgfi
32461c235774SmrgAC_SUBST([AM_V])dnl
32471c235774SmrgAM_SUBST_NOTMAKE([AM_V])dnl
32481c235774SmrgAC_SUBST([AM_DEFAULT_V])dnl
32491c235774SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32501c235774SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32511c235774SmrgAM_BACKSLASH='\'
32521c235774SmrgAC_SUBST([AM_BACKSLASH])dnl
32531c235774Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32541c235774Smrg])
32559f00f3a1Smrg
325674835918Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
32571c235774Smrg#
32581c235774Smrg# This file is free software; the Free Software Foundation
32591c235774Smrg# gives unlimited permission to copy and/or distribute it,
32601c235774Smrg# with or without modifications, as long as this notice is preserved.
32612e2dd055Smrg
32621c235774Smrg# AM_PROG_INSTALL_STRIP
32631c235774Smrg# ---------------------
32641c235774Smrg# One issue with vendor 'install' (even GNU) is that you can't
32651c235774Smrg# specify the program used to strip binaries.  This is especially
32661c235774Smrg# annoying in cross-compiling environments, where the build's strip
32671c235774Smrg# is unlikely to handle the host's binaries.
32681c235774Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32691c235774Smrg# always use install-sh in "make install-strip", and initialize
32701c235774Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
32711c235774SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
32721c235774Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32731c235774Smrg# Installed binaries are usually stripped using 'strip' when the user
32741c235774Smrg# run "make install-strip".  However 'strip' might not be the right
32751c235774Smrg# tool to use in cross-compilation environments, therefore Automake
32761c235774Smrg# will honor the 'STRIP' environment variable to overrule this program.
32771c235774Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
32781c235774Smrgif test "$cross_compiling" != no; then
32791c235774Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
32801c235774Smrgfi
32811c235774SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
32821c235774SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
32832e2dd055Smrg
328474835918Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
32851c235774Smrg#
32861c235774Smrg# This file is free software; the Free Software Foundation
32871c235774Smrg# gives unlimited permission to copy and/or distribute it,
32881c235774Smrg# with or without modifications, as long as this notice is preserved.
3289a966c04fSmrg
32901c235774Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
32911c235774Smrg# ---------------------------
32921c235774Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
32931c235774Smrg# This macro is traced by Automake.
32941c235774SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3295a966c04fSmrg
32961c235774Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32971c235774Smrg# --------------------------
32981c235774Smrg# Public sister of _AM_SUBST_NOTMAKE.
32991c235774SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3300a966c04fSmrg
33011c235774Smrg# Check how to create a tarball.                            -*- Autoconf -*-
33026e7d3316Smrg
330374835918Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
33046e7d3316Smrg#
33051c235774Smrg# This file is free software; the Free Software Foundation
33061c235774Smrg# gives unlimited permission to copy and/or distribute it,
33071c235774Smrg# with or without modifications, as long as this notice is preserved.
3308ac92798bSmrg
33091c235774Smrg# _AM_PROG_TAR(FORMAT)
33101c235774Smrg# --------------------
33111c235774Smrg# Check how to create a tarball in format FORMAT.
33121c235774Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
331319569120Smrg#
33141c235774Smrg# Substitute a variable $(am__tar) that is a command
33151c235774Smrg# writing to stdout a FORMAT-tarball containing the directory
33161c235774Smrg# $tardir.
33171c235774Smrg#     tardir=directory && $(am__tar) > result.tar
331819569120Smrg#
33191c235774Smrg# Substitute a variable $(am__untar) that extract such
33201c235774Smrg# a tarball read from stdin.
33211c235774Smrg#     $(am__untar) < result.tar
33221c235774Smrg#
33231c235774SmrgAC_DEFUN([_AM_PROG_TAR],
33241c235774Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
33251c235774Smrg# in the wild :-(  We should find a proper way to deprecate it ...
33261c235774SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
33276e7d3316Smrg
33281c235774Smrg# We'll loop over all known methods to create a tar archive until one works.
33291c235774Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
33309f00f3a1Smrg
33311c235774Smrgm4_if([$1], [v7],
33321c235774Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
33339f00f3a1Smrg
33341c235774Smrg  [m4_case([$1],
33351c235774Smrg    [ustar],
33361c235774Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33371c235774Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33381c235774Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33391c235774Smrg      # and bug#13588).
33401c235774Smrg      am_max_uid=2097151 # 2^21 - 1
33411c235774Smrg      am_max_gid=$am_max_uid
33421c235774Smrg      # The $UID and $GID variables are not portable, so we need to resort
33431c235774Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33441c235774Smrg      # below are definitely unexpected, so allow the users to see them
33451c235774Smrg      # (that is, avoid stderr redirection).
33461c235774Smrg      am_uid=`id -u || echo unknown`
33471c235774Smrg      am_gid=`id -g || echo unknown`
33481c235774Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33491c235774Smrg      if test $am_uid -le $am_max_uid; then
33501c235774Smrg         AC_MSG_RESULT([yes])
33511c235774Smrg      else
33521c235774Smrg         AC_MSG_RESULT([no])
33531c235774Smrg         _am_tools=none
33541c235774Smrg      fi
33551c235774Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33561c235774Smrg      if test $am_gid -le $am_max_gid; then
33571c235774Smrg         AC_MSG_RESULT([yes])
33581c235774Smrg      else
33591c235774Smrg        AC_MSG_RESULT([no])
33601c235774Smrg        _am_tools=none
33611c235774Smrg      fi],
33629f00f3a1Smrg
33631c235774Smrg  [pax],
33641c235774Smrg    [],
33659f00f3a1Smrg
33661c235774Smrg  [m4_fatal([Unknown tar format])])
33679f00f3a1Smrg
33681c235774Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
33699f00f3a1Smrg
33701c235774Smrg  # Go ahead even if we have the value already cached.  We do so because we
33711c235774Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33721c235774Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
33739f00f3a1Smrg
33741c235774Smrg  for _am_tool in $_am_tools; do
33751c235774Smrg    case $_am_tool in
33761c235774Smrg    gnutar)
33771c235774Smrg      for _am_tar in tar gnutar gtar; do
33781c235774Smrg        AM_RUN_LOG([$_am_tar --version]) && break
33791c235774Smrg      done
33801c235774Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33811c235774Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33821c235774Smrg      am__untar="$_am_tar -xf -"
33831c235774Smrg      ;;
33841c235774Smrg    plaintar)
33851c235774Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33861c235774Smrg      # ustar tarball either.
33871c235774Smrg      (tar --version) >/dev/null 2>&1 && continue
33881c235774Smrg      am__tar='tar chf - "$$tardir"'
33891c235774Smrg      am__tar_='tar chf - "$tardir"'
33901c235774Smrg      am__untar='tar xf -'
33911c235774Smrg      ;;
33921c235774Smrg    pax)
33931c235774Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
33941c235774Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33951c235774Smrg      am__untar='pax -r'
33961c235774Smrg      ;;
33971c235774Smrg    cpio)
33981c235774Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33991c235774Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
34001c235774Smrg      am__untar='cpio -i -H $1 -d'
34011c235774Smrg      ;;
34021c235774Smrg    none)
34031c235774Smrg      am__tar=false
34041c235774Smrg      am__tar_=false
34051c235774Smrg      am__untar=false
34061c235774Smrg      ;;
34071c235774Smrg    esac
3408a966c04fSmrg
34091c235774Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
34101c235774Smrg    # and am__untar set.
34111c235774Smrg    test -n "${am_cv_prog_tar_$1}" && break
34129f00f3a1Smrg
34131c235774Smrg    # tar/untar a dummy directory, and stop if the command works.
34141c235774Smrg    rm -rf conftest.dir
34151c235774Smrg    mkdir conftest.dir
34161c235774Smrg    echo GrepMe > conftest.dir/file
34171c235774Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
34181c235774Smrg    rm -rf conftest.dir
34191c235774Smrg    if test -s conftest.tar; then
34201c235774Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
34211c235774Smrg      AM_RUN_LOG([cat conftest.dir/file])
34221c235774Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
34231c235774Smrg    fi
34241c235774Smrg  done
34251c235774Smrg  rm -rf conftest.dir
34261c235774Smrg
34271c235774Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
34281c235774Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
34291c235774Smrg
34301c235774SmrgAC_SUBST([am__tar])
34311c235774SmrgAC_SUBST([am__untar])
34321c235774Smrg]) # _AM_PROG_TAR
34339f00f3a1Smrg
34349f00f3a1Smrgm4_include([m4/ax_define_dir.m4])
34359f00f3a1Smrgm4_include([m4/libtool.m4])
34369f00f3a1Smrgm4_include([m4/ltoptions.m4])
34379f00f3a1Smrgm4_include([m4/ltsugar.m4])
34389f00f3a1Smrgm4_include([m4/ltversion.m4])
34399f00f3a1Smrgm4_include([m4/lt~obsolete.m4])
3440