Blame aclocal.m4

Packit 071ada
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 071ada
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# This program is distributed in the hope that it will be useful,
Packit 071ada
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
Packit 071ada
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
Packit 071ada
# PARTICULAR PURPOSE.
Packit 071ada
Packit 071ada
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
Packit 071ada
m4_ifndef([AC_AUTOCONF_VERSION],
Packit 071ada
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
Packit 071ada
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
Packit 071ada
[m4_warning([this file was generated for autoconf 2.69.
Packit 071ada
You have another version of autoconf.  It may work, but is not guaranteed to.
Packit 071ada
If you have problems, you may need to regenerate the build system entirely.
Packit 071ada
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
Packit 071ada
Packit 071ada
# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
Packit 071ada
# serial 11 (pkg-config-0.29.1)
Packit 071ada
Packit 071ada
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
Packit 071ada
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
Packit 071ada
dnl
Packit 071ada
dnl This program is free software; you can redistribute it and/or modify
Packit 071ada
dnl it under the terms of the GNU General Public License as published by
Packit 071ada
dnl the Free Software Foundation; either version 2 of the License, or
Packit 071ada
dnl (at your option) any later version.
Packit 071ada
dnl
Packit 071ada
dnl This program is distributed in the hope that it will be useful, but
Packit 071ada
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 071ada
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit 071ada
dnl General Public License for more details.
Packit 071ada
dnl
Packit 071ada
dnl You should have received a copy of the GNU General Public License
Packit 071ada
dnl along with this program; if not, write to the Free Software
Packit 071ada
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
Packit 071ada
dnl 02111-1307, USA.
Packit 071ada
dnl
Packit 071ada
dnl As a special exception to the GNU General Public License, if you
Packit 071ada
dnl distribute this file as part of a program that contains a
Packit 071ada
dnl configuration script generated by Autoconf, you may include it under
Packit 071ada
dnl the same distribution terms that you use for the rest of that
Packit 071ada
dnl program.
Packit 071ada
Packit 071ada
dnl PKG_PREREQ(MIN-VERSION)
Packit 071ada
dnl -----------------------
Packit 071ada
dnl Since: 0.29
Packit 071ada
dnl
Packit 071ada
dnl Verify that the version of the pkg-config macros are at least
Packit 071ada
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
Packit 071ada
dnl installed version of pkg-config, this checks the developer's version
Packit 071ada
dnl of pkg.m4 when generating configure.
Packit 071ada
dnl
Packit 071ada
dnl To ensure that this macro is defined, also add:
Packit 071ada
dnl m4_ifndef([PKG_PREREQ],
Packit 071ada
dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
Packit 071ada
dnl
Packit 071ada
dnl See the "Since" comment for each macro you use to see what version
Packit 071ada
dnl of the macros you require.
Packit 071ada
m4_defun([PKG_PREREQ],
Packit 071ada
[m4_define([PKG_MACROS_VERSION], [0.29.1])
Packit 071ada
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
Packit 071ada
    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
Packit 071ada
])dnl PKG_PREREQ
Packit 071ada
Packit 071ada
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
Packit 071ada
dnl ----------------------------------
Packit 071ada
dnl Since: 0.16
Packit 071ada
dnl
Packit 071ada
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
Packit 071ada
dnl first found in the path. Checks that the version of pkg-config found
Packit 071ada
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
Packit 071ada
dnl used since that's the first version where most current features of
Packit 071ada
dnl pkg-config existed.
Packit 071ada
AC_DEFUN([PKG_PROG_PKG_CONFIG],
Packit 071ada
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
Packit 071ada
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
Packit 071ada
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
Packit 071ada
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
Packit 071ada
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
Packit 071ada
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
Packit 071ada
Packit 071ada
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
Packit 071ada
	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
Packit 071ada
fi
Packit 071ada
if test -n "$PKG_CONFIG"; then
Packit 071ada
	_pkg_min_version=m4_default([$1], [0.9.0])
Packit 071ada
	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
Packit 071ada
	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
Packit 071ada
		AC_MSG_RESULT([yes])
Packit 071ada
	else
Packit 071ada
		AC_MSG_RESULT([no])
Packit 071ada
		PKG_CONFIG=""
Packit 071ada
	fi
Packit 071ada
fi[]dnl
Packit 071ada
])dnl PKG_PROG_PKG_CONFIG
Packit 071ada
Packit 071ada
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
Packit 071ada
dnl -------------------------------------------------------------------
Packit 071ada
dnl Since: 0.18
Packit 071ada
dnl
Packit 071ada
dnl Check to see whether a particular set of modules exists. Similar to
Packit 071ada
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
Packit 071ada
dnl
Packit 071ada
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Packit 071ada
dnl only at the first occurence in configure.ac, so if the first place
Packit 071ada
dnl it's called might be skipped (such as if it is within an "if", you
Packit 071ada
dnl have to call PKG_CHECK_EXISTS manually
Packit 071ada
AC_DEFUN([PKG_CHECK_EXISTS],
Packit 071ada
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
Packit 071ada
if test -n "$PKG_CONFIG" && \
Packit 071ada
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
Packit 071ada
  m4_default([$2], [:])
Packit 071ada
m4_ifvaln([$3], [else
Packit 071ada
  $3])dnl
Packit 071ada
fi])
Packit 071ada
Packit 071ada
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
Packit 071ada
dnl ---------------------------------------------
Packit 071ada
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
Packit 071ada
dnl pkg_failed based on the result.
Packit 071ada
m4_define([_PKG_CONFIG],
Packit 071ada
[if test -n "$$1"; then
Packit 071ada
    pkg_cv_[]$1="$$1"
Packit 071ada
 elif test -n "$PKG_CONFIG"; then
Packit 071ada
    PKG_CHECK_EXISTS([$3],
Packit 071ada
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
Packit 071ada
		      test "x$?" != "x0" && pkg_failed=yes ],
Packit 071ada
		     [pkg_failed=yes])
Packit 071ada
 else
Packit 071ada
    pkg_failed=untried
Packit 071ada
fi[]dnl
Packit 071ada
])dnl _PKG_CONFIG
Packit 071ada
Packit 071ada
dnl _PKG_SHORT_ERRORS_SUPPORTED
Packit 071ada
dnl ---------------------------
Packit 071ada
dnl Internal check to see if pkg-config supports short errors.
Packit 071ada
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
Packit 071ada
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Packit 071ada
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
Packit 071ada
        _pkg_short_errors_supported=yes
Packit 071ada
else
Packit 071ada
        _pkg_short_errors_supported=no
Packit 071ada
fi[]dnl
Packit 071ada
])dnl _PKG_SHORT_ERRORS_SUPPORTED
Packit 071ada
Packit 071ada
Packit 071ada
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
Packit 071ada
dnl   [ACTION-IF-NOT-FOUND])
Packit 071ada
dnl --------------------------------------------------------------
Packit 071ada
dnl Since: 0.4.0
Packit 071ada
dnl
Packit 071ada
dnl Note that if there is a possibility the first call to
Packit 071ada
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
Packit 071ada
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
Packit 071ada
AC_DEFUN([PKG_CHECK_MODULES],
Packit 071ada
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
Packit 071ada
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
Packit 071ada
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
Packit 071ada
Packit 071ada
pkg_failed=no
Packit 071ada
AC_MSG_CHECKING([for $1])
Packit 071ada
Packit 071ada
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
Packit 071ada
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
Packit 071ada
Packit 071ada
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
Packit 071ada
and $1[]_LIBS to avoid the need to call pkg-config.
Packit 071ada
See the pkg-config man page for more details.])
Packit 071ada
Packit 071ada
if test $pkg_failed = yes; then
Packit 071ada
   	AC_MSG_RESULT([no])
Packit 071ada
        _PKG_SHORT_ERRORS_SUPPORTED
Packit 071ada
        if test $_pkg_short_errors_supported = yes; then
Packit 071ada
	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
Packit 071ada
        else 
Packit 071ada
	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
Packit 071ada
        fi
Packit 071ada
	# Put the nasty error message in config.log where it belongs
Packit 071ada
	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
Packit 071ada
Packit 071ada
	m4_default([$4], [AC_MSG_ERROR(
Packit 071ada
[Package requirements ($2) were not met:
Packit 071ada
Packit 071ada
$$1_PKG_ERRORS
Packit 071ada
Packit 071ada
Consider adjusting the PKG_CONFIG_PATH environment variable if you
Packit 071ada
installed software in a non-standard prefix.
Packit 071ada
Packit 071ada
_PKG_TEXT])[]dnl
Packit 071ada
        ])
Packit 071ada
elif test $pkg_failed = untried; then
Packit 071ada
     	AC_MSG_RESULT([no])
Packit 071ada
	m4_default([$4], [AC_MSG_FAILURE(
Packit 071ada
[The pkg-config script could not be found or is too old.  Make sure it
Packit 071ada
is in your PATH or set the PKG_CONFIG environment variable to the full
Packit 071ada
path to pkg-config.
Packit 071ada
Packit 071ada
_PKG_TEXT
Packit 071ada
Packit 071ada
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
Packit 071ada
        ])
Packit 071ada
else
Packit 071ada
	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
Packit 071ada
	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
Packit 071ada
        AC_MSG_RESULT([yes])
Packit 071ada
	$3
Packit 071ada
fi[]dnl
Packit 071ada
])dnl PKG_CHECK_MODULES
Packit 071ada
Packit 071ada
Packit 071ada
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
Packit 071ada
dnl   [ACTION-IF-NOT-FOUND])
Packit 071ada
dnl ---------------------------------------------------------------------
Packit 071ada
dnl Since: 0.29
Packit 071ada
dnl
Packit 071ada
dnl Checks for existence of MODULES and gathers its build flags with
Packit 071ada
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
Packit 071ada
dnl and VARIABLE-PREFIX_LIBS from --libs.
Packit 071ada
dnl
Packit 071ada
dnl Note that if there is a possibility the first call to
Packit 071ada
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
Packit 071ada
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
Packit 071ada
dnl configure.ac.
Packit 071ada
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
Packit 071ada
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
Packit 071ada
_save_PKG_CONFIG=$PKG_CONFIG
Packit 071ada
PKG_CONFIG="$PKG_CONFIG --static"
Packit 071ada
PKG_CHECK_MODULES($@)
Packit 071ada
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
Packit 071ada
])dnl PKG_CHECK_MODULES_STATIC
Packit 071ada
Packit 071ada
Packit 071ada
dnl PKG_INSTALLDIR([DIRECTORY])
Packit 071ada
dnl -------------------------
Packit 071ada
dnl Since: 0.27
Packit 071ada
dnl
Packit 071ada
dnl Substitutes the variable pkgconfigdir as the location where a module
Packit 071ada
dnl should install pkg-config .pc files. By default the directory is
Packit 071ada
dnl $libdir/pkgconfig, but the default can be changed by passing
Packit 071ada
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
Packit 071ada
dnl parameter.
Packit 071ada
AC_DEFUN([PKG_INSTALLDIR],
Packit 071ada
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
Packit 071ada
m4_pushdef([pkg_description],
Packit 071ada
    [pkg-config installation directory @<:@]pkg_default[@:>@])
Packit 071ada
AC_ARG_WITH([pkgconfigdir],
Packit 071ada
    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
Packit 071ada
    [with_pkgconfigdir=]pkg_default)
Packit 071ada
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
Packit 071ada
m4_popdef([pkg_default])
Packit 071ada
m4_popdef([pkg_description])
Packit 071ada
])dnl PKG_INSTALLDIR
Packit 071ada
Packit 071ada
Packit 071ada
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
Packit 071ada
dnl --------------------------------
Packit 071ada
dnl Since: 0.27
Packit 071ada
dnl
Packit 071ada
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
Packit 071ada
dnl module should install arch-independent pkg-config .pc files. By
Packit 071ada
dnl default the directory is $datadir/pkgconfig, but the default can be
Packit 071ada
dnl changed by passing DIRECTORY. The user can override through the
Packit 071ada
dnl --with-noarch-pkgconfigdir parameter.
Packit 071ada
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
Packit 071ada
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
Packit 071ada
m4_pushdef([pkg_description],
Packit 071ada
    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
Packit 071ada
AC_ARG_WITH([noarch-pkgconfigdir],
Packit 071ada
    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
Packit 071ada
    [with_noarch_pkgconfigdir=]pkg_default)
Packit 071ada
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
Packit 071ada
m4_popdef([pkg_default])
Packit 071ada
m4_popdef([pkg_description])
Packit 071ada
])dnl PKG_NOARCH_INSTALLDIR
Packit 071ada
Packit 071ada
Packit 071ada
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
Packit 071ada
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
Packit 071ada
dnl -------------------------------------------
Packit 071ada
dnl Since: 0.28
Packit 071ada
dnl
Packit 071ada
dnl Retrieves the value of the pkg-config variable for the given module.
Packit 071ada
AC_DEFUN([PKG_CHECK_VAR],
Packit 071ada
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
Packit 071ada
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
Packit 071ada
Packit 071ada
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
Packit 071ada
AS_VAR_COPY([$1], [pkg_cv_][$1])
Packit 071ada
Packit 071ada
AS_VAR_IF([$1], [""], [$5], [$4])dnl
Packit 071ada
])dnl PKG_CHECK_VAR
Packit 071ada
Packit 071ada
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
Packit 071ada
dnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
Packit 071ada
dnl   [DESCRIPTION], [DEFAULT])
Packit 071ada
dnl ------------------------------------------
Packit 071ada
dnl
Packit 071ada
dnl Prepare a "--with-" configure option using the lowercase
Packit 071ada
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
Packit 071ada
dnl PKG_CHECK_MODULES in a single macro.
Packit 071ada
AC_DEFUN([PKG_WITH_MODULES],
Packit 071ada
[
Packit 071ada
m4_pushdef([with_arg], m4_tolower([$1]))
Packit 071ada
Packit 071ada
m4_pushdef([description],
Packit 071ada
           [m4_default([$5], [build with ]with_arg[ support])])
Packit 071ada
Packit 071ada
m4_pushdef([def_arg], [m4_default([$6], [auto])])
Packit 071ada
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
Packit 071ada
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
Packit 071ada
Packit 071ada
m4_case(def_arg,
Packit 071ada
            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
Packit 071ada
            [m4_pushdef([with_without],[--with-]with_arg)])
Packit 071ada
Packit 071ada
AC_ARG_WITH(with_arg,
Packit 071ada
     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
Packit 071ada
    [AS_TR_SH([with_]with_arg)=def_arg])
Packit 071ada
Packit 071ada
AS_CASE([$AS_TR_SH([with_]with_arg)],
Packit 071ada
            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
Packit 071ada
            [auto],[PKG_CHECK_MODULES([$1],[$2],
Packit 071ada
                                        [m4_n([def_action_if_found]) $3],
Packit 071ada
                                        [m4_n([def_action_if_not_found]) $4])])
Packit 071ada
Packit 071ada
m4_popdef([with_arg])
Packit 071ada
m4_popdef([description])
Packit 071ada
m4_popdef([def_arg])
Packit 071ada
Packit 071ada
])dnl PKG_WITH_MODULES
Packit 071ada
Packit 071ada
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
Packit 071ada
dnl   [DESCRIPTION], [DEFAULT])
Packit 071ada
dnl -----------------------------------------------
Packit 071ada
dnl
Packit 071ada
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
Packit 071ada
dnl check._[VARIABLE-PREFIX] is exported as make variable.
Packit 071ada
AC_DEFUN([PKG_HAVE_WITH_MODULES],
Packit 071ada
[
Packit 071ada
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
Packit 071ada
Packit 071ada
AM_CONDITIONAL([HAVE_][$1],
Packit 071ada
               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
Packit 071ada
])dnl PKG_HAVE_WITH_MODULES
Packit 071ada
Packit 071ada
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
Packit 071ada
dnl   [DESCRIPTION], [DEFAULT])
Packit 071ada
dnl ------------------------------------------------------
Packit 071ada
dnl
Packit 071ada
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
Packit 071ada
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
Packit 071ada
dnl and preprocessor variable.
Packit 071ada
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
Packit 071ada
[
Packit 071ada
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
Packit 071ada
Packit 071ada
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
Packit 071ada
        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
Packit 071ada
])dnl PKG_HAVE_DEFINE_WITH_MODULES
Packit 071ada
Packit 071ada
dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
Packit 071ada
dnl
Packit 071ada
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
Packit 071ada
dnl
Packit 071ada
dnl Permission is hereby granted, free of charge, to any person obtaining a
Packit 071ada
dnl copy of this software and associated documentation files (the "Software"),
Packit 071ada
dnl to deal in the Software without restriction, including without limitation
Packit 071ada
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
Packit 071ada
dnl and/or sell copies of the Software, and to permit persons to whom the
Packit 071ada
dnl Software is furnished to do so, subject to the following conditions:
Packit 071ada
dnl
Packit 071ada
dnl The above copyright notice and this permission notice (including the next
Packit 071ada
dnl paragraph) shall be included in all copies or substantial portions of the
Packit 071ada
dnl Software.
Packit 071ada
dnl
Packit 071ada
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit 071ada
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit 071ada
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
Packit 071ada
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Packit 071ada
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
Packit 071ada
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
Packit 071ada
dnl DEALINGS IN THE SOFTWARE.
Packit 071ada
Packit 071ada
# XORG_MACROS_VERSION(required-version)
Packit 071ada
# -------------------------------------
Packit 071ada
# Minimum version: 1.1.0
Packit 071ada
#
Packit 071ada
# If you're using a macro added in Version 1.1 or newer, include this in
Packit 071ada
# your configure.ac with the minimum required version, such as:
Packit 071ada
# XORG_MACROS_VERSION(1.1)
Packit 071ada
#
Packit 071ada
# To ensure that this macro is defined, also add:
Packit 071ada
# m4_ifndef([XORG_MACROS_VERSION],
Packit 071ada
#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
Packit 071ada
#
Packit 071ada
#
Packit 071ada
# See the "minimum version" comment for each macro you use to see what
Packit 071ada
# version you require.
Packit 071ada
m4_defun([XORG_MACROS_VERSION],[
Packit 071ada
m4_define([vers_have], [1.19.0])
Packit 071ada
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
Packit 071ada
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
Packit 071ada
m4_if(m4_cmp(maj_have, maj_needed), 0,,
Packit 071ada
    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
Packit 071ada
m4_if(m4_version_compare(vers_have, [$1]), -1,
Packit 071ada
    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
Packit 071ada
m4_undefine([vers_have])
Packit 071ada
m4_undefine([maj_have])
Packit 071ada
m4_undefine([maj_needed])
Packit 071ada
]) # XORG_MACROS_VERSION
Packit 071ada
Packit 071ada
# XORG_PROG_RAWCPP()
Packit 071ada
# ------------------
Packit 071ada
# Minimum version: 1.0.0
Packit 071ada
#
Packit 071ada
# Find cpp program and necessary flags for use in pre-processing text files
Packit 071ada
# such as man pages and config files
Packit 071ada
AC_DEFUN([XORG_PROG_RAWCPP],[
Packit 071ada
AC_REQUIRE([AC_PROG_CPP])
Packit 071ada
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
Packit 071ada
   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
Packit 071ada
Packit 071ada
# Check for flag to avoid builtin definitions - assumes unix is predefined,
Packit 071ada
# which is not the best choice for supporting other OS'es, but covers most
Packit 071ada
# of the ones we need for now.
Packit 071ada
AC_MSG_CHECKING([if $RAWCPP requires -undef])
Packit 071ada
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
Packit 071ada
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
Packit 071ada
	AC_MSG_RESULT([no])
Packit 071ada
else
Packit 071ada
	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
Packit 071ada
		RAWCPPFLAGS=-undef
Packit 071ada
		AC_MSG_RESULT([yes])
Packit 071ada
	# under Cygwin unix is still defined even with -undef
Packit 071ada
	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
Packit 071ada
		RAWCPPFLAGS="-undef -ansi"
Packit 071ada
		AC_MSG_RESULT([yes, with -ansi])
Packit 071ada
	else
Packit 071ada
		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
Packit 071ada
	fi
Packit 071ada
fi
Packit 071ada
rm -f conftest.$ac_ext
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([if $RAWCPP requires -traditional])
Packit 071ada
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
Packit 071ada
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
Packit 071ada
	AC_MSG_RESULT([no])
Packit 071ada
else
Packit 071ada
	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
Packit 071ada
		TRADITIONALCPPFLAGS="-traditional"
Packit 071ada
		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
Packit 071ada
		AC_MSG_RESULT([yes])
Packit 071ada
	else
Packit 071ada
		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
Packit 071ada
	fi
Packit 071ada
fi
Packit 071ada
rm -f conftest.$ac_ext
Packit 071ada
AC_SUBST(RAWCPPFLAGS)
Packit 071ada
AC_SUBST(TRADITIONALCPPFLAGS)
Packit 071ada
]) # XORG_PROG_RAWCPP
Packit 071ada
Packit 071ada
# XORG_MANPAGE_SECTIONS()
Packit 071ada
# -----------------------
Packit 071ada
# Minimum version: 1.0.0
Packit 071ada
#
Packit 071ada
# Determine which sections man pages go in for the different man page types
Packit 071ada
# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
Packit 071ada
# Not sure if there's any better way than just hardcoding by OS name.
Packit 071ada
# Override default settings by setting environment variables
Packit 071ada
# Added MAN_SUBSTS in version 1.8
Packit 071ada
# Added AC_PROG_SED in version 1.8
Packit 071ada
Packit 071ada
AC_DEFUN([XORG_MANPAGE_SECTIONS],[
Packit 071ada
AC_REQUIRE([AC_CANONICAL_HOST])
Packit 071ada
AC_REQUIRE([AC_PROG_SED])
Packit 071ada
Packit 071ada
if test x$APP_MAN_SUFFIX = x    ; then
Packit 071ada
    APP_MAN_SUFFIX=1
Packit 071ada
fi
Packit 071ada
if test x$APP_MAN_DIR = x    ; then
Packit 071ada
    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
Packit 071ada
fi
Packit 071ada
Packit 071ada
if test x$LIB_MAN_SUFFIX = x    ; then
Packit 071ada
    LIB_MAN_SUFFIX=3
Packit 071ada
fi
Packit 071ada
if test x$LIB_MAN_DIR = x    ; then
Packit 071ada
    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
Packit 071ada
fi
Packit 071ada
Packit 071ada
if test x$FILE_MAN_SUFFIX = x    ; then
Packit 071ada
    case $host_os in
Packit 071ada
	solaris*)	FILE_MAN_SUFFIX=4  ;;
Packit 071ada
	*)		FILE_MAN_SUFFIX=5  ;;
Packit 071ada
    esac
Packit 071ada
fi
Packit 071ada
if test x$FILE_MAN_DIR = x    ; then
Packit 071ada
    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
Packit 071ada
fi
Packit 071ada
Packit 071ada
if test x$MISC_MAN_SUFFIX = x    ; then
Packit 071ada
    case $host_os in
Packit 071ada
	solaris*)	MISC_MAN_SUFFIX=5  ;;
Packit 071ada
	*)		MISC_MAN_SUFFIX=7  ;;
