aclocal.m4 revision 17ca54c3
117ca54c3Smrg# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
217ca54c3Smrg
317ca54c3Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
417ca54c3Smrg
517ca54c3Smrg# This file is free software; the Free Software Foundation
617ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
717ca54c3Smrg# with or without modifications, as long as this notice is preserved.
817ca54c3Smrg
917ca54c3Smrg# This program is distributed in the hope that it will be useful,
1017ca54c3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1117ca54c3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1217ca54c3Smrg# PARTICULAR PURPOSE.
1317ca54c3Smrg
1417ca54c3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1517ca54c3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1617ca54c3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1717ca54c3Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1817ca54c3Smrg[m4_warning([this file was generated for autoconf 2.69.
1917ca54c3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2017ca54c3SmrgIf you have problems, you may need to regenerate the build system entirely.
2117ca54c3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2217ca54c3Smrg
2317ca54c3Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
2417ca54c3Smrg# serial 11 (pkg-config-0.29.1)
2517ca54c3Smrg
2617ca54c3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2717ca54c3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2817ca54c3Smrgdnl
2917ca54c3Smrgdnl This program is free software; you can redistribute it and/or modify
3017ca54c3Smrgdnl it under the terms of the GNU General Public License as published by
3117ca54c3Smrgdnl the Free Software Foundation; either version 2 of the License, or
3217ca54c3Smrgdnl (at your option) any later version.
3317ca54c3Smrgdnl
3417ca54c3Smrgdnl This program is distributed in the hope that it will be useful, but
3517ca54c3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
3617ca54c3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3717ca54c3Smrgdnl General Public License for more details.
3817ca54c3Smrgdnl
3917ca54c3Smrgdnl You should have received a copy of the GNU General Public License
4017ca54c3Smrgdnl along with this program; if not, write to the Free Software
4117ca54c3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4217ca54c3Smrgdnl 02111-1307, USA.
4317ca54c3Smrgdnl
4417ca54c3Smrgdnl As a special exception to the GNU General Public License, if you
4517ca54c3Smrgdnl distribute this file as part of a program that contains a
4617ca54c3Smrgdnl configuration script generated by Autoconf, you may include it under
4717ca54c3Smrgdnl the same distribution terms that you use for the rest of that
4817ca54c3Smrgdnl program.
4917ca54c3Smrg
5017ca54c3Smrgdnl PKG_PREREQ(MIN-VERSION)
5117ca54c3Smrgdnl -----------------------
5217ca54c3Smrgdnl Since: 0.29
5317ca54c3Smrgdnl
5417ca54c3Smrgdnl Verify that the version of the pkg-config macros are at least
5517ca54c3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
5617ca54c3Smrgdnl installed version of pkg-config, this checks the developer's version
5717ca54c3Smrgdnl of pkg.m4 when generating configure.
5817ca54c3Smrgdnl
5917ca54c3Smrgdnl To ensure that this macro is defined, also add:
6017ca54c3Smrgdnl m4_ifndef([PKG_PREREQ],
6117ca54c3Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
6217ca54c3Smrgdnl
6317ca54c3Smrgdnl See the "Since" comment for each macro you use to see what version
6417ca54c3Smrgdnl of the macros you require.
6517ca54c3Smrgm4_defun([PKG_PREREQ],
6617ca54c3Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
6717ca54c3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6817ca54c3Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6917ca54c3Smrg])dnl PKG_PREREQ
7017ca54c3Smrg
7117ca54c3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
7217ca54c3Smrgdnl ----------------------------------
7317ca54c3Smrgdnl Since: 0.16
7417ca54c3Smrgdnl
7517ca54c3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
7617ca54c3Smrgdnl first found in the path. Checks that the version of pkg-config found
7717ca54c3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
7817ca54c3Smrgdnl used since that's the first version where most current features of
7917ca54c3Smrgdnl pkg-config existed.
8017ca54c3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
8117ca54c3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8217ca54c3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
8317ca54c3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
8417ca54c3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
8517ca54c3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
8617ca54c3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
8717ca54c3Smrg
8817ca54c3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
8917ca54c3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
9017ca54c3Smrgfi
9117ca54c3Smrgif test -n "$PKG_CONFIG"; then
9217ca54c3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
9317ca54c3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
9417ca54c3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
9517ca54c3Smrg		AC_MSG_RESULT([yes])
9617ca54c3Smrg	else
9717ca54c3Smrg		AC_MSG_RESULT([no])
9817ca54c3Smrg		PKG_CONFIG=""
9917ca54c3Smrg	fi
10017ca54c3Smrgfi[]dnl
10117ca54c3Smrg])dnl PKG_PROG_PKG_CONFIG
10217ca54c3Smrg
10317ca54c3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10417ca54c3Smrgdnl -------------------------------------------------------------------
10517ca54c3Smrgdnl Since: 0.18
10617ca54c3Smrgdnl
10717ca54c3Smrgdnl Check to see whether a particular set of modules exists. Similar to
10817ca54c3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
10917ca54c3Smrgdnl
11017ca54c3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11117ca54c3Smrgdnl only at the first occurence in configure.ac, so if the first place
11217ca54c3Smrgdnl it's called might be skipped (such as if it is within an "if", you
11317ca54c3Smrgdnl have to call PKG_CHECK_EXISTS manually
11417ca54c3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
11517ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11617ca54c3Smrgif test -n "$PKG_CONFIG" && \
11717ca54c3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
11817ca54c3Smrg  m4_default([$2], [:])
11917ca54c3Smrgm4_ifvaln([$3], [else
12017ca54c3Smrg  $3])dnl
12117ca54c3Smrgfi])
12217ca54c3Smrg
12317ca54c3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12417ca54c3Smrgdnl ---------------------------------------------
12517ca54c3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12617ca54c3Smrgdnl pkg_failed based on the result.
12717ca54c3Smrgm4_define([_PKG_CONFIG],
12817ca54c3Smrg[if test -n "$$1"; then
12917ca54c3Smrg    pkg_cv_[]$1="$$1"
13017ca54c3Smrg elif test -n "$PKG_CONFIG"; then
13117ca54c3Smrg    PKG_CHECK_EXISTS([$3],
13217ca54c3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
13317ca54c3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
13417ca54c3Smrg		     [pkg_failed=yes])
13517ca54c3Smrg else
13617ca54c3Smrg    pkg_failed=untried
13717ca54c3Smrgfi[]dnl
13817ca54c3Smrg])dnl _PKG_CONFIG
13917ca54c3Smrg
14017ca54c3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14117ca54c3Smrgdnl ---------------------------
14217ca54c3Smrgdnl Internal check to see if pkg-config supports short errors.
14317ca54c3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14417ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14517ca54c3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14617ca54c3Smrg        _pkg_short_errors_supported=yes
14717ca54c3Smrgelse
14817ca54c3Smrg        _pkg_short_errors_supported=no
14917ca54c3Smrgfi[]dnl
15017ca54c3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
15117ca54c3Smrg
15217ca54c3Smrg
15317ca54c3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15417ca54c3Smrgdnl   [ACTION-IF-NOT-FOUND])
15517ca54c3Smrgdnl --------------------------------------------------------------
15617ca54c3Smrgdnl Since: 0.4.0
15717ca54c3Smrgdnl
15817ca54c3Smrgdnl Note that if there is a possibility the first call to
15917ca54c3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
16017ca54c3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
16117ca54c3SmrgAC_DEFUN([PKG_CHECK_MODULES],
16217ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
16317ca54c3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
16417ca54c3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
16517ca54c3Smrg
16617ca54c3Smrgpkg_failed=no
16717ca54c3SmrgAC_MSG_CHECKING([for $1])
16817ca54c3Smrg
16917ca54c3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
17017ca54c3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
17117ca54c3Smrg
17217ca54c3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
17317ca54c3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
17417ca54c3SmrgSee the pkg-config man page for more details.])
17517ca54c3Smrg
17617ca54c3Smrgif test $pkg_failed = yes; then
17717ca54c3Smrg   	AC_MSG_RESULT([no])
17817ca54c3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
17917ca54c3Smrg        if test $_pkg_short_errors_supported = yes; then
18017ca54c3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
18117ca54c3Smrg        else 
18217ca54c3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
18317ca54c3Smrg        fi
18417ca54c3Smrg	# Put the nasty error message in config.log where it belongs
18517ca54c3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
18617ca54c3Smrg
18717ca54c3Smrg	m4_default([$4], [AC_MSG_ERROR(
18817ca54c3Smrg[Package requirements ($2) were not met:
18917ca54c3Smrg
19017ca54c3Smrg$$1_PKG_ERRORS
19117ca54c3Smrg
19217ca54c3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
19317ca54c3Smrginstalled software in a non-standard prefix.
19417ca54c3Smrg
19517ca54c3Smrg_PKG_TEXT])[]dnl
19617ca54c3Smrg        ])
19717ca54c3Smrgelif test $pkg_failed = untried; then
19817ca54c3Smrg     	AC_MSG_RESULT([no])
19917ca54c3Smrg	m4_default([$4], [AC_MSG_FAILURE(
20017ca54c3Smrg[The pkg-config script could not be found or is too old.  Make sure it
20117ca54c3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
20217ca54c3Smrgpath to pkg-config.
20317ca54c3Smrg
20417ca54c3Smrg_PKG_TEXT
20517ca54c3Smrg
20617ca54c3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
20717ca54c3Smrg        ])
20817ca54c3Smrgelse
20917ca54c3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
21017ca54c3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
21117ca54c3Smrg        AC_MSG_RESULT([yes])
21217ca54c3Smrg	$3
21317ca54c3Smrgfi[]dnl
21417ca54c3Smrg])dnl PKG_CHECK_MODULES
21517ca54c3Smrg
21617ca54c3Smrg
21717ca54c3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
21817ca54c3Smrgdnl   [ACTION-IF-NOT-FOUND])
21917ca54c3Smrgdnl ---------------------------------------------------------------------
22017ca54c3Smrgdnl Since: 0.29
22117ca54c3Smrgdnl
22217ca54c3Smrgdnl Checks for existence of MODULES and gathers its build flags with
22317ca54c3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
22417ca54c3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
22517ca54c3Smrgdnl
22617ca54c3Smrgdnl Note that if there is a possibility the first call to
22717ca54c3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
22817ca54c3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
22917ca54c3Smrgdnl configure.ac.
23017ca54c3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
23117ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
23217ca54c3Smrg_save_PKG_CONFIG=$PKG_CONFIG
23317ca54c3SmrgPKG_CONFIG="$PKG_CONFIG --static"
23417ca54c3SmrgPKG_CHECK_MODULES($@)
23517ca54c3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
23617ca54c3Smrg])dnl PKG_CHECK_MODULES_STATIC
23717ca54c3Smrg
23817ca54c3Smrg
23917ca54c3Smrgdnl PKG_INSTALLDIR([DIRECTORY])
24017ca54c3Smrgdnl -------------------------
24117ca54c3Smrgdnl Since: 0.27
24217ca54c3Smrgdnl
24317ca54c3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
24417ca54c3Smrgdnl should install pkg-config .pc files. By default the directory is
24517ca54c3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
24617ca54c3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
24717ca54c3Smrgdnl parameter.
24817ca54c3SmrgAC_DEFUN([PKG_INSTALLDIR],
24917ca54c3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
25017ca54c3Smrgm4_pushdef([pkg_description],
25117ca54c3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
25217ca54c3SmrgAC_ARG_WITH([pkgconfigdir],
25317ca54c3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
25417ca54c3Smrg    [with_pkgconfigdir=]pkg_default)
25517ca54c3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
25617ca54c3Smrgm4_popdef([pkg_default])
25717ca54c3Smrgm4_popdef([pkg_description])
25817ca54c3Smrg])dnl PKG_INSTALLDIR
25917ca54c3Smrg
26017ca54c3Smrg
26117ca54c3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
26217ca54c3Smrgdnl --------------------------------
26317ca54c3Smrgdnl Since: 0.27
26417ca54c3Smrgdnl
26517ca54c3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
26617ca54c3Smrgdnl module should install arch-independent pkg-config .pc files. By
26717ca54c3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
26817ca54c3Smrgdnl changed by passing DIRECTORY. The user can override through the
26917ca54c3Smrgdnl --with-noarch-pkgconfigdir parameter.
27017ca54c3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
27117ca54c3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
27217ca54c3Smrgm4_pushdef([pkg_description],
27317ca54c3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
27417ca54c3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
27517ca54c3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
27617ca54c3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
27717ca54c3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
27817ca54c3Smrgm4_popdef([pkg_default])
27917ca54c3Smrgm4_popdef([pkg_description])
28017ca54c3Smrg])dnl PKG_NOARCH_INSTALLDIR
28117ca54c3Smrg
28217ca54c3Smrg
28317ca54c3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
28417ca54c3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
28517ca54c3Smrgdnl -------------------------------------------
28617ca54c3Smrgdnl Since: 0.28
28717ca54c3Smrgdnl
28817ca54c3Smrgdnl Retrieves the value of the pkg-config variable for the given module.
28917ca54c3SmrgAC_DEFUN([PKG_CHECK_VAR],
29017ca54c3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
29117ca54c3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
29217ca54c3Smrg
29317ca54c3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
29417ca54c3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
29517ca54c3Smrg
29617ca54c3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
29717ca54c3Smrg])dnl PKG_CHECK_VAR
29817ca54c3Smrg
29917ca54c3Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
30017ca54c3Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
30117ca54c3Smrgdnl   [DESCRIPTION], [DEFAULT])
30217ca54c3Smrgdnl ------------------------------------------
30317ca54c3Smrgdnl
30417ca54c3Smrgdnl Prepare a "--with-" configure option using the lowercase
30517ca54c3Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
30617ca54c3Smrgdnl PKG_CHECK_MODULES in a single macro.
30717ca54c3SmrgAC_DEFUN([PKG_WITH_MODULES],
30817ca54c3Smrg[
30917ca54c3Smrgm4_pushdef([with_arg], m4_tolower([$1]))
31017ca54c3Smrg
31117ca54c3Smrgm4_pushdef([description],
31217ca54c3Smrg           [m4_default([$5], [build with ]with_arg[ support])])
31317ca54c3Smrg
31417ca54c3Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
31517ca54c3Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
31617ca54c3Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
31717ca54c3Smrg
31817ca54c3Smrgm4_case(def_arg,
31917ca54c3Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
32017ca54c3Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
32117ca54c3Smrg
32217ca54c3SmrgAC_ARG_WITH(with_arg,
32317ca54c3Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
32417ca54c3Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
32517ca54c3Smrg
32617ca54c3SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
32717ca54c3Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
32817ca54c3Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
32917ca54c3Smrg                                        [m4_n([def_action_if_found]) $3],
33017ca54c3Smrg                                        [m4_n([def_action_if_not_found]) $4])])
33117ca54c3Smrg
33217ca54c3Smrgm4_popdef([with_arg])
33317ca54c3Smrgm4_popdef([description])
33417ca54c3Smrgm4_popdef([def_arg])
33517ca54c3Smrg
33617ca54c3Smrg])dnl PKG_WITH_MODULES
33717ca54c3Smrg
33817ca54c3Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
33917ca54c3Smrgdnl   [DESCRIPTION], [DEFAULT])
34017ca54c3Smrgdnl -----------------------------------------------
34117ca54c3Smrgdnl
34217ca54c3Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
34317ca54c3Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
34417ca54c3SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
34517ca54c3Smrg[
34617ca54c3SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
34717ca54c3Smrg
34817ca54c3SmrgAM_CONDITIONAL([HAVE_][$1],
34917ca54c3Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
35017ca54c3Smrg])dnl PKG_HAVE_WITH_MODULES
35117ca54c3Smrg
35217ca54c3Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
35317ca54c3Smrgdnl   [DESCRIPTION], [DEFAULT])
35417ca54c3Smrgdnl ------------------------------------------------------
35517ca54c3Smrgdnl
35617ca54c3Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
35717ca54c3Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
35817ca54c3Smrgdnl and preprocessor variable.
35917ca54c3SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
36017ca54c3Smrg[
36117ca54c3SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
36217ca54c3Smrg
36317ca54c3SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
36417ca54c3Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
36517ca54c3Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
36617ca54c3Smrg
36717ca54c3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
36817ca54c3Smrgdnl
36917ca54c3Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
37017ca54c3Smrgdnl
37117ca54c3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
37217ca54c3Smrgdnl copy of this software and associated documentation files (the "Software"),
37317ca54c3Smrgdnl to deal in the Software without restriction, including without limitation
37417ca54c3Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
37517ca54c3Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
37617ca54c3Smrgdnl Software is furnished to do so, subject to the following conditions:
37717ca54c3Smrgdnl
37817ca54c3Smrgdnl The above copyright notice and this permission notice (including the next
37917ca54c3Smrgdnl paragraph) shall be included in all copies or substantial portions of the
38017ca54c3Smrgdnl Software.
38117ca54c3Smrgdnl
38217ca54c3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38317ca54c3Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38417ca54c3Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
38517ca54c3Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38617ca54c3Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
38717ca54c3Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
38817ca54c3Smrgdnl DEALINGS IN THE SOFTWARE.
38917ca54c3Smrg
39017ca54c3Smrg# XORG_MACROS_VERSION(required-version)
39117ca54c3Smrg# -------------------------------------
39217ca54c3Smrg# Minimum version: 1.1.0
39317ca54c3Smrg#
39417ca54c3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
39517ca54c3Smrg# your configure.ac with the minimum required version, such as:
39617ca54c3Smrg# XORG_MACROS_VERSION(1.1)
39717ca54c3Smrg#
39817ca54c3Smrg# To ensure that this macro is defined, also add:
39917ca54c3Smrg# m4_ifndef([XORG_MACROS_VERSION],
40017ca54c3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
40117ca54c3Smrg#
40217ca54c3Smrg#
40317ca54c3Smrg# See the "minimum version" comment for each macro you use to see what
40417ca54c3Smrg# version you require.
40517ca54c3Smrgm4_defun([XORG_MACROS_VERSION],[
40617ca54c3Smrgm4_define([vers_have], [1.19.0])
40717ca54c3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
40817ca54c3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
40917ca54c3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
41017ca54c3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
41117ca54c3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
41217ca54c3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
41317ca54c3Smrgm4_undefine([vers_have])
41417ca54c3Smrgm4_undefine([maj_have])
41517ca54c3Smrgm4_undefine([maj_needed])
41617ca54c3Smrg]) # XORG_MACROS_VERSION
41717ca54c3Smrg
41817ca54c3Smrg# XORG_PROG_RAWCPP()
41917ca54c3Smrg# ------------------
42017ca54c3Smrg# Minimum version: 1.0.0
42117ca54c3Smrg#
42217ca54c3Smrg# Find cpp program and necessary flags for use in pre-processing text files
42317ca54c3Smrg# such as man pages and config files
42417ca54c3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
42517ca54c3SmrgAC_REQUIRE([AC_PROG_CPP])
42617ca54c3SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
42717ca54c3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
42817ca54c3Smrg
42917ca54c3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
43017ca54c3Smrg# which is not the best choice for supporting other OS'es, but covers most
43117ca54c3Smrg# of the ones we need for now.
43217ca54c3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
43317ca54c3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
43417ca54c3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43517ca54c3Smrg	AC_MSG_RESULT([no])
43617ca54c3Smrgelse
43717ca54c3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
43817ca54c3Smrg		RAWCPPFLAGS=-undef
43917ca54c3Smrg		AC_MSG_RESULT([yes])
44017ca54c3Smrg	# under Cygwin unix is still defined even with -undef
44117ca54c3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
44217ca54c3Smrg		RAWCPPFLAGS="-undef -ansi"
44317ca54c3Smrg		AC_MSG_RESULT([yes, with -ansi])
44417ca54c3Smrg	else
44517ca54c3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
44617ca54c3Smrg	fi
44717ca54c3Smrgfi
44817ca54c3Smrgrm -f conftest.$ac_ext
44917ca54c3Smrg
45017ca54c3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
45117ca54c3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
45217ca54c3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45317ca54c3Smrg	AC_MSG_RESULT([no])
45417ca54c3Smrgelse
45517ca54c3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
45617ca54c3Smrg		TRADITIONALCPPFLAGS="-traditional"
45717ca54c3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
45817ca54c3Smrg		AC_MSG_RESULT([yes])
45917ca54c3Smrg	else
46017ca54c3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
46117ca54c3Smrg	fi
46217ca54c3Smrgfi
46317ca54c3Smrgrm -f conftest.$ac_ext
46417ca54c3SmrgAC_SUBST(RAWCPPFLAGS)
46517ca54c3SmrgAC_SUBST(TRADITIONALCPPFLAGS)
46617ca54c3Smrg]) # XORG_PROG_RAWCPP
46717ca54c3Smrg
46817ca54c3Smrg# XORG_MANPAGE_SECTIONS()
46917ca54c3Smrg# -----------------------
47017ca54c3Smrg# Minimum version: 1.0.0
47117ca54c3Smrg#
47217ca54c3Smrg# Determine which sections man pages go in for the different man page types
47317ca54c3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
47417ca54c3Smrg# Not sure if there's any better way than just hardcoding by OS name.
47517ca54c3Smrg# Override default settings by setting environment variables
47617ca54c3Smrg# Added MAN_SUBSTS in version 1.8
47717ca54c3Smrg# Added AC_PROG_SED in version 1.8
47817ca54c3Smrg
47917ca54c3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
48017ca54c3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
48117ca54c3SmrgAC_REQUIRE([AC_PROG_SED])
48217ca54c3Smrg
48317ca54c3Smrgif test x$APP_MAN_SUFFIX = x    ; then
48417ca54c3Smrg    APP_MAN_SUFFIX=1
48517ca54c3Smrgfi
48617ca54c3Smrgif test x$APP_MAN_DIR = x    ; then
48717ca54c3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
48817ca54c3Smrgfi
48917ca54c3Smrg
49017ca54c3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
49117ca54c3Smrg    LIB_MAN_SUFFIX=3
49217ca54c3Smrgfi
49317ca54c3Smrgif test x$LIB_MAN_DIR = x    ; then
49417ca54c3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
49517ca54c3Smrgfi
49617ca54c3Smrg
49717ca54c3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
49817ca54c3Smrg    case $host_os in
49917ca54c3Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
50017ca54c3Smrg	*)		FILE_MAN_SUFFIX=5  ;;
50117ca54c3Smrg    esac
50217ca54c3Smrgfi
50317ca54c3Smrgif test x$FILE_MAN_DIR = x    ; then
50417ca54c3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
50517ca54c3Smrgfi
50617ca54c3Smrg
50717ca54c3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
50817ca54c3Smrg    case $host_os in
50917ca54c3Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
51017ca54c3Smrg	*)		MISC_MAN_SUFFIX=7  ;;
51117ca54c3Smrg    esac
51217ca54c3Smrgfi
51317ca54c3Smrgif test x$MISC_MAN_DIR = x    ; then
51417ca54c3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
51517ca54c3Smrgfi
51617ca54c3Smrg
51717ca54c3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
51817ca54c3Smrg    case $host_os in
51917ca54c3Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
52017ca54c3Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
52117ca54c3Smrg    esac
52217ca54c3Smrgfi
52317ca54c3Smrgif test x$DRIVER_MAN_DIR = x    ; then
52417ca54c3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
52517ca54c3Smrgfi
52617ca54c3Smrg
52717ca54c3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
52817ca54c3Smrg    case $host_os in
52917ca54c3Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
53017ca54c3Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
53117ca54c3Smrg    esac
53217ca54c3Smrgfi
53317ca54c3Smrgif test x$ADMIN_MAN_DIR = x    ; then
53417ca54c3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
53517ca54c3Smrgfi
53617ca54c3Smrg
53717ca54c3Smrg
53817ca54c3SmrgAC_SUBST([APP_MAN_SUFFIX])
53917ca54c3SmrgAC_SUBST([LIB_MAN_SUFFIX])
54017ca54c3SmrgAC_SUBST([FILE_MAN_SUFFIX])
54117ca54c3SmrgAC_SUBST([MISC_MAN_SUFFIX])
54217ca54c3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
54317ca54c3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
54417ca54c3SmrgAC_SUBST([APP_MAN_DIR])
54517ca54c3SmrgAC_SUBST([LIB_MAN_DIR])
54617ca54c3SmrgAC_SUBST([FILE_MAN_DIR])
54717ca54c3SmrgAC_SUBST([MISC_MAN_DIR])
54817ca54c3SmrgAC_SUBST([DRIVER_MAN_DIR])
54917ca54c3SmrgAC_SUBST([ADMIN_MAN_DIR])
55017ca54c3Smrg
55117ca54c3SmrgXORG_MAN_PAGE="X Version 11"
55217ca54c3SmrgAC_SUBST([XORG_MAN_PAGE])
55317ca54c3SmrgMAN_SUBSTS="\
55417ca54c3Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
55517ca54c3Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
55617ca54c3Smrg	-e 's|__xservername__|Xorg|g' \
55717ca54c3Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
55817ca54c3Smrg	-e 's|__projectroot__|\$(prefix)|g' \
55917ca54c3Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
56017ca54c3Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
56117ca54c3Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
56217ca54c3Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
56317ca54c3Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
56417ca54c3Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
56517ca54c3Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
56617ca54c3SmrgAC_SUBST([MAN_SUBSTS])
56717ca54c3Smrg
56817ca54c3Smrg]) # XORG_MANPAGE_SECTIONS
56917ca54c3Smrg
57017ca54c3Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
57117ca54c3Smrg# ------------------------
57217ca54c3Smrg# Minimum version: 1.7.0
57317ca54c3Smrg#
57417ca54c3Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
57517ca54c3Smrg# provided by xorg-sgml-doctools, if installed.
57617ca54c3SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
57717ca54c3SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
57817ca54c3SmrgXORG_SGML_PATH=
57917ca54c3SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
58017ca54c3Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
58117ca54c3Smrg    [m4_ifval([$1],[:],
58217ca54c3Smrg        [if test x"$cross_compiling" != x"yes" ; then
58317ca54c3Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
58417ca54c3Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
58517ca54c3Smrg         fi])
58617ca54c3Smrg    ])
58717ca54c3Smrg
58817ca54c3Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
58917ca54c3Smrg# the path and the name of the doc stylesheet
59017ca54c3Smrgif test "x$XORG_SGML_PATH" != "x" ; then
59117ca54c3Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
59217ca54c3Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
59317ca54c3Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
59417ca54c3Smrgelse
59517ca54c3Smrg   AC_MSG_RESULT([no])
59617ca54c3Smrgfi
59717ca54c3Smrg
59817ca54c3SmrgAC_SUBST(XORG_SGML_PATH)
59917ca54c3SmrgAC_SUBST(STYLESHEET_SRCDIR)
60017ca54c3SmrgAC_SUBST(XSL_STYLESHEET)
60117ca54c3SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
60217ca54c3Smrg]) # XORG_CHECK_SGML_DOCTOOLS
60317ca54c3Smrg
60417ca54c3Smrg# XORG_CHECK_LINUXDOC
60517ca54c3Smrg# -------------------
60617ca54c3Smrg# Minimum version: 1.0.0
60717ca54c3Smrg#
60817ca54c3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
60917ca54c3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
61017ca54c3Smrg# Whether or not the necessary tools and files are found can be checked
61117ca54c3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
61217ca54c3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
61317ca54c3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
61417ca54c3SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
61517ca54c3Smrg
61617ca54c3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
61717ca54c3Smrg
61817ca54c3SmrgAC_MSG_CHECKING([whether to build documentation])
61917ca54c3Smrg
62017ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
62117ca54c3Smrg   BUILDDOC=yes
62217ca54c3Smrgelse
62317ca54c3Smrg   BUILDDOC=no
62417ca54c3Smrgfi
62517ca54c3Smrg
62617ca54c3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
62717ca54c3Smrg
62817ca54c3SmrgAC_MSG_RESULT([$BUILDDOC])
62917ca54c3Smrg
63017ca54c3SmrgAC_MSG_CHECKING([whether to build pdf documentation])
63117ca54c3Smrg
63217ca54c3Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
63317ca54c3Smrg   BUILDPDFDOC=yes
63417ca54c3Smrgelse
63517ca54c3Smrg   BUILDPDFDOC=no
63617ca54c3Smrgfi
63717ca54c3Smrg
63817ca54c3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
63917ca54c3Smrg
64017ca54c3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
64117ca54c3Smrg
64217ca54c3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
64317ca54c3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
64417ca54c3SmrgMAKE_PDF="$PS2PDF"
64517ca54c3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
64617ca54c3Smrg
64717ca54c3SmrgAC_SUBST(MAKE_TEXT)
64817ca54c3SmrgAC_SUBST(MAKE_PS)
64917ca54c3SmrgAC_SUBST(MAKE_PDF)
65017ca54c3SmrgAC_SUBST(MAKE_HTML)
65117ca54c3Smrg]) # XORG_CHECK_LINUXDOC
65217ca54c3Smrg
65317ca54c3Smrg# XORG_CHECK_DOCBOOK
65417ca54c3Smrg# -------------------
65517ca54c3Smrg# Minimum version: 1.0.0
65617ca54c3Smrg#
65717ca54c3Smrg# Checks for the ability to build output formats from SGML DocBook source.
65817ca54c3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
65917ca54c3Smrg# indicates whether the necessary tools and files are found and, if set,
66017ca54c3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
66117ca54c3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
66217ca54c3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
66317ca54c3Smrg
66417ca54c3SmrgBUILDTXTDOC=no
66517ca54c3SmrgBUILDPDFDOC=no
66617ca54c3SmrgBUILDPSDOC=no
66717ca54c3SmrgBUILDHTMLDOC=no
66817ca54c3Smrg
66917ca54c3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
67017ca54c3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
67117ca54c3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
67217ca54c3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
67317ca54c3Smrg
67417ca54c3SmrgAC_MSG_CHECKING([whether to build text documentation])
67517ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
67617ca54c3Smrg   test x$BUILD_TXTDOC != xno; then
67717ca54c3Smrg	BUILDTXTDOC=yes
67817ca54c3Smrgfi
67917ca54c3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
68017ca54c3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
68117ca54c3Smrg
68217ca54c3SmrgAC_MSG_CHECKING([whether to build PDF documentation])
68317ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
68417ca54c3Smrg   test x$BUILD_PDFDOC != xno; then
68517ca54c3Smrg	BUILDPDFDOC=yes
68617ca54c3Smrgfi
68717ca54c3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
68817ca54c3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
68917ca54c3Smrg
69017ca54c3SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
69117ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
69217ca54c3Smrg   test x$BUILD_PSDOC != xno; then
69317ca54c3Smrg	BUILDPSDOC=yes
69417ca54c3Smrgfi
69517ca54c3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
69617ca54c3SmrgAC_MSG_RESULT([$BUILDPSDOC])
69717ca54c3Smrg
69817ca54c3SmrgAC_MSG_CHECKING([whether to build HTML documentation])
69917ca54c3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
70017ca54c3Smrg   test x$BUILD_HTMLDOC != xno; then
70117ca54c3Smrg	BUILDHTMLDOC=yes
70217ca54c3Smrgfi
70317ca54c3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
70417ca54c3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
70517ca54c3Smrg
70617ca54c3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
70717ca54c3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
70817ca54c3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
70917ca54c3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
71017ca54c3Smrg
71117ca54c3SmrgAC_SUBST(MAKE_TEXT)
71217ca54c3SmrgAC_SUBST(MAKE_PS)
71317ca54c3SmrgAC_SUBST(MAKE_PDF)
71417ca54c3SmrgAC_SUBST(MAKE_HTML)
71517ca54c3Smrg]) # XORG_CHECK_DOCBOOK
71617ca54c3Smrg
71717ca54c3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
71817ca54c3Smrg# ----------------
71917ca54c3Smrg# Minimum version: 1.5.0
72017ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
72117ca54c3Smrg#
72217ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
72317ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the
72417ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
72517ca54c3Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
72617ca54c3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
72717ca54c3Smrg# --with-xmlto assumes 'auto'.
72817ca54c3Smrg#
72917ca54c3Smrg# Interface to module:
73017ca54c3Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
73117ca54c3Smrg# XMLTO:	returns the path of the xmlto program found
73217ca54c3Smrg#		returns the path set by the user in the environment
73317ca54c3Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
73417ca54c3Smrg#		'no' user instructs the module not to use xmlto
73517ca54c3Smrg#
73617ca54c3Smrg# Added in version 1.10.0
73717ca54c3Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
73817ca54c3Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
73917ca54c3Smrg#
74017ca54c3Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
74117ca54c3Smrg#
74217ca54c3SmrgAC_DEFUN([XORG_WITH_XMLTO],[
74317ca54c3SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
74417ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
74517ca54c3SmrgAC_ARG_WITH(xmlto,
74617ca54c3Smrg	AS_HELP_STRING([--with-xmlto],
74717ca54c3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
74817ca54c3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
74917ca54c3Smrgm4_undefine([_defopt])
75017ca54c3Smrg
75117ca54c3Smrgif test "x$use_xmlto" = x"auto"; then
75217ca54c3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
75317ca54c3Smrg   if test "x$XMLTO" = "x"; then
75417ca54c3Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
75517ca54c3Smrg	have_xmlto=no
75617ca54c3Smrg   else
75717ca54c3Smrg        have_xmlto=yes
75817ca54c3Smrg   fi
75917ca54c3Smrgelif test "x$use_xmlto" = x"yes" ; then
76017ca54c3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
76117ca54c3Smrg   if test "x$XMLTO" = "x"; then
76217ca54c3Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
76317ca54c3Smrg   fi
76417ca54c3Smrg   have_xmlto=yes
76517ca54c3Smrgelif test "x$use_xmlto" = x"no" ; then
76617ca54c3Smrg   if test "x$XMLTO" != "x"; then
76717ca54c3Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
76817ca54c3Smrg   fi
76917ca54c3Smrg   have_xmlto=no
77017ca54c3Smrgelse
77117ca54c3Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
77217ca54c3Smrgfi
77317ca54c3Smrg
77417ca54c3Smrg# Test for a minimum version of xmlto, if provided.
77517ca54c3Smrgm4_ifval([$1],
77617ca54c3Smrg[if test "$have_xmlto" = yes; then
77717ca54c3Smrg    # scrape the xmlto version
77817ca54c3Smrg    AC_MSG_CHECKING([the xmlto version])
77917ca54c3Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
78017ca54c3Smrg    AC_MSG_RESULT([$xmlto_version])
78117ca54c3Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
78217ca54c3Smrg        [if test "x$use_xmlto" = xauto; then
78317ca54c3Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
78417ca54c3Smrg            have_xmlto=no
78517ca54c3Smrg        else
78617ca54c3Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
78717ca54c3Smrg        fi])
78817ca54c3Smrgfi])
78917ca54c3Smrg
79017ca54c3Smrg# Test for the ability of xmlto to generate a text target
79117ca54c3Smrghave_xmlto_text=no
79217ca54c3Smrgcat > conftest.xml << "EOF"
79317ca54c3SmrgEOF
79417ca54c3SmrgAS_IF([test "$have_xmlto" = yes],
79517ca54c3Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
79617ca54c3Smrg             [have_xmlto_text=yes],
79717ca54c3Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
79817ca54c3Smrgrm -f conftest.xml
79917ca54c3SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
80017ca54c3SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
80117ca54c3Smrg]) # XORG_WITH_XMLTO
80217ca54c3Smrg
80317ca54c3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
80417ca54c3Smrg# --------------------------------------------
80517ca54c3Smrg# Minimum version: 1.12.0
80617ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
80717ca54c3Smrg#
80817ca54c3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
80917ca54c3Smrg# XML-based language used for the transformation of XML documents.
81017ca54c3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
81117ca54c3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
81217ca54c3Smrg# The XSLT processor is often used as a standalone tool for transformations.
81317ca54c3Smrg# It should not be assumed that this tool is used only to work with documnetation.
81417ca54c3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
81517ca54c3Smrg#
81617ca54c3Smrg# Interface to module:
81717ca54c3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
81817ca54c3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
81917ca54c3Smrg#		 returns the path set by the user in the environment
82017ca54c3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
82117ca54c3Smrg#		  'no' user instructs the module not to use xsltproc
82217ca54c3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
82317ca54c3Smrg#
82417ca54c3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
82517ca54c3Smrg#
82617ca54c3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
82717ca54c3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
82817ca54c3Smrg# Preserves the interface, should it be implemented later
82917ca54c3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
83017ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
83117ca54c3SmrgAC_ARG_WITH(xsltproc,
83217ca54c3Smrg	AS_HELP_STRING([--with-xsltproc],
83317ca54c3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
83417ca54c3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
83517ca54c3Smrgm4_undefine([_defopt])
83617ca54c3Smrg
83717ca54c3Smrgif test "x$use_xsltproc" = x"auto"; then
83817ca54c3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
83917ca54c3Smrg   if test "x$XSLTPROC" = "x"; then
84017ca54c3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
84117ca54c3Smrg	have_xsltproc=no
84217ca54c3Smrg   else
84317ca54c3Smrg        have_xsltproc=yes
84417ca54c3Smrg   fi
84517ca54c3Smrgelif test "x$use_xsltproc" = x"yes" ; then
84617ca54c3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
84717ca54c3Smrg   if test "x$XSLTPROC" = "x"; then
84817ca54c3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
84917ca54c3Smrg   fi
85017ca54c3Smrg   have_xsltproc=yes
85117ca54c3Smrgelif test "x$use_xsltproc" = x"no" ; then
85217ca54c3Smrg   if test "x$XSLTPROC" != "x"; then
85317ca54c3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
85417ca54c3Smrg   fi
85517ca54c3Smrg   have_xsltproc=no
85617ca54c3Smrgelse
85717ca54c3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
85817ca54c3Smrgfi
85917ca54c3Smrg
86017ca54c3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
86117ca54c3Smrg]) # XORG_WITH_XSLTPROC
86217ca54c3Smrg
86317ca54c3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
86417ca54c3Smrg# ----------------------------------------
86517ca54c3Smrg# Minimum version: 1.15.0
86617ca54c3Smrg#
86717ca54c3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
86817ca54c3Smrg# scanning arbitrary text files, extracting information from those text files,
86917ca54c3Smrg# and printing reports based on that information.
87017ca54c3Smrg#
87117ca54c3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
87217ca54c3Smrg#
87317ca54c3Smrg# Interface to module:
87417ca54c3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
87517ca54c3Smrg# PERL:	     returns the path of the perl program found
87617ca54c3Smrg#	     returns the path set by the user in the environment
87717ca54c3Smrg# --with-perl: 'yes' user instructs the module to use perl
87817ca54c3Smrg#	       'no' user instructs the module not to use perl
87917ca54c3Smrg# have_perl: returns yes if perl found in PATH or no
88017ca54c3Smrg#
88117ca54c3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
88217ca54c3Smrg#
88317ca54c3SmrgAC_DEFUN([XORG_WITH_PERL],[
88417ca54c3SmrgAC_ARG_VAR([PERL], [Path to perl command])
88517ca54c3Smrg# Preserves the interface, should it be implemented later
88617ca54c3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
88717ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
88817ca54c3SmrgAC_ARG_WITH(perl,
88917ca54c3Smrg	AS_HELP_STRING([--with-perl],
89017ca54c3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
89117ca54c3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
89217ca54c3Smrgm4_undefine([_defopt])
89317ca54c3Smrg
89417ca54c3Smrgif test "x$use_perl" = x"auto"; then
89517ca54c3Smrg   AC_PATH_PROG([PERL], [perl])
89617ca54c3Smrg   if test "x$PERL" = "x"; then
89717ca54c3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
89817ca54c3Smrg	have_perl=no
89917ca54c3Smrg   else
90017ca54c3Smrg        have_perl=yes
90117ca54c3Smrg   fi
90217ca54c3Smrgelif test "x$use_perl" = x"yes" ; then
90317ca54c3Smrg   AC_PATH_PROG([PERL], [perl])
90417ca54c3Smrg   if test "x$PERL" = "x"; then
90517ca54c3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
90617ca54c3Smrg   fi
90717ca54c3Smrg   have_perl=yes
90817ca54c3Smrgelif test "x$use_perl" = x"no" ; then
90917ca54c3Smrg   if test "x$PERL" != "x"; then
91017ca54c3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
91117ca54c3Smrg   fi
91217ca54c3Smrg   have_perl=no
91317ca54c3Smrgelse
91417ca54c3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
91517ca54c3Smrgfi
91617ca54c3Smrg
91717ca54c3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
91817ca54c3Smrg]) # XORG_WITH_PERL
91917ca54c3Smrg
92017ca54c3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
92117ca54c3Smrg# ----------------
92217ca54c3Smrg# Minimum version: 1.5.0
92317ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
92417ca54c3Smrg#
92517ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
92617ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the
92717ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
92817ca54c3Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
92917ca54c3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
93017ca54c3Smrg# --with-asciidoc assumes 'auto'.
93117ca54c3Smrg#
93217ca54c3Smrg# Interface to module:
93317ca54c3Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
93417ca54c3Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
93517ca54c3Smrg#		 returns the path set by the user in the environment
93617ca54c3Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
93717ca54c3Smrg#		  'no' user instructs the module not to use asciidoc
93817ca54c3Smrg#
93917ca54c3Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
94017ca54c3Smrg#
94117ca54c3SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
94217ca54c3SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
94317ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
94417ca54c3SmrgAC_ARG_WITH(asciidoc,
94517ca54c3Smrg	AS_HELP_STRING([--with-asciidoc],
94617ca54c3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
94717ca54c3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
94817ca54c3Smrgm4_undefine([_defopt])
94917ca54c3Smrg
95017ca54c3Smrgif test "x$use_asciidoc" = x"auto"; then
95117ca54c3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
95217ca54c3Smrg   if test "x$ASCIIDOC" = "x"; then
95317ca54c3Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
95417ca54c3Smrg	have_asciidoc=no
95517ca54c3Smrg   else
95617ca54c3Smrg        have_asciidoc=yes
95717ca54c3Smrg   fi
95817ca54c3Smrgelif test "x$use_asciidoc" = x"yes" ; then
95917ca54c3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
96017ca54c3Smrg   if test "x$ASCIIDOC" = "x"; then
96117ca54c3Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
96217ca54c3Smrg   fi
96317ca54c3Smrg   have_asciidoc=yes
96417ca54c3Smrgelif test "x$use_asciidoc" = x"no" ; then
96517ca54c3Smrg   if test "x$ASCIIDOC" != "x"; then
96617ca54c3Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
96717ca54c3Smrg   fi
96817ca54c3Smrg   have_asciidoc=no
96917ca54c3Smrgelse
97017ca54c3Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
97117ca54c3Smrgfi
97217ca54c3Smrgm4_ifval([$1],
97317ca54c3Smrg[if test "$have_asciidoc" = yes; then
97417ca54c3Smrg    # scrape the asciidoc version
97517ca54c3Smrg    AC_MSG_CHECKING([the asciidoc version])
97617ca54c3Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
97717ca54c3Smrg    AC_MSG_RESULT([$asciidoc_version])
97817ca54c3Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
97917ca54c3Smrg        [if test "x$use_asciidoc" = xauto; then
98017ca54c3Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
98117ca54c3Smrg            have_asciidoc=no
98217ca54c3Smrg        else
98317ca54c3Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
98417ca54c3Smrg        fi])
98517ca54c3Smrgfi])
98617ca54c3SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
98717ca54c3Smrg]) # XORG_WITH_ASCIIDOC
98817ca54c3Smrg
98917ca54c3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
99017ca54c3Smrg# -------------------------------------------
99117ca54c3Smrg# Minimum version: 1.5.0
99217ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
99317ca54c3Smrg# Minimum version for optional DOT checking: 1.18.0
99417ca54c3Smrg#
99517ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
99617ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the
99717ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
99817ca54c3Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
99917ca54c3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
100017ca54c3Smrg# --with-doxygen assumes 'auto'.
100117ca54c3Smrg#
100217ca54c3Smrg# Interface to module:
100317ca54c3Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
100417ca54c3Smrg# DOXYGEN:	 returns the path of the doxygen program found
100517ca54c3Smrg#		 returns the path set by the user in the environment
100617ca54c3Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
100717ca54c3Smrg#		  'no' user instructs the module not to use doxygen
100817ca54c3Smrg#
100917ca54c3Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
101017ca54c3Smrg#
101117ca54c3SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
101217ca54c3SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
101317ca54c3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
101417ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
101517ca54c3SmrgAC_ARG_WITH(doxygen,
101617ca54c3Smrg	AS_HELP_STRING([--with-doxygen],
101717ca54c3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
101817ca54c3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
101917ca54c3Smrgm4_undefine([_defopt])
102017ca54c3Smrg
102117ca54c3Smrgif test "x$use_doxygen" = x"auto"; then
102217ca54c3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
102317ca54c3Smrg   if test "x$DOXYGEN" = "x"; then
102417ca54c3Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
102517ca54c3Smrg	have_doxygen=no
102617ca54c3Smrg   else
102717ca54c3Smrg        have_doxygen=yes
102817ca54c3Smrg   fi
102917ca54c3Smrgelif test "x$use_doxygen" = x"yes" ; then
103017ca54c3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
103117ca54c3Smrg   if test "x$DOXYGEN" = "x"; then
103217ca54c3Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
103317ca54c3Smrg   fi
103417ca54c3Smrg   have_doxygen=yes
103517ca54c3Smrgelif test "x$use_doxygen" = x"no" ; then
103617ca54c3Smrg   if test "x$DOXYGEN" != "x"; then
103717ca54c3Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
103817ca54c3Smrg   fi
103917ca54c3Smrg   have_doxygen=no
104017ca54c3Smrgelse
104117ca54c3Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
104217ca54c3Smrgfi
104317ca54c3Smrgm4_ifval([$1],
104417ca54c3Smrg[if test "$have_doxygen" = yes; then
104517ca54c3Smrg    # scrape the doxygen version
104617ca54c3Smrg    AC_MSG_CHECKING([the doxygen version])
104717ca54c3Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
104817ca54c3Smrg    AC_MSG_RESULT([$doxygen_version])
104917ca54c3Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
105017ca54c3Smrg        [if test "x$use_doxygen" = xauto; then
105117ca54c3Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
105217ca54c3Smrg            have_doxygen=no
105317ca54c3Smrg        else
105417ca54c3Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
105517ca54c3Smrg        fi])
105617ca54c3Smrgfi])
105717ca54c3Smrg
105817ca54c3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
105917ca54c3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
106017ca54c3Smrgdnl 	HAVE_DOT = @HAVE_DOT@
106117ca54c3SmrgHAVE_DOT=no
106217ca54c3Smrgif test "x$have_doxygen" = "xyes"; then
106317ca54c3Smrg  AC_PATH_PROG([DOT], [dot])
106417ca54c3Smrg    if test "x$DOT" != "x"; then
106517ca54c3Smrg      HAVE_DOT=yes
106617ca54c3Smrg    fi
106717ca54c3Smrgfi
106817ca54c3Smrg
106917ca54c3SmrgAC_SUBST([HAVE_DOT])
107017ca54c3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
107117ca54c3SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
107217ca54c3Smrg]) # XORG_WITH_DOXYGEN
107317ca54c3Smrg
107417ca54c3Smrg# XORG_WITH_GROFF([DEFAULT])
107517ca54c3Smrg# ----------------
107617ca54c3Smrg# Minimum version: 1.6.0
107717ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
107817ca54c3Smrg#
107917ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
108017ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the
108117ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
108217ca54c3Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
108317ca54c3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
108417ca54c3Smrg# --with-groff assumes 'auto'.
108517ca54c3Smrg#
108617ca54c3Smrg# Interface to module:
108717ca54c3Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
108817ca54c3Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
108917ca54c3Smrg# HAVE_GROFF_MS: the -ms macros package
109017ca54c3Smrg# GROFF:	 returns the path of the groff program found
109117ca54c3Smrg#		 returns the path set by the user in the environment
109217ca54c3Smrg# --with-groff:	 'yes' user instructs the module to use groff
109317ca54c3Smrg#		 'no' user instructs the module not to use groff
109417ca54c3Smrg#
109517ca54c3Smrg# Added in version 1.9.0:
109617ca54c3Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
109717ca54c3Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
109817ca54c3Smrg#		   psselect from the psutils package.
109917ca54c3Smrg#		   the ghostcript package. Refer to the grohtml man pages
110017ca54c3Smrg#
110117ca54c3Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
110217ca54c3Smrg#
110317ca54c3Smrg# OS and distros often splits groff in a basic and full package, the former
110417ca54c3Smrg# having the groff program and the later having devices, fonts and macros
110517ca54c3Smrg# Checking for the groff executable is not enough.
110617ca54c3Smrg#
110717ca54c3Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
110817ca54c3Smrg# unset HAVE_GROFF or GROFF env variables.
110917ca54c3Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
111017ca54c3Smrg#
111117ca54c3SmrgAC_DEFUN([XORG_WITH_GROFF],[
111217ca54c3SmrgAC_ARG_VAR([GROFF], [Path to groff command])
111317ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto]))
111417ca54c3SmrgAC_ARG_WITH(groff,
111517ca54c3Smrg	AS_HELP_STRING([--with-groff],
111617ca54c3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
111717ca54c3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
111817ca54c3Smrgm4_undefine([_defopt])
111917ca54c3Smrg
112017ca54c3Smrgif test "x$use_groff" = x"auto"; then
112117ca54c3Smrg   AC_PATH_PROG([GROFF], [groff])
112217ca54c3Smrg   if test "x$GROFF" = "x"; then
112317ca54c3Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
112417ca54c3Smrg	have_groff=no
112517ca54c3Smrg   else
112617ca54c3Smrg        have_groff=yes
112717ca54c3Smrg   fi
112817ca54c3Smrgelif test "x$use_groff" = x"yes" ; then
112917ca54c3Smrg   AC_PATH_PROG([GROFF], [groff])
113017ca54c3Smrg   if test "x$GROFF" = "x"; then
113117ca54c3Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
113217ca54c3Smrg   fi
113317ca54c3Smrg   have_groff=yes
113417ca54c3Smrgelif test "x$use_groff" = x"no" ; then
113517ca54c3Smrg   if test "x$GROFF" != "x"; then
113617ca54c3Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
113717ca54c3Smrg   fi
113817ca54c3Smrg   have_groff=no
113917ca54c3Smrgelse
114017ca54c3Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
114117ca54c3Smrgfi
114217ca54c3Smrg
114317ca54c3Smrg# We have groff, test for the presence of the macro packages
114417ca54c3Smrgif test "x$have_groff" = x"yes"; then
114517ca54c3Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
114617ca54c3Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
114717ca54c3Smrg        groff_ms_works=yes
114817ca54c3Smrg    else
114917ca54c3Smrg        groff_ms_works=no
115017ca54c3Smrg    fi
115117ca54c3Smrg    AC_MSG_RESULT([$groff_ms_works])
115217ca54c3Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
115317ca54c3Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
115417ca54c3Smrg        groff_mm_works=yes
115517ca54c3Smrg    else
115617ca54c3Smrg        groff_mm_works=no
115717ca54c3Smrg    fi
115817ca54c3Smrg    AC_MSG_RESULT([$groff_mm_works])
115917ca54c3Smrgfi
116017ca54c3Smrg
116117ca54c3Smrg# We have groff, test for HTML dependencies, one command per package
116217ca54c3Smrgif test "x$have_groff" = x"yes"; then
116317ca54c3Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
116417ca54c3Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
116517ca54c3Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
116617ca54c3Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
116717ca54c3Smrg      have_groff_html=yes
116817ca54c3Smrg   else
116917ca54c3Smrg      have_groff_html=no
117017ca54c3Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
117117ca54c3Smrg   fi
117217ca54c3Smrgfi
117317ca54c3Smrg
117417ca54c3Smrg# Set Automake conditionals for Makefiles
117517ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
117617ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
117717ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
117817ca54c3SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
117917ca54c3Smrg]) # XORG_WITH_GROFF
118017ca54c3Smrg
118117ca54c3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
118217ca54c3Smrg# ---------------------------------------
118317ca54c3Smrg# Minimum version: 1.6.0
118417ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
118517ca54c3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
118617ca54c3Smrg#
118717ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
118817ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the
118917ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
119017ca54c3Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
119117ca54c3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
119217ca54c3Smrg# --with-fop assumes 'auto'.
119317ca54c3Smrg#
119417ca54c3Smrg# Interface to module:
119517ca54c3Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
119617ca54c3Smrg# FOP:	 	returns the path of the fop program found
119717ca54c3Smrg#		returns the path set by the user in the environment
119817ca54c3Smrg# --with-fop: 	'yes' user instructs the module to use fop
119917ca54c3Smrg#		'no' user instructs the module not to use fop
120017ca54c3Smrg#
120117ca54c3Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
120217ca54c3Smrg#
120317ca54c3SmrgAC_DEFUN([XORG_WITH_FOP],[
120417ca54c3SmrgAC_ARG_VAR([FOP], [Path to fop command])
120517ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
120617ca54c3SmrgAC_ARG_WITH(fop,
120717ca54c3Smrg	AS_HELP_STRING([--with-fop],
120817ca54c3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
120917ca54c3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
121017ca54c3Smrgm4_undefine([_defopt])
121117ca54c3Smrg
121217ca54c3Smrgif test "x$use_fop" = x"auto"; then
121317ca54c3Smrg   AC_PATH_PROG([FOP], [fop])
121417ca54c3Smrg   if test "x$FOP" = "x"; then
121517ca54c3Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
121617ca54c3Smrg	have_fop=no
121717ca54c3Smrg   else
121817ca54c3Smrg        have_fop=yes
121917ca54c3Smrg   fi
122017ca54c3Smrgelif test "x$use_fop" = x"yes" ; then
122117ca54c3Smrg   AC_PATH_PROG([FOP], [fop])
122217ca54c3Smrg   if test "x$FOP" = "x"; then
122317ca54c3Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
122417ca54c3Smrg   fi
122517ca54c3Smrg   have_fop=yes
122617ca54c3Smrgelif test "x$use_fop" = x"no" ; then
122717ca54c3Smrg   if test "x$FOP" != "x"; then
122817ca54c3Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
122917ca54c3Smrg   fi
123017ca54c3Smrg   have_fop=no
123117ca54c3Smrgelse
123217ca54c3Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
123317ca54c3Smrgfi
123417ca54c3Smrg
123517ca54c3Smrg# Test for a minimum version of fop, if provided.
123617ca54c3Smrgm4_ifval([$1],
123717ca54c3Smrg[if test "$have_fop" = yes; then
123817ca54c3Smrg    # scrape the fop version
123917ca54c3Smrg    AC_MSG_CHECKING([for fop minimum version])
124017ca54c3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
124117ca54c3Smrg    AC_MSG_RESULT([$fop_version])
124217ca54c3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
124317ca54c3Smrg        [if test "x$use_fop" = xauto; then
124417ca54c3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
124517ca54c3Smrg            have_fop=no
124617ca54c3Smrg        else
124717ca54c3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
124817ca54c3Smrg        fi])
124917ca54c3Smrgfi])
125017ca54c3SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
125117ca54c3Smrg]) # XORG_WITH_FOP
125217ca54c3Smrg
125317ca54c3Smrg# XORG_WITH_M4([MIN-VERSION])
125417ca54c3Smrg# ---------------------------
125517ca54c3Smrg# Minimum version: 1.19.0
125617ca54c3Smrg#
125717ca54c3Smrg# This macro attempts to locate an m4 macro processor which supports
125817ca54c3Smrg# -I option and is only useful for modules relying on M4 in order to
125917ca54c3Smrg# expand macros in source code files.
126017ca54c3Smrg#
126117ca54c3Smrg# Interface to module:
126217ca54c3Smrg# M4:	 	returns the path of the m4 program found
126317ca54c3Smrg#		returns the path set by the user in the environment
126417ca54c3Smrg#
126517ca54c3SmrgAC_DEFUN([XORG_WITH_M4], [
126617ca54c3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
126717ca54c3Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
126817ca54c3Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
126917ca54c3Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
127017ca54c3Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
127117ca54c3Smrg   [$PATH:/usr/gnu/bin])])
127217ca54c3Smrg
127317ca54c3SmrgAC_SUBST([M4], [$ac_cv_path_M4])
127417ca54c3Smrg]) # XORG_WITH_M4
127517ca54c3Smrg
127617ca54c3Smrg# XORG_WITH_PS2PDF([DEFAULT])
127717ca54c3Smrg# ----------------
127817ca54c3Smrg# Minimum version: 1.6.0
127917ca54c3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
128017ca54c3Smrg#
128117ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
128217ca54c3Smrg# not at the appropriate level. This macro enables a module to test for the
128317ca54c3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
128417ca54c3Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
128517ca54c3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
128617ca54c3Smrg# --with-ps2pdf assumes 'auto'.
128717ca54c3Smrg#
128817ca54c3Smrg# Interface to module:
128917ca54c3Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
129017ca54c3Smrg# PS2PDF:	returns the path of the ps2pdf program found
129117ca54c3Smrg#		returns the path set by the user in the environment
129217ca54c3Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
129317ca54c3Smrg#		 'no' user instructs the module not to use ps2pdf
129417ca54c3Smrg#
129517ca54c3Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
129617ca54c3Smrg#
129717ca54c3SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
129817ca54c3SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
129917ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto]))
130017ca54c3SmrgAC_ARG_WITH(ps2pdf,
130117ca54c3Smrg	AS_HELP_STRING([--with-ps2pdf],
130217ca54c3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
130317ca54c3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
130417ca54c3Smrgm4_undefine([_defopt])
130517ca54c3Smrg
130617ca54c3Smrgif test "x$use_ps2pdf" = x"auto"; then
130717ca54c3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
130817ca54c3Smrg   if test "x$PS2PDF" = "x"; then
130917ca54c3Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
131017ca54c3Smrg	have_ps2pdf=no
131117ca54c3Smrg   else
131217ca54c3Smrg        have_ps2pdf=yes
131317ca54c3Smrg   fi
131417ca54c3Smrgelif test "x$use_ps2pdf" = x"yes" ; then
131517ca54c3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
131617ca54c3Smrg   if test "x$PS2PDF" = "x"; then
131717ca54c3Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
131817ca54c3Smrg   fi
131917ca54c3Smrg   have_ps2pdf=yes
132017ca54c3Smrgelif test "x$use_ps2pdf" = x"no" ; then
132117ca54c3Smrg   if test "x$PS2PDF" != "x"; then
132217ca54c3Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
132317ca54c3Smrg   fi
132417ca54c3Smrg   have_ps2pdf=no
132517ca54c3Smrgelse
132617ca54c3Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
132717ca54c3Smrgfi
132817ca54c3SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
132917ca54c3Smrg]) # XORG_WITH_PS2PDF
133017ca54c3Smrg
133117ca54c3Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
133217ca54c3Smrg# ----------------
133317ca54c3Smrg# Minimum version: 1.6.0
133417ca54c3Smrg#
133517ca54c3Smrg# Documentation tools are not always available on all platforms and sometimes
133617ca54c3Smrg# not at the appropriate level. This macro enables a builder to skip all
133717ca54c3Smrg# documentation targets except traditional man pages.
133817ca54c3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
133917ca54c3Smrg# maximum flexibilty in controlling documentation building.
134017ca54c3Smrg# Refer to:
134117ca54c3Smrg# XORG_WITH_XMLTO         --with-xmlto
134217ca54c3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
134317ca54c3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
134417ca54c3Smrg# XORG_WITH_FOP           --with-fop
134517ca54c3Smrg# XORG_WITH_GROFF         --with-groff
134617ca54c3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
134717ca54c3Smrg#
134817ca54c3Smrg# Interface to module:
134917ca54c3Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
135017ca54c3Smrg# --enable-docs: 'yes' user instructs the module to generate docs
135117ca54c3Smrg#		 'no' user instructs the module not to generate docs
135217ca54c3Smrg# parm1:	specify the default value, yes or no.
135317ca54c3Smrg#
135417ca54c3SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
135517ca54c3Smrgm4_define([docs_default], m4_default([$1], [yes]))
135617ca54c3SmrgAC_ARG_ENABLE(docs,
135717ca54c3Smrg	AS_HELP_STRING([--enable-docs],
135817ca54c3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
135917ca54c3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
136017ca54c3Smrgm4_undefine([docs_default])
136117ca54c3SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
136217ca54c3SmrgAC_MSG_CHECKING([whether to build documentation])
136317ca54c3SmrgAC_MSG_RESULT([$build_docs])
136417ca54c3Smrg]) # XORG_ENABLE_DOCS
136517ca54c3Smrg
136617ca54c3Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
136717ca54c3Smrg# ----------------
136817ca54c3Smrg# Minimum version: 1.6.0
136917ca54c3Smrg#
137017ca54c3Smrg# This macro enables a builder to skip all developer documentation.
137117ca54c3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
137217ca54c3Smrg# maximum flexibilty in controlling documentation building.
137317ca54c3Smrg# Refer to:
137417ca54c3Smrg# XORG_WITH_XMLTO         --with-xmlto
137517ca54c3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
137617ca54c3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
137717ca54c3Smrg# XORG_WITH_FOP           --with-fop
137817ca54c3Smrg# XORG_WITH_GROFF         --with-groff
137917ca54c3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
138017ca54c3Smrg#
138117ca54c3Smrg# Interface to module:
138217ca54c3Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
138317ca54c3Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
138417ca54c3Smrg#			'no' user instructs the module not to generate developer docs
138517ca54c3Smrg# parm1:		specify the default value, yes or no.
138617ca54c3Smrg#
138717ca54c3SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
138817ca54c3Smrgm4_define([devel_default], m4_default([$1], [yes]))
138917ca54c3SmrgAC_ARG_ENABLE(devel-docs,
139017ca54c3Smrg	AS_HELP_STRING([--enable-devel-docs],
139117ca54c3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
139217ca54c3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
139317ca54c3Smrgm4_undefine([devel_default])
139417ca54c3SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
139517ca54c3SmrgAC_MSG_CHECKING([whether to build developer documentation])
139617ca54c3SmrgAC_MSG_RESULT([$build_devel_docs])
139717ca54c3Smrg]) # XORG_ENABLE_DEVEL_DOCS
139817ca54c3Smrg
139917ca54c3Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
140017ca54c3Smrg# ----------------
140117ca54c3Smrg# Minimum version: 1.6.0
140217ca54c3Smrg#
140317ca54c3Smrg# This macro enables a builder to skip all functional specification targets.
140417ca54c3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
140517ca54c3Smrg# maximum flexibilty in controlling documentation building.
140617ca54c3Smrg# Refer to:
140717ca54c3Smrg# XORG_WITH_XMLTO         --with-xmlto
140817ca54c3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
140917ca54c3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
141017ca54c3Smrg# XORG_WITH_FOP           --with-fop
141117ca54c3Smrg# XORG_WITH_GROFF         --with-groff
141217ca54c3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
141317ca54c3Smrg#
141417ca54c3Smrg# Interface to module:
141517ca54c3Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
141617ca54c3Smrg# --enable-specs:	'yes' user instructs the module to generate specs
141717ca54c3Smrg#			'no' user instructs the module not to generate specs
141817ca54c3Smrg# parm1:		specify the default value, yes or no.
141917ca54c3Smrg#
142017ca54c3SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
142117ca54c3Smrgm4_define([spec_default], m4_default([$1], [yes]))
142217ca54c3SmrgAC_ARG_ENABLE(specs,
142317ca54c3Smrg	AS_HELP_STRING([--enable-specs],
142417ca54c3Smrg	   [Enable building the specs (default: ]spec_default[)]),
142517ca54c3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
142617ca54c3Smrgm4_undefine([spec_default])
142717ca54c3SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
142817ca54c3SmrgAC_MSG_CHECKING([whether to build functional specifications])
142917ca54c3SmrgAC_MSG_RESULT([$build_specs])
143017ca54c3Smrg]) # XORG_ENABLE_SPECS
143117ca54c3Smrg
143217ca54c3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
143317ca54c3Smrg# ----------------------------------------------
143417ca54c3Smrg# Minimum version: 1.13.0
143517ca54c3Smrg#
143617ca54c3Smrg# This macro enables a builder to enable/disable unit testing
143717ca54c3Smrg# It makes no assumption about the test cases implementation
143817ca54c3Smrg# Test cases may or may not use Automake "Support for test suites"
143917ca54c3Smrg# They may or may not use the software utility library GLib
144017ca54c3Smrg#
144117ca54c3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
144217ca54c3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
144317ca54c3Smrg# The variable enable_unit_tests is used by other macros in this file.
144417ca54c3Smrg#
144517ca54c3Smrg# Interface to module:
144617ca54c3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
144717ca54c3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
144817ca54c3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
144917ca54c3Smrg#			'no' user instructs the module not to build tests
145017ca54c3Smrg# parm1:		specify the default value, yes or no.
145117ca54c3Smrg#
145217ca54c3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
145317ca54c3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
145417ca54c3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
145517ca54c3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
145617ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto]))
145717ca54c3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
145817ca54c3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
145917ca54c3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
146017ca54c3Smrgm4_undefine([_defopt])
146117ca54c3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
146217ca54c3SmrgAC_MSG_CHECKING([whether to build unit test cases])
146317ca54c3SmrgAC_MSG_RESULT([$enable_unit_tests])
146417ca54c3Smrg]) # XORG_ENABLE_UNIT_TESTS
146517ca54c3Smrg
146617ca54c3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
146717ca54c3Smrg# ------------------------------------------------------
146817ca54c3Smrg# Minimum version: 1.17.0
146917ca54c3Smrg#
147017ca54c3Smrg# This macro enables a builder to enable/disable integration testing
147117ca54c3Smrg# It makes no assumption about the test cases' implementation
147217ca54c3Smrg# Test cases may or may not use Automake "Support for test suites"
147317ca54c3Smrg#
147417ca54c3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
147517ca54c3Smrg# usually requires less dependencies and may be built and run under less
147617ca54c3Smrg# stringent environments than integration tests.
147717ca54c3Smrg#
147817ca54c3Smrg# Interface to module:
147917ca54c3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
148017ca54c3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
148117ca54c3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
148217ca54c3Smrg#                             'no' user instructs the module not to build tests
148317ca54c3Smrg# parm1:                      specify the default value, yes or no.
148417ca54c3Smrg#
148517ca54c3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
148617ca54c3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
148717ca54c3Smrgm4_define([_defopt], m4_default([$1], [auto]))
148817ca54c3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
148917ca54c3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
149017ca54c3Smrg	[enable_integration_tests=$enableval],
149117ca54c3Smrg	[enable_integration_tests=]_defopt)
149217ca54c3Smrgm4_undefine([_defopt])
149317ca54c3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
149417ca54c3Smrg	[test "x$enable_integration_tests" != xno])
149517ca54c3SmrgAC_MSG_CHECKING([whether to build unit test cases])
149617ca54c3SmrgAC_MSG_RESULT([$enable_integration_tests])
149717ca54c3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
149817ca54c3Smrg
149917ca54c3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
150017ca54c3Smrg# ----------------------------------------
150117ca54c3Smrg# Minimum version: 1.13.0
150217ca54c3Smrg#
150317ca54c3Smrg# GLib is a library which provides advanced data structures and functions.
150417ca54c3Smrg# This macro enables a module to test for the presence of Glib.
150517ca54c3Smrg#
150617ca54c3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
150717ca54c3Smrg# Otherwise the value of $enable_unit_tests is blank.
150817ca54c3Smrg#
150917ca54c3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
151017ca54c3Smrg# test support usually requires less dependencies and may be built and run under
151117ca54c3Smrg# less stringent environments than integration tests.
151217ca54c3Smrg#
151317ca54c3Smrg# Interface to module:
151417ca54c3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
151517ca54c3Smrg# with_glib: used in configure.ac to know if GLib has been found
151617ca54c3Smrg# --with-glib:	'yes' user instructs the module to use glib
151717ca54c3Smrg#		'no' user instructs the module not to use glib
151817ca54c3Smrg#
151917ca54c3SmrgAC_DEFUN([XORG_WITH_GLIB],[
152017ca54c3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
152117ca54c3Smrgm4_define([_defopt], m4_default([$2], [auto]))
152217ca54c3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
152317ca54c3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
152417ca54c3Smrg	[with_glib=$withval], [with_glib=]_defopt)
152517ca54c3Smrgm4_undefine([_defopt])
152617ca54c3Smrg
152717ca54c3Smrghave_glib=no
152817ca54c3Smrg# Do not probe GLib if user explicitly disabled unit testing
152917ca54c3Smrgif test "x$enable_unit_tests" != x"no"; then
153017ca54c3Smrg  # Do not probe GLib if user explicitly disabled it
153117ca54c3Smrg  if test "x$with_glib" != x"no"; then
153217ca54c3Smrg    m4_ifval(
153317ca54c3Smrg      [$1],
153417ca54c3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
153517ca54c3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
153617ca54c3Smrg    )
153717ca54c3Smrg  fi
153817ca54c3Smrgfi
153917ca54c3Smrg
154017ca54c3Smrg# Not having GLib when unit testing has been explicitly requested is an error
154117ca54c3Smrgif test "x$enable_unit_tests" = x"yes"; then
154217ca54c3Smrg  if test "x$have_glib" = x"no"; then
154317ca54c3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
154417ca54c3Smrg  fi
154517ca54c3Smrgfi
154617ca54c3Smrg
154717ca54c3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
154817ca54c3Smrgif test "x$enable_unit_tests" = x"no"; then
154917ca54c3Smrg  if test "x$with_glib" = x"yes"; then
155017ca54c3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
155117ca54c3Smrg  fi
155217ca54c3Smrgfi
155317ca54c3Smrg
155417ca54c3Smrg# Not having GLib when it has been explicitly requested is an error
155517ca54c3Smrgif test "x$with_glib" = x"yes"; then
155617ca54c3Smrg  if test "x$have_glib" = x"no"; then
155717ca54c3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
155817ca54c3Smrg  fi
155917ca54c3Smrgfi
156017ca54c3Smrg
156117ca54c3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
156217ca54c3Smrg]) # XORG_WITH_GLIB
156317ca54c3Smrg
156417ca54c3Smrg# XORG_LD_WRAP([required|optional])
156517ca54c3Smrg# ---------------------------------
156617ca54c3Smrg# Minimum version: 1.13.0
156717ca54c3Smrg#
156817ca54c3Smrg# Check if linker supports -wrap, passed via compiler flags
156917ca54c3Smrg#
157017ca54c3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
157117ca54c3Smrg# Otherwise the value of $enable_unit_tests is blank.
157217ca54c3Smrg#
157317ca54c3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
157417ca54c3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
157517ca54c3Smrg# available, an argument of "optional" allows use when some unit tests require
157617ca54c3Smrg# ld -wrap and others do not.
157717ca54c3Smrg#
157817ca54c3SmrgAC_DEFUN([XORG_LD_WRAP],[
157917ca54c3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
158017ca54c3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
158117ca54c3Smrg                      void __wrap_exit(int status) { return; }],
158217ca54c3Smrg                     [exit(0);])])
158317ca54c3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
158417ca54c3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
158517ca54c3Smrg  if test "x$have_ld_wrap" = x"no"; then
158617ca54c3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
158717ca54c3Smrg  fi
158817ca54c3Smrgfi
158917ca54c3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
159017ca54c3Smrg#
159117ca54c3Smrg]) # XORG_LD_WRAP
159217ca54c3Smrg
159317ca54c3Smrg# XORG_CHECK_LINKER_FLAGS
159417ca54c3Smrg# -----------------------
159517ca54c3Smrg# SYNOPSIS
159617ca54c3Smrg#
159717ca54c3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
159817ca54c3Smrg#
159917ca54c3Smrg# DESCRIPTION
160017ca54c3Smrg#
160117ca54c3Smrg#   Check whether the given linker FLAGS work with the current language's
160217ca54c3Smrg#   linker, or whether they give an error.
160317ca54c3Smrg#
160417ca54c3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
160517ca54c3Smrg#   success/failure.
160617ca54c3Smrg#
160717ca54c3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
160817ca54c3Smrg#
160917ca54c3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
161017ca54c3Smrg#
161117ca54c3Smrg# LICENSE
161217ca54c3Smrg#
161317ca54c3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
161417ca54c3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
161517ca54c3Smrg#   Copyright (c) 2009 Matteo Frigo
161617ca54c3Smrg#
161717ca54c3Smrg#   This program is free software: you can redistribute it and/or modify it
161817ca54c3Smrg#   under the terms of the GNU General Public License as published by the
161917ca54c3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
162017ca54c3Smrg#   option) any later version.
162117ca54c3Smrg#
162217ca54c3Smrg#   This program is distributed in the hope that it will be useful, but
162317ca54c3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
162417ca54c3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
162517ca54c3Smrg#   Public License for more details.
162617ca54c3Smrg#
162717ca54c3Smrg#   You should have received a copy of the GNU General Public License along
162817ca54c3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
162917ca54c3Smrg#
163017ca54c3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
163117ca54c3Smrg#   gives unlimited permission to copy, distribute and modify the configure
163217ca54c3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
163317ca54c3Smrg#   need not follow the terms of the GNU General Public License when using
163417ca54c3Smrg#   or distributing such scripts, even though portions of the text of the
163517ca54c3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
163617ca54c3Smrg#   all other use of the material that constitutes the Autoconf Macro.
163717ca54c3Smrg#
163817ca54c3Smrg#   This special exception to the GPL applies to versions of the Autoconf
163917ca54c3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
164017ca54c3Smrg#   modified version of the Autoconf Macro, you may extend this special
164117ca54c3Smrg#   exception to the GPL to apply to your modified version as well.#
164217ca54c3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
164317ca54c3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
164417ca54c3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
164517ca54c3SmrgAS_LITERAL_IF([$1],
164617ca54c3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
164717ca54c3Smrg      ax_save_FLAGS=$LDFLAGS
164817ca54c3Smrg      LDFLAGS="$1"
164917ca54c3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
165017ca54c3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
165117ca54c3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
165217ca54c3Smrg      LDFLAGS=$ax_save_FLAGS])],
165317ca54c3Smrg  [ax_save_FLAGS=$LDFLAGS
165417ca54c3Smrg   LDFLAGS="$1"
165517ca54c3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
165617ca54c3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
165717ca54c3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
165817ca54c3Smrg   LDFLAGS=$ax_save_FLAGS])
165917ca54c3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
166017ca54c3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
166117ca54c3Smrgif test "x$xorg_check_linker_flags" = xyes; then
166217ca54c3Smrg	m4_default([$2], :)
166317ca54c3Smrgelse
166417ca54c3Smrg	m4_default([$3], :)
166517ca54c3Smrgfi
166617ca54c3Smrg]) # XORG_CHECK_LINKER_FLAGS
166717ca54c3Smrg
166817ca54c3Smrg# XORG_MEMORY_CHECK_FLAGS
166917ca54c3Smrg# -----------------------
167017ca54c3Smrg# Minimum version: 1.16.0
167117ca54c3Smrg#
167217ca54c3Smrg# This macro attempts to find appropriate memory checking functionality
167317ca54c3Smrg# for various platforms which unit testing code may use to catch various
167417ca54c3Smrg# forms of memory allocation and access errors in testing.
167517ca54c3Smrg#
167617ca54c3Smrg# Interface to module:
167717ca54c3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
167817ca54c3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
167917ca54c3Smrg#
168017ca54c3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
168117ca54c3Smrg#
168217ca54c3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
168317ca54c3Smrg
168417ca54c3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
168517ca54c3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
168617ca54c3Smrg           [Environment variables to enable memory checking in tests])
168717ca54c3Smrg
168817ca54c3Smrg# Check for different types of support on different platforms
168917ca54c3Smrgcase $host_os in
169017ca54c3Smrg    solaris*)
169117ca54c3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
169217ca54c3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
169317ca54c3Smrg        ;;
169417ca54c3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
169517ca54c3Smrg        # both directly and inverted, so should not be 0 or 255.
169617ca54c3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
169717ca54c3Smrg        ;;
169817ca54c3Smrg    darwin*)
169917ca54c3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
170017ca54c3Smrg        ;;
170117ca54c3Smrg    *bsd*)
170217ca54c3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
170317ca54c3Smrg        ;;
170417ca54c3Smrgesac
170517ca54c3Smrg
170617ca54c3Smrg# User supplied flags override default flags
170717ca54c3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
170817ca54c3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
170917ca54c3Smrgfi
171017ca54c3Smrg
171117ca54c3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
171217ca54c3Smrg]) # XORG_WITH_LINT
171317ca54c3Smrg
171417ca54c3Smrg# XORG_CHECK_MALLOC_ZERO
171517ca54c3Smrg# ----------------------
171617ca54c3Smrg# Minimum version: 1.0.0
171717ca54c3Smrg#
171817ca54c3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
171917ca54c3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
172017ca54c3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
172117ca54c3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
172217ca54c3SmrgAC_ARG_ENABLE(malloc0returnsnull,
172317ca54c3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
172417ca54c3Smrg		       [malloc(0) returns NULL (default: auto)]),
172517ca54c3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
172617ca54c3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
172717ca54c3Smrg
172817ca54c3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
172917ca54c3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
173017ca54c3SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
173117ca54c3Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
173217ca54c3Smrg#include <stdlib.h>
173317ca54c3Smrg],[
173417ca54c3Smrg    char *m0, *r0, *c0, *p;
173517ca54c3Smrg    m0 = malloc(0);
173617ca54c3Smrg    p = malloc(10);
173717ca54c3Smrg    r0 = realloc(p,0);
173817ca54c3Smrg    c0 = calloc(0,10);
173917ca54c3Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
174017ca54c3Smrg])],
174117ca54c3Smrg		[xorg_cv_malloc0_returns_null=yes],
174217ca54c3Smrg		[xorg_cv_malloc0_returns_null=no])])
174317ca54c3SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
174417ca54c3Smrgfi
174517ca54c3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
174617ca54c3Smrg
174717ca54c3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
174817ca54c3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
174917ca54c3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
175017ca54c3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
175117ca54c3Smrgelse
175217ca54c3Smrg	MALLOC_ZERO_CFLAGS=""
175317ca54c3Smrg	XMALLOC_ZERO_CFLAGS=""
175417ca54c3Smrg	XTMALLOC_ZERO_CFLAGS=""
175517ca54c3Smrgfi
175617ca54c3Smrg
175717ca54c3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
175817ca54c3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
175917ca54c3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
176017ca54c3Smrg]) # XORG_CHECK_MALLOC_ZERO
176117ca54c3Smrg
176217ca54c3Smrg# XORG_WITH_LINT()
176317ca54c3Smrg# ----------------
176417ca54c3Smrg# Minimum version: 1.1.0
176517ca54c3Smrg#
176617ca54c3Smrg# This macro enables the use of a tool that flags some suspicious and
176717ca54c3Smrg# non-portable constructs (likely to be bugs) in C language source code.
176817ca54c3Smrg# It will attempt to locate the tool and use appropriate options.
176917ca54c3Smrg# There are various lint type tools on different platforms.
177017ca54c3Smrg#
177117ca54c3Smrg# Interface to module:
177217ca54c3Smrg# LINT:		returns the path to the tool found on the platform
177317ca54c3Smrg#		or the value set to LINT on the configure cmd line
177417ca54c3Smrg#		also an Automake conditional
177517ca54c3Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
177617ca54c3Smrg#
177717ca54c3Smrg# --with-lint:	'yes' user instructs the module to use lint
177817ca54c3Smrg#		'no' user instructs the module not to use lint (default)
177917ca54c3Smrg#
178017ca54c3Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
178117ca54c3Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
178217ca54c3Smrg#
178317ca54c3SmrgAC_DEFUN([XORG_WITH_LINT],[
178417ca54c3Smrg
178517ca54c3SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
178617ca54c3SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
178717ca54c3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
178817ca54c3Smrg		[Use a lint-style source code checker (default: disabled)])],
178917ca54c3Smrg		[use_lint=$withval], [use_lint=no])
179017ca54c3Smrg
179117ca54c3Smrg# Obtain platform specific info like program name and options
179217ca54c3Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
179317ca54c3Smrgcase $host_os in
179417ca54c3Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
179517ca54c3Smrg	lint_name=splint
179617ca54c3Smrg	lint_options="-badflag"
179717ca54c3Smrg	;;
179817ca54c3Smrg  *freebsd* | *netbsd*)
179917ca54c3Smrg	lint_name=lint
180017ca54c3Smrg	lint_options="-u -b"
180117ca54c3Smrg	;;
180217ca54c3Smrg  *solaris*)
180317ca54c3Smrg	lint_name=lint
180417ca54c3Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
180517ca54c3Smrg	;;
180617ca54c3Smrgesac
180717ca54c3Smrg
180817ca54c3Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
180917ca54c3Smrgif test "x$use_lint" = x"yes" ; then
181017ca54c3Smrg   AC_PATH_PROG([LINT], [$lint_name])
181117ca54c3Smrg   if test "x$LINT" = "x"; then
181217ca54c3Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
181317ca54c3Smrg   fi
181417ca54c3Smrgelif test "x$use_lint" = x"no" ; then
181517ca54c3Smrg   if test "x$LINT" != "x"; then
181617ca54c3Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
181717ca54c3Smrg   fi
181817ca54c3Smrgelse
181917ca54c3Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
182017ca54c3Smrgfi
182117ca54c3Smrg
182217ca54c3Smrg# User supplied flags override default flags
182317ca54c3Smrgif test "x$LINT_FLAGS" != "x"; then
182417ca54c3Smrg   lint_options=$LINT_FLAGS
182517ca54c3Smrgfi
182617ca54c3Smrg
182717ca54c3SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
182817ca54c3SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
182917ca54c3Smrg
183017ca54c3Smrg]) # XORG_WITH_LINT
183117ca54c3Smrg
183217ca54c3Smrg# XORG_LINT_LIBRARY(LIBNAME)
183317ca54c3Smrg# --------------------------
183417ca54c3Smrg# Minimum version: 1.1.0
183517ca54c3Smrg#
183617ca54c3Smrg# Sets up flags for building lint libraries for checking programs that call
183717ca54c3Smrg# functions in the library.
183817ca54c3Smrg#
183917ca54c3Smrg# Interface to module:
184017ca54c3Smrg# LINTLIB		- Automake variable with the name of lint library file to make
184117ca54c3Smrg# MAKE_LINT_LIB		- Automake conditional
184217ca54c3Smrg#
184317ca54c3Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
184417ca54c3Smrg#			  - 'no' user instructs the module not to create a lint library (default)
184517ca54c3Smrg
184617ca54c3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
184717ca54c3SmrgAC_REQUIRE([XORG_WITH_LINT])
184817ca54c3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
184917ca54c3Smrg	[Create lint library (default: disabled)])],
185017ca54c3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
185117ca54c3Smrg
185217ca54c3Smrgif test "x$make_lint_lib" = x"yes" ; then
185317ca54c3Smrg   LINTLIB=llib-l$1.ln
185417ca54c3Smrg   if test "x$LINT" = "x"; then
185517ca54c3Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
185617ca54c3Smrg   fi
185717ca54c3Smrgelif test "x$make_lint_lib" != x"no" ; then
185817ca54c3Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
185917ca54c3Smrgfi
186017ca54c3Smrg
186117ca54c3SmrgAC_SUBST(LINTLIB)
186217ca54c3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
186317ca54c3Smrg
186417ca54c3Smrg]) # XORG_LINT_LIBRARY
186517ca54c3Smrg
186617ca54c3Smrg# XORG_COMPILER_BRAND
186717ca54c3Smrg# -------------------
186817ca54c3Smrg# Minimum version: 1.14.0
186917ca54c3Smrg#
187017ca54c3Smrg# Checks for various brands of compilers and sets flags as appropriate:
187117ca54c3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
187217ca54c3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
187317ca54c3Smrg#   clang compiler - sets CLANGCC to "yes"
187417ca54c3Smrg#   Intel compiler - sets INTELCC to "yes"
187517ca54c3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
187617ca54c3Smrg#
187717ca54c3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
187817ca54c3SmrgAC_LANG_CASE(
187917ca54c3Smrg	[C], [
188017ca54c3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
188117ca54c3Smrg	],
188217ca54c3Smrg	[C++], [
188317ca54c3Smrg		AC_REQUIRE([AC_PROG_CXX])
188417ca54c3Smrg	]
188517ca54c3Smrg)
188617ca54c3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
188717ca54c3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
188817ca54c3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
188917ca54c3Smrg]) # XORG_COMPILER_BRAND
189017ca54c3Smrg
189117ca54c3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
189217ca54c3Smrg# ---------------
189317ca54c3Smrg# Minimum version: 1.16.0
189417ca54c3Smrg#
189517ca54c3Smrg# Test if the compiler works when passed the given flag as a command line argument.
189617ca54c3Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
189717ca54c3Smrg# next flag in the list until there are no more options.
189817ca54c3Smrg#
189917ca54c3Smrg# Note that this does not guarantee that the compiler supports the flag as some
190017ca54c3Smrg# compilers will simply ignore arguments that they do not understand, but we do
190117ca54c3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
190217ca54c3Smrg# -Werror=unused-command-line-argument
190317ca54c3Smrg#
190417ca54c3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
190517ca54c3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
190617ca54c3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
190717ca54c3Smrg
190817ca54c3SmrgAC_LANG_COMPILER_REQUIRE
190917ca54c3Smrg
191017ca54c3SmrgAC_LANG_CASE(
191117ca54c3Smrg	[C], [
191217ca54c3Smrg		AC_REQUIRE([AC_PROG_CC_C99])
191317ca54c3Smrg		define([PREFIX], [C])
191417ca54c3Smrg		define([CACHE_PREFIX], [cc])
191517ca54c3Smrg		define([COMPILER], [$CC])
191617ca54c3Smrg	],
191717ca54c3Smrg	[C++], [
191817ca54c3Smrg		define([PREFIX], [CXX])
191917ca54c3Smrg		define([CACHE_PREFIX], [cxx])
192017ca54c3Smrg		define([COMPILER], [$CXX])
192117ca54c3Smrg	]
192217ca54c3Smrg)
192317ca54c3Smrg
192417ca54c3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
192517ca54c3Smrg
192617ca54c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
192717ca54c3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
192817ca54c3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
192917ca54c3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
193017ca54c3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
193117ca54c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
193217ca54c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
193317ca54c3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
193417ca54c3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
193517ca54c3Smrgfi
193617ca54c3Smrg
193717ca54c3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
193817ca54c3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
193917ca54c3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
194017ca54c3Smrg	fi
194117ca54c3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
194217ca54c3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
194317ca54c3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
194417ca54c3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
194517ca54c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
194617ca54c3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
194717ca54c3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
194817ca54c3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
194917ca54c3Smrgfi
195017ca54c3Smrg
195117ca54c3Smrgfound="no"
195217ca54c3Smrgm4_foreach([flag], m4_cdr($@), [
195317ca54c3Smrg	if test $found = "no" ; then
195417ca54c3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
195517ca54c3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
195617ca54c3Smrg		fi
195717ca54c3Smrg
195817ca54c3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
195917ca54c3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
196017ca54c3Smrg		fi
196117ca54c3Smrg
196217ca54c3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
196317ca54c3Smrg
196417ca54c3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
196517ca54c3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
196617ca54c3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
196717ca54c3Smrg		AC_CACHE_VAL($cacheid,
196817ca54c3Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
196917ca54c3Smrg					     [eval $cacheid=yes],
197017ca54c3Smrg					     [eval $cacheid=no])])
197117ca54c3Smrg
197217ca54c3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
197317ca54c3Smrg
197417ca54c3Smrg		eval supported=\$$cacheid
197517ca54c3Smrg		AC_MSG_RESULT([$supported])
197617ca54c3Smrg		if test "$supported" = "yes" ; then
197717ca54c3Smrg			$1="$$1 ]flag["
197817ca54c3Smrg			found="yes"
197917ca54c3Smrg		fi
198017ca54c3Smrg	fi
198117ca54c3Smrg])
198217ca54c3Smrg]) # XORG_TESTSET_CFLAG
198317ca54c3Smrg
198417ca54c3Smrg# XORG_COMPILER_FLAGS
198517ca54c3Smrg# ---------------
198617ca54c3Smrg# Minimum version: 1.16.0
198717ca54c3Smrg#
198817ca54c3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
198917ca54c3Smrg# arguments supported by the selected compiler which do NOT alter the generated
199017ca54c3Smrg# code.  These arguments will cause the compiler to print various warnings
199117ca54c3Smrg# during compilation AND turn a conservative set of warnings into errors.
199217ca54c3Smrg#
199317ca54c3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
199417ca54c3Smrg# future versions of util-macros as options are added to new compilers.
199517ca54c3Smrg#
199617ca54c3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
199717ca54c3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
199817ca54c3Smrg
199917ca54c3SmrgAC_ARG_ENABLE(selective-werror,
200017ca54c3Smrg              AS_HELP_STRING([--disable-selective-werror],
200117ca54c3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
200217ca54c3Smrg              [SELECTIVE_WERROR=$enableval],
200317ca54c3Smrg              [SELECTIVE_WERROR=yes])
200417ca54c3Smrg
200517ca54c3SmrgAC_LANG_CASE(
200617ca54c3Smrg        [C], [
200717ca54c3Smrg                define([PREFIX], [C])
200817ca54c3Smrg        ],
200917ca54c3Smrg        [C++], [
201017ca54c3Smrg                define([PREFIX], [CXX])
201117ca54c3Smrg        ]
201217ca54c3Smrg)
201317ca54c3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
201417ca54c3Smrgif test "x$SUNCC" = "xyes"; then
201517ca54c3Smrg    [BASE_]PREFIX[FLAGS]="-v"
201617ca54c3Smrgelse
201717ca54c3Smrg    [BASE_]PREFIX[FLAGS]=""
201817ca54c3Smrgfi
201917ca54c3Smrg
202017ca54c3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
202117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
202217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
202317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
202417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
202517ca54c3Smrg
202617ca54c3SmrgAC_LANG_CASE(
202717ca54c3Smrg	[C], [
202817ca54c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
202917ca54c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
203017ca54c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
203117ca54c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
203217ca54c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
203317ca54c3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
203417ca54c3Smrg	]
203517ca54c3Smrg)
203617ca54c3Smrg
203717ca54c3Smrg# This chunk adds additional warnings that could catch undesired effects.
203817ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
203917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
204017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
204117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
204217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
204317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
204417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
204517ca54c3Smrg
204617ca54c3Smrg# These are currently disabled because they are noisy.  They will be enabled
204717ca54c3Smrg# in the future once the codebase is sufficiently modernized to silence
204817ca54c3Smrg# them.  For now, I don't want them to drown out the other warnings.
204917ca54c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
205017ca54c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
205117ca54c3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
205217ca54c3Smrg
205317ca54c3Smrg# Turn some warnings into errors, so we don't accidently get successful builds
205417ca54c3Smrg# when there are problems that should be fixed.
205517ca54c3Smrg
205617ca54c3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
205717ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
205817ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
205917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
206017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
206117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
206217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
206317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
206417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
206517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
206617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
206717ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
206817ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
206917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
207017ca54c3Smrgelse
207117ca54c3SmrgAC_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])
207217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
207317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
207417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
207517ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
207617ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
207717ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
207817ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
207917ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
208017ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
208117ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
208217ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
208317ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
208417ca54c3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
208517ca54c3Smrgfi
208617ca54c3Smrg
208717ca54c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
208817ca54c3Smrg]) # XORG_COMPILER_FLAGS
208917ca54c3Smrg
209017ca54c3Smrg# XORG_CWARNFLAGS
209117ca54c3Smrg# ---------------
209217ca54c3Smrg# Minimum version: 1.2.0
209317ca54c3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
209417ca54c3Smrg#
209517ca54c3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
209617ca54c3Smrg#
209717ca54c3Smrg# This function is deprecated because it defines -fno-strict-aliasing
209817ca54c3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
209917ca54c3Smrg# is needed, then it should be added explicitly in the module when
210017ca54c3Smrg# it is updated to use BASE_CFLAGS.
210117ca54c3Smrg#
210217ca54c3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
210317ca54c3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
210417ca54c3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
210517ca54c3SmrgAC_LANG_CASE(
210617ca54c3Smrg	[C], [
210717ca54c3Smrg		CWARNFLAGS="$BASE_CFLAGS"
210817ca54c3Smrg		if  test "x$GCC" = xyes ; then
210917ca54c3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
211017ca54c3Smrg		fi
211117ca54c3Smrg		AC_SUBST(CWARNFLAGS)
211217ca54c3Smrg	]
211317ca54c3Smrg)
211417ca54c3Smrg]) # XORG_CWARNFLAGS
211517ca54c3Smrg
211617ca54c3Smrg# XORG_STRICT_OPTION
211717ca54c3Smrg# -----------------------
211817ca54c3Smrg# Minimum version: 1.3.0
211917ca54c3Smrg#
212017ca54c3Smrg# Add configure option to enable strict compilation flags, such as treating
212117ca54c3Smrg# warnings as fatal errors.
212217ca54c3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
212317ca54c3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
212417ca54c3Smrg#
212517ca54c3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
212617ca54c3Smrg# when strict compilation is unconditionally desired.
212717ca54c3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
212817ca54c3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
212917ca54c3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
213017ca54c3Smrg
213117ca54c3SmrgAC_ARG_ENABLE(strict-compilation,
213217ca54c3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
213317ca54c3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
213417ca54c3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
213517ca54c3Smrg
213617ca54c3SmrgAC_LANG_CASE(
213717ca54c3Smrg        [C], [
213817ca54c3Smrg                define([PREFIX], [C])
213917ca54c3Smrg        ],
214017ca54c3Smrg        [C++], [
214117ca54c3Smrg                define([PREFIX], [CXX])
214217ca54c3Smrg        ]
214317ca54c3Smrg)
214417ca54c3Smrg
214517ca54c3Smrg[STRICT_]PREFIX[FLAGS]=""
214617ca54c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
214717ca54c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
214817ca54c3Smrg
214917ca54c3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
215017ca54c3Smrg# activate it with -Werror, so we add it here explicitly.
215117ca54c3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
215217ca54c3Smrg
215317ca54c3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
215417ca54c3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
215517ca54c3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
215617ca54c3Smrgfi
215717ca54c3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
215817ca54c3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
215917ca54c3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
216017ca54c3Smrg]) # XORG_STRICT_OPTION
216117ca54c3Smrg
216217ca54c3Smrg# XORG_DEFAULT_OPTIONS
216317ca54c3Smrg# --------------------
216417ca54c3Smrg# Minimum version: 1.3.0
216517ca54c3Smrg#
216617ca54c3Smrg# Defines default options for X.Org modules.
216717ca54c3Smrg#
216817ca54c3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
216917ca54c3SmrgAC_REQUIRE([AC_PROG_INSTALL])
217017ca54c3SmrgXORG_COMPILER_FLAGS
217117ca54c3SmrgXORG_CWARNFLAGS
217217ca54c3SmrgXORG_STRICT_OPTION
217317ca54c3SmrgXORG_RELEASE_VERSION
217417ca54c3SmrgXORG_CHANGELOG
217517ca54c3SmrgXORG_INSTALL
217617ca54c3SmrgXORG_MANPAGE_SECTIONS
217717ca54c3Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
217817ca54c3Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
217917ca54c3Smrg]) # XORG_DEFAULT_OPTIONS
218017ca54c3Smrg
218117ca54c3Smrg# XORG_INSTALL()
218217ca54c3Smrg# ----------------
218317ca54c3Smrg# Minimum version: 1.4.0
218417ca54c3Smrg#
218517ca54c3Smrg# Defines the variable INSTALL_CMD as the command to copy
218617ca54c3Smrg# INSTALL from $prefix/share/util-macros.
218717ca54c3Smrg#
218817ca54c3SmrgAC_DEFUN([XORG_INSTALL], [
218917ca54c3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
219017ca54c3Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
219117ca54c3SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
219217ca54c3Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
219317ca54c3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
219417ca54c3Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
219517ca54c3SmrgAC_SUBST([INSTALL_CMD])
219617ca54c3Smrg]) # XORG_INSTALL
219717ca54c3Smrgdnl Copyright 2005 Red Hat, Inc
219817ca54c3Smrgdnl
219917ca54c3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
220017ca54c3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
220117ca54c3Smrgdnl the above copyright notice appear in all copies and that both that
220217ca54c3Smrgdnl copyright notice and this permission notice appear in supporting
220317ca54c3Smrgdnl documentation.
220417ca54c3Smrgdnl
220517ca54c3Smrgdnl The above copyright notice and this permission notice shall be included
220617ca54c3Smrgdnl in all copies or substantial portions of the Software.
220717ca54c3Smrgdnl
220817ca54c3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
220917ca54c3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
221017ca54c3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
221117ca54c3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
221217ca54c3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
221317ca54c3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
221417ca54c3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
221517ca54c3Smrgdnl
221617ca54c3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
221717ca54c3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
221817ca54c3Smrgdnl other dealings in this Software without prior written authorization
221917ca54c3Smrgdnl from the copyright holders.
222017ca54c3Smrgdnl
222117ca54c3Smrg
222217ca54c3Smrg# XORG_RELEASE_VERSION
222317ca54c3Smrg# --------------------
222417ca54c3Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
222517ca54c3Smrg
222617ca54c3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
222717ca54c3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
222817ca54c3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
222917ca54c3Smrg		[Major version of this package])
223017ca54c3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
223117ca54c3Smrg	if test "x$PVM" = "x"; then
223217ca54c3Smrg		PVM="0"
223317ca54c3Smrg	fi
223417ca54c3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
223517ca54c3Smrg		[$PVM],
223617ca54c3Smrg		[Minor version of this package])
223717ca54c3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
223817ca54c3Smrg	if test "x$PVP" = "x"; then
223917ca54c3Smrg		PVP="0"
224017ca54c3Smrg	fi
224117ca54c3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
224217ca54c3Smrg		[$PVP],
224317ca54c3Smrg		[Patch version of this package])
224417ca54c3Smrg])
224517ca54c3Smrg
224617ca54c3Smrg# XORG_CHANGELOG()
224717ca54c3Smrg# ----------------
224817ca54c3Smrg# Minimum version: 1.2.0
224917ca54c3Smrg#
225017ca54c3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
225117ca54c3Smrg# ChangeLog from git.
225217ca54c3Smrg#
225317ca54c3Smrg#
225417ca54c3SmrgAC_DEFUN([XORG_CHANGELOG], [
225517ca54c3SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
225617ca54c3Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
225717ca54c3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
225817ca54c3Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
225917ca54c3SmrgAC_SUBST([CHANGELOG_CMD])
226017ca54c3Smrg]) # XORG_CHANGELOG
226117ca54c3Smrg
226217ca54c3Smrg# Copyright (C) 2002-2017 Free Software Foundation, Inc.
226317ca54c3Smrg#
226417ca54c3Smrg# This file is free software; the Free Software Foundation
226517ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
226617ca54c3Smrg# with or without modifications, as long as this notice is preserved.
226717ca54c3Smrg
226817ca54c3Smrg# AM_AUTOMAKE_VERSION(VERSION)
226917ca54c3Smrg# ----------------------------
227017ca54c3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
227117ca54c3Smrg# generated from the m4 files accompanying Automake X.Y.
227217ca54c3Smrg# (This private macro should not be called outside this file.)
227317ca54c3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
227417ca54c3Smrg[am__api_version='1.15'
227517ca54c3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
227617ca54c3Smrgdnl require some minimum version.  Point them to the right macro.
227717ca54c3Smrgm4_if([$1], [1.15.1], [],
227817ca54c3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
227917ca54c3Smrg])
228017ca54c3Smrg
228117ca54c3Smrg# _AM_AUTOCONF_VERSION(VERSION)
228217ca54c3Smrg# -----------------------------
228317ca54c3Smrg# aclocal traces this macro to find the Autoconf version.
228417ca54c3Smrg# This is a private macro too.  Using m4_define simplifies
228517ca54c3Smrg# the logic in aclocal, which can simply ignore this definition.
228617ca54c3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
228717ca54c3Smrg
228817ca54c3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
228917ca54c3Smrg# -------------------------------
229017ca54c3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
229117ca54c3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
229217ca54c3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
229317ca54c3Smrg[AM_AUTOMAKE_VERSION([1.15.1])dnl
229417ca54c3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
229517ca54c3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
229617ca54c3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
229717ca54c3Smrg
229817ca54c3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
229917ca54c3Smrg
230017ca54c3Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
230117ca54c3Smrg#
230217ca54c3Smrg# This file is free software; the Free Software Foundation
230317ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
230417ca54c3Smrg# with or without modifications, as long as this notice is preserved.
230517ca54c3Smrg
230617ca54c3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
230717ca54c3Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
230817ca54c3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
230917ca54c3Smrg#
231017ca54c3Smrg# Of course, Automake must honor this variable whenever it calls a
231117ca54c3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
231217ca54c3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
231317ca54c3Smrg# depending on how configure is run.  This is pretty annoying, since
231417ca54c3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
231517ca54c3Smrg# source directory, any form will work fine, but in subdirectories a
231617ca54c3Smrg# relative path needs to be adjusted first.
231717ca54c3Smrg#
231817ca54c3Smrg# $ac_aux_dir/missing
231917ca54c3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
232017ca54c3Smrg# $top_srcdir/$ac_aux_dir/missing
232117ca54c3Smrg#    fails if $ac_aux_dir is absolute,
232217ca54c3Smrg#    fails when called from a subdirectory in a VPATH build with
232317ca54c3Smrg#          a relative $ac_aux_dir
232417ca54c3Smrg#
232517ca54c3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
232617ca54c3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
232717ca54c3Smrg# harmless because $srcdir is '.', but things will broke when you
232817ca54c3Smrg# start a VPATH build or use an absolute $srcdir.
232917ca54c3Smrg#
233017ca54c3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
233117ca54c3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
233217ca54c3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
233317ca54c3Smrg# and then we would define $MISSING as
233417ca54c3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
233517ca54c3Smrg# This will work as long as MISSING is not called from configure, because
233617ca54c3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
233717ca54c3Smrg# However there are other variables, like CC, which are often used in
233817ca54c3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
233917ca54c3Smrg#
234017ca54c3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
234117ca54c3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
234217ca54c3Smrg# configured tree to be moved without reconfiguration.
234317ca54c3Smrg
234417ca54c3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
234517ca54c3Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
234617ca54c3Smrg# Expand $ac_aux_dir to an absolute path.
234717ca54c3Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
234817ca54c3Smrg])
234917ca54c3Smrg
235017ca54c3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
235117ca54c3Smrg
235217ca54c3Smrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
235317ca54c3Smrg#
235417ca54c3Smrg# This file is free software; the Free Software Foundation
235517ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
235617ca54c3Smrg# with or without modifications, as long as this notice is preserved.
235717ca54c3Smrg
235817ca54c3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
235917ca54c3Smrg# -------------------------------------
236017ca54c3Smrg# Define a conditional.
236117ca54c3SmrgAC_DEFUN([AM_CONDITIONAL],
236217ca54c3Smrg[AC_PREREQ([2.52])dnl
236317ca54c3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
236417ca54c3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
236517ca54c3SmrgAC_SUBST([$1_TRUE])dnl
236617ca54c3SmrgAC_SUBST([$1_FALSE])dnl
236717ca54c3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
236817ca54c3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
236917ca54c3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
237017ca54c3Smrgif $2; then
237117ca54c3Smrg  $1_TRUE=
237217ca54c3Smrg  $1_FALSE='#'
237317ca54c3Smrgelse
237417ca54c3Smrg  $1_TRUE='#'
237517ca54c3Smrg  $1_FALSE=
237617ca54c3Smrgfi
237717ca54c3SmrgAC_CONFIG_COMMANDS_PRE(
237817ca54c3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
237917ca54c3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
238017ca54c3SmrgUsually this means the macro was only invoked conditionally.]])
238117ca54c3Smrgfi])])
238217ca54c3Smrg
238317ca54c3Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
238417ca54c3Smrg#
238517ca54c3Smrg# This file is free software; the Free Software Foundation
238617ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
238717ca54c3Smrg# with or without modifications, as long as this notice is preserved.
238817ca54c3Smrg
238917ca54c3Smrg
239017ca54c3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
239117ca54c3Smrg# written in clear, in which case automake, when reading aclocal.m4,
239217ca54c3Smrg# will think it sees a *use*, and therefore will trigger all it's
239317ca54c3Smrg# C support machinery.  Also note that it means that autoscan, seeing
239417ca54c3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
239517ca54c3Smrg
239617ca54c3Smrg
239717ca54c3Smrg# _AM_DEPENDENCIES(NAME)
239817ca54c3Smrg# ----------------------
239917ca54c3Smrg# See how the compiler implements dependency checking.
240017ca54c3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
240117ca54c3Smrg# We try a few techniques and use that to set a single cache variable.
240217ca54c3Smrg#
240317ca54c3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
240417ca54c3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
240517ca54c3Smrg# dependency, and given that the user is not expected to run this macro,
240617ca54c3Smrg# just rely on AC_PROG_CC.
240717ca54c3SmrgAC_DEFUN([_AM_DEPENDENCIES],
240817ca54c3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
240917ca54c3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
241017ca54c3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
241117ca54c3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
241217ca54c3Smrg
241317ca54c3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
241417ca54c3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
241517ca54c3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
241617ca54c3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
241717ca54c3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
241817ca54c3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
241917ca54c3Smrg                    [depcc="$$1"   am_compiler_list=])
242017ca54c3Smrg
242117ca54c3SmrgAC_CACHE_CHECK([dependency style of $depcc],
242217ca54c3Smrg               [am_cv_$1_dependencies_compiler_type],
242317ca54c3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
242417ca54c3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
242517ca54c3Smrg  # making bogus files that we don't know about and never remove.  For
242617ca54c3Smrg  # instance it was reported that on HP-UX the gcc test will end up
242717ca54c3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
242817ca54c3Smrg  # in D".
242917ca54c3Smrg  rm -rf conftest.dir
243017ca54c3Smrg  mkdir conftest.dir
243117ca54c3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
243217ca54c3Smrg  # using a relative directory.
243317ca54c3Smrg  cp "$am_depcomp" conftest.dir
243417ca54c3Smrg  cd conftest.dir
243517ca54c3Smrg  # We will build objects and dependencies in a subdirectory because
243617ca54c3Smrg  # it helps to detect inapplicable dependency modes.  For instance
243717ca54c3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
243817ca54c3Smrg  # side effect of compilation, but ICC will put the dependencies in
243917ca54c3Smrg  # the current directory while Tru64 will put them in the object
244017ca54c3Smrg  # directory.
244117ca54c3Smrg  mkdir sub
244217ca54c3Smrg
244317ca54c3Smrg  am_cv_$1_dependencies_compiler_type=none
244417ca54c3Smrg  if test "$am_compiler_list" = ""; then
244517ca54c3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
244617ca54c3Smrg  fi
244717ca54c3Smrg  am__universal=false
244817ca54c3Smrg  m4_case([$1], [CC],
244917ca54c3Smrg    [case " $depcc " in #(
245017ca54c3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
245117ca54c3Smrg     esac],
245217ca54c3Smrg    [CXX],
245317ca54c3Smrg    [case " $depcc " in #(
245417ca54c3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
245517ca54c3Smrg     esac])
245617ca54c3Smrg
245717ca54c3Smrg  for depmode in $am_compiler_list; do
245817ca54c3Smrg    # Setup a source with many dependencies, because some compilers
245917ca54c3Smrg    # like to wrap large dependency lists on column 80 (with \), and
246017ca54c3Smrg    # we should not choose a depcomp mode which is confused by this.
246117ca54c3Smrg    #
246217ca54c3Smrg    # We need to recreate these files for each test, as the compiler may
246317ca54c3Smrg    # overwrite some of them when testing with obscure command lines.
246417ca54c3Smrg    # This happens at least with the AIX C compiler.
246517ca54c3Smrg    : > sub/conftest.c
246617ca54c3Smrg    for i in 1 2 3 4 5 6; do
246717ca54c3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
246817ca54c3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
246917ca54c3Smrg      # Solaris 10 /bin/sh.
247017ca54c3Smrg      echo '/* dummy */' > sub/conftst$i.h
247117ca54c3Smrg    done
247217ca54c3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
247317ca54c3Smrg
247417ca54c3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
247517ca54c3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
247617ca54c3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
247717ca54c3Smrg    # versions had trouble with output in subdirs.
247817ca54c3Smrg    am__obj=sub/conftest.${OBJEXT-o}
247917ca54c3Smrg    am__minus_obj="-o $am__obj"
248017ca54c3Smrg    case $depmode in
248117ca54c3Smrg    gcc)
248217ca54c3Smrg      # This depmode causes a compiler race in universal mode.
248317ca54c3Smrg      test "$am__universal" = false || continue
248417ca54c3Smrg      ;;
248517ca54c3Smrg    nosideeffect)
248617ca54c3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248717ca54c3Smrg      # only be used when explicitly requested.
248817ca54c3Smrg      if test "x$enable_dependency_tracking" = xyes; then
248917ca54c3Smrg	continue
249017ca54c3Smrg      else
249117ca54c3Smrg	break
249217ca54c3Smrg      fi
249317ca54c3Smrg      ;;
249417ca54c3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
249517ca54c3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
249617ca54c3Smrg      # not run yet.  These depmodes are late enough in the game, and
249717ca54c3Smrg      # so weak that their functioning should not be impacted.
249817ca54c3Smrg      am__obj=conftest.${OBJEXT-o}
249917ca54c3Smrg      am__minus_obj=
250017ca54c3Smrg      ;;
250117ca54c3Smrg    none) break ;;
250217ca54c3Smrg    esac
250317ca54c3Smrg    if depmode=$depmode \
250417ca54c3Smrg       source=sub/conftest.c object=$am__obj \
250517ca54c3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
250617ca54c3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
250717ca54c3Smrg         >/dev/null 2>conftest.err &&
250817ca54c3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
250917ca54c3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
251017ca54c3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
251117ca54c3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
251217ca54c3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
251317ca54c3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
251417ca54c3Smrg      # that says an option was ignored or not supported.
251517ca54c3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
251617ca54c3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
251717ca54c3Smrg      # The diagnosis changed in icc 8.0:
251817ca54c3Smrg      #   icc: Command line remark: option '-MP' not supported
251917ca54c3Smrg      if (grep 'ignoring option' conftest.err ||
252017ca54c3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
252117ca54c3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
252217ca54c3Smrg        break
252317ca54c3Smrg      fi
252417ca54c3Smrg    fi
252517ca54c3Smrg  done
252617ca54c3Smrg
252717ca54c3Smrg  cd ..
252817ca54c3Smrg  rm -rf conftest.dir
252917ca54c3Smrgelse
253017ca54c3Smrg  am_cv_$1_dependencies_compiler_type=none
253117ca54c3Smrgfi
253217ca54c3Smrg])
253317ca54c3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
253417ca54c3SmrgAM_CONDITIONAL([am__fastdep$1], [
253517ca54c3Smrg  test "x$enable_dependency_tracking" != xno \
253617ca54c3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
253717ca54c3Smrg])
253817ca54c3Smrg
253917ca54c3Smrg
254017ca54c3Smrg# AM_SET_DEPDIR
254117ca54c3Smrg# -------------
254217ca54c3Smrg# Choose a directory name for dependency files.
254317ca54c3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
254417ca54c3SmrgAC_DEFUN([AM_SET_DEPDIR],
254517ca54c3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
254617ca54c3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
254717ca54c3Smrg])
254817ca54c3Smrg
254917ca54c3Smrg
255017ca54c3Smrg# AM_DEP_TRACK
255117ca54c3Smrg# ------------
255217ca54c3SmrgAC_DEFUN([AM_DEP_TRACK],
255317ca54c3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
255417ca54c3SmrgAS_HELP_STRING(
255517ca54c3Smrg  [--enable-dependency-tracking],
255617ca54c3Smrg  [do not reject slow dependency extractors])
255717ca54c3SmrgAS_HELP_STRING(
255817ca54c3Smrg  [--disable-dependency-tracking],
255917ca54c3Smrg  [speeds up one-time build])])
256017ca54c3Smrgif test "x$enable_dependency_tracking" != xno; then
256117ca54c3Smrg  am_depcomp="$ac_aux_dir/depcomp"
256217ca54c3Smrg  AMDEPBACKSLASH='\'
256317ca54c3Smrg  am__nodep='_no'
256417ca54c3Smrgfi
256517ca54c3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
256617ca54c3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
256717ca54c3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
256817ca54c3SmrgAC_SUBST([am__nodep])dnl
256917ca54c3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
257017ca54c3Smrg])
257117ca54c3Smrg
257217ca54c3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
257317ca54c3Smrg
257417ca54c3Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
257517ca54c3Smrg#
257617ca54c3Smrg# This file is free software; the Free Software Foundation
257717ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
257817ca54c3Smrg# with or without modifications, as long as this notice is preserved.
257917ca54c3Smrg
258017ca54c3Smrg
258117ca54c3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
258217ca54c3Smrg# ------------------------------
258317ca54c3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
258417ca54c3Smrg[{
258517ca54c3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
258617ca54c3Smrg  # are listed without --file.  Let's play safe and only enable the eval
258717ca54c3Smrg  # if we detect the quoting.
258817ca54c3Smrg  case $CONFIG_FILES in
258917ca54c3Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
259017ca54c3Smrg  *)   set x $CONFIG_FILES ;;
259117ca54c3Smrg  esac
259217ca54c3Smrg  shift
259317ca54c3Smrg  for mf
259417ca54c3Smrg  do
259517ca54c3Smrg    # Strip MF so we end up with the name of the file.
259617ca54c3Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
259717ca54c3Smrg    # Check whether this is an Automake generated Makefile or not.
259817ca54c3Smrg    # We used to match only the files named 'Makefile.in', but
259917ca54c3Smrg    # some people rename them; so instead we look at the file content.
260017ca54c3Smrg    # Grep'ing the first line is not enough: some people post-process
260117ca54c3Smrg    # each Makefile.in and add a new line on top of each file to say so.
260217ca54c3Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
260317ca54c3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
260417ca54c3Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
260517ca54c3Smrg      dirpart=`AS_DIRNAME("$mf")`
260617ca54c3Smrg    else
260717ca54c3Smrg      continue
260817ca54c3Smrg    fi
260917ca54c3Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
261017ca54c3Smrg    # from the Makefile without running 'make'.
261117ca54c3Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
261217ca54c3Smrg    test -z "$DEPDIR" && continue
261317ca54c3Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
261417ca54c3Smrg    test -z "$am__include" && continue
261517ca54c3Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
261617ca54c3Smrg    # Find all dependency output files, they are included files with
261717ca54c3Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
261817ca54c3Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
261917ca54c3Smrg    # expansion.
262017ca54c3Smrg    for file in `sed -n "
262117ca54c3Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
262217ca54c3Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
262317ca54c3Smrg      # Make sure the directory exists.
262417ca54c3Smrg      test -f "$dirpart/$file" && continue
262517ca54c3Smrg      fdir=`AS_DIRNAME(["$file"])`
262617ca54c3Smrg      AS_MKDIR_P([$dirpart/$fdir])
262717ca54c3Smrg      # echo "creating $dirpart/$file"
262817ca54c3Smrg      echo '# dummy' > "$dirpart/$file"
262917ca54c3Smrg    done
263017ca54c3Smrg  done
263117ca54c3Smrg}
263217ca54c3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
263317ca54c3Smrg
263417ca54c3Smrg
263517ca54c3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
263617ca54c3Smrg# -----------------------------
263717ca54c3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
263817ca54c3Smrg#
263917ca54c3Smrg# This code is only required when automatic dependency tracking
264017ca54c3Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
264117ca54c3Smrg# need in order to bootstrap the dependency handling code.
264217ca54c3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
264317ca54c3Smrg[AC_CONFIG_COMMANDS([depfiles],
264417ca54c3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
264517ca54c3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
264617ca54c3Smrg])
264717ca54c3Smrg
264817ca54c3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
264917ca54c3Smrg
265017ca54c3Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
265117ca54c3Smrg#
265217ca54c3Smrg# This file is free software; the Free Software Foundation
265317ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
265417ca54c3Smrg# with or without modifications, as long as this notice is preserved.
265517ca54c3Smrg
265617ca54c3Smrg# This macro actually does too much.  Some checks are only needed if
265717ca54c3Smrg# your package does certain things.  But this isn't really a big deal.
265817ca54c3Smrg
265917ca54c3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
266017ca54c3Smrgm4_define([AC_PROG_CC],
266117ca54c3Smrgm4_defn([AC_PROG_CC])
266217ca54c3Smrg[_AM_PROG_CC_C_O
266317ca54c3Smrg])
266417ca54c3Smrg
266517ca54c3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
266617ca54c3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
266717ca54c3Smrg# -----------------------------------------------
266817ca54c3Smrg# The call with PACKAGE and VERSION arguments is the old style
266917ca54c3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
267017ca54c3Smrg# and VERSION should now be passed to AC_INIT and removed from
267117ca54c3Smrg# the call to AM_INIT_AUTOMAKE.
267217ca54c3Smrg# We support both call styles for the transition.  After
267317ca54c3Smrg# the next Automake release, Autoconf can make the AC_INIT
267417ca54c3Smrg# arguments mandatory, and then we can depend on a new Autoconf
267517ca54c3Smrg# release and drop the old call support.
267617ca54c3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
267717ca54c3Smrg[AC_PREREQ([2.65])dnl
267817ca54c3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
267917ca54c3Smrgdnl the ones we care about.
268017ca54c3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
268117ca54c3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
268217ca54c3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
268317ca54c3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
268417ca54c3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
268517ca54c3Smrg  # is not polluted with repeated "-I."
268617ca54c3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
268717ca54c3Smrg  # test to see if srcdir already configured
268817ca54c3Smrg  if test -f $srcdir/config.status; then
268917ca54c3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
269017ca54c3Smrg  fi
269117ca54c3Smrgfi
269217ca54c3Smrg
269317ca54c3Smrg# test whether we have cygpath
269417ca54c3Smrgif test -z "$CYGPATH_W"; then
269517ca54c3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
269617ca54c3Smrg    CYGPATH_W='cygpath -w'
269717ca54c3Smrg  else
269817ca54c3Smrg    CYGPATH_W=echo
269917ca54c3Smrg  fi
270017ca54c3Smrgfi
270117ca54c3SmrgAC_SUBST([CYGPATH_W])
270217ca54c3Smrg
270317ca54c3Smrg# Define the identity of the package.
270417ca54c3Smrgdnl Distinguish between old-style and new-style calls.
270517ca54c3Smrgm4_ifval([$2],
270617ca54c3Smrg[AC_DIAGNOSE([obsolete],
270717ca54c3Smrg             [$0: two- and three-arguments forms are deprecated.])
270817ca54c3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
270917ca54c3Smrg AC_SUBST([PACKAGE], [$1])dnl
271017ca54c3Smrg AC_SUBST([VERSION], [$2])],
271117ca54c3Smrg[_AM_SET_OPTIONS([$1])dnl
271217ca54c3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
271317ca54c3Smrgm4_if(
271417ca54c3Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
271517ca54c3Smrg  [ok:ok],,
271617ca54c3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
271717ca54c3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
271817ca54c3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
271917ca54c3Smrg
272017ca54c3Smrg_AM_IF_OPTION([no-define],,
272117ca54c3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
272217ca54c3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
272317ca54c3Smrg
272417ca54c3Smrg# Some tools Automake needs.
272517ca54c3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
272617ca54c3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
272717ca54c3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
272817ca54c3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
272917ca54c3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
273017ca54c3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
273117ca54c3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
273217ca54c3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
273317ca54c3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
273417ca54c3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
273517ca54c3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
273617ca54c3Smrg# dies out for good.  For more background, see:
273717ca54c3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
273817ca54c3Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
273917ca54c3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
274017ca54c3Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
274117ca54c3Smrg# system "awk" is bad on some platforms.
274217ca54c3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
274317ca54c3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
274417ca54c3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
274517ca54c3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
274617ca54c3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
274717ca54c3Smrg			     [_AM_PROG_TAR([v7])])])
274817ca54c3Smrg_AM_IF_OPTION([no-dependencies],,
274917ca54c3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
275017ca54c3Smrg		  [_AM_DEPENDENCIES([CC])],
275117ca54c3Smrg		  [m4_define([AC_PROG_CC],
275217ca54c3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
275317ca54c3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
275417ca54c3Smrg		  [_AM_DEPENDENCIES([CXX])],
275517ca54c3Smrg		  [m4_define([AC_PROG_CXX],
275617ca54c3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
275717ca54c3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
275817ca54c3Smrg		  [_AM_DEPENDENCIES([OBJC])],
275917ca54c3Smrg		  [m4_define([AC_PROG_OBJC],
276017ca54c3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
276117ca54c3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
276217ca54c3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
276317ca54c3Smrg		  [m4_define([AC_PROG_OBJCXX],
276417ca54c3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
276517ca54c3Smrg])
276617ca54c3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
276717ca54c3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
276817ca54c3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
276917ca54c3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
277017ca54c3SmrgAC_CONFIG_COMMANDS_PRE(dnl
277117ca54c3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
277217ca54c3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
277317ca54c3Smrg
277417ca54c3Smrg# POSIX will say in a future version that running "rm -f" with no argument
277517ca54c3Smrg# is OK; and we want to be able to make that assumption in our Makefile
277617ca54c3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
277717ca54c3Smrg# actually supported "in the wild" to an acceptable degree.
277817ca54c3Smrg# See automake bug#10828.
277917ca54c3Smrg# To make any issue more visible, cause the running configure to be aborted
278017ca54c3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
278117ca54c3Smrg# user can still override this though.
278217ca54c3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
278317ca54c3Smrg  cat >&2 <<'END'
278417ca54c3SmrgOops!
278517ca54c3Smrg
278617ca54c3SmrgYour 'rm' program seems unable to run without file operands specified
278717ca54c3Smrgon the command line, even when the '-f' option is present.  This is contrary
278817ca54c3Smrgto the behaviour of most rm programs out there, and not conforming with
278917ca54c3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
279017ca54c3Smrg
279117ca54c3SmrgPlease tell bug-automake@gnu.org about your system, including the value
279217ca54c3Smrgof your $PATH and any error possibly output before this message.  This
279317ca54c3Smrgcan help us improve future automake versions.
279417ca54c3Smrg
279517ca54c3SmrgEND
279617ca54c3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
279717ca54c3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
279817ca54c3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
279917ca54c3Smrg    echo >&2
280017ca54c3Smrg  else
280117ca54c3Smrg    cat >&2 <<'END'
280217ca54c3SmrgAborting the configuration process, to ensure you take notice of the issue.
280317ca54c3Smrg
280417ca54c3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
280517ca54c3Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
280617ca54c3Smrg
280717ca54c3SmrgIf you want to complete the configuration process using your problematic
280817ca54c3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
280917ca54c3Smrgto "yes", and re-run configure.
281017ca54c3Smrg
281117ca54c3SmrgEND
281217ca54c3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
281317ca54c3Smrg  fi
281417ca54c3Smrgfi
281517ca54c3Smrgdnl The trailing newline in this macro's definition is deliberate, for
281617ca54c3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
281717ca54c3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
281817ca54c3Smrg])
281917ca54c3Smrg
282017ca54c3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
282117ca54c3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
282217ca54c3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
282317ca54c3Smrgm4_define([_AC_COMPILER_EXEEXT],
282417ca54c3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
282517ca54c3Smrg
282617ca54c3Smrg# When config.status generates a header, we must update the stamp-h file.
282717ca54c3Smrg# This file resides in the same directory as the config header
282817ca54c3Smrg# that is generated.  The stamp files are numbered to have different names.
282917ca54c3Smrg
283017ca54c3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
283117ca54c3Smrg# loop where config.status creates the headers, so we can generate
283217ca54c3Smrg# our stamp files there.
283317ca54c3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
283417ca54c3Smrg[# Compute $1's index in $config_headers.
283517ca54c3Smrg_am_arg=$1
283617ca54c3Smrg_am_stamp_count=1
283717ca54c3Smrgfor _am_header in $config_headers :; do
283817ca54c3Smrg  case $_am_header in
283917ca54c3Smrg    $_am_arg | $_am_arg:* )
284017ca54c3Smrg      break ;;
284117ca54c3Smrg    * )
284217ca54c3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
284317ca54c3Smrg  esac
284417ca54c3Smrgdone
284517ca54c3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
284617ca54c3Smrg
284717ca54c3Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
284817ca54c3Smrg#
284917ca54c3Smrg# This file is free software; the Free Software Foundation
285017ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
285117ca54c3Smrg# with or without modifications, as long as this notice is preserved.
285217ca54c3Smrg
285317ca54c3Smrg# AM_PROG_INSTALL_SH
285417ca54c3Smrg# ------------------
285517ca54c3Smrg# Define $install_sh.
285617ca54c3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
285717ca54c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
285817ca54c3Smrgif test x"${install_sh+set}" != xset; then
285917ca54c3Smrg  case $am_aux_dir in
286017ca54c3Smrg  *\ * | *\	*)
286117ca54c3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
286217ca54c3Smrg  *)
286317ca54c3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
286417ca54c3Smrg  esac
286517ca54c3Smrgfi
286617ca54c3SmrgAC_SUBST([install_sh])])
286717ca54c3Smrg
286817ca54c3Smrg# Copyright (C) 2003-2017 Free Software Foundation, Inc.
286917ca54c3Smrg#
287017ca54c3Smrg# This file is free software; the Free Software Foundation
287117ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
287217ca54c3Smrg# with or without modifications, as long as this notice is preserved.
287317ca54c3Smrg
287417ca54c3Smrg# Check whether the underlying file-system supports filenames
287517ca54c3Smrg# with a leading dot.  For instance MS-DOS doesn't.
287617ca54c3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
287717ca54c3Smrg[rm -rf .tst 2>/dev/null
287817ca54c3Smrgmkdir .tst 2>/dev/null
287917ca54c3Smrgif test -d .tst; then
288017ca54c3Smrg  am__leading_dot=.
288117ca54c3Smrgelse
288217ca54c3Smrg  am__leading_dot=_
288317ca54c3Smrgfi
288417ca54c3Smrgrmdir .tst 2>/dev/null
288517ca54c3SmrgAC_SUBST([am__leading_dot])])
288617ca54c3Smrg
288717ca54c3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
288817ca54c3Smrg
288917ca54c3Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
289017ca54c3Smrg#
289117ca54c3Smrg# This file is free software; the Free Software Foundation
289217ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
289317ca54c3Smrg# with or without modifications, as long as this notice is preserved.
289417ca54c3Smrg
289517ca54c3Smrg# AM_MAKE_INCLUDE()
289617ca54c3Smrg# -----------------
289717ca54c3Smrg# Check to see how make treats includes.
289817ca54c3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
289917ca54c3Smrg[am_make=${MAKE-make}
290017ca54c3Smrgcat > confinc << 'END'
290117ca54c3Smrgam__doit:
290217ca54c3Smrg	@echo this is the am__doit target
290317ca54c3Smrg.PHONY: am__doit
290417ca54c3SmrgEND
290517ca54c3Smrg# If we don't find an include directive, just comment out the code.
290617ca54c3SmrgAC_MSG_CHECKING([for style of include used by $am_make])
290717ca54c3Smrgam__include="#"
290817ca54c3Smrgam__quote=
290917ca54c3Smrg_am_result=none
291017ca54c3Smrg# First try GNU make style include.
291117ca54c3Smrgecho "include confinc" > confmf
291217ca54c3Smrg# Ignore all kinds of additional output from 'make'.
291317ca54c3Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
291417ca54c3Smrg*the\ am__doit\ target*)
291517ca54c3Smrg  am__include=include
291617ca54c3Smrg  am__quote=
291717ca54c3Smrg  _am_result=GNU
291817ca54c3Smrg  ;;
291917ca54c3Smrgesac
292017ca54c3Smrg# Now try BSD make style include.
292117ca54c3Smrgif test "$am__include" = "#"; then
292217ca54c3Smrg   echo '.include "confinc"' > confmf
292317ca54c3Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
292417ca54c3Smrg   *the\ am__doit\ target*)
292517ca54c3Smrg     am__include=.include
292617ca54c3Smrg     am__quote="\""
292717ca54c3Smrg     _am_result=BSD
292817ca54c3Smrg     ;;
292917ca54c3Smrg   esac
293017ca54c3Smrgfi
293117ca54c3SmrgAC_SUBST([am__include])
293217ca54c3SmrgAC_SUBST([am__quote])
293317ca54c3SmrgAC_MSG_RESULT([$_am_result])
293417ca54c3Smrgrm -f confinc confmf
293517ca54c3Smrg])
293617ca54c3Smrg
293717ca54c3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
293817ca54c3Smrg
293917ca54c3Smrg# Copyright (C) 1997-2017 Free Software Foundation, Inc.
294017ca54c3Smrg#
294117ca54c3Smrg# This file is free software; the Free Software Foundation
294217ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
294317ca54c3Smrg# with or without modifications, as long as this notice is preserved.
294417ca54c3Smrg
294517ca54c3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
294617ca54c3Smrg# ------------------------------
294717ca54c3SmrgAC_DEFUN([AM_MISSING_PROG],
294817ca54c3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
294917ca54c3Smrg$1=${$1-"${am_missing_run}$2"}
295017ca54c3SmrgAC_SUBST($1)])
295117ca54c3Smrg
295217ca54c3Smrg# AM_MISSING_HAS_RUN
295317ca54c3Smrg# ------------------
295417ca54c3Smrg# Define MISSING if not defined so far and test if it is modern enough.
295517ca54c3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
295617ca54c3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
295717ca54c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
295817ca54c3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
295917ca54c3Smrgif test x"${MISSING+set}" != xset; then
296017ca54c3Smrg  case $am_aux_dir in
296117ca54c3Smrg  *\ * | *\	*)
296217ca54c3Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
296317ca54c3Smrg  *)
296417ca54c3Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
296517ca54c3Smrg  esac
296617ca54c3Smrgfi
296717ca54c3Smrg# Use eval to expand $SHELL
296817ca54c3Smrgif eval "$MISSING --is-lightweight"; then
296917ca54c3Smrg  am_missing_run="$MISSING "
297017ca54c3Smrgelse
297117ca54c3Smrg  am_missing_run=
297217ca54c3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
297317ca54c3Smrgfi
297417ca54c3Smrg])
297517ca54c3Smrg
297617ca54c3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
297717ca54c3Smrg
297817ca54c3Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
297917ca54c3Smrg#
298017ca54c3Smrg# This file is free software; the Free Software Foundation
298117ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
298217ca54c3Smrg# with or without modifications, as long as this notice is preserved.
298317ca54c3Smrg
298417ca54c3Smrg# _AM_MANGLE_OPTION(NAME)
298517ca54c3Smrg# -----------------------
298617ca54c3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
298717ca54c3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
298817ca54c3Smrg
298917ca54c3Smrg# _AM_SET_OPTION(NAME)
299017ca54c3Smrg# --------------------
299117ca54c3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
299217ca54c3SmrgAC_DEFUN([_AM_SET_OPTION],
299317ca54c3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
299417ca54c3Smrg
299517ca54c3Smrg# _AM_SET_OPTIONS(OPTIONS)
299617ca54c3Smrg# ------------------------
299717ca54c3Smrg# OPTIONS is a space-separated list of Automake options.
299817ca54c3SmrgAC_DEFUN([_AM_SET_OPTIONS],
299917ca54c3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
300017ca54c3Smrg
300117ca54c3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
300217ca54c3Smrg# -------------------------------------------
300317ca54c3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
300417ca54c3SmrgAC_DEFUN([_AM_IF_OPTION],
300517ca54c3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
300617ca54c3Smrg
300717ca54c3Smrg# Copyright (C) 1999-2017 Free Software Foundation, Inc.
300817ca54c3Smrg#
300917ca54c3Smrg# This file is free software; the Free Software Foundation
301017ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
301117ca54c3Smrg# with or without modifications, as long as this notice is preserved.
301217ca54c3Smrg
301317ca54c3Smrg# _AM_PROG_CC_C_O
301417ca54c3Smrg# ---------------
301517ca54c3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
301617ca54c3Smrg# to automatically call this.
301717ca54c3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
301817ca54c3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
301917ca54c3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
302017ca54c3SmrgAC_LANG_PUSH([C])dnl
302117ca54c3SmrgAC_CACHE_CHECK(
302217ca54c3Smrg  [whether $CC understands -c and -o together],
302317ca54c3Smrg  [am_cv_prog_cc_c_o],
302417ca54c3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
302517ca54c3Smrg  # Make sure it works both with $CC and with simple cc.
302617ca54c3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
302717ca54c3Smrg  # compilers refuse to overwrite an existing .o file with -o,
302817ca54c3Smrg  # though they will create one.
302917ca54c3Smrg  am_cv_prog_cc_c_o=yes
303017ca54c3Smrg  for am_i in 1 2; do
303117ca54c3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
303217ca54c3Smrg         && test -f conftest2.$ac_objext; then
303317ca54c3Smrg      : OK
303417ca54c3Smrg    else
303517ca54c3Smrg      am_cv_prog_cc_c_o=no
303617ca54c3Smrg      break
303717ca54c3Smrg    fi
303817ca54c3Smrg  done
303917ca54c3Smrg  rm -f core conftest*
304017ca54c3Smrg  unset am_i])
304117ca54c3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
304217ca54c3Smrg   # Losing compiler, so override with the script.
304317ca54c3Smrg   # FIXME: It is wrong to rewrite CC.
304417ca54c3Smrg   # But if we don't then we get into trouble of one sort or another.
304517ca54c3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
304617ca54c3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
304717ca54c3Smrg   CC="$am_aux_dir/compile $CC"
304817ca54c3Smrgfi
304917ca54c3SmrgAC_LANG_POP([C])])
305017ca54c3Smrg
305117ca54c3Smrg# For backward compatibility.
305217ca54c3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
305317ca54c3Smrg
305417ca54c3Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
305517ca54c3Smrg#
305617ca54c3Smrg# This file is free software; the Free Software Foundation
305717ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
305817ca54c3Smrg# with or without modifications, as long as this notice is preserved.
305917ca54c3Smrg
306017ca54c3Smrg# AM_RUN_LOG(COMMAND)
306117ca54c3Smrg# -------------------
306217ca54c3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
306317ca54c3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
306417ca54c3SmrgAC_DEFUN([AM_RUN_LOG],
306517ca54c3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
306617ca54c3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
306717ca54c3Smrg   ac_status=$?
306817ca54c3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
306917ca54c3Smrg   (exit $ac_status); }])
307017ca54c3Smrg
307117ca54c3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
307217ca54c3Smrg
307317ca54c3Smrg# Copyright (C) 1996-2017 Free Software Foundation, Inc.
307417ca54c3Smrg#
307517ca54c3Smrg# This file is free software; the Free Software Foundation
307617ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
307717ca54c3Smrg# with or without modifications, as long as this notice is preserved.
307817ca54c3Smrg
307917ca54c3Smrg# AM_SANITY_CHECK
308017ca54c3Smrg# ---------------
308117ca54c3SmrgAC_DEFUN([AM_SANITY_CHECK],
308217ca54c3Smrg[AC_MSG_CHECKING([whether build environment is sane])
308317ca54c3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
308417ca54c3Smrg# name.  Accept space and tab only in the latter.
308517ca54c3Smrgam_lf='
308617ca54c3Smrg'
308717ca54c3Smrgcase `pwd` in
308817ca54c3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
308917ca54c3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
309017ca54c3Smrgesac
309117ca54c3Smrgcase $srcdir in
309217ca54c3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
309317ca54c3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
309417ca54c3Smrgesac
309517ca54c3Smrg
309617ca54c3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
309717ca54c3Smrg# arguments.  Must try -L first in case configure is actually a
309817ca54c3Smrg# symlink; some systems play weird games with the mod time of symlinks
309917ca54c3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
310017ca54c3Smrg# directory).
310117ca54c3Smrgif (
310217ca54c3Smrg   am_has_slept=no
310317ca54c3Smrg   for am_try in 1 2; do
310417ca54c3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
310517ca54c3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
310617ca54c3Smrg     if test "$[*]" = "X"; then
310717ca54c3Smrg	# -L didn't work.
310817ca54c3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
310917ca54c3Smrg     fi
311017ca54c3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
311117ca54c3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
311217ca54c3Smrg
311317ca54c3Smrg	# If neither matched, then we have a broken ls.  This can happen
311417ca54c3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
311517ca54c3Smrg	# broken ls alias from the environment.  This has actually
311617ca54c3Smrg	# happened.  Such a system could not be considered "sane".
311717ca54c3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
311817ca54c3Smrg  alias in your environment])
311917ca54c3Smrg     fi
312017ca54c3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
312117ca54c3Smrg       break
312217ca54c3Smrg     fi
312317ca54c3Smrg     # Just in case.
312417ca54c3Smrg     sleep 1
312517ca54c3Smrg     am_has_slept=yes
312617ca54c3Smrg   done
312717ca54c3Smrg   test "$[2]" = conftest.file
312817ca54c3Smrg   )
312917ca54c3Smrgthen
313017ca54c3Smrg   # Ok.
313117ca54c3Smrg   :
313217ca54c3Smrgelse
313317ca54c3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
313417ca54c3SmrgCheck your system clock])
313517ca54c3Smrgfi
313617ca54c3SmrgAC_MSG_RESULT([yes])
313717ca54c3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
313817ca54c3Smrg# generated files are strictly newer.
313917ca54c3Smrgam_sleep_pid=
314017ca54c3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
314117ca54c3Smrg  ( sleep 1 ) &
314217ca54c3Smrg  am_sleep_pid=$!
314317ca54c3Smrgfi
314417ca54c3SmrgAC_CONFIG_COMMANDS_PRE(
314517ca54c3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
314617ca54c3Smrg   if test -n "$am_sleep_pid"; then
314717ca54c3Smrg     # Hide warnings about reused PIDs.
314817ca54c3Smrg     wait $am_sleep_pid 2>/dev/null
314917ca54c3Smrg   fi
315017ca54c3Smrg   AC_MSG_RESULT([done])])
315117ca54c3Smrgrm -f conftest.file
315217ca54c3Smrg])
315317ca54c3Smrg
315417ca54c3Smrg# Copyright (C) 2009-2017 Free Software Foundation, Inc.
315517ca54c3Smrg#
315617ca54c3Smrg# This file is free software; the Free Software Foundation
315717ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
315817ca54c3Smrg# with or without modifications, as long as this notice is preserved.
315917ca54c3Smrg
316017ca54c3Smrg# AM_SILENT_RULES([DEFAULT])
316117ca54c3Smrg# --------------------------
316217ca54c3Smrg# Enable less verbose build rules; with the default set to DEFAULT
316317ca54c3Smrg# ("yes" being less verbose, "no" or empty being verbose).
316417ca54c3SmrgAC_DEFUN([AM_SILENT_RULES],
316517ca54c3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
316617ca54c3SmrgAS_HELP_STRING(
316717ca54c3Smrg  [--enable-silent-rules],
316817ca54c3Smrg  [less verbose build output (undo: "make V=1")])
316917ca54c3SmrgAS_HELP_STRING(
317017ca54c3Smrg  [--disable-silent-rules],
317117ca54c3Smrg  [verbose build output (undo: "make V=0")])dnl
317217ca54c3Smrg])
317317ca54c3Smrgcase $enable_silent_rules in @%:@ (((
317417ca54c3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
317517ca54c3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
317617ca54c3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
317717ca54c3Smrgesac
317817ca54c3Smrgdnl
317917ca54c3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
318017ca54c3Smrgdnl do not support nested variable expansions.
318117ca54c3Smrgdnl See automake bug#9928 and bug#10237.
318217ca54c3Smrgam_make=${MAKE-make}
318317ca54c3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
318417ca54c3Smrg   [am_cv_make_support_nested_variables],
318517ca54c3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
318617ca54c3SmrgBAR0=false
318717ca54c3SmrgBAR1=true
318817ca54c3SmrgV=1
318917ca54c3Smrgam__doit:
319017ca54c3Smrg	@$(TRUE)
319117ca54c3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
319217ca54c3Smrg  am_cv_make_support_nested_variables=yes
319317ca54c3Smrgelse
319417ca54c3Smrg  am_cv_make_support_nested_variables=no
319517ca54c3Smrgfi])
319617ca54c3Smrgif test $am_cv_make_support_nested_variables = yes; then
319717ca54c3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
319817ca54c3Smrg  AM_V='$(V)'
319917ca54c3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
320017ca54c3Smrgelse
320117ca54c3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
320217ca54c3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
320317ca54c3Smrgfi
320417ca54c3SmrgAC_SUBST([AM_V])dnl
320517ca54c3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
320617ca54c3SmrgAC_SUBST([AM_DEFAULT_V])dnl
320717ca54c3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
320817ca54c3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
320917ca54c3SmrgAM_BACKSLASH='\'
321017ca54c3SmrgAC_SUBST([AM_BACKSLASH])dnl
321117ca54c3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
321217ca54c3Smrg])
321317ca54c3Smrg
321417ca54c3Smrg# Copyright (C) 2001-2017 Free Software Foundation, Inc.
321517ca54c3Smrg#
321617ca54c3Smrg# This file is free software; the Free Software Foundation
321717ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
321817ca54c3Smrg# with or without modifications, as long as this notice is preserved.
321917ca54c3Smrg
322017ca54c3Smrg# AM_PROG_INSTALL_STRIP
322117ca54c3Smrg# ---------------------
322217ca54c3Smrg# One issue with vendor 'install' (even GNU) is that you can't
322317ca54c3Smrg# specify the program used to strip binaries.  This is especially
322417ca54c3Smrg# annoying in cross-compiling environments, where the build's strip
322517ca54c3Smrg# is unlikely to handle the host's binaries.
322617ca54c3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
322717ca54c3Smrg# always use install-sh in "make install-strip", and initialize
322817ca54c3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
322917ca54c3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
323017ca54c3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
323117ca54c3Smrg# Installed binaries are usually stripped using 'strip' when the user
323217ca54c3Smrg# run "make install-strip".  However 'strip' might not be the right
323317ca54c3Smrg# tool to use in cross-compilation environments, therefore Automake
323417ca54c3Smrg# will honor the 'STRIP' environment variable to overrule this program.
323517ca54c3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
323617ca54c3Smrgif test "$cross_compiling" != no; then
323717ca54c3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
323817ca54c3Smrgfi
323917ca54c3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
324017ca54c3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
324117ca54c3Smrg
324217ca54c3Smrg# Copyright (C) 2006-2017 Free Software Foundation, Inc.
324317ca54c3Smrg#
324417ca54c3Smrg# This file is free software; the Free Software Foundation
324517ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
324617ca54c3Smrg# with or without modifications, as long as this notice is preserved.
324717ca54c3Smrg
324817ca54c3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
324917ca54c3Smrg# ---------------------------
325017ca54c3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
325117ca54c3Smrg# This macro is traced by Automake.
325217ca54c3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
325317ca54c3Smrg
325417ca54c3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
325517ca54c3Smrg# --------------------------
325617ca54c3Smrg# Public sister of _AM_SUBST_NOTMAKE.
325717ca54c3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
325817ca54c3Smrg
325917ca54c3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
326017ca54c3Smrg
326117ca54c3Smrg# Copyright (C) 2004-2017 Free Software Foundation, Inc.
326217ca54c3Smrg#
326317ca54c3Smrg# This file is free software; the Free Software Foundation
326417ca54c3Smrg# gives unlimited permission to copy and/or distribute it,
326517ca54c3Smrg# with or without modifications, as long as this notice is preserved.
326617ca54c3Smrg
326717ca54c3Smrg# _AM_PROG_TAR(FORMAT)
326817ca54c3Smrg# --------------------
326917ca54c3Smrg# Check how to create a tarball in format FORMAT.
327017ca54c3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
327117ca54c3Smrg#
327217ca54c3Smrg# Substitute a variable $(am__tar) that is a command
327317ca54c3Smrg# writing to stdout a FORMAT-tarball containing the directory
327417ca54c3Smrg# $tardir.
327517ca54c3Smrg#     tardir=directory && $(am__tar) > result.tar
327617ca54c3Smrg#
327717ca54c3Smrg# Substitute a variable $(am__untar) that extract such
327817ca54c3Smrg# a tarball read from stdin.
327917ca54c3Smrg#     $(am__untar) < result.tar
328017ca54c3Smrg#
328117ca54c3SmrgAC_DEFUN([_AM_PROG_TAR],
328217ca54c3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
328317ca54c3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
328417ca54c3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
328517ca54c3Smrg
328617ca54c3Smrg# We'll loop over all known methods to create a tar archive until one works.
328717ca54c3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
328817ca54c3Smrg
328917ca54c3Smrgm4_if([$1], [v7],
329017ca54c3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
329117ca54c3Smrg
329217ca54c3Smrg  [m4_case([$1],
329317ca54c3Smrg    [ustar],
329417ca54c3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
329517ca54c3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
329617ca54c3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
329717ca54c3Smrg      # and bug#13588).
329817ca54c3Smrg      am_max_uid=2097151 # 2^21 - 1
329917ca54c3Smrg      am_max_gid=$am_max_uid
330017ca54c3Smrg      # The $UID and $GID variables are not portable, so we need to resort
330117ca54c3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
330217ca54c3Smrg      # below are definitely unexpected, so allow the users to see them
330317ca54c3Smrg      # (that is, avoid stderr redirection).
330417ca54c3Smrg      am_uid=`id -u || echo unknown`
330517ca54c3Smrg      am_gid=`id -g || echo unknown`
330617ca54c3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
330717ca54c3Smrg      if test $am_uid -le $am_max_uid; then
330817ca54c3Smrg         AC_MSG_RESULT([yes])
330917ca54c3Smrg      else
331017ca54c3Smrg         AC_MSG_RESULT([no])
331117ca54c3Smrg         _am_tools=none
331217ca54c3Smrg      fi
331317ca54c3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
331417ca54c3Smrg      if test $am_gid -le $am_max_gid; then
331517ca54c3Smrg         AC_MSG_RESULT([yes])
331617ca54c3Smrg      else
331717ca54c3Smrg        AC_MSG_RESULT([no])
331817ca54c3Smrg        _am_tools=none
331917ca54c3Smrg      fi],
332017ca54c3Smrg
332117ca54c3Smrg  [pax],
332217ca54c3Smrg    [],
332317ca54c3Smrg
332417ca54c3Smrg  [m4_fatal([Unknown tar format])])
332517ca54c3Smrg
332617ca54c3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
332717ca54c3Smrg
332817ca54c3Smrg  # Go ahead even if we have the value already cached.  We do so because we
332917ca54c3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
333017ca54c3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
333117ca54c3Smrg
333217ca54c3Smrg  for _am_tool in $_am_tools; do
333317ca54c3Smrg    case $_am_tool in
333417ca54c3Smrg    gnutar)
333517ca54c3Smrg      for _am_tar in tar gnutar gtar; do
333617ca54c3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
333717ca54c3Smrg      done
333817ca54c3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
333917ca54c3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
334017ca54c3Smrg      am__untar="$_am_tar -xf -"
334117ca54c3Smrg      ;;
334217ca54c3Smrg    plaintar)
334317ca54c3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
334417ca54c3Smrg      # ustar tarball either.
334517ca54c3Smrg      (tar --version) >/dev/null 2>&1 && continue
334617ca54c3Smrg      am__tar='tar chf - "$$tardir"'
334717ca54c3Smrg      am__tar_='tar chf - "$tardir"'
334817ca54c3Smrg      am__untar='tar xf -'
334917ca54c3Smrg      ;;
335017ca54c3Smrg    pax)
335117ca54c3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
335217ca54c3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
335317ca54c3Smrg      am__untar='pax -r'
335417ca54c3Smrg      ;;
335517ca54c3Smrg    cpio)
335617ca54c3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
335717ca54c3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
335817ca54c3Smrg      am__untar='cpio -i -H $1 -d'
335917ca54c3Smrg      ;;
336017ca54c3Smrg    none)
336117ca54c3Smrg      am__tar=false
336217ca54c3Smrg      am__tar_=false
336317ca54c3Smrg      am__untar=false
336417ca54c3Smrg      ;;
336517ca54c3Smrg    esac
336617ca54c3Smrg
336717ca54c3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
336817ca54c3Smrg    # and am__untar set.
336917ca54c3Smrg    test -n "${am_cv_prog_tar_$1}" && break
337017ca54c3Smrg
337117ca54c3Smrg    # tar/untar a dummy directory, and stop if the command works.
337217ca54c3Smrg    rm -rf conftest.dir
337317ca54c3Smrg    mkdir conftest.dir
337417ca54c3Smrg    echo GrepMe > conftest.dir/file
337517ca54c3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
337617ca54c3Smrg    rm -rf conftest.dir
337717ca54c3Smrg    if test -s conftest.tar; then
337817ca54c3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
337917ca54c3Smrg      AM_RUN_LOG([cat conftest.dir/file])
338017ca54c3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
338117ca54c3Smrg    fi
338217ca54c3Smrg  done
338317ca54c3Smrg  rm -rf conftest.dir
338417ca54c3Smrg
338517ca54c3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
338617ca54c3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
338717ca54c3Smrg
338817ca54c3SmrgAC_SUBST([am__tar])
338917ca54c3SmrgAC_SUBST([am__untar])
339017ca54c3Smrg]) # _AM_PROG_TAR
339117ca54c3Smrg
3392