1bc77032bSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2c6a6acfbSmrg
3bc77032bSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
466fe65f6Smrg
566fe65f6Smrg# This file is free software; the Free Software Foundation
666fe65f6Smrg# gives unlimited permission to copy and/or distribute it,
766fe65f6Smrg# with or without modifications, as long as this notice is preserved.
866fe65f6Smrg
966fe65f6Smrg# This program is distributed in the hope that it will be useful,
1066fe65f6Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1166fe65f6Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1266fe65f6Smrg# PARTICULAR PURPOSE.
1366fe65f6Smrg
14c6a6acfbSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1589d09728Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1689d09728Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17bc77032bSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18bc77032bSmrg[m4_warning([this file was generated for autoconf 2.71.
1989d09728SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2089d09728SmrgIf you have problems, you may need to regenerate the build system entirely.
21c6a6acfbSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2289d09728Smrg
2322281038Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2422281038Smrg# serial 11 (pkg-config-0.29.1)
25a9274bcdSmrg
2622281038Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2722281038Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2822281038Smrgdnl
2922281038Smrgdnl This program is free software; you can redistribute it and/or modify
3022281038Smrgdnl it under the terms of the GNU General Public License as published by
3122281038Smrgdnl the Free Software Foundation; either version 2 of the License, or
3222281038Smrgdnl (at your option) any later version.
3322281038Smrgdnl
3422281038Smrgdnl This program is distributed in the hope that it will be useful, but
3522281038Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3622281038Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3722281038Smrgdnl General Public License for more details.
3822281038Smrgdnl
3922281038Smrgdnl You should have received a copy of the GNU General Public License
4022281038Smrgdnl along with this program; if not, write to the Free Software
4122281038Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4222281038Smrgdnl 02111-1307, USA.
4322281038Smrgdnl
4422281038Smrgdnl As a special exception to the GNU General Public License, if you
4522281038Smrgdnl distribute this file as part of a program that contains a
4622281038Smrgdnl configuration script generated by Autoconf, you may include it under
4722281038Smrgdnl the same distribution terms that you use for the rest of that
4822281038Smrgdnl program.
49a9274bcdSmrg
5022281038Smrgdnl PKG_PREREQ(MIN-VERSION)
5122281038Smrgdnl -----------------------
5222281038Smrgdnl Since: 0.29
5322281038Smrgdnl
5422281038Smrgdnl Verify that the version of the pkg-config macros are at least
5522281038Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5622281038Smrgdnl installed version of pkg-config, this checks the developer's version
5722281038Smrgdnl of pkg.m4 when generating configure.
5822281038Smrgdnl
5922281038Smrgdnl To ensure that this macro is defined, also add:
6022281038Smrgdnl m4_ifndef([PKG_PREREQ],
6122281038Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6222281038Smrgdnl
6322281038Smrgdnl See the "Since" comment for each macro you use to see what version
6422281038Smrgdnl of the macros you require.
6522281038Smrgm4_defun([PKG_PREREQ],
6622281038Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
6722281038Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6822281038Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6922281038Smrg])dnl PKG_PREREQ
70a9274bcdSmrg
7122281038Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7222281038Smrgdnl ----------------------------------
7322281038Smrgdnl Since: 0.16
7422281038Smrgdnl
7522281038Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7622281038Smrgdnl first found in the path. Checks that the version of pkg-config found
7722281038Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7822281038Smrgdnl used since that's the first version where most current features of
7922281038Smrgdnl pkg-config existed.
8022281038SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8122281038Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8222281038Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8322281038Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8422281038SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8522281038SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8622281038SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87a9274bcdSmrg
8822281038Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8922281038Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9022281038Smrgfi
9122281038Smrgif test -n "$PKG_CONFIG"; then
9222281038Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9322281038Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9422281038Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9522281038Smrg		AC_MSG_RESULT([yes])
9622281038Smrg	else
9722281038Smrg		AC_MSG_RESULT([no])
9822281038Smrg		PKG_CONFIG=""
9922281038Smrg	fi
10022281038Smrgfi[]dnl
10122281038Smrg])dnl PKG_PROG_PKG_CONFIG
102a9274bcdSmrg
10322281038Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10422281038Smrgdnl -------------------------------------------------------------------
10522281038Smrgdnl Since: 0.18
10622281038Smrgdnl
10722281038Smrgdnl Check to see whether a particular set of modules exists. Similar to
10822281038Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10922281038Smrgdnl
11022281038Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11122281038Smrgdnl only at the first occurence in configure.ac, so if the first place
11222281038Smrgdnl it's called might be skipped (such as if it is within an "if", you
11322281038Smrgdnl have to call PKG_CHECK_EXISTS manually
11422281038SmrgAC_DEFUN([PKG_CHECK_EXISTS],
11522281038Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11622281038Smrgif test -n "$PKG_CONFIG" && \
11722281038Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11822281038Smrg  m4_default([$2], [:])
11922281038Smrgm4_ifvaln([$3], [else
12022281038Smrg  $3])dnl
12122281038Smrgfi])
12266fe65f6Smrg
12322281038Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12422281038Smrgdnl ---------------------------------------------
12522281038Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12622281038Smrgdnl pkg_failed based on the result.
12722281038Smrgm4_define([_PKG_CONFIG],
12822281038Smrg[if test -n "$$1"; then
12922281038Smrg    pkg_cv_[]$1="$$1"
13022281038Smrg elif test -n "$PKG_CONFIG"; then
13122281038Smrg    PKG_CHECK_EXISTS([$3],
13222281038Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13322281038Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
13422281038Smrg		     [pkg_failed=yes])
13522281038Smrg else
13622281038Smrg    pkg_failed=untried
13722281038Smrgfi[]dnl
13822281038Smrg])dnl _PKG_CONFIG
13966fe65f6Smrg
14022281038Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14122281038Smrgdnl ---------------------------
14222281038Smrgdnl Internal check to see if pkg-config supports short errors.
14322281038SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14422281038Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14522281038Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14622281038Smrg        _pkg_short_errors_supported=yes
147bc77032bSmrgelse
14822281038Smrg        _pkg_short_errors_supported=no
14922281038Smrgfi[]dnl
15022281038Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
15166fe65f6Smrg
15266fe65f6Smrg
15322281038Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15422281038Smrgdnl   [ACTION-IF-NOT-FOUND])
15522281038Smrgdnl --------------------------------------------------------------
15622281038Smrgdnl Since: 0.4.0
15722281038Smrgdnl
15822281038Smrgdnl Note that if there is a possibility the first call to
15922281038Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16022281038Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16122281038SmrgAC_DEFUN([PKG_CHECK_MODULES],
16222281038Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16322281038SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16422281038SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
16566fe65f6Smrg
16622281038Smrgpkg_failed=no
16722281038SmrgAC_MSG_CHECKING([for $1])
16866fe65f6Smrg
16922281038Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17022281038Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
17166fe65f6Smrg
17222281038Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17322281038Smrgand $1[]_LIBS to avoid the need to call pkg-config.
17422281038SmrgSee the pkg-config man page for more details.])
17566fe65f6Smrg
17622281038Smrgif test $pkg_failed = yes; then
17722281038Smrg   	AC_MSG_RESULT([no])
17822281038Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17922281038Smrg        if test $_pkg_short_errors_supported = yes; then
18022281038Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18122281038Smrg        else 
18222281038Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18322281038Smrg        fi
18422281038Smrg	# Put the nasty error message in config.log where it belongs
18522281038Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
18666fe65f6Smrg
18722281038Smrg	m4_default([$4], [AC_MSG_ERROR(
18822281038Smrg[Package requirements ($2) were not met:
18966fe65f6Smrg
19022281038Smrg$$1_PKG_ERRORS
19166fe65f6Smrg
19222281038SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19322281038Smrginstalled software in a non-standard prefix.
19489d09728Smrg
19522281038Smrg_PKG_TEXT])[]dnl
19622281038Smrg        ])
19722281038Smrgelif test $pkg_failed = untried; then
19822281038Smrg     	AC_MSG_RESULT([no])
19922281038Smrg	m4_default([$4], [AC_MSG_FAILURE(
20022281038Smrg[The pkg-config script could not be found or is too old.  Make sure it
20122281038Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
20222281038Smrgpath to pkg-config.
20366fe65f6Smrg
20422281038Smrg_PKG_TEXT
20566fe65f6Smrg
20622281038SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20722281038Smrg        ])
20822281038Smrgelse
20922281038Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21022281038Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21122281038Smrg        AC_MSG_RESULT([yes])
21222281038Smrg	$3
21322281038Smrgfi[]dnl
21422281038Smrg])dnl PKG_CHECK_MODULES
21538c51623Smrg
21638c51623Smrg
21722281038Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21822281038Smrgdnl   [ACTION-IF-NOT-FOUND])
21922281038Smrgdnl ---------------------------------------------------------------------
22022281038Smrgdnl Since: 0.29
22122281038Smrgdnl
22222281038Smrgdnl Checks for existence of MODULES and gathers its build flags with
22322281038Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22422281038Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22522281038Smrgdnl
22622281038Smrgdnl Note that if there is a possibility the first call to
22722281038Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22822281038Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22922281038Smrgdnl configure.ac.
23022281038SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23122281038Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23222281038Smrg_save_PKG_CONFIG=$PKG_CONFIG
23322281038SmrgPKG_CONFIG="$PKG_CONFIG --static"
23422281038SmrgPKG_CHECK_MODULES($@)
23522281038SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23622281038Smrg])dnl PKG_CHECK_MODULES_STATIC
23738c51623Smrg
23838c51623Smrg
23922281038Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24022281038Smrgdnl -------------------------
24122281038Smrgdnl Since: 0.27
24222281038Smrgdnl
24322281038Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
24422281038Smrgdnl should install pkg-config .pc files. By default the directory is
24522281038Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
24622281038Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24722281038Smrgdnl parameter.
24822281038SmrgAC_DEFUN([PKG_INSTALLDIR],
24922281038Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25022281038Smrgm4_pushdef([pkg_description],
25122281038Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25222281038SmrgAC_ARG_WITH([pkgconfigdir],
25322281038Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25422281038Smrg    [with_pkgconfigdir=]pkg_default)
25522281038SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25622281038Smrgm4_popdef([pkg_default])
25722281038Smrgm4_popdef([pkg_description])
25822281038Smrg])dnl PKG_INSTALLDIR
25938c51623Smrg
26038c51623Smrg
26122281038Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26222281038Smrgdnl --------------------------------
26322281038Smrgdnl Since: 0.27
26422281038Smrgdnl
26522281038Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26622281038Smrgdnl module should install arch-independent pkg-config .pc files. By
26722281038Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
26822281038Smrgdnl changed by passing DIRECTORY. The user can override through the
26922281038Smrgdnl --with-noarch-pkgconfigdir parameter.
27022281038SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27122281038Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27222281038Smrgm4_pushdef([pkg_description],
27322281038Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27422281038SmrgAC_ARG_WITH([noarch-pkgconfigdir],
27522281038Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27622281038Smrg    [with_noarch_pkgconfigdir=]pkg_default)
27722281038SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27822281038Smrgm4_popdef([pkg_default])
27922281038Smrgm4_popdef([pkg_description])
28022281038Smrg])dnl PKG_NOARCH_INSTALLDIR
28166fe65f6Smrg
28266fe65f6Smrg
28322281038Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28422281038Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28522281038Smrgdnl -------------------------------------------
28622281038Smrgdnl Since: 0.28
28722281038Smrgdnl
28822281038Smrgdnl Retrieves the value of the pkg-config variable for the given module.
28922281038SmrgAC_DEFUN([PKG_CHECK_VAR],
29022281038Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29122281038SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
29266fe65f6Smrg
29322281038Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29422281038SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29566fe65f6Smrg
29622281038SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29722281038Smrg])dnl PKG_CHECK_VAR
29866fe65f6Smrg
29922281038Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
30022281038Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
30122281038Smrgdnl   [DESCRIPTION], [DEFAULT])
30222281038Smrgdnl ------------------------------------------
30322281038Smrgdnl
30422281038Smrgdnl Prepare a "--with-" configure option using the lowercase
30522281038Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
30622281038Smrgdnl PKG_CHECK_MODULES in a single macro.
30722281038SmrgAC_DEFUN([PKG_WITH_MODULES],
30822281038Smrg[
30922281038Smrgm4_pushdef([with_arg], m4_tolower([$1]))
31022281038Smrg
31122281038Smrgm4_pushdef([description],
31222281038Smrg           [m4_default([$5], [build with ]with_arg[ support])])
31322281038Smrg
31422281038Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
31522281038Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
31622281038Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
31722281038Smrg
31822281038Smrgm4_case(def_arg,
31922281038Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
32022281038Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
32122281038Smrg
32222281038SmrgAC_ARG_WITH(with_arg,
32322281038Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
32422281038Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
32522281038Smrg
32622281038SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
32722281038Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
32822281038Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
32922281038Smrg                                        [m4_n([def_action_if_found]) $3],
33022281038Smrg                                        [m4_n([def_action_if_not_found]) $4])])
33122281038Smrg
33222281038Smrgm4_popdef([with_arg])
33322281038Smrgm4_popdef([description])
33422281038Smrgm4_popdef([def_arg])
33522281038Smrg
33622281038Smrg])dnl PKG_WITH_MODULES
33722281038Smrg
33822281038Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
33922281038Smrgdnl   [DESCRIPTION], [DEFAULT])
34022281038Smrgdnl -----------------------------------------------
34122281038Smrgdnl
34222281038Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
34322281038Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
34422281038SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
34522281038Smrg[
34622281038SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
34722281038Smrg
34822281038SmrgAM_CONDITIONAL([HAVE_][$1],
34922281038Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
35022281038Smrg])dnl PKG_HAVE_WITH_MODULES
35122281038Smrg
35222281038Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
35322281038Smrgdnl   [DESCRIPTION], [DEFAULT])
35422281038Smrgdnl ------------------------------------------------------
35522281038Smrgdnl
35622281038Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
35722281038Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
35822281038Smrgdnl and preprocessor variable.
35922281038SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
36022281038Smrg[
36122281038SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
36266fe65f6Smrg
36322281038SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
36422281038Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
36522281038Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
36666fe65f6Smrg
36722281038Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
36822281038Smrgdnl
36922281038Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
37022281038Smrgdnl
37122281038Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
37222281038Smrgdnl copy of this software and associated documentation files (the "Software"),
37322281038Smrgdnl to deal in the Software without restriction, including without limitation
37422281038Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
37522281038Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
37622281038Smrgdnl Software is furnished to do so, subject to the following conditions:
37722281038Smrgdnl
37822281038Smrgdnl The above copyright notice and this permission notice (including the next
37922281038Smrgdnl paragraph) shall be included in all copies or substantial portions of the
38022281038Smrgdnl Software.
38122281038Smrgdnl
38222281038Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38322281038Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38422281038Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
38522281038Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38622281038Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
38722281038Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
38822281038Smrgdnl DEALINGS IN THE SOFTWARE.
38922281038Smrg
39022281038Smrg# XORG_MACROS_VERSION(required-version)
39122281038Smrg# -------------------------------------
39222281038Smrg# Minimum version: 1.1.0
39322281038Smrg#
39422281038Smrg# If you're using a macro added in Version 1.1 or newer, include this in
39522281038Smrg# your configure.ac with the minimum required version, such as:
39622281038Smrg# XORG_MACROS_VERSION(1.1)
39722281038Smrg#
39822281038Smrg# To ensure that this macro is defined, also add:
39922281038Smrg# m4_ifndef([XORG_MACROS_VERSION],
40022281038Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
40122281038Smrg#
40222281038Smrg#
40322281038Smrg# See the "minimum version" comment for each macro you use to see what
40422281038Smrg# version you require.
40522281038Smrgm4_defun([XORG_MACROS_VERSION],[
40622281038Smrgm4_define([vers_have], [1.19.3])
40722281038Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
40822281038Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
40922281038Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
41022281038Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
41122281038Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
41222281038Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
41322281038Smrgm4_undefine([vers_have])
41422281038Smrgm4_undefine([maj_have])
41522281038Smrgm4_undefine([maj_needed])
41622281038Smrg]) # XORG_MACROS_VERSION
41722281038Smrg
41822281038Smrg# XORG_PROG_RAWCPP()
41922281038Smrg# ------------------
42022281038Smrg# Minimum version: 1.0.0
42122281038Smrg#
42222281038Smrg# Find cpp program and necessary flags for use in pre-processing text files
42322281038Smrg# such as man pages and config files
42422281038SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
42522281038SmrgAC_REQUIRE([AC_PROG_CPP])
42622281038SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
42722281038Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
42822281038Smrg
42922281038Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
43022281038Smrg# which is not the best choice for supporting other OS'es, but covers most
43122281038Smrg# of the ones we need for now.
43222281038SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
43322281038SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
43422281038Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43522281038Smrg	AC_MSG_RESULT([no])
43622281038Smrgelse
43722281038Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43822281038Smrg		RAWCPPFLAGS=-undef
43922281038Smrg		AC_MSG_RESULT([yes])
44022281038Smrg	# under Cygwin unix is still defined even with -undef
44122281038Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
44222281038Smrg		RAWCPPFLAGS="-undef -ansi"
44322281038Smrg		AC_MSG_RESULT([yes, with -ansi])
44422281038Smrg	else
44522281038Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
44622281038Smrg	fi
44738c51623Smrgfi
44822281038Smrgrm -f conftest.$ac_ext
44966fe65f6Smrg
45022281038SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
45122281038SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
45222281038Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45322281038Smrg	AC_MSG_RESULT([no])
45422281038Smrgelse
45522281038Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45622281038Smrg		TRADITIONALCPPFLAGS="-traditional"
45722281038Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
45822281038Smrg		AC_MSG_RESULT([yes])
45922281038Smrg	else
46022281038Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
46122281038Smrg	fi
46238c51623Smrgfi
46322281038Smrgrm -f conftest.$ac_ext
46422281038SmrgAC_SUBST(RAWCPPFLAGS)
46522281038SmrgAC_SUBST(TRADITIONALCPPFLAGS)
46622281038Smrg]) # XORG_PROG_RAWCPP
46738c51623Smrg
46822281038Smrg# XORG_MANPAGE_SECTIONS()
46922281038Smrg# -----------------------
47022281038Smrg# Minimum version: 1.0.0
47122281038Smrg#
47222281038Smrg# Determine which sections man pages go in for the different man page types
47322281038Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
47422281038Smrg# Not sure if there's any better way than just hardcoding by OS name.
47522281038Smrg# Override default settings by setting environment variables
47622281038Smrg# Added MAN_SUBSTS in version 1.8
47722281038Smrg# Added AC_PROG_SED in version 1.8
47866fe65f6Smrg
47922281038SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
48022281038SmrgAC_REQUIRE([AC_CANONICAL_HOST])
48122281038SmrgAC_REQUIRE([AC_PROG_SED])
482a9274bcdSmrg
48322281038Smrgcase $host_os in
48422281038Smrg    solaris*)
48522281038Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
48622281038Smrg        # check for a man page file found in later versions that use
48722281038Smrg        # traditional section numbers instead
48822281038Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
48922281038Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
49022281038Smrg        ;;
49122281038Smrg    *) SYSV_MAN_SECTIONS=false ;;
49222281038Smrgesac
49322281038Smrg
49422281038Smrgif test x$APP_MAN_SUFFIX = x    ; then
49522281038Smrg    APP_MAN_SUFFIX=1
496bc77032bSmrgfi
49722281038Smrgif test x$APP_MAN_DIR = x    ; then
49822281038Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
499bc77032bSmrgfi
50089d09728Smrg
50122281038Smrgif test x$LIB_MAN_SUFFIX = x    ; then
50222281038Smrg    LIB_MAN_SUFFIX=3
50322281038Smrgfi
50422281038Smrgif test x$LIB_MAN_DIR = x    ; then
50522281038Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
50622281038Smrgfi
50738c51623Smrg
50822281038Smrgif test x$FILE_MAN_SUFFIX = x    ; then
50922281038Smrg    case $SYSV_MAN_SECTIONS in
51022281038Smrg	true)				FILE_MAN_SUFFIX=4  ;;
51122281038Smrg	*)				FILE_MAN_SUFFIX=5  ;;
51222281038Smrg    esac
51322281038Smrgfi
51422281038Smrgif test x$FILE_MAN_DIR = x    ; then
51522281038Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
51622281038Smrgfi
517a9274bcdSmrg
51822281038Smrgif test x$MISC_MAN_SUFFIX = x    ; then
51922281038Smrg    case $SYSV_MAN_SECTIONS in
52022281038Smrg	true)				MISC_MAN_SUFFIX=5  ;;
52122281038Smrg	*)				MISC_MAN_SUFFIX=7  ;;
52222281038Smrg    esac
52322281038Smrgfi
52422281038Smrgif test x$MISC_MAN_DIR = x    ; then
52522281038Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
52622281038Smrgfi
527a9274bcdSmrg
52822281038Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
52922281038Smrg    case $SYSV_MAN_SECTIONS in
53022281038Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
53122281038Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
53222281038Smrg    esac
53322281038Smrgfi
53422281038Smrgif test x$DRIVER_MAN_DIR = x    ; then
53522281038Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
53622281038Smrgfi
537c6a6acfbSmrg
53822281038Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
53922281038Smrg    case $SYSV_MAN_SECTIONS in
54022281038Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
54122281038Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
54222281038Smrg    esac
54322281038Smrgfi
54422281038Smrgif test x$ADMIN_MAN_DIR = x    ; then
54522281038Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
54689d09728Smrgfi
54789d09728Smrg
54838c51623Smrg
54922281038SmrgAC_SUBST([APP_MAN_SUFFIX])
55022281038SmrgAC_SUBST([LIB_MAN_SUFFIX])
55122281038SmrgAC_SUBST([FILE_MAN_SUFFIX])
55222281038SmrgAC_SUBST([MISC_MAN_SUFFIX])
55322281038SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
55422281038SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
55522281038SmrgAC_SUBST([APP_MAN_DIR])
55622281038SmrgAC_SUBST([LIB_MAN_DIR])
55722281038SmrgAC_SUBST([FILE_MAN_DIR])
55822281038SmrgAC_SUBST([MISC_MAN_DIR])
55922281038SmrgAC_SUBST([DRIVER_MAN_DIR])
56022281038SmrgAC_SUBST([ADMIN_MAN_DIR])
56138c51623Smrg
56222281038SmrgXORG_MAN_PAGE="X Version 11"
56322281038SmrgAC_SUBST([XORG_MAN_PAGE])
56422281038SmrgMAN_SUBSTS="\
56522281038Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
56622281038Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
56722281038Smrg	-e 's|__xservername__|Xorg|g' \
56822281038Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
56922281038Smrg	-e 's|__projectroot__|\$(prefix)|g' \
57022281038Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
57122281038Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
57222281038Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
57322281038Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
57422281038Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
57522281038Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
57622281038Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
57722281038SmrgAC_SUBST([MAN_SUBSTS])
57838c51623Smrg
57922281038Smrg]) # XORG_MANPAGE_SECTIONS
58022281038Smrg
58122281038Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
58222281038Smrg# ------------------------
58322281038Smrg# Minimum version: 1.7.0
584bc77032bSmrg#
58522281038Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
58622281038Smrg# provided by xorg-sgml-doctools, if installed.
58722281038SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
58822281038SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
58922281038SmrgXORG_SGML_PATH=
59022281038SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
59122281038Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
59222281038Smrg    [m4_ifval([$1],[:],
59322281038Smrg        [if test x"$cross_compiling" != x"yes" ; then
59422281038Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
59522281038Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
59622281038Smrg         fi])
59722281038Smrg    ])
598bc77032bSmrg
59922281038Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
60022281038Smrg# the path and the name of the doc stylesheet
60122281038Smrgif test "x$XORG_SGML_PATH" != "x" ; then
60222281038Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
60322281038Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
60422281038Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
60522281038Smrgelse
60622281038Smrg   AC_MSG_RESULT([no])
607bc77032bSmrgfi
608bc77032bSmrg
60922281038SmrgAC_SUBST(XORG_SGML_PATH)
61022281038SmrgAC_SUBST(STYLESHEET_SRCDIR)
61122281038SmrgAC_SUBST(XSL_STYLESHEET)
61222281038SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
61322281038Smrg]) # XORG_CHECK_SGML_DOCTOOLS
61422281038Smrg
61522281038Smrg# XORG_CHECK_LINUXDOC
61622281038Smrg# -------------------
61722281038Smrg# Minimum version: 1.0.0
618bc77032bSmrg#
61922281038Smrg# Defines the variable MAKE_TEXT if the necessary tools and
62022281038Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
62122281038Smrg# Whether or not the necessary tools and files are found can be checked
62222281038Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
62322281038SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
62422281038SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
62522281038SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
626bc77032bSmrg
62722281038SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
62822281038Smrg
62922281038SmrgAC_MSG_CHECKING([whether to build documentation])
63022281038Smrg
63122281038Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
63222281038Smrg   BUILDDOC=yes
63338c51623Smrgelse
63422281038Smrg   BUILDDOC=no
63589d09728Smrgfi
63689d09728Smrg
63722281038SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
63889d09728Smrg
63922281038SmrgAC_MSG_RESULT([$BUILDDOC])
64089d09728Smrg
64122281038SmrgAC_MSG_CHECKING([whether to build pdf documentation])
642c6a6acfbSmrg
64322281038Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
64422281038Smrg   BUILDPDFDOC=yes
64522281038Smrgelse
64622281038Smrg   BUILDPDFDOC=no
64722281038Smrgfi
648c6a6acfbSmrg
64922281038SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
650c6a6acfbSmrg
65122281038SmrgAC_MSG_RESULT([$BUILDPDFDOC])
652c6a6acfbSmrg
65322281038SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
65422281038SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
65522281038SmrgMAKE_PDF="$PS2PDF"
65622281038SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
657c6a6acfbSmrg
65822281038SmrgAC_SUBST(MAKE_TEXT)
65922281038SmrgAC_SUBST(MAKE_PS)
66022281038SmrgAC_SUBST(MAKE_PDF)
66122281038SmrgAC_SUBST(MAKE_HTML)
66222281038Smrg]) # XORG_CHECK_LINUXDOC
663a9274bcdSmrg
66422281038Smrg# XORG_CHECK_DOCBOOK
66522281038Smrg# -------------------
66622281038Smrg# Minimum version: 1.0.0
667bc77032bSmrg#
66822281038Smrg# Checks for the ability to build output formats from SGML DocBook source.
66922281038Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
67022281038Smrg# indicates whether the necessary tools and files are found and, if set,
67122281038Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
67222281038SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
67322281038SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
674a9274bcdSmrg
67522281038SmrgBUILDTXTDOC=no
67622281038SmrgBUILDPDFDOC=no
67722281038SmrgBUILDPSDOC=no
67822281038SmrgBUILDHTMLDOC=no
679a9274bcdSmrg
68022281038SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
68122281038SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
68222281038SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
68322281038SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
684a9274bcdSmrg
68522281038SmrgAC_MSG_CHECKING([whether to build text documentation])
68622281038Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
68722281038Smrg   test x$BUILD_TXTDOC != xno; then
68822281038Smrg	BUILDTXTDOC=yes
68922281038Smrgfi
69022281038SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
69122281038SmrgAC_MSG_RESULT([$BUILDTXTDOC])
692bc77032bSmrg
69322281038SmrgAC_MSG_CHECKING([whether to build PDF documentation])
69422281038Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
69522281038Smrg   test x$BUILD_PDFDOC != xno; then
69622281038Smrg	BUILDPDFDOC=yes
69722281038Smrgfi
69822281038SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
69922281038SmrgAC_MSG_RESULT([$BUILDPDFDOC])
700bc77032bSmrg
70122281038SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
70222281038Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
70322281038Smrg   test x$BUILD_PSDOC != xno; then
70422281038Smrg	BUILDPSDOC=yes
70522281038Smrgfi
70622281038SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
70722281038SmrgAC_MSG_RESULT([$BUILDPSDOC])
708a9274bcdSmrg
70922281038SmrgAC_MSG_CHECKING([whether to build HTML documentation])
71022281038Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
71122281038Smrg   test x$BUILD_HTMLDOC != xno; then
71222281038Smrg	BUILDHTMLDOC=yes
71366fe65f6Smrgfi
71422281038SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
71522281038SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
71666fe65f6Smrg
71722281038SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
71822281038SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
71922281038SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
72022281038SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
721a9274bcdSmrg
72222281038SmrgAC_SUBST(MAKE_TEXT)
72322281038SmrgAC_SUBST(MAKE_PS)
72422281038SmrgAC_SUBST(MAKE_PDF)
72522281038SmrgAC_SUBST(MAKE_HTML)
72622281038Smrg]) # XORG_CHECK_DOCBOOK
72789d09728Smrg
72822281038Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
72922281038Smrg# ----------------
73022281038Smrg# Minimum version: 1.5.0
73122281038Smrg# Minimum version for optional DEFAULT argument: 1.11.0
73238c51623Smrg#
73322281038Smrg# Documentation tools are not always available on all platforms and sometimes
73422281038Smrg# not at the appropriate level. This macro enables a module to test for the
73522281038Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
73622281038Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
73722281038Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
73822281038Smrg# --with-xmlto assumes 'auto'.
73922281038Smrg#
74022281038Smrg# Interface to module:
74122281038Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
74222281038Smrg# XMLTO:	returns the path of the xmlto program found
74322281038Smrg#		returns the path set by the user in the environment
74422281038Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
74522281038Smrg#		'no' user instructs the module not to use xmlto
74622281038Smrg#
74722281038Smrg# Added in version 1.10.0
74822281038Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
74922281038Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
75022281038Smrg#
75122281038Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
75222281038Smrg#
75322281038SmrgAC_DEFUN([XORG_WITH_XMLTO],[
75422281038SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
75522281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
75622281038SmrgAC_ARG_WITH(xmlto,
75722281038Smrg	AS_HELP_STRING([--with-xmlto],
75822281038Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
75922281038Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
76022281038Smrgm4_undefine([_defopt])
761a9274bcdSmrg
76222281038Smrgif test "x$use_xmlto" = x"auto"; then
76322281038Smrg   AC_PATH_PROG([XMLTO], [xmlto])
76422281038Smrg   if test "x$XMLTO" = "x"; then
76522281038Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
76622281038Smrg	have_xmlto=no
76722281038Smrg   else
76822281038Smrg        have_xmlto=yes
76922281038Smrg   fi
77022281038Smrgelif test "x$use_xmlto" = x"yes" ; then
77122281038Smrg   AC_PATH_PROG([XMLTO], [xmlto])
77222281038Smrg   if test "x$XMLTO" = "x"; then
77322281038Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
77422281038Smrg   fi
77522281038Smrg   have_xmlto=yes
77622281038Smrgelif test "x$use_xmlto" = x"no" ; then
77722281038Smrg   if test "x$XMLTO" != "x"; then
77822281038Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
77922281038Smrg   fi
78022281038Smrg   have_xmlto=no
78122281038Smrgelse
78222281038Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
78322281038Smrgfi
784a9274bcdSmrg
78522281038Smrg# Test for a minimum version of xmlto, if provided.
78622281038Smrgm4_ifval([$1],
78722281038Smrg[if test "$have_xmlto" = yes; then
78822281038Smrg    # scrape the xmlto version
78922281038Smrg    AC_MSG_CHECKING([the xmlto version])
79022281038Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
79122281038Smrg    AC_MSG_RESULT([$xmlto_version])
79222281038Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
79322281038Smrg        [if test "x$use_xmlto" = xauto; then
79422281038Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
79522281038Smrg            have_xmlto=no
79622281038Smrg        else
79722281038Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
79822281038Smrg        fi])
79922281038Smrgfi])
800a9274bcdSmrg
80122281038Smrg# Test for the ability of xmlto to generate a text target
80266fe65f6Smrg#
80322281038Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
80422281038Smrg# following test for empty XML docbook files.
80522281038Smrg# For compatibility reasons use the following empty XML docbook file and if
80622281038Smrg# it fails try it again with a non-empty XML file.
80722281038Smrghave_xmlto_text=no
80822281038Smrgcat > conftest.xml << "EOF"
80922281038SmrgEOF
81022281038SmrgAS_IF([test "$have_xmlto" = yes],
81122281038Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
81222281038Smrg             [have_xmlto_text=yes],
81322281038Smrg             [# Try it again with a non-empty XML file.
81422281038Smrg              cat > conftest.xml << "EOF"
81522281038Smrg<x></x>
81622281038SmrgEOF
81722281038Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
81822281038Smrg                    [have_xmlto_text=yes],
81922281038Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
82022281038Smrgrm -f conftest.xml
82122281038SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
82222281038SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
82322281038Smrg]) # XORG_WITH_XMLTO
82422281038Smrg
82522281038Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
82622281038Smrg# --------------------------------------------
82722281038Smrg# Minimum version: 1.12.0
82822281038Smrg# Minimum version for optional DEFAULT argument: 1.12.0
82938c51623Smrg#
83022281038Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
83122281038Smrg# XML-based language used for the transformation of XML documents.
83222281038Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
83322281038Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
83422281038Smrg# The XSLT processor is often used as a standalone tool for transformations.
83522281038Smrg# It should not be assumed that this tool is used only to work with documnetation.
83622281038Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
83738c51623Smrg#
83822281038Smrg# Interface to module:
83922281038Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
84022281038Smrg# XSLTPROC:	 returns the path of the xsltproc program found
84122281038Smrg#		 returns the path set by the user in the environment
84222281038Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
84322281038Smrg#		  'no' user instructs the module not to use xsltproc
84422281038Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
845bc77032bSmrg#
84622281038Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
847bc77032bSmrg#
84822281038SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
84922281038SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
85022281038Smrg# Preserves the interface, should it be implemented later
85122281038Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
85222281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
85322281038SmrgAC_ARG_WITH(xsltproc,
85422281038Smrg	AS_HELP_STRING([--with-xsltproc],
85522281038Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
85622281038Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
85722281038Smrgm4_undefine([_defopt])
858a9274bcdSmrg
85922281038Smrgif test "x$use_xsltproc" = x"auto"; then
86022281038Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
86122281038Smrg   if test "x$XSLTPROC" = "x"; then
86222281038Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
86322281038Smrg	have_xsltproc=no
86422281038Smrg   else
86522281038Smrg        have_xsltproc=yes
86622281038Smrg   fi
86722281038Smrgelif test "x$use_xsltproc" = x"yes" ; then
86822281038Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
86922281038Smrg   if test "x$XSLTPROC" = "x"; then
87022281038Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
87122281038Smrg   fi
87222281038Smrg   have_xsltproc=yes
87322281038Smrgelif test "x$use_xsltproc" = x"no" ; then
87422281038Smrg   if test "x$XSLTPROC" != "x"; then
87522281038Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
87622281038Smrg   fi
87722281038Smrg   have_xsltproc=no
878bc77032bSmrgelse
87922281038Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
88066fe65f6Smrgfi
88166fe65f6Smrg
88222281038SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
88322281038Smrg]) # XORG_WITH_XSLTPROC
884a9274bcdSmrg
88522281038Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
88622281038Smrg# ----------------------------------------
88722281038Smrg# Minimum version: 1.15.0
88848af84faSmrg#
88922281038Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
89022281038Smrg# scanning arbitrary text files, extracting information from those text files,
89122281038Smrg# and printing reports based on that information.
89222281038Smrg#
89322281038Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
89422281038Smrg#
89522281038Smrg# Interface to module:
89622281038Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
89722281038Smrg# PERL:	     returns the path of the perl program found
89822281038Smrg#	     returns the path set by the user in the environment
89922281038Smrg# --with-perl: 'yes' user instructs the module to use perl
90022281038Smrg#	       'no' user instructs the module not to use perl
90122281038Smrg# have_perl: returns yes if perl found in PATH or no
90222281038Smrg#
90322281038Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
90422281038Smrg#
90522281038SmrgAC_DEFUN([XORG_WITH_PERL],[
90622281038SmrgAC_ARG_VAR([PERL], [Path to perl command])
90722281038Smrg# Preserves the interface, should it be implemented later
90822281038Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
90922281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
91022281038SmrgAC_ARG_WITH(perl,
91122281038Smrg	AS_HELP_STRING([--with-perl],
91222281038Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
91322281038Smrg	   [use_perl=$withval], [use_perl=]_defopt)
91422281038Smrgm4_undefine([_defopt])
91538c51623Smrg
91622281038Smrgif test "x$use_perl" = x"auto"; then
91722281038Smrg   AC_PATH_PROG([PERL], [perl])
91822281038Smrg   if test "x$PERL" = "x"; then
91922281038Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
92022281038Smrg	have_perl=no
92122281038Smrg   else
92222281038Smrg        have_perl=yes
92322281038Smrg   fi
92422281038Smrgelif test "x$use_perl" = x"yes" ; then
92522281038Smrg   AC_PATH_PROG([PERL], [perl])
92622281038Smrg   if test "x$PERL" = "x"; then
92722281038Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
92822281038Smrg   fi
92922281038Smrg   have_perl=yes
93022281038Smrgelif test "x$use_perl" = x"no" ; then
93122281038Smrg   if test "x$PERL" != "x"; then
93222281038Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
93322281038Smrg   fi
93422281038Smrg   have_perl=no
93522281038Smrgelse
93622281038Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
937bc77032bSmrgfi
93838c51623Smrg
93922281038SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
94022281038Smrg]) # XORG_WITH_PERL
94138c51623Smrg
94222281038Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
94322281038Smrg# ----------------
94422281038Smrg# Minimum version: 1.5.0
94522281038Smrg# Minimum version for optional DEFAULT argument: 1.11.0
94622281038Smrg#
94722281038Smrg# Documentation tools are not always available on all platforms and sometimes
94822281038Smrg# not at the appropriate level. This macro enables a module to test for the
94922281038Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
95022281038Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
95122281038Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
95222281038Smrg# --with-asciidoc assumes 'auto'.
95322281038Smrg#
95422281038Smrg# Interface to module:
95522281038Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
95622281038Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
95722281038Smrg#		 returns the path set by the user in the environment
95822281038Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
95922281038Smrg#		  'no' user instructs the module not to use asciidoc
96022281038Smrg#
96122281038Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
96222281038Smrg#
96322281038SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
96422281038SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
96522281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
96622281038SmrgAC_ARG_WITH(asciidoc,
96722281038Smrg	AS_HELP_STRING([--with-asciidoc],
96822281038Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
96922281038Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
97022281038Smrgm4_undefine([_defopt])
97148af84faSmrg
97222281038Smrgif test "x$use_asciidoc" = x"auto"; then
97322281038Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
97422281038Smrg   if test "x$ASCIIDOC" = "x"; then
97522281038Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
97622281038Smrg	have_asciidoc=no
97722281038Smrg   else
97822281038Smrg        have_asciidoc=yes
97922281038Smrg   fi
98022281038Smrgelif test "x$use_asciidoc" = x"yes" ; then
98122281038Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
98222281038Smrg   if test "x$ASCIIDOC" = "x"; then
98322281038Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
98422281038Smrg   fi
98522281038Smrg   have_asciidoc=yes
98622281038Smrgelif test "x$use_asciidoc" = x"no" ; then
98722281038Smrg   if test "x$ASCIIDOC" != "x"; then
98822281038Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
98922281038Smrg   fi
99022281038Smrg   have_asciidoc=no
99122281038Smrgelse
99222281038Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
99338c51623Smrgfi
99422281038Smrgm4_ifval([$1],
99522281038Smrg[if test "$have_asciidoc" = yes; then
99622281038Smrg    # scrape the asciidoc version
99722281038Smrg    AC_MSG_CHECKING([the asciidoc version])
99822281038Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
99922281038Smrg    AC_MSG_RESULT([$asciidoc_version])
100022281038Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
100122281038Smrg        [if test "x$use_asciidoc" = xauto; then
100222281038Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
100322281038Smrg            have_asciidoc=no
100422281038Smrg        else
100522281038Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
100622281038Smrg        fi])
100722281038Smrgfi])
100822281038SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
100922281038Smrg]) # XORG_WITH_ASCIIDOC
101048af84faSmrg
101122281038Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
101222281038Smrg# -------------------------------------------
101322281038Smrg# Minimum version: 1.5.0
101422281038Smrg# Minimum version for optional DEFAULT argument: 1.11.0
101522281038Smrg# Minimum version for optional DOT checking: 1.18.0
101622281038Smrg#
101722281038Smrg# Documentation tools are not always available on all platforms and sometimes
101822281038Smrg# not at the appropriate level. This macro enables a module to test for the
101922281038Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
102022281038Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
102122281038Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
102222281038Smrg# --with-doxygen assumes 'auto'.
102322281038Smrg#
102422281038Smrg# Interface to module:
102522281038Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
102622281038Smrg# DOXYGEN:	 returns the path of the doxygen program found
102722281038Smrg#		 returns the path set by the user in the environment
102822281038Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
102922281038Smrg#		  'no' user instructs the module not to use doxygen
103022281038Smrg#
103122281038Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
103222281038Smrg#
103322281038SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
103422281038SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
103522281038SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
103622281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
103722281038SmrgAC_ARG_WITH(doxygen,
103822281038Smrg	AS_HELP_STRING([--with-doxygen],
103922281038Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
104022281038Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
104122281038Smrgm4_undefine([_defopt])
104248af84faSmrg
104322281038Smrgif test "x$use_doxygen" = x"auto"; then
104422281038Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
104522281038Smrg   if test "x$DOXYGEN" = "x"; then
104622281038Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
104722281038Smrg	have_doxygen=no
104822281038Smrg   else
104922281038Smrg        have_doxygen=yes
105022281038Smrg   fi
105122281038Smrgelif test "x$use_doxygen" = x"yes" ; then
105222281038Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
105322281038Smrg   if test "x$DOXYGEN" = "x"; then
105422281038Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
105522281038Smrg   fi
105622281038Smrg   have_doxygen=yes
105722281038Smrgelif test "x$use_doxygen" = x"no" ; then
105822281038Smrg   if test "x$DOXYGEN" != "x"; then
105922281038Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
106022281038Smrg   fi
106122281038Smrg   have_doxygen=no
106222281038Smrgelse
106322281038Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1064bc77032bSmrgfi
106522281038Smrgm4_ifval([$1],
106622281038Smrg[if test "$have_doxygen" = yes; then
106722281038Smrg    # scrape the doxygen version
106822281038Smrg    AC_MSG_CHECKING([the doxygen version])
106922281038Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
107022281038Smrg    AC_MSG_RESULT([$doxygen_version])
107122281038Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
107222281038Smrg        [if test "x$use_doxygen" = xauto; then
107322281038Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
107422281038Smrg            have_doxygen=no
107522281038Smrg        else
107622281038Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
107722281038Smrg        fi])
107822281038Smrgfi])
107938c51623Smrg
108022281038Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
108122281038Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
108222281038Smrgdnl 	HAVE_DOT = @HAVE_DOT@
108322281038SmrgHAVE_DOT=no
108422281038Smrgif test "x$have_doxygen" = "xyes"; then
108522281038Smrg  AC_PATH_PROG([DOT], [dot])
108622281038Smrg    if test "x$DOT" != "x"; then
108722281038Smrg      HAVE_DOT=yes
108822281038Smrg    fi
108922281038Smrgfi
109038c51623Smrg
109122281038SmrgAC_SUBST([HAVE_DOT])
109222281038SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
109322281038SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
109422281038Smrg]) # XORG_WITH_DOXYGEN
109538c51623Smrg
109622281038Smrg# XORG_WITH_GROFF([DEFAULT])
109722281038Smrg# ----------------
109822281038Smrg# Minimum version: 1.6.0
109922281038Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1100f931275dSmrg#
110122281038Smrg# Documentation tools are not always available on all platforms and sometimes
110222281038Smrg# not at the appropriate level. This macro enables a module to test for the
110322281038Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
110422281038Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
110522281038Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
110622281038Smrg# --with-groff assumes 'auto'.
110722281038Smrg#
110822281038Smrg# Interface to module:
110922281038Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
111022281038Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
111122281038Smrg# HAVE_GROFF_MS: the -ms macros package
111222281038Smrg# GROFF:	 returns the path of the groff program found
111322281038Smrg#		 returns the path set by the user in the environment
111422281038Smrg# --with-groff:	 'yes' user instructs the module to use groff
111522281038Smrg#		 'no' user instructs the module not to use groff
111622281038Smrg#
111722281038Smrg# Added in version 1.9.0:
111822281038Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
111922281038Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
112022281038Smrg#		   psselect from the psutils package.
112122281038Smrg#		   the ghostcript package. Refer to the grohtml man pages
112222281038Smrg#
112322281038Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
112422281038Smrg#
112522281038Smrg# OS and distros often splits groff in a basic and full package, the former
112622281038Smrg# having the groff program and the later having devices, fonts and macros
112722281038Smrg# Checking for the groff executable is not enough.
112822281038Smrg#
112922281038Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
113022281038Smrg# unset HAVE_GROFF or GROFF env variables.
113122281038Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
113222281038Smrg#
113322281038SmrgAC_DEFUN([XORG_WITH_GROFF],[
113422281038SmrgAC_ARG_VAR([GROFF], [Path to groff command])
113522281038Smrgm4_define([_defopt], m4_default([$1], [auto]))
113622281038SmrgAC_ARG_WITH(groff,
113722281038Smrg	AS_HELP_STRING([--with-groff],
113822281038Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
113922281038Smrg	   [use_groff=$withval], [use_groff=]_defopt)
114022281038Smrgm4_undefine([_defopt])
1141bc77032bSmrg
114222281038Smrgif test "x$use_groff" = x"auto"; then
114322281038Smrg   AC_PATH_PROG([GROFF], [groff])
114422281038Smrg   if test "x$GROFF" = "x"; then
114522281038Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
114622281038Smrg	have_groff=no
114722281038Smrg   else
114822281038Smrg        have_groff=yes
114922281038Smrg   fi
115022281038Smrgelif test "x$use_groff" = x"yes" ; then
115122281038Smrg   AC_PATH_PROG([GROFF], [groff])
115222281038Smrg   if test "x$GROFF" = "x"; then
115322281038Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
115422281038Smrg   fi
115522281038Smrg   have_groff=yes
115622281038Smrgelif test "x$use_groff" = x"no" ; then
115722281038Smrg   if test "x$GROFF" != "x"; then
115822281038Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
115922281038Smrg   fi
116022281038Smrg   have_groff=no
1161bc77032bSmrgelse
116222281038Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1163bc77032bSmrgfi
1164bc77032bSmrg
116522281038Smrg# We have groff, test for the presence of the macro packages
116622281038Smrgif test "x$have_groff" = x"yes"; then
116722281038Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
116822281038Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
116922281038Smrg        groff_ms_works=yes
117022281038Smrg    else
117122281038Smrg        groff_ms_works=no
117222281038Smrg    fi
117322281038Smrg    AC_MSG_RESULT([$groff_ms_works])
117422281038Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
117522281038Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
117622281038Smrg        groff_mm_works=yes
117722281038Smrg    else
117822281038Smrg        groff_mm_works=no
117922281038Smrg    fi
118022281038Smrg    AC_MSG_RESULT([$groff_mm_works])
118122281038Smrgfi
1182bc77032bSmrg
118322281038Smrg# We have groff, test for HTML dependencies, one command per package
118422281038Smrgif test "x$have_groff" = x"yes"; then
118522281038Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
118622281038Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
118722281038Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
118822281038Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
118922281038Smrg      have_groff_html=yes
119022281038Smrg   else
119122281038Smrg      have_groff_html=no
119222281038Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
119322281038Smrg   fi
119422281038Smrgfi
1195f931275dSmrg
119622281038Smrg# Set Automake conditionals for Makefiles
119722281038SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
119822281038SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
119922281038SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
120022281038SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
120122281038Smrg]) # XORG_WITH_GROFF
120238c51623Smrg
120322281038Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
120422281038Smrg# ---------------------------------------
120522281038Smrg# Minimum version: 1.6.0
120622281038Smrg# Minimum version for optional DEFAULT argument: 1.11.0
120722281038Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
120822281038Smrg#
120922281038Smrg# Documentation tools are not always available on all platforms and sometimes
121022281038Smrg# not at the appropriate level. This macro enables a module to test for the
121122281038Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
121222281038Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
121322281038Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
121422281038Smrg# --with-fop assumes 'auto'.
121522281038Smrg#
121622281038Smrg# Interface to module:
121722281038Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
121822281038Smrg# FOP:	 	returns the path of the fop program found
121922281038Smrg#		returns the path set by the user in the environment
122022281038Smrg# --with-fop: 	'yes' user instructs the module to use fop
122122281038Smrg#		'no' user instructs the module not to use fop
122222281038Smrg#
122322281038Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
122422281038Smrg#
122522281038SmrgAC_DEFUN([XORG_WITH_FOP],[
122622281038SmrgAC_ARG_VAR([FOP], [Path to fop command])
122722281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
122822281038SmrgAC_ARG_WITH(fop,
122922281038Smrg	AS_HELP_STRING([--with-fop],
123022281038Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
123122281038Smrg	   [use_fop=$withval], [use_fop=]_defopt)
123222281038Smrgm4_undefine([_defopt])
1233bc77032bSmrg
123422281038Smrgif test "x$use_fop" = x"auto"; then
123522281038Smrg   AC_PATH_PROG([FOP], [fop])
123622281038Smrg   if test "x$FOP" = "x"; then
123722281038Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
123822281038Smrg	have_fop=no
123922281038Smrg   else
124022281038Smrg        have_fop=yes
124122281038Smrg   fi
124222281038Smrgelif test "x$use_fop" = x"yes" ; then
124322281038Smrg   AC_PATH_PROG([FOP], [fop])
124422281038Smrg   if test "x$FOP" = "x"; then
124522281038Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
124622281038Smrg   fi
124722281038Smrg   have_fop=yes
124822281038Smrgelif test "x$use_fop" = x"no" ; then
124922281038Smrg   if test "x$FOP" != "x"; then
125022281038Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
125122281038Smrg   fi
125222281038Smrg   have_fop=no
1253f931275dSmrgelse
125422281038Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1255f931275dSmrgfi
1256f931275dSmrg
125722281038Smrg# Test for a minimum version of fop, if provided.
125822281038Smrgm4_ifval([$1],
125922281038Smrg[if test "$have_fop" = yes; then
126022281038Smrg    # scrape the fop version
126122281038Smrg    AC_MSG_CHECKING([for fop minimum version])
126222281038Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
126322281038Smrg    AC_MSG_RESULT([$fop_version])
126422281038Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
126522281038Smrg        [if test "x$use_fop" = xauto; then
126622281038Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
126722281038Smrg            have_fop=no
126822281038Smrg        else
126922281038Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
127022281038Smrg        fi])
127122281038Smrgfi])
127222281038SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
127322281038Smrg]) # XORG_WITH_FOP
1274f931275dSmrg
127522281038Smrg# XORG_WITH_M4([MIN-VERSION])
127622281038Smrg# ---------------------------
127722281038Smrg# Minimum version: 1.19.0
127822281038Smrg#
127922281038Smrg# This macro attempts to locate an m4 macro processor which supports
128022281038Smrg# -I option and is only useful for modules relying on M4 in order to
128122281038Smrg# expand macros in source code files.
128222281038Smrg#
128322281038Smrg# Interface to module:
128422281038Smrg# M4:	 	returns the path of the m4 program found
128522281038Smrg#		returns the path set by the user in the environment
128622281038Smrg#
128722281038SmrgAC_DEFUN([XORG_WITH_M4], [
128822281038SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
128922281038Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
129022281038Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
129122281038Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
129222281038Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
129322281038Smrg   [$PATH:/usr/gnu/bin])])
129438c51623Smrg
129522281038SmrgAC_SUBST([M4], [$ac_cv_path_M4])
129622281038Smrg]) # XORG_WITH_M4
129722281038Smrg
129822281038Smrg# XORG_WITH_PS2PDF([DEFAULT])
129922281038Smrg# ----------------
130022281038Smrg# Minimum version: 1.6.0
130122281038Smrg# Minimum version for optional DEFAULT argument: 1.11.0
130222281038Smrg#
130322281038Smrg# Documentation tools are not always available on all platforms and sometimes
130422281038Smrg# not at the appropriate level. This macro enables a module to test for the
130522281038Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
130622281038Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
130722281038Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
130822281038Smrg# --with-ps2pdf assumes 'auto'.
130922281038Smrg#
131022281038Smrg# Interface to module:
131122281038Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
131222281038Smrg# PS2PDF:	returns the path of the ps2pdf program found
131322281038Smrg#		returns the path set by the user in the environment
131422281038Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
131522281038Smrg#		 'no' user instructs the module not to use ps2pdf
131622281038Smrg#
131722281038Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
131822281038Smrg#
131922281038SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
132022281038SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
132122281038Smrgm4_define([_defopt], m4_default([$1], [auto]))
132222281038SmrgAC_ARG_WITH(ps2pdf,
132322281038Smrg	AS_HELP_STRING([--with-ps2pdf],
132422281038Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
132522281038Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
132622281038Smrgm4_undefine([_defopt])
1327bc77032bSmrg
132822281038Smrgif test "x$use_ps2pdf" = x"auto"; then
132922281038Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
133022281038Smrg   if test "x$PS2PDF" = "x"; then
133122281038Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
133222281038Smrg	have_ps2pdf=no
133322281038Smrg   else
133422281038Smrg        have_ps2pdf=yes
133522281038Smrg   fi
133622281038Smrgelif test "x$use_ps2pdf" = x"yes" ; then
133722281038Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
133822281038Smrg   if test "x$PS2PDF" = "x"; then
133922281038Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
134022281038Smrg   fi
134122281038Smrg   have_ps2pdf=yes
134222281038Smrgelif test "x$use_ps2pdf" = x"no" ; then
134322281038Smrg   if test "x$PS2PDF" != "x"; then
134422281038Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
134522281038Smrg   fi
134622281038Smrg   have_ps2pdf=no
1347bc77032bSmrgelse
134822281038Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1349bc77032bSmrgfi
135022281038SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
135122281038Smrg]) # XORG_WITH_PS2PDF
1352bc77032bSmrg
135322281038Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
135422281038Smrg# ----------------
135522281038Smrg# Minimum version: 1.6.0
135622281038Smrg#
135722281038Smrg# Documentation tools are not always available on all platforms and sometimes
135822281038Smrg# not at the appropriate level. This macro enables a builder to skip all
135922281038Smrg# documentation targets except traditional man pages.
136022281038Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
136122281038Smrg# maximum flexibilty in controlling documentation building.
136222281038Smrg# Refer to:
136322281038Smrg# XORG_WITH_XMLTO         --with-xmlto
136422281038Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
136522281038Smrg# XORG_WITH_DOXYGEN       --with-doxygen
136622281038Smrg# XORG_WITH_FOP           --with-fop
136722281038Smrg# XORG_WITH_GROFF         --with-groff
136822281038Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
136922281038Smrg#
137022281038Smrg# Interface to module:
137122281038Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
137222281038Smrg# --enable-docs: 'yes' user instructs the module to generate docs
137322281038Smrg#		 'no' user instructs the module not to generate docs
137422281038Smrg# parm1:	specify the default value, yes or no.
137522281038Smrg#
137622281038SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
137722281038Smrgm4_define([docs_default], m4_default([$1], [yes]))
137822281038SmrgAC_ARG_ENABLE(docs,
137922281038Smrg	AS_HELP_STRING([--enable-docs],
138022281038Smrg	   [Enable building the documentation (default: ]docs_default[)]),
138122281038Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
138222281038Smrgm4_undefine([docs_default])
138322281038SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
138422281038SmrgAC_MSG_CHECKING([whether to build documentation])
138522281038SmrgAC_MSG_RESULT([$build_docs])
138622281038Smrg]) # XORG_ENABLE_DOCS
1387bc77032bSmrg
138822281038Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
138922281038Smrg# ----------------
139022281038Smrg# Minimum version: 1.6.0
139122281038Smrg#
139222281038Smrg# This macro enables a builder to skip all developer documentation.
139322281038Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
139422281038Smrg# maximum flexibilty in controlling documentation building.
139522281038Smrg# Refer to:
139622281038Smrg# XORG_WITH_XMLTO         --with-xmlto
139722281038Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
139822281038Smrg# XORG_WITH_DOXYGEN       --with-doxygen
139922281038Smrg# XORG_WITH_FOP           --with-fop
140022281038Smrg# XORG_WITH_GROFF         --with-groff
140122281038Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
140222281038Smrg#
140322281038Smrg# Interface to module:
140422281038Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
140522281038Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
140622281038Smrg#			'no' user instructs the module not to generate developer docs
140722281038Smrg# parm1:		specify the default value, yes or no.
140822281038Smrg#
140922281038SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
141022281038Smrgm4_define([devel_default], m4_default([$1], [yes]))
141122281038SmrgAC_ARG_ENABLE(devel-docs,
141222281038Smrg	AS_HELP_STRING([--enable-devel-docs],
141322281038Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
141422281038Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
141522281038Smrgm4_undefine([devel_default])
141622281038SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
141722281038SmrgAC_MSG_CHECKING([whether to build developer documentation])
141822281038SmrgAC_MSG_RESULT([$build_devel_docs])
141922281038Smrg]) # XORG_ENABLE_DEVEL_DOCS
1420bc77032bSmrg
142122281038Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
142222281038Smrg# ----------------
142322281038Smrg# Minimum version: 1.6.0
1424bc77032bSmrg#
142522281038Smrg# This macro enables a builder to skip all functional specification targets.
142622281038Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
142722281038Smrg# maximum flexibilty in controlling documentation building.
142822281038Smrg# Refer to:
142922281038Smrg# XORG_WITH_XMLTO         --with-xmlto
143022281038Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
143122281038Smrg# XORG_WITH_DOXYGEN       --with-doxygen
143222281038Smrg# XORG_WITH_FOP           --with-fop
143322281038Smrg# XORG_WITH_GROFF         --with-groff
143422281038Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
143522281038Smrg#
143622281038Smrg# Interface to module:
143722281038Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
143822281038Smrg# --enable-specs:	'yes' user instructs the module to generate specs
143922281038Smrg#			'no' user instructs the module not to generate specs
144022281038Smrg# parm1:		specify the default value, yes or no.
144122281038Smrg#
144222281038SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
144322281038Smrgm4_define([spec_default], m4_default([$1], [yes]))
144422281038SmrgAC_ARG_ENABLE(specs,
144522281038Smrg	AS_HELP_STRING([--enable-specs],
144622281038Smrg	   [Enable building the specs (default: ]spec_default[)]),
144722281038Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
144822281038Smrgm4_undefine([spec_default])
144922281038SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
145022281038SmrgAC_MSG_CHECKING([whether to build functional specifications])
145122281038SmrgAC_MSG_RESULT([$build_specs])
145222281038Smrg]) # XORG_ENABLE_SPECS
1453bc77032bSmrg
145422281038Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
145522281038Smrg# ----------------------------------------------
145622281038Smrg# Minimum version: 1.13.0
145722281038Smrg#
145822281038Smrg# This macro enables a builder to enable/disable unit testing
145922281038Smrg# It makes no assumption about the test cases implementation
146022281038Smrg# Test cases may or may not use Automake "Support for test suites"
146122281038Smrg# They may or may not use the software utility library GLib
146222281038Smrg#
146322281038Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
146422281038Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
146522281038Smrg# The variable enable_unit_tests is used by other macros in this file.
146622281038Smrg#
146722281038Smrg# Interface to module:
146822281038Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
146922281038Smrg# enable_unit_tests:    used in configure.ac for additional configuration
147022281038Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
147122281038Smrg#			'no' user instructs the module not to build tests
147222281038Smrg# parm1:		specify the default value, yes or no.
147322281038Smrg#
147422281038SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
147522281038SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
147622281038SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
147722281038SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
147822281038Smrgm4_define([_defopt], m4_default([$1], [auto]))
147922281038SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
148022281038Smrg	[Enable building unit test cases (default: ]_defopt[)]),
148122281038Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
148222281038Smrgm4_undefine([_defopt])
148322281038SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
148422281038SmrgAC_MSG_CHECKING([whether to build unit test cases])
148522281038SmrgAC_MSG_RESULT([$enable_unit_tests])
148622281038Smrg]) # XORG_ENABLE_UNIT_TESTS
1487bc77032bSmrg
148822281038Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
148922281038Smrg# ------------------------------------------------------
149022281038Smrg# Minimum version: 1.17.0
149122281038Smrg#
149222281038Smrg# This macro enables a builder to enable/disable integration testing
149322281038Smrg# It makes no assumption about the test cases' implementation
149422281038Smrg# Test cases may or may not use Automake "Support for test suites"
149522281038Smrg#
149622281038Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
149722281038Smrg# usually requires less dependencies and may be built and run under less
149822281038Smrg# stringent environments than integration tests.
149922281038Smrg#
150022281038Smrg# Interface to module:
150122281038Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
150222281038Smrg# enable_integration_tests:   used in configure.ac for additional configuration
150322281038Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
150422281038Smrg#                             'no' user instructs the module not to build tests
150522281038Smrg# parm1:                      specify the default value, yes or no.
150622281038Smrg#
150722281038SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
150822281038SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
150922281038Smrgm4_define([_defopt], m4_default([$1], [auto]))
151022281038SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
151122281038Smrg	[Enable building integration test cases (default: ]_defopt[)]),
151222281038Smrg	[enable_integration_tests=$enableval],
151322281038Smrg	[enable_integration_tests=]_defopt)
151422281038Smrgm4_undefine([_defopt])
151522281038SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
151622281038Smrg	[test "x$enable_integration_tests" != xno])
151722281038SmrgAC_MSG_CHECKING([whether to build unit test cases])
151822281038SmrgAC_MSG_RESULT([$enable_integration_tests])
151922281038Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
152038c51623Smrg
152122281038Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
152222281038Smrg# ----------------------------------------
152322281038Smrg# Minimum version: 1.13.0
152422281038Smrg#
152522281038Smrg# GLib is a library which provides advanced data structures and functions.
152622281038Smrg# This macro enables a module to test for the presence of Glib.
152722281038Smrg#
152822281038Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
152922281038Smrg# Otherwise the value of $enable_unit_tests is blank.
153022281038Smrg#
153122281038Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
153222281038Smrg# test support usually requires less dependencies and may be built and run under
153322281038Smrg# less stringent environments than integration tests.
153422281038Smrg#
153522281038Smrg# Interface to module:
153622281038Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
153722281038Smrg# with_glib: used in configure.ac to know if GLib has been found
153822281038Smrg# --with-glib:	'yes' user instructs the module to use glib
153922281038Smrg#		'no' user instructs the module not to use glib
154022281038Smrg#
154122281038SmrgAC_DEFUN([XORG_WITH_GLIB],[
154222281038SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
154322281038Smrgm4_define([_defopt], m4_default([$2], [auto]))
154422281038SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
154522281038Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
154622281038Smrg	[with_glib=$withval], [with_glib=]_defopt)
154722281038Smrgm4_undefine([_defopt])
154838c51623Smrg
154922281038Smrghave_glib=no
155022281038Smrg# Do not probe GLib if user explicitly disabled unit testing
155122281038Smrgif test "x$enable_unit_tests" != x"no"; then
155222281038Smrg  # Do not probe GLib if user explicitly disabled it
155322281038Smrg  if test "x$with_glib" != x"no"; then
155422281038Smrg    m4_ifval(
155522281038Smrg      [$1],
155622281038Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
155722281038Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
155822281038Smrg    )
155922281038Smrg  fi
1560bc77032bSmrgfi
156138c51623Smrg
156222281038Smrg# Not having GLib when unit testing has been explicitly requested is an error
156322281038Smrgif test "x$enable_unit_tests" = x"yes"; then
156422281038Smrg  if test "x$have_glib" = x"no"; then
156522281038Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
156622281038Smrg  fi
156738c51623Smrgfi
156838c51623Smrg
156922281038Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
157022281038Smrgif test "x$enable_unit_tests" = x"no"; then
157122281038Smrg  if test "x$with_glib" = x"yes"; then
157222281038Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
157322281038Smrg  fi
1574bc77032bSmrgfi
157538c51623Smrg
157622281038Smrg# Not having GLib when it has been explicitly requested is an error
157722281038Smrgif test "x$with_glib" = x"yes"; then
157822281038Smrg  if test "x$have_glib" = x"no"; then
157922281038Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
158022281038Smrg  fi
158122281038Smrgfi
1582bc77032bSmrg
158322281038SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
158422281038Smrg]) # XORG_WITH_GLIB
1585bc77032bSmrg
158622281038Smrg# XORG_LD_WRAP([required|optional])
158722281038Smrg# ---------------------------------
158822281038Smrg# Minimum version: 1.13.0
1589f931275dSmrg#
159022281038Smrg# Check if linker supports -wrap, passed via compiler flags
1591f931275dSmrg#
159222281038Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
159322281038Smrg# Otherwise the value of $enable_unit_tests is blank.
1594f931275dSmrg#
159522281038Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
159622281038Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
159722281038Smrg# available, an argument of "optional" allows use when some unit tests require
159822281038Smrg# ld -wrap and others do not.
1599f931275dSmrg#
160022281038SmrgAC_DEFUN([XORG_LD_WRAP],[
160122281038SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
160222281038Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
160322281038Smrg                      void __wrap_exit(int status) { return; }],
160422281038Smrg                     [exit(0);])])
160522281038Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
160622281038Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
160722281038Smrg  if test "x$have_ld_wrap" = x"no"; then
160822281038Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
160922281038Smrg  fi
1610bc77032bSmrgfi
161122281038SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1612bc77032bSmrg#
161322281038Smrg]) # XORG_LD_WRAP
161438c51623Smrg
161522281038Smrg# XORG_CHECK_LINKER_FLAGS
161622281038Smrg# -----------------------
161722281038Smrg# SYNOPSIS
1618bc77032bSmrg#
161922281038Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
1620bc77032bSmrg#
162122281038Smrg# DESCRIPTION
1622bc77032bSmrg#
162322281038Smrg#   Check whether the given linker FLAGS work with the current language's
162422281038Smrg#   linker, or whether they give an error.
1625bc77032bSmrg#
162622281038Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
162722281038Smrg#   success/failure.
162822281038Smrg#
162922281038Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
163022281038Smrg#
163122281038Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
163222281038Smrg#
163322281038Smrg# LICENSE
163422281038Smrg#
163522281038Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
163622281038Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
163722281038Smrg#   Copyright (c) 2009 Matteo Frigo
163822281038Smrg#
163922281038Smrg#   This program is free software: you can redistribute it and/or modify it
164022281038Smrg#   under the terms of the GNU General Public License as published by the
164122281038Smrg#   Free Software Foundation, either version 3 of the License, or (at your
164222281038Smrg#   option) any later version.
164322281038Smrg#
164422281038Smrg#   This program is distributed in the hope that it will be useful, but
164522281038Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
164622281038Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
164722281038Smrg#   Public License for more details.
164822281038Smrg#
164922281038Smrg#   You should have received a copy of the GNU General Public License along
165022281038Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
165122281038Smrg#
165222281038Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
165322281038Smrg#   gives unlimited permission to copy, distribute and modify the configure
165422281038Smrg#   scripts that are the output of Autoconf when processing the Macro. You
165522281038Smrg#   need not follow the terms of the GNU General Public License when using
165622281038Smrg#   or distributing such scripts, even though portions of the text of the
165722281038Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
165822281038Smrg#   all other use of the material that constitutes the Autoconf Macro.
165922281038Smrg#
166022281038Smrg#   This special exception to the GPL applies to versions of the Autoconf
166122281038Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
166222281038Smrg#   modified version of the Autoconf Macro, you may extend this special
166322281038Smrg#   exception to the GPL to apply to your modified version as well.#
166422281038SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
166522281038Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
166622281038Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
166722281038SmrgAS_LITERAL_IF([$1],
166822281038Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
166922281038Smrg      ax_save_FLAGS=$LDFLAGS
167022281038Smrg      LDFLAGS="$1"
167122281038Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
167222281038Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
167322281038Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
167422281038Smrg      LDFLAGS=$ax_save_FLAGS])],
167522281038Smrg  [ax_save_FLAGS=$LDFLAGS
167622281038Smrg   LDFLAGS="$1"
167722281038Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
167822281038Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
167922281038Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
168022281038Smrg   LDFLAGS=$ax_save_FLAGS])
168122281038Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
168222281038SmrgAC_MSG_RESULT($xorg_check_linker_flags)
168322281038Smrgif test "x$xorg_check_linker_flags" = xyes; then
168422281038Smrg	m4_default([$2], :)
1685bc77032bSmrgelse
168622281038Smrg	m4_default([$3], :)
168738c51623Smrgfi
168822281038Smrg]) # XORG_CHECK_LINKER_FLAGS
168938c51623Smrg
169022281038Smrg# XORG_MEMORY_CHECK_FLAGS
169122281038Smrg# -----------------------
169222281038Smrg# Minimum version: 1.16.0
169348af84faSmrg#
169422281038Smrg# This macro attempts to find appropriate memory checking functionality
169522281038Smrg# for various platforms which unit testing code may use to catch various
169622281038Smrg# forms of memory allocation and access errors in testing.
169748af84faSmrg#
1698bc77032bSmrg# Interface to module:
169922281038Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
170022281038Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
170148af84faSmrg#
170222281038Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
1703bc77032bSmrg#
170422281038SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
170548af84faSmrg
170622281038SmrgAC_REQUIRE([AC_CANONICAL_HOST])
170722281038SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
170822281038Smrg           [Environment variables to enable memory checking in tests])
170922281038Smrg
171022281038Smrg# Check for different types of support on different platforms
171122281038Smrgcase $host_os in
171222281038Smrg    solaris*)
171322281038Smrg        AC_CHECK_LIB([umem], [umem_alloc],
171422281038Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
171522281038Smrg        ;;
171622281038Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
171722281038Smrg        # both directly and inverted, so should not be 0 or 255.
171822281038Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
171922281038Smrg        ;;
172022281038Smrg    darwin*)
172122281038Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
172222281038Smrg        ;;
172322281038Smrg    *bsd*)
172422281038Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
172522281038Smrg        ;;
172622281038Smrgesac
172722281038Smrg
172822281038Smrg# User supplied flags override default flags
172922281038Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
173022281038Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1731bc77032bSmrgfi
173238c51623Smrg
173322281038SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
173422281038Smrg]) # XORG_WITH_LINT
173538c51623Smrg
173622281038Smrg# XORG_CHECK_MALLOC_ZERO
173722281038Smrg# ----------------------
173822281038Smrg# Minimum version: 1.0.0
173948af84faSmrg#
174022281038Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
174122281038Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
174222281038Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
174322281038SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
174422281038SmrgAC_ARG_ENABLE(malloc0returnsnull,
174522281038Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
174622281038Smrg		       [malloc(0) returns NULL (default: auto)]),
174722281038Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
174822281038Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
174938c51623Smrg
175022281038SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
175122281038Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
175222281038SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
175322281038Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
175422281038Smrg#include <stdlib.h>
175522281038Smrg],[
175622281038Smrg    char *m0, *r0, *c0, *p;
175722281038Smrg    m0 = malloc(0);
175822281038Smrg    p = malloc(10);
175922281038Smrg    r0 = realloc(p,0);
176022281038Smrg    c0 = calloc(0,10);
176122281038Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
176222281038Smrg])],
176322281038Smrg		[xorg_cv_malloc0_returns_null=yes],
176422281038Smrg		[xorg_cv_malloc0_returns_null=no])])
176522281038SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
176622281038Smrgfi
176722281038SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
176822281038Smrg
176922281038Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
177022281038Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
177122281038Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
177222281038Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1773bc77032bSmrgelse
177422281038Smrg	MALLOC_ZERO_CFLAGS=""
177522281038Smrg	XMALLOC_ZERO_CFLAGS=""
177622281038Smrg	XTMALLOC_ZERO_CFLAGS=""
1777bc77032bSmrgfi
177838c51623Smrg
177922281038SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
178022281038SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
178122281038SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
178222281038Smrg]) # XORG_CHECK_MALLOC_ZERO
178322281038Smrg
178422281038Smrg# XORG_WITH_LINT()
178522281038Smrg# ----------------
178622281038Smrg# Minimum version: 1.1.0
178748af84faSmrg#
178822281038Smrg# This macro enables the use of a tool that flags some suspicious and
178922281038Smrg# non-portable constructs (likely to be bugs) in C language source code.
179022281038Smrg# It will attempt to locate the tool and use appropriate options.
179122281038Smrg# There are various lint type tools on different platforms.
179248af84faSmrg#
1793bc77032bSmrg# Interface to module:
179422281038Smrg# LINT:		returns the path to the tool found on the platform
179522281038Smrg#		or the value set to LINT on the configure cmd line
179622281038Smrg#		also an Automake conditional
179722281038Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
179822281038Smrg#
179922281038Smrg# --with-lint:	'yes' user instructs the module to use lint
180022281038Smrg#		'no' user instructs the module not to use lint (default)
180148af84faSmrg#
180222281038Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
180322281038Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
180438c51623Smrg#
180522281038SmrgAC_DEFUN([XORG_WITH_LINT],[
180638c51623Smrg
180722281038SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
180822281038SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
180922281038SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
181022281038Smrg		[Use a lint-style source code checker (default: disabled)])],
181122281038Smrg		[use_lint=$withval], [use_lint=no])
181222281038Smrg
181322281038Smrg# Obtain platform specific info like program name and options
181422281038Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
181522281038Smrgcase $host_os in
181622281038Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
181722281038Smrg	lint_name=splint
181822281038Smrg	lint_options="-badflag"
181922281038Smrg	;;
182022281038Smrg  *freebsd* | *netbsd*)
182122281038Smrg	lint_name=lint
182222281038Smrg	lint_options="-u -b"
182322281038Smrg	;;
182422281038Smrg  *solaris*)
182522281038Smrg	lint_name=lint
182622281038Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
182722281038Smrg	;;
182822281038Smrgesac
182922281038Smrg
183022281038Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
183122281038Smrgif test "x$use_lint" = x"yes" ; then
183222281038Smrg   AC_PATH_PROG([LINT], [$lint_name])
183322281038Smrg   if test "x$LINT" = "x"; then
183422281038Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1835bc77032bSmrg   fi
183622281038Smrgelif test "x$use_lint" = x"no" ; then
183722281038Smrg   if test "x$LINT" != "x"; then
183822281038Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1839bc77032bSmrg   fi
184048af84faSmrgelse
184122281038Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
184248af84faSmrgfi
184348af84faSmrg
184422281038Smrg# User supplied flags override default flags
184522281038Smrgif test "x$LINT_FLAGS" != "x"; then
184622281038Smrg   lint_options=$LINT_FLAGS
1847bc77032bSmrgfi
184848af84faSmrg
184922281038SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
185022281038SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
185138c51623Smrg
185222281038Smrg]) # XORG_WITH_LINT
185322281038Smrg
185422281038Smrg# XORG_LINT_LIBRARY(LIBNAME)
185522281038Smrg# --------------------------
185622281038Smrg# Minimum version: 1.1.0
185748af84faSmrg#
185822281038Smrg# Sets up flags for building lint libraries for checking programs that call
185922281038Smrg# functions in the library.
1860bc77032bSmrg#
1861bc77032bSmrg# Interface to module:
186222281038Smrg# LINTLIB		- Automake variable with the name of lint library file to make
186322281038Smrg# MAKE_LINT_LIB		- Automake conditional
1864bc77032bSmrg#
186522281038Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
186622281038Smrg#			  - 'no' user instructs the module not to create a lint library (default)
186722281038Smrg
186822281038SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
186922281038SmrgAC_REQUIRE([XORG_WITH_LINT])
187022281038SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
187122281038Smrg	[Create lint library (default: disabled)])],
187222281038Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
187322281038Smrg
187422281038Smrgif test "x$make_lint_lib" = x"yes" ; then
187522281038Smrg   LINTLIB=llib-l$1.ln
187622281038Smrg   if test "x$LINT" = "x"; then
187722281038Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
187822281038Smrg   fi
187922281038Smrgelif test "x$make_lint_lib" != x"no" ; then
188022281038Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
188122281038Smrgfi
188222281038Smrg
188322281038SmrgAC_SUBST(LINTLIB)
188422281038SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
188522281038Smrg
188622281038Smrg]) # XORG_LINT_LIBRARY
188722281038Smrg
188822281038Smrg# XORG_COMPILER_BRAND
188922281038Smrg# -------------------
189022281038Smrg# Minimum version: 1.14.0
1891bc77032bSmrg#
189222281038Smrg# Checks for various brands of compilers and sets flags as appropriate:
189322281038Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
189422281038Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
189522281038Smrg#   clang compiler - sets CLANGCC to "yes"
189622281038Smrg#   Intel compiler - sets INTELCC to "yes"
189722281038Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1898bc77032bSmrg#
189922281038SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
190022281038SmrgAC_LANG_CASE(
190122281038Smrg	[C], [
190222281038Smrg		AC_REQUIRE([AC_PROG_CC_C99])
190322281038Smrg	],
190422281038Smrg	[C++], [
190522281038Smrg		AC_REQUIRE([AC_PROG_CXX])
190622281038Smrg	]
190722281038Smrg)
190822281038SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
190922281038SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
191022281038SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
191122281038Smrg]) # XORG_COMPILER_BRAND
191222281038Smrg
191322281038Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
191422281038Smrg# ---------------
191522281038Smrg# Minimum version: 1.16.0
1916bc77032bSmrg#
191722281038Smrg# Test if the compiler works when passed the given flag as a command line argument.
191822281038Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
191922281038Smrg# next flag in the list until there are no more options.
1920bc77032bSmrg#
192122281038Smrg# Note that this does not guarantee that the compiler supports the flag as some
192222281038Smrg# compilers will simply ignore arguments that they do not understand, but we do
192322281038Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
192422281038Smrg# -Werror=unused-command-line-argument
192522281038Smrg#
192622281038SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
192722281038Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
192822281038Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1929c6a6acfbSmrg
193022281038SmrgAC_LANG_COMPILER_REQUIRE
1931c6a6acfbSmrg
193222281038SmrgAC_LANG_CASE(
193322281038Smrg	[C], [
193422281038Smrg		AC_REQUIRE([AC_PROG_CC_C99])
193522281038Smrg		define([PREFIX], [C])
193622281038Smrg		define([CACHE_PREFIX], [cc])
193722281038Smrg		define([COMPILER], [$CC])
193822281038Smrg	],
193922281038Smrg	[C++], [
194022281038Smrg		define([PREFIX], [CXX])
194122281038Smrg		define([CACHE_PREFIX], [cxx])
194222281038Smrg		define([COMPILER], [$CXX])
194322281038Smrg	]
194422281038Smrg)
194522281038Smrg
194622281038Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
194722281038Smrg
194822281038Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
194922281038Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
195022281038Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
195122281038Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
195222281038Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
195322281038Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
195422281038Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
195522281038Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
195622281038Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1957bc77032bSmrgfi
195848af84faSmrg
195922281038Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
196022281038Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
196122281038Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
196222281038Smrg	fi
196322281038Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
196422281038Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
196522281038Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
196622281038Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
196722281038Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
196822281038Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
196922281038Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
197022281038Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1971bc77032bSmrgfi
1972bc77032bSmrg
197322281038Smrgfound="no"
197422281038Smrgm4_foreach([flag], m4_cdr($@), [
197522281038Smrg	if test $found = "no" ; then
197622281038Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
197722281038Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
197822281038Smrg		fi
1979bc77032bSmrg
198022281038Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
198122281038Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
198222281038Smrg		fi
198322281038Smrg
198422281038Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
198522281038Smrg
198622281038Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
198722281038Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
198822281038Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
198922281038Smrg		AC_CACHE_VAL($cacheid,
199022281038Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
199122281038Smrg					     [eval $cacheid=yes],
199222281038Smrg					     [eval $cacheid=no])])
199322281038Smrg
199422281038Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
199522281038Smrg
199622281038Smrg		eval supported=\$$cacheid
199722281038Smrg		AC_MSG_RESULT([$supported])
199822281038Smrg		if test "$supported" = "yes" ; then
199922281038Smrg			$1="$$1 ]flag["
200022281038Smrg			found="yes"
200122281038Smrg		fi
200222281038Smrg	fi
200322281038Smrg])
200422281038Smrg]) # XORG_TESTSET_CFLAG
200522281038Smrg
200622281038Smrg# XORG_COMPILER_FLAGS
200722281038Smrg# ---------------
200822281038Smrg# Minimum version: 1.16.0
2009bc77032bSmrg#
201022281038Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
201122281038Smrg# arguments supported by the selected compiler which do NOT alter the generated
201222281038Smrg# code.  These arguments will cause the compiler to print various warnings
201322281038Smrg# during compilation AND turn a conservative set of warnings into errors.
2014bc77032bSmrg#
201522281038Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
201622281038Smrg# future versions of util-macros as options are added to new compilers.
2017bc77032bSmrg#
201822281038SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
201922281038SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2020bc77032bSmrg
202122281038SmrgAC_ARG_ENABLE(selective-werror,
202222281038Smrg              AS_HELP_STRING([--disable-selective-werror],
202322281038Smrg                             [Turn off selective compiler errors. (default: enabled)]),
202422281038Smrg              [SELECTIVE_WERROR=$enableval],
202522281038Smrg              [SELECTIVE_WERROR=yes])
202622281038Smrg
202722281038SmrgAC_LANG_CASE(
202822281038Smrg        [C], [
202922281038Smrg                define([PREFIX], [C])
203022281038Smrg        ],
203122281038Smrg        [C++], [
203222281038Smrg                define([PREFIX], [CXX])
203322281038Smrg        ]
203422281038Smrg)
203522281038Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
203622281038Smrgif test "x$SUNCC" = "xyes"; then
203722281038Smrg    [BASE_]PREFIX[FLAGS]="-v"
203848af84faSmrgelse
203922281038Smrg    [BASE_]PREFIX[FLAGS]=""
204048af84faSmrgfi
204148af84faSmrg
204222281038Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
204322281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
204422281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
204522281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
204622281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
204748af84faSmrg
204822281038SmrgAC_LANG_CASE(
204922281038Smrg	[C], [
205022281038Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
205122281038Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
205222281038Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
205322281038Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
205422281038Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
205522281038Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
205622281038Smrg	]
205722281038Smrg)
205838c51623Smrg
205922281038Smrg# This chunk adds additional warnings that could catch undesired effects.
206022281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
206122281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
206222281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
206322281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
206422281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
206522281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
206622281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
206738c51623Smrg
206822281038Smrg# These are currently disabled because they are noisy.  They will be enabled
206922281038Smrg# in the future once the codebase is sufficiently modernized to silence
207022281038Smrg# them.  For now, I don't want them to drown out the other warnings.
207122281038Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
207222281038Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
207322281038Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
207422281038Smrg
207522281038Smrg# Turn some warnings into errors, so we don't accidently get successful builds
207622281038Smrg# when there are problems that should be fixed.
207722281038Smrg
207822281038Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
207922281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
208022281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
208122281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
208222281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
208322281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
208422281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
208522281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
208622281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
208722281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
208822281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
208922281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
209022281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
209122281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2092bc77032bSmrgelse
209322281038SmrgAC_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])
209422281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
209522281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
209622281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
209722281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
209822281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
209922281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
210022281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
210122281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
210222281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
210322281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
210422281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
210522281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
210622281038SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
210738c51623Smrgfi
210848af84faSmrg
210922281038SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
211022281038Smrg]) # XORG_COMPILER_FLAGS
211122281038Smrg
211222281038Smrg# XORG_CWARNFLAGS
211322281038Smrg# ---------------
211422281038Smrg# Minimum version: 1.2.0
211522281038Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2116f931275dSmrg#
211722281038Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2118bc77032bSmrg#
211922281038Smrg# This function is deprecated because it defines -fno-strict-aliasing
212022281038Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
212122281038Smrg# is needed, then it should be added explicitly in the module when
212222281038Smrg# it is updated to use BASE_CFLAGS.
2123bc77032bSmrg#
212422281038SmrgAC_DEFUN([XORG_CWARNFLAGS], [
212522281038SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
212622281038SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
212722281038SmrgAC_LANG_CASE(
212822281038Smrg	[C], [
212922281038Smrg		CWARNFLAGS="$BASE_CFLAGS"
213022281038Smrg		if  test "x$GCC" = xyes ; then
213122281038Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
213222281038Smrg		fi
213322281038Smrg		AC_SUBST(CWARNFLAGS)
213422281038Smrg	]
213522281038Smrg)
213622281038Smrg]) # XORG_CWARNFLAGS
2137c6a6acfbSmrg
213822281038Smrg# XORG_STRICT_OPTION
213922281038Smrg# -----------------------
214022281038Smrg# Minimum version: 1.3.0
2141bc77032bSmrg#
214222281038Smrg# Add configure option to enable strict compilation flags, such as treating
214322281038Smrg# warnings as fatal errors.
214422281038Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
214522281038Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2146bc77032bSmrg#
214722281038Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
214822281038Smrg# when strict compilation is unconditionally desired.
214922281038SmrgAC_DEFUN([XORG_STRICT_OPTION], [
215022281038SmrgAC_REQUIRE([XORG_CWARNFLAGS])
215122281038SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
215222281038Smrg
215322281038SmrgAC_ARG_ENABLE(strict-compilation,
215422281038Smrg			  AS_HELP_STRING([--enable-strict-compilation],
215522281038Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
215622281038Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
215722281038Smrg
215822281038SmrgAC_LANG_CASE(
215922281038Smrg        [C], [
216022281038Smrg                define([PREFIX], [C])
216122281038Smrg        ],
216222281038Smrg        [C++], [
216322281038Smrg                define([PREFIX], [CXX])
216422281038Smrg        ]
216522281038Smrg)
216622281038Smrg
216722281038Smrg[STRICT_]PREFIX[FLAGS]=""
216822281038SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
216922281038SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
217022281038Smrg
217122281038Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
217222281038Smrg# activate it with -Werror, so we add it here explicitly.
217322281038SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
217422281038Smrg
217522281038Smrgif test "x$STRICT_COMPILE" = "xyes"; then
217622281038Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
217722281038Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
217822281038Smrgfi
217922281038SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
218022281038SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
218122281038SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
218222281038Smrg]) # XORG_STRICT_OPTION
218322281038Smrg
218422281038Smrg# XORG_DEFAULT_OPTIONS
218522281038Smrg# --------------------
218622281038Smrg# Minimum version: 1.3.0
2187bc77032bSmrg#
218822281038Smrg# Defines default options for X.Org modules.
218922281038Smrg#
219022281038SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
219122281038SmrgAC_REQUIRE([AC_PROG_INSTALL])
219222281038SmrgXORG_COMPILER_FLAGS
219322281038SmrgXORG_CWARNFLAGS
219422281038SmrgXORG_STRICT_OPTION
219522281038SmrgXORG_RELEASE_VERSION
219622281038SmrgXORG_CHANGELOG
219722281038SmrgXORG_INSTALL
219822281038SmrgXORG_MANPAGE_SECTIONS
219922281038Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
220022281038Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
220122281038Smrg]) # XORG_DEFAULT_OPTIONS
220238c51623Smrg
220322281038Smrg# XORG_INSTALL()
2204bc77032bSmrg# ----------------
220522281038Smrg# Minimum version: 1.4.0
2206bc77032bSmrg#
220722281038Smrg# Defines the variable INSTALL_CMD as the command to copy
220822281038Smrg# INSTALL from $prefix/share/util-macros.
2209bc77032bSmrg#
221022281038SmrgAC_DEFUN([XORG_INSTALL], [
221122281038SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
221222281038Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
221322281038SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
221422281038Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
221522281038Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
221622281038Smrgtouch \$(top_srcdir)/INSTALL; \
221722281038Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
221822281038SmrgAC_SUBST([INSTALL_CMD])
221922281038Smrg]) # XORG_INSTALL
222022281038Smrgdnl Copyright 2005 Red Hat, Inc
222122281038Smrgdnl
222222281038Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
222322281038Smrgdnl documentation for any purpose is hereby granted without fee, provided that
222422281038Smrgdnl the above copyright notice appear in all copies and that both that
222522281038Smrgdnl copyright notice and this permission notice appear in supporting
222622281038Smrgdnl documentation.
222722281038Smrgdnl
222822281038Smrgdnl The above copyright notice and this permission notice shall be included
222922281038Smrgdnl in all copies or substantial portions of the Software.
223022281038Smrgdnl
223122281038Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
223222281038Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
223322281038Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
223422281038Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
223522281038Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
223622281038Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
223722281038Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
223822281038Smrgdnl
223922281038Smrgdnl Except as contained in this notice, the name of the copyright holders shall
224022281038Smrgdnl not be used in advertising or otherwise to promote the sale, use or
224122281038Smrgdnl other dealings in this Software without prior written authorization
224222281038Smrgdnl from the copyright holders.
224322281038Smrgdnl
224422281038Smrg
224522281038Smrg# XORG_RELEASE_VERSION
224622281038Smrg# --------------------
224722281038Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
224822281038Smrg
224922281038SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
225022281038Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
225122281038Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
225222281038Smrg		[Major version of this package])
225322281038Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
225422281038Smrg	if test "x$PVM" = "x"; then
225522281038Smrg		PVM="0"
225622281038Smrg	fi
225722281038Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
225822281038Smrg		[$PVM],
225922281038Smrg		[Minor version of this package])
226022281038Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
226122281038Smrg	if test "x$PVP" = "x"; then
226222281038Smrg		PVP="0"
226322281038Smrg	fi
226422281038Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
226522281038Smrg		[$PVP],
226622281038Smrg		[Patch version of this package])
226722281038Smrg])
226838c51623Smrg
226922281038Smrg# XORG_CHANGELOG()
227022281038Smrg# ----------------
227122281038Smrg# Minimum version: 1.2.0
2272c6a6acfbSmrg#
227322281038Smrg# Defines the variable CHANGELOG_CMD as the command to generate
227422281038Smrg# ChangeLog from git.
2275bc77032bSmrg#
2276bc77032bSmrg#
227722281038SmrgAC_DEFUN([XORG_CHANGELOG], [
227822281038SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
227922281038Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
228022281038Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
228122281038Smrgtouch \$(top_srcdir)/ChangeLog; \
228222281038Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
228322281038SmrgAC_SUBST([CHANGELOG_CMD])
228422281038Smrg]) # XORG_CHANGELOG
228522281038Smrg
228622281038Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2287bc77032bSmrg#
228822281038Smrg# This file is free software; the Free Software Foundation
228922281038Smrg# gives unlimited permission to copy and/or distribute it,
229022281038Smrg# with or without modifications, as long as this notice is preserved.
229138c51623Smrg
229222281038Smrg# AM_AUTOMAKE_VERSION(VERSION)
229322281038Smrg# ----------------------------
229422281038Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
229522281038Smrg# generated from the m4 files accompanying Automake X.Y.
229622281038Smrg# (This private macro should not be called outside this file.)
229722281038SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
229822281038Smrg[am__api_version='1.16'
229922281038Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
230022281038Smrgdnl require some minimum version.  Point them to the right macro.
230122281038Smrgm4_if([$1], [1.16.5], [],
230222281038Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
230322281038Smrg])
230422281038Smrg
230522281038Smrg# _AM_AUTOCONF_VERSION(VERSION)
230622281038Smrg# -----------------------------
230722281038Smrg# aclocal traces this macro to find the Autoconf version.
230822281038Smrg# This is a private macro too.  Using m4_define simplifies
230922281038Smrg# the logic in aclocal, which can simply ignore this definition.
231022281038Smrgm4_define([_AM_AUTOCONF_VERSION], [])
231122281038Smrg
231222281038Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
231322281038Smrg# -------------------------------
231422281038Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
231522281038Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
231622281038SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
231722281038Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
231822281038Smrgm4_ifndef([AC_AUTOCONF_VERSION],
231922281038Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
232022281038Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
232122281038Smrg
232222281038Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
232322281038Smrg
232422281038Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2325bc77032bSmrg#
232622281038Smrg# This file is free software; the Free Software Foundation
232722281038Smrg# gives unlimited permission to copy and/or distribute it,
232822281038Smrg# with or without modifications, as long as this notice is preserved.
232922281038Smrg
233022281038Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
233122281038Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
233222281038Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2333bc77032bSmrg#
233422281038Smrg# Of course, Automake must honor this variable whenever it calls a
233522281038Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
233622281038Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
233722281038Smrg# depending on how configure is run.  This is pretty annoying, since
233822281038Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
233922281038Smrg# source directory, any form will work fine, but in subdirectories a
234022281038Smrg# relative path needs to be adjusted first.
2341bc77032bSmrg#
234222281038Smrg# $ac_aux_dir/missing
234322281038Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
234422281038Smrg# $top_srcdir/$ac_aux_dir/missing
234522281038Smrg#    fails if $ac_aux_dir is absolute,
234622281038Smrg#    fails when called from a subdirectory in a VPATH build with
234722281038Smrg#          a relative $ac_aux_dir
2348bc77032bSmrg#
234922281038Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
235022281038Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
235122281038Smrg# harmless because $srcdir is '.', but things will broke when you
235222281038Smrg# start a VPATH build or use an absolute $srcdir.
2353bc77032bSmrg#
235422281038Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
235522281038Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
235622281038Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
235722281038Smrg# and then we would define $MISSING as
235822281038Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
235922281038Smrg# This will work as long as MISSING is not called from configure, because
236022281038Smrg# unfortunately $(top_srcdir) has no meaning in configure.
236122281038Smrg# However there are other variables, like CC, which are often used in
236222281038Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2363bc77032bSmrg#
236422281038Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
236522281038Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
236622281038Smrg# configured tree to be moved without reconfiguration.
236722281038Smrg
236822281038SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
236922281038Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
237022281038Smrg# Expand $ac_aux_dir to an absolute path.
237122281038Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
237222281038Smrg])
237322281038Smrg
237422281038Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
237522281038Smrg
237622281038Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
2377bc77032bSmrg#
237822281038Smrg# This file is free software; the Free Software Foundation
237922281038Smrg# gives unlimited permission to copy and/or distribute it,
238022281038Smrg# with or without modifications, as long as this notice is preserved.
238122281038Smrg
238222281038Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
238322281038Smrg# -------------------------------------
238422281038Smrg# Define a conditional.
238522281038SmrgAC_DEFUN([AM_CONDITIONAL],
238622281038Smrg[AC_PREREQ([2.52])dnl
238722281038Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
238822281038Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
238922281038SmrgAC_SUBST([$1_TRUE])dnl
239022281038SmrgAC_SUBST([$1_FALSE])dnl
239122281038Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
239222281038Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
239322281038Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
239422281038Smrgif $2; then
239522281038Smrg  $1_TRUE=
239622281038Smrg  $1_FALSE='#'
239722281038Smrgelse
239822281038Smrg  $1_TRUE='#'
239922281038Smrg  $1_FALSE=
240022281038Smrgfi
240122281038SmrgAC_CONFIG_COMMANDS_PRE(
240222281038Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
240322281038Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
240422281038SmrgUsually this means the macro was only invoked conditionally.]])
240522281038Smrgfi])])
240622281038Smrg
240722281038Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2408f931275dSmrg#
240922281038Smrg# This file is free software; the Free Software Foundation
241022281038Smrg# gives unlimited permission to copy and/or distribute it,
241122281038Smrg# with or without modifications, as long as this notice is preserved.
241222281038Smrg
241322281038Smrg
241422281038Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
241522281038Smrg# written in clear, in which case automake, when reading aclocal.m4,
241622281038Smrg# will think it sees a *use*, and therefore will trigger all it's
241722281038Smrg# C support machinery.  Also note that it means that autoscan, seeing
241822281038Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
241922281038Smrg
242022281038Smrg
242122281038Smrg# _AM_DEPENDENCIES(NAME)
242222281038Smrg# ----------------------
242322281038Smrg# See how the compiler implements dependency checking.
242422281038Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
242522281038Smrg# We try a few techniques and use that to set a single cache variable.
2426bc77032bSmrg#
242722281038Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
242822281038Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
242922281038Smrg# dependency, and given that the user is not expected to run this macro,
243022281038Smrg# just rely on AC_PROG_CC.
243122281038SmrgAC_DEFUN([_AM_DEPENDENCIES],
243222281038Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
243322281038SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
243422281038SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
243522281038SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
243622281038Smrg
243722281038Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
243822281038Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
243922281038Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
244022281038Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
244122281038Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
244222281038Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
244322281038Smrg                    [depcc="$$1"   am_compiler_list=])
244422281038Smrg
244522281038SmrgAC_CACHE_CHECK([dependency style of $depcc],
244622281038Smrg               [am_cv_$1_dependencies_compiler_type],
244722281038Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
244822281038Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
244922281038Smrg  # making bogus files that we don't know about and never remove.  For
245022281038Smrg  # instance it was reported that on HP-UX the gcc test will end up
245122281038Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
245222281038Smrg  # in D".
245322281038Smrg  rm -rf conftest.dir
245422281038Smrg  mkdir conftest.dir
245522281038Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
245622281038Smrg  # using a relative directory.
245722281038Smrg  cp "$am_depcomp" conftest.dir
245822281038Smrg  cd conftest.dir
245922281038Smrg  # We will build objects and dependencies in a subdirectory because
246022281038Smrg  # it helps to detect inapplicable dependency modes.  For instance
246122281038Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
246222281038Smrg  # side effect of compilation, but ICC will put the dependencies in
246322281038Smrg  # the current directory while Tru64 will put them in the object
246422281038Smrg  # directory.
246522281038Smrg  mkdir sub
2466f931275dSmrg
246722281038Smrg  am_cv_$1_dependencies_compiler_type=none
246822281038Smrg  if test "$am_compiler_list" = ""; then
246922281038Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2470f931275dSmrg  fi
247122281038Smrg  am__universal=false
247222281038Smrg  m4_case([$1], [CC],
247322281038Smrg    [case " $depcc " in #(
247422281038Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
247522281038Smrg     esac],
247622281038Smrg    [CXX],
247722281038Smrg    [case " $depcc " in #(
247822281038Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
247922281038Smrg     esac])
2480f931275dSmrg
248122281038Smrg  for depmode in $am_compiler_list; do
248222281038Smrg    # Setup a source with many dependencies, because some compilers
248322281038Smrg    # like to wrap large dependency lists on column 80 (with \), and
248422281038Smrg    # we should not choose a depcomp mode which is confused by this.
248522281038Smrg    #
248622281038Smrg    # We need to recreate these files for each test, as the compiler may
248722281038Smrg    # overwrite some of them when testing with obscure command lines.
248822281038Smrg    # This happens at least with the AIX C compiler.
248922281038Smrg    : > sub/conftest.c
249022281038Smrg    for i in 1 2 3 4 5 6; do
249122281038Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
249222281038Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
249322281038Smrg      # Solaris 10 /bin/sh.
249422281038Smrg      echo '/* dummy */' > sub/conftst$i.h
249522281038Smrg    done
249622281038Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2497f931275dSmrg
249822281038Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
249922281038Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
250022281038Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
250122281038Smrg    # versions had trouble with output in subdirs.
250222281038Smrg    am__obj=sub/conftest.${OBJEXT-o}
250322281038Smrg    am__minus_obj="-o $am__obj"
250422281038Smrg    case $depmode in
250522281038Smrg    gcc)
250622281038Smrg      # This depmode causes a compiler race in universal mode.
250722281038Smrg      test "$am__universal" = false || continue
250822281038Smrg      ;;
250922281038Smrg    nosideeffect)
251022281038Smrg      # After this tag, mechanisms are not by side-effect, so they'll
251122281038Smrg      # only be used when explicitly requested.
251222281038Smrg      if test "x$enable_dependency_tracking" = xyes; then
251322281038Smrg	continue
251422281038Smrg      else
251522281038Smrg	break
251622281038Smrg      fi
251722281038Smrg      ;;
251822281038Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
251922281038Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
252022281038Smrg      # not run yet.  These depmodes are late enough in the game, and
252122281038Smrg      # so weak that their functioning should not be impacted.
252222281038Smrg      am__obj=conftest.${OBJEXT-o}
252322281038Smrg      am__minus_obj=
252422281038Smrg      ;;
252522281038Smrg    none) break ;;
252622281038Smrg    esac
252722281038Smrg    if depmode=$depmode \
252822281038Smrg       source=sub/conftest.c object=$am__obj \
252922281038Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
253022281038Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
253122281038Smrg         >/dev/null 2>conftest.err &&
253222281038Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
253322281038Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
253422281038Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
253522281038Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
253622281038Smrg      # icc doesn't choke on unknown options, it will just issue warnings
253722281038Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
253822281038Smrg      # that says an option was ignored or not supported.
253922281038Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
254022281038Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
254122281038Smrg      # The diagnosis changed in icc 8.0:
254222281038Smrg      #   icc: Command line remark: option '-MP' not supported
254322281038Smrg      if (grep 'ignoring option' conftest.err ||
254422281038Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
254522281038Smrg        am_cv_$1_dependencies_compiler_type=$depmode
254622281038Smrg        break
254722281038Smrg      fi
254822281038Smrg    fi
254922281038Smrg  done
2550f931275dSmrg
255122281038Smrg  cd ..
255222281038Smrg  rm -rf conftest.dir
255322281038Smrgelse
255422281038Smrg  am_cv_$1_dependencies_compiler_type=none
2555bc77032bSmrgfi
255622281038Smrg])
255722281038SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
255822281038SmrgAM_CONDITIONAL([am__fastdep$1], [
255922281038Smrg  test "x$enable_dependency_tracking" != xno \
256022281038Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
256122281038Smrg])
2562f931275dSmrg
2563f931275dSmrg
256422281038Smrg# AM_SET_DEPDIR
256522281038Smrg# -------------
256622281038Smrg# Choose a directory name for dependency files.
256722281038Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
256822281038SmrgAC_DEFUN([AM_SET_DEPDIR],
256922281038Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
257022281038SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
257122281038Smrg])
2572f931275dSmrg
257322281038Smrg
257422281038Smrg# AM_DEP_TRACK
257522281038Smrg# ------------
257622281038SmrgAC_DEFUN([AM_DEP_TRACK],
257722281038Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
257822281038SmrgAS_HELP_STRING(
257922281038Smrg  [--enable-dependency-tracking],
258022281038Smrg  [do not reject slow dependency extractors])
258122281038SmrgAS_HELP_STRING(
258222281038Smrg  [--disable-dependency-tracking],
258322281038Smrg  [speeds up one-time build])])
258422281038Smrgif test "x$enable_dependency_tracking" != xno; then
258522281038Smrg  am_depcomp="$ac_aux_dir/depcomp"
258622281038Smrg  AMDEPBACKSLASH='\'
258722281038Smrg  am__nodep='_no'
2588bc77032bSmrgfi
258922281038SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
259022281038SmrgAC_SUBST([AMDEPBACKSLASH])dnl
259122281038Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
259222281038SmrgAC_SUBST([am__nodep])dnl
259322281038Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
259422281038Smrg])
2595f931275dSmrg
259622281038Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
259722281038Smrg
259822281038Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
2599bc77032bSmrg#
260022281038Smrg# This file is free software; the Free Software Foundation
260122281038Smrg# gives unlimited permission to copy and/or distribute it,
260222281038Smrg# with or without modifications, as long as this notice is preserved.
260322281038Smrg
260422281038Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
260522281038Smrg# ------------------------------
260622281038SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
260722281038Smrg[{
260822281038Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
260922281038Smrg  # are listed without --file.  Let's play safe and only enable the eval
261022281038Smrg  # if we detect the quoting.
261122281038Smrg  # TODO: see whether this extra hack can be removed once we start
261222281038Smrg  # requiring Autoconf 2.70 or later.
261322281038Smrg  AS_CASE([$CONFIG_FILES],
261422281038Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
261522281038Smrg          [*], [set x $CONFIG_FILES])
261622281038Smrg  shift
261722281038Smrg  # Used to flag and report bootstrapping failures.
261822281038Smrg  am_rc=0
261922281038Smrg  for am_mf
262022281038Smrg  do
262122281038Smrg    # Strip MF so we end up with the name of the file.
262222281038Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
262322281038Smrg    # Check whether this is an Automake generated Makefile which includes
262422281038Smrg    # dependency-tracking related rules and includes.
262522281038Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
262622281038Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
262722281038Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
262822281038Smrg      || continue
262922281038Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
263022281038Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
263122281038Smrg    AM_RUN_LOG([cd "$am_dirpart" \
263222281038Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
263322281038Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
263422281038Smrg  done
263522281038Smrg  if test $am_rc -ne 0; then
263622281038Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
263722281038Smrg    for automatic dependency tracking.  If GNU make was not used, consider
263822281038Smrg    re-running the configure script with MAKE="gmake" (or whatever is
263922281038Smrg    necessary).  You can also try re-running configure with the
264022281038Smrg    '--disable-dependency-tracking' option to at least be able to build
264122281038Smrg    the package (albeit without support for automatic dependency tracking).])
264222281038Smrg  fi
264322281038Smrg  AS_UNSET([am_dirpart])
264422281038Smrg  AS_UNSET([am_filepart])
264522281038Smrg  AS_UNSET([am_mf])
264622281038Smrg  AS_UNSET([am_rc])
264722281038Smrg  rm -f conftest-deps.mk
264822281038Smrg}
264922281038Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
265022281038Smrg
265122281038Smrg
265222281038Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
265322281038Smrg# -----------------------------
265422281038Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2655bc77032bSmrg#
265622281038Smrg# This code is only required when automatic dependency tracking is enabled.
265722281038Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
265822281038Smrg# order to bootstrap the dependency handling code.
265922281038SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
266022281038Smrg[AC_CONFIG_COMMANDS([depfiles],
266122281038Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
266222281038Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
266322281038Smrg
266422281038Smrg# Do all the work for Automake.                             -*- Autoconf -*-
266522281038Smrg
266622281038Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
2667bc77032bSmrg#
266822281038Smrg# This file is free software; the Free Software Foundation
266922281038Smrg# gives unlimited permission to copy and/or distribute it,
267022281038Smrg# with or without modifications, as long as this notice is preserved.
2671f931275dSmrg
267222281038Smrg# This macro actually does too much.  Some checks are only needed if
267322281038Smrg# your package does certain things.  But this isn't really a big deal.
2674f931275dSmrg
267522281038Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
267622281038Smrgm4_define([AC_PROG_CC],
267722281038Smrgm4_defn([AC_PROG_CC])
267822281038Smrg[_AM_PROG_CC_C_O
267922281038Smrg])
268089d09728Smrg
268122281038Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
268222281038Smrg# AM_INIT_AUTOMAKE([OPTIONS])
268322281038Smrg# -----------------------------------------------
268422281038Smrg# The call with PACKAGE and VERSION arguments is the old style
268522281038Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
268622281038Smrg# and VERSION should now be passed to AC_INIT and removed from
268722281038Smrg# the call to AM_INIT_AUTOMAKE.
268822281038Smrg# We support both call styles for the transition.  After
268922281038Smrg# the next Automake release, Autoconf can make the AC_INIT
269022281038Smrg# arguments mandatory, and then we can depend on a new Autoconf
269122281038Smrg# release and drop the old call support.
269222281038SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
269322281038Smrg[AC_PREREQ([2.65])dnl
269422281038Smrgm4_ifdef([_$0_ALREADY_INIT],
269522281038Smrg  [m4_fatal([$0 expanded multiple times
269622281038Smrg]m4_defn([_$0_ALREADY_INIT]))],
269722281038Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
269822281038Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
269922281038Smrgdnl the ones we care about.
270022281038Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
270122281038SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
270222281038SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
270322281038Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
270422281038Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
270522281038Smrg  # is not polluted with repeated "-I."
270622281038Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
270722281038Smrg  # test to see if srcdir already configured
270822281038Smrg  if test -f $srcdir/config.status; then
270922281038Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
271022281038Smrg  fi
2711a9274bcdSmrgfi
2712a9274bcdSmrg
271322281038Smrg# test whether we have cygpath
271422281038Smrgif test -z "$CYGPATH_W"; then
271522281038Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
271622281038Smrg    CYGPATH_W='cygpath -w'
271722281038Smrg  else
271822281038Smrg    CYGPATH_W=echo
271922281038Smrg  fi
272022281038Smrgfi
272122281038SmrgAC_SUBST([CYGPATH_W])
272238c51623Smrg
272322281038Smrg# Define the identity of the package.
272422281038Smrgdnl Distinguish between old-style and new-style calls.
272522281038Smrgm4_ifval([$2],
272622281038Smrg[AC_DIAGNOSE([obsolete],
272722281038Smrg             [$0: two- and three-arguments forms are deprecated.])
272822281038Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
272922281038Smrg AC_SUBST([PACKAGE], [$1])dnl
273022281038Smrg AC_SUBST([VERSION], [$2])],
273122281038Smrg[_AM_SET_OPTIONS([$1])dnl
273222281038Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
273322281038Smrgm4_if(
273422281038Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
273522281038Smrg  [ok:ok],,
273622281038Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
273722281038Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
273822281038Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
273966fe65f6Smrg
274022281038Smrg_AM_IF_OPTION([no-define],,
274122281038Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
274222281038Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
274322281038Smrg
274422281038Smrg# Some tools Automake needs.
274522281038SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
274622281038SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
274722281038SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
274822281038SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
274922281038SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
275022281038SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
275122281038SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
275222281038SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
275322281038SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
275422281038SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
275522281038Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
275622281038Smrg# dies out for good.  For more background, see:
275722281038Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
275822281038Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
275922281038SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
276022281038Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
276122281038Smrg# system "awk" is bad on some platforms.
276222281038SmrgAC_REQUIRE([AC_PROG_AWK])dnl
276322281038SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
276422281038SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
276522281038Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
276622281038Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
276722281038Smrg			     [_AM_PROG_TAR([v7])])])
276822281038Smrg_AM_IF_OPTION([no-dependencies],,
276922281038Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
277022281038Smrg		  [_AM_DEPENDENCIES([CC])],
277122281038Smrg		  [m4_define([AC_PROG_CC],
277222281038Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
277322281038SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
277422281038Smrg		  [_AM_DEPENDENCIES([CXX])],
277522281038Smrg		  [m4_define([AC_PROG_CXX],
277622281038Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
277722281038SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
277822281038Smrg		  [_AM_DEPENDENCIES([OBJC])],
277922281038Smrg		  [m4_define([AC_PROG_OBJC],
278022281038Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
278122281038SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
278222281038Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
278322281038Smrg		  [m4_define([AC_PROG_OBJCXX],
278422281038Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
278522281038Smrg])
278622281038Smrg# Variables for tags utilities; see am/tags.am
278722281038Smrgif test -z "$CTAGS"; then
278822281038Smrg  CTAGS=ctags
278938c51623Smrgfi
279022281038SmrgAC_SUBST([CTAGS])
279122281038Smrgif test -z "$ETAGS"; then
279222281038Smrg  ETAGS=etags
279322281038Smrgfi
279422281038SmrgAC_SUBST([ETAGS])
279522281038Smrgif test -z "$CSCOPE"; then
279622281038Smrg  CSCOPE=cscope
2797a9274bcdSmrgfi
279822281038SmrgAC_SUBST([CSCOPE])
279966fe65f6Smrg
280022281038SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
280122281038Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
280222281038Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
280322281038Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
280422281038SmrgAC_CONFIG_COMMANDS_PRE(dnl
280522281038Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
280622281038Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2807a9274bcdSmrg
280822281038Smrg# POSIX will say in a future version that running "rm -f" with no argument
280922281038Smrg# is OK; and we want to be able to make that assumption in our Makefile
281022281038Smrg# recipes.  So use an aggressive probe to check that the usage we want is
281122281038Smrg# actually supported "in the wild" to an acceptable degree.
281222281038Smrg# See automake bug#10828.
281322281038Smrg# To make any issue more visible, cause the running configure to be aborted
281422281038Smrg# by default if the 'rm' program in use doesn't match our expectations; the
281522281038Smrg# user can still override this though.
281622281038Smrgif rm -f && rm -fr && rm -rf; then : OK; else
281722281038Smrg  cat >&2 <<'END'
281822281038SmrgOops!
2819c6a6acfbSmrg
282022281038SmrgYour 'rm' program seems unable to run without file operands specified
282122281038Smrgon the command line, even when the '-f' option is present.  This is contrary
282222281038Smrgto the behaviour of most rm programs out there, and not conforming with
282322281038Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2824f931275dSmrg
282522281038SmrgPlease tell bug-automake@gnu.org about your system, including the value
282622281038Smrgof your $PATH and any error possibly output before this message.  This
282722281038Smrgcan help us improve future automake versions.
2828bc77032bSmrg
282922281038SmrgEND
283022281038Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
283122281038Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
283222281038Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
283322281038Smrg    echo >&2
283422281038Smrg  else
283522281038Smrg    cat >&2 <<'END'
283622281038SmrgAborting the configuration process, to ensure you take notice of the issue.
2837f931275dSmrg
283822281038SmrgYou can download and install GNU coreutils to get an 'rm' implementation
283922281038Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
2840f931275dSmrg
284122281038SmrgIf you want to complete the configuration process using your problematic
284222281038Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
284322281038Smrgto "yes", and re-run configure.
2844f931275dSmrg
284522281038SmrgEND
284622281038Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
284722281038Smrg  fi
284822281038Smrgfi
284922281038Smrgdnl The trailing newline in this macro's definition is deliberate, for
285022281038Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
285122281038Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
285222281038Smrg])
2853f931275dSmrg
285422281038Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
285522281038Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
285622281038Smrgdnl mangled by Autoconf and run in a shell conditional statement.
285722281038Smrgm4_define([_AC_COMPILER_EXEEXT],
285822281038Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2859f931275dSmrg
286022281038Smrg# When config.status generates a header, we must update the stamp-h file.
286122281038Smrg# This file resides in the same directory as the config header
286222281038Smrg# that is generated.  The stamp files are numbered to have different names.
2863bc77032bSmrg
286422281038Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
286522281038Smrg# loop where config.status creates the headers, so we can generate
286622281038Smrg# our stamp files there.
286722281038SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
286822281038Smrg[# Compute $1's index in $config_headers.
286922281038Smrg_am_arg=$1
287022281038Smrg_am_stamp_count=1
287122281038Smrgfor _am_header in $config_headers :; do
287222281038Smrg  case $_am_header in
287322281038Smrg    $_am_arg | $_am_arg:* )
287422281038Smrg      break ;;
287522281038Smrg    * )
287622281038Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
287722281038Smrg  esac
287822281038Smrgdone
287922281038Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2880f931275dSmrg
288122281038Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
288222281038Smrg#
288322281038Smrg# This file is free software; the Free Software Foundation
288422281038Smrg# gives unlimited permission to copy and/or distribute it,
288522281038Smrg# with or without modifications, as long as this notice is preserved.
288638c51623Smrg
288722281038Smrg# AM_PROG_INSTALL_SH
288822281038Smrg# ------------------
288922281038Smrg# Define $install_sh.
289022281038SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
289122281038Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
289222281038Smrgif test x"${install_sh+set}" != xset; then
289322281038Smrg  case $am_aux_dir in
289422281038Smrg  *\ * | *\	*)
289522281038Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
289622281038Smrg  *)
289722281038Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
289822281038Smrg  esac
289922281038Smrgfi
290022281038SmrgAC_SUBST([install_sh])])
290138c51623Smrg
290222281038Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
2903bc77032bSmrg#
290422281038Smrg# This file is free software; the Free Software Foundation
290522281038Smrg# gives unlimited permission to copy and/or distribute it,
290622281038Smrg# with or without modifications, as long as this notice is preserved.
2907f931275dSmrg
290822281038Smrg# Check whether the underlying file-system supports filenames
290922281038Smrg# with a leading dot.  For instance MS-DOS doesn't.
291022281038SmrgAC_DEFUN([AM_SET_LEADING_DOT],
291122281038Smrg[rm -rf .tst 2>/dev/null
291222281038Smrgmkdir .tst 2>/dev/null
291322281038Smrgif test -d .tst; then
291422281038Smrg  am__leading_dot=.
291522281038Smrgelse
291622281038Smrg  am__leading_dot=_
291722281038Smrgfi
291822281038Smrgrmdir .tst 2>/dev/null
291922281038SmrgAC_SUBST([am__leading_dot])])
292022281038Smrg
292122281038Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
292222281038Smrg
292322281038Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
2924bc77032bSmrg#
292522281038Smrg# This file is free software; the Free Software Foundation
292622281038Smrg# gives unlimited permission to copy and/or distribute it,
292722281038Smrg# with or without modifications, as long as this notice is preserved.
2928f931275dSmrg
292922281038Smrg# AM_MAKE_INCLUDE()
293022281038Smrg# -----------------
293122281038Smrg# Check whether make has an 'include' directive that can support all
293222281038Smrg# the idioms we need for our automatic dependency tracking code.
293322281038SmrgAC_DEFUN([AM_MAKE_INCLUDE],
293422281038Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
293522281038Smrgcat > confinc.mk << 'END'
293622281038Smrgam__doit:
293722281038Smrg	@echo this is the am__doit target >confinc.out
293822281038Smrg.PHONY: am__doit
293922281038SmrgEND
294022281038Smrgam__include="#"
294122281038Smrgam__quote=
294222281038Smrg# BSD make does it like this.
294322281038Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
294422281038Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
294522281038Smrgecho 'include confinc.mk # ignored' > confmf.GNU
294622281038Smrg_am_result=no
294722281038Smrgfor s in GNU BSD; do
294822281038Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
294922281038Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
295022281038Smrg      ['0:this is the am__doit target'],
295122281038Smrg      [AS_CASE([$s],
295222281038Smrg          [BSD], [am__include='.include' am__quote='"'],
295322281038Smrg          [am__include='include' am__quote=''])])
295422281038Smrg  if test "$am__include" != "#"; then
295522281038Smrg    _am_result="yes ($s style)"
295622281038Smrg    break
295722281038Smrg  fi
295822281038Smrgdone
295922281038Smrgrm -f confinc.* confmf.*
296022281038SmrgAC_MSG_RESULT([${_am_result}])
296122281038SmrgAC_SUBST([am__include])])
296222281038SmrgAC_SUBST([am__quote])])
2963f931275dSmrg
296422281038Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2965bc77032bSmrg
296622281038Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
296722281038Smrg#
296822281038Smrg# This file is free software; the Free Software Foundation
296922281038Smrg# gives unlimited permission to copy and/or distribute it,
297022281038Smrg# with or without modifications, as long as this notice is preserved.
2971bc77032bSmrg
297222281038Smrg# AM_MISSING_PROG(NAME, PROGRAM)
297322281038Smrg# ------------------------------
297422281038SmrgAC_DEFUN([AM_MISSING_PROG],
297522281038Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
297622281038Smrg$1=${$1-"${am_missing_run}$2"}
297722281038SmrgAC_SUBST($1)])
2978bc77032bSmrg
297922281038Smrg# AM_MISSING_HAS_RUN
298022281038Smrg# ------------------
298122281038Smrg# Define MISSING if not defined so far and test if it is modern enough.
298222281038Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
298322281038SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
298422281038Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
298522281038SmrgAC_REQUIRE_AUX_FILE([missing])dnl
298622281038Smrgif test x"${MISSING+set}" != xset; then
298722281038Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
298822281038Smrgfi
298922281038Smrg# Use eval to expand $SHELL
299022281038Smrgif eval "$MISSING --is-lightweight"; then
299122281038Smrg  am_missing_run="$MISSING "
299222281038Smrgelse
299322281038Smrg  am_missing_run=
299422281038Smrg  AC_MSG_WARN(['missing' script is too old or missing])
2995bc77032bSmrgfi
299622281038Smrg])
2997bc77032bSmrg
299822281038Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2999bc77032bSmrg
300022281038Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
300122281038Smrg#
300222281038Smrg# This file is free software; the Free Software Foundation
300322281038Smrg# gives unlimited permission to copy and/or distribute it,
300422281038Smrg# with or without modifications, as long as this notice is preserved.
3005bc77032bSmrg
300622281038Smrg# _AM_MANGLE_OPTION(NAME)
300722281038Smrg# -----------------------
300822281038SmrgAC_DEFUN([_AM_MANGLE_OPTION],
300922281038Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3010bc77032bSmrg
301122281038Smrg# _AM_SET_OPTION(NAME)
301222281038Smrg# --------------------
301322281038Smrg# Set option NAME.  Presently that only means defining a flag for this option.
301422281038SmrgAC_DEFUN([_AM_SET_OPTION],
301522281038Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
3016bc77032bSmrg
301722281038Smrg# _AM_SET_OPTIONS(OPTIONS)
301822281038Smrg# ------------------------
301922281038Smrg# OPTIONS is a space-separated list of Automake options.
302022281038SmrgAC_DEFUN([_AM_SET_OPTIONS],
302122281038Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3022bc77032bSmrg
302322281038Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
302422281038Smrg# -------------------------------------------
302522281038Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
302622281038SmrgAC_DEFUN([_AM_IF_OPTION],
302722281038Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3028c6a6acfbSmrg
302922281038Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3030bc77032bSmrg#
303122281038Smrg# This file is free software; the Free Software Foundation
303222281038Smrg# gives unlimited permission to copy and/or distribute it,
303322281038Smrg# with or without modifications, as long as this notice is preserved.
3034bc77032bSmrg
303522281038Smrg# _AM_PROG_CC_C_O
303622281038Smrg# ---------------
303722281038Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
303822281038Smrg# to automatically call this.
303922281038SmrgAC_DEFUN([_AM_PROG_CC_C_O],
304022281038Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
304122281038SmrgAC_REQUIRE_AUX_FILE([compile])dnl
304222281038SmrgAC_LANG_PUSH([C])dnl
304322281038SmrgAC_CACHE_CHECK(
304422281038Smrg  [whether $CC understands -c and -o together],
304522281038Smrg  [am_cv_prog_cc_c_o],
304622281038Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
304722281038Smrg  # Make sure it works both with $CC and with simple cc.
304822281038Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
304922281038Smrg  # compilers refuse to overwrite an existing .o file with -o,
305022281038Smrg  # though they will create one.
305122281038Smrg  am_cv_prog_cc_c_o=yes
305222281038Smrg  for am_i in 1 2; do
305322281038Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
305422281038Smrg         && test -f conftest2.$ac_objext; then
305522281038Smrg      : OK
305622281038Smrg    else
305722281038Smrg      am_cv_prog_cc_c_o=no
305822281038Smrg      break
305922281038Smrg    fi
306022281038Smrg  done
306122281038Smrg  rm -f core conftest*
306222281038Smrg  unset am_i])
306322281038Smrgif test "$am_cv_prog_cc_c_o" != yes; then
306422281038Smrg   # Losing compiler, so override with the script.
306522281038Smrg   # FIXME: It is wrong to rewrite CC.
306622281038Smrg   # But if we don't then we get into trouble of one sort or another.
306722281038Smrg   # A longer-term fix would be to have automake use am__CC in this case,
306822281038Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
306922281038Smrg   CC="$am_aux_dir/compile $CC"
307038c51623Smrgfi
307122281038SmrgAC_LANG_POP([C])])
307238c51623Smrg
307322281038Smrg# For backward compatibility.
307422281038SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
307522281038Smrg
307622281038Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
307722281038Smrg#
307822281038Smrg# This file is free software; the Free Software Foundation
307922281038Smrg# gives unlimited permission to copy and/or distribute it,
308022281038Smrg# with or without modifications, as long as this notice is preserved.
308122281038Smrg
308222281038Smrg# AM_RUN_LOG(COMMAND)
308322281038Smrg# -------------------
308422281038Smrg# Run COMMAND, save the exit status in ac_status, and log it.
308522281038Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
308622281038SmrgAC_DEFUN([AM_RUN_LOG],
308722281038Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
308822281038Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
308922281038Smrg   ac_status=$?
309022281038Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
309122281038Smrg   (exit $ac_status); }])
309238c51623Smrg
309322281038Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3094a9274bcdSmrg
309522281038Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
309622281038Smrg#
309722281038Smrg# This file is free software; the Free Software Foundation
309822281038Smrg# gives unlimited permission to copy and/or distribute it,
309922281038Smrg# with or without modifications, as long as this notice is preserved.
3100f931275dSmrg
310122281038Smrg# AM_SANITY_CHECK
310222281038Smrg# ---------------
310322281038SmrgAC_DEFUN([AM_SANITY_CHECK],
310422281038Smrg[AC_MSG_CHECKING([whether build environment is sane])
310522281038Smrg# Reject unsafe characters in $srcdir or the absolute working directory
310622281038Smrg# name.  Accept space and tab only in the latter.
310722281038Smrgam_lf='
310822281038Smrg'
310922281038Smrgcase `pwd` in
311022281038Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
311122281038Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
311222281038Smrgesac
311322281038Smrgcase $srcdir in
311422281038Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
311522281038Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
311622281038Smrgesac
3117c6a6acfbSmrg
311822281038Smrg# Do 'set' in a subshell so we don't clobber the current shell's
311922281038Smrg# arguments.  Must try -L first in case configure is actually a
312022281038Smrg# symlink; some systems play weird games with the mod time of symlinks
312122281038Smrg# (eg FreeBSD returns the mod time of the symlink's containing
312222281038Smrg# directory).
312322281038Smrgif (
312422281038Smrg   am_has_slept=no
312522281038Smrg   for am_try in 1 2; do
312622281038Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
312722281038Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
312822281038Smrg     if test "$[*]" = "X"; then
312922281038Smrg	# -L didn't work.
313022281038Smrg	set X `ls -t "$srcdir/configure" conftest.file`
313122281038Smrg     fi
313222281038Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
313322281038Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3134f931275dSmrg
313522281038Smrg	# If neither matched, then we have a broken ls.  This can happen
313622281038Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
313722281038Smrg	# broken ls alias from the environment.  This has actually
313822281038Smrg	# happened.  Such a system could not be considered "sane".
313922281038Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
314022281038Smrg  alias in your environment])
314122281038Smrg     fi
314222281038Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
314322281038Smrg       break
314422281038Smrg     fi
314522281038Smrg     # Just in case.
314622281038Smrg     sleep 1
314722281038Smrg     am_has_slept=yes
314822281038Smrg   done
314922281038Smrg   test "$[2]" = conftest.file
315022281038Smrg   )
315122281038Smrgthen
315222281038Smrg   # Ok.
315322281038Smrg   :
3154bc77032bSmrgelse
315522281038Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
315622281038SmrgCheck your system clock])
3157bc77032bSmrgfi
315822281038SmrgAC_MSG_RESULT([yes])
315922281038Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
316022281038Smrg# generated files are strictly newer.
316122281038Smrgam_sleep_pid=
316222281038Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
316322281038Smrg  ( sleep 1 ) &
316422281038Smrg  am_sleep_pid=$!
316522281038Smrgfi
316622281038SmrgAC_CONFIG_COMMANDS_PRE(
316722281038Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
316822281038Smrg   if test -n "$am_sleep_pid"; then
316922281038Smrg     # Hide warnings about reused PIDs.
317022281038Smrg     wait $am_sleep_pid 2>/dev/null
317122281038Smrg   fi
317222281038Smrg   AC_MSG_RESULT([done])])
317322281038Smrgrm -f conftest.file
317422281038Smrg])
3175f931275dSmrg
317622281038Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
317748af84faSmrg#
317822281038Smrg# This file is free software; the Free Software Foundation
317922281038Smrg# gives unlimited permission to copy and/or distribute it,
318022281038Smrg# with or without modifications, as long as this notice is preserved.
3181c6a6acfbSmrg
318222281038Smrg# AM_SILENT_RULES([DEFAULT])
318322281038Smrg# --------------------------
318422281038Smrg# Enable less verbose build rules; with the default set to DEFAULT
318522281038Smrg# ("yes" being less verbose, "no" or empty being verbose).
318622281038SmrgAC_DEFUN([AM_SILENT_RULES],
318722281038Smrg[AC_ARG_ENABLE([silent-rules], [dnl
318822281038SmrgAS_HELP_STRING(
318922281038Smrg  [--enable-silent-rules],
319022281038Smrg  [less verbose build output (undo: "make V=1")])
319122281038SmrgAS_HELP_STRING(
319222281038Smrg  [--disable-silent-rules],
319322281038Smrg  [verbose build output (undo: "make V=0")])dnl
319422281038Smrg])
319522281038Smrgcase $enable_silent_rules in @%:@ (((
319622281038Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
319722281038Smrg   no) AM_DEFAULT_VERBOSITY=1;;
319822281038Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
319922281038Smrgesac
320022281038Smrgdnl
320122281038Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
320222281038Smrgdnl do not support nested variable expansions.
320322281038Smrgdnl See automake bug#9928 and bug#10237.
320422281038Smrgam_make=${MAKE-make}
320522281038SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
320622281038Smrg   [am_cv_make_support_nested_variables],
320722281038Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
320822281038SmrgBAR0=false
320922281038SmrgBAR1=true
321022281038SmrgV=1
321122281038Smrgam__doit:
321222281038Smrg	@$(TRUE)
321322281038Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
321422281038Smrg  am_cv_make_support_nested_variables=yes
321522281038Smrgelse
321622281038Smrg  am_cv_make_support_nested_variables=no
321722281038Smrgfi])
321822281038Smrgif test $am_cv_make_support_nested_variables = yes; then
321922281038Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
322022281038Smrg  AM_V='$(V)'
322122281038Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
322222281038Smrgelse
322322281038Smrg  AM_V=$AM_DEFAULT_VERBOSITY
322422281038Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
322522281038Smrgfi
322622281038SmrgAC_SUBST([AM_V])dnl
322722281038SmrgAM_SUBST_NOTMAKE([AM_V])dnl
322822281038SmrgAC_SUBST([AM_DEFAULT_V])dnl
322922281038SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
323022281038SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
323122281038SmrgAM_BACKSLASH='\'
323222281038SmrgAC_SUBST([AM_BACKSLASH])dnl
323322281038Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
323422281038Smrg])
323522281038Smrg
323622281038Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
3237bc77032bSmrg#
323822281038Smrg# This file is free software; the Free Software Foundation
323922281038Smrg# gives unlimited permission to copy and/or distribute it,
324022281038Smrg# with or without modifications, as long as this notice is preserved.
3241a9274bcdSmrg
324222281038Smrg# AM_PROG_INSTALL_STRIP
324322281038Smrg# ---------------------
324422281038Smrg# One issue with vendor 'install' (even GNU) is that you can't
324522281038Smrg# specify the program used to strip binaries.  This is especially
324622281038Smrg# annoying in cross-compiling environments, where the build's strip
324722281038Smrg# is unlikely to handle the host's binaries.
324822281038Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
324922281038Smrg# always use install-sh in "make install-strip", and initialize
325022281038Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
325122281038SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
325222281038Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
325322281038Smrg# Installed binaries are usually stripped using 'strip' when the user
325422281038Smrg# run "make install-strip".  However 'strip' might not be the right
325522281038Smrg# tool to use in cross-compilation environments, therefore Automake
325622281038Smrg# will honor the 'STRIP' environment variable to overrule this program.
325722281038Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
325822281038Smrgif test "$cross_compiling" != no; then
325922281038Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
326022281038Smrgfi
326122281038SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
326222281038SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
326338c51623Smrg
326422281038Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
326522281038Smrg#
326622281038Smrg# This file is free software; the Free Software Foundation
326722281038Smrg# gives unlimited permission to copy and/or distribute it,
326822281038Smrg# with or without modifications, as long as this notice is preserved.
326938c51623Smrg
327022281038Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
327122281038Smrg# ---------------------------
327222281038Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
327322281038Smrg# This macro is traced by Automake.
327422281038SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
327538c51623Smrg
327622281038Smrg# AM_SUBST_NOTMAKE(VARIABLE)
327722281038Smrg# --------------------------
327822281038Smrg# Public sister of _AM_SUBST_NOTMAKE.
327922281038SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
328038c51623Smrg
328122281038Smrg# Check how to create a tarball.                            -*- Autoconf -*-
328238c51623Smrg
328322281038Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
3284c12babebSmrg#
328522281038Smrg# This file is free software; the Free Software Foundation
328622281038Smrg# gives unlimited permission to copy and/or distribute it,
328722281038Smrg# with or without modifications, as long as this notice is preserved.
3288c12babebSmrg
328922281038Smrg# _AM_PROG_TAR(FORMAT)
3290bc77032bSmrg# --------------------
329122281038Smrg# Check how to create a tarball in format FORMAT.
329222281038Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3293bc77032bSmrg#
329422281038Smrg# Substitute a variable $(am__tar) that is a command
329522281038Smrg# writing to stdout a FORMAT-tarball containing the directory
329622281038Smrg# $tardir.
329722281038Smrg#     tardir=directory && $(am__tar) > result.tar
3298bc77032bSmrg#
329922281038Smrg# Substitute a variable $(am__untar) that extract such
330022281038Smrg# a tarball read from stdin.
330122281038Smrg#     $(am__untar) < result.tar
3302bc77032bSmrg#
330322281038SmrgAC_DEFUN([_AM_PROG_TAR],
330422281038Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
330522281038Smrg# in the wild :-(  We should find a proper way to deprecate it ...
330622281038SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
330738c51623Smrg
330822281038Smrg# We'll loop over all known methods to create a tar archive until one works.
330922281038Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
331038c51623Smrg
331122281038Smrgm4_if([$1], [v7],
331222281038Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
331338c51623Smrg
331422281038Smrg  [m4_case([$1],
331522281038Smrg    [ustar],
331622281038Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
331722281038Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
331822281038Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
331922281038Smrg      # and bug#13588).
332022281038Smrg      am_max_uid=2097151 # 2^21 - 1
332122281038Smrg      am_max_gid=$am_max_uid
332222281038Smrg      # The $UID and $GID variables are not portable, so we need to resort
332322281038Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
332422281038Smrg      # below are definitely unexpected, so allow the users to see them
332522281038Smrg      # (that is, avoid stderr redirection).
332622281038Smrg      am_uid=`id -u || echo unknown`
332722281038Smrg      am_gid=`id -g || echo unknown`
332822281038Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
332922281038Smrg      if test $am_uid -le $am_max_uid; then
333022281038Smrg         AC_MSG_RESULT([yes])
333122281038Smrg      else
333222281038Smrg         AC_MSG_RESULT([no])
333322281038Smrg         _am_tools=none
333422281038Smrg      fi
333522281038Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
333622281038Smrg      if test $am_gid -le $am_max_gid; then
333722281038Smrg         AC_MSG_RESULT([yes])
333822281038Smrg      else
333922281038Smrg        AC_MSG_RESULT([no])
334022281038Smrg        _am_tools=none
334122281038Smrg      fi],
334222281038Smrg
334322281038Smrg  [pax],
334422281038Smrg    [],
334522281038Smrg
334622281038Smrg  [m4_fatal([Unknown tar format])])
334722281038Smrg
334822281038Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
334922281038Smrg
335022281038Smrg  # Go ahead even if we have the value already cached.  We do so because we
335122281038Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
335222281038Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
335322281038Smrg
335422281038Smrg  for _am_tool in $_am_tools; do
335522281038Smrg    case $_am_tool in
335622281038Smrg    gnutar)
335722281038Smrg      for _am_tar in tar gnutar gtar; do
335822281038Smrg        AM_RUN_LOG([$_am_tar --version]) && break
335922281038Smrg      done
336022281038Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
336122281038Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
336222281038Smrg      am__untar="$_am_tar -xf -"
336322281038Smrg      ;;
336422281038Smrg    plaintar)
336522281038Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
336622281038Smrg      # ustar tarball either.
336722281038Smrg      (tar --version) >/dev/null 2>&1 && continue
336822281038Smrg      am__tar='tar chf - "$$tardir"'
336922281038Smrg      am__tar_='tar chf - "$tardir"'
337022281038Smrg      am__untar='tar xf -'
337122281038Smrg      ;;
337222281038Smrg    pax)
337322281038Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
337422281038Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
337522281038Smrg      am__untar='pax -r'
337622281038Smrg      ;;
337722281038Smrg    cpio)
337822281038Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
337922281038Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
338022281038Smrg      am__untar='cpio -i -H $1 -d'
338122281038Smrg      ;;
338222281038Smrg    none)
338322281038Smrg      am__tar=false
338422281038Smrg      am__tar_=false
338522281038Smrg      am__untar=false
338622281038Smrg      ;;
338722281038Smrg    esac
338822281038Smrg
338922281038Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
339022281038Smrg    # and am__untar set.
339122281038Smrg    test -n "${am_cv_prog_tar_$1}" && break
339222281038Smrg
339322281038Smrg    # tar/untar a dummy directory, and stop if the command works.
339422281038Smrg    rm -rf conftest.dir
339522281038Smrg    mkdir conftest.dir
339622281038Smrg    echo GrepMe > conftest.dir/file
339722281038Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
339822281038Smrg    rm -rf conftest.dir
339922281038Smrg    if test -s conftest.tar; then
340022281038Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
340122281038Smrg      AM_RUN_LOG([cat conftest.dir/file])
340222281038Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
340322281038Smrg    fi
340422281038Smrg  done
340522281038Smrg  rm -rf conftest.dir
340622281038Smrg
340722281038Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
340822281038Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
340922281038Smrg
341022281038SmrgAC_SUBST([am__tar])
341122281038SmrgAC_SUBST([am__untar])
341222281038Smrg]) # _AM_PROG_TAR
341366fe65f6Smrg
3414