Packit 071ada
    esac
Packit 071ada
fi
Packit 071ada
if test x$MISC_MAN_DIR = x    ; then
Packit 071ada
    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
Packit 071ada
fi
Packit 071ada
Packit 071ada
if test x$DRIVER_MAN_SUFFIX = x    ; then
Packit 071ada
    case $host_os in
Packit 071ada
	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
Packit 071ada
	*)		DRIVER_MAN_SUFFIX=4  ;;
Packit 071ada
    esac
Packit 071ada
fi
Packit 071ada
if test x$DRIVER_MAN_DIR = x    ; then
Packit 071ada
    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
Packit 071ada
fi
Packit 071ada
Packit 071ada
if test x$ADMIN_MAN_SUFFIX = x    ; then
Packit 071ada
    case $host_os in
Packit 071ada
	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
Packit 071ada
	*)		ADMIN_MAN_SUFFIX=8  ;;
Packit 071ada
    esac
Packit 071ada
fi
Packit 071ada
if test x$ADMIN_MAN_DIR = x    ; then
Packit 071ada
    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
Packit 071ada
fi
Packit 071ada
Packit 071ada
Packit 071ada
AC_SUBST([APP_MAN_SUFFIX])
Packit 071ada
AC_SUBST([LIB_MAN_SUFFIX])
Packit 071ada
AC_SUBST([FILE_MAN_SUFFIX])
Packit 071ada
AC_SUBST([MISC_MAN_SUFFIX])
Packit 071ada
AC_SUBST([DRIVER_MAN_SUFFIX])
Packit 071ada
AC_SUBST([ADMIN_MAN_SUFFIX])
Packit 071ada
AC_SUBST([APP_MAN_DIR])
Packit 071ada
AC_SUBST([LIB_MAN_DIR])
Packit 071ada
AC_SUBST([FILE_MAN_DIR])
Packit 071ada
AC_SUBST([MISC_MAN_DIR])
Packit 071ada
AC_SUBST([DRIVER_MAN_DIR])
Packit 071ada
AC_SUBST([ADMIN_MAN_DIR])
Packit 071ada
Packit 071ada
XORG_MAN_PAGE="X Version 11"
Packit 071ada
AC_SUBST([XORG_MAN_PAGE])
Packit 071ada
MAN_SUBSTS="\
Packit 071ada
	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
Packit 071ada
	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
Packit 071ada
	-e 's|__xservername__|Xorg|g' \
Packit 071ada
	-e 's|__xconfigfile__|xorg.conf|g' \
Packit 071ada
	-e 's|__projectroot__|\$(prefix)|g' \
Packit 071ada
	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
Packit 071ada
	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
Packit 071ada
	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
Packit 071ada
	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
Packit 071ada
	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
Packit 071ada
	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
Packit 071ada
	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
Packit 071ada
AC_SUBST([MAN_SUBSTS])
Packit 071ada
Packit 071ada
]) # XORG_MANPAGE_SECTIONS
Packit 071ada
Packit 071ada
# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
Packit 071ada
# ------------------------
Packit 071ada
# Minimum version: 1.7.0
Packit 071ada
#
Packit 071ada
# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
Packit 071ada
# provided by xorg-sgml-doctools, if installed.
Packit 071ada
AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
Packit 071ada
AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
Packit 071ada
XORG_SGML_PATH=
Packit 071ada
PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
Packit 071ada
    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
Packit 071ada
    [m4_ifval([$1],[:],
Packit 071ada
        [if test x"$cross_compiling" != x"yes" ; then
Packit 071ada
            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
Packit 071ada
                          [XORG_SGML_PATH=$prefix/share/sgml])
Packit 071ada
         fi])
Packit 071ada
    ])
Packit 071ada
Packit 071ada
# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
Packit 071ada
# the path and the name of the doc stylesheet
Packit 071ada
if test "x$XORG_SGML_PATH" != "x" ; then
Packit 071ada
   AC_MSG_RESULT([$XORG_SGML_PATH])
Packit 071ada
   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
Packit 071ada
   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
Packit 071ada
else
Packit 071ada
   AC_MSG_RESULT([no])
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST(XORG_SGML_PATH)
Packit 071ada
AC_SUBST(STYLESHEET_SRCDIR)
Packit 071ada
AC_SUBST(XSL_STYLESHEET)
Packit 071ada
AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
Packit 071ada
]) # XORG_CHECK_SGML_DOCTOOLS
Packit 071ada
Packit 071ada
# XORG_CHECK_LINUXDOC
Packit 071ada
# -------------------
Packit 071ada
# Minimum version: 1.0.0
Packit 071ada
#
Packit 071ada
# Defines the variable MAKE_TEXT if the necessary tools and
Packit 071ada
# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
Packit 071ada
# Whether or not the necessary tools and files are found can be checked
Packit 071ada
# with the AM_CONDITIONAL "BUILD_LINUXDOC"
Packit 071ada
AC_DEFUN([XORG_CHECK_LINUXDOC],[
Packit 071ada
AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
Packit 071ada
AC_REQUIRE([XORG_WITH_PS2PDF])
Packit 071ada
Packit 071ada
AC_PATH_PROG(LINUXDOC, linuxdoc)
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether to build documentation])
Packit 071ada
Packit 071ada
if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
Packit 071ada
   BUILDDOC=yes
Packit 071ada
else
Packit 071ada
   BUILDDOC=no
Packit 071ada
fi
Packit 071ada
Packit 071ada
AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
Packit 071ada
Packit 071ada
AC_MSG_RESULT([$BUILDDOC])
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether to build pdf documentation])
Packit 071ada
Packit 071ada
if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
Packit 071ada
   BUILDPDFDOC=yes
Packit 071ada
else
Packit 071ada
   BUILDPDFDOC=no
Packit 071ada
fi
Packit 071ada
Packit 071ada
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
Packit 071ada
Packit 071ada
AC_MSG_RESULT([$BUILDPDFDOC])
Packit 071ada
Packit 071ada
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
Packit 071ada
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
Packit 071ada
MAKE_PDF="$PS2PDF"
Packit 071ada
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
Packit 071ada
Packit 071ada
AC_SUBST(MAKE_TEXT)
Packit 071ada
AC_SUBST(MAKE_PS)
Packit 071ada
AC_SUBST(MAKE_PDF)
Packit 071ada
AC_SUBST(MAKE_HTML)
Packit 071ada
]) # XORG_CHECK_LINUXDOC
Packit 071ada
Packit 071ada
# XORG_CHECK_DOCBOOK
Packit 071ada
# -------------------
Packit 071ada
# Minimum version: 1.0.0
Packit 071ada
#
Packit 071ada
# Checks for the ability to build output formats from SGML DocBook source.
Packit 071ada
# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
Packit 071ada
# indicates whether the necessary tools and files are found and, if set,
Packit 071ada
# $(MAKE_XXX) blah.sgml will produce blah.xxx.
Packit 071ada
AC_DEFUN([XORG_CHECK_DOCBOOK],[
Packit 071ada
AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
Packit 071ada
Packit 071ada
BUILDTXTDOC=no
Packit 071ada
BUILDPDFDOC=no
Packit 071ada
BUILDPSDOC=no
Packit 071ada
BUILDHTMLDOC=no
Packit 071ada
Packit 071ada
AC_PATH_PROG(DOCBOOKPS, docbook2ps)
Packit 071ada
AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
Packit 071ada
AC_PATH_PROG(DOCBOOKHTML, docbook2html)
Packit 071ada
AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether to build text documentation])
Packit 071ada
if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
Packit 071ada
   test x$BUILD_TXTDOC != xno; then
Packit 071ada
	BUILDTXTDOC=yes
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
Packit 071ada
AC_MSG_RESULT([$BUILDTXTDOC])
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether to build PDF documentation])
Packit 071ada
if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
Packit 071ada
   test x$BUILD_PDFDOC != xno; then
Packit 071ada
	BUILDPDFDOC=yes
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
Packit 071ada
AC_MSG_RESULT([$BUILDPDFDOC])
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether to build PostScript documentation])
Packit 071ada
if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
Packit 071ada
   test x$BUILD_PSDOC != xno; then
Packit 071ada
	BUILDPSDOC=yes
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
Packit 071ada
AC_MSG_RESULT([$BUILDPSDOC])
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether to build HTML documentation])
Packit 071ada
if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
Packit 071ada
   test x$BUILD_HTMLDOC != xno; then
