aclocal.m4 revision 40c5344f
140c5344fSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
28abc0ccfSmrg
340c5344fSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
47a0395d0Smrg
57a0395d0Smrg# This file is free software; the Free Software Foundation
67a0395d0Smrg# gives unlimited permission to copy and/or distribute it,
77a0395d0Smrg# with or without modifications, as long as this notice is preserved.
87a0395d0Smrg
97a0395d0Smrg# This program is distributed in the hope that it will be useful,
107a0395d0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117a0395d0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127a0395d0Smrg# PARTICULAR PURPOSE.
137a0395d0Smrg
149a011757Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157a0395d0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167a0395d0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178abc0ccfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
188abc0ccfSmrg[m4_warning([this file was generated for autoconf 2.69.
197a0395d0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207a0395d0SmrgIf you have problems, you may need to regenerate the build system entirely.
218abc0ccfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227a0395d0Smrg
238abc0ccfSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
248abc0ccfSmrg# serial 1 (pkg-config-0.24)
258abc0ccfSmrg# 
268abc0ccfSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
277a0395d0Smrg#
288abc0ccfSmrg# This program is free software; you can redistribute it and/or modify
298abc0ccfSmrg# it under the terms of the GNU General Public License as published by
308abc0ccfSmrg# the Free Software Foundation; either version 2 of the License, or
318abc0ccfSmrg# (at your option) any later version.
328abc0ccfSmrg#
338abc0ccfSmrg# This program is distributed in the hope that it will be useful, but
348abc0ccfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
358abc0ccfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
368abc0ccfSmrg# General Public License for more details.
378abc0ccfSmrg#
388abc0ccfSmrg# You should have received a copy of the GNU General Public License
398abc0ccfSmrg# along with this program; if not, write to the Free Software
408abc0ccfSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
418abc0ccfSmrg#
428abc0ccfSmrg# As a special exception to the GNU General Public License, if you
438abc0ccfSmrg# distribute this file as part of a program that contains a
448abc0ccfSmrg# configuration script generated by Autoconf, you may include it under
458abc0ccfSmrg# the same distribution terms that you use for the rest of that program.
467a0395d0Smrg
478abc0ccfSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
488abc0ccfSmrg# ----------------------------------
498abc0ccfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
508abc0ccfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
518abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
528abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
538abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
548abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
558abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
567a0395d0Smrg
578abc0ccfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
588abc0ccfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
598abc0ccfSmrgfi
608abc0ccfSmrgif test -n "$PKG_CONFIG"; then
618abc0ccfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
628abc0ccfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
638abc0ccfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
648abc0ccfSmrg		AC_MSG_RESULT([yes])
658abc0ccfSmrg	else
668abc0ccfSmrg		AC_MSG_RESULT([no])
678abc0ccfSmrg		PKG_CONFIG=""
688abc0ccfSmrg	fi
698abc0ccfSmrgfi[]dnl
708abc0ccfSmrg])# PKG_PROG_PKG_CONFIG
717a0395d0Smrg
728abc0ccfSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
738abc0ccfSmrg#
748abc0ccfSmrg# Check to see whether a particular set of modules exists.  Similar
758abc0ccfSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
768abc0ccfSmrg#
778abc0ccfSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
788abc0ccfSmrg# only at the first occurence in configure.ac, so if the first place
798abc0ccfSmrg# it's called might be skipped (such as if it is within an "if", you
808abc0ccfSmrg# have to call PKG_CHECK_EXISTS manually
818abc0ccfSmrg# --------------------------------------------------------------
828abc0ccfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
838abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
848abc0ccfSmrgif test -n "$PKG_CONFIG" && \
858abc0ccfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
868abc0ccfSmrg  m4_default([$2], [:])
878abc0ccfSmrgm4_ifvaln([$3], [else
888abc0ccfSmrg  $3])dnl
898abc0ccfSmrgfi])
907a0395d0Smrg
918abc0ccfSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
928abc0ccfSmrg# ---------------------------------------------
938abc0ccfSmrgm4_define([_PKG_CONFIG],
948abc0ccfSmrg[if test -n "$$1"; then
958abc0ccfSmrg    pkg_cv_[]$1="$$1"
968abc0ccfSmrg elif test -n "$PKG_CONFIG"; then
978abc0ccfSmrg    PKG_CHECK_EXISTS([$3],
988abc0ccfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
998abc0ccfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1008abc0ccfSmrg		     [pkg_failed=yes])
1018abc0ccfSmrg else
1028abc0ccfSmrg    pkg_failed=untried
1038abc0ccfSmrgfi[]dnl
1048abc0ccfSmrg])# _PKG_CONFIG
1057a0395d0Smrg
1068abc0ccfSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1078abc0ccfSmrg# -----------------------------
1088abc0ccfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1098abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1108abc0ccfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1118abc0ccfSmrg        _pkg_short_errors_supported=yes
1128abc0ccfSmrgelse
1138abc0ccfSmrg        _pkg_short_errors_supported=no
1148abc0ccfSmrgfi[]dnl
1158abc0ccfSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1167a0395d0Smrg
1178abc0ccfSmrg
1188abc0ccfSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1198abc0ccfSmrg# [ACTION-IF-NOT-FOUND])
1207a0395d0Smrg#
1217a0395d0Smrg#
1228abc0ccfSmrg# Note that if there is a possibility the first call to
1238abc0ccfSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1248abc0ccfSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1257a0395d0Smrg#
1267366012aSmrg#
1278abc0ccfSmrg# --------------------------------------------------------------
1288abc0ccfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1298abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1308abc0ccfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1318abc0ccfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1327a0395d0Smrg
1338abc0ccfSmrgpkg_failed=no
1348abc0ccfSmrgAC_MSG_CHECKING([for $1])
1357a0395d0Smrg
1368abc0ccfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1378abc0ccfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1387a0395d0Smrg
1398abc0ccfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1408abc0ccfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1418abc0ccfSmrgSee the pkg-config man page for more details.])
1427a0395d0Smrg
1438abc0ccfSmrgif test $pkg_failed = yes; then
1448abc0ccfSmrg   	AC_MSG_RESULT([no])
1458abc0ccfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1468abc0ccfSmrg        if test $_pkg_short_errors_supported = yes; then
1478abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1488abc0ccfSmrg        else 
1498abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1508abc0ccfSmrg        fi
1518abc0ccfSmrg	# Put the nasty error message in config.log where it belongs
1528abc0ccfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1537a0395d0Smrg
1548abc0ccfSmrg	m4_default([$4], [AC_MSG_ERROR(
1558abc0ccfSmrg[Package requirements ($2) were not met:
1567a0395d0Smrg
1578abc0ccfSmrg$$1_PKG_ERRORS
1587a0395d0Smrg
1598abc0ccfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1608abc0ccfSmrginstalled software in a non-standard prefix.
1617a0395d0Smrg
1628abc0ccfSmrg_PKG_TEXT])[]dnl
1638abc0ccfSmrg        ])
1648abc0ccfSmrgelif test $pkg_failed = untried; then
1658abc0ccfSmrg     	AC_MSG_RESULT([no])
1668abc0ccfSmrg	m4_default([$4], [AC_MSG_FAILURE(
1678abc0ccfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1688abc0ccfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1698abc0ccfSmrgpath to pkg-config.
1707a0395d0Smrg
1718abc0ccfSmrg_PKG_TEXT
1727a0395d0Smrg
1738abc0ccfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1748abc0ccfSmrg        ])
1758abc0ccfSmrgelse
1768abc0ccfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1778abc0ccfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1788abc0ccfSmrg        AC_MSG_RESULT([yes])
1798abc0ccfSmrg	$3
1808abc0ccfSmrgfi[]dnl
1818abc0ccfSmrg])# PKG_CHECK_MODULES
1827a0395d0Smrg
1837a0395d0Smrg
1848abc0ccfSmrg# PKG_INSTALLDIR(DIRECTORY)
1858abc0ccfSmrg# -------------------------
1868abc0ccfSmrg# Substitutes the variable pkgconfigdir as the location where a module
1878abc0ccfSmrg# should install pkg-config .pc files. By default the directory is
1888abc0ccfSmrg# $libdir/pkgconfig, but the default can be changed by passing
1898abc0ccfSmrg# DIRECTORY. The user can override through the --with-pkgconfigdir
1908abc0ccfSmrg# parameter.
1918abc0ccfSmrgAC_DEFUN([PKG_INSTALLDIR],
1928abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1938abc0ccfSmrgm4_pushdef([pkg_description],
1948abc0ccfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1958abc0ccfSmrgAC_ARG_WITH([pkgconfigdir],
1968abc0ccfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1978abc0ccfSmrg    [with_pkgconfigdir=]pkg_default)
1988abc0ccfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1998abc0ccfSmrgm4_popdef([pkg_default])
2008abc0ccfSmrgm4_popdef([pkg_description])
2018abc0ccfSmrg]) dnl PKG_INSTALLDIR
2028abc0ccfSmrg
2038abc0ccfSmrg
2048abc0ccfSmrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
2058abc0ccfSmrg# -------------------------
2068abc0ccfSmrg# Substitutes the variable noarch_pkgconfigdir as the location where a
2078abc0ccfSmrg# module should install arch-independent pkg-config .pc files. By
2088abc0ccfSmrg# default the directory is $datadir/pkgconfig, but the default can be
2098abc0ccfSmrg# changed by passing DIRECTORY. The user can override through the
2108abc0ccfSmrg# --with-noarch-pkgconfigdir parameter.
2118abc0ccfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2128abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2138abc0ccfSmrgm4_pushdef([pkg_description],
2148abc0ccfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2158abc0ccfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2168abc0ccfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2178abc0ccfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2188abc0ccfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2198abc0ccfSmrgm4_popdef([pkg_default])
2208abc0ccfSmrgm4_popdef([pkg_description])
2218abc0ccfSmrg]) dnl PKG_NOARCH_INSTALLDIR
2227a0395d0Smrg
2239a011757Smrg
2249a011757Smrg# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2259a011757Smrg# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2269a011757Smrg# -------------------------------------------
2279a011757Smrg# Retrieves the value of the pkg-config variable for the given module.
2289a011757SmrgAC_DEFUN([PKG_CHECK_VAR],
2299a011757Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2309a011757SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2319a011757Smrg
2329a011757Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2339a011757SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2349a011757Smrg
2359a011757SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2369a011757Smrg])# PKG_CHECK_VAR
2379a011757Smrg
2388abc0ccfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
2398abc0ccfSmrgdnl
24040c5344fSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
24140c5344fSmrgdnl
2428abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
2438abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
2448abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
2458abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
2468abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
2478abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
2488abc0ccfSmrgdnl
2498abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
2508abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
2518abc0ccfSmrgdnl Software.
2528abc0ccfSmrgdnl
2538abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2548abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2558abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2568abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2578abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2588abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2598abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
2607a0395d0Smrg
2618abc0ccfSmrg# XORG_MACROS_VERSION(required-version)
2628abc0ccfSmrg# -------------------------------------
2638abc0ccfSmrg# Minimum version: 1.1.0
2648abc0ccfSmrg#
2658abc0ccfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
2668abc0ccfSmrg# your configure.ac with the minimum required version, such as:
2678abc0ccfSmrg# XORG_MACROS_VERSION(1.1)
2688abc0ccfSmrg#
2698abc0ccfSmrg# To ensure that this macro is defined, also add:
2708abc0ccfSmrg# m4_ifndef([XORG_MACROS_VERSION],
2718abc0ccfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
2728abc0ccfSmrg#
2738abc0ccfSmrg#
27440c5344fSmrg# See the "minimum version" comment for each macro you use to see what
2758abc0ccfSmrg# version you require.
2768abc0ccfSmrgm4_defun([XORG_MACROS_VERSION],[
27740c5344fSmrgm4_define([vers_have], [1.19.1])
2788abc0ccfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
2798abc0ccfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
2808abc0ccfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
2818abc0ccfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
2828abc0ccfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
2838abc0ccfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
2848abc0ccfSmrgm4_undefine([vers_have])
2858abc0ccfSmrgm4_undefine([maj_have])
2868abc0ccfSmrgm4_undefine([maj_needed])
2878abc0ccfSmrg]) # XORG_MACROS_VERSION
2887a0395d0Smrg
2898abc0ccfSmrg# XORG_PROG_RAWCPP()
2908abc0ccfSmrg# ------------------
2918abc0ccfSmrg# Minimum version: 1.0.0
2928abc0ccfSmrg#
2938abc0ccfSmrg# Find cpp program and necessary flags for use in pre-processing text files
2948abc0ccfSmrg# such as man pages and config files
2958abc0ccfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
2968abc0ccfSmrgAC_REQUIRE([AC_PROG_CPP])
29740c5344fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
2988abc0ccfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
2997a0395d0Smrg
3008abc0ccfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
3018abc0ccfSmrg# which is not the best choice for supporting other OS'es, but covers most
3028abc0ccfSmrg# of the ones we need for now.
3038abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
3048abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
3058abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3068abc0ccfSmrg	AC_MSG_RESULT([no])
3077366012aSmrgelse
3088abc0ccfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3098abc0ccfSmrg		RAWCPPFLAGS=-undef
3108abc0ccfSmrg		AC_MSG_RESULT([yes])
3118abc0ccfSmrg	# under Cygwin unix is still defined even with -undef
3128abc0ccfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
3138abc0ccfSmrg		RAWCPPFLAGS="-undef -ansi"
3148abc0ccfSmrg		AC_MSG_RESULT([yes, with -ansi])
3158abc0ccfSmrg	else
3168abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3178abc0ccfSmrg	fi
3187a0395d0Smrgfi
3198abc0ccfSmrgrm -f conftest.$ac_ext
3207a0395d0Smrg
3218abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3228abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3238abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3248abc0ccfSmrg	AC_MSG_RESULT([no])
3258abc0ccfSmrgelse
3268abc0ccfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
32740c5344fSmrg		TRADITIONALCPPFLAGS="-traditional"
3288abc0ccfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3298abc0ccfSmrg		AC_MSG_RESULT([yes])
3308abc0ccfSmrg	else
3318abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3328abc0ccfSmrg	fi
3338abc0ccfSmrgfi
3348abc0ccfSmrgrm -f conftest.$ac_ext
3358abc0ccfSmrgAC_SUBST(RAWCPPFLAGS)
33640c5344fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
3378abc0ccfSmrg]) # XORG_PROG_RAWCPP
3387a0395d0Smrg
3398abc0ccfSmrg# XORG_MANPAGE_SECTIONS()
3408abc0ccfSmrg# -----------------------
3418abc0ccfSmrg# Minimum version: 1.0.0
3428abc0ccfSmrg#
3438abc0ccfSmrg# Determine which sections man pages go in for the different man page types
3448abc0ccfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
3458abc0ccfSmrg# Not sure if there's any better way than just hardcoding by OS name.
3468abc0ccfSmrg# Override default settings by setting environment variables
3478abc0ccfSmrg# Added MAN_SUBSTS in version 1.8
3488abc0ccfSmrg# Added AC_PROG_SED in version 1.8
3497a0395d0Smrg
3508abc0ccfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
3518abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
3528abc0ccfSmrgAC_REQUIRE([AC_PROG_SED])
3537a0395d0Smrg
3548abc0ccfSmrgif test x$APP_MAN_SUFFIX = x    ; then
3558abc0ccfSmrg    APP_MAN_SUFFIX=1
3568abc0ccfSmrgfi
3578abc0ccfSmrgif test x$APP_MAN_DIR = x    ; then
3588abc0ccfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
3597a0395d0Smrgfi
3607a0395d0Smrg
3618abc0ccfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
3628abc0ccfSmrg    LIB_MAN_SUFFIX=3
3638abc0ccfSmrgfi
3648abc0ccfSmrgif test x$LIB_MAN_DIR = x    ; then
3658abc0ccfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
3668abc0ccfSmrgfi
3677a0395d0Smrg
3688abc0ccfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
3698abc0ccfSmrg    case $host_os in
37040c5344fSmrg	# Solaris 2.0 - 11 use SysV man page sections
37140c5344fSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
37240c5344fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
3738abc0ccfSmrg    esac
3748abc0ccfSmrgfi
3758abc0ccfSmrgif test x$FILE_MAN_DIR = x    ; then
3768abc0ccfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
3778abc0ccfSmrgfi
3787a0395d0Smrg
3798abc0ccfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
3808abc0ccfSmrg    case $host_os in
38140c5344fSmrg	# Solaris 2.0 - 11 use SysV man page sections
38240c5344fSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
38340c5344fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
3848abc0ccfSmrg    esac
3858abc0ccfSmrgfi
3868abc0ccfSmrgif test x$MISC_MAN_DIR = x    ; then
3878abc0ccfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
3888abc0ccfSmrgfi
3897a0395d0Smrg
3908abc0ccfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
3918abc0ccfSmrg    case $host_os in
39240c5344fSmrg	# Solaris 2.0 - 11 use SysV man page sections
39340c5344fSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
39440c5344fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
3958abc0ccfSmrg    esac
3968abc0ccfSmrgfi
3978abc0ccfSmrgif test x$DRIVER_MAN_DIR = x    ; then
3988abc0ccfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
3998abc0ccfSmrgfi
4008abc0ccfSmrg
4018abc0ccfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
4028abc0ccfSmrg    case $host_os in
40340c5344fSmrg	# Solaris 2.0 - 11 use SysV man page sections
40440c5344fSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
40540c5344fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
4068abc0ccfSmrg    esac
4078abc0ccfSmrgfi
4088abc0ccfSmrgif test x$ADMIN_MAN_DIR = x    ; then
4098abc0ccfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
4108abc0ccfSmrgfi
4117366012aSmrg
4127366012aSmrg
4138abc0ccfSmrgAC_SUBST([APP_MAN_SUFFIX])
4148abc0ccfSmrgAC_SUBST([LIB_MAN_SUFFIX])
4158abc0ccfSmrgAC_SUBST([FILE_MAN_SUFFIX])
4168abc0ccfSmrgAC_SUBST([MISC_MAN_SUFFIX])
4178abc0ccfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
4188abc0ccfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
4198abc0ccfSmrgAC_SUBST([APP_MAN_DIR])
4208abc0ccfSmrgAC_SUBST([LIB_MAN_DIR])
4218abc0ccfSmrgAC_SUBST([FILE_MAN_DIR])
4228abc0ccfSmrgAC_SUBST([MISC_MAN_DIR])
4238abc0ccfSmrgAC_SUBST([DRIVER_MAN_DIR])
4248abc0ccfSmrgAC_SUBST([ADMIN_MAN_DIR])
4258abc0ccfSmrg
4268abc0ccfSmrgXORG_MAN_PAGE="X Version 11"
4278abc0ccfSmrgAC_SUBST([XORG_MAN_PAGE])
4288abc0ccfSmrgMAN_SUBSTS="\
4298abc0ccfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4308abc0ccfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4318abc0ccfSmrg	-e 's|__xservername__|Xorg|g' \
4328abc0ccfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
4338abc0ccfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
4348abc0ccfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4358abc0ccfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4368abc0ccfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4378abc0ccfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4388abc0ccfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
4398abc0ccfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
4408abc0ccfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
4418abc0ccfSmrgAC_SUBST([MAN_SUBSTS])
4428abc0ccfSmrg
4438abc0ccfSmrg]) # XORG_MANPAGE_SECTIONS
4448abc0ccfSmrg
4458abc0ccfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
4468abc0ccfSmrg# ------------------------
4478abc0ccfSmrg# Minimum version: 1.7.0
4487a0395d0Smrg#
4498abc0ccfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
4508abc0ccfSmrg# provided by xorg-sgml-doctools, if installed.
4518abc0ccfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
4528abc0ccfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
4538abc0ccfSmrgXORG_SGML_PATH=
4548abc0ccfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
4558abc0ccfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
4568abc0ccfSmrg    [m4_ifval([$1],[:],
4578abc0ccfSmrg        [if test x"$cross_compiling" != x"yes" ; then
4588abc0ccfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
4598abc0ccfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
4608abc0ccfSmrg         fi])
4618abc0ccfSmrg    ])
4627a0395d0Smrg
4638abc0ccfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
4648abc0ccfSmrg# the path and the name of the doc stylesheet
4658abc0ccfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
4668abc0ccfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
4678abc0ccfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
4688abc0ccfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
4698abc0ccfSmrgelse
4708abc0ccfSmrg   AC_MSG_RESULT([no])
4718abc0ccfSmrgfi
4728abc0ccfSmrg
4738abc0ccfSmrgAC_SUBST(XORG_SGML_PATH)
4748abc0ccfSmrgAC_SUBST(STYLESHEET_SRCDIR)
4758abc0ccfSmrgAC_SUBST(XSL_STYLESHEET)
4768abc0ccfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
4778abc0ccfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
4787a0395d0Smrg
4798abc0ccfSmrg# XORG_CHECK_LINUXDOC
4808abc0ccfSmrg# -------------------
4818abc0ccfSmrg# Minimum version: 1.0.0
4827366012aSmrg#
4838abc0ccfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
4848abc0ccfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
4858abc0ccfSmrg# Whether or not the necessary tools and files are found can be checked
4868abc0ccfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
4878abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
4888abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
4898abc0ccfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
4907a0395d0Smrg
4918abc0ccfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
4927a0395d0Smrg
4938abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
4947a0395d0Smrg
4958abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
4968abc0ccfSmrg   BUILDDOC=yes
4978abc0ccfSmrgelse
4988abc0ccfSmrg   BUILDDOC=no
4997a0395d0Smrgfi
5007a0395d0Smrg
5018abc0ccfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
5027a0395d0Smrg
5038abc0ccfSmrgAC_MSG_RESULT([$BUILDDOC])
5047a0395d0Smrg
5058abc0ccfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
5067a0395d0Smrg
5078abc0ccfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
5088abc0ccfSmrg   BUILDPDFDOC=yes
5098abc0ccfSmrgelse
5108abc0ccfSmrg   BUILDPDFDOC=no
5118abc0ccfSmrgfi
5127a0395d0Smrg
5138abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5147a0395d0Smrg
5158abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5167a0395d0Smrg
5178abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
5188abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
5198abc0ccfSmrgMAKE_PDF="$PS2PDF"
5208abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5217a0395d0Smrg
5228abc0ccfSmrgAC_SUBST(MAKE_TEXT)
5238abc0ccfSmrgAC_SUBST(MAKE_PS)
5248abc0ccfSmrgAC_SUBST(MAKE_PDF)
5258abc0ccfSmrgAC_SUBST(MAKE_HTML)
5268abc0ccfSmrg]) # XORG_CHECK_LINUXDOC
5277a0395d0Smrg
5288abc0ccfSmrg# XORG_CHECK_DOCBOOK
5298abc0ccfSmrg# -------------------
5308abc0ccfSmrg# Minimum version: 1.0.0
5317366012aSmrg#
5328abc0ccfSmrg# Checks for the ability to build output formats from SGML DocBook source.
5338abc0ccfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5348abc0ccfSmrg# indicates whether the necessary tools and files are found and, if set,
5358abc0ccfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5368abc0ccfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5378abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5387a0395d0Smrg
5398abc0ccfSmrgBUILDTXTDOC=no
5408abc0ccfSmrgBUILDPDFDOC=no
5418abc0ccfSmrgBUILDPSDOC=no
5428abc0ccfSmrgBUILDHTMLDOC=no
5437a0395d0Smrg
5448abc0ccfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
5458abc0ccfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
5468abc0ccfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
5478abc0ccfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
5487a0395d0Smrg
5498abc0ccfSmrgAC_MSG_CHECKING([whether to build text documentation])
5508abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
5518abc0ccfSmrg   test x$BUILD_TXTDOC != xno; then
5528abc0ccfSmrg	BUILDTXTDOC=yes
5537366012aSmrgfi
5548abc0ccfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
5558abc0ccfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
5567366012aSmrg
5578abc0ccfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
5588abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
5598abc0ccfSmrg   test x$BUILD_PDFDOC != xno; then
5608abc0ccfSmrg	BUILDPDFDOC=yes
5618abc0ccfSmrgfi
5628abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5638abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5647a0395d0Smrg
5658abc0ccfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
5668abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
5678abc0ccfSmrg   test x$BUILD_PSDOC != xno; then
5688abc0ccfSmrg	BUILDPSDOC=yes
5698abc0ccfSmrgfi
5708abc0ccfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
5718abc0ccfSmrgAC_MSG_RESULT([$BUILDPSDOC])
5727a0395d0Smrg
5738abc0ccfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
5748abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
5758abc0ccfSmrg   test x$BUILD_HTMLDOC != xno; then
5768abc0ccfSmrg	BUILDHTMLDOC=yes
5778abc0ccfSmrgfi
5788abc0ccfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
5798abc0ccfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
5807a0395d0Smrg
5818abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
5828abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
5838abc0ccfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
5848abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
5857a0395d0Smrg
5868abc0ccfSmrgAC_SUBST(MAKE_TEXT)
5878abc0ccfSmrgAC_SUBST(MAKE_PS)
5888abc0ccfSmrgAC_SUBST(MAKE_PDF)
5898abc0ccfSmrgAC_SUBST(MAKE_HTML)
5908abc0ccfSmrg]) # XORG_CHECK_DOCBOOK
5917366012aSmrg
5928abc0ccfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
5938abc0ccfSmrg# ----------------
5948abc0ccfSmrg# Minimum version: 1.5.0
5958abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
5967a0395d0Smrg#
5978abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
5988abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
5998abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
6008abc0ccfSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
6018abc0ccfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
6028abc0ccfSmrg# --with-xmlto assumes 'auto'.
6037a0395d0Smrg#
6048abc0ccfSmrg# Interface to module:
6058abc0ccfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
6068abc0ccfSmrg# XMLTO:	returns the path of the xmlto program found
6078abc0ccfSmrg#		returns the path set by the user in the environment
6088abc0ccfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
6098abc0ccfSmrg#		'no' user instructs the module not to use xmlto
6108abc0ccfSmrg#
6118abc0ccfSmrg# Added in version 1.10.0
6128abc0ccfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
6138abc0ccfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
6148abc0ccfSmrg#
6158abc0ccfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
6168abc0ccfSmrg#
6178abc0ccfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
6188abc0ccfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
6198abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
6208abc0ccfSmrgAC_ARG_WITH(xmlto,
6218abc0ccfSmrg	AS_HELP_STRING([--with-xmlto],
6228abc0ccfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6238abc0ccfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6248abc0ccfSmrgm4_undefine([_defopt])
6257366012aSmrg
6268abc0ccfSmrgif test "x$use_xmlto" = x"auto"; then
6278abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6288abc0ccfSmrg   if test "x$XMLTO" = "x"; then
6298abc0ccfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6308abc0ccfSmrg	have_xmlto=no
6318abc0ccfSmrg   else
6328abc0ccfSmrg        have_xmlto=yes
6338abc0ccfSmrg   fi
6348abc0ccfSmrgelif test "x$use_xmlto" = x"yes" ; then
6358abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6368abc0ccfSmrg   if test "x$XMLTO" = "x"; then
6378abc0ccfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6388abc0ccfSmrg   fi
6398abc0ccfSmrg   have_xmlto=yes
6408abc0ccfSmrgelif test "x$use_xmlto" = x"no" ; then
6418abc0ccfSmrg   if test "x$XMLTO" != "x"; then
6428abc0ccfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
6438abc0ccfSmrg   fi
6448abc0ccfSmrg   have_xmlto=no
6457366012aSmrgelse
6468abc0ccfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
6477a0395d0Smrgfi
6487a0395d0Smrg
6498abc0ccfSmrg# Test for a minimum version of xmlto, if provided.
6508abc0ccfSmrgm4_ifval([$1],
6518abc0ccfSmrg[if test "$have_xmlto" = yes; then
6528abc0ccfSmrg    # scrape the xmlto version
6538abc0ccfSmrg    AC_MSG_CHECKING([the xmlto version])
6548abc0ccfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
6558abc0ccfSmrg    AC_MSG_RESULT([$xmlto_version])
6568abc0ccfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
6578abc0ccfSmrg        [if test "x$use_xmlto" = xauto; then
6588abc0ccfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
6598abc0ccfSmrg            have_xmlto=no
6608abc0ccfSmrg        else
6618abc0ccfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
6628abc0ccfSmrg        fi])
6638abc0ccfSmrgfi])
6647a0395d0Smrg
6658abc0ccfSmrg# Test for the ability of xmlto to generate a text target
66640c5344fSmrg#
66740c5344fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
66840c5344fSmrg# following test for empty XML docbook files.
66940c5344fSmrg# For compatibility reasons use the following empty XML docbook file and if
67040c5344fSmrg# it fails try it again with a non-empty XML file.
6718abc0ccfSmrghave_xmlto_text=no
6728abc0ccfSmrgcat > conftest.xml << "EOF"
6738abc0ccfSmrgEOF
6748abc0ccfSmrgAS_IF([test "$have_xmlto" = yes],
6758abc0ccfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
6768abc0ccfSmrg             [have_xmlto_text=yes],
67740c5344fSmrg             [# Try it again with a non-empty XML file.
67840c5344fSmrg              cat > conftest.xml << "EOF"
67940c5344fSmrg<x></x>
68040c5344fSmrgEOF
68140c5344fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
68240c5344fSmrg                    [have_xmlto_text=yes],
68340c5344fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
6848abc0ccfSmrgrm -f conftest.xml
6858abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
6868abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
6878abc0ccfSmrg]) # XORG_WITH_XMLTO
6887a0395d0Smrg
6898abc0ccfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
6908abc0ccfSmrg# --------------------------------------------
6918abc0ccfSmrg# Minimum version: 1.12.0
6928abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
6937366012aSmrg#
6948abc0ccfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
6958abc0ccfSmrg# XML-based language used for the transformation of XML documents.
6968abc0ccfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
6978abc0ccfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
6988abc0ccfSmrg# The XSLT processor is often used as a standalone tool for transformations.
6998abc0ccfSmrg# It should not be assumed that this tool is used only to work with documnetation.
7008abc0ccfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
7018abc0ccfSmrg#
7028abc0ccfSmrg# Interface to module:
7038abc0ccfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
7048abc0ccfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
7058abc0ccfSmrg#		 returns the path set by the user in the environment
7068abc0ccfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
7078abc0ccfSmrg#		  'no' user instructs the module not to use xsltproc
7088abc0ccfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
7098abc0ccfSmrg#
7108abc0ccfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
7118abc0ccfSmrg#
7128abc0ccfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
7138abc0ccfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
7148abc0ccfSmrg# Preserves the interface, should it be implemented later
7158abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
7168abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
7178abc0ccfSmrgAC_ARG_WITH(xsltproc,
7188abc0ccfSmrg	AS_HELP_STRING([--with-xsltproc],
7198abc0ccfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
7208abc0ccfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
7218abc0ccfSmrgm4_undefine([_defopt])
7227366012aSmrg
7238abc0ccfSmrgif test "x$use_xsltproc" = x"auto"; then
7248abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7258abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
7268abc0ccfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
7278abc0ccfSmrg	have_xsltproc=no
7288abc0ccfSmrg   else
7298abc0ccfSmrg        have_xsltproc=yes
7307366012aSmrg   fi
7318abc0ccfSmrgelif test "x$use_xsltproc" = x"yes" ; then
7328abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7338abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
7348abc0ccfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7357366012aSmrg   fi
7368abc0ccfSmrg   have_xsltproc=yes
7378abc0ccfSmrgelif test "x$use_xsltproc" = x"no" ; then
7388abc0ccfSmrg   if test "x$XSLTPROC" != "x"; then
7398abc0ccfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
7408abc0ccfSmrg   fi
7418abc0ccfSmrg   have_xsltproc=no
7427366012aSmrgelse
7438abc0ccfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
7447366012aSmrgfi
7457a0395d0Smrg
7468abc0ccfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
7478abc0ccfSmrg]) # XORG_WITH_XSLTPROC
7487a0395d0Smrg
7498abc0ccfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
7508abc0ccfSmrg# ----------------------------------------
7518abc0ccfSmrg# Minimum version: 1.15.0
7527a0395d0Smrg#
7538abc0ccfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
7548abc0ccfSmrg# scanning arbitrary text files, extracting information from those text files,
7558abc0ccfSmrg# and printing reports based on that information.
7567366012aSmrg#
7578abc0ccfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
7588abc0ccfSmrg#
7598abc0ccfSmrg# Interface to module:
7608abc0ccfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
7618abc0ccfSmrg# PERL:	     returns the path of the perl program found
7628abc0ccfSmrg#	     returns the path set by the user in the environment
7638abc0ccfSmrg# --with-perl: 'yes' user instructs the module to use perl
7648abc0ccfSmrg#	       'no' user instructs the module not to use perl
7658abc0ccfSmrg# have_perl: returns yes if perl found in PATH or no
7668abc0ccfSmrg#
7678abc0ccfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
7688abc0ccfSmrg#
7698abc0ccfSmrgAC_DEFUN([XORG_WITH_PERL],[
7708abc0ccfSmrgAC_ARG_VAR([PERL], [Path to perl command])
7718abc0ccfSmrg# Preserves the interface, should it be implemented later
7728abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
7738abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
7748abc0ccfSmrgAC_ARG_WITH(perl,
7758abc0ccfSmrg	AS_HELP_STRING([--with-perl],
7768abc0ccfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
7778abc0ccfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
7788abc0ccfSmrgm4_undefine([_defopt])
7797a0395d0Smrg
7808abc0ccfSmrgif test "x$use_perl" = x"auto"; then
7818abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
7828abc0ccfSmrg   if test "x$PERL" = "x"; then
7838abc0ccfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
7848abc0ccfSmrg	have_perl=no
7858abc0ccfSmrg   else
7868abc0ccfSmrg        have_perl=yes
7878abc0ccfSmrg   fi
7888abc0ccfSmrgelif test "x$use_perl" = x"yes" ; then
7898abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
7908abc0ccfSmrg   if test "x$PERL" = "x"; then
7918abc0ccfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
7928abc0ccfSmrg   fi
7938abc0ccfSmrg   have_perl=yes
7948abc0ccfSmrgelif test "x$use_perl" = x"no" ; then
7958abc0ccfSmrg   if test "x$PERL" != "x"; then
7968abc0ccfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
7978abc0ccfSmrg   fi
7988abc0ccfSmrg   have_perl=no
7998abc0ccfSmrgelse
8008abc0ccfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
8018abc0ccfSmrgfi
8027366012aSmrg
8038abc0ccfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
8048abc0ccfSmrg]) # XORG_WITH_PERL
8057366012aSmrg
8068abc0ccfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
8078abc0ccfSmrg# ----------------
8088abc0ccfSmrg# Minimum version: 1.5.0
8098abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
8107a0395d0Smrg#
8118abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
8128abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
8138abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
8148abc0ccfSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
8158abc0ccfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
8168abc0ccfSmrg# --with-asciidoc assumes 'auto'.
8177a0395d0Smrg#
8188abc0ccfSmrg# Interface to module:
8198abc0ccfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
8208abc0ccfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
8218abc0ccfSmrg#		 returns the path set by the user in the environment
8228abc0ccfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
8238abc0ccfSmrg#		  'no' user instructs the module not to use asciidoc
8247a0395d0Smrg#
8258abc0ccfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
8268abc0ccfSmrg#
8278abc0ccfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
8288abc0ccfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
8298abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
8308abc0ccfSmrgAC_ARG_WITH(asciidoc,
8318abc0ccfSmrg	AS_HELP_STRING([--with-asciidoc],
8328abc0ccfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8338abc0ccfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8348abc0ccfSmrgm4_undefine([_defopt])
8357366012aSmrg
8368abc0ccfSmrgif test "x$use_asciidoc" = x"auto"; then
8378abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8388abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
8398abc0ccfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
8408abc0ccfSmrg	have_asciidoc=no
8418abc0ccfSmrg   else
8428abc0ccfSmrg        have_asciidoc=yes
8438abc0ccfSmrg   fi
8448abc0ccfSmrgelif test "x$use_asciidoc" = x"yes" ; then
8458abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8468abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
8478abc0ccfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
8488abc0ccfSmrg   fi
8498abc0ccfSmrg   have_asciidoc=yes
8508abc0ccfSmrgelif test "x$use_asciidoc" = x"no" ; then
8518abc0ccfSmrg   if test "x$ASCIIDOC" != "x"; then
8528abc0ccfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
8538abc0ccfSmrg   fi
8548abc0ccfSmrg   have_asciidoc=no
8558abc0ccfSmrgelse
8568abc0ccfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
8578abc0ccfSmrgfi
8588abc0ccfSmrgm4_ifval([$1],
8598abc0ccfSmrg[if test "$have_asciidoc" = yes; then
8608abc0ccfSmrg    # scrape the asciidoc version
8618abc0ccfSmrg    AC_MSG_CHECKING([the asciidoc version])
8628abc0ccfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
8638abc0ccfSmrg    AC_MSG_RESULT([$asciidoc_version])
8648abc0ccfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
8658abc0ccfSmrg        [if test "x$use_asciidoc" = xauto; then
8668abc0ccfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
8678abc0ccfSmrg            have_asciidoc=no
8688abc0ccfSmrg        else
8698abc0ccfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
8708abc0ccfSmrg        fi])
8718abc0ccfSmrgfi])
8728abc0ccfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
8738abc0ccfSmrg]) # XORG_WITH_ASCIIDOC
8747366012aSmrg
8758abc0ccfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
87640c5344fSmrg# -------------------------------------------
8778abc0ccfSmrg# Minimum version: 1.5.0
8788abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
87940c5344fSmrg# Minimum version for optional DOT checking: 1.18.0
8802852888eSmrg#
8818abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
8828abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
8838abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
8848abc0ccfSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
8858abc0ccfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
8868abc0ccfSmrg# --with-doxygen assumes 'auto'.
8872852888eSmrg#
8888abc0ccfSmrg# Interface to module:
8898abc0ccfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
8908abc0ccfSmrg# DOXYGEN:	 returns the path of the doxygen program found
8918abc0ccfSmrg#		 returns the path set by the user in the environment
8928abc0ccfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
8938abc0ccfSmrg#		  'no' user instructs the module not to use doxygen
8942852888eSmrg#
8958abc0ccfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
8962852888eSmrg#
8978abc0ccfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
8988abc0ccfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
89940c5344fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
9008abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
9018abc0ccfSmrgAC_ARG_WITH(doxygen,
9028abc0ccfSmrg	AS_HELP_STRING([--with-doxygen],
9038abc0ccfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
9048abc0ccfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
9058abc0ccfSmrgm4_undefine([_defopt])
9062852888eSmrg
9078abc0ccfSmrgif test "x$use_doxygen" = x"auto"; then
9088abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9098abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
9108abc0ccfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
9118abc0ccfSmrg	have_doxygen=no
9128abc0ccfSmrg   else
9138abc0ccfSmrg        have_doxygen=yes
9148abc0ccfSmrg   fi
9158abc0ccfSmrgelif test "x$use_doxygen" = x"yes" ; then
9168abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
9178abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
9188abc0ccfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
9198abc0ccfSmrg   fi
9208abc0ccfSmrg   have_doxygen=yes
9218abc0ccfSmrgelif test "x$use_doxygen" = x"no" ; then
9228abc0ccfSmrg   if test "x$DOXYGEN" != "x"; then
9238abc0ccfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
9248abc0ccfSmrg   fi
9258abc0ccfSmrg   have_doxygen=no
9268abc0ccfSmrgelse
9278abc0ccfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9282852888eSmrgfi
9298abc0ccfSmrgm4_ifval([$1],
9308abc0ccfSmrg[if test "$have_doxygen" = yes; then
9318abc0ccfSmrg    # scrape the doxygen version
9328abc0ccfSmrg    AC_MSG_CHECKING([the doxygen version])
9338abc0ccfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
9348abc0ccfSmrg    AC_MSG_RESULT([$doxygen_version])
9358abc0ccfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9368abc0ccfSmrg        [if test "x$use_doxygen" = xauto; then
9378abc0ccfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9388abc0ccfSmrg            have_doxygen=no
9398abc0ccfSmrg        else
9408abc0ccfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
9418abc0ccfSmrg        fi])
9428abc0ccfSmrgfi])
94340c5344fSmrg
94440c5344fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
94540c5344fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
94640c5344fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
94740c5344fSmrgHAVE_DOT=no
94840c5344fSmrgif test "x$have_doxygen" = "xyes"; then
94940c5344fSmrg  AC_PATH_PROG([DOT], [dot])
95040c5344fSmrg    if test "x$DOT" != "x"; then
95140c5344fSmrg      HAVE_DOT=yes
95240c5344fSmrg    fi
95340c5344fSmrgfi
95440c5344fSmrg
95540c5344fSmrgAC_SUBST([HAVE_DOT])
95640c5344fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
9578abc0ccfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
9588abc0ccfSmrg]) # XORG_WITH_DOXYGEN
9592852888eSmrg
9608abc0ccfSmrg# XORG_WITH_GROFF([DEFAULT])
9618abc0ccfSmrg# ----------------
9628abc0ccfSmrg# Minimum version: 1.6.0
9638abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9642852888eSmrg#
9658abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
9668abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
9678abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9688abc0ccfSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
9698abc0ccfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
9708abc0ccfSmrg# --with-groff assumes 'auto'.
9712852888eSmrg#
9728abc0ccfSmrg# Interface to module:
9738abc0ccfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
9748abc0ccfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
9758abc0ccfSmrg# HAVE_GROFF_MS: the -ms macros package
9768abc0ccfSmrg# GROFF:	 returns the path of the groff program found
9778abc0ccfSmrg#		 returns the path set by the user in the environment
9788abc0ccfSmrg# --with-groff:	 'yes' user instructs the module to use groff
9798abc0ccfSmrg#		 'no' user instructs the module not to use groff
98096402570Smrg#
9818abc0ccfSmrg# Added in version 1.9.0:
9828abc0ccfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
9838abc0ccfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
9848abc0ccfSmrg#		   psselect from the psutils package.
9858abc0ccfSmrg#		   the ghostcript package. Refer to the grohtml man pages
9862852888eSmrg#
9878abc0ccfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
9882852888eSmrg#
9898abc0ccfSmrg# OS and distros often splits groff in a basic and full package, the former
9908abc0ccfSmrg# having the groff program and the later having devices, fonts and macros
9918abc0ccfSmrg# Checking for the groff executable is not enough.
9922852888eSmrg#
9938abc0ccfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
9948abc0ccfSmrg# unset HAVE_GROFF or GROFF env variables.
9958abc0ccfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
9962852888eSmrg#
9978abc0ccfSmrgAC_DEFUN([XORG_WITH_GROFF],[
9988abc0ccfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
9998abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
10008abc0ccfSmrgAC_ARG_WITH(groff,
10018abc0ccfSmrg	AS_HELP_STRING([--with-groff],
10028abc0ccfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
10038abc0ccfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
10048abc0ccfSmrgm4_undefine([_defopt])
10052852888eSmrg
10068abc0ccfSmrgif test "x$use_groff" = x"auto"; then
10078abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
10088abc0ccfSmrg   if test "x$GROFF" = "x"; then
10098abc0ccfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
10108abc0ccfSmrg	have_groff=no
10118abc0ccfSmrg   else
10128abc0ccfSmrg        have_groff=yes
10138abc0ccfSmrg   fi
10148abc0ccfSmrgelif test "x$use_groff" = x"yes" ; then
10158abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
10168abc0ccfSmrg   if test "x$GROFF" = "x"; then
10178abc0ccfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
10188abc0ccfSmrg   fi
10198abc0ccfSmrg   have_groff=yes
10208abc0ccfSmrgelif test "x$use_groff" = x"no" ; then
10218abc0ccfSmrg   if test "x$GROFF" != "x"; then
10228abc0ccfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
10238abc0ccfSmrg   fi
10248abc0ccfSmrg   have_groff=no
10258abc0ccfSmrgelse
10268abc0ccfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10278abc0ccfSmrgfi
10282852888eSmrg
10298abc0ccfSmrg# We have groff, test for the presence of the macro packages
10308abc0ccfSmrgif test "x$have_groff" = x"yes"; then
10318abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
10328abc0ccfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
10338abc0ccfSmrg        groff_ms_works=yes
10348abc0ccfSmrg    else
10358abc0ccfSmrg        groff_ms_works=no
10368abc0ccfSmrg    fi
10378abc0ccfSmrg    AC_MSG_RESULT([$groff_ms_works])
10388abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
10398abc0ccfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
10408abc0ccfSmrg        groff_mm_works=yes
10418abc0ccfSmrg    else
10428abc0ccfSmrg        groff_mm_works=no
10438abc0ccfSmrg    fi
10448abc0ccfSmrg    AC_MSG_RESULT([$groff_mm_works])
10458abc0ccfSmrgfi
10462852888eSmrg
10478abc0ccfSmrg# We have groff, test for HTML dependencies, one command per package
10488abc0ccfSmrgif test "x$have_groff" = x"yes"; then
10498abc0ccfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
10508abc0ccfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
10518abc0ccfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
10528abc0ccfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
10538abc0ccfSmrg      have_groff_html=yes
10548abc0ccfSmrg   else
10558abc0ccfSmrg      have_groff_html=no
10568abc0ccfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
10578abc0ccfSmrg   fi
10588abc0ccfSmrgfi
10592852888eSmrg
10608abc0ccfSmrg# Set Automake conditionals for Makefiles
10618abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
10628abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
10638abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
10648abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
10658abc0ccfSmrg]) # XORG_WITH_GROFF
10667366012aSmrg
10678abc0ccfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
10688abc0ccfSmrg# ---------------------------------------
10698abc0ccfSmrg# Minimum version: 1.6.0
10708abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10718abc0ccfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
10727a0395d0Smrg#
10738abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
10748abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
10758abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10768abc0ccfSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
10778abc0ccfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
10788abc0ccfSmrg# --with-fop assumes 'auto'.
10797a0395d0Smrg#
10808abc0ccfSmrg# Interface to module:
10818abc0ccfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
10828abc0ccfSmrg# FOP:	 	returns the path of the fop program found
10838abc0ccfSmrg#		returns the path set by the user in the environment
10848abc0ccfSmrg# --with-fop: 	'yes' user instructs the module to use fop
10858abc0ccfSmrg#		'no' user instructs the module not to use fop
10867a0395d0Smrg#
10878abc0ccfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
10887a0395d0Smrg#
10898abc0ccfSmrgAC_DEFUN([XORG_WITH_FOP],[
10908abc0ccfSmrgAC_ARG_VAR([FOP], [Path to fop command])
10918abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
10928abc0ccfSmrgAC_ARG_WITH(fop,
10938abc0ccfSmrg	AS_HELP_STRING([--with-fop],
10948abc0ccfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
10958abc0ccfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
10968abc0ccfSmrgm4_undefine([_defopt])
10977a0395d0Smrg
10988abc0ccfSmrgif test "x$use_fop" = x"auto"; then
10998abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
11008abc0ccfSmrg   if test "x$FOP" = "x"; then
11018abc0ccfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
11028abc0ccfSmrg	have_fop=no
11038abc0ccfSmrg   else
11048abc0ccfSmrg        have_fop=yes
11058abc0ccfSmrg   fi
11068abc0ccfSmrgelif test "x$use_fop" = x"yes" ; then
11078abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
11088abc0ccfSmrg   if test "x$FOP" = "x"; then
11098abc0ccfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
11108abc0ccfSmrg   fi
11118abc0ccfSmrg   have_fop=yes
11128abc0ccfSmrgelif test "x$use_fop" = x"no" ; then
11138abc0ccfSmrg   if test "x$FOP" != "x"; then
11148abc0ccfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
11158abc0ccfSmrg   fi
11168abc0ccfSmrg   have_fop=no
11177366012aSmrgelse
11188abc0ccfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
11197a0395d0Smrgfi
11207a0395d0Smrg
11218abc0ccfSmrg# Test for a minimum version of fop, if provided.
11228abc0ccfSmrgm4_ifval([$1],
11238abc0ccfSmrg[if test "$have_fop" = yes; then
11248abc0ccfSmrg    # scrape the fop version
11258abc0ccfSmrg    AC_MSG_CHECKING([for fop minimum version])
11268abc0ccfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
11278abc0ccfSmrg    AC_MSG_RESULT([$fop_version])
11288abc0ccfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
11298abc0ccfSmrg        [if test "x$use_fop" = xauto; then
11308abc0ccfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
11318abc0ccfSmrg            have_fop=no
11328abc0ccfSmrg        else
11338abc0ccfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
11348abc0ccfSmrg        fi])
11358abc0ccfSmrgfi])
11368abc0ccfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
11378abc0ccfSmrg]) # XORG_WITH_FOP
11387a0395d0Smrg
113940c5344fSmrg# XORG_WITH_M4([MIN-VERSION])
114040c5344fSmrg# ---------------------------
114140c5344fSmrg# Minimum version: 1.19.0
114240c5344fSmrg#
114340c5344fSmrg# This macro attempts to locate an m4 macro processor which supports
114440c5344fSmrg# -I option and is only useful for modules relying on M4 in order to
114540c5344fSmrg# expand macros in source code files.
114640c5344fSmrg#
114740c5344fSmrg# Interface to module:
114840c5344fSmrg# M4:	 	returns the path of the m4 program found
114940c5344fSmrg#		returns the path set by the user in the environment
115040c5344fSmrg#
115140c5344fSmrgAC_DEFUN([XORG_WITH_M4], [
115240c5344fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
115340c5344fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
115440c5344fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
115540c5344fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
115640c5344fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
115740c5344fSmrg   [$PATH:/usr/gnu/bin])])
115840c5344fSmrg
115940c5344fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
116040c5344fSmrg]) # XORG_WITH_M4
116140c5344fSmrg
11628abc0ccfSmrg# XORG_WITH_PS2PDF([DEFAULT])
11638abc0ccfSmrg# ----------------
11648abc0ccfSmrg# Minimum version: 1.6.0
11658abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
11662adc0320Smrg#
11678abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
11688abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
11698abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
11708abc0ccfSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
11718abc0ccfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
11728abc0ccfSmrg# --with-ps2pdf assumes 'auto'.
11737a0395d0Smrg#
11748abc0ccfSmrg# Interface to module:
11758abc0ccfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
11768abc0ccfSmrg# PS2PDF:	returns the path of the ps2pdf program found
11778abc0ccfSmrg#		returns the path set by the user in the environment
11788abc0ccfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
11798abc0ccfSmrg#		 'no' user instructs the module not to use ps2pdf
11808abc0ccfSmrg#
11818abc0ccfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
11828abc0ccfSmrg#
11838abc0ccfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
11848abc0ccfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
11858abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
11868abc0ccfSmrgAC_ARG_WITH(ps2pdf,
11878abc0ccfSmrg	AS_HELP_STRING([--with-ps2pdf],
11888abc0ccfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
11898abc0ccfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
11908abc0ccfSmrgm4_undefine([_defopt])
11917a0395d0Smrg
11928abc0ccfSmrgif test "x$use_ps2pdf" = x"auto"; then
11938abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
11948abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
11958abc0ccfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
11968abc0ccfSmrg	have_ps2pdf=no
11978abc0ccfSmrg   else
11988abc0ccfSmrg        have_ps2pdf=yes
11998abc0ccfSmrg   fi
12008abc0ccfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
12018abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
12028abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
12038abc0ccfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
12048abc0ccfSmrg   fi
12058abc0ccfSmrg   have_ps2pdf=yes
12068abc0ccfSmrgelif test "x$use_ps2pdf" = x"no" ; then
12078abc0ccfSmrg   if test "x$PS2PDF" != "x"; then
12088abc0ccfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
12098abc0ccfSmrg   fi
12108abc0ccfSmrg   have_ps2pdf=no
12117366012aSmrgelse
12128abc0ccfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
12137366012aSmrgfi
12148abc0ccfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
12158abc0ccfSmrg]) # XORG_WITH_PS2PDF
12167a0395d0Smrg
12178abc0ccfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
12182adc0320Smrg# ----------------
12198abc0ccfSmrg# Minimum version: 1.6.0
12202adc0320Smrg#
12212adc0320Smrg# Documentation tools are not always available on all platforms and sometimes
12228abc0ccfSmrg# not at the appropriate level. This macro enables a builder to skip all
12238abc0ccfSmrg# documentation targets except traditional man pages.
12248abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12258abc0ccfSmrg# maximum flexibilty in controlling documentation building.
12268abc0ccfSmrg# Refer to:
12278abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
12288abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12298abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12308abc0ccfSmrg# XORG_WITH_FOP           --with-fop
12318abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
12328abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
12332adc0320Smrg#
12342adc0320Smrg# Interface to module:
12358abc0ccfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
12368abc0ccfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
12378abc0ccfSmrg#		 'no' user instructs the module not to generate docs
12388abc0ccfSmrg# parm1:	specify the default value, yes or no.
12392adc0320Smrg#
12408abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
12418abc0ccfSmrgm4_define([docs_default], m4_default([$1], [yes]))
12428abc0ccfSmrgAC_ARG_ENABLE(docs,
12438abc0ccfSmrg	AS_HELP_STRING([--enable-docs],
12448abc0ccfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
12458abc0ccfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
12468abc0ccfSmrgm4_undefine([docs_default])
12478abc0ccfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
12488abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
12498abc0ccfSmrgAC_MSG_RESULT([$build_docs])
12508abc0ccfSmrg]) # XORG_ENABLE_DOCS
12512adc0320Smrg
12528abc0ccfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
12538abc0ccfSmrg# ----------------
12548abc0ccfSmrg# Minimum version: 1.6.0
12552852888eSmrg#
12568abc0ccfSmrg# This macro enables a builder to skip all developer documentation.
12578abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12588abc0ccfSmrg# maximum flexibilty in controlling documentation building.
12598abc0ccfSmrg# Refer to:
12608abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
12618abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12628abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12638abc0ccfSmrg# XORG_WITH_FOP           --with-fop
12648abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
12658abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
12662852888eSmrg#
12672852888eSmrg# Interface to module:
12688abc0ccfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
12698abc0ccfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
12708abc0ccfSmrg#			'no' user instructs the module not to generate developer docs
12718abc0ccfSmrg# parm1:		specify the default value, yes or no.
12722852888eSmrg#
12738abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
12748abc0ccfSmrgm4_define([devel_default], m4_default([$1], [yes]))
12758abc0ccfSmrgAC_ARG_ENABLE(devel-docs,
12768abc0ccfSmrg	AS_HELP_STRING([--enable-devel-docs],
12778abc0ccfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
12788abc0ccfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
12798abc0ccfSmrgm4_undefine([devel_default])
12808abc0ccfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
12818abc0ccfSmrgAC_MSG_CHECKING([whether to build developer documentation])
12828abc0ccfSmrgAC_MSG_RESULT([$build_devel_docs])
12838abc0ccfSmrg]) # XORG_ENABLE_DEVEL_DOCS
12842852888eSmrg
12858abc0ccfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
12868abc0ccfSmrg# ----------------
12878abc0ccfSmrg# Minimum version: 1.6.0
12888abc0ccfSmrg#
12898abc0ccfSmrg# This macro enables a builder to skip all functional specification targets.
12908abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12918abc0ccfSmrg# maximum flexibilty in controlling documentation building.
12928abc0ccfSmrg# Refer to:
12938abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
12948abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12958abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12968abc0ccfSmrg# XORG_WITH_FOP           --with-fop
12978abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
12988abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
12998abc0ccfSmrg#
13008abc0ccfSmrg# Interface to module:
13018abc0ccfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
13028abc0ccfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
13038abc0ccfSmrg#			'no' user instructs the module not to generate specs
13048abc0ccfSmrg# parm1:		specify the default value, yes or no.
13058abc0ccfSmrg#
13068abc0ccfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
13078abc0ccfSmrgm4_define([spec_default], m4_default([$1], [yes]))
13088abc0ccfSmrgAC_ARG_ENABLE(specs,
13098abc0ccfSmrg	AS_HELP_STRING([--enable-specs],
13108abc0ccfSmrg	   [Enable building the specs (default: ]spec_default[)]),
13118abc0ccfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
13128abc0ccfSmrgm4_undefine([spec_default])
13138abc0ccfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
13148abc0ccfSmrgAC_MSG_CHECKING([whether to build functional specifications])
13158abc0ccfSmrgAC_MSG_RESULT([$build_specs])
13168abc0ccfSmrg]) # XORG_ENABLE_SPECS
13172852888eSmrg
13188abc0ccfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
13198abc0ccfSmrg# ----------------------------------------------
13208abc0ccfSmrg# Minimum version: 1.13.0
132196402570Smrg#
13228abc0ccfSmrg# This macro enables a builder to enable/disable unit testing
13238abc0ccfSmrg# It makes no assumption about the test cases implementation
13248abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
13258abc0ccfSmrg# They may or may not use the software utility library GLib
132696402570Smrg#
13278abc0ccfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
13288abc0ccfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
13298abc0ccfSmrg# The variable enable_unit_tests is used by other macros in this file.
133096402570Smrg#
133196402570Smrg# Interface to module:
13328abc0ccfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
13338abc0ccfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
13348abc0ccfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
13358abc0ccfSmrg#			'no' user instructs the module not to build tests
13368abc0ccfSmrg# parm1:		specify the default value, yes or no.
133796402570Smrg#
13388abc0ccfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
13398abc0ccfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
13408abc0ccfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
13418abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
13428abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
13438abc0ccfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
13448abc0ccfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
13458abc0ccfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
134696402570Smrgm4_undefine([_defopt])
13478abc0ccfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
13488abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
13498abc0ccfSmrgAC_MSG_RESULT([$enable_unit_tests])
13508abc0ccfSmrg]) # XORG_ENABLE_UNIT_TESTS
135196402570Smrg
13528abc0ccfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
13538abc0ccfSmrg# ------------------------------------------------------
13548abc0ccfSmrg# Minimum version: 1.17.0
13552adc0320Smrg#
13568abc0ccfSmrg# This macro enables a builder to enable/disable integration testing
13578abc0ccfSmrg# It makes no assumption about the test cases' implementation
13588abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
13592adc0320Smrg#
13608abc0ccfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
13618abc0ccfSmrg# usually requires less dependencies and may be built and run under less
13628abc0ccfSmrg# stringent environments than integration tests.
13632adc0320Smrg#
13648abc0ccfSmrg# Interface to module:
13658abc0ccfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
13668abc0ccfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
13678abc0ccfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
13688abc0ccfSmrg#                             'no' user instructs the module not to build tests
13698abc0ccfSmrg# parm1:                      specify the default value, yes or no.
13702adc0320Smrg#
13718abc0ccfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
13728abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
13738abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
13748abc0ccfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
13758abc0ccfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
13768abc0ccfSmrg	[enable_integration_tests=$enableval],
13778abc0ccfSmrg	[enable_integration_tests=]_defopt)
13782852888eSmrgm4_undefine([_defopt])
13798abc0ccfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
13808abc0ccfSmrg	[test "x$enable_integration_tests" != xno])
13818abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
13828abc0ccfSmrgAC_MSG_RESULT([$enable_integration_tests])
13838abc0ccfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
13842adc0320Smrg
13858abc0ccfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
13868abc0ccfSmrg# ----------------------------------------
13878abc0ccfSmrg# Minimum version: 1.13.0
13882adc0320Smrg#
13898abc0ccfSmrg# GLib is a library which provides advanced data structures and functions.
13908abc0ccfSmrg# This macro enables a module to test for the presence of Glib.
13912adc0320Smrg#
13928abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
13938abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
13942adc0320Smrg#
13958abc0ccfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
13968abc0ccfSmrg# test support usually requires less dependencies and may be built and run under
13978abc0ccfSmrg# less stringent environments than integration tests.
13982adc0320Smrg#
13992adc0320Smrg# Interface to module:
14008abc0ccfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
14018abc0ccfSmrg# with_glib: used in configure.ac to know if GLib has been found
14028abc0ccfSmrg# --with-glib:	'yes' user instructs the module to use glib
14038abc0ccfSmrg#		'no' user instructs the module not to use glib
14042adc0320Smrg#
14058abc0ccfSmrgAC_DEFUN([XORG_WITH_GLIB],[
14068abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
14078abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
14088abc0ccfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
14098abc0ccfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
14108abc0ccfSmrg	[with_glib=$withval], [with_glib=]_defopt)
14112852888eSmrgm4_undefine([_defopt])
14122adc0320Smrg
14138abc0ccfSmrghave_glib=no
14148abc0ccfSmrg# Do not probe GLib if user explicitly disabled unit testing
14158abc0ccfSmrgif test "x$enable_unit_tests" != x"no"; then
14168abc0ccfSmrg  # Do not probe GLib if user explicitly disabled it
14178abc0ccfSmrg  if test "x$with_glib" != x"no"; then
14188abc0ccfSmrg    m4_ifval(
14198abc0ccfSmrg      [$1],
14208abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
14218abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
14228abc0ccfSmrg    )
14238abc0ccfSmrg  fi
14242adc0320Smrgfi
14252adc0320Smrg
14268abc0ccfSmrg# Not having GLib when unit testing has been explicitly requested is an error
14278abc0ccfSmrgif test "x$enable_unit_tests" = x"yes"; then
14288abc0ccfSmrg  if test "x$have_glib" = x"no"; then
14298abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14308abc0ccfSmrg  fi
14312adc0320Smrgfi
14322adc0320Smrg
14338abc0ccfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
14348abc0ccfSmrgif test "x$enable_unit_tests" = x"no"; then
14358abc0ccfSmrg  if test "x$with_glib" = x"yes"; then
14368abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
14378abc0ccfSmrg  fi
14382adc0320Smrgfi
14392adc0320Smrg
14408abc0ccfSmrg# Not having GLib when it has been explicitly requested is an error
14418abc0ccfSmrgif test "x$with_glib" = x"yes"; then
14428abc0ccfSmrg  if test "x$have_glib" = x"no"; then
14438abc0ccfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
14448abc0ccfSmrg  fi
14458abc0ccfSmrgfi
14462adc0320Smrg
14478abc0ccfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
14488abc0ccfSmrg]) # XORG_WITH_GLIB
14498abc0ccfSmrg
14508abc0ccfSmrg# XORG_LD_WRAP([required|optional])
14518abc0ccfSmrg# ---------------------------------
14528abc0ccfSmrg# Minimum version: 1.13.0
14532adc0320Smrg#
14548abc0ccfSmrg# Check if linker supports -wrap, passed via compiler flags
14552adc0320Smrg#
14568abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
14578abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
14582adc0320Smrg#
14598abc0ccfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
14608abc0ccfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
14618abc0ccfSmrg# available, an argument of "optional" allows use when some unit tests require
14628abc0ccfSmrg# ld -wrap and others do not.
14632adc0320Smrg#
14648abc0ccfSmrgAC_DEFUN([XORG_LD_WRAP],[
14658abc0ccfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
14668abc0ccfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
14678abc0ccfSmrg                      void __wrap_exit(int status) { return; }],
14688abc0ccfSmrg                     [exit(0);])])
14698abc0ccfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
14708abc0ccfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
14718abc0ccfSmrg  if test "x$have_ld_wrap" = x"no"; then
14728abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
14738abc0ccfSmrg  fi
14742adc0320Smrgfi
14758abc0ccfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
14768abc0ccfSmrg#
14778abc0ccfSmrg]) # XORG_LD_WRAP
147896402570Smrg
14798abc0ccfSmrg# XORG_CHECK_LINKER_FLAGS
14808abc0ccfSmrg# -----------------------
14818abc0ccfSmrg# SYNOPSIS
14822adc0320Smrg#
14838abc0ccfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
14842adc0320Smrg#
14858abc0ccfSmrg# DESCRIPTION
14862adc0320Smrg#
14878abc0ccfSmrg#   Check whether the given linker FLAGS work with the current language's
14888abc0ccfSmrg#   linker, or whether they give an error.
14892adc0320Smrg#
14908abc0ccfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
14918abc0ccfSmrg#   success/failure.
14922adc0320Smrg#
14938abc0ccfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
14942adc0320Smrg#
14958abc0ccfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
14962adc0320Smrg#
14978abc0ccfSmrg# LICENSE
14982adc0320Smrg#
14998abc0ccfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
15008abc0ccfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
15018abc0ccfSmrg#   Copyright (c) 2009 Matteo Frigo
15022adc0320Smrg#
15038abc0ccfSmrg#   This program is free software: you can redistribute it and/or modify it
15048abc0ccfSmrg#   under the terms of the GNU General Public License as published by the
15058abc0ccfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
15068abc0ccfSmrg#   option) any later version.
15072adc0320Smrg#
15088abc0ccfSmrg#   This program is distributed in the hope that it will be useful, but
15098abc0ccfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
15108abc0ccfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15118abc0ccfSmrg#   Public License for more details.
15122adc0320Smrg#
15138abc0ccfSmrg#   You should have received a copy of the GNU General Public License along
15148abc0ccfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
15152adc0320Smrg#
15168abc0ccfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
15178abc0ccfSmrg#   gives unlimited permission to copy, distribute and modify the configure
15188abc0ccfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
15198abc0ccfSmrg#   need not follow the terms of the GNU General Public License when using
15208abc0ccfSmrg#   or distributing such scripts, even though portions of the text of the
15218abc0ccfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
15228abc0ccfSmrg#   all other use of the material that constitutes the Autoconf Macro.
15232adc0320Smrg#
15248abc0ccfSmrg#   This special exception to the GPL applies to versions of the Autoconf
15258abc0ccfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
15268abc0ccfSmrg#   modified version of the Autoconf Macro, you may extend this special
15278abc0ccfSmrg#   exception to the GPL to apply to your modified version as well.#
15288abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
15298abc0ccfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
15308abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
15318abc0ccfSmrgAS_LITERAL_IF([$1],
15328abc0ccfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
15338abc0ccfSmrg      ax_save_FLAGS=$LDFLAGS
15348abc0ccfSmrg      LDFLAGS="$1"
15358abc0ccfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
15368abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15378abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15388abc0ccfSmrg      LDFLAGS=$ax_save_FLAGS])],
15398abc0ccfSmrg  [ax_save_FLAGS=$LDFLAGS
15408abc0ccfSmrg   LDFLAGS="$1"
15418abc0ccfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
15428abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
15438abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
15448abc0ccfSmrg   LDFLAGS=$ax_save_FLAGS])
15458abc0ccfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
15468abc0ccfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
15478abc0ccfSmrgif test "x$xorg_check_linker_flags" = xyes; then
15488abc0ccfSmrg	m4_default([$2], :)
15498abc0ccfSmrgelse
15508abc0ccfSmrg	m4_default([$3], :)
15518abc0ccfSmrgfi
15528abc0ccfSmrg]) # XORG_CHECK_LINKER_FLAGS
15532adc0320Smrg
15548abc0ccfSmrg# XORG_MEMORY_CHECK_FLAGS
15558abc0ccfSmrg# -----------------------
15568abc0ccfSmrg# Minimum version: 1.16.0
15572852888eSmrg#
15588abc0ccfSmrg# This macro attempts to find appropriate memory checking functionality
15598abc0ccfSmrg# for various platforms which unit testing code may use to catch various
15608abc0ccfSmrg# forms of memory allocation and access errors in testing.
15612852888eSmrg#
15622852888eSmrg# Interface to module:
15638abc0ccfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
15648abc0ccfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
15652852888eSmrg#
15668abc0ccfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
156796402570Smrg#
15688abc0ccfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
15698abc0ccfSmrg
15708abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15718abc0ccfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
15728abc0ccfSmrg           [Environment variables to enable memory checking in tests])
15738abc0ccfSmrg
15748abc0ccfSmrg# Check for different types of support on different platforms
15758abc0ccfSmrgcase $host_os in
15768abc0ccfSmrg    solaris*)
15778abc0ccfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
15788abc0ccfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
15798abc0ccfSmrg        ;;
15808abc0ccfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
15818abc0ccfSmrg        # both directly and inverted, so should not be 0 or 255.
15828abc0ccfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
15838abc0ccfSmrg        ;;
15848abc0ccfSmrg    darwin*)
15858abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
15868abc0ccfSmrg        ;;
15878abc0ccfSmrg    *bsd*)
15888abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
15898abc0ccfSmrg        ;;
15908abc0ccfSmrgesac
15918abc0ccfSmrg
15928abc0ccfSmrg# User supplied flags override default flags
15938abc0ccfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
15948abc0ccfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
15958abc0ccfSmrgfi
15968abc0ccfSmrg
15978abc0ccfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
15988abc0ccfSmrg]) # XORG_WITH_LINT
15998abc0ccfSmrg
16008abc0ccfSmrg# XORG_CHECK_MALLOC_ZERO
16018abc0ccfSmrg# ----------------------
16028abc0ccfSmrg# Minimum version: 1.0.0
160396402570Smrg#
16048abc0ccfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
16058abc0ccfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
16068abc0ccfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
16078abc0ccfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
16088abc0ccfSmrgAC_ARG_ENABLE(malloc0returnsnull,
16098abc0ccfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
16108abc0ccfSmrg		       [malloc(0) returns NULL (default: auto)]),
16118abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
16128abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16138abc0ccfSmrg
16148abc0ccfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
16158abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
161640c5344fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
161740c5344fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
16188abc0ccfSmrg#include <stdlib.h>
16198abc0ccfSmrg],[
16208abc0ccfSmrg    char *m0, *r0, *c0, *p;
16218abc0ccfSmrg    m0 = malloc(0);
16228abc0ccfSmrg    p = malloc(10);
16238abc0ccfSmrg    r0 = realloc(p,0);
16248abc0ccfSmrg    c0 = calloc(0,10);
16258abc0ccfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
16268abc0ccfSmrg])],
162740c5344fSmrg		[xorg_cv_malloc0_returns_null=yes],
162840c5344fSmrg		[xorg_cv_malloc0_returns_null=no])])
162940c5344fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16308abc0ccfSmrgfi
16318abc0ccfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16328abc0ccfSmrg
16338abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
16348abc0ccfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
16358abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
16368abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
16378abc0ccfSmrgelse
16388abc0ccfSmrg	MALLOC_ZERO_CFLAGS=""
16398abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=""
16408abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS=""
16418abc0ccfSmrgfi
16428abc0ccfSmrg
16438abc0ccfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
16448abc0ccfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
16458abc0ccfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
16468abc0ccfSmrg]) # XORG_CHECK_MALLOC_ZERO
16478abc0ccfSmrg
16488abc0ccfSmrg# XORG_WITH_LINT()
16498abc0ccfSmrg# ----------------
16508abc0ccfSmrg# Minimum version: 1.1.0
16518abc0ccfSmrg#
16528abc0ccfSmrg# This macro enables the use of a tool that flags some suspicious and
16538abc0ccfSmrg# non-portable constructs (likely to be bugs) in C language source code.
16548abc0ccfSmrg# It will attempt to locate the tool and use appropriate options.
16558abc0ccfSmrg# There are various lint type tools on different platforms.
165696402570Smrg#
165796402570Smrg# Interface to module:
16588abc0ccfSmrg# LINT:		returns the path to the tool found on the platform
16598abc0ccfSmrg#		or the value set to LINT on the configure cmd line
16608abc0ccfSmrg#		also an Automake conditional
16618abc0ccfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
16628abc0ccfSmrg#
16638abc0ccfSmrg# --with-lint:	'yes' user instructs the module to use lint
16648abc0ccfSmrg#		'no' user instructs the module not to use lint (default)
16658abc0ccfSmrg#
16668abc0ccfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
16678abc0ccfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
16688abc0ccfSmrg#
16698abc0ccfSmrgAC_DEFUN([XORG_WITH_LINT],[
16708abc0ccfSmrg
16718abc0ccfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
16728abc0ccfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
16738abc0ccfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
16748abc0ccfSmrg		[Use a lint-style source code checker (default: disabled)])],
16758abc0ccfSmrg		[use_lint=$withval], [use_lint=no])
16768abc0ccfSmrg
16778abc0ccfSmrg# Obtain platform specific info like program name and options
16788abc0ccfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
16798abc0ccfSmrgcase $host_os in
16808abc0ccfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
16818abc0ccfSmrg	lint_name=splint
16828abc0ccfSmrg	lint_options="-badflag"
16838abc0ccfSmrg	;;
16848abc0ccfSmrg  *freebsd* | *netbsd*)
16858abc0ccfSmrg	lint_name=lint
16868abc0ccfSmrg	lint_options="-u -b"
16878abc0ccfSmrg	;;
16888abc0ccfSmrg  *solaris*)
16898abc0ccfSmrg	lint_name=lint
16908abc0ccfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
16918abc0ccfSmrg	;;
16928abc0ccfSmrgesac
16938abc0ccfSmrg
16948abc0ccfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
16958abc0ccfSmrgif test "x$use_lint" = x"yes" ; then
16968abc0ccfSmrg   AC_PATH_PROG([LINT], [$lint_name])
16978abc0ccfSmrg   if test "x$LINT" = "x"; then
16988abc0ccfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
16998abc0ccfSmrg   fi
17008abc0ccfSmrgelif test "x$use_lint" = x"no" ; then
17018abc0ccfSmrg   if test "x$LINT" != "x"; then
17028abc0ccfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
17038abc0ccfSmrg   fi
17048abc0ccfSmrgelse
17058abc0ccfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17068abc0ccfSmrgfi
17078abc0ccfSmrg
17088abc0ccfSmrg# User supplied flags override default flags
17098abc0ccfSmrgif test "x$LINT_FLAGS" != "x"; then
17108abc0ccfSmrg   lint_options=$LINT_FLAGS
17118abc0ccfSmrgfi
17128abc0ccfSmrg
17138abc0ccfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
17148abc0ccfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17158abc0ccfSmrg
17168abc0ccfSmrg]) # XORG_WITH_LINT
17178abc0ccfSmrg
17188abc0ccfSmrg# XORG_LINT_LIBRARY(LIBNAME)
17198abc0ccfSmrg# --------------------------
17208abc0ccfSmrg# Minimum version: 1.1.0
17218abc0ccfSmrg#
17228abc0ccfSmrg# Sets up flags for building lint libraries for checking programs that call
17238abc0ccfSmrg# functions in the library.
17248abc0ccfSmrg#
17258abc0ccfSmrg# Interface to module:
17268abc0ccfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
17278abc0ccfSmrg# MAKE_LINT_LIB		- Automake conditional
17288abc0ccfSmrg#
17298abc0ccfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
17308abc0ccfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
17318abc0ccfSmrg
17328abc0ccfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
17338abc0ccfSmrgAC_REQUIRE([XORG_WITH_LINT])
17348abc0ccfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
17358abc0ccfSmrg	[Create lint library (default: disabled)])],
17368abc0ccfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17378abc0ccfSmrg
17388abc0ccfSmrgif test "x$make_lint_lib" = x"yes" ; then
17398abc0ccfSmrg   LINTLIB=llib-l$1.ln
17408abc0ccfSmrg   if test "x$LINT" = "x"; then
17418abc0ccfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
17428abc0ccfSmrg   fi
17438abc0ccfSmrgelif test "x$make_lint_lib" != x"no" ; then
17448abc0ccfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
17458abc0ccfSmrgfi
17468abc0ccfSmrg
17478abc0ccfSmrgAC_SUBST(LINTLIB)
17488abc0ccfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
17498abc0ccfSmrg
17508abc0ccfSmrg]) # XORG_LINT_LIBRARY
17518abc0ccfSmrg
17528abc0ccfSmrg# XORG_COMPILER_BRAND
17538abc0ccfSmrg# -------------------
17548abc0ccfSmrg# Minimum version: 1.14.0
17558abc0ccfSmrg#
17568abc0ccfSmrg# Checks for various brands of compilers and sets flags as appropriate:
17578abc0ccfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
17588abc0ccfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
17598abc0ccfSmrg#   clang compiler - sets CLANGCC to "yes"
17608abc0ccfSmrg#   Intel compiler - sets INTELCC to "yes"
17618abc0ccfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
17628abc0ccfSmrg#
17638abc0ccfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
17648abc0ccfSmrgAC_LANG_CASE(
17658abc0ccfSmrg	[C], [
17668abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
17678abc0ccfSmrg	],
17688abc0ccfSmrg	[C++], [
17698abc0ccfSmrg		AC_REQUIRE([AC_PROG_CXX])
17708abc0ccfSmrg	]
17718abc0ccfSmrg)
17728abc0ccfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
17738abc0ccfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
17748abc0ccfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
17758abc0ccfSmrg]) # XORG_COMPILER_BRAND
17768abc0ccfSmrg
17778abc0ccfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
17788abc0ccfSmrg# ---------------
17798abc0ccfSmrg# Minimum version: 1.16.0
17808abc0ccfSmrg#
17818abc0ccfSmrg# Test if the compiler works when passed the given flag as a command line argument.
17828abc0ccfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
17838abc0ccfSmrg# next flag in the list until there are no more options.
17848abc0ccfSmrg#
17858abc0ccfSmrg# Note that this does not guarantee that the compiler supports the flag as some
17868abc0ccfSmrg# compilers will simply ignore arguments that they do not understand, but we do
17878abc0ccfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
17888abc0ccfSmrg# -Werror=unused-command-line-argument
17898abc0ccfSmrg#
17908abc0ccfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
17918abc0ccfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
17928abc0ccfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
17938abc0ccfSmrg
17948abc0ccfSmrgAC_LANG_COMPILER_REQUIRE
17958abc0ccfSmrg
17968abc0ccfSmrgAC_LANG_CASE(
17978abc0ccfSmrg	[C], [
17988abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
17998abc0ccfSmrg		define([PREFIX], [C])
18008abc0ccfSmrg		define([CACHE_PREFIX], [cc])
18018abc0ccfSmrg		define([COMPILER], [$CC])
18028abc0ccfSmrg	],
18038abc0ccfSmrg	[C++], [
18048abc0ccfSmrg		define([PREFIX], [CXX])
18058abc0ccfSmrg		define([CACHE_PREFIX], [cxx])
18068abc0ccfSmrg		define([COMPILER], [$CXX])
18078abc0ccfSmrg	]
18088abc0ccfSmrg)
18098abc0ccfSmrg
18108abc0ccfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
18118abc0ccfSmrg
18128abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
18138abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18148abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
18158abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
18168abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18178abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
18188abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
18198abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
18208abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18218abc0ccfSmrgfi
18228abc0ccfSmrg
18238abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
18248abc0ccfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
18258abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18268abc0ccfSmrg	fi
18278abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18288abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
18298abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
18308abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
18318abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
18328abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
18338abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
18348abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18358abc0ccfSmrgfi
18368abc0ccfSmrg
18378abc0ccfSmrgfound="no"
18388abc0ccfSmrgm4_foreach([flag], m4_cdr($@), [
18398abc0ccfSmrg	if test $found = "no" ; then
184040c5344fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
18418abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
18428abc0ccfSmrg		fi
18438abc0ccfSmrg
184440c5344fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
18458abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
18468abc0ccfSmrg		fi
18478abc0ccfSmrg
18488abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
18498abc0ccfSmrg
18508abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
185140c5344fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
18528abc0ccfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
18538abc0ccfSmrg		AC_CACHE_VAL($cacheid,
18548abc0ccfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
18558abc0ccfSmrg					     [eval $cacheid=yes],
18568abc0ccfSmrg					     [eval $cacheid=no])])
18578abc0ccfSmrg
18588abc0ccfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
18598abc0ccfSmrg
18608abc0ccfSmrg		eval supported=\$$cacheid
18618abc0ccfSmrg		AC_MSG_RESULT([$supported])
18628abc0ccfSmrg		if test "$supported" = "yes" ; then
18638abc0ccfSmrg			$1="$$1 ]flag["
18648abc0ccfSmrg			found="yes"
18658abc0ccfSmrg		fi
18668abc0ccfSmrg	fi
18678abc0ccfSmrg])
18688abc0ccfSmrg]) # XORG_TESTSET_CFLAG
18698abc0ccfSmrg
18708abc0ccfSmrg# XORG_COMPILER_FLAGS
18718abc0ccfSmrg# ---------------
18728abc0ccfSmrg# Minimum version: 1.16.0
18738abc0ccfSmrg#
18748abc0ccfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
18758abc0ccfSmrg# arguments supported by the selected compiler which do NOT alter the generated
18768abc0ccfSmrg# code.  These arguments will cause the compiler to print various warnings
18778abc0ccfSmrg# during compilation AND turn a conservative set of warnings into errors.
18788abc0ccfSmrg#
18798abc0ccfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
18808abc0ccfSmrg# future versions of util-macros as options are added to new compilers.
18818abc0ccfSmrg#
18828abc0ccfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
18838abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
18848abc0ccfSmrg
18858abc0ccfSmrgAC_ARG_ENABLE(selective-werror,
18868abc0ccfSmrg              AS_HELP_STRING([--disable-selective-werror],
18878abc0ccfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
18888abc0ccfSmrg              [SELECTIVE_WERROR=$enableval],
18898abc0ccfSmrg              [SELECTIVE_WERROR=yes])
18908abc0ccfSmrg
18918abc0ccfSmrgAC_LANG_CASE(
18928abc0ccfSmrg        [C], [
18938abc0ccfSmrg                define([PREFIX], [C])
18948abc0ccfSmrg        ],
18958abc0ccfSmrg        [C++], [
18968abc0ccfSmrg                define([PREFIX], [CXX])
18978abc0ccfSmrg        ]
18988abc0ccfSmrg)
18998abc0ccfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
19008abc0ccfSmrgif test "x$SUNCC" = "xyes"; then
19018abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="-v"
19028abc0ccfSmrgelse
19038abc0ccfSmrg    [BASE_]PREFIX[FLAGS]=""
19048abc0ccfSmrgfi
19058abc0ccfSmrg
19068abc0ccfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
19078abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
19088abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
19098abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
19108abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
19118abc0ccfSmrg
19128abc0ccfSmrgAC_LANG_CASE(
19138abc0ccfSmrg	[C], [
19148abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
19158abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
19168abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
19178abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
191840c5344fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
19198abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
19208abc0ccfSmrg	]
19218abc0ccfSmrg)
19228abc0ccfSmrg
19238abc0ccfSmrg# This chunk adds additional warnings that could catch undesired effects.
19248abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
19258abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
19268abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
19278abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
19288abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
19298abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
193040c5344fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19318abc0ccfSmrg
19328abc0ccfSmrg# These are currently disabled because they are noisy.  They will be enabled
19338abc0ccfSmrg# in the future once the codebase is sufficiently modernized to silence
19348abc0ccfSmrg# them.  For now, I don't want them to drown out the other warnings.
19358abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
19368abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
193740c5344fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
19388abc0ccfSmrg
19398abc0ccfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
19408abc0ccfSmrg# when there are problems that should be fixed.
19418abc0ccfSmrg
19428abc0ccfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
19438abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
19448abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
19458abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
19468abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
19478abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
19488abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
19498abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
19508abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
19518abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
19528abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
19538abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
19548abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
19558abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
19568abc0ccfSmrgelse
19578abc0ccfSmrgAC_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])
19588abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
19598abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
19608abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
19618abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
19628abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
19638abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
19648abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
19658abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
19668abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
19678abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
19688abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
19698abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
19708abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
19718abc0ccfSmrgfi
19728abc0ccfSmrg
19738abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
19748abc0ccfSmrg]) # XORG_COMPILER_FLAGS
19758abc0ccfSmrg
19768abc0ccfSmrg# XORG_CWARNFLAGS
19778abc0ccfSmrg# ---------------
19788abc0ccfSmrg# Minimum version: 1.2.0
19798abc0ccfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
19808abc0ccfSmrg#
19818abc0ccfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
19828abc0ccfSmrg#
19838abc0ccfSmrg# This function is deprecated because it defines -fno-strict-aliasing
19848abc0ccfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
19858abc0ccfSmrg# is needed, then it should be added explicitly in the module when
19868abc0ccfSmrg# it is updated to use BASE_CFLAGS.
19878abc0ccfSmrg#
19888abc0ccfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
19898abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
19908abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19918abc0ccfSmrgAC_LANG_CASE(
19928abc0ccfSmrg	[C], [
19938abc0ccfSmrg		CWARNFLAGS="$BASE_CFLAGS"
19948abc0ccfSmrg		if  test "x$GCC" = xyes ; then
19958abc0ccfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
19968abc0ccfSmrg		fi
19978abc0ccfSmrg		AC_SUBST(CWARNFLAGS)
19988abc0ccfSmrg	]
19998abc0ccfSmrg)
20008abc0ccfSmrg]) # XORG_CWARNFLAGS
20018abc0ccfSmrg
20028abc0ccfSmrg# XORG_STRICT_OPTION
20038abc0ccfSmrg# -----------------------
20048abc0ccfSmrg# Minimum version: 1.3.0
20058abc0ccfSmrg#
20068abc0ccfSmrg# Add configure option to enable strict compilation flags, such as treating
20078abc0ccfSmrg# warnings as fatal errors.
20088abc0ccfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
20098abc0ccfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
20108abc0ccfSmrg#
20118abc0ccfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
20128abc0ccfSmrg# when strict compilation is unconditionally desired.
20138abc0ccfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
20148abc0ccfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
20158abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
20168abc0ccfSmrg
20178abc0ccfSmrgAC_ARG_ENABLE(strict-compilation,
20188abc0ccfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
20198abc0ccfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
20208abc0ccfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
20218abc0ccfSmrg
20228abc0ccfSmrgAC_LANG_CASE(
20238abc0ccfSmrg        [C], [
20248abc0ccfSmrg                define([PREFIX], [C])
20258abc0ccfSmrg        ],
20268abc0ccfSmrg        [C++], [
20278abc0ccfSmrg                define([PREFIX], [CXX])
20288abc0ccfSmrg        ]
20298abc0ccfSmrg)
20308abc0ccfSmrg
20318abc0ccfSmrg[STRICT_]PREFIX[FLAGS]=""
20328abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
20338abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
20348abc0ccfSmrg
20358abc0ccfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
20368abc0ccfSmrg# activate it with -Werror, so we add it here explicitly.
20378abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
20388abc0ccfSmrg
20398abc0ccfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
20408abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
20418abc0ccfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
20428abc0ccfSmrgfi
20438abc0ccfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
20448abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
20458abc0ccfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
20468abc0ccfSmrg]) # XORG_STRICT_OPTION
20478abc0ccfSmrg
20488abc0ccfSmrg# XORG_DEFAULT_OPTIONS
20498abc0ccfSmrg# --------------------
20508abc0ccfSmrg# Minimum version: 1.3.0
20518abc0ccfSmrg#
20528abc0ccfSmrg# Defines default options for X.Org modules.
20538abc0ccfSmrg#
20548abc0ccfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
20558abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])
20568abc0ccfSmrgXORG_COMPILER_FLAGS
20578abc0ccfSmrgXORG_CWARNFLAGS
20588abc0ccfSmrgXORG_STRICT_OPTION
20598abc0ccfSmrgXORG_RELEASE_VERSION
20608abc0ccfSmrgXORG_CHANGELOG
20618abc0ccfSmrgXORG_INSTALL
20628abc0ccfSmrgXORG_MANPAGE_SECTIONS
20638abc0ccfSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
20648abc0ccfSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
20658abc0ccfSmrg]) # XORG_DEFAULT_OPTIONS
20668abc0ccfSmrg
20678abc0ccfSmrg# XORG_INSTALL()
20688abc0ccfSmrg# ----------------
20698abc0ccfSmrg# Minimum version: 1.4.0
20708abc0ccfSmrg#
20718abc0ccfSmrg# Defines the variable INSTALL_CMD as the command to copy
20728abc0ccfSmrg# INSTALL from $prefix/share/util-macros.
20738abc0ccfSmrg#
20748abc0ccfSmrgAC_DEFUN([XORG_INSTALL], [
20758abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
20768abc0ccfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
20778abc0ccfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
20788abc0ccfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
20798abc0ccfSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
20808abc0ccfSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
20818abc0ccfSmrgAC_SUBST([INSTALL_CMD])
20828abc0ccfSmrg]) # XORG_INSTALL
20838abc0ccfSmrgdnl Copyright 2005 Red Hat, Inc
20848abc0ccfSmrgdnl
20858abc0ccfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
20868abc0ccfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
20878abc0ccfSmrgdnl the above copyright notice appear in all copies and that both that
20888abc0ccfSmrgdnl copyright notice and this permission notice appear in supporting
20898abc0ccfSmrgdnl documentation.
20908abc0ccfSmrgdnl
20918abc0ccfSmrgdnl The above copyright notice and this permission notice shall be included
20928abc0ccfSmrgdnl in all copies or substantial portions of the Software.
20938abc0ccfSmrgdnl
20948abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20958abc0ccfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20968abc0ccfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20978abc0ccfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20988abc0ccfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20998abc0ccfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21008abc0ccfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
21018abc0ccfSmrgdnl
21028abc0ccfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
21038abc0ccfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
21048abc0ccfSmrgdnl other dealings in this Software without prior written authorization
21058abc0ccfSmrgdnl from the copyright holders.
21068abc0ccfSmrgdnl
21078abc0ccfSmrg
21088abc0ccfSmrg# XORG_RELEASE_VERSION
21098abc0ccfSmrg# --------------------
21108abc0ccfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
211140c5344fSmrg
21128abc0ccfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
21138abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
21148abc0ccfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
21158abc0ccfSmrg		[Major version of this package])
21168abc0ccfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
21178abc0ccfSmrg	if test "x$PVM" = "x"; then
21188abc0ccfSmrg		PVM="0"
21198abc0ccfSmrg	fi
21208abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
21218abc0ccfSmrg		[$PVM],
21228abc0ccfSmrg		[Minor version of this package])
21238abc0ccfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
21248abc0ccfSmrg	if test "x$PVP" = "x"; then
21258abc0ccfSmrg		PVP="0"
21268abc0ccfSmrg	fi
21278abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
21288abc0ccfSmrg		[$PVP],
21298abc0ccfSmrg		[Patch version of this package])
21308abc0ccfSmrg])
21318abc0ccfSmrg
21328abc0ccfSmrg# XORG_CHANGELOG()
21338abc0ccfSmrg# ----------------
21348abc0ccfSmrg# Minimum version: 1.2.0
21358abc0ccfSmrg#
21368abc0ccfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
21378abc0ccfSmrg# ChangeLog from git.
21388abc0ccfSmrg#
21398abc0ccfSmrg#
21408abc0ccfSmrgAC_DEFUN([XORG_CHANGELOG], [
21418abc0ccfSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
21428abc0ccfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
21438abc0ccfSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
21448abc0ccfSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
21458abc0ccfSmrgAC_SUBST([CHANGELOG_CMD])
21468abc0ccfSmrg]) # XORG_CHANGELOG
21478abc0ccfSmrg
21488abc0ccfSmrgdnl
21498abc0ccfSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
21508abc0ccfSmrgdnl
21518abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
21528abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
21538abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
21548abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
21558abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
21568abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
21578abc0ccfSmrgdnl
21588abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
21598abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
21608abc0ccfSmrgdnl Software.
21618abc0ccfSmrgdnl
21628abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21638abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21648abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21658abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21668abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21678abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21688abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
21698abc0ccfSmrgdnl
21708abc0ccfSmrg
21718abc0ccfSmrg# XTRANS_TCP_FLAGS()
21728abc0ccfSmrg# ------------------
21738abc0ccfSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
21748abc0ccfSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
21758abc0ccfSmrg # SVR4 hides these in libraries other than libc
21768abc0ccfSmrg AC_SEARCH_LIBS(socket, [socket])
21778abc0ccfSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
21788abc0ccfSmrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
21799a011757Smrg   AC_CHECK_LIB([ws2_32],[main])
21808abc0ccfSmrg fi
21818abc0ccfSmrg
21828abc0ccfSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
21838abc0ccfSmrg AC_ARG_ENABLE(ipv6,
21849a011757Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
21858abc0ccfSmrg	[IPV6CONN=$enableval],
21868abc0ccfSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
21878abc0ccfSmrg AC_MSG_CHECKING([if IPv6 support should be built])
21888abc0ccfSmrg if test "$IPV6CONN" = "yes"; then
21898abc0ccfSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
21908abc0ccfSmrg fi
21918abc0ccfSmrg AC_MSG_RESULT($IPV6CONN)
21928abc0ccfSmrg
21938abc0ccfSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
21948abc0ccfSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
21958abc0ccfSmrg	AC_DEFINE([BSD44SOCKETS],1,
21968abc0ccfSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
21978abc0ccfSmrg#include <sys/types.h>
21988abc0ccfSmrg#include <sys/socket.h>
21998abc0ccfSmrg#include <netinet/in.h>
22008abc0ccfSmrg ])
22018abc0ccfSmrg
22028abc0ccfSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
22038abc0ccfSmrg AC_CHECK_TYPES([socklen_t], [], [], [
22048abc0ccfSmrgAC_INCLUDES_DEFAULT
22058abc0ccfSmrg#include <sys/socket.h>])
22068abc0ccfSmrg
22079a011757Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
22089a011757Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
22099a011757Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
22109a011757Smrg                 [
22119a011757SmrgAC_INCLUDES_DEFAULT
22129a011757Smrg#include <sys/socket.h>
22139a011757Smrg                 ])
22149a011757Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
22159a011757Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
22169a011757Smrg     unset ac_cv_member_struct_msghdr_msg_control
22179a011757Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
22189a011757Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
22199a011757Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
22209a011757Smrg                       [Defined if needed to expose struct msghdr.msg_control])
22219a011757Smrg                     ], [], [
22229a011757Smrg#define _XOPEN_SOURCE 600
22239a011757SmrgAC_INCLUDES_DEFAULT
22249a011757Smrg#include <sys/socket.h>
22259a011757Smrg                     ])
22269a011757Smrg fi
22279a011757Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
22289a011757Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
22299a011757Smrg     unset ac_cv_member_struct_msghdr_msg_control
22309a011757Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
22319a011757Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
22329a011757Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
22339a011757Smrg                       [Defined if needed to expose struct msghdr.msg_control])
22349a011757Smrg                     ], [], [
22359a011757Smrg#define _XOPEN_SOURCE 500
22369a011757SmrgAC_INCLUDES_DEFAULT
22379a011757Smrg#include <sys/socket.h>
22389a011757Smrg                     ])
22399a011757Smrg fi
22409a011757Smrg
22419a011757Smrg
22428abc0ccfSmrg]) # XTRANS_TCP_FLAGS
22438abc0ccfSmrg
22448abc0ccfSmrg# XTRANS_CONNECTION_FLAGS()
22458abc0ccfSmrg# -------------------------
22468abc0ccfSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
22478abc0ccfSmrg# that use Xtrans functions
22488abc0ccfSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
22498abc0ccfSmrg AC_REQUIRE([AC_CANONICAL_HOST])
22508abc0ccfSmrg [case $host_os in
22518abc0ccfSmrg	mingw*)	unixdef="no"   ;;
22528abc0ccfSmrg	*)	unixdef="yes"  ;;
22538abc0ccfSmrg esac]
22548abc0ccfSmrg AC_ARG_ENABLE(unix-transport,
22559a011757Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
22568abc0ccfSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
22578abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
22588abc0ccfSmrg if test "$UNIXCONN" = "yes"; then
22598abc0ccfSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
22608abc0ccfSmrg fi
22618abc0ccfSmrg AC_MSG_RESULT($UNIXCONN)
22628abc0ccfSmrg AC_ARG_ENABLE(tcp-transport,
22639a011757Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
22648abc0ccfSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
22658abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
22668abc0ccfSmrg AC_MSG_RESULT($TCPCONN)
22678abc0ccfSmrg if test "$TCPCONN" = "yes"; then
22688abc0ccfSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
22698abc0ccfSmrg	XTRANS_TCP_FLAGS
22708abc0ccfSmrg fi
22718abc0ccfSmrg [case $host_os in
22728abc0ccfSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
22738abc0ccfSmrg	*)			localdef="no"  ;;
22748abc0ccfSmrg esac]
22758abc0ccfSmrg AC_ARG_ENABLE(local-transport,
22769a011757Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
22778abc0ccfSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
22788abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
22798abc0ccfSmrg AC_MSG_RESULT($LOCALCONN)
22808abc0ccfSmrg if test "$LOCALCONN" = "yes"; then
22818abc0ccfSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
22828abc0ccfSmrg fi
22838abc0ccfSmrg
22848abc0ccfSmrg]) # XTRANS_CONNECTION_FLAGS
22858abc0ccfSmrg
22868abc0ccfSmrg
22878abc0ccfSmrg# XTRANS_SECURE_RPC_FLAGS()
22888abc0ccfSmrg# -------------------------
22898abc0ccfSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
22908abc0ccfSmrg# so that any necessary networking libraries are already found
22918abc0ccfSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
22928abc0ccfSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
22938abc0ccfSmrg AC_ARG_ENABLE(secure-rpc,
22949a011757Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
22958abc0ccfSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
22968abc0ccfSmrg
22978abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
22988abc0ccfSmrg	FOUND_SECURE_RPC="no"
22998abc0ccfSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
23008abc0ccfSmrg			[FOUND_SECURE_RPC="yes"])
23018abc0ccfSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
23028abc0ccfSmrg		if test "x$SECURE_RPC" = "xyes" ; then
23038abc0ccfSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
23048abc0ccfSmrg		fi
23058abc0ccfSmrg		SECURE_RPC="no"
23068abc0ccfSmrg	else
23078abc0ccfSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
23088abc0ccfSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
23098abc0ccfSmrg		SECURE_RPC="yes"
23108abc0ccfSmrg	fi
23118abc0ccfSmrg fi
23128abc0ccfSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
23138abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" ; then
23148abc0ccfSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
23158abc0ccfSmrg fi
23168abc0ccfSmrg AC_MSG_RESULT($SECURE_RPC)
23178abc0ccfSmrg]) # XTRANS_SECURE_RPC_FLAGS
23188abc0ccfSmrg
23198abc0ccfSmrg
232040c5344fSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
23218abc0ccfSmrg#
23228abc0ccfSmrg# This file is free software; the Free Software Foundation
23238abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
23248abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
23258abc0ccfSmrg
23268abc0ccfSmrg# AM_AUTOMAKE_VERSION(VERSION)
23278abc0ccfSmrg# ----------------------------
23288abc0ccfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
23298abc0ccfSmrg# generated from the m4 files accompanying Automake X.Y.
23308abc0ccfSmrg# (This private macro should not be called outside this file.)
23318abc0ccfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
233240c5344fSmrg[am__api_version='1.15'
23338abc0ccfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
23348abc0ccfSmrgdnl require some minimum version.  Point them to the right macro.
233540c5344fSmrgm4_if([$1], [1.15], [],
23368abc0ccfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
23378abc0ccfSmrg])
23388abc0ccfSmrg
23398abc0ccfSmrg# _AM_AUTOCONF_VERSION(VERSION)
23408abc0ccfSmrg# -----------------------------
23418abc0ccfSmrg# aclocal traces this macro to find the Autoconf version.
23428abc0ccfSmrg# This is a private macro too.  Using m4_define simplifies
23438abc0ccfSmrg# the logic in aclocal, which can simply ignore this definition.
23448abc0ccfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
23458abc0ccfSmrg
23468abc0ccfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
23478abc0ccfSmrg# -------------------------------
23488abc0ccfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23498abc0ccfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
23508abc0ccfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
235140c5344fSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
23528abc0ccfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
23538abc0ccfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23548abc0ccfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
23558abc0ccfSmrg
23568abc0ccfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
23578abc0ccfSmrg
235840c5344fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
235996402570Smrg#
23608abc0ccfSmrg# This file is free software; the Free Software Foundation
23618abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
23628abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
236396402570Smrg
23648abc0ccfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23658abc0ccfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23668abc0ccfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
23672852888eSmrg#
23688abc0ccfSmrg# Of course, Automake must honor this variable whenever it calls a
23698abc0ccfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
23708abc0ccfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
23718abc0ccfSmrg# depending on how configure is run.  This is pretty annoying, since
23728abc0ccfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
23738abc0ccfSmrg# source directory, any form will work fine, but in subdirectories a
23748abc0ccfSmrg# relative path needs to be adjusted first.
23752852888eSmrg#
23768abc0ccfSmrg# $ac_aux_dir/missing
23778abc0ccfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
23788abc0ccfSmrg# $top_srcdir/$ac_aux_dir/missing
23798abc0ccfSmrg#    fails if $ac_aux_dir is absolute,
23808abc0ccfSmrg#    fails when called from a subdirectory in a VPATH build with
23818abc0ccfSmrg#          a relative $ac_aux_dir
23822852888eSmrg#
23838abc0ccfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
23848abc0ccfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
23858abc0ccfSmrg# harmless because $srcdir is '.', but things will broke when you
23868abc0ccfSmrg# start a VPATH build or use an absolute $srcdir.
238796402570Smrg#
23888abc0ccfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
23898abc0ccfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
23908abc0ccfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
23918abc0ccfSmrg# and then we would define $MISSING as
23928abc0ccfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
23938abc0ccfSmrg# This will work as long as MISSING is not called from configure, because
23948abc0ccfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
23958abc0ccfSmrg# However there are other variables, like CC, which are often used in
23968abc0ccfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
23972852888eSmrg#
23988abc0ccfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
23998abc0ccfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
24008abc0ccfSmrg# configured tree to be moved without reconfiguration.
24012852888eSmrg
24028abc0ccfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
240340c5344fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
240440c5344fSmrg# Expand $ac_aux_dir to an absolute path.
240540c5344fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
24068abc0ccfSmrg])
24072852888eSmrg
24088abc0ccfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
24092852888eSmrg
241040c5344fSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
24118abc0ccfSmrg#
24128abc0ccfSmrg# This file is free software; the Free Software Foundation
24138abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
24148abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
24152852888eSmrg
24168abc0ccfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
24178abc0ccfSmrg# -------------------------------------
24188abc0ccfSmrg# Define a conditional.
24198abc0ccfSmrgAC_DEFUN([AM_CONDITIONAL],
24208abc0ccfSmrg[AC_PREREQ([2.52])dnl
24218abc0ccfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
24228abc0ccfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
24238abc0ccfSmrgAC_SUBST([$1_TRUE])dnl
24248abc0ccfSmrgAC_SUBST([$1_FALSE])dnl
24258abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
24268abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
24278abc0ccfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
24288abc0ccfSmrgif $2; then
24298abc0ccfSmrg  $1_TRUE=
24308abc0ccfSmrg  $1_FALSE='#'
24318abc0ccfSmrgelse
24328abc0ccfSmrg  $1_TRUE='#'
24338abc0ccfSmrg  $1_FALSE=
24348abc0ccfSmrgfi
24358abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
24368abc0ccfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
24378abc0ccfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
24388abc0ccfSmrgUsually this means the macro was only invoked conditionally.]])
24398abc0ccfSmrgfi])])
24402852888eSmrg
244140c5344fSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
24422852888eSmrg#
24438abc0ccfSmrg# This file is free software; the Free Software Foundation
24448abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
24458abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
24468abc0ccfSmrg
24478abc0ccfSmrg
24488abc0ccfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
24498abc0ccfSmrg# written in clear, in which case automake, when reading aclocal.m4,
24508abc0ccfSmrg# will think it sees a *use*, and therefore will trigger all it's
24518abc0ccfSmrg# C support machinery.  Also note that it means that autoscan, seeing
24528abc0ccfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
24538abc0ccfSmrg
24548abc0ccfSmrg
24558abc0ccfSmrg# _AM_DEPENDENCIES(NAME)
24568abc0ccfSmrg# ----------------------
24578abc0ccfSmrg# See how the compiler implements dependency checking.
24588abc0ccfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
24598abc0ccfSmrg# We try a few techniques and use that to set a single cache variable.
246096402570Smrg#
24618abc0ccfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
24628abc0ccfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
24638abc0ccfSmrg# dependency, and given that the user is not expected to run this macro,
24648abc0ccfSmrg# just rely on AC_PROG_CC.
24658abc0ccfSmrgAC_DEFUN([_AM_DEPENDENCIES],
24668abc0ccfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
24678abc0ccfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
24688abc0ccfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
24698abc0ccfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
24708abc0ccfSmrg
24718abc0ccfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24728abc0ccfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24738abc0ccfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24748abc0ccfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24758abc0ccfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24768abc0ccfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24778abc0ccfSmrg                    [depcc="$$1"   am_compiler_list=])
24788abc0ccfSmrg
24798abc0ccfSmrgAC_CACHE_CHECK([dependency style of $depcc],
24808abc0ccfSmrg               [am_cv_$1_dependencies_compiler_type],
24818abc0ccfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
24828abc0ccfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
24838abc0ccfSmrg  # making bogus files that we don't know about and never remove.  For
24848abc0ccfSmrg  # instance it was reported that on HP-UX the gcc test will end up
24858abc0ccfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24868abc0ccfSmrg  # in D".
24878abc0ccfSmrg  rm -rf conftest.dir
24888abc0ccfSmrg  mkdir conftest.dir
24898abc0ccfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
24908abc0ccfSmrg  # using a relative directory.
24918abc0ccfSmrg  cp "$am_depcomp" conftest.dir
24928abc0ccfSmrg  cd conftest.dir
24938abc0ccfSmrg  # We will build objects and dependencies in a subdirectory because
24948abc0ccfSmrg  # it helps to detect inapplicable dependency modes.  For instance
24958abc0ccfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
24968abc0ccfSmrg  # side effect of compilation, but ICC will put the dependencies in
24978abc0ccfSmrg  # the current directory while Tru64 will put them in the object
24988abc0ccfSmrg  # directory.
24998abc0ccfSmrg  mkdir sub
25008abc0ccfSmrg
25018abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
25028abc0ccfSmrg  if test "$am_compiler_list" = ""; then
25038abc0ccfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
25042852888eSmrg  fi
25058abc0ccfSmrg  am__universal=false
25068abc0ccfSmrg  m4_case([$1], [CC],
25078abc0ccfSmrg    [case " $depcc " in #(
25088abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
25098abc0ccfSmrg     esac],
25108abc0ccfSmrg    [CXX],
25118abc0ccfSmrg    [case " $depcc " in #(
25128abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
25138abc0ccfSmrg     esac])
25148abc0ccfSmrg
25158abc0ccfSmrg  for depmode in $am_compiler_list; do
25168abc0ccfSmrg    # Setup a source with many dependencies, because some compilers
25178abc0ccfSmrg    # like to wrap large dependency lists on column 80 (with \), and
25188abc0ccfSmrg    # we should not choose a depcomp mode which is confused by this.
25198abc0ccfSmrg    #
25208abc0ccfSmrg    # We need to recreate these files for each test, as the compiler may
25218abc0ccfSmrg    # overwrite some of them when testing with obscure command lines.
25228abc0ccfSmrg    # This happens at least with the AIX C compiler.
25238abc0ccfSmrg    : > sub/conftest.c
25248abc0ccfSmrg    for i in 1 2 3 4 5 6; do
25258abc0ccfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
25268abc0ccfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
25278abc0ccfSmrg      # Solaris 10 /bin/sh.
25288abc0ccfSmrg      echo '/* dummy */' > sub/conftst$i.h
25298abc0ccfSmrg    done
25308abc0ccfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
25318abc0ccfSmrg
25328abc0ccfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
25338abc0ccfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25348abc0ccfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25358abc0ccfSmrg    # versions had trouble with output in subdirs.
25368abc0ccfSmrg    am__obj=sub/conftest.${OBJEXT-o}
25378abc0ccfSmrg    am__minus_obj="-o $am__obj"
25388abc0ccfSmrg    case $depmode in
25398abc0ccfSmrg    gcc)
25408abc0ccfSmrg      # This depmode causes a compiler race in universal mode.
25418abc0ccfSmrg      test "$am__universal" = false || continue
25428abc0ccfSmrg      ;;
25438abc0ccfSmrg    nosideeffect)
25448abc0ccfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
25458abc0ccfSmrg      # only be used when explicitly requested.
25468abc0ccfSmrg      if test "x$enable_dependency_tracking" = xyes; then
25478abc0ccfSmrg	continue
25488abc0ccfSmrg      else
25498abc0ccfSmrg	break
25508abc0ccfSmrg      fi
25518abc0ccfSmrg      ;;
25528abc0ccfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25538abc0ccfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
25548abc0ccfSmrg      # not run yet.  These depmodes are late enough in the game, and
25558abc0ccfSmrg      # so weak that their functioning should not be impacted.
25568abc0ccfSmrg      am__obj=conftest.${OBJEXT-o}
25578abc0ccfSmrg      am__minus_obj=
25588abc0ccfSmrg      ;;
25598abc0ccfSmrg    none) break ;;
25608abc0ccfSmrg    esac
25618abc0ccfSmrg    if depmode=$depmode \
25628abc0ccfSmrg       source=sub/conftest.c object=$am__obj \
25638abc0ccfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25648abc0ccfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
25658abc0ccfSmrg         >/dev/null 2>conftest.err &&
25668abc0ccfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
25678abc0ccfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25688abc0ccfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
25698abc0ccfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
25708abc0ccfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
25718abc0ccfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
25728abc0ccfSmrg      # that says an option was ignored or not supported.
25738abc0ccfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
25748abc0ccfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
25758abc0ccfSmrg      # The diagnosis changed in icc 8.0:
25768abc0ccfSmrg      #   icc: Command line remark: option '-MP' not supported
25778abc0ccfSmrg      if (grep 'ignoring option' conftest.err ||
25788abc0ccfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
25798abc0ccfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
25808abc0ccfSmrg        break
25818abc0ccfSmrg      fi
25828abc0ccfSmrg    fi
25838abc0ccfSmrg  done
25842852888eSmrg
25858abc0ccfSmrg  cd ..
25868abc0ccfSmrg  rm -rf conftest.dir
25872852888eSmrgelse
25888abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
25892852888eSmrgfi
25908abc0ccfSmrg])
25918abc0ccfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
25928abc0ccfSmrgAM_CONDITIONAL([am__fastdep$1], [
25938abc0ccfSmrg  test "x$enable_dependency_tracking" != xno \
25948abc0ccfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
25958abc0ccfSmrg])
25962852888eSmrg
259796402570Smrg
25988abc0ccfSmrg# AM_SET_DEPDIR
25998abc0ccfSmrg# -------------
26008abc0ccfSmrg# Choose a directory name for dependency files.
26018abc0ccfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
26028abc0ccfSmrgAC_DEFUN([AM_SET_DEPDIR],
26038abc0ccfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
26048abc0ccfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
26058abc0ccfSmrg])
260696402570Smrg
260796402570Smrg
26088abc0ccfSmrg# AM_DEP_TRACK
26098abc0ccfSmrg# ------------
26108abc0ccfSmrgAC_DEFUN([AM_DEP_TRACK],
26118abc0ccfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
26128abc0ccfSmrgAS_HELP_STRING(
26138abc0ccfSmrg  [--enable-dependency-tracking],
26148abc0ccfSmrg  [do not reject slow dependency extractors])
26158abc0ccfSmrgAS_HELP_STRING(
26168abc0ccfSmrg  [--disable-dependency-tracking],
26178abc0ccfSmrg  [speeds up one-time build])])
26188abc0ccfSmrgif test "x$enable_dependency_tracking" != xno; then
26198abc0ccfSmrg  am_depcomp="$ac_aux_dir/depcomp"
26208abc0ccfSmrg  AMDEPBACKSLASH='\'
26218abc0ccfSmrg  am__nodep='_no'
262296402570Smrgfi
26238abc0ccfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
26248abc0ccfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
26258abc0ccfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
26268abc0ccfSmrgAC_SUBST([am__nodep])dnl
26278abc0ccfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
26288abc0ccfSmrg])
262996402570Smrg
26308abc0ccfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
263196402570Smrg
263240c5344fSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
26337a0395d0Smrg#
26348abc0ccfSmrg# This file is free software; the Free Software Foundation
26358abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
26368abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
26377a0395d0Smrg
26387a0395d0Smrg
26398abc0ccfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
26408abc0ccfSmrg# ------------------------------
26418abc0ccfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26428abc0ccfSmrg[{
26439a011757Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
26448abc0ccfSmrg  # are listed without --file.  Let's play safe and only enable the eval
26458abc0ccfSmrg  # if we detect the quoting.
26468abc0ccfSmrg  case $CONFIG_FILES in
26478abc0ccfSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
26488abc0ccfSmrg  *)   set x $CONFIG_FILES ;;
26498abc0ccfSmrg  esac
26508abc0ccfSmrg  shift
26518abc0ccfSmrg  for mf
26528abc0ccfSmrg  do
26538abc0ccfSmrg    # Strip MF so we end up with the name of the file.
26548abc0ccfSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
26558abc0ccfSmrg    # Check whether this is an Automake generated Makefile or not.
26568abc0ccfSmrg    # We used to match only the files named 'Makefile.in', but
26578abc0ccfSmrg    # some people rename them; so instead we look at the file content.
26588abc0ccfSmrg    # Grep'ing the first line is not enough: some people post-process
26598abc0ccfSmrg    # each Makefile.in and add a new line on top of each file to say so.
26608abc0ccfSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
26618abc0ccfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
26628abc0ccfSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
26638abc0ccfSmrg      dirpart=`AS_DIRNAME("$mf")`
26648abc0ccfSmrg    else
26658abc0ccfSmrg      continue
26668abc0ccfSmrg    fi
26678abc0ccfSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
26688abc0ccfSmrg    # from the Makefile without running 'make'.
26698abc0ccfSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
26708abc0ccfSmrg    test -z "$DEPDIR" && continue
26718abc0ccfSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
26729a011757Smrg    test -z "$am__include" && continue
26738abc0ccfSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
26748abc0ccfSmrg    # Find all dependency output files, they are included files with
26758abc0ccfSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
26768abc0ccfSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
26778abc0ccfSmrg    # expansion.
26788abc0ccfSmrg    for file in `sed -n "
26798abc0ccfSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
26808abc0ccfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
26818abc0ccfSmrg      # Make sure the directory exists.
26828abc0ccfSmrg      test -f "$dirpart/$file" && continue
26838abc0ccfSmrg      fdir=`AS_DIRNAME(["$file"])`
26848abc0ccfSmrg      AS_MKDIR_P([$dirpart/$fdir])
26858abc0ccfSmrg      # echo "creating $dirpart/$file"
26868abc0ccfSmrg      echo '# dummy' > "$dirpart/$file"
26878abc0ccfSmrg    done
26888abc0ccfSmrg  done
26898abc0ccfSmrg}
26908abc0ccfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
26917a0395d0Smrg
26927a0395d0Smrg
26938abc0ccfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
26948abc0ccfSmrg# -----------------------------
26958abc0ccfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
26962adc0320Smrg#
26978abc0ccfSmrg# This code is only required when automatic dependency tracking
26988abc0ccfSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
26998abc0ccfSmrg# need in order to bootstrap the dependency handling code.
27008abc0ccfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
27018abc0ccfSmrg[AC_CONFIG_COMMANDS([depfiles],
27028abc0ccfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
27038abc0ccfSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
27048abc0ccfSmrg])
27058abc0ccfSmrg
27068abc0ccfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
27078abc0ccfSmrg
270840c5344fSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
27097366012aSmrg#
27108abc0ccfSmrg# This file is free software; the Free Software Foundation
27118abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
27128abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
27137a0395d0Smrg
27148abc0ccfSmrg# This macro actually does too much.  Some checks are only needed if
27158abc0ccfSmrg# your package does certain things.  But this isn't really a big deal.
27162adc0320Smrg
271740c5344fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
271840c5344fSmrgm4_define([AC_PROG_CC],
271940c5344fSmrgm4_defn([AC_PROG_CC])
272040c5344fSmrg[_AM_PROG_CC_C_O
272140c5344fSmrg])
272240c5344fSmrg
27238abc0ccfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
27248abc0ccfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
27258abc0ccfSmrg# -----------------------------------------------
27268abc0ccfSmrg# The call with PACKAGE and VERSION arguments is the old style
27278abc0ccfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
27288abc0ccfSmrg# and VERSION should now be passed to AC_INIT and removed from
27298abc0ccfSmrg# the call to AM_INIT_AUTOMAKE.
27308abc0ccfSmrg# We support both call styles for the transition.  After
27318abc0ccfSmrg# the next Automake release, Autoconf can make the AC_INIT
27328abc0ccfSmrg# arguments mandatory, and then we can depend on a new Autoconf
27338abc0ccfSmrg# release and drop the old call support.
27348abc0ccfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
27359a011757Smrg[AC_PREREQ([2.65])dnl
27368abc0ccfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
27378abc0ccfSmrgdnl the ones we care about.
27388abc0ccfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
27398abc0ccfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
27408abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
27418abc0ccfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
27428abc0ccfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
27438abc0ccfSmrg  # is not polluted with repeated "-I."
27448abc0ccfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27458abc0ccfSmrg  # test to see if srcdir already configured
27468abc0ccfSmrg  if test -f $srcdir/config.status; then
27478abc0ccfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
27488abc0ccfSmrg  fi
27497366012aSmrgfi
27502adc0320Smrg
27518abc0ccfSmrg# test whether we have cygpath
27528abc0ccfSmrgif test -z "$CYGPATH_W"; then
27538abc0ccfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
27548abc0ccfSmrg    CYGPATH_W='cygpath -w'
27558abc0ccfSmrg  else
27568abc0ccfSmrg    CYGPATH_W=echo
27578abc0ccfSmrg  fi
27587366012aSmrgfi
27598abc0ccfSmrgAC_SUBST([CYGPATH_W])
27607a0395d0Smrg
27618abc0ccfSmrg# Define the identity of the package.
27628abc0ccfSmrgdnl Distinguish between old-style and new-style calls.
27638abc0ccfSmrgm4_ifval([$2],
27648abc0ccfSmrg[AC_DIAGNOSE([obsolete],
27659a011757Smrg             [$0: two- and three-arguments forms are deprecated.])
27668abc0ccfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
27678abc0ccfSmrg AC_SUBST([PACKAGE], [$1])dnl
27688abc0ccfSmrg AC_SUBST([VERSION], [$2])],
27698abc0ccfSmrg[_AM_SET_OPTIONS([$1])dnl
27708abc0ccfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27718abc0ccfSmrgm4_if(
27728abc0ccfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
27738abc0ccfSmrg  [ok:ok],,
27748abc0ccfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
27758abc0ccfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
27768abc0ccfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
27772adc0320Smrg
27788abc0ccfSmrg_AM_IF_OPTION([no-define],,
27798abc0ccfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27808abc0ccfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
27812adc0320Smrg
27828abc0ccfSmrg# Some tools Automake needs.
27838abc0ccfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
27848abc0ccfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27858abc0ccfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27868abc0ccfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27878abc0ccfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27888abc0ccfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27898abc0ccfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27908abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27918abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27928abc0ccfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27938abc0ccfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
27948abc0ccfSmrg# dies out for good.  For more background, see:
27958abc0ccfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
27968abc0ccfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27978abc0ccfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
279840c5344fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
279940c5344fSmrg# system "awk" is bad on some platforms.
28008abc0ccfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
28018abc0ccfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
28028abc0ccfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
28038abc0ccfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
28048abc0ccfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
28058abc0ccfSmrg			     [_AM_PROG_TAR([v7])])])
28068abc0ccfSmrg_AM_IF_OPTION([no-dependencies],,
28078abc0ccfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
28088abc0ccfSmrg		  [_AM_DEPENDENCIES([CC])],
28098abc0ccfSmrg		  [m4_define([AC_PROG_CC],
28108abc0ccfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
28118abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
28128abc0ccfSmrg		  [_AM_DEPENDENCIES([CXX])],
28138abc0ccfSmrg		  [m4_define([AC_PROG_CXX],
28148abc0ccfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
28158abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
28168abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJC])],
28178abc0ccfSmrg		  [m4_define([AC_PROG_OBJC],
28188abc0ccfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
28199a011757SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
28208abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
28218abc0ccfSmrg		  [m4_define([AC_PROG_OBJCXX],
28229a011757Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
28238abc0ccfSmrg])
28249a011757SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
28259a011757Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
28269a011757Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
28279a011757Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
28288abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(dnl
28298abc0ccfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
28308abc0ccfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
283140c5344fSmrg
283240c5344fSmrg# POSIX will say in a future version that running "rm -f" with no argument
283340c5344fSmrg# is OK; and we want to be able to make that assumption in our Makefile
283440c5344fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
283540c5344fSmrg# actually supported "in the wild" to an acceptable degree.
283640c5344fSmrg# See automake bug#10828.
283740c5344fSmrg# To make any issue more visible, cause the running configure to be aborted
283840c5344fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
283940c5344fSmrg# user can still override this though.
284040c5344fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
284140c5344fSmrg  cat >&2 <<'END'
284240c5344fSmrgOops!
284340c5344fSmrg
284440c5344fSmrgYour 'rm' program seems unable to run without file operands specified
284540c5344fSmrgon the command line, even when the '-f' option is present.  This is contrary
284640c5344fSmrgto the behaviour of most rm programs out there, and not conforming with
284740c5344fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
284840c5344fSmrg
284940c5344fSmrgPlease tell bug-automake@gnu.org about your system, including the value
285040c5344fSmrgof your $PATH and any error possibly output before this message.  This
285140c5344fSmrgcan help us improve future automake versions.
285240c5344fSmrg
285340c5344fSmrgEND
285440c5344fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
285540c5344fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
285640c5344fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
285740c5344fSmrg    echo >&2
285840c5344fSmrg  else
285940c5344fSmrg    cat >&2 <<'END'
286040c5344fSmrgAborting the configuration process, to ensure you take notice of the issue.
286140c5344fSmrg
286240c5344fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
286340c5344fSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
286440c5344fSmrg
286540c5344fSmrgIf you want to complete the configuration process using your problematic
286640c5344fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
286740c5344fSmrgto "yes", and re-run configure.
286840c5344fSmrg
286940c5344fSmrgEND
287040c5344fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
287140c5344fSmrg  fi
287240c5344fSmrgfi
287340c5344fSmrgdnl The trailing newline in this macro's definition is deliberate, for
287440c5344fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
287540c5344fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
28768abc0ccfSmrg])
28777a0395d0Smrg
28788abc0ccfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28798abc0ccfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28808abc0ccfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
28818abc0ccfSmrgm4_define([_AC_COMPILER_EXEEXT],
28828abc0ccfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
28837a0395d0Smrg
28848abc0ccfSmrg# When config.status generates a header, we must update the stamp-h file.
28858abc0ccfSmrg# This file resides in the same directory as the config header
28868abc0ccfSmrg# that is generated.  The stamp files are numbered to have different names.
288796402570Smrg
28888abc0ccfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
28898abc0ccfSmrg# loop where config.status creates the headers, so we can generate
28908abc0ccfSmrg# our stamp files there.
28918abc0ccfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
28928abc0ccfSmrg[# Compute $1's index in $config_headers.
28938abc0ccfSmrg_am_arg=$1
28948abc0ccfSmrg_am_stamp_count=1
28958abc0ccfSmrgfor _am_header in $config_headers :; do
28968abc0ccfSmrg  case $_am_header in
28978abc0ccfSmrg    $_am_arg | $_am_arg:* )
28988abc0ccfSmrg      break ;;
28998abc0ccfSmrg    * )
29008abc0ccfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
29018abc0ccfSmrg  esac
29028abc0ccfSmrgdone
29038abc0ccfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
290496402570Smrg
290540c5344fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
29068abc0ccfSmrg#
29078abc0ccfSmrg# This file is free software; the Free Software Foundation
29088abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29098abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
291096402570Smrg
29118abc0ccfSmrg# AM_PROG_INSTALL_SH
29128abc0ccfSmrg# ------------------
29138abc0ccfSmrg# Define $install_sh.
29148abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
29158abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
291640c5344fSmrgif test x"${install_sh+set}" != xset; then
29178abc0ccfSmrg  case $am_aux_dir in
29188abc0ccfSmrg  *\ * | *\	*)
29198abc0ccfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
29208abc0ccfSmrg  *)
29218abc0ccfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
29228abc0ccfSmrg  esac
292396402570Smrgfi
29248abc0ccfSmrgAC_SUBST([install_sh])])
292596402570Smrg
292640c5344fSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
29278abc0ccfSmrg#
29288abc0ccfSmrg# This file is free software; the Free Software Foundation
29298abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29308abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
29318abc0ccfSmrg
29328abc0ccfSmrg# Check whether the underlying file-system supports filenames
29338abc0ccfSmrg# with a leading dot.  For instance MS-DOS doesn't.
29348abc0ccfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
29358abc0ccfSmrg[rm -rf .tst 2>/dev/null
29368abc0ccfSmrgmkdir .tst 2>/dev/null
29378abc0ccfSmrgif test -d .tst; then
29388abc0ccfSmrg  am__leading_dot=.
29398abc0ccfSmrgelse
29408abc0ccfSmrg  am__leading_dot=_
294196402570Smrgfi
29428abc0ccfSmrgrmdir .tst 2>/dev/null
29438abc0ccfSmrgAC_SUBST([am__leading_dot])])
294496402570Smrg
29458abc0ccfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
294696402570Smrg
294740c5344fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
294896402570Smrg#
29498abc0ccfSmrg# This file is free software; the Free Software Foundation
29508abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29518abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
295296402570Smrg
29538abc0ccfSmrg# AM_MAKE_INCLUDE()
29548abc0ccfSmrg# -----------------
29558abc0ccfSmrg# Check to see how make treats includes.
29568abc0ccfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
29578abc0ccfSmrg[am_make=${MAKE-make}
29588abc0ccfSmrgcat > confinc << 'END'
29598abc0ccfSmrgam__doit:
29608abc0ccfSmrg	@echo this is the am__doit target
29618abc0ccfSmrg.PHONY: am__doit
29628abc0ccfSmrgEND
29638abc0ccfSmrg# If we don't find an include directive, just comment out the code.
29648abc0ccfSmrgAC_MSG_CHECKING([for style of include used by $am_make])
29658abc0ccfSmrgam__include="#"
29668abc0ccfSmrgam__quote=
29678abc0ccfSmrg_am_result=none
29688abc0ccfSmrg# First try GNU make style include.
29698abc0ccfSmrgecho "include confinc" > confmf
29708abc0ccfSmrg# Ignore all kinds of additional output from 'make'.
29718abc0ccfSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
29728abc0ccfSmrg*the\ am__doit\ target*)
29738abc0ccfSmrg  am__include=include
29748abc0ccfSmrg  am__quote=
29758abc0ccfSmrg  _am_result=GNU
29768abc0ccfSmrg  ;;
29778abc0ccfSmrgesac
29788abc0ccfSmrg# Now try BSD make style include.
29798abc0ccfSmrgif test "$am__include" = "#"; then
29808abc0ccfSmrg   echo '.include "confinc"' > confmf
29818abc0ccfSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
29828abc0ccfSmrg   *the\ am__doit\ target*)
29838abc0ccfSmrg     am__include=.include
29848abc0ccfSmrg     am__quote="\""
29858abc0ccfSmrg     _am_result=BSD
29868abc0ccfSmrg     ;;
29878abc0ccfSmrg   esac
298896402570Smrgfi
29898abc0ccfSmrgAC_SUBST([am__include])
29908abc0ccfSmrgAC_SUBST([am__quote])
29918abc0ccfSmrgAC_MSG_RESULT([$_am_result])
29928abc0ccfSmrgrm -f confinc confmf
29938abc0ccfSmrg])
299496402570Smrg
29958abc0ccfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
299696402570Smrg
299740c5344fSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
29988abc0ccfSmrg#
29998abc0ccfSmrg# This file is free software; the Free Software Foundation
30008abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30018abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
300296402570Smrg
30038abc0ccfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
30048abc0ccfSmrg# ------------------------------
30058abc0ccfSmrgAC_DEFUN([AM_MISSING_PROG],
30068abc0ccfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
30078abc0ccfSmrg$1=${$1-"${am_missing_run}$2"}
30088abc0ccfSmrgAC_SUBST($1)])
300996402570Smrg
30108abc0ccfSmrg# AM_MISSING_HAS_RUN
30118abc0ccfSmrg# ------------------
30129a011757Smrg# Define MISSING if not defined so far and test if it is modern enough.
30139a011757Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
30148abc0ccfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
30158abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30168abc0ccfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
30178abc0ccfSmrgif test x"${MISSING+set}" != xset; then
30188abc0ccfSmrg  case $am_aux_dir in
30198abc0ccfSmrg  *\ * | *\	*)
30208abc0ccfSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
30218abc0ccfSmrg  *)
30228abc0ccfSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
30238abc0ccfSmrg  esac
30248abc0ccfSmrgfi
30258abc0ccfSmrg# Use eval to expand $SHELL
30269a011757Smrgif eval "$MISSING --is-lightweight"; then
30279a011757Smrg  am_missing_run="$MISSING "
302896402570Smrgelse
30298abc0ccfSmrg  am_missing_run=
30308abc0ccfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
303196402570Smrgfi
30328abc0ccfSmrg])
303396402570Smrg
30348abc0ccfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
303596402570Smrg
303640c5344fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
30377366012aSmrg#
30388abc0ccfSmrg# This file is free software; the Free Software Foundation
30398abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30408abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
30417366012aSmrg
30428abc0ccfSmrg# _AM_MANGLE_OPTION(NAME)
30437366012aSmrg# -----------------------
30448abc0ccfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
30458abc0ccfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
30467366012aSmrg
30478abc0ccfSmrg# _AM_SET_OPTION(NAME)
30488abc0ccfSmrg# --------------------
30498abc0ccfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
30508abc0ccfSmrgAC_DEFUN([_AM_SET_OPTION],
30518abc0ccfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
305296402570Smrg
30538abc0ccfSmrg# _AM_SET_OPTIONS(OPTIONS)
30548abc0ccfSmrg# ------------------------
30558abc0ccfSmrg# OPTIONS is a space-separated list of Automake options.
30568abc0ccfSmrgAC_DEFUN([_AM_SET_OPTIONS],
30578abc0ccfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
305896402570Smrg
30598abc0ccfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
30608abc0ccfSmrg# -------------------------------------------
30618abc0ccfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
30628abc0ccfSmrgAC_DEFUN([_AM_IF_OPTION],
30638abc0ccfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
306496402570Smrg
306540c5344fSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
306640c5344fSmrg#
306740c5344fSmrg# This file is free software; the Free Software Foundation
306840c5344fSmrg# gives unlimited permission to copy and/or distribute it,
306940c5344fSmrg# with or without modifications, as long as this notice is preserved.
307040c5344fSmrg
307140c5344fSmrg# _AM_PROG_CC_C_O
307240c5344fSmrg# ---------------
307340c5344fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
307440c5344fSmrg# to automatically call this.
307540c5344fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
307640c5344fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
307740c5344fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
307840c5344fSmrgAC_LANG_PUSH([C])dnl
307940c5344fSmrgAC_CACHE_CHECK(
308040c5344fSmrg  [whether $CC understands -c and -o together],
308140c5344fSmrg  [am_cv_prog_cc_c_o],
308240c5344fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
308340c5344fSmrg  # Make sure it works both with $CC and with simple cc.
308440c5344fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
308540c5344fSmrg  # compilers refuse to overwrite an existing .o file with -o,
308640c5344fSmrg  # though they will create one.
308740c5344fSmrg  am_cv_prog_cc_c_o=yes
308840c5344fSmrg  for am_i in 1 2; do
308940c5344fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
309040c5344fSmrg         && test -f conftest2.$ac_objext; then
309140c5344fSmrg      : OK
309240c5344fSmrg    else
309340c5344fSmrg      am_cv_prog_cc_c_o=no
309440c5344fSmrg      break
309540c5344fSmrg    fi
309640c5344fSmrg  done
309740c5344fSmrg  rm -f core conftest*
309840c5344fSmrg  unset am_i])
309940c5344fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
310040c5344fSmrg   # Losing compiler, so override with the script.
310140c5344fSmrg   # FIXME: It is wrong to rewrite CC.
310240c5344fSmrg   # But if we don't then we get into trouble of one sort or another.
310340c5344fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
310440c5344fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
310540c5344fSmrg   CC="$am_aux_dir/compile $CC"
310640c5344fSmrgfi
310740c5344fSmrgAC_LANG_POP([C])])
310840c5344fSmrg
310940c5344fSmrg# For backward compatibility.
311040c5344fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
311140c5344fSmrg
311240c5344fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
311340c5344fSmrg#
311440c5344fSmrg# This file is free software; the Free Software Foundation
311540c5344fSmrg# gives unlimited permission to copy and/or distribute it,
311640c5344fSmrg# with or without modifications, as long as this notice is preserved.
311740c5344fSmrg
311840c5344fSmrg# AM_RUN_LOG(COMMAND)
311940c5344fSmrg# -------------------
312040c5344fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
312140c5344fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
312240c5344fSmrgAC_DEFUN([AM_RUN_LOG],
312340c5344fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
312440c5344fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
312540c5344fSmrg   ac_status=$?
312640c5344fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
312740c5344fSmrg   (exit $ac_status); }])
312840c5344fSmrg
31298abc0ccfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
313096402570Smrg
313140c5344fSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
31328abc0ccfSmrg#
31338abc0ccfSmrg# This file is free software; the Free Software Foundation
31348abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31358abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
31368abc0ccfSmrg
31378abc0ccfSmrg# AM_SANITY_CHECK
31388abc0ccfSmrg# ---------------
31398abc0ccfSmrgAC_DEFUN([AM_SANITY_CHECK],
31408abc0ccfSmrg[AC_MSG_CHECKING([whether build environment is sane])
31418abc0ccfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
31428abc0ccfSmrg# name.  Accept space and tab only in the latter.
31438abc0ccfSmrgam_lf='
31448abc0ccfSmrg'
31458abc0ccfSmrgcase `pwd` in
31468abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
31478abc0ccfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
31488abc0ccfSmrgesac
31498abc0ccfSmrgcase $srcdir in
31508abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31518abc0ccfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31528abc0ccfSmrgesac
31538abc0ccfSmrg
31548abc0ccfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
31558abc0ccfSmrg# arguments.  Must try -L first in case configure is actually a
31568abc0ccfSmrg# symlink; some systems play weird games with the mod time of symlinks
31578abc0ccfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
31588abc0ccfSmrg# directory).
31598abc0ccfSmrgif (
31608abc0ccfSmrg   am_has_slept=no
31618abc0ccfSmrg   for am_try in 1 2; do
31628abc0ccfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31638abc0ccfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31648abc0ccfSmrg     if test "$[*]" = "X"; then
31658abc0ccfSmrg	# -L didn't work.
31668abc0ccfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
31678abc0ccfSmrg     fi
31688abc0ccfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31698abc0ccfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
31708abc0ccfSmrg
31718abc0ccfSmrg	# If neither matched, then we have a broken ls.  This can happen
31728abc0ccfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31738abc0ccfSmrg	# broken ls alias from the environment.  This has actually
31748abc0ccfSmrg	# happened.  Such a system could not be considered "sane".
31758abc0ccfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31768abc0ccfSmrg  alias in your environment])
31778abc0ccfSmrg     fi
31788abc0ccfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31798abc0ccfSmrg       break
31808abc0ccfSmrg     fi
31818abc0ccfSmrg     # Just in case.
31828abc0ccfSmrg     sleep 1
31838abc0ccfSmrg     am_has_slept=yes
31848abc0ccfSmrg   done
31858abc0ccfSmrg   test "$[2]" = conftest.file
31868abc0ccfSmrg   )
31878abc0ccfSmrgthen
31888abc0ccfSmrg   # Ok.
31898abc0ccfSmrg   :
31908abc0ccfSmrgelse
31918abc0ccfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
31928abc0ccfSmrgCheck your system clock])
31937a0395d0Smrgfi
31948abc0ccfSmrgAC_MSG_RESULT([yes])
31958abc0ccfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31968abc0ccfSmrg# generated files are strictly newer.
31978abc0ccfSmrgam_sleep_pid=
31988abc0ccfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31998abc0ccfSmrg  ( sleep 1 ) &
32008abc0ccfSmrg  am_sleep_pid=$!
32018abc0ccfSmrgfi
32028abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
32038abc0ccfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
32048abc0ccfSmrg   if test -n "$am_sleep_pid"; then
32058abc0ccfSmrg     # Hide warnings about reused PIDs.
32068abc0ccfSmrg     wait $am_sleep_pid 2>/dev/null
32078abc0ccfSmrg   fi
32088abc0ccfSmrg   AC_MSG_RESULT([done])])
32098abc0ccfSmrgrm -f conftest.file
32108abc0ccfSmrg])
32117366012aSmrg
321240c5344fSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
32137366012aSmrg#
32148abc0ccfSmrg# This file is free software; the Free Software Foundation
32158abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
32168abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
32172adc0320Smrg
32188abc0ccfSmrg# AM_SILENT_RULES([DEFAULT])
32198abc0ccfSmrg# --------------------------
32208abc0ccfSmrg# Enable less verbose build rules; with the default set to DEFAULT
32218abc0ccfSmrg# ("yes" being less verbose, "no" or empty being verbose).
32228abc0ccfSmrgAC_DEFUN([AM_SILENT_RULES],
32238abc0ccfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
32248abc0ccfSmrgAS_HELP_STRING(
32258abc0ccfSmrg  [--enable-silent-rules],
32268abc0ccfSmrg  [less verbose build output (undo: "make V=1")])
32278abc0ccfSmrgAS_HELP_STRING(
32288abc0ccfSmrg  [--disable-silent-rules],
32298abc0ccfSmrg  [verbose build output (undo: "make V=0")])dnl
32308abc0ccfSmrg])
32318abc0ccfSmrgcase $enable_silent_rules in @%:@ (((
32328abc0ccfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
32338abc0ccfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
32348abc0ccfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
32358abc0ccfSmrgesac
32368abc0ccfSmrgdnl
32378abc0ccfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
32388abc0ccfSmrgdnl do not support nested variable expansions.
32398abc0ccfSmrgdnl See automake bug#9928 and bug#10237.
32408abc0ccfSmrgam_make=${MAKE-make}
32418abc0ccfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
32428abc0ccfSmrg   [am_cv_make_support_nested_variables],
32438abc0ccfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
32448abc0ccfSmrgBAR0=false
32458abc0ccfSmrgBAR1=true
32468abc0ccfSmrgV=1
32478abc0ccfSmrgam__doit:
32488abc0ccfSmrg	@$(TRUE)
32498abc0ccfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
32508abc0ccfSmrg  am_cv_make_support_nested_variables=yes
32518abc0ccfSmrgelse
32528abc0ccfSmrg  am_cv_make_support_nested_variables=no
32538abc0ccfSmrgfi])
32548abc0ccfSmrgif test $am_cv_make_support_nested_variables = yes; then
32558abc0ccfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32568abc0ccfSmrg  AM_V='$(V)'
32578abc0ccfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32588abc0ccfSmrgelse
32598abc0ccfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
32608abc0ccfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32618abc0ccfSmrgfi
32628abc0ccfSmrgAC_SUBST([AM_V])dnl
32638abc0ccfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
32648abc0ccfSmrgAC_SUBST([AM_DEFAULT_V])dnl
32658abc0ccfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32668abc0ccfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32678abc0ccfSmrgAM_BACKSLASH='\'
32688abc0ccfSmrgAC_SUBST([AM_BACKSLASH])dnl
32698abc0ccfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32707a0395d0Smrg])
32717a0395d0Smrg
327240c5344fSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
32737366012aSmrg#
32748abc0ccfSmrg# This file is free software; the Free Software Foundation
32758abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
32768abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
32777a0395d0Smrg
32788abc0ccfSmrg# AM_PROG_INSTALL_STRIP
32798abc0ccfSmrg# ---------------------
32808abc0ccfSmrg# One issue with vendor 'install' (even GNU) is that you can't
32818abc0ccfSmrg# specify the program used to strip binaries.  This is especially
32828abc0ccfSmrg# annoying in cross-compiling environments, where the build's strip
32838abc0ccfSmrg# is unlikely to handle the host's binaries.
32848abc0ccfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32858abc0ccfSmrg# always use install-sh in "make install-strip", and initialize
32868abc0ccfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
32878abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
32888abc0ccfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32898abc0ccfSmrg# Installed binaries are usually stripped using 'strip' when the user
32908abc0ccfSmrg# run "make install-strip".  However 'strip' might not be the right
32918abc0ccfSmrg# tool to use in cross-compilation environments, therefore Automake
32928abc0ccfSmrg# will honor the 'STRIP' environment variable to overrule this program.
32938abc0ccfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
32948abc0ccfSmrgif test "$cross_compiling" != no; then
32958abc0ccfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
32968abc0ccfSmrgfi
32978abc0ccfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
32988abc0ccfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
32997a0395d0Smrg
330040c5344fSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
33018abc0ccfSmrg#
33028abc0ccfSmrg# This file is free software; the Free Software Foundation
33038abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33048abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33057a0395d0Smrg
33068abc0ccfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
33078abc0ccfSmrg# ---------------------------
33088abc0ccfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
33098abc0ccfSmrg# This macro is traced by Automake.
33108abc0ccfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
331196402570Smrg
33128abc0ccfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
33138abc0ccfSmrg# --------------------------
33148abc0ccfSmrg# Public sister of _AM_SUBST_NOTMAKE.
33158abc0ccfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
33167a0395d0Smrg
33178abc0ccfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
331896402570Smrg
331940c5344fSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
33208abc0ccfSmrg#
33218abc0ccfSmrg# This file is free software; the Free Software Foundation
33228abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
33238abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
33247a0395d0Smrg
33258abc0ccfSmrg# _AM_PROG_TAR(FORMAT)
33268abc0ccfSmrg# --------------------
33278abc0ccfSmrg# Check how to create a tarball in format FORMAT.
33288abc0ccfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
33298abc0ccfSmrg#
33308abc0ccfSmrg# Substitute a variable $(am__tar) that is a command
33318abc0ccfSmrg# writing to stdout a FORMAT-tarball containing the directory
33328abc0ccfSmrg# $tardir.
33338abc0ccfSmrg#     tardir=directory && $(am__tar) > result.tar
33348abc0ccfSmrg#
33358abc0ccfSmrg# Substitute a variable $(am__untar) that extract such
33368abc0ccfSmrg# a tarball read from stdin.
33378abc0ccfSmrg#     $(am__untar) < result.tar
33389a011757Smrg#
33398abc0ccfSmrgAC_DEFUN([_AM_PROG_TAR],
33408abc0ccfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
33418abc0ccfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
33428abc0ccfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
33439a011757Smrg
33449a011757Smrg# We'll loop over all known methods to create a tar archive until one works.
33458abc0ccfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
33467a0395d0Smrg
33479a011757Smrgm4_if([$1], [v7],
33489a011757Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
33499a011757Smrg
33509a011757Smrg  [m4_case([$1],
33519a011757Smrg    [ustar],
33529a011757Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33539a011757Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33549a011757Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33559a011757Smrg      # and bug#13588).
33569a011757Smrg      am_max_uid=2097151 # 2^21 - 1
33579a011757Smrg      am_max_gid=$am_max_uid
33589a011757Smrg      # The $UID and $GID variables are not portable, so we need to resort
33599a011757Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33609a011757Smrg      # below are definitely unexpected, so allow the users to see them
33619a011757Smrg      # (that is, avoid stderr redirection).
33629a011757Smrg      am_uid=`id -u || echo unknown`
33639a011757Smrg      am_gid=`id -g || echo unknown`
33649a011757Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33659a011757Smrg      if test $am_uid -le $am_max_uid; then
33669a011757Smrg         AC_MSG_RESULT([yes])
33679a011757Smrg      else
33689a011757Smrg         AC_MSG_RESULT([no])
33699a011757Smrg         _am_tools=none
33709a011757Smrg      fi
33719a011757Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33729a011757Smrg      if test $am_gid -le $am_max_gid; then
33739a011757Smrg         AC_MSG_RESULT([yes])
33749a011757Smrg      else
33759a011757Smrg        AC_MSG_RESULT([no])
33769a011757Smrg        _am_tools=none
33779a011757Smrg      fi],
33789a011757Smrg
33799a011757Smrg  [pax],
33809a011757Smrg    [],
33819a011757Smrg
33829a011757Smrg  [m4_fatal([Unknown tar format])])
33839a011757Smrg
33849a011757Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
33859a011757Smrg
33869a011757Smrg  # Go ahead even if we have the value already cached.  We do so because we
33879a011757Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33889a011757Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
33899a011757Smrg
33909a011757Smrg  for _am_tool in $_am_tools; do
33919a011757Smrg    case $_am_tool in
33929a011757Smrg    gnutar)
33939a011757Smrg      for _am_tar in tar gnutar gtar; do
33949a011757Smrg        AM_RUN_LOG([$_am_tar --version]) && break
33959a011757Smrg      done
33969a011757Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33979a011757Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33989a011757Smrg      am__untar="$_am_tar -xf -"
33999a011757Smrg      ;;
34009a011757Smrg    plaintar)
34019a011757Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
34029a011757Smrg      # ustar tarball either.
34039a011757Smrg      (tar --version) >/dev/null 2>&1 && continue
34049a011757Smrg      am__tar='tar chf - "$$tardir"'
34059a011757Smrg      am__tar_='tar chf - "$tardir"'
34069a011757Smrg      am__untar='tar xf -'
34079a011757Smrg      ;;
34089a011757Smrg    pax)
34099a011757Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
34109a011757Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
34119a011757Smrg      am__untar='pax -r'
34129a011757Smrg      ;;
34139a011757Smrg    cpio)
34149a011757Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
34159a011757Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
34169a011757Smrg      am__untar='cpio -i -H $1 -d'
34179a011757Smrg      ;;
34189a011757Smrg    none)
34199a011757Smrg      am__tar=false
34209a011757Smrg      am__tar_=false
34219a011757Smrg      am__untar=false
34229a011757Smrg      ;;
34239a011757Smrg    esac
34248abc0ccfSmrg
34259a011757Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
34269a011757Smrg    # and am__untar set.
34279a011757Smrg    test -n "${am_cv_prog_tar_$1}" && break
34289a011757Smrg
34299a011757Smrg    # tar/untar a dummy directory, and stop if the command works.
34309a011757Smrg    rm -rf conftest.dir
34319a011757Smrg    mkdir conftest.dir
34329a011757Smrg    echo GrepMe > conftest.dir/file
34339a011757Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
34349a011757Smrg    rm -rf conftest.dir
34359a011757Smrg    if test -s conftest.tar; then
34369a011757Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
34379a011757Smrg      AM_RUN_LOG([cat conftest.dir/file])
34389a011757Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
34399a011757Smrg    fi
34409a011757Smrg  done
34418abc0ccfSmrg  rm -rf conftest.dir
34427a0395d0Smrg
34439a011757Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
34449a011757Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
34459a011757Smrg
34468abc0ccfSmrgAC_SUBST([am__tar])
34478abc0ccfSmrgAC_SUBST([am__untar])
34488abc0ccfSmrg]) # _AM_PROG_TAR
34497a0395d0Smrg
3450