aclocal.m4 revision 4d9306db
14d9306dbSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2e7fdea5fSmrg
34d9306dbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4067610f1Smrg
5067610f1Smrg# This file is free software; the Free Software Foundation
6067610f1Smrg# gives unlimited permission to copy and/or distribute it,
7067610f1Smrg# with or without modifications, as long as this notice is preserved.
8067610f1Smrg
9067610f1Smrg# This program is distributed in the hope that it will be useful,
10067610f1Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11067610f1Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12067610f1Smrg# PARTICULAR PURPOSE.
13067610f1Smrg
14e7fdea5fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157e6533d5Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167e6533d5Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17e7fdea5fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18e7fdea5fSmrg[m4_warning([this file was generated for autoconf 2.69.
197e6533d5SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207e6533d5SmrgIf you have problems, you may need to regenerate the build system entirely.
21e7fdea5fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22067610f1Smrg
234d9306dbSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
244d9306dbSmrgdnl serial 11 (pkg-config-0.29)
254d9306dbSmrgdnl
264d9306dbSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
274d9306dbSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
284d9306dbSmrgdnl
294d9306dbSmrgdnl This program is free software; you can redistribute it and/or modify
304d9306dbSmrgdnl it under the terms of the GNU General Public License as published by
314d9306dbSmrgdnl the Free Software Foundation; either version 2 of the License, or
324d9306dbSmrgdnl (at your option) any later version.
334d9306dbSmrgdnl
344d9306dbSmrgdnl This program is distributed in the hope that it will be useful, but
354d9306dbSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
364d9306dbSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
374d9306dbSmrgdnl General Public License for more details.
384d9306dbSmrgdnl
394d9306dbSmrgdnl You should have received a copy of the GNU General Public License
404d9306dbSmrgdnl along with this program; if not, write to the Free Software
414d9306dbSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
424d9306dbSmrgdnl 02111-1307, USA.
434d9306dbSmrgdnl
444d9306dbSmrgdnl As a special exception to the GNU General Public License, if you
454d9306dbSmrgdnl distribute this file as part of a program that contains a
464d9306dbSmrgdnl configuration script generated by Autoconf, you may include it under
474d9306dbSmrgdnl the same distribution terms that you use for the rest of that
484d9306dbSmrgdnl program.
494d9306dbSmrg
504d9306dbSmrgdnl PKG_PREREQ(MIN-VERSION)
514d9306dbSmrgdnl -----------------------
524d9306dbSmrgdnl Since: 0.29
534d9306dbSmrgdnl
544d9306dbSmrgdnl Verify that the version of the pkg-config macros are at least
554d9306dbSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
564d9306dbSmrgdnl installed version of pkg-config, this checks the developer's version
574d9306dbSmrgdnl of pkg.m4 when generating configure.
584d9306dbSmrgdnl
594d9306dbSmrgdnl To ensure that this macro is defined, also add:
604d9306dbSmrgdnl m4_ifndef([PKG_PREREQ],
614d9306dbSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
624d9306dbSmrgdnl
634d9306dbSmrgdnl See the "Since" comment for each macro you use to see what version
644d9306dbSmrgdnl of the macros you require.
654d9306dbSmrgm4_defun([PKG_PREREQ],
664d9306dbSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
674d9306dbSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
684d9306dbSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
694d9306dbSmrg])dnl PKG_PREREQ
704d9306dbSmrg
714d9306dbSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
724d9306dbSmrgdnl ----------------------------------
734d9306dbSmrgdnl Since: 0.16
744d9306dbSmrgdnl
754d9306dbSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
764d9306dbSmrgdnl first found in the path. Checks that the version of pkg-config found
774d9306dbSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
784d9306dbSmrgdnl used since that's the first version where most current features of
794d9306dbSmrgdnl pkg-config existed.
804d9306dbSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
814d9306dbSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
824d9306dbSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
834d9306dbSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
844d9306dbSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
854d9306dbSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
864d9306dbSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87067610f1Smrg
884d9306dbSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
894d9306dbSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
904d9306dbSmrgfi
914d9306dbSmrgif test -n "$PKG_CONFIG"; then
924d9306dbSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
934d9306dbSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
944d9306dbSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
954d9306dbSmrg		AC_MSG_RESULT([yes])
964d9306dbSmrg	else
974d9306dbSmrg		AC_MSG_RESULT([no])
984d9306dbSmrg		PKG_CONFIG=""
994d9306dbSmrg	fi
1004d9306dbSmrgfi[]dnl
1014d9306dbSmrg])dnl PKG_PROG_PKG_CONFIG
102067610f1Smrg
1034d9306dbSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1044d9306dbSmrgdnl -------------------------------------------------------------------
1054d9306dbSmrgdnl Since: 0.18
1064d9306dbSmrgdnl
1074d9306dbSmrgdnl Check to see whether a particular set of modules exists. Similar to
1084d9306dbSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1094d9306dbSmrgdnl
1104d9306dbSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1114d9306dbSmrgdnl only at the first occurence in configure.ac, so if the first place
1124d9306dbSmrgdnl it's called might be skipped (such as if it is within an "if", you
1134d9306dbSmrgdnl have to call PKG_CHECK_EXISTS manually
1144d9306dbSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1154d9306dbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1164d9306dbSmrgif test -n "$PKG_CONFIG" && \
1174d9306dbSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1184d9306dbSmrg  m4_default([$2], [:])
1194d9306dbSmrgm4_ifvaln([$3], [else
1204d9306dbSmrg  $3])dnl
1214d9306dbSmrgfi])
122067610f1Smrg
1234d9306dbSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1244d9306dbSmrgdnl ---------------------------------------------
1254d9306dbSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1264d9306dbSmrgdnl pkg_failed based on the result.
1274d9306dbSmrgm4_define([_PKG_CONFIG],
1284d9306dbSmrg[if test -n "$$1"; then
1294d9306dbSmrg    pkg_cv_[]$1="$$1"
1304d9306dbSmrg elif test -n "$PKG_CONFIG"; then
1314d9306dbSmrg    PKG_CHECK_EXISTS([$3],
1324d9306dbSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1334d9306dbSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1344d9306dbSmrg		     [pkg_failed=yes])
1354d9306dbSmrg else
1364d9306dbSmrg    pkg_failed=untried
1374d9306dbSmrgfi[]dnl
1384d9306dbSmrg])dnl _PKG_CONFIG
139067610f1Smrg
1404d9306dbSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1414d9306dbSmrgdnl ---------------------------
1424d9306dbSmrgdnl Internal check to see if pkg-config supports short errors.
1434d9306dbSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1444d9306dbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1454d9306dbSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1464d9306dbSmrg        _pkg_short_errors_supported=yes
1474d9306dbSmrgelse
1484d9306dbSmrg        _pkg_short_errors_supported=no
1494d9306dbSmrgfi[]dnl
1504d9306dbSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151067610f1Smrg
152067610f1Smrg
1534d9306dbSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1544d9306dbSmrgdnl   [ACTION-IF-NOT-FOUND])
1554d9306dbSmrgdnl --------------------------------------------------------------
1564d9306dbSmrgdnl Since: 0.4.0
1574d9306dbSmrgdnl
1584d9306dbSmrgdnl Note that if there is a possibility the first call to
1594d9306dbSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1604d9306dbSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1614d9306dbSmrgAC_DEFUN([PKG_CHECK_MODULES],
1624d9306dbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1634d9306dbSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1644d9306dbSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165067610f1Smrg
1664d9306dbSmrgpkg_failed=no
1674d9306dbSmrgAC_MSG_CHECKING([for $1])
168067610f1Smrg
1694d9306dbSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1704d9306dbSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171067610f1Smrg
1724d9306dbSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1734d9306dbSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1744d9306dbSmrgSee the pkg-config man page for more details.])
175067610f1Smrg
1764d9306dbSmrgif test $pkg_failed = yes; then
1774d9306dbSmrg   	AC_MSG_RESULT([no])
1784d9306dbSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1794d9306dbSmrg        if test $_pkg_short_errors_supported = yes; then
1804d9306dbSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1814d9306dbSmrg        else 
1824d9306dbSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1834d9306dbSmrg        fi
1844d9306dbSmrg	# Put the nasty error message in config.log where it belongs
1854d9306dbSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186067610f1Smrg
1874d9306dbSmrg	m4_default([$4], [AC_MSG_ERROR(
1884d9306dbSmrg[Package requirements ($2) were not met:
189067610f1Smrg
1904d9306dbSmrg$$1_PKG_ERRORS
191067610f1Smrg
1924d9306dbSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1934d9306dbSmrginstalled software in a non-standard prefix.
194067610f1Smrg
1954d9306dbSmrg_PKG_TEXT])[]dnl
1964d9306dbSmrg        ])
1974d9306dbSmrgelif test $pkg_failed = untried; then
1984d9306dbSmrg     	AC_MSG_RESULT([no])
1994d9306dbSmrg	m4_default([$4], [AC_MSG_FAILURE(
2004d9306dbSmrg[The pkg-config script could not be found or is too old.  Make sure it
2014d9306dbSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
2024d9306dbSmrgpath to pkg-config.
203067610f1Smrg
2044d9306dbSmrg_PKG_TEXT
205067610f1Smrg
2064d9306dbSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2074d9306dbSmrg        ])
2084d9306dbSmrgelse
2094d9306dbSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2104d9306dbSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2114d9306dbSmrg        AC_MSG_RESULT([yes])
2124d9306dbSmrg	$3
2134d9306dbSmrgfi[]dnl
2144d9306dbSmrg])dnl PKG_CHECK_MODULES
215067610f1Smrg
216067610f1Smrg
2174d9306dbSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2184d9306dbSmrgdnl   [ACTION-IF-NOT-FOUND])
2194d9306dbSmrgdnl ---------------------------------------------------------------------
2204d9306dbSmrgdnl Since: 0.29
2214d9306dbSmrgdnl
2224d9306dbSmrgdnl Checks for existence of MODULES and gathers its build flags with
2234d9306dbSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
2244d9306dbSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
2254d9306dbSmrgdnl
2264d9306dbSmrgdnl Note that if there is a possibility the first call to
2274d9306dbSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
2284d9306dbSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
2294d9306dbSmrgdnl configure.ac.
2304d9306dbSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
2314d9306dbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2324d9306dbSmrg_save_PKG_CONFIG=$PKG_CONFIG
2334d9306dbSmrgPKG_CONFIG="$PKG_CONFIG --static"
2344d9306dbSmrgPKG_CHECK_MODULES($@)
2354d9306dbSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
2364d9306dbSmrg])dnl PKG_CHECK_MODULES_STATIC
2377e6533d5Smrg
238067610f1Smrg
2394d9306dbSmrgdnl PKG_INSTALLDIR([DIRECTORY])
2404d9306dbSmrgdnl -------------------------
2414d9306dbSmrgdnl Since: 0.27
2424d9306dbSmrgdnl
2434d9306dbSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
2444d9306dbSmrgdnl should install pkg-config .pc files. By default the directory is
2454d9306dbSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
2464d9306dbSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
2474d9306dbSmrgdnl parameter.
2484d9306dbSmrgAC_DEFUN([PKG_INSTALLDIR],
2494d9306dbSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
2504d9306dbSmrgm4_pushdef([pkg_description],
2514d9306dbSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
2524d9306dbSmrgAC_ARG_WITH([pkgconfigdir],
2534d9306dbSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
2544d9306dbSmrg    [with_pkgconfigdir=]pkg_default)
2554d9306dbSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
2564d9306dbSmrgm4_popdef([pkg_default])
2574d9306dbSmrgm4_popdef([pkg_description])
2584d9306dbSmrg])dnl PKG_INSTALLDIR
2594d9306dbSmrg
2604d9306dbSmrg
2614d9306dbSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
2624d9306dbSmrgdnl --------------------------------
2634d9306dbSmrgdnl Since: 0.27
2644d9306dbSmrgdnl
2654d9306dbSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
2664d9306dbSmrgdnl module should install arch-independent pkg-config .pc files. By
2674d9306dbSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
2684d9306dbSmrgdnl changed by passing DIRECTORY. The user can override through the
2694d9306dbSmrgdnl --with-noarch-pkgconfigdir parameter.
2704d9306dbSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2714d9306dbSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2724d9306dbSmrgm4_pushdef([pkg_description],
2734d9306dbSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2744d9306dbSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2754d9306dbSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2764d9306dbSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2774d9306dbSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2784d9306dbSmrgm4_popdef([pkg_default])
2794d9306dbSmrgm4_popdef([pkg_description])
2804d9306dbSmrg])dnl PKG_NOARCH_INSTALLDIR
2814d9306dbSmrg
2824d9306dbSmrg
2834d9306dbSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2844d9306dbSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2854d9306dbSmrgdnl -------------------------------------------
2864d9306dbSmrgdnl Since: 0.28
2874d9306dbSmrgdnl
2884d9306dbSmrgdnl Retrieves the value of the pkg-config variable for the given module.
2894d9306dbSmrgAC_DEFUN([PKG_CHECK_VAR],
2904d9306dbSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2914d9306dbSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292067610f1Smrg
2934d9306dbSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2944d9306dbSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2954d9306dbSmrg
2964d9306dbSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2974d9306dbSmrg])dnl PKG_CHECK_VAR
2984d9306dbSmrg
2994d9306dbSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3004d9306dbSmrgdnl
3014d9306dbSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3024d9306dbSmrgdnl
3034d9306dbSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3044d9306dbSmrgdnl copy of this software and associated documentation files (the "Software"),
3054d9306dbSmrgdnl to deal in the Software without restriction, including without limitation
3064d9306dbSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3074d9306dbSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
3084d9306dbSmrgdnl Software is furnished to do so, subject to the following conditions:
3094d9306dbSmrgdnl
3104d9306dbSmrgdnl The above copyright notice and this permission notice (including the next
3114d9306dbSmrgdnl paragraph) shall be included in all copies or substantial portions of the
3124d9306dbSmrgdnl Software.
3134d9306dbSmrgdnl
3144d9306dbSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3154d9306dbSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3164d9306dbSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3174d9306dbSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3184d9306dbSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3194d9306dbSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3204d9306dbSmrgdnl DEALINGS IN THE SOFTWARE.
3214d9306dbSmrg
3224d9306dbSmrg# XORG_MACROS_VERSION(required-version)
3234d9306dbSmrg# -------------------------------------
3244d9306dbSmrg# Minimum version: 1.1.0
3254d9306dbSmrg#
3264d9306dbSmrg# If you're using a macro added in Version 1.1 or newer, include this in
3274d9306dbSmrg# your configure.ac with the minimum required version, such as:
3284d9306dbSmrg# XORG_MACROS_VERSION(1.1)
3294d9306dbSmrg#
3304d9306dbSmrg# To ensure that this macro is defined, also add:
3314d9306dbSmrg# m4_ifndef([XORG_MACROS_VERSION],
3324d9306dbSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
3334d9306dbSmrg#
3344d9306dbSmrg#
3354d9306dbSmrg# See the "minimum version" comment for each macro you use to see what
3364d9306dbSmrg# version you require.
3374d9306dbSmrgm4_defun([XORG_MACROS_VERSION],[
3384d9306dbSmrgm4_define([vers_have], [1.19.0])
3394d9306dbSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
3404d9306dbSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
3414d9306dbSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
3424d9306dbSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
3434d9306dbSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
3444d9306dbSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
3454d9306dbSmrgm4_undefine([vers_have])
3464d9306dbSmrgm4_undefine([maj_have])
3474d9306dbSmrgm4_undefine([maj_needed])
3484d9306dbSmrg]) # XORG_MACROS_VERSION
3494d9306dbSmrg
3504d9306dbSmrg# XORG_PROG_RAWCPP()
3514d9306dbSmrg# ------------------
3524d9306dbSmrg# Minimum version: 1.0.0
3534d9306dbSmrg#
3544d9306dbSmrg# Find cpp program and necessary flags for use in pre-processing text files
3554d9306dbSmrg# such as man pages and config files
3564d9306dbSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
3574d9306dbSmrgAC_REQUIRE([AC_PROG_CPP])
3584d9306dbSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
3594d9306dbSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
3604d9306dbSmrg
3614d9306dbSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3624d9306dbSmrg# which is not the best choice for supporting other OS'es, but covers most
3634d9306dbSmrg# of the ones we need for now.
3644d9306dbSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3654d9306dbSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3664d9306dbSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3674d9306dbSmrg	AC_MSG_RESULT([no])
368067610f1Smrgelse
3694d9306dbSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3704d9306dbSmrg		RAWCPPFLAGS=-undef
3714d9306dbSmrg		AC_MSG_RESULT([yes])
3724d9306dbSmrg	# under Cygwin unix is still defined even with -undef
3734d9306dbSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3744d9306dbSmrg		RAWCPPFLAGS="-undef -ansi"
3754d9306dbSmrg		AC_MSG_RESULT([yes, with -ansi])
3764d9306dbSmrg	else
3774d9306dbSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3784d9306dbSmrg	fi
379067610f1Smrgfi
3804d9306dbSmrgrm -f conftest.$ac_ext
381067610f1Smrg
3824d9306dbSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3834d9306dbSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3844d9306dbSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3854d9306dbSmrg	AC_MSG_RESULT([no])
3864d9306dbSmrgelse
3874d9306dbSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3884d9306dbSmrg		TRADITIONALCPPFLAGS="-traditional"
3894d9306dbSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3904d9306dbSmrg		AC_MSG_RESULT([yes])
3914d9306dbSmrg	else
3924d9306dbSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3934d9306dbSmrg	fi
3944d9306dbSmrgfi
3954d9306dbSmrgrm -f conftest.$ac_ext
3964d9306dbSmrgAC_SUBST(RAWCPPFLAGS)
3974d9306dbSmrgAC_SUBST(TRADITIONALCPPFLAGS)
3984d9306dbSmrg]) # XORG_PROG_RAWCPP
399067610f1Smrg
4004d9306dbSmrg# XORG_MANPAGE_SECTIONS()
4014d9306dbSmrg# -----------------------
4024d9306dbSmrg# Minimum version: 1.0.0
4034d9306dbSmrg#
4044d9306dbSmrg# Determine which sections man pages go in for the different man page types
4054d9306dbSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4064d9306dbSmrg# Not sure if there's any better way than just hardcoding by OS name.
4074d9306dbSmrg# Override default settings by setting environment variables
4084d9306dbSmrg# Added MAN_SUBSTS in version 1.8
4094d9306dbSmrg# Added AC_PROG_SED in version 1.8
410067610f1Smrg
4114d9306dbSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4124d9306dbSmrgAC_REQUIRE([AC_CANONICAL_HOST])
4134d9306dbSmrgAC_REQUIRE([AC_PROG_SED])
414067610f1Smrg
4154d9306dbSmrgif test x$APP_MAN_SUFFIX = x    ; then
4164d9306dbSmrg    APP_MAN_SUFFIX=1
4174d9306dbSmrgfi
4184d9306dbSmrgif test x$APP_MAN_DIR = x    ; then
4194d9306dbSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
420067610f1Smrgfi
421067610f1Smrg
4224d9306dbSmrgif test x$LIB_MAN_SUFFIX = x    ; then
4234d9306dbSmrg    LIB_MAN_SUFFIX=3
4244d9306dbSmrgfi
4254d9306dbSmrgif test x$LIB_MAN_DIR = x    ; then
4264d9306dbSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
4274d9306dbSmrgfi
428067610f1Smrg
4294d9306dbSmrgif test x$FILE_MAN_SUFFIX = x    ; then
4304d9306dbSmrg    case $host_os in
4314d9306dbSmrg	# Solaris 2.0 - 11 use SysV man page sections
4324d9306dbSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
4334d9306dbSmrg	*)				FILE_MAN_SUFFIX=5  ;;
4344d9306dbSmrg    esac
4354d9306dbSmrgfi
4364d9306dbSmrgif test x$FILE_MAN_DIR = x    ; then
4374d9306dbSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
4384d9306dbSmrgfi
439067610f1Smrg
4404d9306dbSmrgif test x$MISC_MAN_SUFFIX = x    ; then
4414d9306dbSmrg    case $host_os in
4424d9306dbSmrg	# Solaris 2.0 - 11 use SysV man page sections
4434d9306dbSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
4444d9306dbSmrg	*)				MISC_MAN_SUFFIX=7  ;;
4454d9306dbSmrg    esac
4464d9306dbSmrgfi
4474d9306dbSmrgif test x$MISC_MAN_DIR = x    ; then
4484d9306dbSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
4494d9306dbSmrgfi
450067610f1Smrg
4514d9306dbSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
4524d9306dbSmrg    case $host_os in
4534d9306dbSmrg	# Solaris 2.0 - 11 use SysV man page sections
4544d9306dbSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
4554d9306dbSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
4564d9306dbSmrg    esac
4574d9306dbSmrgfi
4584d9306dbSmrgif test x$DRIVER_MAN_DIR = x    ; then
4594d9306dbSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
4604d9306dbSmrgfi
461067610f1Smrg
4624d9306dbSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4634d9306dbSmrg    case $host_os in
4644d9306dbSmrg	# Solaris 2.0 - 11 use SysV man page sections
4654d9306dbSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
4664d9306dbSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4674d9306dbSmrg    esac
4684d9306dbSmrgfi
4694d9306dbSmrgif test x$ADMIN_MAN_DIR = x    ; then
4704d9306dbSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4714d9306dbSmrgfi
472067610f1Smrg
4734d9306dbSmrg
4744d9306dbSmrgAC_SUBST([APP_MAN_SUFFIX])
4754d9306dbSmrgAC_SUBST([LIB_MAN_SUFFIX])
4764d9306dbSmrgAC_SUBST([FILE_MAN_SUFFIX])
4774d9306dbSmrgAC_SUBST([MISC_MAN_SUFFIX])
4784d9306dbSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4794d9306dbSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4804d9306dbSmrgAC_SUBST([APP_MAN_DIR])
4814d9306dbSmrgAC_SUBST([LIB_MAN_DIR])
4824d9306dbSmrgAC_SUBST([FILE_MAN_DIR])
4834d9306dbSmrgAC_SUBST([MISC_MAN_DIR])
4844d9306dbSmrgAC_SUBST([DRIVER_MAN_DIR])
4854d9306dbSmrgAC_SUBST([ADMIN_MAN_DIR])
4864d9306dbSmrg
4874d9306dbSmrgXORG_MAN_PAGE="X Version 11"
4884d9306dbSmrgAC_SUBST([XORG_MAN_PAGE])
4894d9306dbSmrgMAN_SUBSTS="\
4904d9306dbSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4914d9306dbSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4924d9306dbSmrg	-e 's|__xservername__|Xorg|g' \
4934d9306dbSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
4944d9306dbSmrg	-e 's|__projectroot__|\$(prefix)|g' \
4954d9306dbSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4964d9306dbSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4974d9306dbSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4984d9306dbSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4994d9306dbSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5004d9306dbSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5014d9306dbSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5024d9306dbSmrgAC_SUBST([MAN_SUBSTS])
5034d9306dbSmrg
5044d9306dbSmrg]) # XORG_MANPAGE_SECTIONS
5054d9306dbSmrg
5064d9306dbSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5074d9306dbSmrg# ------------------------
5084d9306dbSmrg# Minimum version: 1.7.0
509067610f1Smrg#
5104d9306dbSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5114d9306dbSmrg# provided by xorg-sgml-doctools, if installed.
5124d9306dbSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5134d9306dbSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5144d9306dbSmrgXORG_SGML_PATH=
5154d9306dbSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5164d9306dbSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5174d9306dbSmrg    [m4_ifval([$1],[:],
5184d9306dbSmrg        [if test x"$cross_compiling" != x"yes" ; then
5194d9306dbSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5204d9306dbSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5214d9306dbSmrg         fi])
5224d9306dbSmrg    ])
523067610f1Smrg
5244d9306dbSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
5254d9306dbSmrg# the path and the name of the doc stylesheet
5264d9306dbSmrgif test "x$XORG_SGML_PATH" != "x" ; then
5274d9306dbSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
5284d9306dbSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
5294d9306dbSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
5304d9306dbSmrgelse
5314d9306dbSmrg   AC_MSG_RESULT([no])
5324d9306dbSmrgfi
5334d9306dbSmrg
5344d9306dbSmrgAC_SUBST(XORG_SGML_PATH)
5354d9306dbSmrgAC_SUBST(STYLESHEET_SRCDIR)
5364d9306dbSmrgAC_SUBST(XSL_STYLESHEET)
5374d9306dbSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
5384d9306dbSmrg]) # XORG_CHECK_SGML_DOCTOOLS
539067610f1Smrg
5404d9306dbSmrg# XORG_CHECK_LINUXDOC
5414d9306dbSmrg# -------------------
5424d9306dbSmrg# Minimum version: 1.0.0
543067610f1Smrg#
5444d9306dbSmrg# Defines the variable MAKE_TEXT if the necessary tools and
5454d9306dbSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
5464d9306dbSmrg# Whether or not the necessary tools and files are found can be checked
5474d9306dbSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
5484d9306dbSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
5494d9306dbSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5504d9306dbSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
551067610f1Smrg
5524d9306dbSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
553067610f1Smrg
5544d9306dbSmrgAC_MSG_CHECKING([whether to build documentation])
555e7fdea5fSmrg
5564d9306dbSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
5574d9306dbSmrg   BUILDDOC=yes
5584d9306dbSmrgelse
5594d9306dbSmrg   BUILDDOC=no
560067610f1Smrgfi
561067610f1Smrg
5624d9306dbSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5634d9306dbSmrg
5644d9306dbSmrgAC_MSG_RESULT([$BUILDDOC])
5654d9306dbSmrg
5664d9306dbSmrgAC_MSG_CHECKING([whether to build pdf documentation])
5674d9306dbSmrg
5684d9306dbSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5694d9306dbSmrg   BUILDPDFDOC=yes
5704d9306dbSmrgelse
5714d9306dbSmrg   BUILDPDFDOC=no
572067610f1Smrgfi
573067610f1Smrg
5744d9306dbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
575067610f1Smrg
5764d9306dbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
577067610f1Smrg
5784d9306dbSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5794d9306dbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5804d9306dbSmrgMAKE_PDF="$PS2PDF"
5814d9306dbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
582067610f1Smrg
5834d9306dbSmrgAC_SUBST(MAKE_TEXT)
5844d9306dbSmrgAC_SUBST(MAKE_PS)
5854d9306dbSmrgAC_SUBST(MAKE_PDF)
5864d9306dbSmrgAC_SUBST(MAKE_HTML)
5874d9306dbSmrg]) # XORG_CHECK_LINUXDOC
588e7fdea5fSmrg
5894d9306dbSmrg# XORG_CHECK_DOCBOOK
5904d9306dbSmrg# -------------------
5914d9306dbSmrg# Minimum version: 1.0.0
5924d9306dbSmrg#
5934d9306dbSmrg# Checks for the ability to build output formats from SGML DocBook source.
5944d9306dbSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5954d9306dbSmrg# indicates whether the necessary tools and files are found and, if set,
5964d9306dbSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5974d9306dbSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5984d9306dbSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599e7fdea5fSmrg
6004d9306dbSmrgBUILDTXTDOC=no
6014d9306dbSmrgBUILDPDFDOC=no
6024d9306dbSmrgBUILDPSDOC=no
6034d9306dbSmrgBUILDHTMLDOC=no
604e7fdea5fSmrg
6054d9306dbSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6064d9306dbSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6074d9306dbSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6084d9306dbSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609e7fdea5fSmrg
6104d9306dbSmrgAC_MSG_CHECKING([whether to build text documentation])
6114d9306dbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6124d9306dbSmrg   test x$BUILD_TXTDOC != xno; then
6134d9306dbSmrg	BUILDTXTDOC=yes
6144d9306dbSmrgfi
6154d9306dbSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6164d9306dbSmrgAC_MSG_RESULT([$BUILDTXTDOC])
617e7fdea5fSmrg
6184d9306dbSmrgAC_MSG_CHECKING([whether to build PDF documentation])
6194d9306dbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6204d9306dbSmrg   test x$BUILD_PDFDOC != xno; then
6214d9306dbSmrg	BUILDPDFDOC=yes
6224d9306dbSmrgfi
6234d9306dbSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6244d9306dbSmrgAC_MSG_RESULT([$BUILDPDFDOC])
625e7fdea5fSmrg
6264d9306dbSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
6274d9306dbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
6284d9306dbSmrg   test x$BUILD_PSDOC != xno; then
6294d9306dbSmrg	BUILDPSDOC=yes
6304d9306dbSmrgfi
6314d9306dbSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
6324d9306dbSmrgAC_MSG_RESULT([$BUILDPSDOC])
633e7fdea5fSmrg
6344d9306dbSmrgAC_MSG_CHECKING([whether to build HTML documentation])
6354d9306dbSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
6364d9306dbSmrg   test x$BUILD_HTMLDOC != xno; then
6374d9306dbSmrg	BUILDHTMLDOC=yes
6384d9306dbSmrgfi
6394d9306dbSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
6404d9306dbSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
6417e6533d5Smrg
6424d9306dbSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
6434d9306dbSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
6444d9306dbSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
6454d9306dbSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
646067610f1Smrg
6474d9306dbSmrgAC_SUBST(MAKE_TEXT)
6484d9306dbSmrgAC_SUBST(MAKE_PS)
6494d9306dbSmrgAC_SUBST(MAKE_PDF)
6504d9306dbSmrgAC_SUBST(MAKE_HTML)
6514d9306dbSmrg]) # XORG_CHECK_DOCBOOK
652067610f1Smrg
6534d9306dbSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
6544d9306dbSmrg# ----------------
6554d9306dbSmrg# Minimum version: 1.5.0
6564d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
657067610f1Smrg#
6584d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
6594d9306dbSmrg# not at the appropriate level. This macro enables a module to test for the
6604d9306dbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
6614d9306dbSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6624d9306dbSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6634d9306dbSmrg# --with-xmlto assumes 'auto'.
664067610f1Smrg#
6654d9306dbSmrg# Interface to module:
6664d9306dbSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6674d9306dbSmrg# XMLTO:	returns the path of the xmlto program found
6684d9306dbSmrg#		returns the path set by the user in the environment
6694d9306dbSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6704d9306dbSmrg#		'no' user instructs the module not to use xmlto
6714d9306dbSmrg#
6724d9306dbSmrg# Added in version 1.10.0
6734d9306dbSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6744d9306dbSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6754d9306dbSmrg#
6764d9306dbSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6774d9306dbSmrg#
6784d9306dbSmrgAC_DEFUN([XORG_WITH_XMLTO],[
6794d9306dbSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6804d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
6814d9306dbSmrgAC_ARG_WITH(xmlto,
6824d9306dbSmrg	AS_HELP_STRING([--with-xmlto],
6834d9306dbSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6844d9306dbSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6854d9306dbSmrgm4_undefine([_defopt])
686067610f1Smrg
6874d9306dbSmrgif test "x$use_xmlto" = x"auto"; then
6884d9306dbSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6894d9306dbSmrg   if test "x$XMLTO" = "x"; then
6904d9306dbSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6914d9306dbSmrg	have_xmlto=no
6924d9306dbSmrg   else
6934d9306dbSmrg        have_xmlto=yes
6944d9306dbSmrg   fi
6954d9306dbSmrgelif test "x$use_xmlto" = x"yes" ; then
6964d9306dbSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6974d9306dbSmrg   if test "x$XMLTO" = "x"; then
6984d9306dbSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6994d9306dbSmrg   fi
7004d9306dbSmrg   have_xmlto=yes
7014d9306dbSmrgelif test "x$use_xmlto" = x"no" ; then
7024d9306dbSmrg   if test "x$XMLTO" != "x"; then
7034d9306dbSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7044d9306dbSmrg   fi
7054d9306dbSmrg   have_xmlto=no
706067610f1Smrgelse
7074d9306dbSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
708067610f1Smrgfi
709067610f1Smrg
7104d9306dbSmrg# Test for a minimum version of xmlto, if provided.
7114d9306dbSmrgm4_ifval([$1],
7124d9306dbSmrg[if test "$have_xmlto" = yes; then
7134d9306dbSmrg    # scrape the xmlto version
7144d9306dbSmrg    AC_MSG_CHECKING([the xmlto version])
7154d9306dbSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7164d9306dbSmrg    AC_MSG_RESULT([$xmlto_version])
7174d9306dbSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7184d9306dbSmrg        [if test "x$use_xmlto" = xauto; then
7194d9306dbSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7204d9306dbSmrg            have_xmlto=no
7214d9306dbSmrg        else
7224d9306dbSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7234d9306dbSmrg        fi])
7244d9306dbSmrgfi])
725067610f1Smrg
7264d9306dbSmrg# Test for the ability of xmlto to generate a text target
727067610f1Smrg#
7284d9306dbSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
7294d9306dbSmrg# following test for empty XML docbook files.
7304d9306dbSmrg# For compatibility reasons use the following empty XML docbook file and if
7314d9306dbSmrg# it fails try it again with a non-empty XML file.
7324d9306dbSmrghave_xmlto_text=no
7334d9306dbSmrgcat > conftest.xml << "EOF"
7344d9306dbSmrgEOF
7354d9306dbSmrgAS_IF([test "$have_xmlto" = yes],
7364d9306dbSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7374d9306dbSmrg             [have_xmlto_text=yes],
7384d9306dbSmrg             [# Try it again with a non-empty XML file.
7394d9306dbSmrg              cat > conftest.xml << "EOF"
7404d9306dbSmrg<x></x>
7414d9306dbSmrgEOF
7424d9306dbSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
7434d9306dbSmrg                    [have_xmlto_text=yes],
7444d9306dbSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
7454d9306dbSmrgrm -f conftest.xml
7464d9306dbSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
7474d9306dbSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
7484d9306dbSmrg]) # XORG_WITH_XMLTO
749067610f1Smrg
7504d9306dbSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
7514d9306dbSmrg# --------------------------------------------
7524d9306dbSmrg# Minimum version: 1.12.0
7534d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.12.0
754067610f1Smrg#
7554d9306dbSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
7564d9306dbSmrg# XML-based language used for the transformation of XML documents.
7574d9306dbSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
7584d9306dbSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
7594d9306dbSmrg# The XSLT processor is often used as a standalone tool for transformations.
7604d9306dbSmrg# It should not be assumed that this tool is used only to work with documnetation.
7614d9306dbSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7624d9306dbSmrg#
7634d9306dbSmrg# Interface to module:
7644d9306dbSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7654d9306dbSmrg# XSLTPROC:	 returns the path of the xsltproc program found
7664d9306dbSmrg#		 returns the path set by the user in the environment
7674d9306dbSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7684d9306dbSmrg#		  'no' user instructs the module not to use xsltproc
7694d9306dbSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7704d9306dbSmrg#
7714d9306dbSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7724d9306dbSmrg#
7734d9306dbSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7744d9306dbSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7754d9306dbSmrg# Preserves the interface, should it be implemented later
7764d9306dbSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7774d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
7784d9306dbSmrgAC_ARG_WITH(xsltproc,
7794d9306dbSmrg	AS_HELP_STRING([--with-xsltproc],
7804d9306dbSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7814d9306dbSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7824d9306dbSmrgm4_undefine([_defopt])
783067610f1Smrg
7844d9306dbSmrgif test "x$use_xsltproc" = x"auto"; then
7854d9306dbSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7864d9306dbSmrg   if test "x$XSLTPROC" = "x"; then
7874d9306dbSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7884d9306dbSmrg	have_xsltproc=no
7894d9306dbSmrg   else
7904d9306dbSmrg        have_xsltproc=yes
7914d9306dbSmrg   fi
7924d9306dbSmrgelif test "x$use_xsltproc" = x"yes" ; then
7934d9306dbSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7944d9306dbSmrg   if test "x$XSLTPROC" = "x"; then
7954d9306dbSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7964d9306dbSmrg   fi
7974d9306dbSmrg   have_xsltproc=yes
7984d9306dbSmrgelif test "x$use_xsltproc" = x"no" ; then
7994d9306dbSmrg   if test "x$XSLTPROC" != "x"; then
8004d9306dbSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8014d9306dbSmrg   fi
8024d9306dbSmrg   have_xsltproc=no
803067610f1Smrgelse
8044d9306dbSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
805067610f1Smrgfi
806067610f1Smrg
8074d9306dbSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8084d9306dbSmrg]) # XORG_WITH_XSLTPROC
809067610f1Smrg
8104d9306dbSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8114d9306dbSmrg# ----------------------------------------
8124d9306dbSmrg# Minimum version: 1.15.0
813067610f1Smrg#
8144d9306dbSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
8154d9306dbSmrg# scanning arbitrary text files, extracting information from those text files,
8164d9306dbSmrg# and printing reports based on that information.
817e7fdea5fSmrg#
8184d9306dbSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8194d9306dbSmrg#
8204d9306dbSmrg# Interface to module:
8214d9306dbSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
8224d9306dbSmrg# PERL:	     returns the path of the perl program found
8234d9306dbSmrg#	     returns the path set by the user in the environment
8244d9306dbSmrg# --with-perl: 'yes' user instructs the module to use perl
8254d9306dbSmrg#	       'no' user instructs the module not to use perl
8264d9306dbSmrg# have_perl: returns yes if perl found in PATH or no
8274d9306dbSmrg#
8284d9306dbSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
8294d9306dbSmrg#
8304d9306dbSmrgAC_DEFUN([XORG_WITH_PERL],[
8314d9306dbSmrgAC_ARG_VAR([PERL], [Path to perl command])
8324d9306dbSmrg# Preserves the interface, should it be implemented later
8334d9306dbSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
8344d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
8354d9306dbSmrgAC_ARG_WITH(perl,
8364d9306dbSmrg	AS_HELP_STRING([--with-perl],
8374d9306dbSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
8384d9306dbSmrg	   [use_perl=$withval], [use_perl=]_defopt)
8394d9306dbSmrgm4_undefine([_defopt])
840067610f1Smrg
8414d9306dbSmrgif test "x$use_perl" = x"auto"; then
8424d9306dbSmrg   AC_PATH_PROG([PERL], [perl])
8434d9306dbSmrg   if test "x$PERL" = "x"; then
8444d9306dbSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
8454d9306dbSmrg	have_perl=no
8464d9306dbSmrg   else
8474d9306dbSmrg        have_perl=yes
8484d9306dbSmrg   fi
8494d9306dbSmrgelif test "x$use_perl" = x"yes" ; then
8504d9306dbSmrg   AC_PATH_PROG([PERL], [perl])
8514d9306dbSmrg   if test "x$PERL" = "x"; then
8524d9306dbSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
8534d9306dbSmrg   fi
8544d9306dbSmrg   have_perl=yes
8554d9306dbSmrgelif test "x$use_perl" = x"no" ; then
8564d9306dbSmrg   if test "x$PERL" != "x"; then
8574d9306dbSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
8584d9306dbSmrg   fi
8594d9306dbSmrg   have_perl=no
8604d9306dbSmrgelse
8614d9306dbSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
862e7fdea5fSmrgfi
863e7fdea5fSmrg
8644d9306dbSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8654d9306dbSmrg]) # XORG_WITH_PERL
866e7fdea5fSmrg
8674d9306dbSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8684d9306dbSmrg# ----------------
8694d9306dbSmrg# Minimum version: 1.5.0
8704d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
871067610f1Smrg#
8724d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
8734d9306dbSmrg# not at the appropriate level. This macro enables a module to test for the
8744d9306dbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
8754d9306dbSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8764d9306dbSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8774d9306dbSmrg# --with-asciidoc assumes 'auto'.
878e7fdea5fSmrg#
8794d9306dbSmrg# Interface to module:
8804d9306dbSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8814d9306dbSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
8824d9306dbSmrg#		 returns the path set by the user in the environment
8834d9306dbSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8844d9306dbSmrg#		  'no' user instructs the module not to use asciidoc
8854d9306dbSmrg#
8864d9306dbSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8874d9306dbSmrg#
8884d9306dbSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8894d9306dbSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8904d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
8914d9306dbSmrgAC_ARG_WITH(asciidoc,
8924d9306dbSmrg	AS_HELP_STRING([--with-asciidoc],
8934d9306dbSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8944d9306dbSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8954d9306dbSmrgm4_undefine([_defopt])
896067610f1Smrg
8974d9306dbSmrgif test "x$use_asciidoc" = x"auto"; then
8984d9306dbSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8994d9306dbSmrg   if test "x$ASCIIDOC" = "x"; then
9004d9306dbSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9014d9306dbSmrg	have_asciidoc=no
9024d9306dbSmrg   else
9034d9306dbSmrg        have_asciidoc=yes
9044d9306dbSmrg   fi
9054d9306dbSmrgelif test "x$use_asciidoc" = x"yes" ; then
9064d9306dbSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9074d9306dbSmrg   if test "x$ASCIIDOC" = "x"; then
9084d9306dbSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9094d9306dbSmrg   fi
9104d9306dbSmrg   have_asciidoc=yes
9114d9306dbSmrgelif test "x$use_asciidoc" = x"no" ; then
9124d9306dbSmrg   if test "x$ASCIIDOC" != "x"; then
9134d9306dbSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9144d9306dbSmrg   fi
9154d9306dbSmrg   have_asciidoc=no
9164d9306dbSmrgelse
9174d9306dbSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9184d9306dbSmrgfi
9194d9306dbSmrgm4_ifval([$1],
9204d9306dbSmrg[if test "$have_asciidoc" = yes; then
9214d9306dbSmrg    # scrape the asciidoc version
9224d9306dbSmrg    AC_MSG_CHECKING([the asciidoc version])
9234d9306dbSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9244d9306dbSmrg    AC_MSG_RESULT([$asciidoc_version])
9254d9306dbSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
9264d9306dbSmrg        [if test "x$use_asciidoc" = xauto; then
9274d9306dbSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
9284d9306dbSmrg            have_asciidoc=no
9294d9306dbSmrg        else
9304d9306dbSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
9314d9306dbSmrg        fi])
9324d9306dbSmrgfi])
9334d9306dbSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
9344d9306dbSmrg]) # XORG_WITH_ASCIIDOC
9357e6533d5Smrg
9364d9306dbSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
9374d9306dbSmrg# -------------------------------------------
9384d9306dbSmrg# Minimum version: 1.5.0
9394d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9404d9306dbSmrg# Minimum version for optional DOT checking: 1.18.0
9414d9306dbSmrg#
9424d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
9434d9306dbSmrg# not at the appropriate level. This macro enables a module to test for the
9444d9306dbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9454d9306dbSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
9464d9306dbSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
9474d9306dbSmrg# --with-doxygen assumes 'auto'.
9484d9306dbSmrg#
9494d9306dbSmrg# Interface to module:
9504d9306dbSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
9514d9306dbSmrg# DOXYGEN:	 returns the path of the doxygen program found
9524d9306dbSmrg#		 returns the path set by the user in the environment
9534d9306dbSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
9544d9306dbSmrg#		  'no' user instructs the module not to use doxygen
9554d9306dbSmrg#
9564d9306dbSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
9574d9306dbSmrg#
9584d9306dbSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
9594d9306dbSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
9604d9306dbSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9614d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
9624d9306dbSmrgAC_ARG_WITH(doxygen,
9634d9306dbSmrg	AS_HELP_STRING([--with-doxygen],
9644d9306dbSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9654d9306dbSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9664d9306dbSmrgm4_undefine([_defopt])
967e7fdea5fSmrg
9684d9306dbSmrgif test "x$use_doxygen" = x"auto"; then
9694d9306dbSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9704d9306dbSmrg   if test "x$DOXYGEN" = "x"; then
9714d9306dbSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9724d9306dbSmrg	have_doxygen=no
9734d9306dbSmrg   else
9744d9306dbSmrg        have_doxygen=yes
9754d9306dbSmrg   fi
9764d9306dbSmrgelif test "x$use_doxygen" = x"yes" ; then
9774d9306dbSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9784d9306dbSmrg   if test "x$DOXYGEN" = "x"; then
9794d9306dbSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9804d9306dbSmrg   fi
9814d9306dbSmrg   have_doxygen=yes
9824d9306dbSmrgelif test "x$use_doxygen" = x"no" ; then
9834d9306dbSmrg   if test "x$DOXYGEN" != "x"; then
9844d9306dbSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9854d9306dbSmrg   fi
9864d9306dbSmrg   have_doxygen=no
987067610f1Smrgelse
9884d9306dbSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
989067610f1Smrgfi
9904d9306dbSmrgm4_ifval([$1],
9914d9306dbSmrg[if test "$have_doxygen" = yes; then
9924d9306dbSmrg    # scrape the doxygen version
9934d9306dbSmrg    AC_MSG_CHECKING([the doxygen version])
9944d9306dbSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9954d9306dbSmrg    AC_MSG_RESULT([$doxygen_version])
9964d9306dbSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9974d9306dbSmrg        [if test "x$use_doxygen" = xauto; then
9984d9306dbSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9994d9306dbSmrg            have_doxygen=no
10004d9306dbSmrg        else
10014d9306dbSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10024d9306dbSmrg        fi])
10034d9306dbSmrgfi])
10044d9306dbSmrg
10054d9306dbSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
10064d9306dbSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
10074d9306dbSmrgdnl 	HAVE_DOT = @HAVE_DOT@
10084d9306dbSmrgHAVE_DOT=no
10094d9306dbSmrgif test "x$have_doxygen" = "xyes"; then
10104d9306dbSmrg  AC_PATH_PROG([DOT], [dot])
10114d9306dbSmrg    if test "x$DOT" != "x"; then
10124d9306dbSmrg      HAVE_DOT=yes
10134d9306dbSmrg    fi
1014e7fdea5fSmrgfi
1015067610f1Smrg
10164d9306dbSmrgAC_SUBST([HAVE_DOT])
10174d9306dbSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10184d9306dbSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10194d9306dbSmrg]) # XORG_WITH_DOXYGEN
10204d9306dbSmrg
10214d9306dbSmrg# XORG_WITH_GROFF([DEFAULT])
10224d9306dbSmrg# ----------------
10234d9306dbSmrg# Minimum version: 1.6.0
10244d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10257e6533d5Smrg#
10264d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
10274d9306dbSmrg# not at the appropriate level. This macro enables a module to test for the
10284d9306dbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10294d9306dbSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
10304d9306dbSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
10314d9306dbSmrg# --with-groff assumes 'auto'.
10324d9306dbSmrg#
10334d9306dbSmrg# Interface to module:
10344d9306dbSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
10354d9306dbSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
10364d9306dbSmrg# HAVE_GROFF_MS: the -ms macros package
10374d9306dbSmrg# GROFF:	 returns the path of the groff program found
10384d9306dbSmrg#		 returns the path set by the user in the environment
10394d9306dbSmrg# --with-groff:	 'yes' user instructs the module to use groff
10404d9306dbSmrg#		 'no' user instructs the module not to use groff
10414d9306dbSmrg#
10424d9306dbSmrg# Added in version 1.9.0:
10434d9306dbSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
10444d9306dbSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
10454d9306dbSmrg#		   psselect from the psutils package.
10464d9306dbSmrg#		   the ghostcript package. Refer to the grohtml man pages
10474d9306dbSmrg#
10484d9306dbSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
10494d9306dbSmrg#
10504d9306dbSmrg# OS and distros often splits groff in a basic and full package, the former
10514d9306dbSmrg# having the groff program and the later having devices, fonts and macros
10524d9306dbSmrg# Checking for the groff executable is not enough.
10534d9306dbSmrg#
10544d9306dbSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
10554d9306dbSmrg# unset HAVE_GROFF or GROFF env variables.
10564d9306dbSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
10574d9306dbSmrg#
10584d9306dbSmrgAC_DEFUN([XORG_WITH_GROFF],[
10594d9306dbSmrgAC_ARG_VAR([GROFF], [Path to groff command])
10604d9306dbSmrgm4_define([_defopt], m4_default([$1], [auto]))
10614d9306dbSmrgAC_ARG_WITH(groff,
10624d9306dbSmrg	AS_HELP_STRING([--with-groff],
10634d9306dbSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10644d9306dbSmrg	   [use_groff=$withval], [use_groff=]_defopt)
10654d9306dbSmrgm4_undefine([_defopt])
10667e6533d5Smrg
10674d9306dbSmrgif test "x$use_groff" = x"auto"; then
10684d9306dbSmrg   AC_PATH_PROG([GROFF], [groff])
10694d9306dbSmrg   if test "x$GROFF" = "x"; then
10704d9306dbSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10714d9306dbSmrg	have_groff=no
10724d9306dbSmrg   else
10734d9306dbSmrg        have_groff=yes
10744d9306dbSmrg   fi
10754d9306dbSmrgelif test "x$use_groff" = x"yes" ; then
10764d9306dbSmrg   AC_PATH_PROG([GROFF], [groff])
10774d9306dbSmrg   if test "x$GROFF" = "x"; then
10784d9306dbSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10794d9306dbSmrg   fi
10804d9306dbSmrg   have_groff=yes
10814d9306dbSmrgelif test "x$use_groff" = x"no" ; then
10824d9306dbSmrg   if test "x$GROFF" != "x"; then
10834d9306dbSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10844d9306dbSmrg   fi
10854d9306dbSmrg   have_groff=no
1086e7fdea5fSmrgelse
10874d9306dbSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10884d9306dbSmrgfi
10894d9306dbSmrg
10904d9306dbSmrg# We have groff, test for the presence of the macro packages
10914d9306dbSmrgif test "x$have_groff" = x"yes"; then
10924d9306dbSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10934d9306dbSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10944d9306dbSmrg        groff_ms_works=yes
10954d9306dbSmrg    else
10964d9306dbSmrg        groff_ms_works=no
10974d9306dbSmrg    fi
10984d9306dbSmrg    AC_MSG_RESULT([$groff_ms_works])
10994d9306dbSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11004d9306dbSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11014d9306dbSmrg        groff_mm_works=yes
11024d9306dbSmrg    else
11034d9306dbSmrg        groff_mm_works=no
11044d9306dbSmrg    fi
11054d9306dbSmrg    AC_MSG_RESULT([$groff_mm_works])
1106e7fdea5fSmrgfi
11077e6533d5Smrg
11084d9306dbSmrg# We have groff, test for HTML dependencies, one command per package
11094d9306dbSmrgif test "x$have_groff" = x"yes"; then
11104d9306dbSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11114d9306dbSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11124d9306dbSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11134d9306dbSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11144d9306dbSmrg      have_groff_html=yes
11154d9306dbSmrg   else
11164d9306dbSmrg      have_groff_html=no
11174d9306dbSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11184d9306dbSmrg   fi
11194d9306dbSmrgfi
11204d9306dbSmrg
11214d9306dbSmrg# Set Automake conditionals for Makefiles
11224d9306dbSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11234d9306dbSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11244d9306dbSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
11254d9306dbSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
11264d9306dbSmrg]) # XORG_WITH_GROFF
11274d9306dbSmrg
11284d9306dbSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
11294d9306dbSmrg# ---------------------------------------
11304d9306dbSmrg# Minimum version: 1.6.0
11314d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11324d9306dbSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1133067610f1Smrg#
11344d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
11354d9306dbSmrg# not at the appropriate level. This macro enables a module to test for the
11364d9306dbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11374d9306dbSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
11384d9306dbSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
11394d9306dbSmrg# --with-fop assumes 'auto'.
11404d9306dbSmrg#
11414d9306dbSmrg# Interface to module:
11424d9306dbSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
11434d9306dbSmrg# FOP:	 	returns the path of the fop program found
11444d9306dbSmrg#		returns the path set by the user in the environment
11454d9306dbSmrg# --with-fop: 	'yes' user instructs the module to use fop
11464d9306dbSmrg#		'no' user instructs the module not to use fop
11474d9306dbSmrg#
11484d9306dbSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
11494d9306dbSmrg#
11504d9306dbSmrgAC_DEFUN([XORG_WITH_FOP],[
11514d9306dbSmrgAC_ARG_VAR([FOP], [Path to fop command])
11524d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
11534d9306dbSmrgAC_ARG_WITH(fop,
11544d9306dbSmrg	AS_HELP_STRING([--with-fop],
11554d9306dbSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
11564d9306dbSmrg	   [use_fop=$withval], [use_fop=]_defopt)
11574d9306dbSmrgm4_undefine([_defopt])
1158067610f1Smrg
11594d9306dbSmrgif test "x$use_fop" = x"auto"; then
11604d9306dbSmrg   AC_PATH_PROG([FOP], [fop])
11614d9306dbSmrg   if test "x$FOP" = "x"; then
11624d9306dbSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11634d9306dbSmrg	have_fop=no
11644d9306dbSmrg   else
11654d9306dbSmrg        have_fop=yes
11664d9306dbSmrg   fi
11674d9306dbSmrgelif test "x$use_fop" = x"yes" ; then
11684d9306dbSmrg   AC_PATH_PROG([FOP], [fop])
11694d9306dbSmrg   if test "x$FOP" = "x"; then
11704d9306dbSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11714d9306dbSmrg   fi
11724d9306dbSmrg   have_fop=yes
11734d9306dbSmrgelif test "x$use_fop" = x"no" ; then
11744d9306dbSmrg   if test "x$FOP" != "x"; then
11754d9306dbSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11764d9306dbSmrg   fi
11774d9306dbSmrg   have_fop=no
11784d9306dbSmrgelse
11794d9306dbSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1180067610f1Smrgfi
1181067610f1Smrg
11824d9306dbSmrg# Test for a minimum version of fop, if provided.
11834d9306dbSmrgm4_ifval([$1],
11844d9306dbSmrg[if test "$have_fop" = yes; then
11854d9306dbSmrg    # scrape the fop version
11864d9306dbSmrg    AC_MSG_CHECKING([for fop minimum version])
11874d9306dbSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11884d9306dbSmrg    AC_MSG_RESULT([$fop_version])
11894d9306dbSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
11904d9306dbSmrg        [if test "x$use_fop" = xauto; then
11914d9306dbSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11924d9306dbSmrg            have_fop=no
11934d9306dbSmrg        else
11944d9306dbSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11954d9306dbSmrg        fi])
11964d9306dbSmrgfi])
11974d9306dbSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11984d9306dbSmrg]) # XORG_WITH_FOP
1199067610f1Smrg
12004d9306dbSmrg# XORG_WITH_M4([MIN-VERSION])
1201067610f1Smrg# ---------------------------
12024d9306dbSmrg# Minimum version: 1.19.0
12034d9306dbSmrg#
12044d9306dbSmrg# This macro attempts to locate an m4 macro processor which supports
12054d9306dbSmrg# -I option and is only useful for modules relying on M4 in order to
12064d9306dbSmrg# expand macros in source code files.
12074d9306dbSmrg#
12084d9306dbSmrg# Interface to module:
12094d9306dbSmrg# M4:	 	returns the path of the m4 program found
12104d9306dbSmrg#		returns the path set by the user in the environment
12114d9306dbSmrg#
12124d9306dbSmrgAC_DEFUN([XORG_WITH_M4], [
12134d9306dbSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
12144d9306dbSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
12154d9306dbSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
12164d9306dbSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
12174d9306dbSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
12184d9306dbSmrg   [$PATH:/usr/gnu/bin])])
12197e6533d5Smrg
12204d9306dbSmrgAC_SUBST([M4], [$ac_cv_path_M4])
12214d9306dbSmrg]) # XORG_WITH_M4
1222067610f1Smrg
12234d9306dbSmrg# XORG_WITH_PS2PDF([DEFAULT])
12244d9306dbSmrg# ----------------
12254d9306dbSmrg# Minimum version: 1.6.0
12264d9306dbSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1227067610f1Smrg#
12284d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
12294d9306dbSmrg# not at the appropriate level. This macro enables a module to test for the
12304d9306dbSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
12314d9306dbSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
12324d9306dbSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
12334d9306dbSmrg# --with-ps2pdf assumes 'auto'.
1234067610f1Smrg#
12354d9306dbSmrg# Interface to module:
12364d9306dbSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
12374d9306dbSmrg# PS2PDF:	returns the path of the ps2pdf program found
12384d9306dbSmrg#		returns the path set by the user in the environment
12394d9306dbSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
12404d9306dbSmrg#		 'no' user instructs the module not to use ps2pdf
1241067610f1Smrg#
12424d9306dbSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243e7fdea5fSmrg#
12444d9306dbSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
12454d9306dbSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
12464d9306dbSmrgm4_define([_defopt], m4_default([$1], [auto]))
12474d9306dbSmrgAC_ARG_WITH(ps2pdf,
12484d9306dbSmrg	AS_HELP_STRING([--with-ps2pdf],
12494d9306dbSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
12504d9306dbSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
12514d9306dbSmrgm4_undefine([_defopt])
1252e7fdea5fSmrg
12534d9306dbSmrgif test "x$use_ps2pdf" = x"auto"; then
12544d9306dbSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12554d9306dbSmrg   if test "x$PS2PDF" = "x"; then
12564d9306dbSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
12574d9306dbSmrg	have_ps2pdf=no
12584d9306dbSmrg   else
12594d9306dbSmrg        have_ps2pdf=yes
12604d9306dbSmrg   fi
12614d9306dbSmrgelif test "x$use_ps2pdf" = x"yes" ; then
12624d9306dbSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12634d9306dbSmrg   if test "x$PS2PDF" = "x"; then
12644d9306dbSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12654d9306dbSmrg   fi
12664d9306dbSmrg   have_ps2pdf=yes
12674d9306dbSmrgelif test "x$use_ps2pdf" = x"no" ; then
12684d9306dbSmrg   if test "x$PS2PDF" != "x"; then
12694d9306dbSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12704d9306dbSmrg   fi
12714d9306dbSmrg   have_ps2pdf=no
12724d9306dbSmrgelse
12734d9306dbSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12744d9306dbSmrgfi
12754d9306dbSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12764d9306dbSmrg]) # XORG_WITH_PS2PDF
1277067610f1Smrg
12784d9306dbSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
12794d9306dbSmrg# ----------------
12804d9306dbSmrg# Minimum version: 1.6.0
12814d9306dbSmrg#
12824d9306dbSmrg# Documentation tools are not always available on all platforms and sometimes
12834d9306dbSmrg# not at the appropriate level. This macro enables a builder to skip all
12844d9306dbSmrg# documentation targets except traditional man pages.
12854d9306dbSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12864d9306dbSmrg# maximum flexibilty in controlling documentation building.
12874d9306dbSmrg# Refer to:
12884d9306dbSmrg# XORG_WITH_XMLTO         --with-xmlto
12894d9306dbSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12904d9306dbSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12914d9306dbSmrg# XORG_WITH_FOP           --with-fop
12924d9306dbSmrg# XORG_WITH_GROFF         --with-groff
12934d9306dbSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
12944d9306dbSmrg#
12954d9306dbSmrg# Interface to module:
12964d9306dbSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12974d9306dbSmrg# --enable-docs: 'yes' user instructs the module to generate docs
12984d9306dbSmrg#		 'no' user instructs the module not to generate docs
12994d9306dbSmrg# parm1:	specify the default value, yes or no.
1300aea1d7ffSmrg#
13014d9306dbSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13024d9306dbSmrgm4_define([docs_default], m4_default([$1], [yes]))
13034d9306dbSmrgAC_ARG_ENABLE(docs,
13044d9306dbSmrg	AS_HELP_STRING([--enable-docs],
13054d9306dbSmrg	   [Enable building the documentation (default: ]docs_default[)]),
13064d9306dbSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
13074d9306dbSmrgm4_undefine([docs_default])
13084d9306dbSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13094d9306dbSmrgAC_MSG_CHECKING([whether to build documentation])
13104d9306dbSmrgAC_MSG_RESULT([$build_docs])
13114d9306dbSmrg]) # XORG_ENABLE_DOCS
13124d9306dbSmrg
13134d9306dbSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13144d9306dbSmrg# ----------------
13154d9306dbSmrg# Minimum version: 1.6.0
1316aea1d7ffSmrg#
13174d9306dbSmrg# This macro enables a builder to skip all developer documentation.
13184d9306dbSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13194d9306dbSmrg# maximum flexibilty in controlling documentation building.
13204d9306dbSmrg# Refer to:
13214d9306dbSmrg# XORG_WITH_XMLTO         --with-xmlto
13224d9306dbSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13234d9306dbSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13244d9306dbSmrg# XORG_WITH_FOP           --with-fop
13254d9306dbSmrg# XORG_WITH_GROFF         --with-groff
13264d9306dbSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1327aea1d7ffSmrg#
13284d9306dbSmrg# Interface to module:
13294d9306dbSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
13304d9306dbSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
13314d9306dbSmrg#			'no' user instructs the module not to generate developer docs
13324d9306dbSmrg# parm1:		specify the default value, yes or no.
1333aea1d7ffSmrg#
13344d9306dbSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
13354d9306dbSmrgm4_define([devel_default], m4_default([$1], [yes]))
13364d9306dbSmrgAC_ARG_ENABLE(devel-docs,
13374d9306dbSmrg	AS_HELP_STRING([--enable-devel-docs],
13384d9306dbSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
13394d9306dbSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
13404d9306dbSmrgm4_undefine([devel_default])
13414d9306dbSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
13424d9306dbSmrgAC_MSG_CHECKING([whether to build developer documentation])
13434d9306dbSmrgAC_MSG_RESULT([$build_devel_docs])
13444d9306dbSmrg]) # XORG_ENABLE_DEVEL_DOCS
1345aea1d7ffSmrg
13464d9306dbSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
13474d9306dbSmrg# ----------------
13484d9306dbSmrg# Minimum version: 1.6.0
1349aea1d7ffSmrg#
13504d9306dbSmrg# This macro enables a builder to skip all functional specification targets.
13514d9306dbSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13524d9306dbSmrg# maximum flexibilty in controlling documentation building.
13534d9306dbSmrg# Refer to:
13544d9306dbSmrg# XORG_WITH_XMLTO         --with-xmlto
13554d9306dbSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13564d9306dbSmrg# XORG_WITH_DOXYGEN       --with-doxygen
13574d9306dbSmrg# XORG_WITH_FOP           --with-fop
13584d9306dbSmrg# XORG_WITH_GROFF         --with-groff
13594d9306dbSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1360aea1d7ffSmrg#
13614d9306dbSmrg# Interface to module:
13624d9306dbSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13634d9306dbSmrg# --enable-specs:	'yes' user instructs the module to generate specs
13644d9306dbSmrg#			'no' user instructs the module not to generate specs
13654d9306dbSmrg# parm1:		specify the default value, yes or no.
1366aea1d7ffSmrg#
13674d9306dbSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13684d9306dbSmrgm4_define([spec_default], m4_default([$1], [yes]))
13694d9306dbSmrgAC_ARG_ENABLE(specs,
13704d9306dbSmrg	AS_HELP_STRING([--enable-specs],
13714d9306dbSmrg	   [Enable building the specs (default: ]spec_default[)]),
13724d9306dbSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
13734d9306dbSmrgm4_undefine([spec_default])
13744d9306dbSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13754d9306dbSmrgAC_MSG_CHECKING([whether to build functional specifications])
13764d9306dbSmrgAC_MSG_RESULT([$build_specs])
13774d9306dbSmrg]) # XORG_ENABLE_SPECS
1378aea1d7ffSmrg
13794d9306dbSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13804d9306dbSmrg# ----------------------------------------------
13814d9306dbSmrg# Minimum version: 1.13.0
1382aea1d7ffSmrg#
13834d9306dbSmrg# This macro enables a builder to enable/disable unit testing
13844d9306dbSmrg# It makes no assumption about the test cases implementation
13854d9306dbSmrg# Test cases may or may not use Automake "Support for test suites"
13864d9306dbSmrg# They may or may not use the software utility library GLib
1387aea1d7ffSmrg#
13884d9306dbSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13894d9306dbSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13904d9306dbSmrg# The variable enable_unit_tests is used by other macros in this file.
1391aea1d7ffSmrg#
13924d9306dbSmrg# Interface to module:
13934d9306dbSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13944d9306dbSmrg# enable_unit_tests:    used in configure.ac for additional configuration
13954d9306dbSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13964d9306dbSmrg#			'no' user instructs the module not to build tests
13974d9306dbSmrg# parm1:		specify the default value, yes or no.
1398aea1d7ffSmrg#
13994d9306dbSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14004d9306dbSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14014d9306dbSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14024d9306dbSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14034d9306dbSmrgm4_define([_defopt], m4_default([$1], [auto]))
14044d9306dbSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14054d9306dbSmrg	[Enable building unit test cases (default: ]_defopt[)]),
14064d9306dbSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14074d9306dbSmrgm4_undefine([_defopt])
14084d9306dbSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14094d9306dbSmrgAC_MSG_CHECKING([whether to build unit test cases])
14104d9306dbSmrgAC_MSG_RESULT([$enable_unit_tests])
14114d9306dbSmrg]) # XORG_ENABLE_UNIT_TESTS
1412aea1d7ffSmrg
14134d9306dbSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14144d9306dbSmrg# ------------------------------------------------------
14154d9306dbSmrg# Minimum version: 1.17.0
14164d9306dbSmrg#
14174d9306dbSmrg# This macro enables a builder to enable/disable integration testing
14184d9306dbSmrg# It makes no assumption about the test cases' implementation
14194d9306dbSmrg# Test cases may or may not use Automake "Support for test suites"
14204d9306dbSmrg#
14214d9306dbSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14224d9306dbSmrg# usually requires less dependencies and may be built and run under less
14234d9306dbSmrg# stringent environments than integration tests.
14244d9306dbSmrg#
14254d9306dbSmrg# Interface to module:
14264d9306dbSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
14274d9306dbSmrg# enable_integration_tests:   used in configure.ac for additional configuration
14284d9306dbSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
14294d9306dbSmrg#                             'no' user instructs the module not to build tests
14304d9306dbSmrg# parm1:                      specify the default value, yes or no.
14314d9306dbSmrg#
14324d9306dbSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
14334d9306dbSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14344d9306dbSmrgm4_define([_defopt], m4_default([$1], [auto]))
14354d9306dbSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
14364d9306dbSmrg	[Enable building integration test cases (default: ]_defopt[)]),
14374d9306dbSmrg	[enable_integration_tests=$enableval],
14384d9306dbSmrg	[enable_integration_tests=]_defopt)
14394d9306dbSmrgm4_undefine([_defopt])
14404d9306dbSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
14414d9306dbSmrg	[test "x$enable_integration_tests" != xno])
14424d9306dbSmrgAC_MSG_CHECKING([whether to build unit test cases])
14434d9306dbSmrgAC_MSG_RESULT([$enable_integration_tests])
14444d9306dbSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445067610f1Smrg
14464d9306dbSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
14474d9306dbSmrg# ----------------------------------------
14484d9306dbSmrg# Minimum version: 1.13.0
1449067610f1Smrg#
14504d9306dbSmrg# GLib is a library which provides advanced data structures and functions.
14514d9306dbSmrg# This macro enables a module to test for the presence of Glib.
1452067610f1Smrg#
14534d9306dbSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
14544d9306dbSmrg# Otherwise the value of $enable_unit_tests is blank.
1455067610f1Smrg#
14564d9306dbSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
14574d9306dbSmrg# test support usually requires less dependencies and may be built and run under
14584d9306dbSmrg# less stringent environments than integration tests.
1459067610f1Smrg#
14604d9306dbSmrg# Interface to module:
14614d9306dbSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
14624d9306dbSmrg# with_glib: used in configure.ac to know if GLib has been found
14634d9306dbSmrg# --with-glib:	'yes' user instructs the module to use glib
14644d9306dbSmrg#		'no' user instructs the module not to use glib
1465067610f1Smrg#
14664d9306dbSmrgAC_DEFUN([XORG_WITH_GLIB],[
14674d9306dbSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14684d9306dbSmrgm4_define([_defopt], m4_default([$2], [auto]))
14694d9306dbSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14704d9306dbSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14714d9306dbSmrg	[with_glib=$withval], [with_glib=]_defopt)
14724d9306dbSmrgm4_undefine([_defopt])
1473067610f1Smrg
14744d9306dbSmrghave_glib=no
14754d9306dbSmrg# Do not probe GLib if user explicitly disabled unit testing
14764d9306dbSmrgif test "x$enable_unit_tests" != x"no"; then
14774d9306dbSmrg  # Do not probe GLib if user explicitly disabled it
14784d9306dbSmrg  if test "x$with_glib" != x"no"; then
14794d9306dbSmrg    m4_ifval(
14804d9306dbSmrg      [$1],
14814d9306dbSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14824d9306dbSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14834d9306dbSmrg    )
14844d9306dbSmrg  fi
1485067610f1Smrgfi
1486067610f1Smrg
14874d9306dbSmrg# Not having GLib when unit testing has been explicitly requested is an error
14884d9306dbSmrgif test "x$enable_unit_tests" = x"yes"; then
14894d9306dbSmrg  if test "x$have_glib" = x"no"; then
14904d9306dbSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14914d9306dbSmrg  fi
1492067610f1Smrgfi
1493067610f1Smrg
14944d9306dbSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
14954d9306dbSmrgif test "x$enable_unit_tests" = x"no"; then
14964d9306dbSmrg  if test "x$with_glib" = x"yes"; then
14974d9306dbSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14984d9306dbSmrg  fi
1499067610f1Smrgfi
1500067610f1Smrg
15014d9306dbSmrg# Not having GLib when it has been explicitly requested is an error
15024d9306dbSmrgif test "x$with_glib" = x"yes"; then
15034d9306dbSmrg  if test "x$have_glib" = x"no"; then
15044d9306dbSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15054d9306dbSmrg  fi
1506067610f1Smrgfi
1507067610f1Smrg
15084d9306dbSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15094d9306dbSmrg]) # XORG_WITH_GLIB
1510067610f1Smrg
15114d9306dbSmrg# XORG_LD_WRAP([required|optional])
15124d9306dbSmrg# ---------------------------------
15134d9306dbSmrg# Minimum version: 1.13.0
15144d9306dbSmrg#
15154d9306dbSmrg# Check if linker supports -wrap, passed via compiler flags
15164d9306dbSmrg#
15174d9306dbSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15184d9306dbSmrg# Otherwise the value of $enable_unit_tests is blank.
15194d9306dbSmrg#
15204d9306dbSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15214d9306dbSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15224d9306dbSmrg# available, an argument of "optional" allows use when some unit tests require
15234d9306dbSmrg# ld -wrap and others do not.
15244d9306dbSmrg#
15254d9306dbSmrgAC_DEFUN([XORG_LD_WRAP],[
15264d9306dbSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
15274d9306dbSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
15284d9306dbSmrg                      void __wrap_exit(int status) { return; }],
15294d9306dbSmrg                     [exit(0);])])
15304d9306dbSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
15314d9306dbSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
15324d9306dbSmrg  if test "x$have_ld_wrap" = x"no"; then
15334d9306dbSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
15344d9306dbSmrg  fi
1535067610f1Smrgfi
15364d9306dbSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
15374d9306dbSmrg#
15384d9306dbSmrg]) # XORG_LD_WRAP
1539067610f1Smrg
15404d9306dbSmrg# XORG_CHECK_LINKER_FLAGS
15414d9306dbSmrg# -----------------------
15424d9306dbSmrg# SYNOPSIS
15434d9306dbSmrg#
15444d9306dbSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
15454d9306dbSmrg#
15464d9306dbSmrg# DESCRIPTION
15474d9306dbSmrg#
15484d9306dbSmrg#   Check whether the given linker FLAGS work with the current language's
15494d9306dbSmrg#   linker, or whether they give an error.
15504d9306dbSmrg#
15514d9306dbSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15524d9306dbSmrg#   success/failure.
15534d9306dbSmrg#
15544d9306dbSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
15554d9306dbSmrg#
15564d9306dbSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
15574d9306dbSmrg#
15584d9306dbSmrg# LICENSE
15594d9306dbSmrg#
15604d9306dbSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15614d9306dbSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15624d9306dbSmrg#   Copyright (c) 2009 Matteo Frigo
15634d9306dbSmrg#
15644d9306dbSmrg#   This program is free software: you can redistribute it and/or modify it
15654d9306dbSmrg#   under the terms of the GNU General Public License as published by the
15664d9306dbSmrg#   Free Software Foundation, either version 3 of the License, or (at your
15674d9306dbSmrg#   option) any later version.
15684d9306dbSmrg#
15694d9306dbSmrg#   This program is distributed in the hope that it will be useful, but
15704d9306dbSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15714d9306dbSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15724d9306dbSmrg#   Public License for more details.
15734d9306dbSmrg#
15744d9306dbSmrg#   You should have received a copy of the GNU General Public License along
15754d9306dbSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15764d9306dbSmrg#
15774d9306dbSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
15784d9306dbSmrg#   gives unlimited permission to copy, distribute and modify the configure
15794d9306dbSmrg#   scripts that are the output of Autoconf when processing the Macro. You
15804d9306dbSmrg#   need not follow the terms of the GNU General Public License when using
15814d9306dbSmrg#   or distributing such scripts, even though portions of the text of the
15824d9306dbSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15834d9306dbSmrg#   all other use of the material that constitutes the Autoconf Macro.
15844d9306dbSmrg#
15854d9306dbSmrg#   This special exception to the GPL applies to versions of the Autoconf
15864d9306dbSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
15874d9306dbSmrg#   modified version of the Autoconf Macro, you may extend this special
15884d9306dbSmrg#   exception to the GPL to apply to your modified version as well.#
15894d9306dbSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15904d9306dbSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
15914d9306dbSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15924d9306dbSmrgAS_LITERAL_IF([$1],
15934d9306dbSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15944d9306dbSmrg      ax_save_FLAGS=$LDFLAGS
15954d9306dbSmrg      LDFLAGS="$1"
15964d9306dbSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15974d9306dbSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15984d9306dbSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15994d9306dbSmrg      LDFLAGS=$ax_save_FLAGS])],
16004d9306dbSmrg  [ax_save_FLAGS=$LDFLAGS
16014d9306dbSmrg   LDFLAGS="$1"
16024d9306dbSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16034d9306dbSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16044d9306dbSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16054d9306dbSmrg   LDFLAGS=$ax_save_FLAGS])
16064d9306dbSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16074d9306dbSmrgAC_MSG_RESULT($xorg_check_linker_flags)
16084d9306dbSmrgif test "x$xorg_check_linker_flags" = xyes; then
16094d9306dbSmrg	m4_default([$2], :)
16104d9306dbSmrgelse
16114d9306dbSmrg	m4_default([$3], :)
1612067610f1Smrgfi
16134d9306dbSmrg]) # XORG_CHECK_LINKER_FLAGS
1614067610f1Smrg
16154d9306dbSmrg# XORG_MEMORY_CHECK_FLAGS
16164d9306dbSmrg# -----------------------
16174d9306dbSmrg# Minimum version: 1.16.0
16184d9306dbSmrg#
16194d9306dbSmrg# This macro attempts to find appropriate memory checking functionality
16204d9306dbSmrg# for various platforms which unit testing code may use to catch various
16214d9306dbSmrg# forms of memory allocation and access errors in testing.
16224d9306dbSmrg#
16234d9306dbSmrg# Interface to module:
16244d9306dbSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
16254d9306dbSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
16264d9306dbSmrg#
16274d9306dbSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
16284d9306dbSmrg#
16294d9306dbSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1630067610f1Smrg
16314d9306dbSmrgAC_REQUIRE([AC_CANONICAL_HOST])
16324d9306dbSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
16334d9306dbSmrg           [Environment variables to enable memory checking in tests])
16347e6533d5Smrg
16354d9306dbSmrg# Check for different types of support on different platforms
16364d9306dbSmrgcase $host_os in
16374d9306dbSmrg    solaris*)
16384d9306dbSmrg        AC_CHECK_LIB([umem], [umem_alloc],
16394d9306dbSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
16404d9306dbSmrg        ;;
16414d9306dbSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
16424d9306dbSmrg        # both directly and inverted, so should not be 0 or 255.
16434d9306dbSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
16444d9306dbSmrg        ;;
16454d9306dbSmrg    darwin*)
16464d9306dbSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
16474d9306dbSmrg        ;;
16484d9306dbSmrg    *bsd*)
16494d9306dbSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
16504d9306dbSmrg        ;;
16514d9306dbSmrgesac
16527e6533d5Smrg
16534d9306dbSmrg# User supplied flags override default flags
16544d9306dbSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
16554d9306dbSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16564d9306dbSmrgfi
1657067610f1Smrg
16584d9306dbSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
16594d9306dbSmrg]) # XORG_WITH_LINT
16604d9306dbSmrg
16614d9306dbSmrg# XORG_CHECK_MALLOC_ZERO
16624d9306dbSmrg# ----------------------
16634d9306dbSmrg# Minimum version: 1.0.0
16647e6533d5Smrg#
16654d9306dbSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16664d9306dbSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16674d9306dbSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16684d9306dbSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16694d9306dbSmrgAC_ARG_ENABLE(malloc0returnsnull,
16704d9306dbSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16714d9306dbSmrg		       [malloc(0) returns NULL (default: auto)]),
16724d9306dbSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16734d9306dbSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16747e6533d5Smrg
16754d9306dbSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16764d9306dbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16774d9306dbSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16784d9306dbSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16794d9306dbSmrg#include <stdlib.h>
16804d9306dbSmrg],[
16814d9306dbSmrg    char *m0, *r0, *c0, *p;
16824d9306dbSmrg    m0 = malloc(0);
16834d9306dbSmrg    p = malloc(10);
16844d9306dbSmrg    r0 = realloc(p,0);
16854d9306dbSmrg    c0 = calloc(0,10);
16864d9306dbSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16874d9306dbSmrg])],
16884d9306dbSmrg		[xorg_cv_malloc0_returns_null=yes],
16894d9306dbSmrg		[xorg_cv_malloc0_returns_null=no])])
16904d9306dbSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16914d9306dbSmrgfi
16924d9306dbSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16934d9306dbSmrg
16944d9306dbSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16954d9306dbSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16964d9306dbSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16974d9306dbSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16987e6533d5Smrgelse
16994d9306dbSmrg	MALLOC_ZERO_CFLAGS=""
17004d9306dbSmrg	XMALLOC_ZERO_CFLAGS=""
17014d9306dbSmrg	XTMALLOC_ZERO_CFLAGS=""
17027e6533d5Smrgfi
17037e6533d5Smrg
17044d9306dbSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17054d9306dbSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17064d9306dbSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17074d9306dbSmrg]) # XORG_CHECK_MALLOC_ZERO
17087e6533d5Smrg
17094d9306dbSmrg# XORG_WITH_LINT()
17104d9306dbSmrg# ----------------
17114d9306dbSmrg# Minimum version: 1.1.0
1712067610f1Smrg#
17134d9306dbSmrg# This macro enables the use of a tool that flags some suspicious and
17144d9306dbSmrg# non-portable constructs (likely to be bugs) in C language source code.
17154d9306dbSmrg# It will attempt to locate the tool and use appropriate options.
17164d9306dbSmrg# There are various lint type tools on different platforms.
17174d9306dbSmrg#
17184d9306dbSmrg# Interface to module:
17194d9306dbSmrg# LINT:		returns the path to the tool found on the platform
17204d9306dbSmrg#		or the value set to LINT on the configure cmd line
17214d9306dbSmrg#		also an Automake conditional
17224d9306dbSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
17234d9306dbSmrg#
17244d9306dbSmrg# --with-lint:	'yes' user instructs the module to use lint
17254d9306dbSmrg#		'no' user instructs the module not to use lint (default)
17264d9306dbSmrg#
17274d9306dbSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
17284d9306dbSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
17294d9306dbSmrg#
17304d9306dbSmrgAC_DEFUN([XORG_WITH_LINT],[
1731067610f1Smrg
17324d9306dbSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
17334d9306dbSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
17344d9306dbSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
17354d9306dbSmrg		[Use a lint-style source code checker (default: disabled)])],
17364d9306dbSmrg		[use_lint=$withval], [use_lint=no])
1737067610f1Smrg
17384d9306dbSmrg# Obtain platform specific info like program name and options
17394d9306dbSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
17404d9306dbSmrgcase $host_os in
17414d9306dbSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
17424d9306dbSmrg	lint_name=splint
17434d9306dbSmrg	lint_options="-badflag"
17444d9306dbSmrg	;;
17454d9306dbSmrg  *freebsd* | *netbsd*)
17464d9306dbSmrg	lint_name=lint
17474d9306dbSmrg	lint_options="-u -b"
17484d9306dbSmrg	;;
17494d9306dbSmrg  *solaris*)
17504d9306dbSmrg	lint_name=lint
17514d9306dbSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
17524d9306dbSmrg	;;
17534d9306dbSmrgesac
1754067610f1Smrg
17554d9306dbSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
17564d9306dbSmrgif test "x$use_lint" = x"yes" ; then
17574d9306dbSmrg   AC_PATH_PROG([LINT], [$lint_name])
17584d9306dbSmrg   if test "x$LINT" = "x"; then
17594d9306dbSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
17604d9306dbSmrg   fi
17614d9306dbSmrgelif test "x$use_lint" = x"no" ; then
17624d9306dbSmrg   if test "x$LINT" != "x"; then
17634d9306dbSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17644d9306dbSmrg   fi
1765067610f1Smrgelse
17664d9306dbSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1767067610f1Smrgfi
1768067610f1Smrg
17694d9306dbSmrg# User supplied flags override default flags
17704d9306dbSmrgif test "x$LINT_FLAGS" != "x"; then
17714d9306dbSmrg   lint_options=$LINT_FLAGS
17724d9306dbSmrgfi
1773067610f1Smrg
17744d9306dbSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17754d9306dbSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1776067610f1Smrg
17774d9306dbSmrg]) # XORG_WITH_LINT
1778067610f1Smrg
17794d9306dbSmrg# XORG_LINT_LIBRARY(LIBNAME)
17804d9306dbSmrg# --------------------------
17814d9306dbSmrg# Minimum version: 1.1.0
17824d9306dbSmrg#
17834d9306dbSmrg# Sets up flags for building lint libraries for checking programs that call
17844d9306dbSmrg# functions in the library.
17854d9306dbSmrg#
17864d9306dbSmrg# Interface to module:
17874d9306dbSmrg# LINTLIB		- Automake variable with the name of lint library file to make
17884d9306dbSmrg# MAKE_LINT_LIB		- Automake conditional
17894d9306dbSmrg#
17904d9306dbSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17914d9306dbSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1792067610f1Smrg
17934d9306dbSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17944d9306dbSmrgAC_REQUIRE([XORG_WITH_LINT])
17954d9306dbSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17964d9306dbSmrg	[Create lint library (default: disabled)])],
17974d9306dbSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1798067610f1Smrg
17994d9306dbSmrgif test "x$make_lint_lib" = x"yes" ; then
18004d9306dbSmrg   LINTLIB=llib-l$1.ln
18014d9306dbSmrg   if test "x$LINT" = "x"; then
18024d9306dbSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18034d9306dbSmrg   fi
18044d9306dbSmrgelif test "x$make_lint_lib" != x"no" ; then
18054d9306dbSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18064d9306dbSmrgfi
1807067610f1Smrg
18084d9306dbSmrgAC_SUBST(LINTLIB)
18094d9306dbSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1810067610f1Smrg
18114d9306dbSmrg]) # XORG_LINT_LIBRARY
18124d9306dbSmrg
18134d9306dbSmrg# XORG_COMPILER_BRAND
1814067610f1Smrg# -------------------
18154d9306dbSmrg# Minimum version: 1.14.0
1816067610f1Smrg#
18174d9306dbSmrg# Checks for various brands of compilers and sets flags as appropriate:
18184d9306dbSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18194d9306dbSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18204d9306dbSmrg#   clang compiler - sets CLANGCC to "yes"
18214d9306dbSmrg#   Intel compiler - sets INTELCC to "yes"
18224d9306dbSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18234d9306dbSmrg#
18244d9306dbSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
18254d9306dbSmrgAC_LANG_CASE(
18264d9306dbSmrg	[C], [
18274d9306dbSmrg		AC_REQUIRE([AC_PROG_CC_C99])
18284d9306dbSmrg	],
18294d9306dbSmrg	[C++], [
18304d9306dbSmrg		AC_REQUIRE([AC_PROG_CXX])
18314d9306dbSmrg	]
18324d9306dbSmrg)
18334d9306dbSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
18344d9306dbSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
18354d9306dbSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
18364d9306dbSmrg]) # XORG_COMPILER_BRAND
18377e6533d5Smrg
18384d9306dbSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
18394d9306dbSmrg# ---------------
18404d9306dbSmrg# Minimum version: 1.16.0
18414d9306dbSmrg#
18424d9306dbSmrg# Test if the compiler works when passed the given flag as a command line argument.
18434d9306dbSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
18444d9306dbSmrg# next flag in the list until there are no more options.
18454d9306dbSmrg#
18464d9306dbSmrg# Note that this does not guarantee that the compiler supports the flag as some
18474d9306dbSmrg# compilers will simply ignore arguments that they do not understand, but we do
18484d9306dbSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
18494d9306dbSmrg# -Werror=unused-command-line-argument
18504d9306dbSmrg#
18514d9306dbSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
18524d9306dbSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
18534d9306dbSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854067610f1Smrg
18554d9306dbSmrgAC_LANG_COMPILER_REQUIRE
1856067610f1Smrg
18574d9306dbSmrgAC_LANG_CASE(
18584d9306dbSmrg	[C], [
18594d9306dbSmrg		AC_REQUIRE([AC_PROG_CC_C99])
18604d9306dbSmrg		define([PREFIX], [C])
18614d9306dbSmrg		define([CACHE_PREFIX], [cc])
18624d9306dbSmrg		define([COMPILER], [$CC])
18634d9306dbSmrg	],
18644d9306dbSmrg	[C++], [
18654d9306dbSmrg		define([PREFIX], [CXX])
18664d9306dbSmrg		define([CACHE_PREFIX], [cxx])
18674d9306dbSmrg		define([COMPILER], [$CXX])
18684d9306dbSmrg	]
18694d9306dbSmrg)
1870067610f1Smrg
18714d9306dbSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1872067610f1Smrg
18734d9306dbSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18744d9306dbSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18754d9306dbSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18764d9306dbSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18774d9306dbSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18784d9306dbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18794d9306dbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18804d9306dbSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18814d9306dbSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882067610f1Smrgfi
1883067610f1Smrg
18844d9306dbSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18854d9306dbSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18864d9306dbSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18874d9306dbSmrg	fi
18884d9306dbSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18894d9306dbSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18904d9306dbSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18914d9306dbSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18924d9306dbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18934d9306dbSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18944d9306dbSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18954d9306dbSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1896067610f1Smrgfi
1897067610f1Smrg
18984d9306dbSmrgfound="no"
18994d9306dbSmrgm4_foreach([flag], m4_cdr($@), [
19004d9306dbSmrg	if test $found = "no" ; then
19014d9306dbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19024d9306dbSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19034d9306dbSmrg		fi
1904067610f1Smrg
19054d9306dbSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19064d9306dbSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19074d9306dbSmrg		fi
1908067610f1Smrg
19094d9306dbSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19107e6533d5Smrg
19114d9306dbSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
19124d9306dbSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19134d9306dbSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19144d9306dbSmrg		AC_CACHE_VAL($cacheid,
19154d9306dbSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19164d9306dbSmrg					     [eval $cacheid=yes],
19174d9306dbSmrg					     [eval $cacheid=no])])
19187e6533d5Smrg
19194d9306dbSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19207e6533d5Smrg
19214d9306dbSmrg		eval supported=\$$cacheid
19224d9306dbSmrg		AC_MSG_RESULT([$supported])
19234d9306dbSmrg		if test "$supported" = "yes" ; then
19244d9306dbSmrg			$1="$$1 ]flag["
19254d9306dbSmrg			found="yes"
19264d9306dbSmrg		fi
19274d9306dbSmrg	fi
19284d9306dbSmrg])
19294d9306dbSmrg]) # XORG_TESTSET_CFLAG
19307e6533d5Smrg
19314d9306dbSmrg# XORG_COMPILER_FLAGS
19324d9306dbSmrg# ---------------
19334d9306dbSmrg# Minimum version: 1.16.0
1934aea1d7ffSmrg#
19354d9306dbSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
19364d9306dbSmrg# arguments supported by the selected compiler which do NOT alter the generated
19374d9306dbSmrg# code.  These arguments will cause the compiler to print various warnings
19384d9306dbSmrg# during compilation AND turn a conservative set of warnings into errors.
1939aea1d7ffSmrg#
19404d9306dbSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
19414d9306dbSmrg# future versions of util-macros as options are added to new compilers.
1942aea1d7ffSmrg#
19434d9306dbSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
19444d9306dbSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945aea1d7ffSmrg
19464d9306dbSmrgAC_ARG_ENABLE(selective-werror,
19474d9306dbSmrg              AS_HELP_STRING([--disable-selective-werror],
19484d9306dbSmrg                             [Turn off selective compiler errors. (default: enabled)]),
19494d9306dbSmrg              [SELECTIVE_WERROR=$enableval],
19504d9306dbSmrg              [SELECTIVE_WERROR=yes])
19514d9306dbSmrg
19524d9306dbSmrgAC_LANG_CASE(
19534d9306dbSmrg        [C], [
19544d9306dbSmrg                define([PREFIX], [C])
19554d9306dbSmrg        ],
19564d9306dbSmrg        [C++], [
19574d9306dbSmrg                define([PREFIX], [CXX])
19584d9306dbSmrg        ]
19594d9306dbSmrg)
19604d9306dbSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19614d9306dbSmrgif test "x$SUNCC" = "xyes"; then
19624d9306dbSmrg    [BASE_]PREFIX[FLAGS]="-v"
1963aea1d7ffSmrgelse
19644d9306dbSmrg    [BASE_]PREFIX[FLAGS]=""
1965aea1d7ffSmrgfi
1966aea1d7ffSmrg
19674d9306dbSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19684d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19694d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19704d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19714d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972aea1d7ffSmrg
19734d9306dbSmrgAC_LANG_CASE(
19744d9306dbSmrg	[C], [
19754d9306dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19764d9306dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19774d9306dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19784d9306dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19794d9306dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19804d9306dbSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19814d9306dbSmrg	]
19824d9306dbSmrg)
19834d9306dbSmrg
19844d9306dbSmrg# This chunk adds additional warnings that could catch undesired effects.
19854d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19864d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19874d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19884d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19894d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19904d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19914d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19924d9306dbSmrg
19934d9306dbSmrg# These are currently disabled because they are noisy.  They will be enabled
19944d9306dbSmrg# in the future once the codebase is sufficiently modernized to silence
19954d9306dbSmrg# them.  For now, I don't want them to drown out the other warnings.
19964d9306dbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19974d9306dbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19984d9306dbSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19994d9306dbSmrg
20004d9306dbSmrg# Turn some warnings into errors, so we don't accidently get successful builds
20014d9306dbSmrg# when there are problems that should be fixed.
20024d9306dbSmrg
20034d9306dbSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20044d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20054d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20064d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20074d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20084d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20094d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20104d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20114d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20124d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20134d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20144d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20154d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20164d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
20174d9306dbSmrgelse
20184d9306dbSmrgAC_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])
20194d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20204d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20214d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20224d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20234d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20244d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
20254d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
20264d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
20274d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
20284d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
20294d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
20304d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
20314d9306dbSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
20324d9306dbSmrgfi
20334d9306dbSmrg
20344d9306dbSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20354d9306dbSmrg]) # XORG_COMPILER_FLAGS
20364d9306dbSmrg
20374d9306dbSmrg# XORG_CWARNFLAGS
20384d9306dbSmrg# ---------------
20394d9306dbSmrg# Minimum version: 1.2.0
20404d9306dbSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041aea1d7ffSmrg#
20424d9306dbSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2043aea1d7ffSmrg#
20444d9306dbSmrg# This function is deprecated because it defines -fno-strict-aliasing
20454d9306dbSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
20464d9306dbSmrg# is needed, then it should be added explicitly in the module when
20474d9306dbSmrg# it is updated to use BASE_CFLAGS.
2048aea1d7ffSmrg#
20494d9306dbSmrgAC_DEFUN([XORG_CWARNFLAGS], [
20504d9306dbSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20514d9306dbSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20524d9306dbSmrgAC_LANG_CASE(
20534d9306dbSmrg	[C], [
20544d9306dbSmrg		CWARNFLAGS="$BASE_CFLAGS"
20554d9306dbSmrg		if  test "x$GCC" = xyes ; then
20564d9306dbSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
20574d9306dbSmrg		fi
20584d9306dbSmrg		AC_SUBST(CWARNFLAGS)
20594d9306dbSmrg	]
20604d9306dbSmrg)
20614d9306dbSmrg]) # XORG_CWARNFLAGS
20624d9306dbSmrg
20634d9306dbSmrg# XORG_STRICT_OPTION
20644d9306dbSmrg# -----------------------
20654d9306dbSmrg# Minimum version: 1.3.0
2066aea1d7ffSmrg#
20674d9306dbSmrg# Add configure option to enable strict compilation flags, such as treating
20684d9306dbSmrg# warnings as fatal errors.
20694d9306dbSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20704d9306dbSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071aea1d7ffSmrg#
20724d9306dbSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20734d9306dbSmrg# when strict compilation is unconditionally desired.
20744d9306dbSmrgAC_DEFUN([XORG_STRICT_OPTION], [
20754d9306dbSmrgAC_REQUIRE([XORG_CWARNFLAGS])
20764d9306dbSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077aea1d7ffSmrg
20784d9306dbSmrgAC_ARG_ENABLE(strict-compilation,
20794d9306dbSmrg			  AS_HELP_STRING([--enable-strict-compilation],
20804d9306dbSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20814d9306dbSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082aea1d7ffSmrg
20834d9306dbSmrgAC_LANG_CASE(
20844d9306dbSmrg        [C], [
20854d9306dbSmrg                define([PREFIX], [C])
20864d9306dbSmrg        ],
20874d9306dbSmrg        [C++], [
20884d9306dbSmrg                define([PREFIX], [CXX])
20894d9306dbSmrg        ]
20904d9306dbSmrg)
2091aea1d7ffSmrg
20924d9306dbSmrg[STRICT_]PREFIX[FLAGS]=""
20934d9306dbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20944d9306dbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
20954d9306dbSmrg
20964d9306dbSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20974d9306dbSmrg# activate it with -Werror, so we add it here explicitly.
20984d9306dbSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20994d9306dbSmrg
21004d9306dbSmrgif test "x$STRICT_COMPILE" = "xyes"; then
21014d9306dbSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21024d9306dbSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
21034d9306dbSmrgfi
21044d9306dbSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21054d9306dbSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21064d9306dbSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21074d9306dbSmrg]) # XORG_STRICT_OPTION
21084d9306dbSmrg
21094d9306dbSmrg# XORG_DEFAULT_OPTIONS
21104d9306dbSmrg# --------------------
21114d9306dbSmrg# Minimum version: 1.3.0
21127e6533d5Smrg#
21134d9306dbSmrg# Defines default options for X.Org modules.
21147e6533d5Smrg#
21154d9306dbSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21164d9306dbSmrgAC_REQUIRE([AC_PROG_INSTALL])
21174d9306dbSmrgXORG_COMPILER_FLAGS
21184d9306dbSmrgXORG_CWARNFLAGS
21194d9306dbSmrgXORG_STRICT_OPTION
21204d9306dbSmrgXORG_RELEASE_VERSION
21214d9306dbSmrgXORG_CHANGELOG
21224d9306dbSmrgXORG_INSTALL
21234d9306dbSmrgXORG_MANPAGE_SECTIONS
21244d9306dbSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
21254d9306dbSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
21264d9306dbSmrg]) # XORG_DEFAULT_OPTIONS
21274d9306dbSmrg
21284d9306dbSmrg# XORG_INSTALL()
21294d9306dbSmrg# ----------------
21304d9306dbSmrg# Minimum version: 1.4.0
21317e6533d5Smrg#
21324d9306dbSmrg# Defines the variable INSTALL_CMD as the command to copy
21334d9306dbSmrg# INSTALL from $prefix/share/util-macros.
21347e6533d5Smrg#
21354d9306dbSmrgAC_DEFUN([XORG_INSTALL], [
21364d9306dbSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
21374d9306dbSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
21384d9306dbSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
21394d9306dbSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
21404d9306dbSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
21414d9306dbSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
21424d9306dbSmrgAC_SUBST([INSTALL_CMD])
21434d9306dbSmrg]) # XORG_INSTALL
21444d9306dbSmrgdnl Copyright 2005 Red Hat, Inc
21454d9306dbSmrgdnl
21464d9306dbSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
21474d9306dbSmrgdnl documentation for any purpose is hereby granted without fee, provided that
21484d9306dbSmrgdnl the above copyright notice appear in all copies and that both that
21494d9306dbSmrgdnl copyright notice and this permission notice appear in supporting
21504d9306dbSmrgdnl documentation.
21514d9306dbSmrgdnl
21524d9306dbSmrgdnl The above copyright notice and this permission notice shall be included
21534d9306dbSmrgdnl in all copies or substantial portions of the Software.
21544d9306dbSmrgdnl
21554d9306dbSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21564d9306dbSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21574d9306dbSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21584d9306dbSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
21594d9306dbSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21604d9306dbSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21614d9306dbSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
21624d9306dbSmrgdnl
21634d9306dbSmrgdnl Except as contained in this notice, the name of the copyright holders shall
21644d9306dbSmrgdnl not be used in advertising or otherwise to promote the sale, use or
21654d9306dbSmrgdnl other dealings in this Software without prior written authorization
21664d9306dbSmrgdnl from the copyright holders.
21674d9306dbSmrgdnl
21687e6533d5Smrg
21694d9306dbSmrg# XORG_RELEASE_VERSION
21704d9306dbSmrg# --------------------
21714d9306dbSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
21727e6533d5Smrg
21734d9306dbSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21744d9306dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21754d9306dbSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21764d9306dbSmrg		[Major version of this package])
21774d9306dbSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21784d9306dbSmrg	if test "x$PVM" = "x"; then
21794d9306dbSmrg		PVM="0"
21804d9306dbSmrg	fi
21814d9306dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21824d9306dbSmrg		[$PVM],
21834d9306dbSmrg		[Minor version of this package])
21844d9306dbSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21854d9306dbSmrg	if test "x$PVP" = "x"; then
21864d9306dbSmrg		PVP="0"
21874d9306dbSmrg	fi
21884d9306dbSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21894d9306dbSmrg		[$PVP],
21904d9306dbSmrg		[Patch version of this package])
21914d9306dbSmrg])
21924d9306dbSmrg
21934d9306dbSmrg# XORG_CHANGELOG()
21944d9306dbSmrg# ----------------
21954d9306dbSmrg# Minimum version: 1.2.0
21967e6533d5Smrg#
21974d9306dbSmrg# Defines the variable CHANGELOG_CMD as the command to generate
21984d9306dbSmrg# ChangeLog from git.
21997e6533d5Smrg#
22007e6533d5Smrg#
22014d9306dbSmrgAC_DEFUN([XORG_CHANGELOG], [
22024d9306dbSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
22034d9306dbSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
22044d9306dbSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
22054d9306dbSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
22064d9306dbSmrgAC_SUBST([CHANGELOG_CMD])
22074d9306dbSmrg]) # XORG_CHANGELOG
22084d9306dbSmrg
22094d9306dbSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
22107e6533d5Smrg#
22114d9306dbSmrg# This file is free software; the Free Software Foundation
22124d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
22134d9306dbSmrg# with or without modifications, as long as this notice is preserved.
22147e6533d5Smrg
22154d9306dbSmrg# AM_AUTOMAKE_VERSION(VERSION)
22164d9306dbSmrg# ----------------------------
22174d9306dbSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22184d9306dbSmrg# generated from the m4 files accompanying Automake X.Y.
22194d9306dbSmrg# (This private macro should not be called outside this file.)
22204d9306dbSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22214d9306dbSmrg[am__api_version='1.15'
22224d9306dbSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22234d9306dbSmrgdnl require some minimum version.  Point them to the right macro.
22244d9306dbSmrgm4_if([$1], [1.15], [],
22254d9306dbSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22264d9306dbSmrg])
2227e7fdea5fSmrg
22284d9306dbSmrg# _AM_AUTOCONF_VERSION(VERSION)
22294d9306dbSmrg# -----------------------------
22304d9306dbSmrg# aclocal traces this macro to find the Autoconf version.
22314d9306dbSmrg# This is a private macro too.  Using m4_define simplifies
22324d9306dbSmrg# the logic in aclocal, which can simply ignore this definition.
22334d9306dbSmrgm4_define([_AM_AUTOCONF_VERSION], [])
2234e7fdea5fSmrg
22354d9306dbSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22364d9306dbSmrg# -------------------------------
22374d9306dbSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22384d9306dbSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22394d9306dbSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22404d9306dbSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
22414d9306dbSmrgm4_ifndef([AC_AUTOCONF_VERSION],
22424d9306dbSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22434d9306dbSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
22447e6533d5Smrg
22454d9306dbSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22464d9306dbSmrg
22474d9306dbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
22487e6533d5Smrg#
22494d9306dbSmrg# This file is free software; the Free Software Foundation
22504d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
22514d9306dbSmrg# with or without modifications, as long as this notice is preserved.
22524d9306dbSmrg
22534d9306dbSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22544d9306dbSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22554d9306dbSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
22567e6533d5Smrg#
22574d9306dbSmrg# Of course, Automake must honor this variable whenever it calls a
22584d9306dbSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22594d9306dbSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22604d9306dbSmrg# depending on how configure is run.  This is pretty annoying, since
22614d9306dbSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22624d9306dbSmrg# source directory, any form will work fine, but in subdirectories a
22634d9306dbSmrg# relative path needs to be adjusted first.
22647e6533d5Smrg#
22654d9306dbSmrg# $ac_aux_dir/missing
22664d9306dbSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22674d9306dbSmrg# $top_srcdir/$ac_aux_dir/missing
22684d9306dbSmrg#    fails if $ac_aux_dir is absolute,
22694d9306dbSmrg#    fails when called from a subdirectory in a VPATH build with
22704d9306dbSmrg#          a relative $ac_aux_dir
22717e6533d5Smrg#
22724d9306dbSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22734d9306dbSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
22744d9306dbSmrg# harmless because $srcdir is '.', but things will broke when you
22754d9306dbSmrg# start a VPATH build or use an absolute $srcdir.
22767e6533d5Smrg#
22774d9306dbSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22784d9306dbSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22794d9306dbSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22804d9306dbSmrg# and then we would define $MISSING as
22814d9306dbSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22824d9306dbSmrg# This will work as long as MISSING is not called from configure, because
22834d9306dbSmrg# unfortunately $(top_srcdir) has no meaning in configure.
22844d9306dbSmrg# However there are other variables, like CC, which are often used in
22854d9306dbSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
22867e6533d5Smrg#
22874d9306dbSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
22884d9306dbSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
22894d9306dbSmrg# configured tree to be moved without reconfiguration.
22904d9306dbSmrg
22914d9306dbSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22924d9306dbSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22934d9306dbSmrg# Expand $ac_aux_dir to an absolute path.
22944d9306dbSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
22954d9306dbSmrg])
22964d9306dbSmrg
22974d9306dbSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
22984d9306dbSmrg
22994d9306dbSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
23007e6533d5Smrg#
23014d9306dbSmrg# This file is free software; the Free Software Foundation
23024d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
23034d9306dbSmrg# with or without modifications, as long as this notice is preserved.
23047e6533d5Smrg
23054d9306dbSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23064d9306dbSmrg# -------------------------------------
23074d9306dbSmrg# Define a conditional.
23084d9306dbSmrgAC_DEFUN([AM_CONDITIONAL],
23094d9306dbSmrg[AC_PREREQ([2.52])dnl
23104d9306dbSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23114d9306dbSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23124d9306dbSmrgAC_SUBST([$1_TRUE])dnl
23134d9306dbSmrgAC_SUBST([$1_FALSE])dnl
23144d9306dbSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23154d9306dbSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23164d9306dbSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23174d9306dbSmrgif $2; then
23184d9306dbSmrg  $1_TRUE=
23194d9306dbSmrg  $1_FALSE='#'
23207e6533d5Smrgelse
23214d9306dbSmrg  $1_TRUE='#'
23224d9306dbSmrg  $1_FALSE=
23237e6533d5Smrgfi
23244d9306dbSmrgAC_CONFIG_COMMANDS_PRE(
23254d9306dbSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23264d9306dbSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23274d9306dbSmrgUsually this means the macro was only invoked conditionally.]])
23284d9306dbSmrgfi])])
23297e6533d5Smrg
23304d9306dbSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
23314d9306dbSmrg#
23324d9306dbSmrg# This file is free software; the Free Software Foundation
23334d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
23344d9306dbSmrg# with or without modifications, as long as this notice is preserved.
23354d9306dbSmrg
23364d9306dbSmrg
23374d9306dbSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23384d9306dbSmrg# written in clear, in which case automake, when reading aclocal.m4,
23394d9306dbSmrg# will think it sees a *use*, and therefore will trigger all it's
23404d9306dbSmrg# C support machinery.  Also note that it means that autoscan, seeing
23414d9306dbSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23424d9306dbSmrg
23434d9306dbSmrg
23444d9306dbSmrg# _AM_DEPENDENCIES(NAME)
23454d9306dbSmrg# ----------------------
23464d9306dbSmrg# See how the compiler implements dependency checking.
23474d9306dbSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23484d9306dbSmrg# We try a few techniques and use that to set a single cache variable.
23494d9306dbSmrg#
23504d9306dbSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23514d9306dbSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23524d9306dbSmrg# dependency, and given that the user is not expected to run this macro,
23534d9306dbSmrg# just rely on AC_PROG_CC.
23544d9306dbSmrgAC_DEFUN([_AM_DEPENDENCIES],
23554d9306dbSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23564d9306dbSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23574d9306dbSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23584d9306dbSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
23594d9306dbSmrg
23604d9306dbSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23614d9306dbSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23624d9306dbSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23634d9306dbSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23644d9306dbSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23654d9306dbSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23664d9306dbSmrg                    [depcc="$$1"   am_compiler_list=])
23674d9306dbSmrg
23684d9306dbSmrgAC_CACHE_CHECK([dependency style of $depcc],
23694d9306dbSmrg               [am_cv_$1_dependencies_compiler_type],
23704d9306dbSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23714d9306dbSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
23724d9306dbSmrg  # making bogus files that we don't know about and never remove.  For
23734d9306dbSmrg  # instance it was reported that on HP-UX the gcc test will end up
23744d9306dbSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23754d9306dbSmrg  # in D".
23764d9306dbSmrg  rm -rf conftest.dir
23774d9306dbSmrg  mkdir conftest.dir
23784d9306dbSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23794d9306dbSmrg  # using a relative directory.
23804d9306dbSmrg  cp "$am_depcomp" conftest.dir
23814d9306dbSmrg  cd conftest.dir
23824d9306dbSmrg  # We will build objects and dependencies in a subdirectory because
23834d9306dbSmrg  # it helps to detect inapplicable dependency modes.  For instance
23844d9306dbSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23854d9306dbSmrg  # side effect of compilation, but ICC will put the dependencies in
23864d9306dbSmrg  # the current directory while Tru64 will put them in the object
23874d9306dbSmrg  # directory.
23884d9306dbSmrg  mkdir sub
23894d9306dbSmrg
23904d9306dbSmrg  am_cv_$1_dependencies_compiler_type=none
23914d9306dbSmrg  if test "$am_compiler_list" = ""; then
23924d9306dbSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
23934d9306dbSmrg  fi
23944d9306dbSmrg  am__universal=false
23954d9306dbSmrg  m4_case([$1], [CC],
23964d9306dbSmrg    [case " $depcc " in #(
23974d9306dbSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
23984d9306dbSmrg     esac],
23994d9306dbSmrg    [CXX],
24004d9306dbSmrg    [case " $depcc " in #(
24014d9306dbSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24024d9306dbSmrg     esac])
24034d9306dbSmrg
24044d9306dbSmrg  for depmode in $am_compiler_list; do
24054d9306dbSmrg    # Setup a source with many dependencies, because some compilers
24064d9306dbSmrg    # like to wrap large dependency lists on column 80 (with \), and
24074d9306dbSmrg    # we should not choose a depcomp mode which is confused by this.
24084d9306dbSmrg    #
24094d9306dbSmrg    # We need to recreate these files for each test, as the compiler may
24104d9306dbSmrg    # overwrite some of them when testing with obscure command lines.
24114d9306dbSmrg    # This happens at least with the AIX C compiler.
24124d9306dbSmrg    : > sub/conftest.c
24134d9306dbSmrg    for i in 1 2 3 4 5 6; do
24144d9306dbSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24154d9306dbSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24164d9306dbSmrg      # Solaris 10 /bin/sh.
24174d9306dbSmrg      echo '/* dummy */' > sub/conftst$i.h
24184d9306dbSmrg    done
24194d9306dbSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24204d9306dbSmrg
24214d9306dbSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24224d9306dbSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24234d9306dbSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24244d9306dbSmrg    # versions had trouble with output in subdirs.
24254d9306dbSmrg    am__obj=sub/conftest.${OBJEXT-o}
24264d9306dbSmrg    am__minus_obj="-o $am__obj"
24274d9306dbSmrg    case $depmode in
24284d9306dbSmrg    gcc)
24294d9306dbSmrg      # This depmode causes a compiler race in universal mode.
24304d9306dbSmrg      test "$am__universal" = false || continue
24314d9306dbSmrg      ;;
24324d9306dbSmrg    nosideeffect)
24334d9306dbSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24344d9306dbSmrg      # only be used when explicitly requested.
24354d9306dbSmrg      if test "x$enable_dependency_tracking" = xyes; then
24364d9306dbSmrg	continue
24374d9306dbSmrg      else
24384d9306dbSmrg	break
24394d9306dbSmrg      fi
24404d9306dbSmrg      ;;
24414d9306dbSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24424d9306dbSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
24434d9306dbSmrg      # not run yet.  These depmodes are late enough in the game, and
24444d9306dbSmrg      # so weak that their functioning should not be impacted.
24454d9306dbSmrg      am__obj=conftest.${OBJEXT-o}
24464d9306dbSmrg      am__minus_obj=
24474d9306dbSmrg      ;;
24484d9306dbSmrg    none) break ;;
24494d9306dbSmrg    esac
24504d9306dbSmrg    if depmode=$depmode \
24514d9306dbSmrg       source=sub/conftest.c object=$am__obj \
24524d9306dbSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24534d9306dbSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24544d9306dbSmrg         >/dev/null 2>conftest.err &&
24554d9306dbSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24564d9306dbSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24574d9306dbSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24584d9306dbSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24594d9306dbSmrg      # icc doesn't choke on unknown options, it will just issue warnings
24604d9306dbSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
24614d9306dbSmrg      # that says an option was ignored or not supported.
24624d9306dbSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24634d9306dbSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24644d9306dbSmrg      # The diagnosis changed in icc 8.0:
24654d9306dbSmrg      #   icc: Command line remark: option '-MP' not supported
24664d9306dbSmrg      if (grep 'ignoring option' conftest.err ||
24674d9306dbSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24684d9306dbSmrg        am_cv_$1_dependencies_compiler_type=$depmode
24694d9306dbSmrg        break
24704d9306dbSmrg      fi
24717e6533d5Smrg    fi
24724d9306dbSmrg  done
24737e6533d5Smrg
24744d9306dbSmrg  cd ..
24754d9306dbSmrg  rm -rf conftest.dir
24767e6533d5Smrgelse
24774d9306dbSmrg  am_cv_$1_dependencies_compiler_type=none
24787e6533d5Smrgfi
24794d9306dbSmrg])
24804d9306dbSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24814d9306dbSmrgAM_CONDITIONAL([am__fastdep$1], [
24824d9306dbSmrg  test "x$enable_dependency_tracking" != xno \
24834d9306dbSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24844d9306dbSmrg])
2485aea1d7ffSmrg
2486e7fdea5fSmrg
24874d9306dbSmrg# AM_SET_DEPDIR
24884d9306dbSmrg# -------------
24894d9306dbSmrg# Choose a directory name for dependency files.
24904d9306dbSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
24914d9306dbSmrgAC_DEFUN([AM_SET_DEPDIR],
24924d9306dbSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
24934d9306dbSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
24944d9306dbSmrg])
2495e7fdea5fSmrg
24967e6533d5Smrg
24974d9306dbSmrg# AM_DEP_TRACK
24984d9306dbSmrg# ------------
24994d9306dbSmrgAC_DEFUN([AM_DEP_TRACK],
25004d9306dbSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25014d9306dbSmrgAS_HELP_STRING(
25024d9306dbSmrg  [--enable-dependency-tracking],
25034d9306dbSmrg  [do not reject slow dependency extractors])
25044d9306dbSmrgAS_HELP_STRING(
25054d9306dbSmrg  [--disable-dependency-tracking],
25064d9306dbSmrg  [speeds up one-time build])])
25074d9306dbSmrgif test "x$enable_dependency_tracking" != xno; then
25084d9306dbSmrg  am_depcomp="$ac_aux_dir/depcomp"
25094d9306dbSmrg  AMDEPBACKSLASH='\'
25104d9306dbSmrg  am__nodep='_no'
25117e6533d5Smrgfi
25124d9306dbSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25134d9306dbSmrgAC_SUBST([AMDEPBACKSLASH])dnl
25144d9306dbSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25154d9306dbSmrgAC_SUBST([am__nodep])dnl
25164d9306dbSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25174d9306dbSmrg])
25187e6533d5Smrg
25194d9306dbSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25207e6533d5Smrg
25214d9306dbSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
25227e6533d5Smrg#
25234d9306dbSmrg# This file is free software; the Free Software Foundation
25244d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
25254d9306dbSmrg# with or without modifications, as long as this notice is preserved.
25267e6533d5Smrg
2527aea1d7ffSmrg
25284d9306dbSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25294d9306dbSmrg# ------------------------------
25304d9306dbSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25314d9306dbSmrg[{
25324d9306dbSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
25334d9306dbSmrg  # are listed without --file.  Let's play safe and only enable the eval
25344d9306dbSmrg  # if we detect the quoting.
25354d9306dbSmrg  case $CONFIG_FILES in
25364d9306dbSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
25374d9306dbSmrg  *)   set x $CONFIG_FILES ;;
25384d9306dbSmrg  esac
25394d9306dbSmrg  shift
25404d9306dbSmrg  for mf
25414d9306dbSmrg  do
25424d9306dbSmrg    # Strip MF so we end up with the name of the file.
25434d9306dbSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25444d9306dbSmrg    # Check whether this is an Automake generated Makefile or not.
25454d9306dbSmrg    # We used to match only the files named 'Makefile.in', but
25464d9306dbSmrg    # some people rename them; so instead we look at the file content.
25474d9306dbSmrg    # Grep'ing the first line is not enough: some people post-process
25484d9306dbSmrg    # each Makefile.in and add a new line on top of each file to say so.
25494d9306dbSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
25504d9306dbSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
25514d9306dbSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25524d9306dbSmrg      dirpart=`AS_DIRNAME("$mf")`
25534d9306dbSmrg    else
25544d9306dbSmrg      continue
25554d9306dbSmrg    fi
25564d9306dbSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
25574d9306dbSmrg    # from the Makefile without running 'make'.
25584d9306dbSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25594d9306dbSmrg    test -z "$DEPDIR" && continue
25604d9306dbSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25614d9306dbSmrg    test -z "$am__include" && continue
25624d9306dbSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25634d9306dbSmrg    # Find all dependency output files, they are included files with
25644d9306dbSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25654d9306dbSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25664d9306dbSmrg    # expansion.
25674d9306dbSmrg    for file in `sed -n "
25684d9306dbSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25694d9306dbSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25704d9306dbSmrg      # Make sure the directory exists.
25714d9306dbSmrg      test -f "$dirpart/$file" && continue
25724d9306dbSmrg      fdir=`AS_DIRNAME(["$file"])`
25734d9306dbSmrg      AS_MKDIR_P([$dirpart/$fdir])
25744d9306dbSmrg      # echo "creating $dirpart/$file"
25754d9306dbSmrg      echo '# dummy' > "$dirpart/$file"
25764d9306dbSmrg    done
25774d9306dbSmrg  done
25784d9306dbSmrg}
25794d9306dbSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2580aea1d7ffSmrg
25814d9306dbSmrg
25824d9306dbSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25834d9306dbSmrg# -----------------------------
25844d9306dbSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2585aea1d7ffSmrg#
25864d9306dbSmrg# This code is only required when automatic dependency tracking
25874d9306dbSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
25884d9306dbSmrg# need in order to bootstrap the dependency handling code.
25894d9306dbSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
25904d9306dbSmrg[AC_CONFIG_COMMANDS([depfiles],
25914d9306dbSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
25924d9306dbSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
25934d9306dbSmrg])
2594aea1d7ffSmrg
25954d9306dbSmrg# Do all the work for Automake.                             -*- Autoconf -*-
2596aea1d7ffSmrg
25974d9306dbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
25984d9306dbSmrg#
25994d9306dbSmrg# This file is free software; the Free Software Foundation
26004d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
26014d9306dbSmrg# with or without modifications, as long as this notice is preserved.
2602aea1d7ffSmrg
26034d9306dbSmrg# This macro actually does too much.  Some checks are only needed if
26044d9306dbSmrg# your package does certain things.  But this isn't really a big deal.
26054d9306dbSmrg
26064d9306dbSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26074d9306dbSmrgm4_define([AC_PROG_CC],
26084d9306dbSmrgm4_defn([AC_PROG_CC])
26094d9306dbSmrg[_AM_PROG_CC_C_O
26104d9306dbSmrg])
2611aea1d7ffSmrg
26124d9306dbSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26134d9306dbSmrg# AM_INIT_AUTOMAKE([OPTIONS])
26144d9306dbSmrg# -----------------------------------------------
26154d9306dbSmrg# The call with PACKAGE and VERSION arguments is the old style
26164d9306dbSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26174d9306dbSmrg# and VERSION should now be passed to AC_INIT and removed from
26184d9306dbSmrg# the call to AM_INIT_AUTOMAKE.
26194d9306dbSmrg# We support both call styles for the transition.  After
26204d9306dbSmrg# the next Automake release, Autoconf can make the AC_INIT
26214d9306dbSmrg# arguments mandatory, and then we can depend on a new Autoconf
26224d9306dbSmrg# release and drop the old call support.
26234d9306dbSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26244d9306dbSmrg[AC_PREREQ([2.65])dnl
26254d9306dbSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26264d9306dbSmrgdnl the ones we care about.
26274d9306dbSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26284d9306dbSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26294d9306dbSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26304d9306dbSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26314d9306dbSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26324d9306dbSmrg  # is not polluted with repeated "-I."
26334d9306dbSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26344d9306dbSmrg  # test to see if srcdir already configured
26354d9306dbSmrg  if test -f $srcdir/config.status; then
26364d9306dbSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637aea1d7ffSmrg  fi
2638aea1d7ffSmrgfi
2639aea1d7ffSmrg
26404d9306dbSmrg# test whether we have cygpath
26414d9306dbSmrgif test -z "$CYGPATH_W"; then
26424d9306dbSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26434d9306dbSmrg    CYGPATH_W='cygpath -w'
26444d9306dbSmrg  else
26454d9306dbSmrg    CYGPATH_W=echo
2646aea1d7ffSmrg  fi
2647aea1d7ffSmrgfi
26484d9306dbSmrgAC_SUBST([CYGPATH_W])
2649aea1d7ffSmrg
26504d9306dbSmrg# Define the identity of the package.
26514d9306dbSmrgdnl Distinguish between old-style and new-style calls.
26524d9306dbSmrgm4_ifval([$2],
26534d9306dbSmrg[AC_DIAGNOSE([obsolete],
26544d9306dbSmrg             [$0: two- and three-arguments forms are deprecated.])
26554d9306dbSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26564d9306dbSmrg AC_SUBST([PACKAGE], [$1])dnl
26574d9306dbSmrg AC_SUBST([VERSION], [$2])],
26584d9306dbSmrg[_AM_SET_OPTIONS([$1])dnl
26594d9306dbSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26604d9306dbSmrgm4_if(
26614d9306dbSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26624d9306dbSmrg  [ok:ok],,
26634d9306dbSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26644d9306dbSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26654d9306dbSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666aea1d7ffSmrg
26674d9306dbSmrg_AM_IF_OPTION([no-define],,
26684d9306dbSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26694d9306dbSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670aea1d7ffSmrg
26714d9306dbSmrg# Some tools Automake needs.
26724d9306dbSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26734d9306dbSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26744d9306dbSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26754d9306dbSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26764d9306dbSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26774d9306dbSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26784d9306dbSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26794d9306dbSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26804d9306dbSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26814d9306dbSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26824d9306dbSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
26834d9306dbSmrg# dies out for good.  For more background, see:
26844d9306dbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26854d9306dbSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26864d9306dbSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26874d9306dbSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
26884d9306dbSmrg# system "awk" is bad on some platforms.
26894d9306dbSmrgAC_REQUIRE([AC_PROG_AWK])dnl
26904d9306dbSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
26914d9306dbSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
26924d9306dbSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
26934d9306dbSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
26944d9306dbSmrg			     [_AM_PROG_TAR([v7])])])
26954d9306dbSmrg_AM_IF_OPTION([no-dependencies],,
26964d9306dbSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
26974d9306dbSmrg		  [_AM_DEPENDENCIES([CC])],
26984d9306dbSmrg		  [m4_define([AC_PROG_CC],
26994d9306dbSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27004d9306dbSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27014d9306dbSmrg		  [_AM_DEPENDENCIES([CXX])],
27024d9306dbSmrg		  [m4_define([AC_PROG_CXX],
27034d9306dbSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27044d9306dbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27054d9306dbSmrg		  [_AM_DEPENDENCIES([OBJC])],
27064d9306dbSmrg		  [m4_define([AC_PROG_OBJC],
27074d9306dbSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27084d9306dbSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27094d9306dbSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
27104d9306dbSmrg		  [m4_define([AC_PROG_OBJCXX],
27114d9306dbSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27124d9306dbSmrg])
27134d9306dbSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27144d9306dbSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
27154d9306dbSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27164d9306dbSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27174d9306dbSmrgAC_CONFIG_COMMANDS_PRE(dnl
27184d9306dbSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27194d9306dbSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720aea1d7ffSmrg
27214d9306dbSmrg# POSIX will say in a future version that running "rm -f" with no argument
27224d9306dbSmrg# is OK; and we want to be able to make that assumption in our Makefile
27234d9306dbSmrg# recipes.  So use an aggressive probe to check that the usage we want is
27244d9306dbSmrg# actually supported "in the wild" to an acceptable degree.
27254d9306dbSmrg# See automake bug#10828.
27264d9306dbSmrg# To make any issue more visible, cause the running configure to be aborted
27274d9306dbSmrg# by default if the 'rm' program in use doesn't match our expectations; the
27284d9306dbSmrg# user can still override this though.
27294d9306dbSmrgif rm -f && rm -fr && rm -rf; then : OK; else
27304d9306dbSmrg  cat >&2 <<'END'
27314d9306dbSmrgOops!
2732aea1d7ffSmrg
27334d9306dbSmrgYour 'rm' program seems unable to run without file operands specified
27344d9306dbSmrgon the command line, even when the '-f' option is present.  This is contrary
27354d9306dbSmrgto the behaviour of most rm programs out there, and not conforming with
27364d9306dbSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737aea1d7ffSmrg
27384d9306dbSmrgPlease tell bug-automake@gnu.org about your system, including the value
27394d9306dbSmrgof your $PATH and any error possibly output before this message.  This
27404d9306dbSmrgcan help us improve future automake versions.
2741aea1d7ffSmrg
27424d9306dbSmrgEND
27434d9306dbSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
27444d9306dbSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
27454d9306dbSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
27464d9306dbSmrg    echo >&2
27474d9306dbSmrg  else
27484d9306dbSmrg    cat >&2 <<'END'
27494d9306dbSmrgAborting the configuration process, to ensure you take notice of the issue.
2750067610f1Smrg
27514d9306dbSmrgYou can download and install GNU coreutils to get an 'rm' implementation
27524d9306dbSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753067610f1Smrg
27544d9306dbSmrgIf you want to complete the configuration process using your problematic
27554d9306dbSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
27564d9306dbSmrgto "yes", and re-run configure.
27574d9306dbSmrg
27584d9306dbSmrgEND
27594d9306dbSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
27604d9306dbSmrg  fi
2761067610f1Smrgfi
27624d9306dbSmrgdnl The trailing newline in this macro's definition is deliberate, for
27634d9306dbSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
27644d9306dbSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
27654d9306dbSmrg])
2766067610f1Smrg
27674d9306dbSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27684d9306dbSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27694d9306dbSmrgdnl mangled by Autoconf and run in a shell conditional statement.
27704d9306dbSmrgm4_define([_AC_COMPILER_EXEEXT],
27714d9306dbSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2772067610f1Smrg
27734d9306dbSmrg# When config.status generates a header, we must update the stamp-h file.
27744d9306dbSmrg# This file resides in the same directory as the config header
27754d9306dbSmrg# that is generated.  The stamp files are numbered to have different names.
2776067610f1Smrg
27774d9306dbSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27784d9306dbSmrg# loop where config.status creates the headers, so we can generate
27794d9306dbSmrg# our stamp files there.
27804d9306dbSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27814d9306dbSmrg[# Compute $1's index in $config_headers.
27824d9306dbSmrg_am_arg=$1
27834d9306dbSmrg_am_stamp_count=1
27844d9306dbSmrgfor _am_header in $config_headers :; do
27854d9306dbSmrg  case $_am_header in
27864d9306dbSmrg    $_am_arg | $_am_arg:* )
27874d9306dbSmrg      break ;;
27884d9306dbSmrg    * )
27894d9306dbSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27904d9306dbSmrg  esac
27914d9306dbSmrgdone
27924d9306dbSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
27937e6533d5Smrg
27944d9306dbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27954d9306dbSmrg#
27964d9306dbSmrg# This file is free software; the Free Software Foundation
27974d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
27984d9306dbSmrg# with or without modifications, as long as this notice is preserved.
27997e6533d5Smrg
28004d9306dbSmrg# AM_PROG_INSTALL_SH
28014d9306dbSmrg# ------------------
28024d9306dbSmrg# Define $install_sh.
28034d9306dbSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28044d9306dbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
28054d9306dbSmrgif test x"${install_sh+set}" != xset; then
28064d9306dbSmrg  case $am_aux_dir in
28074d9306dbSmrg  *\ * | *\	*)
28084d9306dbSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28094d9306dbSmrg  *)
28104d9306dbSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28114d9306dbSmrg  esac
2812067610f1Smrgfi
28134d9306dbSmrgAC_SUBST([install_sh])])
28147e6533d5Smrg
28154d9306dbSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
28164d9306dbSmrg#
28174d9306dbSmrg# This file is free software; the Free Software Foundation
28184d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
28194d9306dbSmrg# with or without modifications, as long as this notice is preserved.
2820067610f1Smrg
28214d9306dbSmrg# Check whether the underlying file-system supports filenames
28224d9306dbSmrg# with a leading dot.  For instance MS-DOS doesn't.
28234d9306dbSmrgAC_DEFUN([AM_SET_LEADING_DOT],
28244d9306dbSmrg[rm -rf .tst 2>/dev/null
28254d9306dbSmrgmkdir .tst 2>/dev/null
28264d9306dbSmrgif test -d .tst; then
28274d9306dbSmrg  am__leading_dot=.
28284d9306dbSmrgelse
28294d9306dbSmrg  am__leading_dot=_
28304d9306dbSmrgfi
28314d9306dbSmrgrmdir .tst 2>/dev/null
28324d9306dbSmrgAC_SUBST([am__leading_dot])])
2833067610f1Smrg
28344d9306dbSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2835067610f1Smrg
28364d9306dbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
28377e6533d5Smrg#
28384d9306dbSmrg# This file is free software; the Free Software Foundation
28394d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
28404d9306dbSmrg# with or without modifications, as long as this notice is preserved.
28417e6533d5Smrg
28424d9306dbSmrg# AM_MAKE_INCLUDE()
28434d9306dbSmrg# -----------------
28444d9306dbSmrg# Check to see how make treats includes.
28454d9306dbSmrgAC_DEFUN([AM_MAKE_INCLUDE],
28464d9306dbSmrg[am_make=${MAKE-make}
28474d9306dbSmrgcat > confinc << 'END'
28484d9306dbSmrgam__doit:
28494d9306dbSmrg	@echo this is the am__doit target
28504d9306dbSmrg.PHONY: am__doit
28514d9306dbSmrgEND
28524d9306dbSmrg# If we don't find an include directive, just comment out the code.
28534d9306dbSmrgAC_MSG_CHECKING([for style of include used by $am_make])
28544d9306dbSmrgam__include="#"
28554d9306dbSmrgam__quote=
28564d9306dbSmrg_am_result=none
28574d9306dbSmrg# First try GNU make style include.
28584d9306dbSmrgecho "include confinc" > confmf
28594d9306dbSmrg# Ignore all kinds of additional output from 'make'.
28604d9306dbSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28614d9306dbSmrg*the\ am__doit\ target*)
28624d9306dbSmrg  am__include=include
28634d9306dbSmrg  am__quote=
28644d9306dbSmrg  _am_result=GNU
28654d9306dbSmrg  ;;
28664d9306dbSmrgesac
28674d9306dbSmrg# Now try BSD make style include.
28684d9306dbSmrgif test "$am__include" = "#"; then
28694d9306dbSmrg   echo '.include "confinc"' > confmf
28704d9306dbSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28714d9306dbSmrg   *the\ am__doit\ target*)
28724d9306dbSmrg     am__include=.include
28734d9306dbSmrg     am__quote="\""
28744d9306dbSmrg     _am_result=BSD
28754d9306dbSmrg     ;;
28764d9306dbSmrg   esac
2877067610f1Smrgfi
28784d9306dbSmrgAC_SUBST([am__include])
28794d9306dbSmrgAC_SUBST([am__quote])
28804d9306dbSmrgAC_MSG_RESULT([$_am_result])
28814d9306dbSmrgrm -f confinc confmf
28824d9306dbSmrg])
28837e6533d5Smrg
28844d9306dbSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885aea1d7ffSmrg
28864d9306dbSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887aea1d7ffSmrg#
28884d9306dbSmrg# This file is free software; the Free Software Foundation
28894d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
28904d9306dbSmrg# with or without modifications, as long as this notice is preserved.
2891aea1d7ffSmrg
28924d9306dbSmrg# AM_MISSING_PROG(NAME, PROGRAM)
28934d9306dbSmrg# ------------------------------
28944d9306dbSmrgAC_DEFUN([AM_MISSING_PROG],
28954d9306dbSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
28964d9306dbSmrg$1=${$1-"${am_missing_run}$2"}
28974d9306dbSmrgAC_SUBST($1)])
2898aea1d7ffSmrg
28994d9306dbSmrg# AM_MISSING_HAS_RUN
29004d9306dbSmrg# ------------------
29014d9306dbSmrg# Define MISSING if not defined so far and test if it is modern enough.
29024d9306dbSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29034d9306dbSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29044d9306dbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29054d9306dbSmrgAC_REQUIRE_AUX_FILE([missing])dnl
29064d9306dbSmrgif test x"${MISSING+set}" != xset; then
29074d9306dbSmrg  case $am_aux_dir in
29084d9306dbSmrg  *\ * | *\	*)
29094d9306dbSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29104d9306dbSmrg  *)
29114d9306dbSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29124d9306dbSmrg  esac
2913aea1d7ffSmrgfi
29144d9306dbSmrg# Use eval to expand $SHELL
29154d9306dbSmrgif eval "$MISSING --is-lightweight"; then
29164d9306dbSmrg  am_missing_run="$MISSING "
29174d9306dbSmrgelse
29184d9306dbSmrg  am_missing_run=
29194d9306dbSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2920aea1d7ffSmrgfi
29214d9306dbSmrg])
2922aea1d7ffSmrg
29234d9306dbSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2924aea1d7ffSmrg
29254d9306dbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29264d9306dbSmrg#
29274d9306dbSmrg# This file is free software; the Free Software Foundation
29284d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
29294d9306dbSmrg# with or without modifications, as long as this notice is preserved.
2930aea1d7ffSmrg
29314d9306dbSmrg# _AM_MANGLE_OPTION(NAME)
29324d9306dbSmrg# -----------------------
29334d9306dbSmrgAC_DEFUN([_AM_MANGLE_OPTION],
29344d9306dbSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935aea1d7ffSmrg
29364d9306dbSmrg# _AM_SET_OPTION(NAME)
29374d9306dbSmrg# --------------------
29384d9306dbSmrg# Set option NAME.  Presently that only means defining a flag for this option.
29394d9306dbSmrgAC_DEFUN([_AM_SET_OPTION],
29404d9306dbSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941aea1d7ffSmrg
29424d9306dbSmrg# _AM_SET_OPTIONS(OPTIONS)
29434d9306dbSmrg# ------------------------
29444d9306dbSmrg# OPTIONS is a space-separated list of Automake options.
29454d9306dbSmrgAC_DEFUN([_AM_SET_OPTIONS],
29464d9306dbSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947aea1d7ffSmrg
29484d9306dbSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29494d9306dbSmrg# -------------------------------------------
29504d9306dbSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29514d9306dbSmrgAC_DEFUN([_AM_IF_OPTION],
29524d9306dbSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953aea1d7ffSmrg
29544d9306dbSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955aea1d7ffSmrg#
29564d9306dbSmrg# This file is free software; the Free Software Foundation
29574d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
29584d9306dbSmrg# with or without modifications, as long as this notice is preserved.
2959aea1d7ffSmrg
29604d9306dbSmrg# _AM_PROG_CC_C_O
29614d9306dbSmrg# ---------------
29624d9306dbSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
29634d9306dbSmrg# to automatically call this.
29644d9306dbSmrgAC_DEFUN([_AM_PROG_CC_C_O],
29654d9306dbSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29664d9306dbSmrgAC_REQUIRE_AUX_FILE([compile])dnl
29674d9306dbSmrgAC_LANG_PUSH([C])dnl
29684d9306dbSmrgAC_CACHE_CHECK(
29694d9306dbSmrg  [whether $CC understands -c and -o together],
29704d9306dbSmrg  [am_cv_prog_cc_c_o],
29714d9306dbSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
29724d9306dbSmrg  # Make sure it works both with $CC and with simple cc.
29734d9306dbSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
29744d9306dbSmrg  # compilers refuse to overwrite an existing .o file with -o,
29754d9306dbSmrg  # though they will create one.
29764d9306dbSmrg  am_cv_prog_cc_c_o=yes
29774d9306dbSmrg  for am_i in 1 2; do
29784d9306dbSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
29794d9306dbSmrg         && test -f conftest2.$ac_objext; then
29804d9306dbSmrg      : OK
29814d9306dbSmrg    else
29824d9306dbSmrg      am_cv_prog_cc_c_o=no
29834d9306dbSmrg      break
29844d9306dbSmrg    fi
29854d9306dbSmrg  done
29864d9306dbSmrg  rm -f core conftest*
29874d9306dbSmrg  unset am_i])
29884d9306dbSmrgif test "$am_cv_prog_cc_c_o" != yes; then
29894d9306dbSmrg   # Losing compiler, so override with the script.
29904d9306dbSmrg   # FIXME: It is wrong to rewrite CC.
29914d9306dbSmrg   # But if we don't then we get into trouble of one sort or another.
29924d9306dbSmrg   # A longer-term fix would be to have automake use am__CC in this case,
29934d9306dbSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
29944d9306dbSmrg   CC="$am_aux_dir/compile $CC"
2995aea1d7ffSmrgfi
29964d9306dbSmrgAC_LANG_POP([C])])
2997aea1d7ffSmrg
29984d9306dbSmrg# For backward compatibility.
29994d9306dbSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30004d9306dbSmrg
30014d9306dbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30024d9306dbSmrg#
30034d9306dbSmrg# This file is free software; the Free Software Foundation
30044d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
30054d9306dbSmrg# with or without modifications, as long as this notice is preserved.
30064d9306dbSmrg
30074d9306dbSmrg# AM_RUN_LOG(COMMAND)
30084d9306dbSmrg# -------------------
30094d9306dbSmrg# Run COMMAND, save the exit status in ac_status, and log it.
30104d9306dbSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30114d9306dbSmrgAC_DEFUN([AM_RUN_LOG],
30124d9306dbSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30134d9306dbSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30144d9306dbSmrg   ac_status=$?
30154d9306dbSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30164d9306dbSmrg   (exit $ac_status); }])
3017aea1d7ffSmrg
30184d9306dbSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019aea1d7ffSmrg
30204d9306dbSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
30214d9306dbSmrg#
30224d9306dbSmrg# This file is free software; the Free Software Foundation
30234d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
30244d9306dbSmrg# with or without modifications, as long as this notice is preserved.
3025aea1d7ffSmrg
30264d9306dbSmrg# AM_SANITY_CHECK
30274d9306dbSmrg# ---------------
30284d9306dbSmrgAC_DEFUN([AM_SANITY_CHECK],
30294d9306dbSmrg[AC_MSG_CHECKING([whether build environment is sane])
30304d9306dbSmrg# Reject unsafe characters in $srcdir or the absolute working directory
30314d9306dbSmrg# name.  Accept space and tab only in the latter.
30324d9306dbSmrgam_lf='
30334d9306dbSmrg'
30344d9306dbSmrgcase `pwd` in
30354d9306dbSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30364d9306dbSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30374d9306dbSmrgesac
30384d9306dbSmrgcase $srcdir in
30394d9306dbSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
30404d9306dbSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
30414d9306dbSmrgesac
3042aea1d7ffSmrg
30434d9306dbSmrg# Do 'set' in a subshell so we don't clobber the current shell's
30444d9306dbSmrg# arguments.  Must try -L first in case configure is actually a
30454d9306dbSmrg# symlink; some systems play weird games with the mod time of symlinks
30464d9306dbSmrg# (eg FreeBSD returns the mod time of the symlink's containing
30474d9306dbSmrg# directory).
30484d9306dbSmrgif (
30494d9306dbSmrg   am_has_slept=no
30504d9306dbSmrg   for am_try in 1 2; do
30514d9306dbSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30524d9306dbSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30534d9306dbSmrg     if test "$[*]" = "X"; then
30544d9306dbSmrg	# -L didn't work.
30554d9306dbSmrg	set X `ls -t "$srcdir/configure" conftest.file`
30564d9306dbSmrg     fi
30574d9306dbSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30584d9306dbSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059aea1d7ffSmrg
30604d9306dbSmrg	# If neither matched, then we have a broken ls.  This can happen
30614d9306dbSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30624d9306dbSmrg	# broken ls alias from the environment.  This has actually
30634d9306dbSmrg	# happened.  Such a system could not be considered "sane".
30644d9306dbSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30654d9306dbSmrg  alias in your environment])
30664d9306dbSmrg     fi
30674d9306dbSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30684d9306dbSmrg       break
30694d9306dbSmrg     fi
30704d9306dbSmrg     # Just in case.
30714d9306dbSmrg     sleep 1
30724d9306dbSmrg     am_has_slept=yes
30734d9306dbSmrg   done
30744d9306dbSmrg   test "$[2]" = conftest.file
30754d9306dbSmrg   )
30764d9306dbSmrgthen
30774d9306dbSmrg   # Ok.
30784d9306dbSmrg   :
3079aea1d7ffSmrgelse
30804d9306dbSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
30814d9306dbSmrgCheck your system clock])
3082aea1d7ffSmrgfi
30834d9306dbSmrgAC_MSG_RESULT([yes])
30844d9306dbSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30854d9306dbSmrg# generated files are strictly newer.
30864d9306dbSmrgam_sleep_pid=
30874d9306dbSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30884d9306dbSmrg  ( sleep 1 ) &
30894d9306dbSmrg  am_sleep_pid=$!
30904d9306dbSmrgfi
30914d9306dbSmrgAC_CONFIG_COMMANDS_PRE(
30924d9306dbSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30934d9306dbSmrg   if test -n "$am_sleep_pid"; then
30944d9306dbSmrg     # Hide warnings about reused PIDs.
30954d9306dbSmrg     wait $am_sleep_pid 2>/dev/null
30964d9306dbSmrg   fi
30974d9306dbSmrg   AC_MSG_RESULT([done])])
30984d9306dbSmrgrm -f conftest.file
30994d9306dbSmrg])
3100aea1d7ffSmrg
31014d9306dbSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
31027e6533d5Smrg#
31034d9306dbSmrg# This file is free software; the Free Software Foundation
31044d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
31054d9306dbSmrg# with or without modifications, as long as this notice is preserved.
31067e6533d5Smrg
31074d9306dbSmrg# AM_SILENT_RULES([DEFAULT])
31084d9306dbSmrg# --------------------------
31094d9306dbSmrg# Enable less verbose build rules; with the default set to DEFAULT
31104d9306dbSmrg# ("yes" being less verbose, "no" or empty being verbose).
31114d9306dbSmrgAC_DEFUN([AM_SILENT_RULES],
31124d9306dbSmrg[AC_ARG_ENABLE([silent-rules], [dnl
31134d9306dbSmrgAS_HELP_STRING(
31144d9306dbSmrg  [--enable-silent-rules],
31154d9306dbSmrg  [less verbose build output (undo: "make V=1")])
31164d9306dbSmrgAS_HELP_STRING(
31174d9306dbSmrg  [--disable-silent-rules],
31184d9306dbSmrg  [verbose build output (undo: "make V=0")])dnl
31194d9306dbSmrg])
31204d9306dbSmrgcase $enable_silent_rules in @%:@ (((
31214d9306dbSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
31224d9306dbSmrg   no) AM_DEFAULT_VERBOSITY=1;;
31234d9306dbSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31244d9306dbSmrgesac
31254d9306dbSmrgdnl
31264d9306dbSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31274d9306dbSmrgdnl do not support nested variable expansions.
31284d9306dbSmrgdnl See automake bug#9928 and bug#10237.
31294d9306dbSmrgam_make=${MAKE-make}
31304d9306dbSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31314d9306dbSmrg   [am_cv_make_support_nested_variables],
31324d9306dbSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31334d9306dbSmrgBAR0=false
31344d9306dbSmrgBAR1=true
31354d9306dbSmrgV=1
31364d9306dbSmrgam__doit:
31374d9306dbSmrg	@$(TRUE)
31384d9306dbSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31394d9306dbSmrg  am_cv_make_support_nested_variables=yes
31404d9306dbSmrgelse
31414d9306dbSmrg  am_cv_make_support_nested_variables=no
31424d9306dbSmrgfi])
31434d9306dbSmrgif test $am_cv_make_support_nested_variables = yes; then
31444d9306dbSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31454d9306dbSmrg  AM_V='$(V)'
31464d9306dbSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31474d9306dbSmrgelse
31484d9306dbSmrg  AM_V=$AM_DEFAULT_VERBOSITY
31494d9306dbSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31504d9306dbSmrgfi
31514d9306dbSmrgAC_SUBST([AM_V])dnl
31524d9306dbSmrgAM_SUBST_NOTMAKE([AM_V])dnl
31534d9306dbSmrgAC_SUBST([AM_DEFAULT_V])dnl
31544d9306dbSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31554d9306dbSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31564d9306dbSmrgAM_BACKSLASH='\'
31574d9306dbSmrgAC_SUBST([AM_BACKSLASH])dnl
31584d9306dbSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31594d9306dbSmrg])
31604d9306dbSmrg
31614d9306dbSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162aea1d7ffSmrg#
31634d9306dbSmrg# This file is free software; the Free Software Foundation
31644d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
31654d9306dbSmrg# with or without modifications, as long as this notice is preserved.
31664d9306dbSmrg
31674d9306dbSmrg# AM_PROG_INSTALL_STRIP
31684d9306dbSmrg# ---------------------
31694d9306dbSmrg# One issue with vendor 'install' (even GNU) is that you can't
31704d9306dbSmrg# specify the program used to strip binaries.  This is especially
31714d9306dbSmrg# annoying in cross-compiling environments, where the build's strip
31724d9306dbSmrg# is unlikely to handle the host's binaries.
31734d9306dbSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31744d9306dbSmrg# always use install-sh in "make install-strip", and initialize
31754d9306dbSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
31764d9306dbSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31774d9306dbSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31784d9306dbSmrg# Installed binaries are usually stripped using 'strip' when the user
31794d9306dbSmrg# run "make install-strip".  However 'strip' might not be the right
31804d9306dbSmrg# tool to use in cross-compilation environments, therefore Automake
31814d9306dbSmrg# will honor the 'STRIP' environment variable to overrule this program.
31824d9306dbSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31834d9306dbSmrgif test "$cross_compiling" != no; then
31844d9306dbSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
31854d9306dbSmrgfi
31864d9306dbSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31874d9306dbSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31887e6533d5Smrg
31894d9306dbSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
31904d9306dbSmrg#
31914d9306dbSmrg# This file is free software; the Free Software Foundation
31924d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
31934d9306dbSmrg# with or without modifications, as long as this notice is preserved.
3194aea1d7ffSmrg
31954d9306dbSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
31964d9306dbSmrg# ---------------------------
31974d9306dbSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31984d9306dbSmrg# This macro is traced by Automake.
31994d9306dbSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200aea1d7ffSmrg
32014d9306dbSmrg# AM_SUBST_NOTMAKE(VARIABLE)
32024d9306dbSmrg# --------------------------
32034d9306dbSmrg# Public sister of _AM_SUBST_NOTMAKE.
32044d9306dbSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205aea1d7ffSmrg
32064d9306dbSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3207aea1d7ffSmrg
32084d9306dbSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
32094d9306dbSmrg#
32104d9306dbSmrg# This file is free software; the Free Software Foundation
32114d9306dbSmrg# gives unlimited permission to copy and/or distribute it,
32124d9306dbSmrg# with or without modifications, as long as this notice is preserved.
32137e6533d5Smrg
32144d9306dbSmrg# _AM_PROG_TAR(FORMAT)
32157e6533d5Smrg# --------------------
32164d9306dbSmrg# Check how to create a tarball in format FORMAT.
32174d9306dbSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32187e6533d5Smrg#
32194d9306dbSmrg# Substitute a variable $(am__tar) that is a command
32204d9306dbSmrg# writing to stdout a FORMAT-tarball containing the directory
32214d9306dbSmrg# $tardir.
32224d9306dbSmrg#     tardir=directory && $(am__tar) > result.tar
32237e6533d5Smrg#
32244d9306dbSmrg# Substitute a variable $(am__untar) that extract such
32254d9306dbSmrg# a tarball read from stdin.
32264d9306dbSmrg#     $(am__untar) < result.tar
32277e6533d5Smrg#
32284d9306dbSmrgAC_DEFUN([_AM_PROG_TAR],
32294d9306dbSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32304d9306dbSmrg# in the wild :-(  We should find a proper way to deprecate it ...
32314d9306dbSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3232067610f1Smrg
32334d9306dbSmrg# We'll loop over all known methods to create a tar archive until one works.
32344d9306dbSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235e7fdea5fSmrg
32364d9306dbSmrgm4_if([$1], [v7],
32374d9306dbSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3238067610f1Smrg
32394d9306dbSmrg  [m4_case([$1],
32404d9306dbSmrg    [ustar],
32414d9306dbSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
32424d9306dbSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
32434d9306dbSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
32444d9306dbSmrg      # and bug#13588).
32454d9306dbSmrg      am_max_uid=2097151 # 2^21 - 1
32464d9306dbSmrg      am_max_gid=$am_max_uid
32474d9306dbSmrg      # The $UID and $GID variables are not portable, so we need to resort
32484d9306dbSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
32494d9306dbSmrg      # below are definitely unexpected, so allow the users to see them
32504d9306dbSmrg      # (that is, avoid stderr redirection).
32514d9306dbSmrg      am_uid=`id -u || echo unknown`
32524d9306dbSmrg      am_gid=`id -g || echo unknown`
32534d9306dbSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
32544d9306dbSmrg      if test $am_uid -le $am_max_uid; then
32554d9306dbSmrg         AC_MSG_RESULT([yes])
32564d9306dbSmrg      else
32574d9306dbSmrg         AC_MSG_RESULT([no])
32584d9306dbSmrg         _am_tools=none
32594d9306dbSmrg      fi
32604d9306dbSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
32614d9306dbSmrg      if test $am_gid -le $am_max_gid; then
32624d9306dbSmrg         AC_MSG_RESULT([yes])
32634d9306dbSmrg      else
32644d9306dbSmrg        AC_MSG_RESULT([no])
32654d9306dbSmrg        _am_tools=none
32664d9306dbSmrg      fi],
32674d9306dbSmrg
32684d9306dbSmrg  [pax],
32694d9306dbSmrg    [],
32704d9306dbSmrg
32714d9306dbSmrg  [m4_fatal([Unknown tar format])])
32724d9306dbSmrg
32734d9306dbSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
32744d9306dbSmrg
32754d9306dbSmrg  # Go ahead even if we have the value already cached.  We do so because we
32764d9306dbSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
32774d9306dbSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
32784d9306dbSmrg
32794d9306dbSmrg  for _am_tool in $_am_tools; do
32804d9306dbSmrg    case $_am_tool in
32814d9306dbSmrg    gnutar)
32824d9306dbSmrg      for _am_tar in tar gnutar gtar; do
32834d9306dbSmrg        AM_RUN_LOG([$_am_tar --version]) && break
32844d9306dbSmrg      done
32854d9306dbSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32864d9306dbSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32874d9306dbSmrg      am__untar="$_am_tar -xf -"
32884d9306dbSmrg      ;;
32894d9306dbSmrg    plaintar)
32904d9306dbSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
32914d9306dbSmrg      # ustar tarball either.
32924d9306dbSmrg      (tar --version) >/dev/null 2>&1 && continue
32934d9306dbSmrg      am__tar='tar chf - "$$tardir"'
32944d9306dbSmrg      am__tar_='tar chf - "$tardir"'
32954d9306dbSmrg      am__untar='tar xf -'
32964d9306dbSmrg      ;;
32974d9306dbSmrg    pax)
32984d9306dbSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
32994d9306dbSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
33004d9306dbSmrg      am__untar='pax -r'
33014d9306dbSmrg      ;;
33024d9306dbSmrg    cpio)
33034d9306dbSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33044d9306dbSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33054d9306dbSmrg      am__untar='cpio -i -H $1 -d'
33064d9306dbSmrg      ;;
33074d9306dbSmrg    none)
33084d9306dbSmrg      am__tar=false
33094d9306dbSmrg      am__tar_=false
33104d9306dbSmrg      am__untar=false
33114d9306dbSmrg      ;;
33124d9306dbSmrg    esac
33134d9306dbSmrg
33144d9306dbSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
33154d9306dbSmrg    # and am__untar set.
33164d9306dbSmrg    test -n "${am_cv_prog_tar_$1}" && break
33174d9306dbSmrg
33184d9306dbSmrg    # tar/untar a dummy directory, and stop if the command works.
33194d9306dbSmrg    rm -rf conftest.dir
33204d9306dbSmrg    mkdir conftest.dir
33214d9306dbSmrg    echo GrepMe > conftest.dir/file
33224d9306dbSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33234d9306dbSmrg    rm -rf conftest.dir
33244d9306dbSmrg    if test -s conftest.tar; then
33254d9306dbSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
33264d9306dbSmrg      AM_RUN_LOG([cat conftest.dir/file])
33274d9306dbSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33284d9306dbSmrg    fi
33294d9306dbSmrg  done
33304d9306dbSmrg  rm -rf conftest.dir
33314d9306dbSmrg
33324d9306dbSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33334d9306dbSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33344d9306dbSmrg
33354d9306dbSmrgAC_SUBST([am__tar])
33364d9306dbSmrgAC_SUBST([am__untar])
33374d9306dbSmrg]) # _AM_PROG_TAR
33387e6533d5Smrg
3339