Packit 071ada
	BUILDHTMLDOC=yes
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
Packit 071ada
AC_MSG_RESULT([$BUILDHTMLDOC])
Packit 071ada
Packit 071ada
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
Packit 071ada
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
Packit 071ada
MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
Packit 071ada
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
Packit 071ada
Packit 071ada
AC_SUBST(MAKE_TEXT)
Packit 071ada
AC_SUBST(MAKE_PS)
Packit 071ada
AC_SUBST(MAKE_PDF)
Packit 071ada
AC_SUBST(MAKE_HTML)
Packit 071ada
]) # XORG_CHECK_DOCBOOK
Packit 071ada
Packit 071ada
# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.5.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.11.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a module to test for the
Packit 071ada
# presence of the tool and obtain it's path in separate variables. Coupled with
Packit 071ada
# the --with-xmlto option, it allows maximum flexibilty in making decisions
Packit 071ada
# as whether or not to use the xmlto package. When DEFAULT is not specified,
Packit 071ada
# --with-xmlto assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
Packit 071ada
# XMLTO:	returns the path of the xmlto program found
Packit 071ada
#		returns the path set by the user in the environment
Packit 071ada
# --with-xmlto:	'yes' user instructs the module to use xmlto
Packit 071ada
#		'no' user instructs the module not to use xmlto
Packit 071ada
#
Packit 071ada
# Added in version 1.10.0
Packit 071ada
# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
Packit 071ada
#                  xmlto for text output requires either lynx, links, or w3m browsers
Packit 071ada
#
Packit 071ada
# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_XMLTO],[
Packit 071ada
AC_ARG_VAR([XMLTO], [Path to xmlto command])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(xmlto,
Packit 071ada
	AS_HELP_STRING([--with-xmlto],
Packit 071ada
	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
Packit 071ada
	   [use_xmlto=$withval], [use_xmlto=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_xmlto" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([XMLTO], [xmlto])
Packit 071ada
   if test "x$XMLTO" = "x"; then
Packit 071ada
        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
Packit 071ada
	have_xmlto=no
Packit 071ada
   else
Packit 071ada
        have_xmlto=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_xmlto" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([XMLTO], [xmlto])
Packit 071ada
   if test "x$XMLTO" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_xmlto=yes
Packit 071ada
elif test "x$use_xmlto" = x"no" ; then
Packit 071ada
   if test "x$XMLTO" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_xmlto=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
Packit 071ada
# Test for a minimum version of xmlto, if provided.
Packit 071ada
m4_ifval([$1],
Packit 071ada
[if test "$have_xmlto" = yes; then
Packit 071ada
    # scrape the xmlto version
Packit 071ada
    AC_MSG_CHECKING([the xmlto version])
Packit 071ada
    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
Packit 071ada
    AC_MSG_RESULT([$xmlto_version])
Packit 071ada
    AS_VERSION_COMPARE([$xmlto_version], [$1],
Packit 071ada
        [if test "x$use_xmlto" = xauto; then
Packit 071ada
            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
Packit 071ada
            have_xmlto=no
Packit 071ada
        else
Packit 071ada
            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
Packit 071ada
        fi])
Packit 071ada
fi])
Packit 071ada
Packit 071ada
# Test for the ability of xmlto to generate a text target
Packit 071ada
#
Packit 071ada
# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
Packit 071ada
# following test for empty XML docbook files.
Packit 071ada
# For compatibility reasons use the following empty XML docbook file and if
Packit 071ada
# it fails try it again with a non-empty XML file.
Packit 071ada
have_xmlto_text=no
Packit 071ada
cat > conftest.xml << "EOF"
Packit 071ada
EOF
Packit 071ada
AS_IF([test "$have_xmlto" = yes],
Packit 071ada
      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
Packit 071ada
             [have_xmlto_text=yes],
Packit 071ada
             [# Try it again with a non-empty XML file.
Packit 071ada
              cat > conftest.xml << "EOF"
Packit 071ada
<x></x>
Packit 071ada
EOF
Packit 071ada
              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
Packit 071ada
                    [have_xmlto_text=yes],
Packit 071ada
                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
Packit 071ada
rm -f conftest.xml
Packit 071ada
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
Packit 071ada
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
Packit 071ada
]) # XORG_WITH_XMLTO
Packit 071ada
Packit 071ada
# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
Packit 071ada
# --------------------------------------------
Packit 071ada
# Minimum version: 1.12.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.12.0
Packit 071ada
#
Packit 071ada
# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
Packit 071ada
# XML-based language used for the transformation of XML documents.
Packit 071ada
# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
Packit 071ada
# It is used under the cover by xmlto to generate html files from DocBook/XML.
Packit 071ada
# The XSLT processor is often used as a standalone tool for transformations.
Packit 071ada
# It should not be assumed that this tool is used only to work with documnetation.
Packit 071ada
# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
Packit 071ada
# XSLTPROC:	 returns the path of the xsltproc program found
Packit 071ada
#		 returns the path set by the user in the environment
Packit 071ada
# --with-xsltproc: 'yes' user instructs the module to use xsltproc
Packit 071ada
#		  'no' user instructs the module not to use xsltproc
Packit 071ada
# have_xsltproc: returns yes if xsltproc found in PATH or no
Packit 071ada
#
Packit 071ada
# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_XSLTPROC],[
Packit 071ada
AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
Packit 071ada
# Preserves the interface, should it be implemented later
Packit 071ada
m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(xsltproc,
Packit 071ada
	AS_HELP_STRING([--with-xsltproc],
Packit 071ada
	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
Packit 071ada
	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_xsltproc" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([XSLTPROC], [xsltproc])
Packit 071ada
   if test "x$XSLTPROC" = "x"; then
Packit 071ada
        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
Packit 071ada
	have_xsltproc=no
Packit 071ada
   else
Packit 071ada
        have_xsltproc=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_xsltproc" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([XSLTPROC], [xsltproc])
Packit 071ada
   if test "x$XSLTPROC" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_xsltproc=yes
Packit 071ada
elif test "x$use_xsltproc" = x"no" ; then
Packit 071ada
   if test "x$XSLTPROC" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_xsltproc=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
Packit 071ada
AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
Packit 071ada
]) # XORG_WITH_XSLTPROC
Packit 071ada
Packit 071ada
# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
Packit 071ada
# ----------------------------------------
Packit 071ada
# Minimum version: 1.15.0
Packit 071ada
#
Packit 071ada
# PERL (Practical Extraction and Report Language) is a language optimized for
Packit 071ada
# scanning arbitrary text files, extracting information from those text files,
Packit 071ada
# and printing reports based on that information.
Packit 071ada
#
Packit 071ada
# When DEFAULT is not specified, --with-perl assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_PERL: used in makefiles to conditionally scan text files
Packit 071ada
# PERL:	     returns the path of the perl program found
Packit 071ada
#	     returns the path set by the user in the environment
Packit 071ada
# --with-perl: 'yes' user instructs the module to use perl
Packit 071ada
#	       'no' user instructs the module not to use perl
Packit 071ada
# have_perl: returns yes if perl found in PATH or no
Packit 071ada
#
Packit 071ada
# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_PERL],[
Packit 071ada
AC_ARG_VAR([PERL], [Path to perl command])
Packit 071ada
# Preserves the interface, should it be implemented later
Packit 071ada
m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(perl,
Packit 071ada
	AS_HELP_STRING([--with-perl],
Packit 071ada
	   [Use perl for extracting information from files (default: ]_defopt[)]),
Packit 071ada
	   [use_perl=$withval], [use_perl=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_perl" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([PERL], [perl])
Packit 071ada
   if test "x$PERL" = "x"; then
Packit 071ada
        AC_MSG_WARN([perl not found - cannot extract information and report])
Packit 071ada
	have_perl=no
Packit 071ada
   else
Packit 071ada
        have_perl=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_perl" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([PERL], [perl])
Packit 071ada
   if test "x$PERL" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_perl=yes
Packit 071ada
elif test "x$use_perl" = x"no" ; then
Packit 071ada
   if test "x$PERL" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_perl=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
Packit 071ada
AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
Packit 071ada
]) # XORG_WITH_PERL
Packit 071ada
Packit 071ada
# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.5.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.11.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a module to test for the
Packit 071ada
# presence of the tool and obtain it's path in separate variables. Coupled with
Packit 071ada
# the --with-asciidoc option, it allows maximum flexibilty in making decisions
Packit 071ada
# as whether or not to use the asciidoc package. When DEFAULT is not specified,
Packit 071ada
# --with-asciidoc assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
Packit 071ada
# ASCIIDOC:	 returns the path of the asciidoc program found
Packit 071ada
#		 returns the path set by the user in the environment
Packit 071ada
# --with-asciidoc: 'yes' user instructs the module to use asciidoc
Packit 071ada
#		  'no' user instructs the module not to use asciidoc
Packit 071ada
#
Packit 071ada
# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_ASCIIDOC],[
Packit 071ada
AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(asciidoc,
Packit 071ada
	AS_HELP_STRING([--with-asciidoc],
Packit 071ada
	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
Packit 071ada
	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_asciidoc" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([ASCIIDOC], [asciidoc])
Packit 071ada
   if test "x$ASCIIDOC" = "x"; then
Packit 071ada
        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
Packit 071ada
	have_asciidoc=no
Packit 071ada
   else
Packit 071ada
        have_asciidoc=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_asciidoc" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([ASCIIDOC], [asciidoc])
Packit 071ada
   if test "x$ASCIIDOC" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_asciidoc=yes
Packit 071ada
elif test "x$use_asciidoc" = x"no" ; then
Packit 071ada
   if test "x$ASCIIDOC" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_asciidoc=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
m4_ifval([$1],
Packit 071ada
[if test "$have_asciidoc" = yes; then
Packit 071ada
    # scrape the asciidoc version
Packit 071ada
    AC_MSG_CHECKING([the asciidoc version])
Packit 071ada
    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
Packit 071ada
    AC_MSG_RESULT([$asciidoc_version])
Packit 071ada
    AS_VERSION_COMPARE([$asciidoc_version], [$1],
Packit 071ada
        [if test "x$use_asciidoc" = xauto; then
Packit 071ada
            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
Packit 071ada
            have_asciidoc=no
Packit 071ada
        else
Packit 071ada
            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
Packit 071ada
        fi])
Packit 071ada
fi])
Packit 071ada
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
Packit 071ada
]) # XORG_WITH_ASCIIDOC
Packit 071ada
Packit 071ada
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
Packit 071ada
# -------------------------------------------
Packit 071ada
# Minimum version: 1.5.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.11.0
Packit 071ada
# Minimum version for optional DOT checking: 1.18.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a module to test for the
Packit 071ada
# presence of the tool and obtain it's path in separate variables. Coupled with
Packit 071ada
# the --with-doxygen option, it allows maximum flexibilty in making decisions
Packit 071ada
# as whether or not to use the doxygen package. When DEFAULT is not specified,
Packit 071ada
# --with-doxygen assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
Packit 071ada
# DOXYGEN:	 returns the path of the doxygen program found
Packit 071ada
#		 returns the path set by the user in the environment
Packit 071ada
# --with-doxygen: 'yes' user instructs the module to use doxygen
Packit 071ada
#		  'no' user instructs the module not to use doxygen
Packit 071ada
#
Packit 071ada
# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_DOXYGEN],[
Packit 071ada
AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
Packit 071ada
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(doxygen,
Packit 071ada
	AS_HELP_STRING([--with-doxygen],
Packit 071ada
	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
Packit 071ada
	   [use_doxygen=$withval], [use_doxygen=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_doxygen" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([DOXYGEN], [doxygen])
Packit 071ada
   if test "x$DOXYGEN" = "x"; then
Packit 071ada
        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
Packit 071ada
	have_doxygen=no
Packit 071ada
   else
Packit 071ada
        have_doxygen=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_doxygen" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([DOXYGEN], [doxygen])
Packit 071ada
   if test "x$DOXYGEN" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_doxygen=yes
Packit 071ada
elif test "x$use_doxygen" = x"no" ; then
Packit 071ada
   if test "x$DOXYGEN" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_doxygen=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
m4_ifval([$1],
Packit 071ada
[if test "$have_doxygen" = yes; then
Packit 071ada
    # scrape the doxygen version
Packit 071ada
    AC_MSG_CHECKING([the doxygen version])
Packit 071ada
    doxygen_version=`$DOXYGEN --version 2>/dev/null`
Packit 071ada
    AC_MSG_RESULT([$doxygen_version])
Packit 071ada
    AS_VERSION_COMPARE([$doxygen_version], [$1],
Packit 071ada
        [if test "x$use_doxygen" = xauto; then
Packit 071ada
            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
Packit 071ada
            have_doxygen=no
Packit 071ada
        else
Packit 071ada
            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
Packit 071ada
        fi])
Packit 071ada
fi])
Packit 071ada
Packit 071ada
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
Packit 071ada
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
Packit 071ada
dnl 	HAVE_DOT = @HAVE_DOT@
Packit 071ada
HAVE_DOT=no
Packit 071ada
if test "x$have_doxygen" = "xyes"; then
Packit 071ada
  AC_PATH_PROG([DOT], [dot])
Packit 071ada
    if test "x$DOT" != "x"; then
Packit 071ada
      HAVE_DOT=yes
Packit 071ada
    fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST([HAVE_DOT])
Packit 071ada
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
Packit 071ada
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
Packit 071ada
]) # XORG_WITH_DOXYGEN
Packit 071ada
Packit 071ada
# XORG_WITH_GROFF([DEFAULT])
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.6.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.11.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a module to test for the
Packit 071ada
# presence of the tool and obtain it's path in separate variables. Coupled with
Packit 071ada
# the --with-groff option, it allows maximum flexibilty in making decisions
Packit 071ada
# as whether or not to use the groff package. When DEFAULT is not specified,
Packit 071ada
# --with-groff assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
Packit 071ada
# HAVE_GROFF_MM: the memorandum macros (-mm) package
Packit 071ada
# HAVE_GROFF_MS: the -ms macros package
Packit 071ada
# GROFF:	 returns the path of the groff program found
Packit 071ada
#		 returns the path set by the user in the environment
Packit 071ada
# --with-groff:	 'yes' user instructs the module to use groff
Packit 071ada
#		 'no' user instructs the module not to use groff
Packit 071ada
#
Packit 071ada
# Added in version 1.9.0:
Packit 071ada
# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
Packit 071ada
#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
Packit 071ada
#		   psselect from the psutils package.
Packit 071ada
#		   the ghostcript package. Refer to the grohtml man pages
Packit 071ada
#
Packit 071ada
# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
# OS and distros often splits groff in a basic and full package, the former
Packit 071ada
# having the groff program and the later having devices, fonts and macros
Packit 071ada
# Checking for the groff executable is not enough.
Packit 071ada
#
Packit 071ada
# If macros are missing, we cannot assume that groff is useless, so we don't
Packit 071ada
# unset HAVE_GROFF or GROFF env variables.
Packit 071ada
# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_GROFF],[
Packit 071ada
AC_ARG_VAR([GROFF], [Path to groff command])
Packit 071ada
m4_define([_defopt], m4_default([$1], [auto]))
Packit 071ada
AC_ARG_WITH(groff,
Packit 071ada
	AS_HELP_STRING([--with-groff],
Packit 071ada
	   [Use groff to regenerate documentation (default: ]_defopt[)]),
Packit 071ada
	   [use_groff=$withval], [use_groff=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_groff" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([GROFF], [groff])
Packit 071ada
   if test "x$GROFF" = "x"; then
Packit 071ada
        AC_MSG_WARN([groff not found - documentation targets will be skipped])
Packit 071ada
	have_groff=no
Packit 071ada
   else
Packit 071ada
        have_groff=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_groff" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([GROFF], [groff])
Packit 071ada
   if test "x$GROFF" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_groff=yes
Packit 071ada
elif test "x$use_groff" = x"no" ; then
Packit 071ada
   if test "x$GROFF" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_groff=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
Packit 071ada
# We have groff, test for the presence of the macro packages
Packit 071ada
if test "x$have_groff" = x"yes"; then
Packit 071ada
    AC_MSG_CHECKING([for ${GROFF} -ms macros])
Packit 071ada
    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
Packit 071ada
        groff_ms_works=yes
Packit 071ada
    else
Packit 071ada
        groff_ms_works=no
Packit 071ada
    fi
Packit 071ada
    AC_MSG_RESULT([$groff_ms_works])
Packit 071ada
    AC_MSG_CHECKING([for ${GROFF} -mm macros])
Packit 071ada
    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
Packit 071ada
        groff_mm_works=yes
Packit 071ada
    else
Packit 071ada
        groff_mm_works=no
Packit 071ada
    fi
Packit 071ada
    AC_MSG_RESULT([$groff_mm_works])
Packit 071ada
fi
Packit 071ada
Packit 071ada
# We have groff, test for HTML dependencies, one command per package
Packit 071ada
if test "x$have_groff" = x"yes"; then
Packit 071ada
   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
Packit 071ada
   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
Packit 071ada
   AC_PATH_PROG(PSSELECT_PATH, [psselect])
Packit 071ada
   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
Packit 071ada
      have_groff_html=yes
Packit 071ada
   else
Packit 071ada
      have_groff_html=no
Packit 071ada
      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
Packit 071ada
   fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
# Set Automake conditionals for Makefiles
Packit 071ada
AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
Packit 071ada
AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
Packit 071ada
AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
Packit 071ada
AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
Packit 071ada
]) # XORG_WITH_GROFF
Packit 071ada
Packit 071ada
# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
Packit 071ada
# ---------------------------------------
Packit 071ada
# Minimum version: 1.6.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.11.0
Packit 071ada
# Minimum version for optional MIN-VERSION argument: 1.15.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a module to test for the
Packit 071ada
# presence of the tool and obtain it's path in separate variables. Coupled with
Packit 071ada
# the --with-fop option, it allows maximum flexibilty in making decisions
Packit 071ada
# as whether or not to use the fop package. When DEFAULT is not specified,
Packit 071ada
# --with-fop assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_FOP: 	used in makefiles to conditionally generate documentation
Packit 071ada
# FOP:	 	returns the path of the fop program found
Packit 071ada
#		returns the path set by the user in the environment
Packit 071ada
# --with-fop: 	'yes' user instructs the module to use fop
Packit 071ada
#		'no' user instructs the module not to use fop
Packit 071ada
#
Packit 071ada
# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_FOP],[
Packit 071ada
AC_ARG_VAR([FOP], [Path to fop command])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(fop,
Packit 071ada
	AS_HELP_STRING([--with-fop],
Packit 071ada
	   [Use fop to regenerate documentation (default: ]_defopt[)]),
Packit 071ada
	   [use_fop=$withval], [use_fop=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_fop" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([FOP], [fop])
Packit 071ada
   if test "x$FOP" = "x"; then
Packit 071ada
        AC_MSG_WARN([fop not found - documentation targets will be skipped])
Packit 071ada
	have_fop=no
Packit 071ada
   else
Packit 071ada
        have_fop=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_fop" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([FOP], [fop])
Packit 071ada
   if test "x$FOP" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_fop=yes
Packit 071ada
elif test "x$use_fop" = x"no" ; then
Packit 071ada
   if test "x$FOP" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_fop=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
Packit 071ada
# Test for a minimum version of fop, if provided.
Packit 071ada
m4_ifval([$1],
Packit 071ada
[if test "$have_fop" = yes; then
Packit 071ada
    # scrape the fop version
Packit 071ada
    AC_MSG_CHECKING([for fop minimum version])
Packit 071ada
    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
Packit 071ada
    AC_MSG_RESULT([$fop_version])
Packit 071ada
    AS_VERSION_COMPARE([$fop_version], [$1],
Packit 071ada
        [if test "x$use_fop" = xauto; then
Packit 071ada
            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
Packit 071ada
            have_fop=no
Packit 071ada
        else
Packit 071ada
            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
Packit 071ada
        fi])
Packit 071ada
fi])
Packit 071ada
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
Packit 071ada
]) # XORG_WITH_FOP
Packit 071ada
Packit 071ada
# XORG_WITH_M4([MIN-VERSION])
Packit 071ada
# ---------------------------
Packit 071ada
# Minimum version: 1.19.0
Packit 071ada
#
Packit 071ada
# This macro attempts to locate an m4 macro processor which supports
Packit 071ada
# -I option and is only useful for modules relying on M4 in order to
Packit 071ada
# expand macros in source code files.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# M4:	 	returns the path of the m4 program found
Packit 071ada
#		returns the path set by the user in the environment
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_M4], [
Packit 071ada
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
Packit 071ada
   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
Packit 071ada
       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
Packit 071ada
         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
Packit 071ada
   [AC_MSG_ERROR([could not find m4 that supports -I option])],
Packit 071ada
   [$PATH:/usr/gnu/bin])])
Packit 071ada
Packit 071ada
AC_SUBST([M4], [$ac_cv_path_M4])
Packit 071ada
]) # XORG_WITH_M4
Packit 071ada
Packit 071ada
# XORG_WITH_PS2PDF([DEFAULT])
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.6.0
Packit 071ada
# Minimum version for optional DEFAULT argument: 1.11.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a module to test for the
Packit 071ada
# presence of the tool and obtain it's path in separate variables. Coupled with
Packit 071ada
# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
Packit 071ada
# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
Packit 071ada
# --with-ps2pdf assumes 'auto'.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
Packit 071ada
# PS2PDF:	returns the path of the ps2pdf program found
Packit 071ada
#		returns the path set by the user in the environment
Packit 071ada
# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
Packit 071ada
#		 'no' user instructs the module not to use ps2pdf
Packit 071ada
#
Packit 071ada
# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_PS2PDF],[
Packit 071ada
AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
Packit 071ada
m4_define([_defopt], m4_default([$1], [auto]))
Packit 071ada
AC_ARG_WITH(ps2pdf,
Packit 071ada
	AS_HELP_STRING([--with-ps2pdf],
Packit 071ada
	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
Packit 071ada
	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
if test "x$use_ps2pdf" = x"auto"; then
Packit 071ada
   AC_PATH_PROG([PS2PDF], [ps2pdf])
Packit 071ada
   if test "x$PS2PDF" = "x"; then
Packit 071ada
        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
Packit 071ada
	have_ps2pdf=no
Packit 071ada
   else
Packit 071ada
        have_ps2pdf=yes
Packit 071ada
   fi
Packit 071ada
elif test "x$use_ps2pdf" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([PS2PDF], [ps2pdf])
Packit 071ada
   if test "x$PS2PDF" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
Packit 071ada
   fi
Packit 071ada
   have_ps2pdf=yes
Packit 071ada
elif test "x$use_ps2pdf" = x"no" ; then
Packit 071ada
   if test "x$PS2PDF" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
Packit 071ada
   fi
Packit 071ada
   have_ps2pdf=no
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
Packit 071ada
]) # XORG_WITH_PS2PDF
Packit 071ada
Packit 071ada
# XORG_ENABLE_DOCS (enable_docs=yes)
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.6.0
Packit 071ada
#
Packit 071ada
# Documentation tools are not always available on all platforms and sometimes
Packit 071ada
# not at the appropriate level. This macro enables a builder to skip all
Packit 071ada
# documentation targets except traditional man pages.
Packit 071ada
# Combined with the specific tool checking macros XORG_WITH_*, it provides
Packit 071ada
# maximum flexibilty in controlling documentation building.
Packit 071ada
# Refer to:
Packit 071ada
# XORG_WITH_XMLTO         --with-xmlto
Packit 071ada
# XORG_WITH_ASCIIDOC      --with-asciidoc
Packit 071ada
# XORG_WITH_DOXYGEN       --with-doxygen
Packit 071ada
# XORG_WITH_FOP           --with-fop
Packit 071ada
# XORG_WITH_GROFF         --with-groff
Packit 071ada
# XORG_WITH_PS2PDF        --with-ps2pdf
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
Packit 071ada
# --enable-docs: 'yes' user instructs the module to generate docs
Packit 071ada
#		 'no' user instructs the module not to generate docs
Packit 071ada
# parm1:	specify the default value, yes or no.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_ENABLE_DOCS],[
Packit 071ada
m4_define([docs_default], m4_default([$1], [yes]))
Packit 071ada
AC_ARG_ENABLE(docs,
Packit 071ada
	AS_HELP_STRING([--enable-docs],
Packit 071ada
	   [Enable building the documentation (default: ]docs_default[)]),
Packit 071ada
	   [build_docs=$enableval], [build_docs=]docs_default)
