aclocal.m4 revision 8abc0ccf
18abc0ccfSmrg# generated automatically by aclocal 1.12.2 -*- Autoconf -*-
28abc0ccfSmrg
38abc0ccfSmrg# Copyright (C) 1996-2012 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
147a0395d0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
157a0395d0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
168abc0ccfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
178abc0ccfSmrg[m4_warning([this file was generated for autoconf 2.69.
187a0395d0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
197a0395d0SmrgIf you have problems, you may need to regenerate the build system entirely.
208abc0ccfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
217a0395d0Smrg
228abc0ccfSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
238abc0ccfSmrg# serial 1 (pkg-config-0.24)
248abc0ccfSmrg# 
258abc0ccfSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
267a0395d0Smrg#
278abc0ccfSmrg# This program is free software; you can redistribute it and/or modify
288abc0ccfSmrg# it under the terms of the GNU General Public License as published by
298abc0ccfSmrg# the Free Software Foundation; either version 2 of the License, or
308abc0ccfSmrg# (at your option) any later version.
318abc0ccfSmrg#
328abc0ccfSmrg# This program is distributed in the hope that it will be useful, but
338abc0ccfSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
348abc0ccfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
358abc0ccfSmrg# General Public License for more details.
368abc0ccfSmrg#
378abc0ccfSmrg# You should have received a copy of the GNU General Public License
388abc0ccfSmrg# along with this program; if not, write to the Free Software
398abc0ccfSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
408abc0ccfSmrg#
418abc0ccfSmrg# As a special exception to the GNU General Public License, if you
428abc0ccfSmrg# distribute this file as part of a program that contains a
438abc0ccfSmrg# configuration script generated by Autoconf, you may include it under
448abc0ccfSmrg# the same distribution terms that you use for the rest of that program.
457a0395d0Smrg
468abc0ccfSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
478abc0ccfSmrg# ----------------------------------
488abc0ccfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
498abc0ccfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
508abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
518abc0ccfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
528abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
538abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
548abc0ccfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
557a0395d0Smrg
568abc0ccfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
578abc0ccfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
588abc0ccfSmrgfi
598abc0ccfSmrgif test -n "$PKG_CONFIG"; then
608abc0ccfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
618abc0ccfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
628abc0ccfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
638abc0ccfSmrg		AC_MSG_RESULT([yes])
648abc0ccfSmrg	else
658abc0ccfSmrg		AC_MSG_RESULT([no])
668abc0ccfSmrg		PKG_CONFIG=""
678abc0ccfSmrg	fi
688abc0ccfSmrgfi[]dnl
698abc0ccfSmrg])# PKG_PROG_PKG_CONFIG
707a0395d0Smrg
718abc0ccfSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
728abc0ccfSmrg#
738abc0ccfSmrg# Check to see whether a particular set of modules exists.  Similar
748abc0ccfSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
758abc0ccfSmrg#
768abc0ccfSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
778abc0ccfSmrg# only at the first occurence in configure.ac, so if the first place
788abc0ccfSmrg# it's called might be skipped (such as if it is within an "if", you
798abc0ccfSmrg# have to call PKG_CHECK_EXISTS manually
808abc0ccfSmrg# --------------------------------------------------------------
818abc0ccfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
828abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
838abc0ccfSmrgif test -n "$PKG_CONFIG" && \
848abc0ccfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
858abc0ccfSmrg  m4_default([$2], [:])
868abc0ccfSmrgm4_ifvaln([$3], [else
878abc0ccfSmrg  $3])dnl
888abc0ccfSmrgfi])
897a0395d0Smrg
908abc0ccfSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
918abc0ccfSmrg# ---------------------------------------------
928abc0ccfSmrgm4_define([_PKG_CONFIG],
938abc0ccfSmrg[if test -n "$$1"; then
948abc0ccfSmrg    pkg_cv_[]$1="$$1"
958abc0ccfSmrg elif test -n "$PKG_CONFIG"; then
968abc0ccfSmrg    PKG_CHECK_EXISTS([$3],
978abc0ccfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
988abc0ccfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
998abc0ccfSmrg		     [pkg_failed=yes])
1008abc0ccfSmrg else
1018abc0ccfSmrg    pkg_failed=untried
1028abc0ccfSmrgfi[]dnl
1038abc0ccfSmrg])# _PKG_CONFIG
1047a0395d0Smrg
1058abc0ccfSmrg# _PKG_SHORT_ERRORS_SUPPORTED
1068abc0ccfSmrg# -----------------------------
1078abc0ccfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1088abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1098abc0ccfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1108abc0ccfSmrg        _pkg_short_errors_supported=yes
1118abc0ccfSmrgelse
1128abc0ccfSmrg        _pkg_short_errors_supported=no
1138abc0ccfSmrgfi[]dnl
1148abc0ccfSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1157a0395d0Smrg
1168abc0ccfSmrg
1178abc0ccfSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1188abc0ccfSmrg# [ACTION-IF-NOT-FOUND])
1197a0395d0Smrg#
1207a0395d0Smrg#
1218abc0ccfSmrg# Note that if there is a possibility the first call to
1228abc0ccfSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1238abc0ccfSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1247a0395d0Smrg#
1257366012aSmrg#
1268abc0ccfSmrg# --------------------------------------------------------------
1278abc0ccfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1288abc0ccfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1298abc0ccfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1308abc0ccfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1317a0395d0Smrg
1328abc0ccfSmrgpkg_failed=no
1338abc0ccfSmrgAC_MSG_CHECKING([for $1])
1347a0395d0Smrg
1358abc0ccfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1368abc0ccfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1377a0395d0Smrg
1388abc0ccfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1398abc0ccfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1408abc0ccfSmrgSee the pkg-config man page for more details.])
1417a0395d0Smrg
1428abc0ccfSmrgif test $pkg_failed = yes; then
1438abc0ccfSmrg   	AC_MSG_RESULT([no])
1448abc0ccfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1458abc0ccfSmrg        if test $_pkg_short_errors_supported = yes; then
1468abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1478abc0ccfSmrg        else 
1488abc0ccfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1498abc0ccfSmrg        fi
1508abc0ccfSmrg	# Put the nasty error message in config.log where it belongs
1518abc0ccfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1527a0395d0Smrg
1538abc0ccfSmrg	m4_default([$4], [AC_MSG_ERROR(
1548abc0ccfSmrg[Package requirements ($2) were not met:
1557a0395d0Smrg
1568abc0ccfSmrg$$1_PKG_ERRORS
1577a0395d0Smrg
1588abc0ccfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1598abc0ccfSmrginstalled software in a non-standard prefix.
1607a0395d0Smrg
1618abc0ccfSmrg_PKG_TEXT])[]dnl
1628abc0ccfSmrg        ])
1638abc0ccfSmrgelif test $pkg_failed = untried; then
1648abc0ccfSmrg     	AC_MSG_RESULT([no])
1658abc0ccfSmrg	m4_default([$4], [AC_MSG_FAILURE(
1668abc0ccfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1678abc0ccfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1688abc0ccfSmrgpath to pkg-config.
1697a0395d0Smrg
1708abc0ccfSmrg_PKG_TEXT
1717a0395d0Smrg
1728abc0ccfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1738abc0ccfSmrg        ])
1748abc0ccfSmrgelse
1758abc0ccfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1768abc0ccfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1778abc0ccfSmrg        AC_MSG_RESULT([yes])
1788abc0ccfSmrg	$3
1798abc0ccfSmrgfi[]dnl
1808abc0ccfSmrg])# PKG_CHECK_MODULES
1817a0395d0Smrg
1827a0395d0Smrg
1838abc0ccfSmrg# PKG_INSTALLDIR(DIRECTORY)
1848abc0ccfSmrg# -------------------------
1858abc0ccfSmrg# Substitutes the variable pkgconfigdir as the location where a module
1868abc0ccfSmrg# should install pkg-config .pc files. By default the directory is
1878abc0ccfSmrg# $libdir/pkgconfig, but the default can be changed by passing
1888abc0ccfSmrg# DIRECTORY. The user can override through the --with-pkgconfigdir
1898abc0ccfSmrg# parameter.
1908abc0ccfSmrgAC_DEFUN([PKG_INSTALLDIR],
1918abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1928abc0ccfSmrgm4_pushdef([pkg_description],
1938abc0ccfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1948abc0ccfSmrgAC_ARG_WITH([pkgconfigdir],
1958abc0ccfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1968abc0ccfSmrg    [with_pkgconfigdir=]pkg_default)
1978abc0ccfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1988abc0ccfSmrgm4_popdef([pkg_default])
1998abc0ccfSmrgm4_popdef([pkg_description])
2008abc0ccfSmrg]) dnl PKG_INSTALLDIR
2018abc0ccfSmrg
2028abc0ccfSmrg
2038abc0ccfSmrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
2048abc0ccfSmrg# -------------------------
2058abc0ccfSmrg# Substitutes the variable noarch_pkgconfigdir as the location where a
2068abc0ccfSmrg# module should install arch-independent pkg-config .pc files. By
2078abc0ccfSmrg# default the directory is $datadir/pkgconfig, but the default can be
2088abc0ccfSmrg# changed by passing DIRECTORY. The user can override through the
2098abc0ccfSmrg# --with-noarch-pkgconfigdir parameter.
2108abc0ccfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2118abc0ccfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2128abc0ccfSmrgm4_pushdef([pkg_description],
2138abc0ccfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2148abc0ccfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
2158abc0ccfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2168abc0ccfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
2178abc0ccfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2188abc0ccfSmrgm4_popdef([pkg_default])
2198abc0ccfSmrgm4_popdef([pkg_description])
2208abc0ccfSmrg]) dnl PKG_NOARCH_INSTALLDIR
2217a0395d0Smrg
2228abc0ccfSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
2238abc0ccfSmrgdnl
2248abc0ccfSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2258abc0ccfSmrgdnl 
2268abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
2278abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
2288abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
2298abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
2308abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
2318abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
2328abc0ccfSmrgdnl
2338abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
2348abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
2358abc0ccfSmrgdnl Software.
2368abc0ccfSmrgdnl
2378abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2388abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2398abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2408abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2418abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2428abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2438abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
2447a0395d0Smrg
2458abc0ccfSmrg# XORG_MACROS_VERSION(required-version)
2468abc0ccfSmrg# -------------------------------------
2478abc0ccfSmrg# Minimum version: 1.1.0
2488abc0ccfSmrg#
2498abc0ccfSmrg# If you're using a macro added in Version 1.1 or newer, include this in
2508abc0ccfSmrg# your configure.ac with the minimum required version, such as:
2518abc0ccfSmrg# XORG_MACROS_VERSION(1.1)
2528abc0ccfSmrg#
2538abc0ccfSmrg# To ensure that this macro is defined, also add:
2548abc0ccfSmrg# m4_ifndef([XORG_MACROS_VERSION],
2558abc0ccfSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
2568abc0ccfSmrg#
2578abc0ccfSmrg#
2588abc0ccfSmrg# See the "minimum version" comment for each macro you use to see what 
2598abc0ccfSmrg# version you require.
2608abc0ccfSmrgm4_defun([XORG_MACROS_VERSION],[
2618abc0ccfSmrgm4_define([vers_have], [1.17])
2628abc0ccfSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
2638abc0ccfSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
2648abc0ccfSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
2658abc0ccfSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
2668abc0ccfSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
2678abc0ccfSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
2688abc0ccfSmrgm4_undefine([vers_have])
2698abc0ccfSmrgm4_undefine([maj_have])
2708abc0ccfSmrgm4_undefine([maj_needed])
2718abc0ccfSmrg]) # XORG_MACROS_VERSION
2727a0395d0Smrg
2738abc0ccfSmrg# XORG_PROG_RAWCPP()
2748abc0ccfSmrg# ------------------
2758abc0ccfSmrg# Minimum version: 1.0.0
2768abc0ccfSmrg#
2778abc0ccfSmrg# Find cpp program and necessary flags for use in pre-processing text files
2788abc0ccfSmrg# such as man pages and config files
2798abc0ccfSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
2808abc0ccfSmrgAC_REQUIRE([AC_PROG_CPP])
2818abc0ccfSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
2828abc0ccfSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
2837a0395d0Smrg
2848abc0ccfSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
2858abc0ccfSmrg# which is not the best choice for supporting other OS'es, but covers most
2868abc0ccfSmrg# of the ones we need for now.
2878abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
2888abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
2898abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2908abc0ccfSmrg	AC_MSG_RESULT([no])
2917366012aSmrgelse
2928abc0ccfSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2938abc0ccfSmrg		RAWCPPFLAGS=-undef
2948abc0ccfSmrg		AC_MSG_RESULT([yes])
2958abc0ccfSmrg	# under Cygwin unix is still defined even with -undef
2968abc0ccfSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
2978abc0ccfSmrg		RAWCPPFLAGS="-undef -ansi"
2988abc0ccfSmrg		AC_MSG_RESULT([yes, with -ansi])
2998abc0ccfSmrg	else
3008abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
3018abc0ccfSmrg	fi
3027a0395d0Smrgfi
3038abc0ccfSmrgrm -f conftest.$ac_ext
3047a0395d0Smrg
3058abc0ccfSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
3068abc0ccfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
3078abc0ccfSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3088abc0ccfSmrg	AC_MSG_RESULT([no])
3098abc0ccfSmrgelse
3108abc0ccfSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3118abc0ccfSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
3128abc0ccfSmrg		AC_MSG_RESULT([yes])
3138abc0ccfSmrg	else
3148abc0ccfSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
3158abc0ccfSmrg	fi
3168abc0ccfSmrgfi
3178abc0ccfSmrgrm -f conftest.$ac_ext
3188abc0ccfSmrgAC_SUBST(RAWCPPFLAGS)
3198abc0ccfSmrg]) # XORG_PROG_RAWCPP
3207a0395d0Smrg
3218abc0ccfSmrg# XORG_MANPAGE_SECTIONS()
3228abc0ccfSmrg# -----------------------
3238abc0ccfSmrg# Minimum version: 1.0.0
3248abc0ccfSmrg#
3258abc0ccfSmrg# Determine which sections man pages go in for the different man page types
3268abc0ccfSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
3278abc0ccfSmrg# Not sure if there's any better way than just hardcoding by OS name.
3288abc0ccfSmrg# Override default settings by setting environment variables
3298abc0ccfSmrg# Added MAN_SUBSTS in version 1.8
3308abc0ccfSmrg# Added AC_PROG_SED in version 1.8
3317a0395d0Smrg
3328abc0ccfSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
3338abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
3348abc0ccfSmrgAC_REQUIRE([AC_PROG_SED])
3357a0395d0Smrg
3368abc0ccfSmrgif test x$APP_MAN_SUFFIX = x    ; then
3378abc0ccfSmrg    APP_MAN_SUFFIX=1
3388abc0ccfSmrgfi
3398abc0ccfSmrgif test x$APP_MAN_DIR = x    ; then
3408abc0ccfSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
3417a0395d0Smrgfi
3427a0395d0Smrg
3438abc0ccfSmrgif test x$LIB_MAN_SUFFIX = x    ; then
3448abc0ccfSmrg    LIB_MAN_SUFFIX=3
3458abc0ccfSmrgfi
3468abc0ccfSmrgif test x$LIB_MAN_DIR = x    ; then
3478abc0ccfSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
3488abc0ccfSmrgfi
3497a0395d0Smrg
3508abc0ccfSmrgif test x$FILE_MAN_SUFFIX = x    ; then
3518abc0ccfSmrg    case $host_os in
3528abc0ccfSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
3538abc0ccfSmrg	*)		FILE_MAN_SUFFIX=5  ;;
3548abc0ccfSmrg    esac
3558abc0ccfSmrgfi
3568abc0ccfSmrgif test x$FILE_MAN_DIR = x    ; then
3578abc0ccfSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
3588abc0ccfSmrgfi
3597a0395d0Smrg
3608abc0ccfSmrgif test x$MISC_MAN_SUFFIX = x    ; then
3618abc0ccfSmrg    case $host_os in
3628abc0ccfSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
3638abc0ccfSmrg	*)		MISC_MAN_SUFFIX=7  ;;
3648abc0ccfSmrg    esac
3658abc0ccfSmrgfi
3668abc0ccfSmrgif test x$MISC_MAN_DIR = x    ; then
3678abc0ccfSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
3688abc0ccfSmrgfi
3697a0395d0Smrg
3708abc0ccfSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
3718abc0ccfSmrg    case $host_os in
3728abc0ccfSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
3738abc0ccfSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
3748abc0ccfSmrg    esac
3758abc0ccfSmrgfi
3768abc0ccfSmrgif test x$DRIVER_MAN_DIR = x    ; then
3778abc0ccfSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
3788abc0ccfSmrgfi
3798abc0ccfSmrg
3808abc0ccfSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
3818abc0ccfSmrg    case $host_os in
3828abc0ccfSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
3838abc0ccfSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
3848abc0ccfSmrg    esac
3858abc0ccfSmrgfi
3868abc0ccfSmrgif test x$ADMIN_MAN_DIR = x    ; then
3878abc0ccfSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
3888abc0ccfSmrgfi
3897366012aSmrg
3907366012aSmrg
3918abc0ccfSmrgAC_SUBST([APP_MAN_SUFFIX])
3928abc0ccfSmrgAC_SUBST([LIB_MAN_SUFFIX])
3938abc0ccfSmrgAC_SUBST([FILE_MAN_SUFFIX])
3948abc0ccfSmrgAC_SUBST([MISC_MAN_SUFFIX])
3958abc0ccfSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
3968abc0ccfSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
3978abc0ccfSmrgAC_SUBST([APP_MAN_DIR])
3988abc0ccfSmrgAC_SUBST([LIB_MAN_DIR])
3998abc0ccfSmrgAC_SUBST([FILE_MAN_DIR])
4008abc0ccfSmrgAC_SUBST([MISC_MAN_DIR])
4018abc0ccfSmrgAC_SUBST([DRIVER_MAN_DIR])
4028abc0ccfSmrgAC_SUBST([ADMIN_MAN_DIR])
4038abc0ccfSmrg
4048abc0ccfSmrgXORG_MAN_PAGE="X Version 11"
4058abc0ccfSmrgAC_SUBST([XORG_MAN_PAGE])
4068abc0ccfSmrgMAN_SUBSTS="\
4078abc0ccfSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4088abc0ccfSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
4098abc0ccfSmrg	-e 's|__xservername__|Xorg|g' \
4108abc0ccfSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
4118abc0ccfSmrg	-e 's|__projectroot__|\$(prefix)|g' \
4128abc0ccfSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
4138abc0ccfSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
4148abc0ccfSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
4158abc0ccfSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
4168abc0ccfSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
4178abc0ccfSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
4188abc0ccfSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
4198abc0ccfSmrgAC_SUBST([MAN_SUBSTS])
4208abc0ccfSmrg
4218abc0ccfSmrg]) # XORG_MANPAGE_SECTIONS
4228abc0ccfSmrg
4238abc0ccfSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
4248abc0ccfSmrg# ------------------------
4258abc0ccfSmrg# Minimum version: 1.7.0
4267a0395d0Smrg#
4278abc0ccfSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
4288abc0ccfSmrg# provided by xorg-sgml-doctools, if installed.
4298abc0ccfSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
4308abc0ccfSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
4318abc0ccfSmrgXORG_SGML_PATH=
4328abc0ccfSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
4338abc0ccfSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
4348abc0ccfSmrg    [m4_ifval([$1],[:],
4358abc0ccfSmrg        [if test x"$cross_compiling" != x"yes" ; then
4368abc0ccfSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
4378abc0ccfSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
4388abc0ccfSmrg         fi])
4398abc0ccfSmrg    ])
4407a0395d0Smrg
4418abc0ccfSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
4428abc0ccfSmrg# the path and the name of the doc stylesheet
4438abc0ccfSmrgif test "x$XORG_SGML_PATH" != "x" ; then
4448abc0ccfSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
4458abc0ccfSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
4468abc0ccfSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
4478abc0ccfSmrgelse
4488abc0ccfSmrg   AC_MSG_RESULT([no])
4498abc0ccfSmrgfi
4508abc0ccfSmrg
4518abc0ccfSmrgAC_SUBST(XORG_SGML_PATH)
4528abc0ccfSmrgAC_SUBST(STYLESHEET_SRCDIR)
4538abc0ccfSmrgAC_SUBST(XSL_STYLESHEET)
4548abc0ccfSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
4558abc0ccfSmrg]) # XORG_CHECK_SGML_DOCTOOLS
4567a0395d0Smrg
4578abc0ccfSmrg# XORG_CHECK_LINUXDOC
4588abc0ccfSmrg# -------------------
4598abc0ccfSmrg# Minimum version: 1.0.0
4607366012aSmrg#
4618abc0ccfSmrg# Defines the variable MAKE_TEXT if the necessary tools and
4628abc0ccfSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
4638abc0ccfSmrg# Whether or not the necessary tools and files are found can be checked
4648abc0ccfSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
4658abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
4668abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
4678abc0ccfSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
4687a0395d0Smrg
4698abc0ccfSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
4707a0395d0Smrg
4718abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
4727a0395d0Smrg
4738abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
4748abc0ccfSmrg   BUILDDOC=yes
4758abc0ccfSmrgelse
4768abc0ccfSmrg   BUILDDOC=no
4777a0395d0Smrgfi
4787a0395d0Smrg
4798abc0ccfSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
4807a0395d0Smrg
4818abc0ccfSmrgAC_MSG_RESULT([$BUILDDOC])
4827a0395d0Smrg
4838abc0ccfSmrgAC_MSG_CHECKING([whether to build pdf documentation])
4847a0395d0Smrg
4858abc0ccfSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
4868abc0ccfSmrg   BUILDPDFDOC=yes
4878abc0ccfSmrgelse
4888abc0ccfSmrg   BUILDPDFDOC=no
4898abc0ccfSmrgfi
4907a0395d0Smrg
4918abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
4927a0395d0Smrg
4938abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
4947a0395d0Smrg
4958abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
4968abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
4978abc0ccfSmrgMAKE_PDF="$PS2PDF"
4988abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
4997a0395d0Smrg
5008abc0ccfSmrgAC_SUBST(MAKE_TEXT)
5018abc0ccfSmrgAC_SUBST(MAKE_PS)
5028abc0ccfSmrgAC_SUBST(MAKE_PDF)
5038abc0ccfSmrgAC_SUBST(MAKE_HTML)
5048abc0ccfSmrg]) # XORG_CHECK_LINUXDOC
5057a0395d0Smrg
5068abc0ccfSmrg# XORG_CHECK_DOCBOOK
5078abc0ccfSmrg# -------------------
5088abc0ccfSmrg# Minimum version: 1.0.0
5097366012aSmrg#
5108abc0ccfSmrg# Checks for the ability to build output formats from SGML DocBook source.
5118abc0ccfSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
5128abc0ccfSmrg# indicates whether the necessary tools and files are found and, if set,
5138abc0ccfSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
5148abc0ccfSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
5158abc0ccfSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5167a0395d0Smrg
5178abc0ccfSmrgBUILDTXTDOC=no
5188abc0ccfSmrgBUILDPDFDOC=no
5198abc0ccfSmrgBUILDPSDOC=no
5208abc0ccfSmrgBUILDHTMLDOC=no
5217a0395d0Smrg
5228abc0ccfSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
5238abc0ccfSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
5248abc0ccfSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
5258abc0ccfSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
5267a0395d0Smrg
5278abc0ccfSmrgAC_MSG_CHECKING([whether to build text documentation])
5288abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
5298abc0ccfSmrg   test x$BUILD_TXTDOC != xno; then
5308abc0ccfSmrg	BUILDTXTDOC=yes
5317366012aSmrgfi
5328abc0ccfSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
5338abc0ccfSmrgAC_MSG_RESULT([$BUILDTXTDOC])
5347366012aSmrg
5358abc0ccfSmrgAC_MSG_CHECKING([whether to build PDF documentation])
5368abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
5378abc0ccfSmrg   test x$BUILD_PDFDOC != xno; then
5388abc0ccfSmrg	BUILDPDFDOC=yes
5398abc0ccfSmrgfi
5408abc0ccfSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5418abc0ccfSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5427a0395d0Smrg
5438abc0ccfSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
5448abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
5458abc0ccfSmrg   test x$BUILD_PSDOC != xno; then
5468abc0ccfSmrg	BUILDPSDOC=yes
5478abc0ccfSmrgfi
5488abc0ccfSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
5498abc0ccfSmrgAC_MSG_RESULT([$BUILDPSDOC])
5507a0395d0Smrg
5518abc0ccfSmrgAC_MSG_CHECKING([whether to build HTML documentation])
5528abc0ccfSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
5538abc0ccfSmrg   test x$BUILD_HTMLDOC != xno; then
5548abc0ccfSmrg	BUILDHTMLDOC=yes
5558abc0ccfSmrgfi
5568abc0ccfSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
5578abc0ccfSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
5587a0395d0Smrg
5598abc0ccfSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
5608abc0ccfSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
5618abc0ccfSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
5628abc0ccfSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
5637a0395d0Smrg
5648abc0ccfSmrgAC_SUBST(MAKE_TEXT)
5658abc0ccfSmrgAC_SUBST(MAKE_PS)
5668abc0ccfSmrgAC_SUBST(MAKE_PDF)
5678abc0ccfSmrgAC_SUBST(MAKE_HTML)
5688abc0ccfSmrg]) # XORG_CHECK_DOCBOOK
5697366012aSmrg
5708abc0ccfSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
5718abc0ccfSmrg# ----------------
5728abc0ccfSmrg# Minimum version: 1.5.0
5738abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
5747a0395d0Smrg#
5758abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
5768abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
5778abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
5788abc0ccfSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
5798abc0ccfSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
5808abc0ccfSmrg# --with-xmlto assumes 'auto'.
5817a0395d0Smrg#
5828abc0ccfSmrg# Interface to module:
5838abc0ccfSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
5848abc0ccfSmrg# XMLTO:	returns the path of the xmlto program found
5858abc0ccfSmrg#		returns the path set by the user in the environment
5868abc0ccfSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
5878abc0ccfSmrg#		'no' user instructs the module not to use xmlto
5888abc0ccfSmrg#
5898abc0ccfSmrg# Added in version 1.10.0
5908abc0ccfSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
5918abc0ccfSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
5928abc0ccfSmrg#
5938abc0ccfSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
5948abc0ccfSmrg#
5958abc0ccfSmrgAC_DEFUN([XORG_WITH_XMLTO],[
5968abc0ccfSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
5978abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
5988abc0ccfSmrgAC_ARG_WITH(xmlto,
5998abc0ccfSmrg	AS_HELP_STRING([--with-xmlto],
6008abc0ccfSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
6018abc0ccfSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
6028abc0ccfSmrgm4_undefine([_defopt])
6037366012aSmrg
6048abc0ccfSmrgif test "x$use_xmlto" = x"auto"; then
6058abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6068abc0ccfSmrg   if test "x$XMLTO" = "x"; then
6078abc0ccfSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
6088abc0ccfSmrg	have_xmlto=no
6098abc0ccfSmrg   else
6108abc0ccfSmrg        have_xmlto=yes
6118abc0ccfSmrg   fi
6128abc0ccfSmrgelif test "x$use_xmlto" = x"yes" ; then
6138abc0ccfSmrg   AC_PATH_PROG([XMLTO], [xmlto])
6148abc0ccfSmrg   if test "x$XMLTO" = "x"; then
6158abc0ccfSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
6168abc0ccfSmrg   fi
6178abc0ccfSmrg   have_xmlto=yes
6188abc0ccfSmrgelif test "x$use_xmlto" = x"no" ; then
6198abc0ccfSmrg   if test "x$XMLTO" != "x"; then
6208abc0ccfSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
6218abc0ccfSmrg   fi
6228abc0ccfSmrg   have_xmlto=no
6237366012aSmrgelse
6248abc0ccfSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
6257a0395d0Smrgfi
6267a0395d0Smrg
6278abc0ccfSmrg# Test for a minimum version of xmlto, if provided.
6288abc0ccfSmrgm4_ifval([$1],
6298abc0ccfSmrg[if test "$have_xmlto" = yes; then
6308abc0ccfSmrg    # scrape the xmlto version
6318abc0ccfSmrg    AC_MSG_CHECKING([the xmlto version])
6328abc0ccfSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
6338abc0ccfSmrg    AC_MSG_RESULT([$xmlto_version])
6348abc0ccfSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
6358abc0ccfSmrg        [if test "x$use_xmlto" = xauto; then
6368abc0ccfSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
6378abc0ccfSmrg            have_xmlto=no
6388abc0ccfSmrg        else
6398abc0ccfSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
6408abc0ccfSmrg        fi])
6418abc0ccfSmrgfi])
6427a0395d0Smrg
6438abc0ccfSmrg# Test for the ability of xmlto to generate a text target
6448abc0ccfSmrghave_xmlto_text=no
6458abc0ccfSmrgcat > conftest.xml << "EOF"
6468abc0ccfSmrgEOF
6478abc0ccfSmrgAS_IF([test "$have_xmlto" = yes],
6488abc0ccfSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
6498abc0ccfSmrg             [have_xmlto_text=yes],
6508abc0ccfSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
6518abc0ccfSmrgrm -f conftest.xml
6528abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
6538abc0ccfSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
6548abc0ccfSmrg]) # XORG_WITH_XMLTO
6557a0395d0Smrg
6568abc0ccfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
6578abc0ccfSmrg# --------------------------------------------
6588abc0ccfSmrg# Minimum version: 1.12.0
6598abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
6607366012aSmrg#
6618abc0ccfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
6628abc0ccfSmrg# XML-based language used for the transformation of XML documents.
6638abc0ccfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
6648abc0ccfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
6658abc0ccfSmrg# The XSLT processor is often used as a standalone tool for transformations.
6668abc0ccfSmrg# It should not be assumed that this tool is used only to work with documnetation.
6678abc0ccfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
6688abc0ccfSmrg#
6698abc0ccfSmrg# Interface to module:
6708abc0ccfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
6718abc0ccfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
6728abc0ccfSmrg#		 returns the path set by the user in the environment
6738abc0ccfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
6748abc0ccfSmrg#		  'no' user instructs the module not to use xsltproc
6758abc0ccfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
6768abc0ccfSmrg#
6778abc0ccfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
6788abc0ccfSmrg#
6798abc0ccfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
6808abc0ccfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
6818abc0ccfSmrg# Preserves the interface, should it be implemented later
6828abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
6838abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
6848abc0ccfSmrgAC_ARG_WITH(xsltproc,
6858abc0ccfSmrg	AS_HELP_STRING([--with-xsltproc],
6868abc0ccfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
6878abc0ccfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
6888abc0ccfSmrgm4_undefine([_defopt])
6897366012aSmrg
6908abc0ccfSmrgif test "x$use_xsltproc" = x"auto"; then
6918abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
6928abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
6938abc0ccfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
6948abc0ccfSmrg	have_xsltproc=no
6958abc0ccfSmrg   else
6968abc0ccfSmrg        have_xsltproc=yes
6977366012aSmrg   fi
6988abc0ccfSmrgelif test "x$use_xsltproc" = x"yes" ; then
6998abc0ccfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
7008abc0ccfSmrg   if test "x$XSLTPROC" = "x"; then
7018abc0ccfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
7027366012aSmrg   fi
7038abc0ccfSmrg   have_xsltproc=yes
7048abc0ccfSmrgelif test "x$use_xsltproc" = x"no" ; then
7058abc0ccfSmrg   if test "x$XSLTPROC" != "x"; then
7068abc0ccfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
7078abc0ccfSmrg   fi
7088abc0ccfSmrg   have_xsltproc=no
7097366012aSmrgelse
7108abc0ccfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
7117366012aSmrgfi
7127a0395d0Smrg
7138abc0ccfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
7148abc0ccfSmrg]) # XORG_WITH_XSLTPROC
7157a0395d0Smrg
7168abc0ccfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
7178abc0ccfSmrg# ----------------------------------------
7188abc0ccfSmrg# Minimum version: 1.15.0
7197a0395d0Smrg#
7208abc0ccfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
7218abc0ccfSmrg# scanning arbitrary text files, extracting information from those text files,
7228abc0ccfSmrg# and printing reports based on that information.
7237366012aSmrg#
7248abc0ccfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
7258abc0ccfSmrg#
7268abc0ccfSmrg# Interface to module:
7278abc0ccfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
7288abc0ccfSmrg# PERL:	     returns the path of the perl program found
7298abc0ccfSmrg#	     returns the path set by the user in the environment
7308abc0ccfSmrg# --with-perl: 'yes' user instructs the module to use perl
7318abc0ccfSmrg#	       'no' user instructs the module not to use perl
7328abc0ccfSmrg# have_perl: returns yes if perl found in PATH or no
7338abc0ccfSmrg#
7348abc0ccfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
7358abc0ccfSmrg#
7368abc0ccfSmrgAC_DEFUN([XORG_WITH_PERL],[
7378abc0ccfSmrgAC_ARG_VAR([PERL], [Path to perl command])
7388abc0ccfSmrg# Preserves the interface, should it be implemented later
7398abc0ccfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
7408abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
7418abc0ccfSmrgAC_ARG_WITH(perl,
7428abc0ccfSmrg	AS_HELP_STRING([--with-perl],
7438abc0ccfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
7448abc0ccfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
7458abc0ccfSmrgm4_undefine([_defopt])
7467a0395d0Smrg
7478abc0ccfSmrgif test "x$use_perl" = x"auto"; then
7488abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
7498abc0ccfSmrg   if test "x$PERL" = "x"; then
7508abc0ccfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
7518abc0ccfSmrg	have_perl=no
7528abc0ccfSmrg   else
7538abc0ccfSmrg        have_perl=yes
7548abc0ccfSmrg   fi
7558abc0ccfSmrgelif test "x$use_perl" = x"yes" ; then
7568abc0ccfSmrg   AC_PATH_PROG([PERL], [perl])
7578abc0ccfSmrg   if test "x$PERL" = "x"; then
7588abc0ccfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
7598abc0ccfSmrg   fi
7608abc0ccfSmrg   have_perl=yes
7618abc0ccfSmrgelif test "x$use_perl" = x"no" ; then
7628abc0ccfSmrg   if test "x$PERL" != "x"; then
7638abc0ccfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
7648abc0ccfSmrg   fi
7658abc0ccfSmrg   have_perl=no
7668abc0ccfSmrgelse
7678abc0ccfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
7688abc0ccfSmrgfi
7697366012aSmrg
7708abc0ccfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
7718abc0ccfSmrg]) # XORG_WITH_PERL
7727366012aSmrg
7738abc0ccfSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
7748abc0ccfSmrg# ----------------
7758abc0ccfSmrg# Minimum version: 1.5.0
7768abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
7777a0395d0Smrg#
7788abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
7798abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
7808abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
7818abc0ccfSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
7828abc0ccfSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
7838abc0ccfSmrg# --with-asciidoc assumes 'auto'.
7847a0395d0Smrg#
7858abc0ccfSmrg# Interface to module:
7868abc0ccfSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
7878abc0ccfSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
7888abc0ccfSmrg#		 returns the path set by the user in the environment
7898abc0ccfSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
7908abc0ccfSmrg#		  'no' user instructs the module not to use asciidoc
7917a0395d0Smrg#
7928abc0ccfSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
7938abc0ccfSmrg#
7948abc0ccfSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
7958abc0ccfSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
7968abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
7978abc0ccfSmrgAC_ARG_WITH(asciidoc,
7988abc0ccfSmrg	AS_HELP_STRING([--with-asciidoc],
7998abc0ccfSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
8008abc0ccfSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
8018abc0ccfSmrgm4_undefine([_defopt])
8027366012aSmrg
8038abc0ccfSmrgif test "x$use_asciidoc" = x"auto"; then
8048abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8058abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
8068abc0ccfSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
8078abc0ccfSmrg	have_asciidoc=no
8088abc0ccfSmrg   else
8098abc0ccfSmrg        have_asciidoc=yes
8108abc0ccfSmrg   fi
8118abc0ccfSmrgelif test "x$use_asciidoc" = x"yes" ; then
8128abc0ccfSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
8138abc0ccfSmrg   if test "x$ASCIIDOC" = "x"; then
8148abc0ccfSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
8158abc0ccfSmrg   fi
8168abc0ccfSmrg   have_asciidoc=yes
8178abc0ccfSmrgelif test "x$use_asciidoc" = x"no" ; then
8188abc0ccfSmrg   if test "x$ASCIIDOC" != "x"; then
8198abc0ccfSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
8208abc0ccfSmrg   fi
8218abc0ccfSmrg   have_asciidoc=no
8228abc0ccfSmrgelse
8238abc0ccfSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
8248abc0ccfSmrgfi
8258abc0ccfSmrgm4_ifval([$1],
8268abc0ccfSmrg[if test "$have_asciidoc" = yes; then
8278abc0ccfSmrg    # scrape the asciidoc version
8288abc0ccfSmrg    AC_MSG_CHECKING([the asciidoc version])
8298abc0ccfSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
8308abc0ccfSmrg    AC_MSG_RESULT([$asciidoc_version])
8318abc0ccfSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
8328abc0ccfSmrg        [if test "x$use_asciidoc" = xauto; then
8338abc0ccfSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
8348abc0ccfSmrg            have_asciidoc=no
8358abc0ccfSmrg        else
8368abc0ccfSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
8378abc0ccfSmrg        fi])
8388abc0ccfSmrgfi])
8398abc0ccfSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
8408abc0ccfSmrg]) # XORG_WITH_ASCIIDOC
8417366012aSmrg
8428abc0ccfSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
8438abc0ccfSmrg# --------------------------------
8448abc0ccfSmrg# Minimum version: 1.5.0
8458abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
8462852888eSmrg#
8478abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
8488abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
8498abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
8508abc0ccfSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
8518abc0ccfSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
8528abc0ccfSmrg# --with-doxygen assumes 'auto'.
8532852888eSmrg#
8548abc0ccfSmrg# Interface to module:
8558abc0ccfSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
8568abc0ccfSmrg# DOXYGEN:	 returns the path of the doxygen program found
8578abc0ccfSmrg#		 returns the path set by the user in the environment
8588abc0ccfSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
8598abc0ccfSmrg#		  'no' user instructs the module not to use doxygen
8602852888eSmrg#
8618abc0ccfSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
8622852888eSmrg#
8638abc0ccfSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
8648abc0ccfSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
8658abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
8668abc0ccfSmrgAC_ARG_WITH(doxygen,
8678abc0ccfSmrg	AS_HELP_STRING([--with-doxygen],
8688abc0ccfSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
8698abc0ccfSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
8708abc0ccfSmrgm4_undefine([_defopt])
8712852888eSmrg
8728abc0ccfSmrgif test "x$use_doxygen" = x"auto"; then
8738abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
8748abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
8758abc0ccfSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
8768abc0ccfSmrg	have_doxygen=no
8778abc0ccfSmrg   else
8788abc0ccfSmrg        have_doxygen=yes
8798abc0ccfSmrg   fi
8808abc0ccfSmrgelif test "x$use_doxygen" = x"yes" ; then
8818abc0ccfSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
8828abc0ccfSmrg   if test "x$DOXYGEN" = "x"; then
8838abc0ccfSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
8848abc0ccfSmrg   fi
8858abc0ccfSmrg   have_doxygen=yes
8868abc0ccfSmrgelif test "x$use_doxygen" = x"no" ; then
8878abc0ccfSmrg   if test "x$DOXYGEN" != "x"; then
8888abc0ccfSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
8898abc0ccfSmrg   fi
8908abc0ccfSmrg   have_doxygen=no
8918abc0ccfSmrgelse
8928abc0ccfSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
8932852888eSmrgfi
8948abc0ccfSmrgm4_ifval([$1],
8958abc0ccfSmrg[if test "$have_doxygen" = yes; then
8968abc0ccfSmrg    # scrape the doxygen version
8978abc0ccfSmrg    AC_MSG_CHECKING([the doxygen version])
8988abc0ccfSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
8998abc0ccfSmrg    AC_MSG_RESULT([$doxygen_version])
9008abc0ccfSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
9018abc0ccfSmrg        [if test "x$use_doxygen" = xauto; then
9028abc0ccfSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
9038abc0ccfSmrg            have_doxygen=no
9048abc0ccfSmrg        else
9058abc0ccfSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
9068abc0ccfSmrg        fi])
9078abc0ccfSmrgfi])
9088abc0ccfSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
9098abc0ccfSmrg]) # XORG_WITH_DOXYGEN
9102852888eSmrg
9118abc0ccfSmrg# XORG_WITH_GROFF([DEFAULT])
9128abc0ccfSmrg# ----------------
9138abc0ccfSmrg# Minimum version: 1.6.0
9148abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
9152852888eSmrg#
9168abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
9178abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
9188abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
9198abc0ccfSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
9208abc0ccfSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
9218abc0ccfSmrg# --with-groff assumes 'auto'.
9222852888eSmrg#
9238abc0ccfSmrg# Interface to module:
9248abc0ccfSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
9258abc0ccfSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
9268abc0ccfSmrg# HAVE_GROFF_MS: the -ms macros package
9278abc0ccfSmrg# GROFF:	 returns the path of the groff program found
9288abc0ccfSmrg#		 returns the path set by the user in the environment
9298abc0ccfSmrg# --with-groff:	 'yes' user instructs the module to use groff
9308abc0ccfSmrg#		 'no' user instructs the module not to use groff
93196402570Smrg#
9328abc0ccfSmrg# Added in version 1.9.0:
9338abc0ccfSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
9348abc0ccfSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
9358abc0ccfSmrg#		   psselect from the psutils package.
9368abc0ccfSmrg#		   the ghostcript package. Refer to the grohtml man pages
9372852888eSmrg#
9388abc0ccfSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
9392852888eSmrg#
9408abc0ccfSmrg# OS and distros often splits groff in a basic and full package, the former
9418abc0ccfSmrg# having the groff program and the later having devices, fonts and macros
9428abc0ccfSmrg# Checking for the groff executable is not enough.
9432852888eSmrg#
9448abc0ccfSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
9458abc0ccfSmrg# unset HAVE_GROFF or GROFF env variables.
9468abc0ccfSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
9472852888eSmrg#
9488abc0ccfSmrgAC_DEFUN([XORG_WITH_GROFF],[
9498abc0ccfSmrgAC_ARG_VAR([GROFF], [Path to groff command])
9508abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
9518abc0ccfSmrgAC_ARG_WITH(groff,
9528abc0ccfSmrg	AS_HELP_STRING([--with-groff],
9538abc0ccfSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
9548abc0ccfSmrg	   [use_groff=$withval], [use_groff=]_defopt)
9558abc0ccfSmrgm4_undefine([_defopt])
9562852888eSmrg
9578abc0ccfSmrgif test "x$use_groff" = x"auto"; then
9588abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
9598abc0ccfSmrg   if test "x$GROFF" = "x"; then
9608abc0ccfSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
9618abc0ccfSmrg	have_groff=no
9628abc0ccfSmrg   else
9638abc0ccfSmrg        have_groff=yes
9648abc0ccfSmrg   fi
9658abc0ccfSmrgelif test "x$use_groff" = x"yes" ; then
9668abc0ccfSmrg   AC_PATH_PROG([GROFF], [groff])
9678abc0ccfSmrg   if test "x$GROFF" = "x"; then
9688abc0ccfSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
9698abc0ccfSmrg   fi
9708abc0ccfSmrg   have_groff=yes
9718abc0ccfSmrgelif test "x$use_groff" = x"no" ; then
9728abc0ccfSmrg   if test "x$GROFF" != "x"; then
9738abc0ccfSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
9748abc0ccfSmrg   fi
9758abc0ccfSmrg   have_groff=no
9768abc0ccfSmrgelse
9778abc0ccfSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
9788abc0ccfSmrgfi
9792852888eSmrg
9808abc0ccfSmrg# We have groff, test for the presence of the macro packages
9818abc0ccfSmrgif test "x$have_groff" = x"yes"; then
9828abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
9838abc0ccfSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
9848abc0ccfSmrg        groff_ms_works=yes
9858abc0ccfSmrg    else
9868abc0ccfSmrg        groff_ms_works=no
9878abc0ccfSmrg    fi
9888abc0ccfSmrg    AC_MSG_RESULT([$groff_ms_works])
9898abc0ccfSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
9908abc0ccfSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
9918abc0ccfSmrg        groff_mm_works=yes
9928abc0ccfSmrg    else
9938abc0ccfSmrg        groff_mm_works=no
9948abc0ccfSmrg    fi
9958abc0ccfSmrg    AC_MSG_RESULT([$groff_mm_works])
9968abc0ccfSmrgfi
9972852888eSmrg
9988abc0ccfSmrg# We have groff, test for HTML dependencies, one command per package
9998abc0ccfSmrgif test "x$have_groff" = x"yes"; then
10008abc0ccfSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
10018abc0ccfSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
10028abc0ccfSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
10038abc0ccfSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
10048abc0ccfSmrg      have_groff_html=yes
10058abc0ccfSmrg   else
10068abc0ccfSmrg      have_groff_html=no
10078abc0ccfSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
10088abc0ccfSmrg   fi
10098abc0ccfSmrgfi
10102852888eSmrg
10118abc0ccfSmrg# Set Automake conditionals for Makefiles
10128abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
10138abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
10148abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
10158abc0ccfSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
10168abc0ccfSmrg]) # XORG_WITH_GROFF
10177366012aSmrg
10188abc0ccfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
10198abc0ccfSmrg# ---------------------------------------
10208abc0ccfSmrg# Minimum version: 1.6.0
10218abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10228abc0ccfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
10237a0395d0Smrg#
10248abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
10258abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
10268abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10278abc0ccfSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
10288abc0ccfSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
10298abc0ccfSmrg# --with-fop assumes 'auto'.
10307a0395d0Smrg#
10318abc0ccfSmrg# Interface to module:
10328abc0ccfSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
10338abc0ccfSmrg# FOP:	 	returns the path of the fop program found
10348abc0ccfSmrg#		returns the path set by the user in the environment
10358abc0ccfSmrg# --with-fop: 	'yes' user instructs the module to use fop
10368abc0ccfSmrg#		'no' user instructs the module not to use fop
10377a0395d0Smrg#
10388abc0ccfSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
10397a0395d0Smrg#
10408abc0ccfSmrgAC_DEFUN([XORG_WITH_FOP],[
10418abc0ccfSmrgAC_ARG_VAR([FOP], [Path to fop command])
10428abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
10438abc0ccfSmrgAC_ARG_WITH(fop,
10448abc0ccfSmrg	AS_HELP_STRING([--with-fop],
10458abc0ccfSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
10468abc0ccfSmrg	   [use_fop=$withval], [use_fop=]_defopt)
10478abc0ccfSmrgm4_undefine([_defopt])
10487a0395d0Smrg
10498abc0ccfSmrgif test "x$use_fop" = x"auto"; then
10508abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
10518abc0ccfSmrg   if test "x$FOP" = "x"; then
10528abc0ccfSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
10538abc0ccfSmrg	have_fop=no
10548abc0ccfSmrg   else
10558abc0ccfSmrg        have_fop=yes
10568abc0ccfSmrg   fi
10578abc0ccfSmrgelif test "x$use_fop" = x"yes" ; then
10588abc0ccfSmrg   AC_PATH_PROG([FOP], [fop])
10598abc0ccfSmrg   if test "x$FOP" = "x"; then
10608abc0ccfSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
10618abc0ccfSmrg   fi
10628abc0ccfSmrg   have_fop=yes
10638abc0ccfSmrgelif test "x$use_fop" = x"no" ; then
10648abc0ccfSmrg   if test "x$FOP" != "x"; then
10658abc0ccfSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
10668abc0ccfSmrg   fi
10678abc0ccfSmrg   have_fop=no
10687366012aSmrgelse
10698abc0ccfSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
10707a0395d0Smrgfi
10717a0395d0Smrg
10728abc0ccfSmrg# Test for a minimum version of fop, if provided.
10738abc0ccfSmrgm4_ifval([$1],
10748abc0ccfSmrg[if test "$have_fop" = yes; then
10758abc0ccfSmrg    # scrape the fop version
10768abc0ccfSmrg    AC_MSG_CHECKING([for fop minimum version])
10778abc0ccfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
10788abc0ccfSmrg    AC_MSG_RESULT([$fop_version])
10798abc0ccfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
10808abc0ccfSmrg        [if test "x$use_fop" = xauto; then
10818abc0ccfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
10828abc0ccfSmrg            have_fop=no
10838abc0ccfSmrg        else
10848abc0ccfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
10858abc0ccfSmrg        fi])
10868abc0ccfSmrgfi])
10878abc0ccfSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
10888abc0ccfSmrg]) # XORG_WITH_FOP
10897a0395d0Smrg
10908abc0ccfSmrg# XORG_WITH_PS2PDF([DEFAULT])
10918abc0ccfSmrg# ----------------
10928abc0ccfSmrg# Minimum version: 1.6.0
10938abc0ccfSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10942adc0320Smrg#
10958abc0ccfSmrg# Documentation tools are not always available on all platforms and sometimes
10968abc0ccfSmrg# not at the appropriate level. This macro enables a module to test for the
10978abc0ccfSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
10988abc0ccfSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
10998abc0ccfSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
11008abc0ccfSmrg# --with-ps2pdf assumes 'auto'.
11017a0395d0Smrg#
11028abc0ccfSmrg# Interface to module:
11038abc0ccfSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
11048abc0ccfSmrg# PS2PDF:	returns the path of the ps2pdf program found
11058abc0ccfSmrg#		returns the path set by the user in the environment
11068abc0ccfSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
11078abc0ccfSmrg#		 'no' user instructs the module not to use ps2pdf
11088abc0ccfSmrg#
11098abc0ccfSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
11108abc0ccfSmrg#
11118abc0ccfSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
11128abc0ccfSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
11138abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
11148abc0ccfSmrgAC_ARG_WITH(ps2pdf,
11158abc0ccfSmrg	AS_HELP_STRING([--with-ps2pdf],
11168abc0ccfSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
11178abc0ccfSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
11188abc0ccfSmrgm4_undefine([_defopt])
11197a0395d0Smrg
11208abc0ccfSmrgif test "x$use_ps2pdf" = x"auto"; then
11218abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
11228abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
11238abc0ccfSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
11248abc0ccfSmrg	have_ps2pdf=no
11258abc0ccfSmrg   else
11268abc0ccfSmrg        have_ps2pdf=yes
11278abc0ccfSmrg   fi
11288abc0ccfSmrgelif test "x$use_ps2pdf" = x"yes" ; then
11298abc0ccfSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
11308abc0ccfSmrg   if test "x$PS2PDF" = "x"; then
11318abc0ccfSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
11328abc0ccfSmrg   fi
11338abc0ccfSmrg   have_ps2pdf=yes
11348abc0ccfSmrgelif test "x$use_ps2pdf" = x"no" ; then
11358abc0ccfSmrg   if test "x$PS2PDF" != "x"; then
11368abc0ccfSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
11378abc0ccfSmrg   fi
11388abc0ccfSmrg   have_ps2pdf=no
11397366012aSmrgelse
11408abc0ccfSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
11417366012aSmrgfi
11428abc0ccfSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
11438abc0ccfSmrg]) # XORG_WITH_PS2PDF
11447a0395d0Smrg
11458abc0ccfSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
11462adc0320Smrg# ----------------
11478abc0ccfSmrg# Minimum version: 1.6.0
11482adc0320Smrg#
11492adc0320Smrg# Documentation tools are not always available on all platforms and sometimes
11508abc0ccfSmrg# not at the appropriate level. This macro enables a builder to skip all
11518abc0ccfSmrg# documentation targets except traditional man pages.
11528abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
11538abc0ccfSmrg# maximum flexibilty in controlling documentation building.
11548abc0ccfSmrg# Refer to:
11558abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
11568abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
11578abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
11588abc0ccfSmrg# XORG_WITH_FOP           --with-fop
11598abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
11608abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
11612adc0320Smrg#
11622adc0320Smrg# Interface to module:
11638abc0ccfSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
11648abc0ccfSmrg# --enable-docs: 'yes' user instructs the module to generate docs
11658abc0ccfSmrg#		 'no' user instructs the module not to generate docs
11668abc0ccfSmrg# parm1:	specify the default value, yes or no.
11672adc0320Smrg#
11688abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
11698abc0ccfSmrgm4_define([docs_default], m4_default([$1], [yes]))
11708abc0ccfSmrgAC_ARG_ENABLE(docs,
11718abc0ccfSmrg	AS_HELP_STRING([--enable-docs],
11728abc0ccfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
11738abc0ccfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
11748abc0ccfSmrgm4_undefine([docs_default])
11758abc0ccfSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
11768abc0ccfSmrgAC_MSG_CHECKING([whether to build documentation])
11778abc0ccfSmrgAC_MSG_RESULT([$build_docs])
11788abc0ccfSmrg]) # XORG_ENABLE_DOCS
11792adc0320Smrg
11808abc0ccfSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
11818abc0ccfSmrg# ----------------
11828abc0ccfSmrg# Minimum version: 1.6.0
11832852888eSmrg#
11848abc0ccfSmrg# This macro enables a builder to skip all developer documentation.
11858abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
11868abc0ccfSmrg# maximum flexibilty in controlling documentation building.
11878abc0ccfSmrg# Refer to:
11888abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
11898abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
11908abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
11918abc0ccfSmrg# XORG_WITH_FOP           --with-fop
11928abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
11938abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
11942852888eSmrg#
11952852888eSmrg# Interface to module:
11968abc0ccfSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
11978abc0ccfSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
11988abc0ccfSmrg#			'no' user instructs the module not to generate developer docs
11998abc0ccfSmrg# parm1:		specify the default value, yes or no.
12002852888eSmrg#
12018abc0ccfSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
12028abc0ccfSmrgm4_define([devel_default], m4_default([$1], [yes]))
12038abc0ccfSmrgAC_ARG_ENABLE(devel-docs,
12048abc0ccfSmrg	AS_HELP_STRING([--enable-devel-docs],
12058abc0ccfSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
12068abc0ccfSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
12078abc0ccfSmrgm4_undefine([devel_default])
12088abc0ccfSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
12098abc0ccfSmrgAC_MSG_CHECKING([whether to build developer documentation])
12108abc0ccfSmrgAC_MSG_RESULT([$build_devel_docs])
12118abc0ccfSmrg]) # XORG_ENABLE_DEVEL_DOCS
12122852888eSmrg
12138abc0ccfSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
12148abc0ccfSmrg# ----------------
12158abc0ccfSmrg# Minimum version: 1.6.0
12168abc0ccfSmrg#
12178abc0ccfSmrg# This macro enables a builder to skip all functional specification targets.
12188abc0ccfSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
12198abc0ccfSmrg# maximum flexibilty in controlling documentation building.
12208abc0ccfSmrg# Refer to:
12218abc0ccfSmrg# XORG_WITH_XMLTO         --with-xmlto
12228abc0ccfSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
12238abc0ccfSmrg# XORG_WITH_DOXYGEN       --with-doxygen
12248abc0ccfSmrg# XORG_WITH_FOP           --with-fop
12258abc0ccfSmrg# XORG_WITH_GROFF         --with-groff
12268abc0ccfSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
12278abc0ccfSmrg#
12288abc0ccfSmrg# Interface to module:
12298abc0ccfSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
12308abc0ccfSmrg# --enable-specs:	'yes' user instructs the module to generate specs
12318abc0ccfSmrg#			'no' user instructs the module not to generate specs
12328abc0ccfSmrg# parm1:		specify the default value, yes or no.
12338abc0ccfSmrg#
12348abc0ccfSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
12358abc0ccfSmrgm4_define([spec_default], m4_default([$1], [yes]))
12368abc0ccfSmrgAC_ARG_ENABLE(specs,
12378abc0ccfSmrg	AS_HELP_STRING([--enable-specs],
12388abc0ccfSmrg	   [Enable building the specs (default: ]spec_default[)]),
12398abc0ccfSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
12408abc0ccfSmrgm4_undefine([spec_default])
12418abc0ccfSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
12428abc0ccfSmrgAC_MSG_CHECKING([whether to build functional specifications])
12438abc0ccfSmrgAC_MSG_RESULT([$build_specs])
12448abc0ccfSmrg]) # XORG_ENABLE_SPECS
12452852888eSmrg
12468abc0ccfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
12478abc0ccfSmrg# ----------------------------------------------
12488abc0ccfSmrg# Minimum version: 1.13.0
124996402570Smrg#
12508abc0ccfSmrg# This macro enables a builder to enable/disable unit testing
12518abc0ccfSmrg# It makes no assumption about the test cases implementation
12528abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
12538abc0ccfSmrg# They may or may not use the software utility library GLib
125496402570Smrg#
12558abc0ccfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
12568abc0ccfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
12578abc0ccfSmrg# The variable enable_unit_tests is used by other macros in this file.
125896402570Smrg#
125996402570Smrg# Interface to module:
12608abc0ccfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
12618abc0ccfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
12628abc0ccfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
12638abc0ccfSmrg#			'no' user instructs the module not to build tests
12648abc0ccfSmrg# parm1:		specify the default value, yes or no.
126596402570Smrg#
12668abc0ccfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
12678abc0ccfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
12688abc0ccfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
12698abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
12708abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
12718abc0ccfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
12728abc0ccfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
12738abc0ccfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
127496402570Smrgm4_undefine([_defopt])
12758abc0ccfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
12768abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
12778abc0ccfSmrgAC_MSG_RESULT([$enable_unit_tests])
12788abc0ccfSmrg]) # XORG_ENABLE_UNIT_TESTS
127996402570Smrg
12808abc0ccfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
12818abc0ccfSmrg# ------------------------------------------------------
12828abc0ccfSmrg# Minimum version: 1.17.0
12832adc0320Smrg#
12848abc0ccfSmrg# This macro enables a builder to enable/disable integration testing
12858abc0ccfSmrg# It makes no assumption about the test cases' implementation
12868abc0ccfSmrg# Test cases may or may not use Automake "Support for test suites"
12872adc0320Smrg#
12888abc0ccfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
12898abc0ccfSmrg# usually requires less dependencies and may be built and run under less
12908abc0ccfSmrg# stringent environments than integration tests.
12912adc0320Smrg#
12928abc0ccfSmrg# Interface to module:
12938abc0ccfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
12948abc0ccfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
12958abc0ccfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
12968abc0ccfSmrg#                             'no' user instructs the module not to build tests
12978abc0ccfSmrg# parm1:                      specify the default value, yes or no.
12982adc0320Smrg#
12998abc0ccfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
13008abc0ccfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
13018abc0ccfSmrgm4_define([_defopt], m4_default([$1], [auto]))
13028abc0ccfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
13038abc0ccfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
13048abc0ccfSmrg	[enable_integration_tests=$enableval],
13058abc0ccfSmrg	[enable_integration_tests=]_defopt)
13062852888eSmrgm4_undefine([_defopt])
13078abc0ccfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
13088abc0ccfSmrg	[test "x$enable_integration_tests" != xno])
13098abc0ccfSmrgAC_MSG_CHECKING([whether to build unit test cases])
13108abc0ccfSmrgAC_MSG_RESULT([$enable_integration_tests])
13118abc0ccfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
13122adc0320Smrg
13138abc0ccfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
13148abc0ccfSmrg# ----------------------------------------
13158abc0ccfSmrg# Minimum version: 1.13.0
13162adc0320Smrg#
13178abc0ccfSmrg# GLib is a library which provides advanced data structures and functions.
13188abc0ccfSmrg# This macro enables a module to test for the presence of Glib.
13192adc0320Smrg#
13208abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
13218abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
13222adc0320Smrg#
13238abc0ccfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
13248abc0ccfSmrg# test support usually requires less dependencies and may be built and run under
13258abc0ccfSmrg# less stringent environments than integration tests.
13262adc0320Smrg#
13272adc0320Smrg# Interface to module:
13288abc0ccfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
13298abc0ccfSmrg# with_glib: used in configure.ac to know if GLib has been found
13308abc0ccfSmrg# --with-glib:	'yes' user instructs the module to use glib
13318abc0ccfSmrg#		'no' user instructs the module not to use glib
13322adc0320Smrg#
13338abc0ccfSmrgAC_DEFUN([XORG_WITH_GLIB],[
13348abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
13358abc0ccfSmrgm4_define([_defopt], m4_default([$2], [auto]))
13368abc0ccfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
13378abc0ccfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
13388abc0ccfSmrg	[with_glib=$withval], [with_glib=]_defopt)
13392852888eSmrgm4_undefine([_defopt])
13402adc0320Smrg
13418abc0ccfSmrghave_glib=no
13428abc0ccfSmrg# Do not probe GLib if user explicitly disabled unit testing
13438abc0ccfSmrgif test "x$enable_unit_tests" != x"no"; then
13448abc0ccfSmrg  # Do not probe GLib if user explicitly disabled it
13458abc0ccfSmrg  if test "x$with_glib" != x"no"; then
13468abc0ccfSmrg    m4_ifval(
13478abc0ccfSmrg      [$1],
13488abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
13498abc0ccfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
13508abc0ccfSmrg    )
13518abc0ccfSmrg  fi
13522adc0320Smrgfi
13532adc0320Smrg
13548abc0ccfSmrg# Not having GLib when unit testing has been explicitly requested is an error
13558abc0ccfSmrgif test "x$enable_unit_tests" = x"yes"; then
13568abc0ccfSmrg  if test "x$have_glib" = x"no"; then
13578abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
13588abc0ccfSmrg  fi
13592adc0320Smrgfi
13602adc0320Smrg
13618abc0ccfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
13628abc0ccfSmrgif test "x$enable_unit_tests" = x"no"; then
13638abc0ccfSmrg  if test "x$with_glib" = x"yes"; then
13648abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
13658abc0ccfSmrg  fi
13662adc0320Smrgfi
13672adc0320Smrg
13688abc0ccfSmrg# Not having GLib when it has been explicitly requested is an error
13698abc0ccfSmrgif test "x$with_glib" = x"yes"; then
13708abc0ccfSmrg  if test "x$have_glib" = x"no"; then
13718abc0ccfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
13728abc0ccfSmrg  fi
13738abc0ccfSmrgfi
13742adc0320Smrg
13758abc0ccfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
13768abc0ccfSmrg]) # XORG_WITH_GLIB
13778abc0ccfSmrg
13788abc0ccfSmrg# XORG_LD_WRAP([required|optional])
13798abc0ccfSmrg# ---------------------------------
13808abc0ccfSmrg# Minimum version: 1.13.0
13812adc0320Smrg#
13828abc0ccfSmrg# Check if linker supports -wrap, passed via compiler flags
13832adc0320Smrg#
13848abc0ccfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
13858abc0ccfSmrg# Otherwise the value of $enable_unit_tests is blank.
13862adc0320Smrg#
13878abc0ccfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
13888abc0ccfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
13898abc0ccfSmrg# available, an argument of "optional" allows use when some unit tests require
13908abc0ccfSmrg# ld -wrap and others do not.
13912adc0320Smrg#
13928abc0ccfSmrgAC_DEFUN([XORG_LD_WRAP],[
13938abc0ccfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
13948abc0ccfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
13958abc0ccfSmrg                      void __wrap_exit(int status) { return; }],
13968abc0ccfSmrg                     [exit(0);])])
13978abc0ccfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
13988abc0ccfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
13998abc0ccfSmrg  if test "x$have_ld_wrap" = x"no"; then
14008abc0ccfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
14018abc0ccfSmrg  fi
14022adc0320Smrgfi
14038abc0ccfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
14048abc0ccfSmrg#
14058abc0ccfSmrg]) # XORG_LD_WRAP
140696402570Smrg
14078abc0ccfSmrg# XORG_CHECK_LINKER_FLAGS
14088abc0ccfSmrg# -----------------------
14098abc0ccfSmrg# SYNOPSIS
14102adc0320Smrg#
14118abc0ccfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
14122adc0320Smrg#
14138abc0ccfSmrg# DESCRIPTION
14142adc0320Smrg#
14158abc0ccfSmrg#   Check whether the given linker FLAGS work with the current language's
14168abc0ccfSmrg#   linker, or whether they give an error.
14172adc0320Smrg#
14188abc0ccfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
14198abc0ccfSmrg#   success/failure.
14202adc0320Smrg#
14218abc0ccfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
14222adc0320Smrg#
14238abc0ccfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
14242adc0320Smrg#
14258abc0ccfSmrg# LICENSE
14262adc0320Smrg#
14278abc0ccfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
14288abc0ccfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
14298abc0ccfSmrg#   Copyright (c) 2009 Matteo Frigo
14302adc0320Smrg#
14318abc0ccfSmrg#   This program is free software: you can redistribute it and/or modify it
14328abc0ccfSmrg#   under the terms of the GNU General Public License as published by the
14338abc0ccfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
14348abc0ccfSmrg#   option) any later version.
14352adc0320Smrg#
14368abc0ccfSmrg#   This program is distributed in the hope that it will be useful, but
14378abc0ccfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
14388abc0ccfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14398abc0ccfSmrg#   Public License for more details.
14402adc0320Smrg#
14418abc0ccfSmrg#   You should have received a copy of the GNU General Public License along
14428abc0ccfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
14432adc0320Smrg#
14448abc0ccfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
14458abc0ccfSmrg#   gives unlimited permission to copy, distribute and modify the configure
14468abc0ccfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
14478abc0ccfSmrg#   need not follow the terms of the GNU General Public License when using
14488abc0ccfSmrg#   or distributing such scripts, even though portions of the text of the
14498abc0ccfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
14508abc0ccfSmrg#   all other use of the material that constitutes the Autoconf Macro.
14512adc0320Smrg#
14528abc0ccfSmrg#   This special exception to the GPL applies to versions of the Autoconf
14538abc0ccfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
14548abc0ccfSmrg#   modified version of the Autoconf Macro, you may extend this special
14558abc0ccfSmrg#   exception to the GPL to apply to your modified version as well.#
14568abc0ccfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
14578abc0ccfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
14588abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
14598abc0ccfSmrgAS_LITERAL_IF([$1],
14608abc0ccfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
14618abc0ccfSmrg      ax_save_FLAGS=$LDFLAGS
14628abc0ccfSmrg      LDFLAGS="$1"
14638abc0ccfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
14648abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
14658abc0ccfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
14668abc0ccfSmrg      LDFLAGS=$ax_save_FLAGS])],
14678abc0ccfSmrg  [ax_save_FLAGS=$LDFLAGS
14688abc0ccfSmrg   LDFLAGS="$1"
14698abc0ccfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
14708abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
14718abc0ccfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
14728abc0ccfSmrg   LDFLAGS=$ax_save_FLAGS])
14738abc0ccfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
14748abc0ccfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
14758abc0ccfSmrgif test "x$xorg_check_linker_flags" = xyes; then
14768abc0ccfSmrg	m4_default([$2], :)
14778abc0ccfSmrgelse
14788abc0ccfSmrg	m4_default([$3], :)
14798abc0ccfSmrgfi
14808abc0ccfSmrg]) # XORG_CHECK_LINKER_FLAGS
14812adc0320Smrg
14828abc0ccfSmrg# XORG_MEMORY_CHECK_FLAGS
14838abc0ccfSmrg# -----------------------
14848abc0ccfSmrg# Minimum version: 1.16.0
14852852888eSmrg#
14868abc0ccfSmrg# This macro attempts to find appropriate memory checking functionality
14878abc0ccfSmrg# for various platforms which unit testing code may use to catch various
14888abc0ccfSmrg# forms of memory allocation and access errors in testing.
14892852888eSmrg#
14902852888eSmrg# Interface to module:
14918abc0ccfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
14928abc0ccfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
14932852888eSmrg#
14948abc0ccfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
149596402570Smrg#
14968abc0ccfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
14978abc0ccfSmrg
14988abc0ccfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
14998abc0ccfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
15008abc0ccfSmrg           [Environment variables to enable memory checking in tests])
15018abc0ccfSmrg
15028abc0ccfSmrg# Check for different types of support on different platforms
15038abc0ccfSmrgcase $host_os in
15048abc0ccfSmrg    solaris*)
15058abc0ccfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
15068abc0ccfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
15078abc0ccfSmrg        ;;
15088abc0ccfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
15098abc0ccfSmrg        # both directly and inverted, so should not be 0 or 255.
15108abc0ccfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
15118abc0ccfSmrg        ;;
15128abc0ccfSmrg    darwin*)
15138abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
15148abc0ccfSmrg        ;;
15158abc0ccfSmrg    *bsd*)
15168abc0ccfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
15178abc0ccfSmrg        ;;
15188abc0ccfSmrgesac
15198abc0ccfSmrg
15208abc0ccfSmrg# User supplied flags override default flags
15218abc0ccfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
15228abc0ccfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
15238abc0ccfSmrgfi
15248abc0ccfSmrg
15258abc0ccfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
15268abc0ccfSmrg]) # XORG_WITH_LINT
15278abc0ccfSmrg
15288abc0ccfSmrg# XORG_CHECK_MALLOC_ZERO
15298abc0ccfSmrg# ----------------------
15308abc0ccfSmrg# Minimum version: 1.0.0
153196402570Smrg#
15328abc0ccfSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
15338abc0ccfSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
15348abc0ccfSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
15358abc0ccfSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
15368abc0ccfSmrgAC_ARG_ENABLE(malloc0returnsnull,
15378abc0ccfSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
15388abc0ccfSmrg		       [malloc(0) returns NULL (default: auto)]),
15398abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
15408abc0ccfSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
15418abc0ccfSmrg
15428abc0ccfSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
15438abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
15448abc0ccfSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
15458abc0ccfSmrg#include <stdlib.h>
15468abc0ccfSmrg],[
15478abc0ccfSmrg    char *m0, *r0, *c0, *p;
15488abc0ccfSmrg    m0 = malloc(0);
15498abc0ccfSmrg    p = malloc(10);
15508abc0ccfSmrg    r0 = realloc(p,0);
15518abc0ccfSmrg    c0 = calloc(0,10);
15528abc0ccfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
15538abc0ccfSmrg])],
15548abc0ccfSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
15558abc0ccfSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
15568abc0ccfSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
15578abc0ccfSmrgfi
15588abc0ccfSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
15598abc0ccfSmrg
15608abc0ccfSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
15618abc0ccfSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
15628abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
15638abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
15648abc0ccfSmrgelse
15658abc0ccfSmrg	MALLOC_ZERO_CFLAGS=""
15668abc0ccfSmrg	XMALLOC_ZERO_CFLAGS=""
15678abc0ccfSmrg	XTMALLOC_ZERO_CFLAGS=""
15688abc0ccfSmrgfi
15698abc0ccfSmrg
15708abc0ccfSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
15718abc0ccfSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
15728abc0ccfSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
15738abc0ccfSmrg]) # XORG_CHECK_MALLOC_ZERO
15748abc0ccfSmrg
15758abc0ccfSmrg# XORG_WITH_LINT()
15768abc0ccfSmrg# ----------------
15778abc0ccfSmrg# Minimum version: 1.1.0
15788abc0ccfSmrg#
15798abc0ccfSmrg# This macro enables the use of a tool that flags some suspicious and
15808abc0ccfSmrg# non-portable constructs (likely to be bugs) in C language source code.
15818abc0ccfSmrg# It will attempt to locate the tool and use appropriate options.
15828abc0ccfSmrg# There are various lint type tools on different platforms.
158396402570Smrg#
158496402570Smrg# Interface to module:
15858abc0ccfSmrg# LINT:		returns the path to the tool found on the platform
15868abc0ccfSmrg#		or the value set to LINT on the configure cmd line
15878abc0ccfSmrg#		also an Automake conditional
15888abc0ccfSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
15898abc0ccfSmrg#
15908abc0ccfSmrg# --with-lint:	'yes' user instructs the module to use lint
15918abc0ccfSmrg#		'no' user instructs the module not to use lint (default)
15928abc0ccfSmrg#
15938abc0ccfSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
15948abc0ccfSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
15958abc0ccfSmrg#
15968abc0ccfSmrgAC_DEFUN([XORG_WITH_LINT],[
15978abc0ccfSmrg
15988abc0ccfSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
15998abc0ccfSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
16008abc0ccfSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
16018abc0ccfSmrg		[Use a lint-style source code checker (default: disabled)])],
16028abc0ccfSmrg		[use_lint=$withval], [use_lint=no])
16038abc0ccfSmrg
16048abc0ccfSmrg# Obtain platform specific info like program name and options
16058abc0ccfSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
16068abc0ccfSmrgcase $host_os in
16078abc0ccfSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
16088abc0ccfSmrg	lint_name=splint
16098abc0ccfSmrg	lint_options="-badflag"
16108abc0ccfSmrg	;;
16118abc0ccfSmrg  *freebsd* | *netbsd*)
16128abc0ccfSmrg	lint_name=lint
16138abc0ccfSmrg	lint_options="-u -b"
16148abc0ccfSmrg	;;
16158abc0ccfSmrg  *solaris*)
16168abc0ccfSmrg	lint_name=lint
16178abc0ccfSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
16188abc0ccfSmrg	;;
16198abc0ccfSmrgesac
16208abc0ccfSmrg
16218abc0ccfSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
16228abc0ccfSmrgif test "x$use_lint" = x"yes" ; then
16238abc0ccfSmrg   AC_PATH_PROG([LINT], [$lint_name])
16248abc0ccfSmrg   if test "x$LINT" = "x"; then
16258abc0ccfSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
16268abc0ccfSmrg   fi
16278abc0ccfSmrgelif test "x$use_lint" = x"no" ; then
16288abc0ccfSmrg   if test "x$LINT" != "x"; then
16298abc0ccfSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
16308abc0ccfSmrg   fi
16318abc0ccfSmrgelse
16328abc0ccfSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
16338abc0ccfSmrgfi
16348abc0ccfSmrg
16358abc0ccfSmrg# User supplied flags override default flags
16368abc0ccfSmrgif test "x$LINT_FLAGS" != "x"; then
16378abc0ccfSmrg   lint_options=$LINT_FLAGS
16388abc0ccfSmrgfi
16398abc0ccfSmrg
16408abc0ccfSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
16418abc0ccfSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
16428abc0ccfSmrg
16438abc0ccfSmrg]) # XORG_WITH_LINT
16448abc0ccfSmrg
16458abc0ccfSmrg# XORG_LINT_LIBRARY(LIBNAME)
16468abc0ccfSmrg# --------------------------
16478abc0ccfSmrg# Minimum version: 1.1.0
16488abc0ccfSmrg#
16498abc0ccfSmrg# Sets up flags for building lint libraries for checking programs that call
16508abc0ccfSmrg# functions in the library.
16518abc0ccfSmrg#
16528abc0ccfSmrg# Interface to module:
16538abc0ccfSmrg# LINTLIB		- Automake variable with the name of lint library file to make
16548abc0ccfSmrg# MAKE_LINT_LIB		- Automake conditional
16558abc0ccfSmrg#
16568abc0ccfSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
16578abc0ccfSmrg#			  - 'no' user instructs the module not to create a lint library (default)
16588abc0ccfSmrg
16598abc0ccfSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
16608abc0ccfSmrgAC_REQUIRE([XORG_WITH_LINT])
16618abc0ccfSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
16628abc0ccfSmrg	[Create lint library (default: disabled)])],
16638abc0ccfSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
16648abc0ccfSmrg
16658abc0ccfSmrgif test "x$make_lint_lib" = x"yes" ; then
16668abc0ccfSmrg   LINTLIB=llib-l$1.ln
16678abc0ccfSmrg   if test "x$LINT" = "x"; then
16688abc0ccfSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
16698abc0ccfSmrg   fi
16708abc0ccfSmrgelif test "x$make_lint_lib" != x"no" ; then
16718abc0ccfSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
16728abc0ccfSmrgfi
16738abc0ccfSmrg
16748abc0ccfSmrgAC_SUBST(LINTLIB)
16758abc0ccfSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
16768abc0ccfSmrg
16778abc0ccfSmrg]) # XORG_LINT_LIBRARY
16788abc0ccfSmrg
16798abc0ccfSmrg# XORG_COMPILER_BRAND
16808abc0ccfSmrg# -------------------
16818abc0ccfSmrg# Minimum version: 1.14.0
16828abc0ccfSmrg#
16838abc0ccfSmrg# Checks for various brands of compilers and sets flags as appropriate:
16848abc0ccfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
16858abc0ccfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
16868abc0ccfSmrg#   clang compiler - sets CLANGCC to "yes"
16878abc0ccfSmrg#   Intel compiler - sets INTELCC to "yes"
16888abc0ccfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
16898abc0ccfSmrg#
16908abc0ccfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
16918abc0ccfSmrgAC_LANG_CASE(
16928abc0ccfSmrg	[C], [
16938abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
16948abc0ccfSmrg	],
16958abc0ccfSmrg	[C++], [
16968abc0ccfSmrg		AC_REQUIRE([AC_PROG_CXX])
16978abc0ccfSmrg	]
16988abc0ccfSmrg)
16998abc0ccfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
17008abc0ccfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
17018abc0ccfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
17028abc0ccfSmrg]) # XORG_COMPILER_BRAND
17038abc0ccfSmrg
17048abc0ccfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
17058abc0ccfSmrg# ---------------
17068abc0ccfSmrg# Minimum version: 1.16.0
17078abc0ccfSmrg#
17088abc0ccfSmrg# Test if the compiler works when passed the given flag as a command line argument.
17098abc0ccfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
17108abc0ccfSmrg# next flag in the list until there are no more options.
17118abc0ccfSmrg#
17128abc0ccfSmrg# Note that this does not guarantee that the compiler supports the flag as some
17138abc0ccfSmrg# compilers will simply ignore arguments that they do not understand, but we do
17148abc0ccfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
17158abc0ccfSmrg# -Werror=unused-command-line-argument
17168abc0ccfSmrg#
17178abc0ccfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
17188abc0ccfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
17198abc0ccfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
17208abc0ccfSmrg
17218abc0ccfSmrgAC_LANG_COMPILER_REQUIRE
17228abc0ccfSmrg
17238abc0ccfSmrgAC_LANG_CASE(
17248abc0ccfSmrg	[C], [
17258abc0ccfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
17268abc0ccfSmrg		define([PREFIX], [C])
17278abc0ccfSmrg		define([CACHE_PREFIX], [cc])
17288abc0ccfSmrg		define([COMPILER], [$CC])
17298abc0ccfSmrg	],
17308abc0ccfSmrg	[C++], [
17318abc0ccfSmrg		define([PREFIX], [CXX])
17328abc0ccfSmrg		define([CACHE_PREFIX], [cxx])
17338abc0ccfSmrg		define([COMPILER], [$CXX])
17348abc0ccfSmrg	]
17358abc0ccfSmrg)
17368abc0ccfSmrg
17378abc0ccfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
17388abc0ccfSmrg
17398abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
17408abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
17418abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
17428abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
17438abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
17448abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
17458abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
17468abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
17478abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
17488abc0ccfSmrgfi
17498abc0ccfSmrg
17508abc0ccfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
17518abc0ccfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
17528abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
17538abc0ccfSmrg	fi
17548abc0ccfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
17558abc0ccfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
17568abc0ccfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
17578abc0ccfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
17588abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
17598abc0ccfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
17608abc0ccfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
17618abc0ccfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
17628abc0ccfSmrgfi
17638abc0ccfSmrg
17648abc0ccfSmrgfound="no"
17658abc0ccfSmrgm4_foreach([flag], m4_cdr($@), [
17668abc0ccfSmrg	if test $found = "no" ; then
17678abc0ccfSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
17688abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
17698abc0ccfSmrg		fi
17708abc0ccfSmrg
17718abc0ccfSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
17728abc0ccfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
17738abc0ccfSmrg		fi
17748abc0ccfSmrg
17758abc0ccfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
17768abc0ccfSmrg
17778abc0ccfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
17788abc0ccfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
17798abc0ccfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
17808abc0ccfSmrg		AC_CACHE_VAL($cacheid,
17818abc0ccfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
17828abc0ccfSmrg					     [eval $cacheid=yes],
17838abc0ccfSmrg					     [eval $cacheid=no])])
17848abc0ccfSmrg
17858abc0ccfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
17868abc0ccfSmrg
17878abc0ccfSmrg		eval supported=\$$cacheid
17888abc0ccfSmrg		AC_MSG_RESULT([$supported])
17898abc0ccfSmrg		if test "$supported" = "yes" ; then
17908abc0ccfSmrg			$1="$$1 ]flag["
17918abc0ccfSmrg			found="yes"
17928abc0ccfSmrg		fi
17938abc0ccfSmrg	fi
17948abc0ccfSmrg])
17958abc0ccfSmrg]) # XORG_TESTSET_CFLAG
17968abc0ccfSmrg
17978abc0ccfSmrg# XORG_COMPILER_FLAGS
17988abc0ccfSmrg# ---------------
17998abc0ccfSmrg# Minimum version: 1.16.0
18008abc0ccfSmrg#
18018abc0ccfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
18028abc0ccfSmrg# arguments supported by the selected compiler which do NOT alter the generated
18038abc0ccfSmrg# code.  These arguments will cause the compiler to print various warnings
18048abc0ccfSmrg# during compilation AND turn a conservative set of warnings into errors.
18058abc0ccfSmrg#
18068abc0ccfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
18078abc0ccfSmrg# future versions of util-macros as options are added to new compilers.
18088abc0ccfSmrg#
18098abc0ccfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
18108abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
18118abc0ccfSmrg
18128abc0ccfSmrgAC_ARG_ENABLE(selective-werror,
18138abc0ccfSmrg              AS_HELP_STRING([--disable-selective-werror],
18148abc0ccfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
18158abc0ccfSmrg              [SELECTIVE_WERROR=$enableval],
18168abc0ccfSmrg              [SELECTIVE_WERROR=yes])
18178abc0ccfSmrg
18188abc0ccfSmrgAC_LANG_CASE(
18198abc0ccfSmrg        [C], [
18208abc0ccfSmrg                define([PREFIX], [C])
18218abc0ccfSmrg        ],
18228abc0ccfSmrg        [C++], [
18238abc0ccfSmrg                define([PREFIX], [CXX])
18248abc0ccfSmrg        ]
18258abc0ccfSmrg)
18268abc0ccfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
18278abc0ccfSmrgif test "x$SUNCC" = "xyes"; then
18288abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="-v"
18298abc0ccfSmrgelse
18308abc0ccfSmrg    [BASE_]PREFIX[FLAGS]=""
18318abc0ccfSmrgfi
18328abc0ccfSmrg
18338abc0ccfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
18348abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
18358abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
18368abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
18378abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
18388abc0ccfSmrg
18398abc0ccfSmrgAC_LANG_CASE(
18408abc0ccfSmrg	[C], [
18418abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
18428abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
18438abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
18448abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
18458abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
18468abc0ccfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
18478abc0ccfSmrg	]
18488abc0ccfSmrg)
18498abc0ccfSmrg
18508abc0ccfSmrg# This chunk adds additional warnings that could catch undesired effects.
18518abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
18528abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
18538abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
18548abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
18558abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
18568abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
18578abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
18588abc0ccfSmrg
18598abc0ccfSmrg# These are currently disabled because they are noisy.  They will be enabled
18608abc0ccfSmrg# in the future once the codebase is sufficiently modernized to silence
18618abc0ccfSmrg# them.  For now, I don't want them to drown out the other warnings.
18628abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
18638abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
18648abc0ccfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
18658abc0ccfSmrg
18668abc0ccfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
18678abc0ccfSmrg# when there are problems that should be fixed.
18688abc0ccfSmrg
18698abc0ccfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
18708abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
18718abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
18728abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
18738abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
18748abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
18758abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
18768abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
18778abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
18788abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
18798abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
18808abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
18818abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
18828abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
18838abc0ccfSmrgelse
18848abc0ccfSmrgAC_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])
18858abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
18868abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
18878abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
18888abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
18898abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
18908abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
18918abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
18928abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
18938abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
18948abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
18958abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
18968abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
18978abc0ccfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
18988abc0ccfSmrgfi
18998abc0ccfSmrg
19008abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
19018abc0ccfSmrg]) # XORG_COMPILER_FLAGS
19028abc0ccfSmrg
19038abc0ccfSmrg# XORG_CWARNFLAGS
19048abc0ccfSmrg# ---------------
19058abc0ccfSmrg# Minimum version: 1.2.0
19068abc0ccfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
19078abc0ccfSmrg#
19088abc0ccfSmrg# Defines CWARNFLAGS to enable C compiler warnings.
19098abc0ccfSmrg#
19108abc0ccfSmrg# This function is deprecated because it defines -fno-strict-aliasing
19118abc0ccfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
19128abc0ccfSmrg# is needed, then it should be added explicitly in the module when
19138abc0ccfSmrg# it is updated to use BASE_CFLAGS.
19148abc0ccfSmrg#
19158abc0ccfSmrgAC_DEFUN([XORG_CWARNFLAGS], [
19168abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
19178abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
19188abc0ccfSmrgAC_LANG_CASE(
19198abc0ccfSmrg	[C], [
19208abc0ccfSmrg		CWARNFLAGS="$BASE_CFLAGS"
19218abc0ccfSmrg		if  test "x$GCC" = xyes ; then
19228abc0ccfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
19238abc0ccfSmrg		fi
19248abc0ccfSmrg		AC_SUBST(CWARNFLAGS)
19258abc0ccfSmrg	]
19268abc0ccfSmrg)
19278abc0ccfSmrg]) # XORG_CWARNFLAGS
19288abc0ccfSmrg
19298abc0ccfSmrg# XORG_STRICT_OPTION
19308abc0ccfSmrg# -----------------------
19318abc0ccfSmrg# Minimum version: 1.3.0
19328abc0ccfSmrg#
19338abc0ccfSmrg# Add configure option to enable strict compilation flags, such as treating
19348abc0ccfSmrg# warnings as fatal errors.
19358abc0ccfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
19368abc0ccfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
19378abc0ccfSmrg#
19388abc0ccfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
19398abc0ccfSmrg# when strict compilation is unconditionally desired.
19408abc0ccfSmrgAC_DEFUN([XORG_STRICT_OPTION], [
19418abc0ccfSmrgAC_REQUIRE([XORG_CWARNFLAGS])
19428abc0ccfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
19438abc0ccfSmrg
19448abc0ccfSmrgAC_ARG_ENABLE(strict-compilation,
19458abc0ccfSmrg			  AS_HELP_STRING([--enable-strict-compilation],
19468abc0ccfSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
19478abc0ccfSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
19488abc0ccfSmrg
19498abc0ccfSmrgAC_LANG_CASE(
19508abc0ccfSmrg        [C], [
19518abc0ccfSmrg                define([PREFIX], [C])
19528abc0ccfSmrg        ],
19538abc0ccfSmrg        [C++], [
19548abc0ccfSmrg                define([PREFIX], [CXX])
19558abc0ccfSmrg        ]
19568abc0ccfSmrg)
19578abc0ccfSmrg
19588abc0ccfSmrg[STRICT_]PREFIX[FLAGS]=""
19598abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
19608abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
19618abc0ccfSmrg
19628abc0ccfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
19638abc0ccfSmrg# activate it with -Werror, so we add it here explicitly.
19648abc0ccfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
19658abc0ccfSmrg
19668abc0ccfSmrgif test "x$STRICT_COMPILE" = "xyes"; then
19678abc0ccfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
19688abc0ccfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
19698abc0ccfSmrgfi
19708abc0ccfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
19718abc0ccfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
19728abc0ccfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
19738abc0ccfSmrg]) # XORG_STRICT_OPTION
19748abc0ccfSmrg
19758abc0ccfSmrg# XORG_DEFAULT_OPTIONS
19768abc0ccfSmrg# --------------------
19778abc0ccfSmrg# Minimum version: 1.3.0
19788abc0ccfSmrg#
19798abc0ccfSmrg# Defines default options for X.Org modules.
19808abc0ccfSmrg#
19818abc0ccfSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
19828abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])
19838abc0ccfSmrgXORG_COMPILER_FLAGS
19848abc0ccfSmrgXORG_CWARNFLAGS
19858abc0ccfSmrgXORG_STRICT_OPTION
19868abc0ccfSmrgXORG_RELEASE_VERSION
19878abc0ccfSmrgXORG_CHANGELOG
19888abc0ccfSmrgXORG_INSTALL
19898abc0ccfSmrgXORG_MANPAGE_SECTIONS
19908abc0ccfSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
19918abc0ccfSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
19928abc0ccfSmrg]) # XORG_DEFAULT_OPTIONS
19938abc0ccfSmrg
19948abc0ccfSmrg# XORG_INSTALL()
19958abc0ccfSmrg# ----------------
19968abc0ccfSmrg# Minimum version: 1.4.0
19978abc0ccfSmrg#
19988abc0ccfSmrg# Defines the variable INSTALL_CMD as the command to copy
19998abc0ccfSmrg# INSTALL from $prefix/share/util-macros.
20008abc0ccfSmrg#
20018abc0ccfSmrgAC_DEFUN([XORG_INSTALL], [
20028abc0ccfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
20038abc0ccfSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
20048abc0ccfSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
20058abc0ccfSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
20068abc0ccfSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
20078abc0ccfSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
20088abc0ccfSmrgAC_SUBST([INSTALL_CMD])
20098abc0ccfSmrg]) # XORG_INSTALL
20108abc0ccfSmrgdnl Copyright 2005 Red Hat, Inc
20118abc0ccfSmrgdnl
20128abc0ccfSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
20138abc0ccfSmrgdnl documentation for any purpose is hereby granted without fee, provided that
20148abc0ccfSmrgdnl the above copyright notice appear in all copies and that both that
20158abc0ccfSmrgdnl copyright notice and this permission notice appear in supporting
20168abc0ccfSmrgdnl documentation.
20178abc0ccfSmrgdnl
20188abc0ccfSmrgdnl The above copyright notice and this permission notice shall be included
20198abc0ccfSmrgdnl in all copies or substantial portions of the Software.
20208abc0ccfSmrgdnl
20218abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20228abc0ccfSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20238abc0ccfSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20248abc0ccfSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20258abc0ccfSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20268abc0ccfSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20278abc0ccfSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
20288abc0ccfSmrgdnl
20298abc0ccfSmrgdnl Except as contained in this notice, the name of the copyright holders shall
20308abc0ccfSmrgdnl not be used in advertising or otherwise to promote the sale, use or
20318abc0ccfSmrgdnl other dealings in this Software without prior written authorization
20328abc0ccfSmrgdnl from the copyright holders.
20338abc0ccfSmrgdnl
20348abc0ccfSmrg
20358abc0ccfSmrg# XORG_RELEASE_VERSION
20368abc0ccfSmrg# --------------------
20378abc0ccfSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
20388abc0ccfSmrg 
20398abc0ccfSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
20408abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
20418abc0ccfSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
20428abc0ccfSmrg		[Major version of this package])
20438abc0ccfSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
20448abc0ccfSmrg	if test "x$PVM" = "x"; then
20458abc0ccfSmrg		PVM="0"
20468abc0ccfSmrg	fi
20478abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
20488abc0ccfSmrg		[$PVM],
20498abc0ccfSmrg		[Minor version of this package])
20508abc0ccfSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
20518abc0ccfSmrg	if test "x$PVP" = "x"; then
20528abc0ccfSmrg		PVP="0"
20538abc0ccfSmrg	fi
20548abc0ccfSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
20558abc0ccfSmrg		[$PVP],
20568abc0ccfSmrg		[Patch version of this package])
20578abc0ccfSmrg])
20588abc0ccfSmrg
20598abc0ccfSmrg# XORG_CHANGELOG()
20608abc0ccfSmrg# ----------------
20618abc0ccfSmrg# Minimum version: 1.2.0
20628abc0ccfSmrg#
20638abc0ccfSmrg# Defines the variable CHANGELOG_CMD as the command to generate
20648abc0ccfSmrg# ChangeLog from git.
20658abc0ccfSmrg#
20668abc0ccfSmrg#
20678abc0ccfSmrgAC_DEFUN([XORG_CHANGELOG], [
20688abc0ccfSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
20698abc0ccfSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
20708abc0ccfSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
20718abc0ccfSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
20728abc0ccfSmrgAC_SUBST([CHANGELOG_CMD])
20738abc0ccfSmrg]) # XORG_CHANGELOG
20748abc0ccfSmrg
20758abc0ccfSmrgdnl
20768abc0ccfSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
20778abc0ccfSmrgdnl
20788abc0ccfSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
20798abc0ccfSmrgdnl copy of this software and associated documentation files (the "Software"),
20808abc0ccfSmrgdnl to deal in the Software without restriction, including without limitation
20818abc0ccfSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
20828abc0ccfSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
20838abc0ccfSmrgdnl Software is furnished to do so, subject to the following conditions:
20848abc0ccfSmrgdnl
20858abc0ccfSmrgdnl The above copyright notice and this permission notice (including the next
20868abc0ccfSmrgdnl paragraph) shall be included in all copies or substantial portions of the
20878abc0ccfSmrgdnl Software.
20888abc0ccfSmrgdnl
20898abc0ccfSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20908abc0ccfSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20918abc0ccfSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20928abc0ccfSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20938abc0ccfSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20948abc0ccfSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20958abc0ccfSmrgdnl DEALINGS IN THE SOFTWARE.
20968abc0ccfSmrgdnl
20978abc0ccfSmrg
20988abc0ccfSmrg# XTRANS_TCP_FLAGS()
20998abc0ccfSmrg# ------------------
21008abc0ccfSmrg# Find needed libraries for TCP sockets, and check for IPv6 support
21018abc0ccfSmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
21028abc0ccfSmrg # SVR4 hides these in libraries other than libc
21038abc0ccfSmrg AC_SEARCH_LIBS(socket, [socket])
21048abc0ccfSmrg AC_SEARCH_LIBS(gethostbyname, [nsl])
21058abc0ccfSmrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
21068abc0ccfSmrg   AC_HAVE_LIBRARY([ws2_32])
21078abc0ccfSmrg fi
21088abc0ccfSmrg
21098abc0ccfSmrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
21108abc0ccfSmrg AC_ARG_ENABLE(ipv6,
21118abc0ccfSmrg	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
21128abc0ccfSmrg	[IPV6CONN=$enableval],
21138abc0ccfSmrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
21148abc0ccfSmrg AC_MSG_CHECKING([if IPv6 support should be built])
21158abc0ccfSmrg if test "$IPV6CONN" = "yes"; then
21168abc0ccfSmrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
21178abc0ccfSmrg fi
21188abc0ccfSmrg AC_MSG_RESULT($IPV6CONN)
21198abc0ccfSmrg
21208abc0ccfSmrg # 4.3BSD-Reno added a new member to struct sockaddr_in
21218abc0ccfSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
21228abc0ccfSmrg	AC_DEFINE([BSD44SOCKETS],1,
21238abc0ccfSmrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
21248abc0ccfSmrg#include <sys/types.h>
21258abc0ccfSmrg#include <sys/socket.h>
21268abc0ccfSmrg#include <netinet/in.h>
21278abc0ccfSmrg ])
21288abc0ccfSmrg
21298abc0ccfSmrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
21308abc0ccfSmrg AC_CHECK_TYPES([socklen_t], [], [], [
21318abc0ccfSmrgAC_INCLUDES_DEFAULT
21328abc0ccfSmrg#include <sys/socket.h>])
21338abc0ccfSmrg
21348abc0ccfSmrg]) # XTRANS_TCP_FLAGS
21358abc0ccfSmrg
21368abc0ccfSmrg# XTRANS_CONNECTION_FLAGS()
21378abc0ccfSmrg# -------------------------
21388abc0ccfSmrg# Standard checks for which Xtrans transports to use by the Xorg packages
21398abc0ccfSmrg# that use Xtrans functions
21408abc0ccfSmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
21418abc0ccfSmrg AC_REQUIRE([AC_CANONICAL_HOST])
21428abc0ccfSmrg AC_REQUIRE([AC_TYPE_SIGNAL])
21438abc0ccfSmrg [case $host_os in
21448abc0ccfSmrg	mingw*)	unixdef="no"   ;;
21458abc0ccfSmrg	*)	unixdef="yes"  ;;
21468abc0ccfSmrg esac]
21478abc0ccfSmrg AC_ARG_ENABLE(unix-transport,
21488abc0ccfSmrg	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
21498abc0ccfSmrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
21508abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
21518abc0ccfSmrg if test "$UNIXCONN" = "yes"; then
21528abc0ccfSmrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
21538abc0ccfSmrg fi
21548abc0ccfSmrg AC_MSG_RESULT($UNIXCONN)
21558abc0ccfSmrg AC_ARG_ENABLE(tcp-transport,
21568abc0ccfSmrg	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
21578abc0ccfSmrg	[TCPCONN=$enableval], [TCPCONN=yes])
21588abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
21598abc0ccfSmrg AC_MSG_RESULT($TCPCONN)
21608abc0ccfSmrg if test "$TCPCONN" = "yes"; then
21618abc0ccfSmrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
21628abc0ccfSmrg	XTRANS_TCP_FLAGS
21638abc0ccfSmrg fi
21648abc0ccfSmrg [case $host_os in
21658abc0ccfSmrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
21668abc0ccfSmrg	*)			localdef="no"  ;;
21678abc0ccfSmrg esac]
21688abc0ccfSmrg AC_ARG_ENABLE(local-transport,
21698abc0ccfSmrg	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
21708abc0ccfSmrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
21718abc0ccfSmrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
21728abc0ccfSmrg AC_MSG_RESULT($LOCALCONN)
21738abc0ccfSmrg if test "$LOCALCONN" = "yes"; then
21748abc0ccfSmrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
21758abc0ccfSmrg fi
21768abc0ccfSmrg
21778abc0ccfSmrg]) # XTRANS_CONNECTION_FLAGS
21788abc0ccfSmrg
21798abc0ccfSmrg
21808abc0ccfSmrg# XTRANS_SECURE_RPC_FLAGS()
21818abc0ccfSmrg# -------------------------
21828abc0ccfSmrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
21838abc0ccfSmrg# so that any necessary networking libraries are already found
21848abc0ccfSmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
21858abc0ccfSmrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
21868abc0ccfSmrg AC_ARG_ENABLE(secure-rpc,
21878abc0ccfSmrg	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
21888abc0ccfSmrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
21898abc0ccfSmrg
21908abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
21918abc0ccfSmrg	FOUND_SECURE_RPC="no"
21928abc0ccfSmrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
21938abc0ccfSmrg			[FOUND_SECURE_RPC="yes"])
21948abc0ccfSmrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
21958abc0ccfSmrg		if test "x$SECURE_RPC" = "xyes" ; then
21968abc0ccfSmrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
21978abc0ccfSmrg		fi
21988abc0ccfSmrg		SECURE_RPC="no"
21998abc0ccfSmrg	else
22008abc0ccfSmrg		dnl FreeBSD keeps getsecretkey in librpcsvc
22018abc0ccfSmrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
22028abc0ccfSmrg		SECURE_RPC="yes"
22038abc0ccfSmrg	fi
22048abc0ccfSmrg fi
22058abc0ccfSmrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
22068abc0ccfSmrg if test "x$SECURE_RPC" = "xyes" ; then
22078abc0ccfSmrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
22088abc0ccfSmrg fi
22098abc0ccfSmrg AC_MSG_RESULT($SECURE_RPC)
22108abc0ccfSmrg]) # XTRANS_SECURE_RPC_FLAGS
22118abc0ccfSmrg
22128abc0ccfSmrg
22138abc0ccfSmrg# Copyright (C) 2002-2012 Free Software Foundation, Inc.
22148abc0ccfSmrg#
22158abc0ccfSmrg# This file is free software; the Free Software Foundation
22168abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
22178abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
22188abc0ccfSmrg
22198abc0ccfSmrg# serial 8
22208abc0ccfSmrg
22218abc0ccfSmrg# AM_AUTOMAKE_VERSION(VERSION)
22228abc0ccfSmrg# ----------------------------
22238abc0ccfSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22248abc0ccfSmrg# generated from the m4 files accompanying Automake X.Y.
22258abc0ccfSmrg# (This private macro should not be called outside this file.)
22268abc0ccfSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
22278abc0ccfSmrg[am__api_version='1.12'
22288abc0ccfSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
22298abc0ccfSmrgdnl require some minimum version.  Point them to the right macro.
22308abc0ccfSmrgm4_if([$1], [1.12.2], [],
22318abc0ccfSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
22328abc0ccfSmrg])
22338abc0ccfSmrg
22348abc0ccfSmrg# _AM_AUTOCONF_VERSION(VERSION)
22358abc0ccfSmrg# -----------------------------
22368abc0ccfSmrg# aclocal traces this macro to find the Autoconf version.
22378abc0ccfSmrg# This is a private macro too.  Using m4_define simplifies
22388abc0ccfSmrg# the logic in aclocal, which can simply ignore this definition.
22398abc0ccfSmrgm4_define([_AM_AUTOCONF_VERSION], [])
22408abc0ccfSmrg
22418abc0ccfSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
22428abc0ccfSmrg# -------------------------------
22438abc0ccfSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
22448abc0ccfSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
22458abc0ccfSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22468abc0ccfSmrg[AM_AUTOMAKE_VERSION([1.12.2])dnl
22478abc0ccfSmrgm4_ifndef([AC_AUTOCONF_VERSION],
22488abc0ccfSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
22498abc0ccfSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
22508abc0ccfSmrg
22518abc0ccfSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
22528abc0ccfSmrg
22538abc0ccfSmrg# Copyright (C) 2001-2012 Free Software Foundation, Inc.
225496402570Smrg#
22558abc0ccfSmrg# This file is free software; the Free Software Foundation
22568abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
22578abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
225896402570Smrg
22598abc0ccfSmrg# serial 2
22608abc0ccfSmrg
22618abc0ccfSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
22628abc0ccfSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
22638abc0ccfSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
22642852888eSmrg#
22658abc0ccfSmrg# Of course, Automake must honor this variable whenever it calls a
22668abc0ccfSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
22678abc0ccfSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
22688abc0ccfSmrg# depending on how configure is run.  This is pretty annoying, since
22698abc0ccfSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
22708abc0ccfSmrg# source directory, any form will work fine, but in subdirectories a
22718abc0ccfSmrg# relative path needs to be adjusted first.
22722852888eSmrg#
22738abc0ccfSmrg# $ac_aux_dir/missing
22748abc0ccfSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
22758abc0ccfSmrg# $top_srcdir/$ac_aux_dir/missing
22768abc0ccfSmrg#    fails if $ac_aux_dir is absolute,
22778abc0ccfSmrg#    fails when called from a subdirectory in a VPATH build with
22788abc0ccfSmrg#          a relative $ac_aux_dir
22792852888eSmrg#
22808abc0ccfSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
22818abc0ccfSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
22828abc0ccfSmrg# harmless because $srcdir is '.', but things will broke when you
22838abc0ccfSmrg# start a VPATH build or use an absolute $srcdir.
228496402570Smrg#
22858abc0ccfSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
22868abc0ccfSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
22878abc0ccfSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
22888abc0ccfSmrg# and then we would define $MISSING as
22898abc0ccfSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
22908abc0ccfSmrg# This will work as long as MISSING is not called from configure, because
22918abc0ccfSmrg# unfortunately $(top_srcdir) has no meaning in configure.
22928abc0ccfSmrg# However there are other variables, like CC, which are often used in
22938abc0ccfSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
22942852888eSmrg#
22958abc0ccfSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
22968abc0ccfSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
22978abc0ccfSmrg# configured tree to be moved without reconfiguration.
22982852888eSmrg
22998abc0ccfSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
23008abc0ccfSmrg[dnl Rely on autoconf to set up CDPATH properly.
23018abc0ccfSmrgAC_PREREQ([2.50])dnl
23028abc0ccfSmrg# expand $ac_aux_dir to an absolute path
23038abc0ccfSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
23048abc0ccfSmrg])
23052852888eSmrg
23068abc0ccfSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
23072852888eSmrg
23088abc0ccfSmrg# Copyright (C) 1997-2012 Free Software Foundation, Inc.
23098abc0ccfSmrg#
23108abc0ccfSmrg# This file is free software; the Free Software Foundation
23118abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
23128abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
23132852888eSmrg
23148abc0ccfSmrg# serial 10
23152852888eSmrg
23168abc0ccfSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23178abc0ccfSmrg# -------------------------------------
23188abc0ccfSmrg# Define a conditional.
23198abc0ccfSmrgAC_DEFUN([AM_CONDITIONAL],
23208abc0ccfSmrg[AC_PREREQ([2.52])dnl
23218abc0ccfSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23228abc0ccfSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23238abc0ccfSmrgAC_SUBST([$1_TRUE])dnl
23248abc0ccfSmrgAC_SUBST([$1_FALSE])dnl
23258abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23268abc0ccfSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23278abc0ccfSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23288abc0ccfSmrgif $2; then
23298abc0ccfSmrg  $1_TRUE=
23308abc0ccfSmrg  $1_FALSE='#'
23318abc0ccfSmrgelse
23328abc0ccfSmrg  $1_TRUE='#'
23338abc0ccfSmrg  $1_FALSE=
23348abc0ccfSmrgfi
23358abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
23368abc0ccfSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
23378abc0ccfSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
23388abc0ccfSmrgUsually this means the macro was only invoked conditionally.]])
23398abc0ccfSmrgfi])])
23402852888eSmrg
23418abc0ccfSmrg# Copyright (C) 1999-2012 Free Software Foundation, Inc.
23422852888eSmrg#
23438abc0ccfSmrg# This file is free software; the Free Software Foundation
23448abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
23458abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
23468abc0ccfSmrg
23478abc0ccfSmrg# serial 17
23488abc0ccfSmrg
23498abc0ccfSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
23508abc0ccfSmrg# written in clear, in which case automake, when reading aclocal.m4,
23518abc0ccfSmrg# will think it sees a *use*, and therefore will trigger all it's
23528abc0ccfSmrg# C support machinery.  Also note that it means that autoscan, seeing
23538abc0ccfSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
23548abc0ccfSmrg
23558abc0ccfSmrg
23568abc0ccfSmrg# _AM_DEPENDENCIES(NAME)
23578abc0ccfSmrg# ----------------------
23588abc0ccfSmrg# See how the compiler implements dependency checking.
23598abc0ccfSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
23608abc0ccfSmrg# We try a few techniques and use that to set a single cache variable.
236196402570Smrg#
23628abc0ccfSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
23638abc0ccfSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
23648abc0ccfSmrg# dependency, and given that the user is not expected to run this macro,
23658abc0ccfSmrg# just rely on AC_PROG_CC.
23668abc0ccfSmrgAC_DEFUN([_AM_DEPENDENCIES],
23678abc0ccfSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
23688abc0ccfSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
23698abc0ccfSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
23708abc0ccfSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
23718abc0ccfSmrg
23728abc0ccfSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
23738abc0ccfSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
23748abc0ccfSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
23758abc0ccfSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
23768abc0ccfSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
23778abc0ccfSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
23788abc0ccfSmrg                    [depcc="$$1"   am_compiler_list=])
23798abc0ccfSmrg
23808abc0ccfSmrgAC_CACHE_CHECK([dependency style of $depcc],
23818abc0ccfSmrg               [am_cv_$1_dependencies_compiler_type],
23828abc0ccfSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
23838abc0ccfSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
23848abc0ccfSmrg  # making bogus files that we don't know about and never remove.  For
23858abc0ccfSmrg  # instance it was reported that on HP-UX the gcc test will end up
23868abc0ccfSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
23878abc0ccfSmrg  # in D".
23888abc0ccfSmrg  rm -rf conftest.dir
23898abc0ccfSmrg  mkdir conftest.dir
23908abc0ccfSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
23918abc0ccfSmrg  # using a relative directory.
23928abc0ccfSmrg  cp "$am_depcomp" conftest.dir
23938abc0ccfSmrg  cd conftest.dir
23948abc0ccfSmrg  # We will build objects and dependencies in a subdirectory because
23958abc0ccfSmrg  # it helps to detect inapplicable dependency modes.  For instance
23968abc0ccfSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
23978abc0ccfSmrg  # side effect of compilation, but ICC will put the dependencies in
23988abc0ccfSmrg  # the current directory while Tru64 will put them in the object
23998abc0ccfSmrg  # directory.
24008abc0ccfSmrg  mkdir sub
24018abc0ccfSmrg
24028abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
24038abc0ccfSmrg  if test "$am_compiler_list" = ""; then
24048abc0ccfSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
24052852888eSmrg  fi
24068abc0ccfSmrg  am__universal=false
24078abc0ccfSmrg  m4_case([$1], [CC],
24088abc0ccfSmrg    [case " $depcc " in #(
24098abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24108abc0ccfSmrg     esac],
24118abc0ccfSmrg    [CXX],
24128abc0ccfSmrg    [case " $depcc " in #(
24138abc0ccfSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24148abc0ccfSmrg     esac])
24158abc0ccfSmrg
24168abc0ccfSmrg  for depmode in $am_compiler_list; do
24178abc0ccfSmrg    # Setup a source with many dependencies, because some compilers
24188abc0ccfSmrg    # like to wrap large dependency lists on column 80 (with \), and
24198abc0ccfSmrg    # we should not choose a depcomp mode which is confused by this.
24208abc0ccfSmrg    #
24218abc0ccfSmrg    # We need to recreate these files for each test, as the compiler may
24228abc0ccfSmrg    # overwrite some of them when testing with obscure command lines.
24238abc0ccfSmrg    # This happens at least with the AIX C compiler.
24248abc0ccfSmrg    : > sub/conftest.c
24258abc0ccfSmrg    for i in 1 2 3 4 5 6; do
24268abc0ccfSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24278abc0ccfSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24288abc0ccfSmrg      # Solaris 10 /bin/sh.
24298abc0ccfSmrg      echo '/* dummy */' > sub/conftst$i.h
24308abc0ccfSmrg    done
24318abc0ccfSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24328abc0ccfSmrg
24338abc0ccfSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24348abc0ccfSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24358abc0ccfSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
24368abc0ccfSmrg    # versions had trouble with output in subdirs.
24378abc0ccfSmrg    am__obj=sub/conftest.${OBJEXT-o}
24388abc0ccfSmrg    am__minus_obj="-o $am__obj"
24398abc0ccfSmrg    case $depmode in
24408abc0ccfSmrg    gcc)
24418abc0ccfSmrg      # This depmode causes a compiler race in universal mode.
24428abc0ccfSmrg      test "$am__universal" = false || continue
24438abc0ccfSmrg      ;;
24448abc0ccfSmrg    nosideeffect)
24458abc0ccfSmrg      # After this tag, mechanisms are not by side-effect, so they'll
24468abc0ccfSmrg      # only be used when explicitly requested.
24478abc0ccfSmrg      if test "x$enable_dependency_tracking" = xyes; then
24488abc0ccfSmrg	continue
24498abc0ccfSmrg      else
24508abc0ccfSmrg	break
24518abc0ccfSmrg      fi
24528abc0ccfSmrg      ;;
24538abc0ccfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
24548abc0ccfSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
24558abc0ccfSmrg      # not run yet.  These depmodes are late enough in the game, and
24568abc0ccfSmrg      # so weak that their functioning should not be impacted.
24578abc0ccfSmrg      am__obj=conftest.${OBJEXT-o}
24588abc0ccfSmrg      am__minus_obj=
24598abc0ccfSmrg      ;;
24608abc0ccfSmrg    none) break ;;
24618abc0ccfSmrg    esac
24628abc0ccfSmrg    if depmode=$depmode \
24638abc0ccfSmrg       source=sub/conftest.c object=$am__obj \
24648abc0ccfSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
24658abc0ccfSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
24668abc0ccfSmrg         >/dev/null 2>conftest.err &&
24678abc0ccfSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
24688abc0ccfSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
24698abc0ccfSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
24708abc0ccfSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
24718abc0ccfSmrg      # icc doesn't choke on unknown options, it will just issue warnings
24728abc0ccfSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
24738abc0ccfSmrg      # that says an option was ignored or not supported.
24748abc0ccfSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
24758abc0ccfSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
24768abc0ccfSmrg      # The diagnosis changed in icc 8.0:
24778abc0ccfSmrg      #   icc: Command line remark: option '-MP' not supported
24788abc0ccfSmrg      if (grep 'ignoring option' conftest.err ||
24798abc0ccfSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
24808abc0ccfSmrg        am_cv_$1_dependencies_compiler_type=$depmode
24818abc0ccfSmrg        break
24828abc0ccfSmrg      fi
24838abc0ccfSmrg    fi
24848abc0ccfSmrg  done
24852852888eSmrg
24868abc0ccfSmrg  cd ..
24878abc0ccfSmrg  rm -rf conftest.dir
24882852888eSmrgelse
24898abc0ccfSmrg  am_cv_$1_dependencies_compiler_type=none
24902852888eSmrgfi
24918abc0ccfSmrg])
24928abc0ccfSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
24938abc0ccfSmrgAM_CONDITIONAL([am__fastdep$1], [
24948abc0ccfSmrg  test "x$enable_dependency_tracking" != xno \
24958abc0ccfSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
24968abc0ccfSmrg])
24972852888eSmrg
249896402570Smrg
24998abc0ccfSmrg# AM_SET_DEPDIR
25008abc0ccfSmrg# -------------
25018abc0ccfSmrg# Choose a directory name for dependency files.
25028abc0ccfSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25038abc0ccfSmrgAC_DEFUN([AM_SET_DEPDIR],
25048abc0ccfSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25058abc0ccfSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25068abc0ccfSmrg])
250796402570Smrg
250896402570Smrg
25098abc0ccfSmrg# AM_DEP_TRACK
25108abc0ccfSmrg# ------------
25118abc0ccfSmrgAC_DEFUN([AM_DEP_TRACK],
25128abc0ccfSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25138abc0ccfSmrgAS_HELP_STRING(
25148abc0ccfSmrg  [--enable-dependency-tracking],
25158abc0ccfSmrg  [do not reject slow dependency extractors])
25168abc0ccfSmrgAS_HELP_STRING(
25178abc0ccfSmrg  [--disable-dependency-tracking],
25188abc0ccfSmrg  [speeds up one-time build])])
25198abc0ccfSmrgif test "x$enable_dependency_tracking" != xno; then
25208abc0ccfSmrg  am_depcomp="$ac_aux_dir/depcomp"
25218abc0ccfSmrg  AMDEPBACKSLASH='\'
25228abc0ccfSmrg  am__nodep='_no'
252396402570Smrgfi
25248abc0ccfSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25258abc0ccfSmrgAC_SUBST([AMDEPBACKSLASH])dnl
25268abc0ccfSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25278abc0ccfSmrgAC_SUBST([am__nodep])dnl
25288abc0ccfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25298abc0ccfSmrg])
253096402570Smrg
25318abc0ccfSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
253296402570Smrg
25338abc0ccfSmrg# Copyright (C) 1999-2012 Free Software Foundation, Inc.
25347a0395d0Smrg#
25358abc0ccfSmrg# This file is free software; the Free Software Foundation
25368abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
25378abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
25387a0395d0Smrg
25398abc0ccfSmrg# serial 6
25407a0395d0Smrg
25418abc0ccfSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
25428abc0ccfSmrg# ------------------------------
25438abc0ccfSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25448abc0ccfSmrg[{
25458abc0ccfSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
25468abc0ccfSmrg  # are listed without --file.  Let's play safe and only enable the eval
25478abc0ccfSmrg  # if we detect the quoting.
25488abc0ccfSmrg  case $CONFIG_FILES in
25498abc0ccfSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
25508abc0ccfSmrg  *)   set x $CONFIG_FILES ;;
25518abc0ccfSmrg  esac
25528abc0ccfSmrg  shift
25538abc0ccfSmrg  for mf
25548abc0ccfSmrg  do
25558abc0ccfSmrg    # Strip MF so we end up with the name of the file.
25568abc0ccfSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
25578abc0ccfSmrg    # Check whether this is an Automake generated Makefile or not.
25588abc0ccfSmrg    # We used to match only the files named 'Makefile.in', but
25598abc0ccfSmrg    # some people rename them; so instead we look at the file content.
25608abc0ccfSmrg    # Grep'ing the first line is not enough: some people post-process
25618abc0ccfSmrg    # each Makefile.in and add a new line on top of each file to say so.
25628abc0ccfSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
25638abc0ccfSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
25648abc0ccfSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
25658abc0ccfSmrg      dirpart=`AS_DIRNAME("$mf")`
25668abc0ccfSmrg    else
25678abc0ccfSmrg      continue
25688abc0ccfSmrg    fi
25698abc0ccfSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
25708abc0ccfSmrg    # from the Makefile without running 'make'.
25718abc0ccfSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
25728abc0ccfSmrg    test -z "$DEPDIR" && continue
25738abc0ccfSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
25748abc0ccfSmrg    test -z "am__include" && continue
25758abc0ccfSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
25768abc0ccfSmrg    # Find all dependency output files, they are included files with
25778abc0ccfSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
25788abc0ccfSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
25798abc0ccfSmrg    # expansion.
25808abc0ccfSmrg    for file in `sed -n "
25818abc0ccfSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
25828abc0ccfSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
25838abc0ccfSmrg      # Make sure the directory exists.
25848abc0ccfSmrg      test -f "$dirpart/$file" && continue
25858abc0ccfSmrg      fdir=`AS_DIRNAME(["$file"])`
25868abc0ccfSmrg      AS_MKDIR_P([$dirpart/$fdir])
25878abc0ccfSmrg      # echo "creating $dirpart/$file"
25888abc0ccfSmrg      echo '# dummy' > "$dirpart/$file"
25898abc0ccfSmrg    done
25908abc0ccfSmrg  done
25918abc0ccfSmrg}
25928abc0ccfSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
25937a0395d0Smrg
25947a0395d0Smrg
25958abc0ccfSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
25968abc0ccfSmrg# -----------------------------
25978abc0ccfSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
25982adc0320Smrg#
25998abc0ccfSmrg# This code is only required when automatic dependency tracking
26008abc0ccfSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
26018abc0ccfSmrg# need in order to bootstrap the dependency handling code.
26028abc0ccfSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
26038abc0ccfSmrg[AC_CONFIG_COMMANDS([depfiles],
26048abc0ccfSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
26058abc0ccfSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
26068abc0ccfSmrg])
26078abc0ccfSmrg
26088abc0ccfSmrg# Do all the work for Automake.                             -*- Autoconf -*-
26098abc0ccfSmrg
26108abc0ccfSmrg# Copyright (C) 1996-2012 Free Software Foundation, Inc.
26117366012aSmrg#
26128abc0ccfSmrg# This file is free software; the Free Software Foundation
26138abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
26148abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
26157a0395d0Smrg
26168abc0ccfSmrg# serial 19
26172adc0320Smrg
26188abc0ccfSmrg# This macro actually does too much.  Some checks are only needed if
26198abc0ccfSmrg# your package does certain things.  But this isn't really a big deal.
26202adc0320Smrg
26218abc0ccfSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26228abc0ccfSmrg# AM_INIT_AUTOMAKE([OPTIONS])
26238abc0ccfSmrg# -----------------------------------------------
26248abc0ccfSmrg# The call with PACKAGE and VERSION arguments is the old style
26258abc0ccfSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26268abc0ccfSmrg# and VERSION should now be passed to AC_INIT and removed from
26278abc0ccfSmrg# the call to AM_INIT_AUTOMAKE.
26288abc0ccfSmrg# We support both call styles for the transition.  After
26298abc0ccfSmrg# the next Automake release, Autoconf can make the AC_INIT
26308abc0ccfSmrg# arguments mandatory, and then we can depend on a new Autoconf
26318abc0ccfSmrg# release and drop the old call support.
26328abc0ccfSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26338abc0ccfSmrg[AC_PREREQ([2.62])dnl
26348abc0ccfSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26358abc0ccfSmrgdnl the ones we care about.
26368abc0ccfSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26378abc0ccfSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26388abc0ccfSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26398abc0ccfSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26408abc0ccfSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26418abc0ccfSmrg  # is not polluted with repeated "-I."
26428abc0ccfSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
26438abc0ccfSmrg  # test to see if srcdir already configured
26448abc0ccfSmrg  if test -f $srcdir/config.status; then
26458abc0ccfSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
26468abc0ccfSmrg  fi
26477366012aSmrgfi
26482adc0320Smrg
26498abc0ccfSmrg# test whether we have cygpath
26508abc0ccfSmrgif test -z "$CYGPATH_W"; then
26518abc0ccfSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
26528abc0ccfSmrg    CYGPATH_W='cygpath -w'
26538abc0ccfSmrg  else
26548abc0ccfSmrg    CYGPATH_W=echo
26558abc0ccfSmrg  fi
26567366012aSmrgfi
26578abc0ccfSmrgAC_SUBST([CYGPATH_W])
26587a0395d0Smrg
26598abc0ccfSmrg# Define the identity of the package.
26608abc0ccfSmrgdnl Distinguish between old-style and new-style calls.
26618abc0ccfSmrgm4_ifval([$2],
26628abc0ccfSmrg[AC_DIAGNOSE([obsolete],
26638abc0ccfSmrg[$0: two- and three-arguments forms are deprecated.  For more info, see:
26648abc0ccfSmrghttp://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
26658abc0ccfSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
26668abc0ccfSmrg AC_SUBST([PACKAGE], [$1])dnl
26678abc0ccfSmrg AC_SUBST([VERSION], [$2])],
26688abc0ccfSmrg[_AM_SET_OPTIONS([$1])dnl
26698abc0ccfSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
26708abc0ccfSmrgm4_if(
26718abc0ccfSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
26728abc0ccfSmrg  [ok:ok],,
26738abc0ccfSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
26748abc0ccfSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
26758abc0ccfSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
26762adc0320Smrg
26778abc0ccfSmrg_AM_IF_OPTION([no-define],,
26788abc0ccfSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
26798abc0ccfSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
26802adc0320Smrg
26818abc0ccfSmrg# Some tools Automake needs.
26828abc0ccfSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
26838abc0ccfSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
26848abc0ccfSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
26858abc0ccfSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
26868abc0ccfSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
26878abc0ccfSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
26888abc0ccfSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
26898abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
26908abc0ccfSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
26918abc0ccfSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
26928abc0ccfSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
26938abc0ccfSmrg# dies out for good.  For more background, see:
26948abc0ccfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
26958abc0ccfSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
26968abc0ccfSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
26978abc0ccfSmrg# We need awk for the "check" target.  The system "awk" is bad on
26988abc0ccfSmrg# some platforms.
26998abc0ccfSmrgAC_REQUIRE([AC_PROG_AWK])dnl
27008abc0ccfSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
27018abc0ccfSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
27028abc0ccfSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27038abc0ccfSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27048abc0ccfSmrg			     [_AM_PROG_TAR([v7])])])
27058abc0ccfSmrg_AM_IF_OPTION([no-dependencies],,
27068abc0ccfSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27078abc0ccfSmrg		  [_AM_DEPENDENCIES([CC])],
27088abc0ccfSmrg		  [m4_define([AC_PROG_CC],
27098abc0ccfSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27108abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27118abc0ccfSmrg		  [_AM_DEPENDENCIES([CXX])],
27128abc0ccfSmrg		  [m4_define([AC_PROG_CXX],
27138abc0ccfSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27148abc0ccfSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27158abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJC])],
27168abc0ccfSmrg		  [m4_define([AC_PROG_OBJC],
27178abc0ccfSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27188abc0ccfSmrgdnl Support for Objective C++ was only introduced in Autoconf 2.65,
27198abc0ccfSmrgdnl but we still cater to Autoconf 2.62.
27208abc0ccfSmrgm4_ifdef([AC_PROG_OBJCXX],
27218abc0ccfSmrg[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27228abc0ccfSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
27238abc0ccfSmrg		  [m4_define([AC_PROG_OBJCXX],
27248abc0ccfSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
27258abc0ccfSmrg])
27268abc0ccfSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
27278abc0ccfSmrgdnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
27288abc0ccfSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
27298abc0ccfSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
27308abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(dnl
27318abc0ccfSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27328abc0ccfSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
27338abc0ccfSmrg])
27347a0395d0Smrg
27358abc0ccfSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
27368abc0ccfSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
27378abc0ccfSmrgdnl mangled by Autoconf and run in a shell conditional statement.
27388abc0ccfSmrgm4_define([_AC_COMPILER_EXEEXT],
27398abc0ccfSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27407a0395d0Smrg
274196402570Smrg
27428abc0ccfSmrg# When config.status generates a header, we must update the stamp-h file.
27438abc0ccfSmrg# This file resides in the same directory as the config header
27448abc0ccfSmrg# that is generated.  The stamp files are numbered to have different names.
274596402570Smrg
27468abc0ccfSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
27478abc0ccfSmrg# loop where config.status creates the headers, so we can generate
27488abc0ccfSmrg# our stamp files there.
27498abc0ccfSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
27508abc0ccfSmrg[# Compute $1's index in $config_headers.
27518abc0ccfSmrg_am_arg=$1
27528abc0ccfSmrg_am_stamp_count=1
27538abc0ccfSmrgfor _am_header in $config_headers :; do
27548abc0ccfSmrg  case $_am_header in
27558abc0ccfSmrg    $_am_arg | $_am_arg:* )
27568abc0ccfSmrg      break ;;
27578abc0ccfSmrg    * )
27588abc0ccfSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
27598abc0ccfSmrg  esac
27608abc0ccfSmrgdone
27618abc0ccfSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
276296402570Smrg
27638abc0ccfSmrg# Copyright (C) 2001-2012 Free Software Foundation, Inc.
27648abc0ccfSmrg#
27658abc0ccfSmrg# This file is free software; the Free Software Foundation
27668abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
27678abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
276896402570Smrg
27698abc0ccfSmrg# serial 8
277096402570Smrg
27718abc0ccfSmrg# AM_PROG_INSTALL_SH
27728abc0ccfSmrg# ------------------
27738abc0ccfSmrg# Define $install_sh.
27748abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
27758abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
27768abc0ccfSmrgif test x"${install_sh}" != xset; then
27778abc0ccfSmrg  case $am_aux_dir in
27788abc0ccfSmrg  *\ * | *\	*)
27798abc0ccfSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
27808abc0ccfSmrg  *)
27818abc0ccfSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
27828abc0ccfSmrg  esac
278396402570Smrgfi
27848abc0ccfSmrgAC_SUBST([install_sh])])
278596402570Smrg
27868abc0ccfSmrg# Copyright (C) 2003-2012 Free Software Foundation, Inc.
27878abc0ccfSmrg#
27888abc0ccfSmrg# This file is free software; the Free Software Foundation
27898abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
27908abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
27918abc0ccfSmrg
27928abc0ccfSmrg# serial 2
27938abc0ccfSmrg
27948abc0ccfSmrg# Check whether the underlying file-system supports filenames
27958abc0ccfSmrg# with a leading dot.  For instance MS-DOS doesn't.
27968abc0ccfSmrgAC_DEFUN([AM_SET_LEADING_DOT],
27978abc0ccfSmrg[rm -rf .tst 2>/dev/null
27988abc0ccfSmrgmkdir .tst 2>/dev/null
27998abc0ccfSmrgif test -d .tst; then
28008abc0ccfSmrg  am__leading_dot=.
28018abc0ccfSmrgelse
28028abc0ccfSmrg  am__leading_dot=_
280396402570Smrgfi
28048abc0ccfSmrgrmdir .tst 2>/dev/null
28058abc0ccfSmrgAC_SUBST([am__leading_dot])])
280696402570Smrg
28078abc0ccfSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
28088abc0ccfSmrg# From Jim Meyering
280996402570Smrg
28108abc0ccfSmrg# Copyright (C) 1996-2012 Free Software Foundation, Inc.
28118abc0ccfSmrg#
28128abc0ccfSmrg# This file is free software; the Free Software Foundation
28138abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
28148abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
281596402570Smrg
28168abc0ccfSmrg# serial 7
281796402570Smrg
28188abc0ccfSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
28198abc0ccfSmrg# ----------------------------------
28208abc0ccfSmrg# Control maintainer-specific portions of Makefiles.
28218abc0ccfSmrg# Default is to disable them, unless 'enable' is passed literally.
28228abc0ccfSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
28238abc0ccfSmrg# can override the default with the --enable/--disable switch.
28248abc0ccfSmrgAC_DEFUN([AM_MAINTAINER_MODE],
28258abc0ccfSmrg[m4_case(m4_default([$1], [disable]),
28268abc0ccfSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
28278abc0ccfSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
28288abc0ccfSmrg       [m4_define([am_maintainer_other], [enable])
28298abc0ccfSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
28308abc0ccfSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
28318abc0ccfSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
28328abc0ccfSmrg  AC_ARG_ENABLE([maintainer-mode],
28338abc0ccfSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
28348abc0ccfSmrg      am_maintainer_other[ make rules and dependencies not useful
28358abc0ccfSmrg      (and sometimes confusing) to the casual installer])],
28368abc0ccfSmrg    [USE_MAINTAINER_MODE=$enableval],
28378abc0ccfSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
28388abc0ccfSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
28398abc0ccfSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
28408abc0ccfSmrg  MAINT=$MAINTAINER_MODE_TRUE
28418abc0ccfSmrg  AC_SUBST([MAINT])dnl
28428abc0ccfSmrg]
28438abc0ccfSmrg)
284496402570Smrg
28458abc0ccfSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
284696402570Smrg
28478abc0ccfSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
284896402570Smrg
28498abc0ccfSmrg# Copyright (C) 2001-2012 Free Software Foundation, Inc.
285096402570Smrg#
28518abc0ccfSmrg# This file is free software; the Free Software Foundation
28528abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
28538abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
285496402570Smrg
28558abc0ccfSmrg# serial 5
285696402570Smrg
28578abc0ccfSmrg# AM_MAKE_INCLUDE()
28588abc0ccfSmrg# -----------------
28598abc0ccfSmrg# Check to see how make treats includes.
28608abc0ccfSmrgAC_DEFUN([AM_MAKE_INCLUDE],
28618abc0ccfSmrg[am_make=${MAKE-make}
28628abc0ccfSmrgcat > confinc << 'END'
28638abc0ccfSmrgam__doit:
28648abc0ccfSmrg	@echo this is the am__doit target
28658abc0ccfSmrg.PHONY: am__doit
28668abc0ccfSmrgEND
28678abc0ccfSmrg# If we don't find an include directive, just comment out the code.
28688abc0ccfSmrgAC_MSG_CHECKING([for style of include used by $am_make])
28698abc0ccfSmrgam__include="#"
28708abc0ccfSmrgam__quote=
28718abc0ccfSmrg_am_result=none
28728abc0ccfSmrg# First try GNU make style include.
28738abc0ccfSmrgecho "include confinc" > confmf
28748abc0ccfSmrg# Ignore all kinds of additional output from 'make'.
28758abc0ccfSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
28768abc0ccfSmrg*the\ am__doit\ target*)
28778abc0ccfSmrg  am__include=include
28788abc0ccfSmrg  am__quote=
28798abc0ccfSmrg  _am_result=GNU
28808abc0ccfSmrg  ;;
28818abc0ccfSmrgesac
28828abc0ccfSmrg# Now try BSD make style include.
28838abc0ccfSmrgif test "$am__include" = "#"; then
28848abc0ccfSmrg   echo '.include "confinc"' > confmf
28858abc0ccfSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
28868abc0ccfSmrg   *the\ am__doit\ target*)
28878abc0ccfSmrg     am__include=.include
28888abc0ccfSmrg     am__quote="\""
28898abc0ccfSmrg     _am_result=BSD
28908abc0ccfSmrg     ;;
28918abc0ccfSmrg   esac
289296402570Smrgfi
28938abc0ccfSmrgAC_SUBST([am__include])
28948abc0ccfSmrgAC_SUBST([am__quote])
28958abc0ccfSmrgAC_MSG_RESULT([$_am_result])
28968abc0ccfSmrgrm -f confinc confmf
28978abc0ccfSmrg])
289896402570Smrg
28998abc0ccfSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
290096402570Smrg
29018abc0ccfSmrg# Copyright (C) 1997-2012 Free Software Foundation, Inc.
29028abc0ccfSmrg#
29038abc0ccfSmrg# This file is free software; the Free Software Foundation
29048abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29058abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
290696402570Smrg
29078abc0ccfSmrg# serial 7
290896402570Smrg
29098abc0ccfSmrg# AM_MISSING_PROG(NAME, PROGRAM)
29108abc0ccfSmrg# ------------------------------
29118abc0ccfSmrgAC_DEFUN([AM_MISSING_PROG],
29128abc0ccfSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
29138abc0ccfSmrg$1=${$1-"${am_missing_run}$2"}
29148abc0ccfSmrgAC_SUBST($1)])
291596402570Smrg
291696402570Smrg
29178abc0ccfSmrg# AM_MISSING_HAS_RUN
29188abc0ccfSmrg# ------------------
29198abc0ccfSmrg# Define MISSING if not defined so far and test if it supports --run.
29208abc0ccfSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
29218abc0ccfSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29228abc0ccfSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29238abc0ccfSmrgAC_REQUIRE_AUX_FILE([missing])dnl
29248abc0ccfSmrgif test x"${MISSING+set}" != xset; then
29258abc0ccfSmrg  case $am_aux_dir in
29268abc0ccfSmrg  *\ * | *\	*)
29278abc0ccfSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29288abc0ccfSmrg  *)
29298abc0ccfSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29308abc0ccfSmrg  esac
29318abc0ccfSmrgfi
29328abc0ccfSmrg# Use eval to expand $SHELL
29338abc0ccfSmrgif eval "$MISSING --run true"; then
29348abc0ccfSmrg  am_missing_run="$MISSING --run "
293596402570Smrgelse
29368abc0ccfSmrg  am_missing_run=
29378abc0ccfSmrg  AC_MSG_WARN(['missing' script is too old or missing])
293896402570Smrgfi
29398abc0ccfSmrg])
294096402570Smrg
29418abc0ccfSmrg# Helper functions for option handling.                     -*- Autoconf -*-
294296402570Smrg
29438abc0ccfSmrg# Copyright (C) 2001-2012 Free Software Foundation, Inc.
29447366012aSmrg#
29458abc0ccfSmrg# This file is free software; the Free Software Foundation
29468abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29478abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
29487366012aSmrg
29498abc0ccfSmrg# serial 6
29508abc0ccfSmrg
29518abc0ccfSmrg# _AM_MANGLE_OPTION(NAME)
29527366012aSmrg# -----------------------
29538abc0ccfSmrgAC_DEFUN([_AM_MANGLE_OPTION],
29548abc0ccfSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
29557366012aSmrg
29568abc0ccfSmrg# _AM_SET_OPTION(NAME)
29578abc0ccfSmrg# --------------------
29588abc0ccfSmrg# Set option NAME.  Presently that only means defining a flag for this option.
29598abc0ccfSmrgAC_DEFUN([_AM_SET_OPTION],
29608abc0ccfSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
296196402570Smrg
29628abc0ccfSmrg# _AM_SET_OPTIONS(OPTIONS)
29638abc0ccfSmrg# ------------------------
29648abc0ccfSmrg# OPTIONS is a space-separated list of Automake options.
29658abc0ccfSmrgAC_DEFUN([_AM_SET_OPTIONS],
29668abc0ccfSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
296796402570Smrg
29688abc0ccfSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
29698abc0ccfSmrg# -------------------------------------------
29708abc0ccfSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
29718abc0ccfSmrgAC_DEFUN([_AM_IF_OPTION],
29728abc0ccfSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
297396402570Smrg
29748abc0ccfSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
297596402570Smrg
29768abc0ccfSmrg# Copyright (C) 1996-2012 Free Software Foundation, Inc.
29778abc0ccfSmrg#
29788abc0ccfSmrg# This file is free software; the Free Software Foundation
29798abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
29808abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
29818abc0ccfSmrg
29828abc0ccfSmrg# serial 9
29838abc0ccfSmrg
29848abc0ccfSmrg# AM_SANITY_CHECK
29858abc0ccfSmrg# ---------------
29868abc0ccfSmrgAC_DEFUN([AM_SANITY_CHECK],
29878abc0ccfSmrg[AC_MSG_CHECKING([whether build environment is sane])
29888abc0ccfSmrg# Reject unsafe characters in $srcdir or the absolute working directory
29898abc0ccfSmrg# name.  Accept space and tab only in the latter.
29908abc0ccfSmrgam_lf='
29918abc0ccfSmrg'
29928abc0ccfSmrgcase `pwd` in
29938abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
29948abc0ccfSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
29958abc0ccfSmrgesac
29968abc0ccfSmrgcase $srcdir in
29978abc0ccfSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
29988abc0ccfSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
29998abc0ccfSmrgesac
30008abc0ccfSmrg
30018abc0ccfSmrg# Do 'set' in a subshell so we don't clobber the current shell's
30028abc0ccfSmrg# arguments.  Must try -L first in case configure is actually a
30038abc0ccfSmrg# symlink; some systems play weird games with the mod time of symlinks
30048abc0ccfSmrg# (eg FreeBSD returns the mod time of the symlink's containing
30058abc0ccfSmrg# directory).
30068abc0ccfSmrgif (
30078abc0ccfSmrg   am_has_slept=no
30088abc0ccfSmrg   for am_try in 1 2; do
30098abc0ccfSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
30108abc0ccfSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
30118abc0ccfSmrg     if test "$[*]" = "X"; then
30128abc0ccfSmrg	# -L didn't work.
30138abc0ccfSmrg	set X `ls -t "$srcdir/configure" conftest.file`
30148abc0ccfSmrg     fi
30158abc0ccfSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
30168abc0ccfSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
30178abc0ccfSmrg
30188abc0ccfSmrg	# If neither matched, then we have a broken ls.  This can happen
30198abc0ccfSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
30208abc0ccfSmrg	# broken ls alias from the environment.  This has actually
30218abc0ccfSmrg	# happened.  Such a system could not be considered "sane".
30228abc0ccfSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
30238abc0ccfSmrg  alias in your environment])
30248abc0ccfSmrg     fi
30258abc0ccfSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
30268abc0ccfSmrg       break
30278abc0ccfSmrg     fi
30288abc0ccfSmrg     # Just in case.
30298abc0ccfSmrg     sleep 1
30308abc0ccfSmrg     am_has_slept=yes
30318abc0ccfSmrg   done
30328abc0ccfSmrg   test "$[2]" = conftest.file
30338abc0ccfSmrg   )
30348abc0ccfSmrgthen
30358abc0ccfSmrg   # Ok.
30368abc0ccfSmrg   :
30378abc0ccfSmrgelse
30388abc0ccfSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
30398abc0ccfSmrgCheck your system clock])
30407a0395d0Smrgfi
30418abc0ccfSmrgAC_MSG_RESULT([yes])
30428abc0ccfSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
30438abc0ccfSmrg# generated files are strictly newer.
30448abc0ccfSmrgam_sleep_pid=
30458abc0ccfSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
30468abc0ccfSmrg  ( sleep 1 ) &
30478abc0ccfSmrg  am_sleep_pid=$!
30488abc0ccfSmrgfi
30498abc0ccfSmrgAC_CONFIG_COMMANDS_PRE(
30508abc0ccfSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
30518abc0ccfSmrg   if test -n "$am_sleep_pid"; then
30528abc0ccfSmrg     # Hide warnings about reused PIDs.
30538abc0ccfSmrg     wait $am_sleep_pid 2>/dev/null
30548abc0ccfSmrg   fi
30558abc0ccfSmrg   AC_MSG_RESULT([done])])
30568abc0ccfSmrgrm -f conftest.file
30578abc0ccfSmrg])
30587366012aSmrg
30598abc0ccfSmrg# Copyright (C) 2009-2012 Free Software Foundation, Inc.
30607366012aSmrg#
30618abc0ccfSmrg# This file is free software; the Free Software Foundation
30628abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
30638abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
30642adc0320Smrg
30658abc0ccfSmrg# serial 3
30667366012aSmrg
30678abc0ccfSmrg# AM_SILENT_RULES([DEFAULT])
30688abc0ccfSmrg# --------------------------
30698abc0ccfSmrg# Enable less verbose build rules; with the default set to DEFAULT
30708abc0ccfSmrg# ("yes" being less verbose, "no" or empty being verbose).
30718abc0ccfSmrgAC_DEFUN([AM_SILENT_RULES],
30728abc0ccfSmrg[AC_ARG_ENABLE([silent-rules], [dnl
30738abc0ccfSmrgAS_HELP_STRING(
30748abc0ccfSmrg  [--enable-silent-rules],
30758abc0ccfSmrg  [less verbose build output (undo: "make V=1")])
30768abc0ccfSmrgAS_HELP_STRING(
30778abc0ccfSmrg  [--disable-silent-rules],
30788abc0ccfSmrg  [verbose build output (undo: "make V=0")])dnl
30798abc0ccfSmrg])
30808abc0ccfSmrgcase $enable_silent_rules in @%:@ (((
30818abc0ccfSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
30828abc0ccfSmrg   no) AM_DEFAULT_VERBOSITY=1;;
30838abc0ccfSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
30848abc0ccfSmrgesac
30858abc0ccfSmrgdnl
30868abc0ccfSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
30878abc0ccfSmrgdnl do not support nested variable expansions.
30888abc0ccfSmrgdnl See automake bug#9928 and bug#10237.
30898abc0ccfSmrgam_make=${MAKE-make}
30908abc0ccfSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
30918abc0ccfSmrg   [am_cv_make_support_nested_variables],
30928abc0ccfSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
30938abc0ccfSmrgBAR0=false
30948abc0ccfSmrgBAR1=true
30958abc0ccfSmrgV=1
30968abc0ccfSmrgam__doit:
30978abc0ccfSmrg	@$(TRUE)
30988abc0ccfSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
30998abc0ccfSmrg  am_cv_make_support_nested_variables=yes
31008abc0ccfSmrgelse
31018abc0ccfSmrg  am_cv_make_support_nested_variables=no
31028abc0ccfSmrgfi])
31038abc0ccfSmrgif test $am_cv_make_support_nested_variables = yes; then
31048abc0ccfSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
31058abc0ccfSmrg  AM_V='$(V)'
31068abc0ccfSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
31078abc0ccfSmrgelse
31088abc0ccfSmrg  AM_V=$AM_DEFAULT_VERBOSITY
31098abc0ccfSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
31108abc0ccfSmrgfi
31118abc0ccfSmrgAC_SUBST([AM_V])dnl
31128abc0ccfSmrgAM_SUBST_NOTMAKE([AM_V])dnl
31138abc0ccfSmrgAC_SUBST([AM_DEFAULT_V])dnl
31148abc0ccfSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
31158abc0ccfSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
31168abc0ccfSmrgAM_BACKSLASH='\'
31178abc0ccfSmrgAC_SUBST([AM_BACKSLASH])dnl
31188abc0ccfSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
31197a0395d0Smrg])
31207a0395d0Smrg
31218abc0ccfSmrg# Copyright (C) 2001-2012 Free Software Foundation, Inc.
31227366012aSmrg#
31238abc0ccfSmrg# This file is free software; the Free Software Foundation
31248abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31258abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
31267a0395d0Smrg
31278abc0ccfSmrg# serial 2
31287a0395d0Smrg
31298abc0ccfSmrg# AM_PROG_INSTALL_STRIP
31308abc0ccfSmrg# ---------------------
31318abc0ccfSmrg# One issue with vendor 'install' (even GNU) is that you can't
31328abc0ccfSmrg# specify the program used to strip binaries.  This is especially
31338abc0ccfSmrg# annoying in cross-compiling environments, where the build's strip
31348abc0ccfSmrg# is unlikely to handle the host's binaries.
31358abc0ccfSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
31368abc0ccfSmrg# always use install-sh in "make install-strip", and initialize
31378abc0ccfSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
31388abc0ccfSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
31398abc0ccfSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
31408abc0ccfSmrg# Installed binaries are usually stripped using 'strip' when the user
31418abc0ccfSmrg# run "make install-strip".  However 'strip' might not be the right
31428abc0ccfSmrg# tool to use in cross-compilation environments, therefore Automake
31438abc0ccfSmrg# will honor the 'STRIP' environment variable to overrule this program.
31448abc0ccfSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
31458abc0ccfSmrgif test "$cross_compiling" != no; then
31468abc0ccfSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
31478abc0ccfSmrgfi
31488abc0ccfSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
31498abc0ccfSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
31507a0395d0Smrg
31518abc0ccfSmrg# Copyright (C) 2006-2012 Free Software Foundation, Inc.
31528abc0ccfSmrg#
31538abc0ccfSmrg# This file is free software; the Free Software Foundation
31548abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31558abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
31567a0395d0Smrg
31578abc0ccfSmrg# serial 3
31587a0395d0Smrg
31598abc0ccfSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
31608abc0ccfSmrg# ---------------------------
31618abc0ccfSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
31628abc0ccfSmrg# This macro is traced by Automake.
31638abc0ccfSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
316496402570Smrg
31658abc0ccfSmrg# AM_SUBST_NOTMAKE(VARIABLE)
31668abc0ccfSmrg# --------------------------
31678abc0ccfSmrg# Public sister of _AM_SUBST_NOTMAKE.
31688abc0ccfSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
31697a0395d0Smrg
31708abc0ccfSmrg# Check how to create a tarball.                            -*- Autoconf -*-
317196402570Smrg
31728abc0ccfSmrg# Copyright (C) 2004-2012 Free Software Foundation, Inc.
31738abc0ccfSmrg#
31748abc0ccfSmrg# This file is free software; the Free Software Foundation
31758abc0ccfSmrg# gives unlimited permission to copy and/or distribute it,
31768abc0ccfSmrg# with or without modifications, as long as this notice is preserved.
31777a0395d0Smrg
31788abc0ccfSmrg# serial 3
31797a0395d0Smrg
31808abc0ccfSmrg# _AM_PROG_TAR(FORMAT)
31818abc0ccfSmrg# --------------------
31828abc0ccfSmrg# Check how to create a tarball in format FORMAT.
31838abc0ccfSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
31848abc0ccfSmrg#
31858abc0ccfSmrg# Substitute a variable $(am__tar) that is a command
31868abc0ccfSmrg# writing to stdout a FORMAT-tarball containing the directory
31878abc0ccfSmrg# $tardir.
31888abc0ccfSmrg#     tardir=directory && $(am__tar) > result.tar
31898abc0ccfSmrg#
31908abc0ccfSmrg# Substitute a variable $(am__untar) that extract such
31918abc0ccfSmrg# a tarball read from stdin.
31928abc0ccfSmrg#     $(am__untar) < result.tar
31938abc0ccfSmrgAC_DEFUN([_AM_PROG_TAR],
31948abc0ccfSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
31958abc0ccfSmrg# in the wild :-(  We should find a proper way to deprecate it ...
31968abc0ccfSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
31978abc0ccfSmrgm4_if([$1], [v7],
31988abc0ccfSmrg     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
31998abc0ccfSmrg     [m4_case([$1], [ustar],, [pax],,
32008abc0ccfSmrg              [m4_fatal([Unknown tar format])])
32018abc0ccfSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
32028abc0ccfSmrg# Loop over all known methods to create a tar archive until one works.
32038abc0ccfSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
32048abc0ccfSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
32058abc0ccfSmrg# Do not fold the above two line into one, because Tru64 sh and
32068abc0ccfSmrg# Solaris sh will not grok spaces in the rhs of '-'.
32078abc0ccfSmrgfor _am_tool in $_am_tools
32088abc0ccfSmrgdo
32098abc0ccfSmrg  case $_am_tool in
32108abc0ccfSmrg  gnutar)
32118abc0ccfSmrg    for _am_tar in tar gnutar gtar;
32128abc0ccfSmrg    do
32138abc0ccfSmrg      AM_RUN_LOG([$_am_tar --version]) && break
32148abc0ccfSmrg    done
32158abc0ccfSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
32168abc0ccfSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
32178abc0ccfSmrg    am__untar="$_am_tar -xf -"
32188abc0ccfSmrg    ;;
32198abc0ccfSmrg  plaintar)
32208abc0ccfSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
32218abc0ccfSmrg    # ustar tarball either.
32228abc0ccfSmrg    (tar --version) >/dev/null 2>&1 && continue
32238abc0ccfSmrg    am__tar='tar chf - "$$tardir"'
32248abc0ccfSmrg    am__tar_='tar chf - "$tardir"'
32258abc0ccfSmrg    am__untar='tar xf -'
32268abc0ccfSmrg    ;;
32278abc0ccfSmrg  pax)
32288abc0ccfSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
32298abc0ccfSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
32308abc0ccfSmrg    am__untar='pax -r'
32318abc0ccfSmrg    ;;
32328abc0ccfSmrg  cpio)
32338abc0ccfSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
32348abc0ccfSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
32358abc0ccfSmrg    am__untar='cpio -i -H $1 -d'
32368abc0ccfSmrg    ;;
32378abc0ccfSmrg  none)
32388abc0ccfSmrg    am__tar=false
32398abc0ccfSmrg    am__tar_=false
32408abc0ccfSmrg    am__untar=false
32418abc0ccfSmrg    ;;
32428abc0ccfSmrg  esac
32437a0395d0Smrg
32448abc0ccfSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
32458abc0ccfSmrg  # and am__untar set.
32468abc0ccfSmrg  test -n "${am_cv_prog_tar_$1}" && break
32478abc0ccfSmrg
32488abc0ccfSmrg  # tar/untar a dummy directory, and stop if the command works
32498abc0ccfSmrg  rm -rf conftest.dir
32508abc0ccfSmrg  mkdir conftest.dir
32518abc0ccfSmrg  echo GrepMe > conftest.dir/file
32528abc0ccfSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
32538abc0ccfSmrg  rm -rf conftest.dir
32548abc0ccfSmrg  if test -s conftest.tar; then
32558abc0ccfSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
32568abc0ccfSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
32578abc0ccfSmrg  fi
32588abc0ccfSmrgdone
32598abc0ccfSmrgrm -rf conftest.dir
32607a0395d0Smrg
32618abc0ccfSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
32628abc0ccfSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
32638abc0ccfSmrgAC_SUBST([am__tar])
32648abc0ccfSmrgAC_SUBST([am__untar])
32658abc0ccfSmrg]) # _AM_PROG_TAR
32667a0395d0Smrg
3267