Packit 071ada
m4_undefine([docs_default])
Packit 071ada
AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
Packit 071ada
AC_MSG_CHECKING([whether to build documentation])
Packit 071ada
AC_MSG_RESULT([$build_docs])
Packit 071ada
]) # XORG_ENABLE_DOCS
Packit 071ada
Packit 071ada
# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.6.0
Packit 071ada
#
Packit 071ada
# This macro enables a builder to skip all developer documentation.
Packit 071ada
# Combined with the specific tool checking macros XORG_WITH_*, it provides
Packit 071ada
# maximum flexibilty in controlling documentation building.
Packit 071ada
# Refer to:
Packit 071ada
# XORG_WITH_XMLTO         --with-xmlto
Packit 071ada
# XORG_WITH_ASCIIDOC      --with-asciidoc
Packit 071ada
# XORG_WITH_DOXYGEN       --with-doxygen
Packit 071ada
# XORG_WITH_FOP           --with-fop
Packit 071ada
# XORG_WITH_GROFF         --with-groff
Packit 071ada
# XORG_WITH_PS2PDF        --with-ps2pdf
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
Packit 071ada
# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
Packit 071ada
#			'no' user instructs the module not to generate developer docs
Packit 071ada
# parm1:		specify the default value, yes or no.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
Packit 071ada
m4_define([devel_default], m4_default([$1], [yes]))
Packit 071ada
AC_ARG_ENABLE(devel-docs,
Packit 071ada
	AS_HELP_STRING([--enable-devel-docs],
Packit 071ada
	   [Enable building the developer documentation (default: ]devel_default[)]),
Packit 071ada
	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
Packit 071ada
m4_undefine([devel_default])
Packit 071ada
AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
Packit 071ada
AC_MSG_CHECKING([whether to build developer documentation])
Packit 071ada
AC_MSG_RESULT([$build_devel_docs])
Packit 071ada
]) # XORG_ENABLE_DEVEL_DOCS
Packit 071ada
Packit 071ada
# XORG_ENABLE_SPECS (enable_specs=yes)
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.6.0
Packit 071ada
#
Packit 071ada
# This macro enables a builder to skip all functional specification targets.
Packit 071ada
# Combined with the specific tool checking macros XORG_WITH_*, it provides
Packit 071ada
# maximum flexibilty in controlling documentation building.
Packit 071ada
# Refer to:
Packit 071ada
# XORG_WITH_XMLTO         --with-xmlto
Packit 071ada
# XORG_WITH_ASCIIDOC      --with-asciidoc
Packit 071ada
# XORG_WITH_DOXYGEN       --with-doxygen
Packit 071ada
# XORG_WITH_FOP           --with-fop
Packit 071ada
# XORG_WITH_GROFF         --with-groff
Packit 071ada
# XORG_WITH_PS2PDF        --with-ps2pdf
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# ENABLE_SPECS:		used in makefiles to conditionally generate specs
Packit 071ada
# --enable-specs:	'yes' user instructs the module to generate specs
Packit 071ada
#			'no' user instructs the module not to generate specs
Packit 071ada
# parm1:		specify the default value, yes or no.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_ENABLE_SPECS],[
Packit 071ada
m4_define([spec_default], m4_default([$1], [yes]))
Packit 071ada
AC_ARG_ENABLE(specs,
Packit 071ada
	AS_HELP_STRING([--enable-specs],
Packit 071ada
	   [Enable building the specs (default: ]spec_default[)]),
Packit 071ada
	   [build_specs=$enableval], [build_specs=]spec_default)
Packit 071ada
m4_undefine([spec_default])
Packit 071ada
AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
Packit 071ada
AC_MSG_CHECKING([whether to build functional specifications])
Packit 071ada
AC_MSG_RESULT([$build_specs])
Packit 071ada
]) # XORG_ENABLE_SPECS
Packit 071ada
Packit 071ada
# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
Packit 071ada
# ----------------------------------------------
Packit 071ada
# Minimum version: 1.13.0
Packit 071ada
#
Packit 071ada
# This macro enables a builder to enable/disable unit testing
Packit 071ada
# It makes no assumption about the test cases implementation
Packit 071ada
# Test cases may or may not use Automake "Support for test suites"
Packit 071ada
# They may or may not use the software utility library GLib
Packit 071ada
#
Packit 071ada
# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
Packit 071ada
# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
Packit 071ada
# The variable enable_unit_tests is used by other macros in this file.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
Packit 071ada
# enable_unit_tests:    used in configure.ac for additional configuration
Packit 071ada
# --enable-unit-tests:	'yes' user instructs the module to build tests
Packit 071ada
#			'no' user instructs the module not to build tests
Packit 071ada
# parm1:		specify the default value, yes or no.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
Packit 071ada
AC_BEFORE([$0], [XORG_WITH_GLIB])
Packit 071ada
AC_BEFORE([$0], [XORG_LD_WRAP])
Packit 071ada
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
Packit 071ada
m4_define([_defopt], m4_default([$1], [auto]))
Packit 071ada
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
Packit 071ada
	[Enable building unit test cases (default: ]_defopt[)]),
Packit 071ada
	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
Packit 071ada
AC_MSG_CHECKING([whether to build unit test cases])
Packit 071ada
AC_MSG_RESULT([$enable_unit_tests])
Packit 071ada
]) # XORG_ENABLE_UNIT_TESTS
Packit 071ada
Packit 071ada
# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
Packit 071ada
# ------------------------------------------------------
Packit 071ada
# Minimum version: 1.17.0
Packit 071ada
#
Packit 071ada
# This macro enables a builder to enable/disable integration testing
Packit 071ada
# It makes no assumption about the test cases' implementation
Packit 071ada
# Test cases may or may not use Automake "Support for test suites"
Packit 071ada
#
Packit 071ada
# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
Packit 071ada
# usually requires less dependencies and may be built and run under less
Packit 071ada
# stringent environments than integration tests.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
Packit 071ada
# enable_integration_tests:   used in configure.ac for additional configuration
Packit 071ada
# --enable-integration-tests: 'yes' user instructs the module to build tests
Packit 071ada
#                             'no' user instructs the module not to build tests
Packit 071ada
# parm1:                      specify the default value, yes or no.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
Packit 071ada
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
Packit 071ada
m4_define([_defopt], m4_default([$1], [auto]))
Packit 071ada
AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
Packit 071ada
	[Enable building integration test cases (default: ]_defopt[)]),
Packit 071ada
	[enable_integration_tests=$enableval],
Packit 071ada
	[enable_integration_tests=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
Packit 071ada
	[test "x$enable_integration_tests" != xno])
Packit 071ada
AC_MSG_CHECKING([whether to build unit test cases])
Packit 071ada
AC_MSG_RESULT([$enable_integration_tests])
Packit 071ada
]) # XORG_ENABLE_INTEGRATION_TESTS
Packit 071ada
Packit 071ada
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
Packit 071ada
# ----------------------------------------
Packit 071ada
# Minimum version: 1.13.0
Packit 071ada
#
Packit 071ada
# GLib is a library which provides advanced data structures and functions.
Packit 071ada
# This macro enables a module to test for the presence of Glib.
Packit 071ada
#
Packit 071ada
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
Packit 071ada
# Otherwise the value of $enable_unit_tests is blank.
Packit 071ada
#
Packit 071ada
# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
Packit 071ada
# test support usually requires less dependencies and may be built and run under
Packit 071ada
# less stringent environments than integration tests.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# HAVE_GLIB: used in makefiles to conditionally build targets
Packit 071ada
# with_glib: used in configure.ac to know if GLib has been found
Packit 071ada
# --with-glib:	'yes' user instructs the module to use glib
Packit 071ada
#		'no' user instructs the module not to use glib
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_GLIB],[
Packit 071ada
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Packit 071ada
m4_define([_defopt], m4_default([$2], [auto]))
Packit 071ada
AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
Packit 071ada
	[Use GLib library for unit testing (default: ]_defopt[)]),
Packit 071ada
	[with_glib=$withval], [with_glib=]_defopt)
Packit 071ada
m4_undefine([_defopt])
Packit 071ada
Packit 071ada
have_glib=no
Packit 071ada
# Do not probe GLib if user explicitly disabled unit testing
Packit 071ada
if test "x$enable_unit_tests" != x"no"; then
Packit 071ada
  # Do not probe GLib if user explicitly disabled it
Packit 071ada
  if test "x$with_glib" != x"no"; then
Packit 071ada
    m4_ifval(
Packit 071ada
      [$1],
Packit 071ada
      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
Packit 071ada
      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
Packit 071ada
    )
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
# Not having GLib when unit testing has been explicitly requested is an error
Packit 071ada
if test "x$enable_unit_tests" = x"yes"; then
Packit 071ada
  if test "x$have_glib" = x"no"; then
Packit 071ada
    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
# Having unit testing disabled when GLib has been explicitly requested is an error
Packit 071ada
if test "x$enable_unit_tests" = x"no"; then
Packit 071ada
  if test "x$with_glib" = x"yes"; then
Packit 071ada
    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
# Not having GLib when it has been explicitly requested is an error
Packit 071ada
if test "x$with_glib" = x"yes"; then
Packit 071ada
  if test "x$have_glib" = x"no"; then
Packit 071ada
    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
Packit 071ada
]) # XORG_WITH_GLIB
Packit 071ada
Packit 071ada
# XORG_LD_WRAP([required|optional])
Packit 071ada
# ---------------------------------
Packit 071ada
# Minimum version: 1.13.0
Packit 071ada
#
Packit 071ada
# Check if linker supports -wrap, passed via compiler flags
Packit 071ada
#
Packit 071ada
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
Packit 071ada
# Otherwise the value of $enable_unit_tests is blank.
Packit 071ada
#
Packit 071ada
# Argument added in 1.16.0 - default is "required", to match existing behavior
Packit 071ada
# of returning an error if enable_unit_tests is yes, and ld -wrap is not
Packit 071ada
# available, an argument of "optional" allows use when some unit tests require
Packit 071ada
# ld -wrap and others do not.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_LD_WRAP],[
Packit 071ada
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
Packit 071ada
    [AC_LANG_PROGRAM([#include <stdlib.h>
Packit 071ada
                      void __wrap_exit(int status) { return; }],
Packit 071ada
                     [exit(0);])])
Packit 071ada
# Not having ld wrap when unit testing has been explicitly requested is an error
Packit 071ada
if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
Packit 071ada
  if test "x$have_ld_wrap" = x"no"; then
Packit 071ada
    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
Packit 071ada
#
Packit 071ada
]) # XORG_LD_WRAP
Packit 071ada
Packit 071ada
# XORG_CHECK_LINKER_FLAGS
Packit 071ada
# -----------------------
Packit 071ada
# SYNOPSIS
Packit 071ada
#
Packit 071ada
#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
Packit 071ada
#
Packit 071ada
# DESCRIPTION
Packit 071ada
#
Packit 071ada
#   Check whether the given linker FLAGS work with the current language's
Packit 071ada
#   linker, or whether they give an error.
Packit 071ada
#
Packit 071ada
#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
Packit 071ada
#   success/failure.
Packit 071ada
#
Packit 071ada
#   PROGRAM-SOURCE is the program source to link with, if needed
Packit 071ada
#
Packit 071ada
#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
Packit 071ada
#
Packit 071ada
# LICENSE
Packit 071ada
#
Packit 071ada
#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
Packit 071ada
#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
Packit 071ada
#   Copyright (c) 2009 Matteo Frigo
Packit 071ada
#
Packit 071ada
#   This program is free software: you can redistribute it and/or modify it
Packit 071ada
#   under the terms of the GNU General Public License as published by the
Packit 071ada
#   Free Software Foundation, either version 3 of the License, or (at your
Packit 071ada
#   option) any later version.
Packit 071ada
#
Packit 071ada
#   This program is distributed in the hope that it will be useful, but
Packit 071ada
#   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 071ada
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Packit 071ada
#   Public License for more details.
Packit 071ada
#
Packit 071ada
#   You should have received a copy of the GNU General Public License along
Packit 071ada
#   with this program. If not, see <http://www.gnu.org/licenses/>.
Packit 071ada
#
Packit 071ada
#   As a special exception, the respective Autoconf Macro's copyright owner
Packit 071ada
#   gives unlimited permission to copy, distribute and modify the configure
Packit 071ada
#   scripts that are the output of Autoconf when processing the Macro. You
Packit 071ada
#   need not follow the terms of the GNU General Public License when using
Packit 071ada
#   or distributing such scripts, even though portions of the text of the
Packit 071ada
#   Macro appear in them. The GNU General Public License (GPL) does govern
Packit 071ada
#   all other use of the material that constitutes the Autoconf Macro.
Packit 071ada
#
Packit 071ada
#   This special exception to the GPL applies to versions of the Autoconf
Packit 071ada
#   Macro released by the Autoconf Archive. When you make and distribute a
Packit 071ada
#   modified version of the Autoconf Macro, you may extend this special
Packit 071ada
#   exception to the GPL to apply to your modified version as well.#
Packit 071ada
AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
Packit 071ada
[AC_MSG_CHECKING([whether the linker accepts $1])
Packit 071ada
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
Packit 071ada
AS_LITERAL_IF([$1],
Packit 071ada
  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
Packit 071ada
      ax_save_FLAGS=$LDFLAGS
Packit 071ada
      LDFLAGS="$1"
Packit 071ada
      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
Packit 071ada
        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
Packit 071ada
        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
Packit 071ada
      LDFLAGS=$ax_save_FLAGS])],
Packit 071ada
  [ax_save_FLAGS=$LDFLAGS
Packit 071ada
   LDFLAGS="$1"
Packit 071ada
   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
Packit 071ada
     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
Packit 071ada
     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
Packit 071ada
   LDFLAGS=$ax_save_FLAGS])
Packit 071ada
eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
Packit 071ada
AC_MSG_RESULT($xorg_check_linker_flags)
Packit 071ada
if test "x$xorg_check_linker_flags" = xyes; then
Packit 071ada
	m4_default([$2], :)
Packit 071ada
else
Packit 071ada
	m4_default([$3], :)
Packit 071ada
fi
Packit 071ada
]) # XORG_CHECK_LINKER_FLAGS
Packit 071ada
Packit 071ada
# XORG_MEMORY_CHECK_FLAGS
Packit 071ada
# -----------------------
Packit 071ada
# Minimum version: 1.16.0
Packit 071ada
#
Packit 071ada
# This macro attempts to find appropriate memory checking functionality
Packit 071ada
# for various platforms which unit testing code may use to catch various
Packit 071ada
# forms of memory allocation and access errors in testing.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
Packit 071ada
#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
Packit 071ada
#
Packit 071ada
# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
Packit 071ada
Packit 071ada
AC_REQUIRE([AC_CANONICAL_HOST])
Packit 071ada
AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
Packit 071ada
           [Environment variables to enable memory checking in tests])
Packit 071ada
Packit 071ada
# Check for different types of support on different platforms
Packit 071ada
case $host_os in
Packit 071ada
    solaris*)
Packit 071ada
        AC_CHECK_LIB([umem], [umem_alloc],
Packit 071ada
            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
Packit 071ada
        ;;
Packit 071ada
    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
Packit 071ada
        # both directly and inverted, so should not be 0 or 255.
Packit 071ada
        malloc_debug_env='MALLOC_PERTURB_=15'
Packit 071ada
        ;;
Packit 071ada
    darwin*)
Packit 071ada
        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
Packit 071ada
        ;;
Packit 071ada
    *bsd*)
Packit 071ada
        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
Packit 071ada
        ;;
Packit 071ada
esac
Packit 071ada
Packit 071ada
# User supplied flags override default flags
Packit 071ada
if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
Packit 071ada
    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
Packit 071ada
]) # XORG_WITH_LINT
Packit 071ada
Packit 071ada
# XORG_CHECK_MALLOC_ZERO
Packit 071ada
# ----------------------
Packit 071ada
# Minimum version: 1.0.0
Packit 071ada
#
Packit 071ada
# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
Packit 071ada
# malloc(0) returns NULL.  Packages should add one of these cflags to
Packit 071ada
# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
Packit 071ada
AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
Packit 071ada
AC_ARG_ENABLE(malloc0returnsnull,
Packit 071ada
	AS_HELP_STRING([--enable-malloc0returnsnull],
Packit 071ada
		       [malloc(0) returns NULL (default: auto)]),
Packit 071ada
	[MALLOC_ZERO_RETURNS_NULL=$enableval],
Packit 071ada
	[MALLOC_ZERO_RETURNS_NULL=auto])
Packit 071ada
Packit 071ada
AC_MSG_CHECKING([whether malloc(0) returns NULL])
Packit 071ada
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
Packit 071ada
AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
Packit 071ada
	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
Packit 071ada
#include <stdlib.h>
Packit 071ada
],[
Packit 071ada
    char *m0, *r0, *c0, *p;
Packit 071ada
    m0 = malloc(0);
Packit 071ada
    p = malloc(10);
Packit 071ada
    r0 = realloc(p,0);
Packit 071ada
    c0 = calloc(0,10);
Packit 071ada
    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
Packit 071ada
])],
Packit 071ada
		[xorg_cv_malloc0_returns_null=yes],
Packit 071ada
		[xorg_cv_malloc0_returns_null=no])])
Packit 071ada
MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
Packit 071ada
fi
Packit 071ada
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
Packit 071ada
Packit 071ada
if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
Packit 071ada
	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
Packit 071ada
	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
Packit 071ada
	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
Packit 071ada
else
Packit 071ada
	MALLOC_ZERO_CFLAGS=""
Packit 071ada
	XMALLOC_ZERO_CFLAGS=""
Packit 071ada
	XTMALLOC_ZERO_CFLAGS=""
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST([MALLOC_ZERO_CFLAGS])
Packit 071ada
AC_SUBST([XMALLOC_ZERO_CFLAGS])
Packit 071ada
AC_SUBST([XTMALLOC_ZERO_CFLAGS])
Packit 071ada
]) # XORG_CHECK_MALLOC_ZERO
Packit 071ada
Packit 071ada
# XORG_WITH_LINT()
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.1.0
Packit 071ada
#
Packit 071ada
# This macro enables the use of a tool that flags some suspicious and
Packit 071ada
# non-portable constructs (likely to be bugs) in C language source code.
Packit 071ada
# It will attempt to locate the tool and use appropriate options.
Packit 071ada
# There are various lint type tools on different platforms.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# LINT:		returns the path to the tool found on the platform
Packit 071ada
#		or the value set to LINT on the configure cmd line
Packit 071ada
#		also an Automake conditional
Packit 071ada
# LINT_FLAGS:	an Automake variable with appropriate flags
Packit 071ada
#
Packit 071ada
# --with-lint:	'yes' user instructs the module to use lint
Packit 071ada
#		'no' user instructs the module not to use lint (default)
Packit 071ada
#
Packit 071ada
# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
Packit 071ada
# If the user sets the value of LINT_FLAGS, they are used verbatim.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_WITH_LINT],[
Packit 071ada
Packit 071ada
AC_ARG_VAR([LINT], [Path to a lint-style command])
Packit 071ada
AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
Packit 071ada
AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
Packit 071ada
		[Use a lint-style source code checker (default: disabled)])],
Packit 071ada
		[use_lint=$withval], [use_lint=no])
Packit 071ada
Packit 071ada
# Obtain platform specific info like program name and options
Packit 071ada
# The lint program on FreeBSD and NetBSD is different from the one on Solaris
Packit 071ada
case $host_os in
Packit 071ada
  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
Packit 071ada
	lint_name=splint
Packit 071ada
	lint_options="-badflag"
Packit 071ada
	;;
Packit 071ada
  *freebsd* | *netbsd*)
Packit 071ada
	lint_name=lint
Packit 071ada
	lint_options="-u -b"
Packit 071ada
	;;
Packit 071ada
  *solaris*)
Packit 071ada
	lint_name=lint
Packit 071ada
	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
Packit 071ada
	;;
Packit 071ada
esac
Packit 071ada
Packit 071ada
# Test for the presence of the program (either guessed by the code or spelled out by the user)
Packit 071ada
if test "x$use_lint" = x"yes" ; then
Packit 071ada
   AC_PATH_PROG([LINT], [$lint_name])
Packit 071ada
   if test "x$LINT" = "x"; then
Packit 071ada
        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
Packit 071ada
   fi
Packit 071ada
elif test "x$use_lint" = x"no" ; then
Packit 071ada
   if test "x$LINT" != "x"; then
Packit 071ada
      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
Packit 071ada
   fi
Packit 071ada
else
Packit 071ada
   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
Packit 071ada
fi
Packit 071ada
Packit 071ada
# User supplied flags override default flags
Packit 071ada
if test "x$LINT_FLAGS" != "x"; then
Packit 071ada
   lint_options=$LINT_FLAGS
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST([LINT_FLAGS],[$lint_options])
Packit 071ada
AM_CONDITIONAL(LINT, [test "x$LINT" != x])
Packit 071ada
Packit 071ada
]) # XORG_WITH_LINT
Packit 071ada
Packit 071ada
# XORG_LINT_LIBRARY(LIBNAME)
Packit 071ada
# --------------------------
Packit 071ada
# Minimum version: 1.1.0
Packit 071ada
#
Packit 071ada
# Sets up flags for building lint libraries for checking programs that call
Packit 071ada
# functions in the library.
Packit 071ada
#
Packit 071ada
# Interface to module:
Packit 071ada
# LINTLIB		- Automake variable with the name of lint library file to make
Packit 071ada
# MAKE_LINT_LIB		- Automake conditional
Packit 071ada
#
Packit 071ada
# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
Packit 071ada
#			  - 'no' user instructs the module not to create a lint library (default)
Packit 071ada
Packit 071ada
AC_DEFUN([XORG_LINT_LIBRARY],[
Packit 071ada
AC_REQUIRE([XORG_WITH_LINT])
Packit 071ada
AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
Packit 071ada
	[Create lint library (default: disabled)])],
Packit 071ada
	[make_lint_lib=$enableval], [make_lint_lib=no])
Packit 071ada
Packit 071ada
if test "x$make_lint_lib" = x"yes" ; then
Packit 071ada
   LINTLIB=llib-l$1.ln
Packit 071ada
   if test "x$LINT" = "x"; then
Packit 071ada
        AC_MSG_ERROR([Cannot make lint library without --with-lint])
Packit 071ada
   fi
Packit 071ada
elif test "x$make_lint_lib" != x"no" ; then
Packit 071ada
   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST(LINTLIB)
Packit 071ada
AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
Packit 071ada
Packit 071ada
]) # XORG_LINT_LIBRARY
Packit 071ada
Packit 071ada
# XORG_COMPILER_BRAND
Packit 071ada
# -------------------
Packit 071ada
# Minimum version: 1.14.0
Packit 071ada
#
Packit 071ada
# Checks for various brands of compilers and sets flags as appropriate:
Packit 071ada
#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
Packit 071ada
#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
Packit 071ada
#   clang compiler - sets CLANGCC to "yes"
Packit 071ada
#   Intel compiler - sets INTELCC to "yes"
Packit 071ada
#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_COMPILER_BRAND], [
Packit 071ada
AC_LANG_CASE(
Packit 071ada
	[C], [
Packit 071ada
		AC_REQUIRE([AC_PROG_CC_C99])
Packit 071ada
	],
Packit 071ada
	[C++], [
Packit 071ada
		AC_REQUIRE([AC_PROG_CXX])
Packit 071ada
	]
Packit 071ada
)
Packit 071ada
AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
Packit 071ada
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
Packit 071ada
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
Packit 071ada
]) # XORG_COMPILER_BRAND
Packit 071ada
Packit 071ada
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
Packit 071ada
# ---------------
Packit 071ada
# Minimum version: 1.16.0
Packit 071ada
#
Packit 071ada
# Test if the compiler works when passed the given flag as a command line argument.
Packit 071ada
# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
Packit 071ada
# next flag in the list until there are no more options.
Packit 071ada
#
Packit 071ada
# Note that this does not guarantee that the compiler supports the flag as some
Packit 071ada
# compilers will simply ignore arguments that they do not understand, but we do
Packit 071ada
# attempt to weed out false positives by using -Werror=unknown-warning-option and
Packit 071ada
# -Werror=unused-command-line-argument
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_TESTSET_CFLAG], [
Packit 071ada
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
Packit 071ada
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
Packit 071ada
Packit 071ada
AC_LANG_COMPILER_REQUIRE
Packit 071ada
Packit 071ada
AC_LANG_CASE(
Packit 071ada
	[C], [
Packit 071ada
		AC_REQUIRE([AC_PROG_CC_C99])
Packit 071ada
		define([PREFIX], [C])
Packit 071ada
		define([CACHE_PREFIX], [cc])
Packit 071ada
		define([COMPILER], [$CC])
Packit 071ada
	],
Packit 071ada
	[C++], [
Packit 071ada
		define([PREFIX], [CXX])
Packit 071ada
		define([CACHE_PREFIX], [cxx])
Packit 071ada
		define([COMPILER], [$CXX])
Packit 071ada
	]
Packit 071ada
)
Packit 071ada
Packit 071ada
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
Packit 071ada
Packit 071ada
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
Packit 071ada
	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
Packit 071ada
	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
Packit 071ada
			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
Packit 071ada
			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
Packit 071ada
					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
Packit 071ada
					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
Packit 071ada
	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
Packit 071ada
	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
Packit 071ada
fi
Packit 071ada
Packit 071ada
if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
Packit 071ada
	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
Packit 071ada
		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
Packit 071ada
	fi
Packit 071ada
	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
Packit 071ada
	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
Packit 071ada
			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
Packit 071ada
			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
Packit 071ada
					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
Packit 071ada
					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
Packit 071ada
	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
Packit 071ada
	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
Packit 071ada
fi
Packit 071ada
Packit 071ada
found="no"
Packit 071ada
m4_foreach([flag], m4_cdr($@), [
Packit 071ada
	if test $found = "no" ; then
Packit 071ada
		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
Packit 071ada
			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
Packit 071ada
		fi
Packit 071ada
Packit 071ada
		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
Packit 071ada
			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
Packit 071ada
		fi
Packit 071ada
Packit 071ada
		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
Packit 071ada
Packit 071ada
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
Packit 071ada
		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
Packit 071ada
		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
Packit 071ada
		AC_CACHE_VAL($cacheid,
Packit 071ada
			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
Packit 071ada
					     [eval $cacheid=yes],
Packit 071ada
					     [eval $cacheid=no])])
Packit 071ada
Packit 071ada
		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
Packit 071ada
Packit 071ada
		eval supported=\$$cacheid
Packit 071ada
		AC_MSG_RESULT([$supported])
Packit 071ada
		if test "$supported" = "yes" ; then
Packit 071ada
			$1="$$1 ]flag["
Packit 071ada
			found="yes"
Packit 071ada
		fi
Packit 071ada
	fi
Packit 071ada
])
Packit 071ada
]) # XORG_TESTSET_CFLAG
Packit 071ada
Packit 071ada
# XORG_COMPILER_FLAGS
Packit 071ada
# ---------------
Packit 071ada
# Minimum version: 1.16.0
Packit 071ada
#
Packit 071ada
# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
Packit 071ada
# arguments supported by the selected compiler which do NOT alter the generated
Packit 071ada
# code.  These arguments will cause the compiler to print various warnings
Packit 071ada
# during compilation AND turn a conservative set of warnings into errors.
Packit 071ada
#
Packit 071ada
# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
Packit 071ada
# future versions of util-macros as options are added to new compilers.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_COMPILER_FLAGS], [
Packit 071ada
AC_REQUIRE([XORG_COMPILER_BRAND])
Packit 071ada
Packit 071ada
AC_ARG_ENABLE(selective-werror,
Packit 071ada
              AS_HELP_STRING([--disable-selective-werror],
Packit 071ada
                             [Turn off selective compiler errors. (default: enabled)]),
Packit 071ada
              [SELECTIVE_WERROR=$enableval],
Packit 071ada
              [SELECTIVE_WERROR=yes])
Packit 071ada
Packit 071ada
AC_LANG_CASE(
Packit 071ada
        [C], [
Packit 071ada
                define([PREFIX], [C])
Packit 071ada
        ],
Packit 071ada
        [C++], [
Packit 071ada
                define([PREFIX], [CXX])
Packit 071ada
        ]
Packit 071ada
)
Packit 071ada
# -v is too short to test reliably with XORG_TESTSET_CFLAG
Packit 071ada
if test "x$SUNCC" = "xyes"; then
Packit 071ada
    [BASE_]PREFIX[FLAGS]="-v"
Packit 071ada
else
Packit 071ada
    [BASE_]PREFIX[FLAGS]=""
Packit 071ada
fi
Packit 071ada
Packit 071ada
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
Packit 071ada
Packit 071ada
AC_LANG_CASE(
Packit 071ada
	[C], [
Packit 071ada
		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
Packit 071ada
		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
Packit 071ada
		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
Packit 071ada
		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
Packit 071ada
		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
Packit 071ada
		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
Packit 071ada
	]
Packit 071ada
)
Packit 071ada
Packit 071ada
# This chunk adds additional warnings that could catch undesired effects.
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
Packit 071ada
Packit 071ada
# These are currently disabled because they are noisy.  They will be enabled
Packit 071ada
# in the future once the codebase is sufficiently modernized to silence
Packit 071ada
# them.  For now, I don't want them to drown out the other warnings.
Packit 071ada
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
Packit 071ada
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
Packit 071ada
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
Packit 071ada
Packit 071ada
# Turn some warnings into errors, so we don't accidently get successful builds
Packit 071ada
# when there are problems that should be fixed.
Packit 071ada
Packit 071ada
if test "x$SELECTIVE_WERROR" = "xyes" ; then
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
Packit 071ada
else
Packit 071ada
AC_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])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
Packit 071ada
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
Packit 071ada
fi
Packit 071ada
Packit 071ada
AC_SUBST([BASE_]PREFIX[FLAGS])
Packit 071ada
]) # XORG_COMPILER_FLAGS
Packit 071ada
Packit 071ada
# XORG_CWARNFLAGS
Packit 071ada
# ---------------
Packit 071ada
# Minimum version: 1.2.0
Packit 071ada
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
Packit 071ada
#
Packit 071ada
# Defines CWARNFLAGS to enable C compiler warnings.
Packit 071ada
#
Packit 071ada
# This function is deprecated because it defines -fno-strict-aliasing
Packit 071ada
# which alters the code generated by the compiler.  If -fno-strict-aliasing
Packit 071ada
# is needed, then it should be added explicitly in the module when
Packit 071ada
# it is updated to use BASE_CFLAGS.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_CWARNFLAGS], [
Packit 071ada
AC_REQUIRE([XORG_COMPILER_FLAGS])
Packit 071ada
AC_REQUIRE([XORG_COMPILER_BRAND])
Packit 071ada
AC_LANG_CASE(
Packit 071ada
	[C], [
Packit 071ada
		CWARNFLAGS="$BASE_CFLAGS"
Packit 071ada
		if  test "x$GCC" = xyes ; then
Packit 071ada
		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
Packit 071ada
		fi
Packit 071ada
		AC_SUBST(CWARNFLAGS)
Packit 071ada
	]
Packit 071ada
)
Packit 071ada
]) # XORG_CWARNFLAGS
Packit 071ada
Packit 071ada
# XORG_STRICT_OPTION
Packit 071ada
# -----------------------
Packit 071ada
# Minimum version: 1.3.0
Packit 071ada
#
Packit 071ada
# Add configure option to enable strict compilation flags, such as treating
Packit 071ada
# warnings as fatal errors.
Packit 071ada
# If --enable-strict-compilation is passed to configure, adds strict flags to
Packit 071ada
# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
Packit 071ada
#
Packit 071ada
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
Packit 071ada
# when strict compilation is unconditionally desired.
Packit 071ada
AC_DEFUN([XORG_STRICT_OPTION], [
Packit 071ada
AC_REQUIRE([XORG_CWARNFLAGS])
Packit 071ada
AC_REQUIRE([XORG_COMPILER_FLAGS])
Packit 071ada
Packit 071ada
AC_ARG_ENABLE(strict-compilation,
Packit 071ada
			  AS_HELP_STRING([--enable-strict-compilation],
Packit 071ada
			  [Enable all warnings from compiler and make them errors (default: disabled)]),
Packit 071ada
			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
Packit 071ada
Packit 071ada
AC_LANG_CASE(
Packit 071ada
        [C], [
Packit 071ada
                define([PREFIX], [C])
Packit 071ada
        ],
Packit 071ada
        [C++], [
Packit 071ada
                define([PREFIX], [CXX])
Packit 071ada
        ]
Packit 071ada
)
Packit 071ada
Packit 071ada
[STRICT_]PREFIX[FLAGS]=""
Packit 071ada
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
Packit 071ada
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
Packit 071ada
Packit 071ada
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
Packit 071ada
# activate it with -Werror, so we add it here explicitly.
Packit 071ada
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
Packit 071ada
Packit 071ada
if test "x$STRICT_COMPILE" = "xyes"; then
Packit 071ada
    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
Packit 071ada
    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
Packit 071ada
fi
Packit 071ada
AC_SUBST([STRICT_]PREFIX[FLAGS])
Packit 071ada
AC_SUBST([BASE_]PREFIX[FLAGS])
Packit 071ada
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
Packit 071ada
]) # XORG_STRICT_OPTION
Packit 071ada
Packit 071ada
# XORG_DEFAULT_OPTIONS
Packit 071ada
# --------------------
Packit 071ada
# Minimum version: 1.3.0
Packit 071ada
#
Packit 071ada
# Defines default options for X.Org modules.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
Packit 071ada
AC_REQUIRE([AC_PROG_INSTALL])
Packit 071ada
XORG_COMPILER_FLAGS
Packit 071ada
XORG_CWARNFLAGS
Packit 071ada
XORG_STRICT_OPTION
Packit 071ada
XORG_RELEASE_VERSION
Packit 071ada
XORG_CHANGELOG
Packit 071ada
XORG_INSTALL
Packit 071ada
XORG_MANPAGE_SECTIONS
Packit 071ada
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
Packit 071ada
    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
Packit 071ada
]) # XORG_DEFAULT_OPTIONS
Packit 071ada
Packit 071ada
# XORG_INSTALL()
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.4.0
Packit 071ada
#
Packit 071ada
# Defines the variable INSTALL_CMD as the command to copy
Packit 071ada
# INSTALL from $prefix/share/util-macros.
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_INSTALL], [
Packit 071ada
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Packit 071ada
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
Packit 071ada
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
Packit 071ada
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
Packit 071ada
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
Packit 071ada
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
Packit 071ada
AC_SUBST([INSTALL_CMD])
Packit 071ada
]) # XORG_INSTALL
Packit 071ada
dnl Copyright 2005 Red Hat, Inc
Packit 071ada
dnl
Packit 071ada
dnl Permission to use, copy, modify, distribute, and sell this software and its
Packit 071ada
dnl documentation for any purpose is hereby granted without fee, provided that
Packit 071ada
dnl the above copyright notice appear in all copies and that both that
Packit 071ada
dnl copyright notice and this permission notice appear in supporting
Packit 071ada
dnl documentation.
Packit 071ada
dnl
Packit 071ada
dnl The above copyright notice and this permission notice shall be included
Packit 071ada
dnl in all copies or substantial portions of the Software.
Packit 071ada
dnl
Packit 071ada
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit 071ada
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 071ada
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Packit 071ada
dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit 071ada
dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit 071ada
dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit 071ada
dnl OTHER DEALINGS IN THE SOFTWARE.
Packit 071ada
dnl
Packit 071ada
dnl Except as contained in this notice, the name of the copyright holders shall
Packit 071ada
dnl not be used in advertising or otherwise to promote the sale, use or
Packit 071ada
dnl other dealings in this Software without prior written authorization
Packit 071ada
dnl from the copyright holders.
Packit 071ada
dnl
Packit 071ada
Packit 071ada
# XORG_RELEASE_VERSION
Packit 071ada
# --------------------
Packit 071ada
# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
Packit 071ada
Packit 071ada
AC_DEFUN([XORG_RELEASE_VERSION],[
Packit 071ada
	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
Packit 071ada
		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
Packit 071ada
		[Major version of this package])
Packit 071ada
	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
Packit 071ada
	if test "x$PVM" = "x"; then
Packit 071ada
		PVM="0"
Packit 071ada
	fi
Packit 071ada
	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
Packit 071ada
		[$PVM],
Packit 071ada
		[Minor version of this package])
Packit 071ada
	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
Packit 071ada
	if test "x$PVP" = "x"; then
Packit 071ada
		PVP="0"
Packit 071ada
	fi
Packit 071ada
	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
Packit 071ada
		[$PVP],
Packit 071ada
		[Patch version of this package])
Packit 071ada
])
Packit 071ada
Packit 071ada
# XORG_CHANGELOG()
Packit 071ada
# ----------------
Packit 071ada
# Minimum version: 1.2.0
Packit 071ada
#
Packit 071ada
# Defines the variable CHANGELOG_CMD as the command to generate
Packit 071ada
# ChangeLog from git.
Packit 071ada
#
Packit 071ada
#
Packit 071ada
AC_DEFUN([XORG_CHANGELOG], [
Packit 071ada
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
Packit 071ada
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
Packit 071ada
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
Packit 071ada
echo 'git directory not found: installing possibly empty changelog.' >&2)"
Packit 071ada
AC_SUBST([CHANGELOG_CMD])
Packit 071ada
]) # XORG_CHANGELOG
Packit 071ada
Packit 071ada
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# AM_AUTOMAKE_VERSION(VERSION)
Packit 071ada
# ----------------------------
Packit 071ada
# Automake X.Y traces this macro to ensure aclocal.m4 has been
Packit 071ada
# generated from the m4 files accompanying Automake X.Y.
Packit 071ada
# (This private macro should not be called outside this file.)
Packit 071ada
AC_DEFUN([AM_AUTOMAKE_VERSION],
Packit 071ada
[am__api_version='1.16'
Packit 071ada
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
Packit 071ada
dnl require some minimum version.  Point them to the right macro.
Packit 071ada
m4_if([$1], [1.16.1], [],
Packit 071ada
      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
Packit 071ada
])
Packit 071ada
Packit 071ada
# _AM_AUTOCONF_VERSION(VERSION)
Packit 071ada
# -----------------------------
Packit 071ada
# aclocal traces this macro to find the Autoconf version.
Packit 071ada
# This is a private macro too.  Using m4_define simplifies
Packit 071ada
# the logic in aclocal, which can simply ignore this definition.
Packit 071ada
m4_define([_AM_AUTOCONF_VERSION], [])
Packit 071ada
Packit 071ada
# AM_SET_CURRENT_AUTOMAKE_VERSION
Packit 071ada
# -------------------------------
Packit 071ada
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
Packit 071ada
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
Packit 071ada
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
Packit 071ada
[AM_AUTOMAKE_VERSION([1.16.1])dnl
Packit 071ada
m4_ifndef([AC_AUTOCONF_VERSION],
Packit 071ada
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
Packit 071ada
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
Packit 071ada
Packit 071ada
# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
Packit 071ada
# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
Packit 071ada
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
Packit 071ada
#
Packit 071ada
# Of course, Automake must honor this variable whenever it calls a
Packit 071ada
# tool from the auxiliary directory.  The problem is that $srcdir (and
Packit 071ada
# therefore $ac_aux_dir as well) can be either absolute or relative,
Packit 071ada
# depending on how configure is run.  This is pretty annoying, since
Packit 071ada
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
Packit 071ada
# source directory, any form will work fine, but in subdirectories a
Packit 071ada
# relative path needs to be adjusted first.
Packit 071ada
#
Packit 071ada
# $ac_aux_dir/missing
Packit 071ada
#    fails when called from a subdirectory if $ac_aux_dir is relative
Packit 071ada
# $top_srcdir/$ac_aux_dir/missing
Packit 071ada
#    fails if $ac_aux_dir is absolute,
Packit 071ada
#    fails when called from a subdirectory in a VPATH build with
Packit 071ada
#          a relative $ac_aux_dir
Packit 071ada
#
Packit 071ada
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
Packit 071ada
# are both prefixed by $srcdir.  In an in-source build this is usually
Packit 071ada
# harmless because $srcdir is '.', but things will broke when you
Packit 071ada
# start a VPATH build or use an absolute $srcdir.
Packit 071ada
#
Packit 071ada
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
Packit 071ada
# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
Packit 071ada
#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
Packit 071ada
# and then we would define $MISSING as
Packit 071ada
#   MISSING="\${SHELL} $am_aux_dir/missing"
Packit 071ada
# This will work as long as MISSING is not called from configure, because
Packit 071ada
# unfortunately $(top_srcdir) has no meaning in configure.
Packit 071ada
# However there are other variables, like CC, which are often used in
Packit 071ada
# configure, and could therefore not use this "fixed" $ac_aux_dir.
Packit 071ada
#
Packit 071ada
# Another solution, used here, is to always expand $ac_aux_dir to an
Packit 071ada
# absolute PATH.  The drawback is that using absolute paths prevent a
Packit 071ada
# configured tree to be moved without reconfiguration.
Packit 071ada
Packit 071ada
AC_DEFUN([AM_AUX_DIR_EXPAND],
Packit 071ada
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
Packit 071ada
# Expand $ac_aux_dir to an absolute path.
Packit 071ada
am_aux_dir=`cd "$ac_aux_dir" && pwd`
Packit 071ada
])
Packit 071ada
Packit 071ada
# AM_CONDITIONAL                                            -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
Packit 071ada
# -------------------------------------
Packit 071ada
# Define a conditional.
Packit 071ada
AC_DEFUN([AM_CONDITIONAL],
Packit 071ada
[AC_PREREQ([2.52])dnl
Packit 071ada
 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
Packit 071ada
       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
Packit 071ada
AC_SUBST([$1_TRUE])dnl
Packit 071ada
AC_SUBST([$1_FALSE])dnl
Packit 071ada
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
Packit 071ada
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
Packit 071ada
m4_define([_AM_COND_VALUE_$1], [$2])dnl
Packit 071ada
if $2; then
Packit 071ada
  $1_TRUE=
Packit 071ada
  $1_FALSE='#'
Packit 071ada
else
Packit 071ada
  $1_TRUE='#'
Packit 071ada
  $1_FALSE=
Packit 071ada
fi
Packit 071ada
AC_CONFIG_COMMANDS_PRE(
Packit 071ada
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
Packit 071ada
  AC_MSG_ERROR([[conditional "$1" was never defined.
Packit 071ada
Usually this means the macro was only invoked conditionally.]])
Packit 071ada
fi])])
Packit 071ada
Packit 071ada
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
Packit 071ada
# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
Packit 071ada
# written in clear, in which case automake, when reading aclocal.m4,
Packit 071ada
# will think it sees a *use*, and therefore will trigger all it's
Packit 071ada
# C support machinery.  Also note that it means that autoscan, seeing
Packit 071ada
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
Packit 071ada
Packit 071ada
Packit 071ada
# _AM_DEPENDENCIES(NAME)
Packit 071ada
# ----------------------
Packit 071ada
# See how the compiler implements dependency checking.
Packit 071ada
# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
Packit 071ada
# We try a few techniques and use that to set a single cache variable.
Packit 071ada
#
Packit 071ada
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
Packit 071ada
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
Packit 071ada
# dependency, and given that the user is not expected to run this macro,
Packit 071ada
# just rely on AC_PROG_CC.
Packit 071ada
AC_DEFUN([_AM_DEPENDENCIES],
Packit 071ada
[AC_REQUIRE([AM_SET_DEPDIR])dnl
Packit 071ada
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
Packit 071ada
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
Packit 071ada
AC_REQUIRE([AM_DEP_TRACK])dnl
Packit 071ada
Packit 071ada
m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
Packit 071ada
      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
Packit 071ada
      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
Packit 071ada
      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
Packit 071ada
      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
Packit 071ada
      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
Packit 071ada
                    [depcc="$$1"   am_compiler_list=])
Packit 071ada
Packit 071ada
AC_CACHE_CHECK([dependency style of $depcc],
Packit 071ada
               [am_cv_$1_dependencies_compiler_type],
Packit 071ada
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
Packit 071ada
  # We make a subdir and do the tests there.  Otherwise we can end up
Packit 071ada
  # making bogus files that we don't know about and never remove.  For
Packit 071ada
  # instance it was reported that on HP-UX the gcc test will end up
Packit 071ada
  # making a dummy file named 'D' -- because '-MD' means "put the output
Packit 071ada
  # in D".
Packit 071ada
  rm -rf conftest.dir
Packit 071ada
  mkdir conftest.dir
Packit 071ada
  # Copy depcomp to subdir because otherwise we won't find it if we're
Packit 071ada
  # using a relative directory.
Packit 071ada
  cp "$am_depcomp" conftest.dir
Packit 071ada
  cd conftest.dir
Packit 071ada
  # We will build objects and dependencies in a subdirectory because
Packit 071ada
  # it helps to detect inapplicable dependency modes.  For instance
Packit 071ada
  # both Tru64's cc and ICC support -MD to output dependencies as a
Packit 071ada
  # side effect of compilation, but ICC will put the dependencies in
Packit 071ada
  # the current directory while Tru64 will put them in the object
Packit 071ada
  # directory.
Packit 071ada
  mkdir sub
Packit 071ada
Packit 071ada
  am_cv_$1_dependencies_compiler_type=none
Packit 071ada
  if test "$am_compiler_list" = ""; then
Packit 071ada
     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
Packit 071ada
  fi
Packit 071ada
  am__universal=false
Packit 071ada
  m4_case([$1], [CC],
Packit 071ada
    [case " $depcc " in #(
Packit 071ada
     *\ -arch\ *\ -arch\ *) am__universal=true ;;
Packit 071ada
     esac],
Packit 071ada
    [CXX],
Packit 071ada
    [case " $depcc " in #(
Packit 071ada
     *\ -arch\ *\ -arch\ *) am__universal=true ;;
Packit 071ada
     esac])
Packit 071ada
Packit 071ada
  for depmode in $am_compiler_list; do
Packit 071ada
    # Setup a source with many dependencies, because some compilers
Packit 071ada
    # like to wrap large dependency lists on column 80 (with \), and
Packit 071ada
    # we should not choose a depcomp mode which is confused by this.
Packit 071ada
    #
Packit 071ada
    # We need to recreate these files for each test, as the compiler may
Packit 071ada
    # overwrite some of them when testing with obscure command lines.
Packit 071ada
    # This happens at least with the AIX C compiler.
Packit 071ada
    : > sub/conftest.c
Packit 071ada
    for i in 1 2 3 4 5 6; do
Packit 071ada
      echo '#include "conftst'$i'.h"' >> sub/conftest.c
Packit 071ada
      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
Packit 071ada
      # Solaris 10 /bin/sh.
Packit 071ada
      echo '/* dummy */' > sub/conftst$i.h
Packit 071ada
    done
Packit 071ada
    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
Packit 071ada
Packit 071ada
    # We check with '-c' and '-o' for the sake of the "dashmstdout"
Packit 071ada
    # mode.  It turns out that the SunPro C++ compiler does not properly
Packit 071ada
    # handle '-M -o', and we need to detect this.  Also, some Intel
Packit 071ada
    # versions had trouble with output in subdirs.
Packit 071ada
    am__obj=sub/conftest.${OBJEXT-o}
Packit 071ada
    am__minus_obj="-o $am__obj"
Packit 071ada
    case $depmode in
Packit 071ada
    gcc)
Packit 071ada
      # This depmode causes a compiler race in universal mode.
Packit 071ada
      test "$am__universal" = false || continue
Packit 071ada
      ;;
Packit 071ada
    nosideeffect)
Packit 071ada
      # After this tag, mechanisms are not by side-effect, so they'll
Packit 071ada
      # only be used when explicitly requested.
Packit 071ada
      if test "x$enable_dependency_tracking" = xyes; then
Packit 071ada
	continue
Packit 071ada
      else
Packit 071ada
	break
Packit 071ada
      fi
Packit 071ada
      ;;
Packit 071ada
    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
Packit 071ada
      # This compiler won't grok '-c -o', but also, the minuso test has
Packit 071ada
      # not run yet.  These depmodes are late enough in the game, and
Packit 071ada
      # so weak that their functioning should not be impacted.
Packit 071ada
      am__obj=conftest.${OBJEXT-o}
Packit 071ada
      am__minus_obj=
Packit 071ada
      ;;
Packit 071ada
    none) break ;;
Packit 071ada
    esac
Packit 071ada
    if depmode=$depmode \
Packit 071ada
       source=sub/conftest.c object=$am__obj \
Packit 071ada
       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
Packit 071ada
       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
Packit 071ada
         >/dev/null 2>conftest.err &&
Packit 071ada
       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
Packit 071ada
       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
Packit 071ada
       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
Packit 071ada
       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
Packit 071ada
      # icc doesn't choke on unknown options, it will just issue warnings
Packit 071ada
      # or remarks (even with -Werror).  So we grep stderr for any message
Packit 071ada
      # that says an option was ignored or not supported.
Packit 071ada
      # When given -MP, icc 7.0 and 7.1 complain thusly:
Packit 071ada
      #   icc: Command line warning: ignoring option '-M'; no argument required
Packit 071ada
      # The diagnosis changed in icc 8.0:
Packit 071ada
      #   icc: Command line remark: option '-MP' not supported
Packit 071ada
      if (grep 'ignoring option' conftest.err ||
Packit 071ada
          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
Packit 071ada
        am_cv_$1_dependencies_compiler_type=$depmode
Packit 071ada
        break
Packit 071ada
      fi
Packit 071ada
    fi
Packit 071ada
  done
Packit 071ada
Packit 071ada
  cd ..
Packit 071ada
  rm -rf conftest.dir
Packit 071ada
else
Packit 071ada
  am_cv_$1_dependencies_compiler_type=none
Packit 071ada
fi
Packit 071ada
])
Packit 071ada
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
Packit 071ada
AM_CONDITIONAL([am__fastdep$1], [
Packit 071ada
  test "x$enable_dependency_tracking" != xno \
Packit 071ada
  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
Packit 071ada
])
Packit 071ada
Packit 071ada
Packit 071ada
# AM_SET_DEPDIR
Packit 071ada
# -------------
Packit 071ada
# Choose a directory name for dependency files.
Packit 071ada
# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
Packit 071ada
AC_DEFUN([AM_SET_DEPDIR],
Packit 071ada
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
Packit 071ada
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
Packit 071ada
])
Packit 071ada
Packit 071ada
Packit 071ada
# AM_DEP_TRACK
Packit 071ada
# ------------
Packit 071ada
AC_DEFUN([AM_DEP_TRACK],
Packit 071ada
[AC_ARG_ENABLE([dependency-tracking], [dnl
Packit 071ada
AS_HELP_STRING(
Packit 071ada
  [--enable-dependency-tracking],
Packit 071ada
  [do not reject slow dependency extractors])
Packit 071ada
AS_HELP_STRING(
Packit 071ada
  [--disable-dependency-tracking],
Packit 071ada
  [speeds up one-time build])])
Packit 071ada
if test "x$enable_dependency_tracking" != xno; then
Packit 071ada
  am_depcomp="$ac_aux_dir/depcomp"
Packit 071ada
  AMDEPBACKSLASH='\'
Packit 071ada
  am__nodep='_no'
Packit 071ada
fi
Packit 071ada
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
Packit 071ada
AC_SUBST([AMDEPBACKSLASH])dnl
Packit 071ada
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
Packit 071ada
AC_SUBST([am__nodep])dnl
Packit 071ada
_AM_SUBST_NOTMAKE([am__nodep])dnl
Packit 071ada
])
Packit 071ada
Packit 071ada
# Generate code to set up dependency tracking.              -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# _AM_OUTPUT_DEPENDENCY_COMMANDS
Packit 071ada
# ------------------------------
Packit 071ada
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
Packit 071ada
[{
Packit 071ada
  # Older Autoconf quotes --file arguments for eval, but not when files
Packit 071ada
  # are listed without --file.  Let's play safe and only enable the eval
Packit 071ada
  # if we detect the quoting.
Packit 071ada
  # TODO: see whether this extra hack can be removed once we start
Packit 071ada
  # requiring Autoconf 2.70 or later.
Packit 071ada
  AS_CASE([$CONFIG_FILES],
Packit 071ada
          [*\'*], [eval set x "$CONFIG_FILES"],
Packit 071ada
          [*], [set x $CONFIG_FILES])
Packit 071ada
  shift
Packit 071ada
  # Used to flag and report bootstrapping failures.
Packit 071ada
  am_rc=0
Packit 071ada
  for am_mf
Packit 071ada
  do
Packit 071ada
    # Strip MF so we end up with the name of the file.
Packit 071ada
    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
Packit 071ada
    # Check whether this is an Automake generated Makefile which includes
Packit 071ada
    # dependency-tracking related rules and includes.
Packit 071ada
    # Grep'ing the whole file directly is not great: AIX grep has a line
Packit 071ada
    # limit of 2048, but all sed's we know have understand at least 4000.
Packit 071ada
    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
Packit 071ada
      || continue
Packit 071ada
    am_dirpart=`AS_DIRNAME(["$am_mf"])`
Packit 071ada
    am_filepart=`AS_BASENAME(["$am_mf"])`
Packit 071ada
    AM_RUN_LOG([cd "$am_dirpart" \
Packit 071ada
      && sed -e '/# am--include-marker/d' "$am_filepart" \
Packit 071ada
        | $MAKE -f - am--depfiles]) || am_rc=$?
Packit 071ada
  done
Packit 071ada
  if test $am_rc -ne 0; then
Packit 071ada
    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
Packit 071ada
    for automatic dependency tracking.  Try re-running configure with the
Packit 071ada
    '--disable-dependency-tracking' option to at least be able to build
Packit 071ada
    the package (albeit without support for automatic dependency tracking).])
Packit 071ada
  fi
Packit 071ada
  AS_UNSET([am_dirpart])
Packit 071ada
  AS_UNSET([am_filepart])
Packit 071ada
  AS_UNSET([am_mf])
Packit 071ada
  AS_UNSET([am_rc])
Packit 071ada
  rm -f conftest-deps.mk
Packit 071ada
}
Packit 071ada
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
Packit 071ada
Packit 071ada
Packit 071ada
# AM_OUTPUT_DEPENDENCY_COMMANDS
Packit 071ada
# -----------------------------
Packit 071ada
# This macro should only be invoked once -- use via AC_REQUIRE.
Packit 071ada
#
Packit 071ada
# This code is only required when automatic dependency tracking is enabled.
Packit 071ada
# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
Packit 071ada
# order to bootstrap the dependency handling code.
Packit 071ada
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
Packit 071ada
[AC_CONFIG_COMMANDS([depfiles],
Packit 071ada
     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
Packit 071ada
     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
Packit 071ada
Packit 071ada
# Do all the work for Automake.                             -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# This macro actually does too much.  Some checks are only needed if
Packit 071ada
# your package does certain things.  But this isn't really a big deal.
Packit 071ada
Packit 071ada
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
Packit 071ada
m4_define([AC_PROG_CC],
Packit 071ada
m4_defn([AC_PROG_CC])
Packit 071ada
[_AM_PROG_CC_C_O
Packit 071ada
])
Packit 071ada
Packit 071ada
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
Packit 071ada
# AM_INIT_AUTOMAKE([OPTIONS])
Packit 071ada
# -----------------------------------------------
Packit 071ada
# The call with PACKAGE and VERSION arguments is the old style
Packit 071ada
# call (pre autoconf-2.50), which is being phased out.  PACKAGE
Packit 071ada
# and VERSION should now be passed to AC_INIT and removed from
Packit 071ada
# the call to AM_INIT_AUTOMAKE.
Packit 071ada
# We support both call styles for the transition.  After
Packit 071ada
# the next Automake release, Autoconf can make the AC_INIT
Packit 071ada
# arguments mandatory, and then we can depend on a new Autoconf
Packit 071ada
# release and drop the old call support.
Packit 071ada
AC_DEFUN([AM_INIT_AUTOMAKE],
Packit 071ada
[AC_PREREQ([2.65])dnl
Packit 071ada
dnl Autoconf wants to disallow AM_ names.  We explicitly allow
Packit 071ada
dnl the ones we care about.
Packit 071ada
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
Packit 071ada
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
Packit 071ada
AC_REQUIRE([AC_PROG_INSTALL])dnl
Packit 071ada
if test "`cd $srcdir && pwd`" != "`pwd`"; then
Packit 071ada
  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
Packit 071ada
  # is not polluted with repeated "-I."
Packit 071ada
  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
Packit 071ada
  # test to see if srcdir already configured
Packit 071ada
  if test -f $srcdir/config.status; then
Packit 071ada
    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
Packit 071ada
# test whether we have cygpath
Packit 071ada
if test -z "$CYGPATH_W"; then
Packit 071ada
  if (cygpath --version) >/dev/null 2>/dev/null; then
Packit 071ada
    CYGPATH_W='cygpath -w'
Packit 071ada
  else
Packit 071ada
    CYGPATH_W=echo
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
AC_SUBST([CYGPATH_W])
Packit 071ada
Packit 071ada
# Define the identity of the package.
Packit 071ada
dnl Distinguish between old-style and new-style calls.
Packit 071ada
m4_ifval([$2],
Packit 071ada
[AC_DIAGNOSE([obsolete],
Packit 071ada
             [$0: two- and three-arguments forms are deprecated.])
Packit 071ada
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
Packit 071ada
 AC_SUBST([PACKAGE], [$1])dnl
Packit 071ada
 AC_SUBST([VERSION], [$2])],
Packit 071ada
[_AM_SET_OPTIONS([$1])dnl
Packit 071ada
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
Packit 071ada
m4_if(
Packit 071ada
  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
Packit 071ada
  [ok:ok],,
Packit 071ada
  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
Packit 071ada
 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
Packit 071ada
 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
Packit 071ada
Packit 071ada
_AM_IF_OPTION([no-define],,
Packit 071ada
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
Packit 071ada
 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
Packit 071ada
Packit 071ada
# Some tools Automake needs.
Packit 071ada
AC_REQUIRE([AM_SANITY_CHECK])dnl
Packit 071ada
AC_REQUIRE([AC_ARG_PROGRAM])dnl
Packit 071ada
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
Packit 071ada
AM_MISSING_PROG([AUTOCONF], [autoconf])
Packit 071ada
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
Packit 071ada
AM_MISSING_PROG([AUTOHEADER], [autoheader])
Packit 071ada
AM_MISSING_PROG([MAKEINFO], [makeinfo])
Packit 071ada
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
Packit 071ada
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
Packit 071ada
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
Packit 071ada
# For better backward compatibility.  To be removed once Automake 1.9.x
Packit 071ada
# dies out for good.  For more background, see:
Packit 071ada
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
Packit 071ada
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
Packit 071ada
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
Packit 071ada
# We need awk for the "check" target (and possibly the TAP driver).  The
Packit 071ada
# system "awk" is bad on some platforms.
Packit 071ada
AC_REQUIRE([AC_PROG_AWK])dnl
Packit 071ada
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
Packit 071ada
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
Packit 071ada
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
Packit 071ada
	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
Packit 071ada
			     [_AM_PROG_TAR([v7])])])
Packit 071ada
_AM_IF_OPTION([no-dependencies],,
Packit 071ada
[AC_PROVIDE_IFELSE([AC_PROG_CC],
Packit 071ada
		  [_AM_DEPENDENCIES([CC])],
Packit 071ada
		  [m4_define([AC_PROG_CC],
Packit 071ada
			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
Packit 071ada
AC_PROVIDE_IFELSE([AC_PROG_CXX],
Packit 071ada
		  [_AM_DEPENDENCIES([CXX])],
Packit 071ada
		  [m4_define([AC_PROG_CXX],
Packit 071ada
			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
Packit 071ada
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
Packit 071ada
		  [_AM_DEPENDENCIES([OBJC])],
Packit 071ada
		  [m4_define([AC_PROG_OBJC],
Packit 071ada
			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
Packit 071ada
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
Packit 071ada
		  [_AM_DEPENDENCIES([OBJCXX])],
Packit 071ada
		  [m4_define([AC_PROG_OBJCXX],
Packit 071ada
			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
Packit 071ada
])
Packit 071ada
AC_REQUIRE([AM_SILENT_RULES])dnl
Packit 071ada
dnl The testsuite driver may need to know about EXEEXT, so add the
Packit 071ada
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
Packit 071ada
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
Packit 071ada
AC_CONFIG_COMMANDS_PRE(dnl
Packit 071ada
[m4_provide_if([_AM_COMPILER_EXEEXT],
Packit 071ada
  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
Packit 071ada
Packit 071ada
# POSIX will say in a future version that running "rm -f" with no argument
Packit 071ada
# is OK; and we want to be able to make that assumption in our Makefile
Packit 071ada
# recipes.  So use an aggressive probe to check that the usage we want is
Packit 071ada
# actually supported "in the wild" to an acceptable degree.
Packit 071ada
# See automake bug#10828.
Packit 071ada
# To make any issue more visible, cause the running configure to be aborted
Packit 071ada
# by default if the 'rm' program in use doesn't match our expectations; the
Packit 071ada
# user can still override this though.
Packit 071ada
if rm -f && rm -fr && rm -rf; then : OK; else
Packit 071ada
  cat >&2 <<'END'
Packit 071ada
Oops!
Packit 071ada
Packit 071ada
Your 'rm' program seems unable to run without file operands specified
Packit 071ada
on the command line, even when the '-f' option is present.  This is contrary
Packit 071ada
to the behaviour of most rm programs out there, and not conforming with
Packit 071ada
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Packit 071ada
Packit 071ada
Please tell bug-automake@gnu.org about your system, including the value
Packit 071ada
of your $PATH and any error possibly output before this message.  This
Packit 071ada
can help us improve future automake versions.
Packit 071ada
Packit 071ada
END
Packit 071ada
  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
Packit 071ada
    echo 'Configuration will proceed anyway, since you have set the' >&2
Packit 071ada
    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
Packit 071ada
    echo >&2
Packit 071ada
  else
Packit 071ada
    cat >&2 <<'END'
Packit 071ada
Aborting the configuration process, to ensure you take notice of the issue.
Packit 071ada
Packit 071ada
You can download and install GNU coreutils to get an 'rm' implementation
Packit 071ada
that behaves properly: <https://www.gnu.org/software/coreutils/>.
Packit 071ada
Packit 071ada
If you want to complete the configuration process using your problematic
Packit 071ada
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
Packit 071ada
to "yes", and re-run configure.
Packit 071ada
Packit 071ada
END
Packit 071ada
    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
Packit 071ada
  fi
Packit 071ada
fi
Packit 071ada
dnl The trailing newline in this macro's definition is deliberate, for
Packit 071ada
dnl backward compatibility and to allow trailing 'dnl'-style comments
Packit 071ada
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
Packit 071ada
])
Packit 071ada
Packit 071ada
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
Packit 071ada
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
Packit 071ada
dnl mangled by Autoconf and run in a shell conditional statement.
Packit 071ada
m4_define([_AC_COMPILER_EXEEXT],
Packit 071ada
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
Packit 071ada
Packit 071ada
# When config.status generates a header, we must update the stamp-h file.
Packit 071ada
# This file resides in the same directory as the config header
Packit 071ada
# that is generated.  The stamp files are numbered to have different names.
Packit 071ada
Packit 071ada
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
Packit 071ada
# loop where config.status creates the headers, so we can generate
Packit 071ada
# our stamp files there.
Packit 071ada
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
Packit 071ada
[# Compute $1's index in $config_headers.
Packit 071ada
_am_arg=$1
Packit 071ada
_am_stamp_count=1
Packit 071ada
for _am_header in $config_headers :; do
Packit 071ada
  case $_am_header in
Packit 071ada
    $_am_arg | $_am_arg:* )
Packit 071ada
      break ;;
Packit 071ada
    * )
Packit 071ada
      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
Packit 071ada
  esac
Packit 071ada
done
Packit 071ada
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
Packit 071ada
Packit 071ada
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# AM_PROG_INSTALL_SH
Packit 071ada
# ------------------
Packit 071ada
# Define $install_sh.
Packit 071ada
AC_DEFUN([AM_PROG_INSTALL_SH],
Packit 071ada
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
Packit 071ada
if test x"${install_sh+set}" != xset; then
Packit 071ada
  case $am_aux_dir in
Packit 071ada
  *\ * | *\	*)
Packit 071ada
    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
Packit 071ada
  *)
Packit 071ada
    install_sh="\${SHELL} $am_aux_dir/install-sh"
Packit 071ada
  esac
Packit 071ada
fi
Packit 071ada
AC_SUBST([install_sh])])
Packit 071ada
Packit 071ada
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# Check whether the underlying file-system supports filenames
Packit 071ada
# with a leading dot.  For instance MS-DOS doesn't.
Packit 071ada
AC_DEFUN([AM_SET_LEADING_DOT],
Packit 071ada
[rm -rf .tst 2>/dev/null
Packit 071ada
mkdir .tst 2>/dev/null
Packit 071ada
if test -d .tst; then
Packit 071ada
  am__leading_dot=.
Packit 071ada
else
Packit 071ada
  am__leading_dot=_
Packit 071ada
fi
Packit 071ada
rmdir .tst 2>/dev/null
Packit 071ada
AC_SUBST([am__leading_dot])])
Packit 071ada
Packit 071ada
# Check to see how 'make' treats includes.	            -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# AM_MAKE_INCLUDE()
Packit 071ada
# -----------------
Packit 071ada
# Check whether make has an 'include' directive that can support all
Packit 071ada
# the idioms we need for our automatic dependency tracking code.
Packit 071ada
AC_DEFUN([AM_MAKE_INCLUDE],
Packit 071ada
[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
Packit 071ada
cat > confinc.mk << 'END'
Packit 071ada
am__doit:
Packit 071ada
	@echo this is the am__doit target >confinc.out
Packit 071ada
.PHONY: am__doit
Packit 071ada
END
Packit 071ada
am__include="#"
Packit 071ada
am__quote=
Packit 071ada
# BSD make does it like this.
Packit 071ada
echo '.include "confinc.mk" # ignored' > confmf.BSD
Packit 071ada
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
Packit 071ada
echo 'include confinc.mk # ignored' > confmf.GNU
Packit 071ada
_am_result=no
Packit 071ada
for s in GNU BSD; do
Packit 071ada
  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
Packit 071ada
  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
Packit 071ada
      ['0:this is the am__doit target'],
Packit 071ada
      [AS_CASE([$s],
Packit 071ada
          [BSD], [am__include='.include' am__quote='"'],
Packit 071ada
          [am__include='include' am__quote=''])])
Packit 071ada
  if test "$am__include" != "#"; then
Packit 071ada
    _am_result="yes ($s style)"
Packit 071ada
    break
Packit 071ada
  fi
Packit 071ada
done
Packit 071ada
rm -f confinc.* confmf.*
Packit 071ada
AC_MSG_RESULT([${_am_result}])
Packit 071ada
AC_SUBST([am__include])])
Packit 071ada
AC_SUBST([am__quote])])
Packit 071ada
Packit 071ada
# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# AM_MISSING_PROG(NAME, PROGRAM)
Packit 071ada
# ------------------------------
Packit 071ada
AC_DEFUN([AM_MISSING_PROG],
Packit 071ada
[AC_REQUIRE([AM_MISSING_HAS_RUN])
Packit 071ada
$1=${$1-"${am_missing_run}$2"}
Packit 071ada
AC_SUBST($1)])
Packit 071ada
Packit 071ada
# AM_MISSING_HAS_RUN
Packit 071ada
# ------------------
Packit 071ada
# Define MISSING if not defined so far and test if it is modern enough.
Packit 071ada
# If it is, set am_missing_run to use it, otherwise, to nothing.
Packit 071ada
AC_DEFUN([AM_MISSING_HAS_RUN],
Packit 071ada
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
Packit 071ada
AC_REQUIRE_AUX_FILE([missing])dnl
Packit 071ada
if test x"${MISSING+set}" != xset; then
Packit 071ada
  case $am_aux_dir in
Packit 071ada
  *\ * | *\	*)
Packit 071ada
    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
Packit 071ada
  *)
Packit 071ada
    MISSING="\${SHELL} $am_aux_dir/missing" ;;
Packit 071ada
  esac
Packit 071ada
fi
Packit 071ada
# Use eval to expand $SHELL
Packit 071ada
if eval "$MISSING --is-lightweight"; then
Packit 071ada
  am_missing_run="$MISSING "
Packit 071ada
else
Packit 071ada
  am_missing_run=
Packit 071ada
  AC_MSG_WARN(['missing' script is too old or missing])
Packit 071ada
fi
Packit 071ada
])
Packit 071ada
Packit 071ada
# Helper functions for option handling.                     -*- Autoconf -*-
Packit 071ada
Packit 071ada
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# _AM_MANGLE_OPTION(NAME)
Packit 071ada
# -----------------------
Packit 071ada
AC_DEFUN([_AM_MANGLE_OPTION],
Packit 071ada
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
Packit 071ada
Packit 071ada
# _AM_SET_OPTION(NAME)
Packit 071ada
# --------------------
Packit 071ada
# Set option NAME.  Presently that only means defining a flag for this option.
Packit 071ada
AC_DEFUN([_AM_SET_OPTION],
Packit 071ada
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
Packit 071ada
Packit 071ada
# _AM_SET_OPTIONS(OPTIONS)
Packit 071ada
# ------------------------
Packit 071ada
# OPTIONS is a space-separated list of Automake options.
Packit 071ada
AC_DEFUN([_AM_SET_OPTIONS],
Packit 071ada
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
Packit 071ada
Packit 071ada
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
Packit 071ada
# -------------------------------------------
Packit 071ada
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
Packit 071ada
AC_DEFUN([_AM_IF_OPTION],
Packit 071ada
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
Packit 071ada
Packit 071ada
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
# _AM_PROG_CC_C_O
Packit 071ada
# ---------------
Packit 071ada
# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
Packit 071ada
# to automatically call this.
Packit 071ada
AC_DEFUN([_AM_PROG_CC_C_O],
Packit 071ada
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
Packit 071ada
AC_REQUIRE_AUX_FILE([compile])dnl
Packit 071ada
AC_LANG_PUSH([C])dnl
Packit 071ada
AC_CACHE_CHECK(
Packit 071ada
  [whether $CC understands -c and -o together],
Packit 071ada
  [am_cv_prog_cc_c_o],
Packit 071ada
  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
Packit 071ada
  # Make sure it works both with $CC and with simple cc.
Packit 071ada
  # Following AC_PROG_CC_C_O, we do the test twice because some
Packit 071ada
  # compilers refuse to overwrite an existing .o file with -o,
Packit 071ada
  # though they will create one.
Packit 071ada
  am_cv_prog_cc_c_o=yes
Packit 071ada
  for am_i in 1 2; do
Packit 071ada
    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
Packit 071ada
         && test -f conftest2.$ac_objext; then
Packit 071ada
      : OK
Packit 071ada
    else
Packit 071ada
      am_cv_prog_cc_c_o=no
Packit 071ada
      break
Packit 071ada
    fi
Packit 071ada
  done
Packit 071ada
  rm -f core conftest*
Packit 071ada
  unset am_i])
Packit 071ada
if test "$am_cv_prog_cc_c_o" != yes; then
Packit 071ada
   # Losing compiler, so override with the script.
Packit 071ada
   # FIXME: It is wrong to rewrite CC.
Packit 071ada
   # But if we don't then we get into trouble of one sort or another.
Packit 071ada
   # A longer-term fix would be to have automake use am__CC in this case,
Packit 071ada
   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
Packit 071ada
   CC="$am_aux_dir/compile $CC"
Packit 071ada
fi
Packit 071ada
AC_LANG_POP([C])])
Packit 071ada
Packit 071ada
# For backward compatibility.
Packit 071ada
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
Packit 071ada
Packit 071ada
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit 071ada
#
Packit 071ada
# This file is free software; the Free Software Foundation
Packit 071ada
# gives unlimited permission to copy and/or distribute it,
Packit 071ada
# with or without modifications, as long as this notice is preserved.
Packit 071ada
Packit 071ada
Packit 071ada
# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
Packit 071ada
# ---------------------------------------------------------------------------
Packit 071ada
# Adds support for distributing Python modules and packages.  To
Packit 071ada
# install modules, copy them to $(pythondir), using the python_PYTHON
Packit 071ada
# automake variable.  To install a package with the same name as the
Packit 071ada
# automake package, install to $(pkgpythondir), or use the
Packit 071ada
# pkgpython_PYTHON automake variable.
Packit 071ada
#
Packit 071ada
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
Packit 071ada
# locations to install python extension modules (shared libraries).
Packit 071ada
# Another macro is required to find the appropriate flags to compile
Packit 071ada
# extension modules.
Packit 071ada
#
Packit 071ada
# If your package is configured with a different prefix to python,
Packit 071ada
# users will have to add the install directory to the PYTHONPATH
Packit 071ada
# environment variable, or create a .pth file (see the python
Packit 071ada
# documentation for details).
Packit 071ada
#
Packit 071ada
# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
Packit 071ada
# cause an error if the version of python installed on the system
Packit 071ada
# doesn't meet the requirement.  MINIMUM-VERSION should consist of
Packit 071ada
# numbers and dots only.
Packit 071ada
AC_DEFUN([AM_PATH_PYTHON],
Packit 071ada
 [
Packit 071ada
  dnl Find a Python interpreter.  Python versions prior to 2.0 are not
Packit 071ada
  dnl supported. (2.0 was released on October 16, 2000).
Packit 071ada
  m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
Packit 071ada
[python python2 python3 dnl
Packit 071ada
 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
Packit 071ada
 python3.2 python3.1 python3.0 dnl
Packit 071ada
 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
Packit 071ada
 python2.0])
Packit 071ada
Packit 071ada
  AC_ARG_VAR([PYTHON], [the Python interpreter])
Packit 071ada
Packit 071ada
  m4_if([$1],[],[
Packit 071ada
    dnl No version check is needed.
Packit 071ada
    # Find any Python interpreter.
Packit 071ada
    if test -z "$PYTHON"; then
Packit 071ada
      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
Packit 071ada
    fi
Packit 071ada
    am_display_PYTHON=python
Packit 071ada
  ], [
Packit 071ada
    dnl A version check is needed.
Packit 071ada
    if test -n "$PYTHON"; then
Packit 071ada
      # If the user set $PYTHON, use it and don't search something else.
Packit 071ada
      AC_MSG_CHECKING([whether $PYTHON version is >= $1])
Packit 071ada
      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
Packit 071ada
			      [AC_MSG_RESULT([yes])],
Packit 071ada
			      [AC_MSG_RESULT([no])
Packit 071ada
			       AC_MSG_ERROR([Python interpreter is too old])])
Packit 071ada
      am_display_PYTHON=$PYTHON
Packit 071ada
    else
Packit 071ada
      # Otherwise, try each interpreter until we find one that satisfies
Packit 071ada
      # VERSION.
Packit 071ada
      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
Packit 071ada
	[am_cv_pathless_PYTHON],[
Packit 071ada
	for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
Packit 071ada
	  test "$am_cv_pathless_PYTHON" = none && break
Packit 071ada
	  AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
Packit 071ada
	done])
Packit 071ada
      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
Packit 071ada
      if test "$am_cv_pathless_PYTHON" = none; then
Packit 071ada
	PYTHON=:
Packit 071ada
      else
Packit 071ada
        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
Packit 071ada
      fi
Packit 071ada
      am_display_PYTHON=$am_cv_pathless_PYTHON
Packit 071ada
    fi
Packit 071ada
  ])
Packit 071ada
Packit 071ada
  if test "$PYTHON" = :; then
Packit 071ada
  dnl Run any user-specified action, or abort.
Packit 071ada
    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
Packit 071ada
  else
Packit 071ada
Packit 071ada
  dnl Query Python for its version number.  Getting [:3] seems to be
Packit 071ada
  dnl the best way to do this; it's what "site.py" does in the standard
Packit 071ada
  dnl library.
Packit 071ada
Packit 071ada
  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
Packit 071ada
    [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
Packit 071ada
  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
Packit 071ada
Packit 071ada
  dnl Use the values of $prefix and $exec_prefix for the corresponding
Packit 071ada
  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
Packit 071ada
  dnl distinct variables so they can be overridden if need be.  However,
Packit 071ada
  dnl general consensus is that you shouldn't need this ability.
Packit 071ada
Packit 071ada
  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
Packit 071ada
  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
Packit 071ada
Packit 071ada
  dnl At times (like when building shared libraries) you may want
Packit 071ada
  dnl to know which OS platform Python thinks this is.
Packit 071ada
Packit 071ada
  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
Packit 071ada
    [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
Packit 071ada
  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
Packit 071ada
Packit 071ada
  # Just factor out some code duplication.
Packit 071ada
  am_python_setup_sysconfig="\
Packit 071ada
import sys
Packit 071ada
# Prefer sysconfig over distutils.sysconfig, for better compatibility
Packit 071ada
# with python 3.x.  See automake bug#10227.
Packit 071ada
try:
Packit 071ada
    import sysconfig
Packit 071ada
except ImportError:
Packit 071ada
    can_use_sysconfig = 0
Packit 071ada
else:
Packit 071ada
    can_use_sysconfig = 1
Packit 071ada
# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
Packit 071ada
# <https://github.com/pypa/virtualenv/issues/118>
Packit 071ada
try:
Packit 071ada
    from platform import python_implementation
Packit 071ada
    if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
Packit 071ada
        can_use_sysconfig = 0
Packit 071ada
except ImportError:
Packit 071ada
    pass"
Packit 071ada
Packit 071ada
  dnl Set up 4 directories:
Packit 071ada
Packit 071ada
  dnl pythondir -- where to install python scripts.  This is the
Packit 071ada
  dnl   site-packages directory, not the python standard library
Packit 071ada
  dnl   directory like in previous automake betas.  This behavior
Packit 071ada
  dnl   is more consistent with lispdir.m4 for example.
Packit 071ada
  dnl Query distutils for this directory.
Packit 071ada
  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
Packit 071ada
    [am_cv_python_pythondir],
Packit 071ada
    [if test "x$prefix" = xNONE
Packit 071ada
     then
Packit 071ada
       am_py_prefix=$ac_default_prefix
Packit 071ada
     else
Packit 071ada
       am_py_prefix=$prefix
Packit 071ada
     fi
Packit 071ada
     am_cv_python_pythondir=`$PYTHON -c "
Packit 071ada
$am_python_setup_sysconfig
Packit 071ada
if can_use_sysconfig:
Packit 071ada
    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
Packit 071ada
else:
Packit 071ada
    from distutils import sysconfig
Packit 071ada
    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
Packit 071ada
sys.stdout.write(sitedir)"`
Packit 071ada
     case $am_cv_python_pythondir in
Packit 071ada
     $am_py_prefix*)
Packit 071ada
       am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
Packit 071ada
       am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
Packit 071ada
       ;;
Packit 071ada
     *)
Packit 071ada
       case $am_py_prefix in
Packit 071ada
         /usr|/System*) ;;
Packit 071ada
         *)
Packit 071ada
	  am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
Packit 071ada
	  ;;
Packit 071ada
       esac
Packit 071ada
       ;;
Packit 071ada
     esac
Packit 071ada
    ])
Packit 071ada
  AC_SUBST([pythondir], [$am_cv_python_pythondir])
Packit 071ada
Packit 071ada
  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
Packit 071ada
  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
Packit 071ada
  dnl   more consistent with the rest of automake.
Packit 071ada
Packit 071ada
  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
Packit 071ada
Packit 071ada
  dnl pyexecdir -- directory for installing python extension modules
Packit 071ada
  dnl   (shared libraries)
Packit 071ada
  dnl Query distutils for this directory.
Packit 071ada
  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
Packit 071ada
    [am_cv_python_pyexecdir],
Packit 071ada
    [if test "x$exec_prefix" = xNONE
Packit 071ada
     then
Packit 071ada
       am_py_exec_prefix=$am_py_prefix
Packit 071ada
     else
Packit 071ada
       am_py_exec_prefix=$exec_prefix
Packit 071ada
     fi
Packit 071ada
     am_cv_python_pyexecdir=`$PYTHON -c "
Packit 071ada
$am_python_setup_sysconfig
Packit 071ada
if can_use_sysconfig:
Packit 071ada
    sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
Packit 071ada
else:
Packit 071ada
    from distutils import sysconfig
Packit 071ada
    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
Packit 071ada
sys.stdout.write(sitedir)"`
Packit 071ada
     case $am_cv_python_pyexecdir in
Packit 071ada
     $am_py_exec_prefix*)
Packit 071ada
       am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
Packit 071ada
       am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
Packit 071ada
       ;;
Packit 071ada
     *)
Packit 071ada
       case $am_py_exec_prefix in
Packit 071ada
         /usr|/System*) ;;
Packit 071ada
         *)
Packit 071ada
	   am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
Packit 071ada
	   ;;
Packit 071ada
       esac
Packit 071ada
       ;;
Packit 071ada
     esac
Packit 071ada
    ])
Packit 071ada
  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
Packit 071ada
Packit 071ada
  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
Packit 071ada
Packit 071ada
  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
Packit 071ada
Packit 071ada
  dnl Run any user-specified action.
Packit 071ada
  $2
Packit 071ada
  fi
Packit 071ada
Packit 071ada
])
Packit 071ada
Packit 071ada
Packit 071ada
# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
Packit 071ada
# ---------------------------------------------------------------------------
Packit 071ada
# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
Packit 071ada
# Run ACTION-IF-FALSE otherwise.
Packit 071ada
# This test uses sys.hexversion instead of the string equivalent (first
Packit 071ada
# word of sys.version), in order to cope with versions such as 2.2c1.
Packit 071ada
# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
Packit 071ada
AC_DEFUN([AM_PYTHON_CHECK_VERSION],
Packit 071ada
 [prog="import sys
Packit 071ada
# split strings by '.' and convert to numeric.  Append some zeros
Packit 071ada
# because we need at least 4 digits for the hex conversion.
Packit 071ada
# map returns an iterator in Python 3.0 and a list in 2.x
Packit 071ada
minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
Packit 071ada
minverhex = 0
Packit 071ada
# xrange is not present in Python 3.0 and range returns an iterator
Packit 071ada
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
Packit