aclocal.m4 revision 7f419768
17f419768Smrg# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
2f29dbc25Smrg
304007ebaSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4f29dbc25Smrg
504007ebaSmrg# This file is free software; the Free Software Foundation
604007ebaSmrg# gives unlimited permission to copy and/or distribute it,
704007ebaSmrg# with or without modifications, as long as this notice is preserved.
8f29dbc25Smrg
904007ebaSmrg# This program is distributed in the hope that it will be useful,
1004007ebaSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1104007ebaSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1204007ebaSmrg# PARTICULAR PURPOSE.
13f29dbc25Smrg
1404007ebaSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1504007ebaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1604007ebaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1704007ebaSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1804007ebaSmrg[m4_warning([this file was generated for autoconf 2.69.
1904007ebaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2004007ebaSmrgIf you have problems, you may need to regenerate the build system entirely.
2104007ebaSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22f29dbc25Smrg
23f29dbc25Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
24170d5fdcSmrg# serial 1 (pkg-config-0.24)
25f29dbc25Smrg# 
26f29dbc25Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27f29dbc25Smrg#
28f29dbc25Smrg# This program is free software; you can redistribute it and/or modify
29f29dbc25Smrg# it under the terms of the GNU General Public License as published by
30f29dbc25Smrg# the Free Software Foundation; either version 2 of the License, or
31f29dbc25Smrg# (at your option) any later version.
32f29dbc25Smrg#
33f29dbc25Smrg# This program is distributed in the hope that it will be useful, but
34f29dbc25Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
35f29dbc25Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36f29dbc25Smrg# General Public License for more details.
37f29dbc25Smrg#
38f29dbc25Smrg# You should have received a copy of the GNU General Public License
39f29dbc25Smrg# along with this program; if not, write to the Free Software
40f29dbc25Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41f29dbc25Smrg#
42f29dbc25Smrg# As a special exception to the GNU General Public License, if you
43f29dbc25Smrg# distribute this file as part of a program that contains a
44f29dbc25Smrg# configuration script generated by Autoconf, you may include it under
45f29dbc25Smrg# the same distribution terms that you use for the rest of that program.
46f29dbc25Smrg
47f29dbc25Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
48f29dbc25Smrg# ----------------------------------
49f29dbc25SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
50f29dbc25Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
5104007ebaSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
5204007ebaSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
53170d5fdcSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
54170d5fdcSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
55170d5fdcSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
56170d5fdcSmrg
57f29dbc25Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
58f29dbc25Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
59f29dbc25Smrgfi
60f29dbc25Smrgif test -n "$PKG_CONFIG"; then
61f29dbc25Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
62f29dbc25Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
63f29dbc25Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
64f29dbc25Smrg		AC_MSG_RESULT([yes])
65f29dbc25Smrg	else
66f29dbc25Smrg		AC_MSG_RESULT([no])
67f29dbc25Smrg		PKG_CONFIG=""
68f29dbc25Smrg	fi
69f29dbc25Smrgfi[]dnl
70f29dbc25Smrg])# PKG_PROG_PKG_CONFIG
71f29dbc25Smrg
72f29dbc25Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
73f29dbc25Smrg#
74f29dbc25Smrg# Check to see whether a particular set of modules exists.  Similar
75f29dbc25Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
76f29dbc25Smrg#
77170d5fdcSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
78170d5fdcSmrg# only at the first occurence in configure.ac, so if the first place
79170d5fdcSmrg# it's called might be skipped (such as if it is within an "if", you
80170d5fdcSmrg# have to call PKG_CHECK_EXISTS manually
81f29dbc25Smrg# --------------------------------------------------------------
82f29dbc25SmrgAC_DEFUN([PKG_CHECK_EXISTS],
83f29dbc25Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84f29dbc25Smrgif test -n "$PKG_CONFIG" && \
85f29dbc25Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
86170d5fdcSmrg  m4_default([$2], [:])
87f29dbc25Smrgm4_ifvaln([$3], [else
88f29dbc25Smrg  $3])dnl
89f29dbc25Smrgfi])
90f29dbc25Smrg
91f29dbc25Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
92f29dbc25Smrg# ---------------------------------------------
93f29dbc25Smrgm4_define([_PKG_CONFIG],
94170d5fdcSmrg[if test -n "$$1"; then
95170d5fdcSmrg    pkg_cv_[]$1="$$1"
96170d5fdcSmrg elif test -n "$PKG_CONFIG"; then
97170d5fdcSmrg    PKG_CHECK_EXISTS([$3],
9804007ebaSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
9904007ebaSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
100170d5fdcSmrg		     [pkg_failed=yes])
101170d5fdcSmrg else
102170d5fdcSmrg    pkg_failed=untried
103f29dbc25Smrgfi[]dnl
104f29dbc25Smrg])# _PKG_CONFIG
105f29dbc25Smrg
106f29dbc25Smrg# _PKG_SHORT_ERRORS_SUPPORTED
107f29dbc25Smrg# -----------------------------
108f29dbc25SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
109f29dbc25Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110f29dbc25Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
111f29dbc25Smrg        _pkg_short_errors_supported=yes
112f29dbc25Smrgelse
113f29dbc25Smrg        _pkg_short_errors_supported=no
114f29dbc25Smrgfi[]dnl
115f29dbc25Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
116f29dbc25Smrg
117f29dbc25Smrg
118f29dbc25Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
119f29dbc25Smrg# [ACTION-IF-NOT-FOUND])
120f29dbc25Smrg#
121f29dbc25Smrg#
122f29dbc25Smrg# Note that if there is a possibility the first call to
123f29dbc25Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
124f29dbc25Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125f29dbc25Smrg#
126f29dbc25Smrg#
127f29dbc25Smrg# --------------------------------------------------------------
128f29dbc25SmrgAC_DEFUN([PKG_CHECK_MODULES],
129f29dbc25Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
130f29dbc25SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
131f29dbc25SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
132f29dbc25Smrg
133f29dbc25Smrgpkg_failed=no
134f29dbc25SmrgAC_MSG_CHECKING([for $1])
135f29dbc25Smrg
136f29dbc25Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
137f29dbc25Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138f29dbc25Smrg
139f29dbc25Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
140f29dbc25Smrgand $1[]_LIBS to avoid the need to call pkg-config.
141f29dbc25SmrgSee the pkg-config man page for more details.])
142f29dbc25Smrg
143f29dbc25Smrgif test $pkg_failed = yes; then
144170d5fdcSmrg   	AC_MSG_RESULT([no])
145f29dbc25Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146f29dbc25Smrg        if test $_pkg_short_errors_supported = yes; then
14704007ebaSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
148f29dbc25Smrg        else 
14904007ebaSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
150f29dbc25Smrg        fi
151f29dbc25Smrg	# Put the nasty error message in config.log where it belongs
152f29dbc25Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
153f29dbc25Smrg
154170d5fdcSmrg	m4_default([$4], [AC_MSG_ERROR(
155f29dbc25Smrg[Package requirements ($2) were not met:
156f29dbc25Smrg
157f29dbc25Smrg$$1_PKG_ERRORS
158f29dbc25Smrg
159f29dbc25SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
160f29dbc25Smrginstalled software in a non-standard prefix.
161f29dbc25Smrg
162170d5fdcSmrg_PKG_TEXT])[]dnl
163170d5fdcSmrg        ])
164f29dbc25Smrgelif test $pkg_failed = untried; then
165170d5fdcSmrg     	AC_MSG_RESULT([no])
166170d5fdcSmrg	m4_default([$4], [AC_MSG_FAILURE(
167f29dbc25Smrg[The pkg-config script could not be found or is too old.  Make sure it
168f29dbc25Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
169f29dbc25Smrgpath to pkg-config.
170f29dbc25Smrg
171f29dbc25Smrg_PKG_TEXT
172f29dbc25Smrg
173170d5fdcSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
174170d5fdcSmrg        ])
175f29dbc25Smrgelse
176f29dbc25Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
177f29dbc25Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
178f29dbc25Smrg        AC_MSG_RESULT([yes])
179170d5fdcSmrg	$3
180f29dbc25Smrgfi[]dnl
181f29dbc25Smrg])# PKG_CHECK_MODULES
182f29dbc25Smrg
1837f419768Smrg
1847f419768Smrg# PKG_INSTALLDIR(DIRECTORY)
1857f419768Smrg# -------------------------
1867f419768Smrg# Substitutes the variable pkgconfigdir as the location where a module
1877f419768Smrg# should install pkg-config .pc files. By default the directory is
1887f419768Smrg# $libdir/pkgconfig, but the default can be changed by passing
1897f419768Smrg# DIRECTORY. The user can override through the --with-pkgconfigdir
1907f419768Smrg# parameter.
1917f419768SmrgAC_DEFUN([PKG_INSTALLDIR],
1927f419768Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1937f419768Smrgm4_pushdef([pkg_description],
1947f419768Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1957f419768SmrgAC_ARG_WITH([pkgconfigdir],
1967f419768Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1977f419768Smrg    [with_pkgconfigdir=]pkg_default)
1987f419768SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1997f419768Smrgm4_popdef([pkg_default])
2007f419768Smrgm4_popdef([pkg_description])
2017f419768Smrg]) dnl PKG_INSTALLDIR
2027f419768Smrg
2037f419768Smrg
2047f419768Smrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
2057f419768Smrg# -------------------------
2067f419768Smrg# Substitutes the variable noarch_pkgconfigdir as the location where a
2077f419768Smrg# module should install arch-independent pkg-config .pc files. By
2087f419768Smrg# default the directory is $datadir/pkgconfig, but the default can be
2097f419768Smrg# changed by passing DIRECTORY. The user can override through the
2107f419768Smrg# --with-noarch-pkgconfigdir parameter.
2117f419768SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
2127f419768Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
2137f419768Smrgm4_pushdef([pkg_description],
2147f419768Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
2157f419768SmrgAC_ARG_WITH([noarch-pkgconfigdir],
2167f419768Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
2177f419768Smrg    [with_noarch_pkgconfigdir=]pkg_default)
2187f419768SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
2197f419768Smrgm4_popdef([pkg_default])
2207f419768Smrgm4_popdef([pkg_description])
2217f419768Smrg]) dnl PKG_NOARCH_INSTALLDIR
2227f419768Smrg
2237f419768Smrg
2247f419768Smrg# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
2257f419768Smrg# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2267f419768Smrg# -------------------------------------------
2277f419768Smrg# Retrieves the value of the pkg-config variable for the given module.
2287f419768SmrgAC_DEFUN([PKG_CHECK_VAR],
2297f419768Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2307f419768SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2317f419768Smrg
2327f419768Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
2337f419768SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2347f419768Smrg
2357f419768SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
2367f419768Smrg])# PKG_CHECK_VAR
2377f419768Smrg
238f29dbc25Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
239f29dbc25Smrgdnl
240170d5fdcSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
24104007ebaSmrgdnl
242f29dbc25Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
243f29dbc25Smrgdnl copy of this software and associated documentation files (the "Software"),
244f29dbc25Smrgdnl to deal in the Software without restriction, including without limitation
245f29dbc25Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
246f29dbc25Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
247f29dbc25Smrgdnl Software is furnished to do so, subject to the following conditions:
248f29dbc25Smrgdnl
249f29dbc25Smrgdnl The above copyright notice and this permission notice (including the next
250f29dbc25Smrgdnl paragraph) shall be included in all copies or substantial portions of the
251f29dbc25Smrgdnl Software.
252f29dbc25Smrgdnl
253f29dbc25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
254f29dbc25Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
255f29dbc25Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
256f29dbc25Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
257f29dbc25Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
258f29dbc25Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
259f29dbc25Smrgdnl DEALINGS IN THE SOFTWARE.
260f29dbc25Smrg
261f29dbc25Smrg# XORG_MACROS_VERSION(required-version)
262f29dbc25Smrg# -------------------------------------
263f29dbc25Smrg# Minimum version: 1.1.0
264f29dbc25Smrg#
265f29dbc25Smrg# If you're using a macro added in Version 1.1 or newer, include this in
266f29dbc25Smrg# your configure.ac with the minimum required version, such as:
267f29dbc25Smrg# XORG_MACROS_VERSION(1.1)
268f29dbc25Smrg#
269f29dbc25Smrg# To ensure that this macro is defined, also add:
270f29dbc25Smrg# m4_ifndef([XORG_MACROS_VERSION],
271f29dbc25Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
272f29dbc25Smrg#
273f29dbc25Smrg#
27404007ebaSmrg# See the "minimum version" comment for each macro you use to see what
275f29dbc25Smrg# version you require.
276f29dbc25Smrgm4_defun([XORG_MACROS_VERSION],[
2777f419768Smrgm4_define([vers_have], [1.19.0])
278f29dbc25Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
279f29dbc25Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
280f29dbc25Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
281f29dbc25Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
282f29dbc25Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
283f29dbc25Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
284f29dbc25Smrgm4_undefine([vers_have])
285f29dbc25Smrgm4_undefine([maj_have])
286f29dbc25Smrgm4_undefine([maj_needed])
287f29dbc25Smrg]) # XORG_MACROS_VERSION
288f29dbc25Smrg
289f29dbc25Smrg# XORG_PROG_RAWCPP()
290f29dbc25Smrg# ------------------
291f29dbc25Smrg# Minimum version: 1.0.0
292f29dbc25Smrg#
293f29dbc25Smrg# Find cpp program and necessary flags for use in pre-processing text files
294f29dbc25Smrg# such as man pages and config files
295f29dbc25SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
296f29dbc25SmrgAC_REQUIRE([AC_PROG_CPP])
29704007ebaSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
298f29dbc25Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
299f29dbc25Smrg
300f29dbc25Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
301f29dbc25Smrg# which is not the best choice for supporting other OS'es, but covers most
302f29dbc25Smrg# of the ones we need for now.
303f29dbc25SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
30404007ebaSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
305f29dbc25Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
306f29dbc25Smrg	AC_MSG_RESULT([no])
307f29dbc25Smrgelse
308f29dbc25Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
309f29dbc25Smrg		RAWCPPFLAGS=-undef
310f29dbc25Smrg		AC_MSG_RESULT([yes])
311f29dbc25Smrg	# under Cygwin unix is still defined even with -undef
312f29dbc25Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
313f29dbc25Smrg		RAWCPPFLAGS="-undef -ansi"
314f29dbc25Smrg		AC_MSG_RESULT([yes, with -ansi])
315f29dbc25Smrg	else
316f29dbc25Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
317f29dbc25Smrg	fi
318f29dbc25Smrgfi
319f29dbc25Smrgrm -f conftest.$ac_ext
320f29dbc25Smrg
321f29dbc25SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
32204007ebaSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
323f29dbc25Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
324f29dbc25Smrg	AC_MSG_RESULT([no])
325f29dbc25Smrgelse
326f29dbc25Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
3277f419768Smrg		TRADITIONALCPPFLAGS="-traditional"
328f29dbc25Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
329f29dbc25Smrg		AC_MSG_RESULT([yes])
330f29dbc25Smrg	else
331f29dbc25Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
332f29dbc25Smrg	fi
333f29dbc25Smrgfi
334f29dbc25Smrgrm -f conftest.$ac_ext
335f29dbc25SmrgAC_SUBST(RAWCPPFLAGS)
3367f419768SmrgAC_SUBST(TRADITIONALCPPFLAGS)
337f29dbc25Smrg]) # XORG_PROG_RAWCPP
338f29dbc25Smrg
339f29dbc25Smrg# XORG_MANPAGE_SECTIONS()
340f29dbc25Smrg# -----------------------
341f29dbc25Smrg# Minimum version: 1.0.0
342f29dbc25Smrg#
343f29dbc25Smrg# Determine which sections man pages go in for the different man page types
344f29dbc25Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
345f29dbc25Smrg# Not sure if there's any better way than just hardcoding by OS name.
346f29dbc25Smrg# Override default settings by setting environment variables
347170d5fdcSmrg# Added MAN_SUBSTS in version 1.8
348170d5fdcSmrg# Added AC_PROG_SED in version 1.8
349f29dbc25Smrg
350f29dbc25SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
351f29dbc25SmrgAC_REQUIRE([AC_CANONICAL_HOST])
352170d5fdcSmrgAC_REQUIRE([AC_PROG_SED])
353f29dbc25Smrg
354f29dbc25Smrgif test x$APP_MAN_SUFFIX = x    ; then
355f29dbc25Smrg    APP_MAN_SUFFIX=1
356f29dbc25Smrgfi
357f29dbc25Smrgif test x$APP_MAN_DIR = x    ; then
358f29dbc25Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
359f29dbc25Smrgfi
360f29dbc25Smrg
361f29dbc25Smrgif test x$LIB_MAN_SUFFIX = x    ; then
362f29dbc25Smrg    LIB_MAN_SUFFIX=3
363f29dbc25Smrgfi
364f29dbc25Smrgif test x$LIB_MAN_DIR = x    ; then
365f29dbc25Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
366f29dbc25Smrgfi
367f29dbc25Smrg
368f29dbc25Smrgif test x$FILE_MAN_SUFFIX = x    ; then
369f29dbc25Smrg    case $host_os in
370f29dbc25Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
371f29dbc25Smrg	*)		FILE_MAN_SUFFIX=5  ;;
372f29dbc25Smrg    esac
373f29dbc25Smrgfi
374f29dbc25Smrgif test x$FILE_MAN_DIR = x    ; then
375f29dbc25Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
376f29dbc25Smrgfi
377f29dbc25Smrg
378f29dbc25Smrgif test x$MISC_MAN_SUFFIX = x    ; then
379f29dbc25Smrg    case $host_os in
380f29dbc25Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
381f29dbc25Smrg	*)		MISC_MAN_SUFFIX=7  ;;
382f29dbc25Smrg    esac
383f29dbc25Smrgfi
384f29dbc25Smrgif test x$MISC_MAN_DIR = x    ; then
385f29dbc25Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
386f29dbc25Smrgfi
387f29dbc25Smrg
388f29dbc25Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
389f29dbc25Smrg    case $host_os in
390f29dbc25Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
391f29dbc25Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
392f29dbc25Smrg    esac
393f29dbc25Smrgfi
394f29dbc25Smrgif test x$DRIVER_MAN_DIR = x    ; then
395f29dbc25Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
396f29dbc25Smrgfi
397f29dbc25Smrg
398f29dbc25Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
399f29dbc25Smrg    case $host_os in
400f29dbc25Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
401f29dbc25Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
402f29dbc25Smrg    esac
403f29dbc25Smrgfi
404f29dbc25Smrgif test x$ADMIN_MAN_DIR = x    ; then
405f29dbc25Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
406f29dbc25Smrgfi
407f29dbc25Smrg
408f29dbc25Smrg
409f29dbc25SmrgAC_SUBST([APP_MAN_SUFFIX])
410f29dbc25SmrgAC_SUBST([LIB_MAN_SUFFIX])
411f29dbc25SmrgAC_SUBST([FILE_MAN_SUFFIX])
412f29dbc25SmrgAC_SUBST([MISC_MAN_SUFFIX])
413f29dbc25SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
414f29dbc25SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
415f29dbc25SmrgAC_SUBST([APP_MAN_DIR])
416f29dbc25SmrgAC_SUBST([LIB_MAN_DIR])
417f29dbc25SmrgAC_SUBST([FILE_MAN_DIR])
418f29dbc25SmrgAC_SUBST([MISC_MAN_DIR])
419f29dbc25SmrgAC_SUBST([DRIVER_MAN_DIR])
420f29dbc25SmrgAC_SUBST([ADMIN_MAN_DIR])
421170d5fdcSmrg
422170d5fdcSmrgXORG_MAN_PAGE="X Version 11"
423170d5fdcSmrgAC_SUBST([XORG_MAN_PAGE])
424170d5fdcSmrgMAN_SUBSTS="\
425170d5fdcSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
426170d5fdcSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
427170d5fdcSmrg	-e 's|__xservername__|Xorg|g' \
428170d5fdcSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
429170d5fdcSmrg	-e 's|__projectroot__|\$(prefix)|g' \
430170d5fdcSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
431170d5fdcSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
432170d5fdcSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
433170d5fdcSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
434170d5fdcSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
435170d5fdcSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
436170d5fdcSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
437170d5fdcSmrgAC_SUBST([MAN_SUBSTS])
438170d5fdcSmrg
439f29dbc25Smrg]) # XORG_MANPAGE_SECTIONS
440f29dbc25Smrg
441170d5fdcSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
442170d5fdcSmrg# ------------------------
443170d5fdcSmrg# Minimum version: 1.7.0
444170d5fdcSmrg#
445170d5fdcSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
446170d5fdcSmrg# provided by xorg-sgml-doctools, if installed.
447170d5fdcSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
448170d5fdcSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
449170d5fdcSmrgXORG_SGML_PATH=
450170d5fdcSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
451170d5fdcSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
452170d5fdcSmrg    [m4_ifval([$1],[:],
453170d5fdcSmrg        [if test x"$cross_compiling" != x"yes" ; then
454170d5fdcSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
455170d5fdcSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
456170d5fdcSmrg         fi])
457170d5fdcSmrg    ])
458170d5fdcSmrg
459170d5fdcSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
460170d5fdcSmrg# the path and the name of the doc stylesheet
461170d5fdcSmrgif test "x$XORG_SGML_PATH" != "x" ; then
462170d5fdcSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
463170d5fdcSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
464170d5fdcSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
465170d5fdcSmrgelse
466170d5fdcSmrg   AC_MSG_RESULT([no])
467170d5fdcSmrgfi
468170d5fdcSmrg
469170d5fdcSmrgAC_SUBST(XORG_SGML_PATH)
470170d5fdcSmrgAC_SUBST(STYLESHEET_SRCDIR)
471170d5fdcSmrgAC_SUBST(XSL_STYLESHEET)
472170d5fdcSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
473170d5fdcSmrg]) # XORG_CHECK_SGML_DOCTOOLS
474170d5fdcSmrg
475f29dbc25Smrg# XORG_CHECK_LINUXDOC
476f29dbc25Smrg# -------------------
477f29dbc25Smrg# Minimum version: 1.0.0
478f29dbc25Smrg#
479f29dbc25Smrg# Defines the variable MAKE_TEXT if the necessary tools and
480f29dbc25Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
481f29dbc25Smrg# Whether or not the necessary tools and files are found can be checked
482f29dbc25Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
483f29dbc25SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
484170d5fdcSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
485170d5fdcSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
486f29dbc25Smrg
487f29dbc25SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
488f29dbc25Smrg
489170d5fdcSmrgAC_MSG_CHECKING([whether to build documentation])
490f29dbc25Smrg
491170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
492f29dbc25Smrg   BUILDDOC=yes
493f29dbc25Smrgelse
494f29dbc25Smrg   BUILDDOC=no
495f29dbc25Smrgfi
496f29dbc25Smrg
497f29dbc25SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
498f29dbc25Smrg
499f29dbc25SmrgAC_MSG_RESULT([$BUILDDOC])
500f29dbc25Smrg
501170d5fdcSmrgAC_MSG_CHECKING([whether to build pdf documentation])
502f29dbc25Smrg
503170d5fdcSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
504f29dbc25Smrg   BUILDPDFDOC=yes
505f29dbc25Smrgelse
506f29dbc25Smrg   BUILDPDFDOC=no
507f29dbc25Smrgfi
508f29dbc25Smrg
509f29dbc25SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
510f29dbc25Smrg
511f29dbc25SmrgAC_MSG_RESULT([$BUILDPDFDOC])
512f29dbc25Smrg
513170d5fdcSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
514f29dbc25SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
515f29dbc25SmrgMAKE_PDF="$PS2PDF"
516f29dbc25SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
517f29dbc25Smrg
518f29dbc25SmrgAC_SUBST(MAKE_TEXT)
519f29dbc25SmrgAC_SUBST(MAKE_PS)
520f29dbc25SmrgAC_SUBST(MAKE_PDF)
521f29dbc25SmrgAC_SUBST(MAKE_HTML)
522f29dbc25Smrg]) # XORG_CHECK_LINUXDOC
523f29dbc25Smrg
524f29dbc25Smrg# XORG_CHECK_DOCBOOK
525f29dbc25Smrg# -------------------
526f29dbc25Smrg# Minimum version: 1.0.0
527f29dbc25Smrg#
528f29dbc25Smrg# Checks for the ability to build output formats from SGML DocBook source.
529f29dbc25Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
530f29dbc25Smrg# indicates whether the necessary tools and files are found and, if set,
531f29dbc25Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
532f29dbc25SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
533170d5fdcSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
534170d5fdcSmrg
535f29dbc25SmrgBUILDTXTDOC=no
536f29dbc25SmrgBUILDPDFDOC=no
537f29dbc25SmrgBUILDPSDOC=no
538f29dbc25SmrgBUILDHTMLDOC=no
539f29dbc25Smrg
540f29dbc25SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
541f29dbc25SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
542f29dbc25SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
543f29dbc25SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
544f29dbc25Smrg
545170d5fdcSmrgAC_MSG_CHECKING([whether to build text documentation])
546170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
547f29dbc25Smrg   test x$BUILD_TXTDOC != xno; then
548f29dbc25Smrg	BUILDTXTDOC=yes
549f29dbc25Smrgfi
550f29dbc25SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
551f29dbc25SmrgAC_MSG_RESULT([$BUILDTXTDOC])
552f29dbc25Smrg
553170d5fdcSmrgAC_MSG_CHECKING([whether to build PDF documentation])
554170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
555f29dbc25Smrg   test x$BUILD_PDFDOC != xno; then
556f29dbc25Smrg	BUILDPDFDOC=yes
557f29dbc25Smrgfi
558f29dbc25SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
559f29dbc25SmrgAC_MSG_RESULT([$BUILDPDFDOC])
560f29dbc25Smrg
561170d5fdcSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
562170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
563f29dbc25Smrg   test x$BUILD_PSDOC != xno; then
564f29dbc25Smrg	BUILDPSDOC=yes
565f29dbc25Smrgfi
566f29dbc25SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
567f29dbc25SmrgAC_MSG_RESULT([$BUILDPSDOC])
568f29dbc25Smrg
569170d5fdcSmrgAC_MSG_CHECKING([whether to build HTML documentation])
570170d5fdcSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
571f29dbc25Smrg   test x$BUILD_HTMLDOC != xno; then
572f29dbc25Smrg	BUILDHTMLDOC=yes
573f29dbc25Smrgfi
574f29dbc25SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
575f29dbc25SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
576f29dbc25Smrg
577f29dbc25SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
578f29dbc25SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
579f29dbc25SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
580f29dbc25SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
581f29dbc25Smrg
582f29dbc25SmrgAC_SUBST(MAKE_TEXT)
583f29dbc25SmrgAC_SUBST(MAKE_PS)
584f29dbc25SmrgAC_SUBST(MAKE_PDF)
585f29dbc25SmrgAC_SUBST(MAKE_HTML)
586f29dbc25Smrg]) # XORG_CHECK_DOCBOOK
587f29dbc25Smrg
588170d5fdcSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
589f29dbc25Smrg# ----------------
590f29dbc25Smrg# Minimum version: 1.5.0
591170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
592f29dbc25Smrg#
593f29dbc25Smrg# Documentation tools are not always available on all platforms and sometimes
594f29dbc25Smrg# not at the appropriate level. This macro enables a module to test for the
595f29dbc25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
596f29dbc25Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
597170d5fdcSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
598170d5fdcSmrg# --with-xmlto assumes 'auto'.
599f29dbc25Smrg#
600f29dbc25Smrg# Interface to module:
601f29dbc25Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
602f29dbc25Smrg# XMLTO:	returns the path of the xmlto program found
603f29dbc25Smrg#		returns the path set by the user in the environment
604f29dbc25Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
605f29dbc25Smrg#		'no' user instructs the module not to use xmlto
606f29dbc25Smrg#
607170d5fdcSmrg# Added in version 1.10.0
608170d5fdcSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
609170d5fdcSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
610170d5fdcSmrg#
611f29dbc25Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
612f29dbc25Smrg#
613f29dbc25SmrgAC_DEFUN([XORG_WITH_XMLTO],[
614f29dbc25SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
615170d5fdcSmrgm4_define([_defopt], m4_default([$2], [auto]))
616f29dbc25SmrgAC_ARG_WITH(xmlto,
617f29dbc25Smrg	AS_HELP_STRING([--with-xmlto],
618170d5fdcSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
619170d5fdcSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
620170d5fdcSmrgm4_undefine([_defopt])
621f29dbc25Smrg
622f29dbc25Smrgif test "x$use_xmlto" = x"auto"; then
623f29dbc25Smrg   AC_PATH_PROG([XMLTO], [xmlto])
624f29dbc25Smrg   if test "x$XMLTO" = "x"; then
625f29dbc25Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
626f29dbc25Smrg	have_xmlto=no
627f29dbc25Smrg   else
628f29dbc25Smrg        have_xmlto=yes
629f29dbc25Smrg   fi
630f29dbc25Smrgelif test "x$use_xmlto" = x"yes" ; then
631f29dbc25Smrg   AC_PATH_PROG([XMLTO], [xmlto])
632f29dbc25Smrg   if test "x$XMLTO" = "x"; then
633f29dbc25Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
634f29dbc25Smrg   fi
635f29dbc25Smrg   have_xmlto=yes
636f29dbc25Smrgelif test "x$use_xmlto" = x"no" ; then
637f29dbc25Smrg   if test "x$XMLTO" != "x"; then
638f29dbc25Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
639f29dbc25Smrg   fi
640f29dbc25Smrg   have_xmlto=no
641f29dbc25Smrgelse
642f29dbc25Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
643f29dbc25Smrgfi
644170d5fdcSmrg
645170d5fdcSmrg# Test for a minimum version of xmlto, if provided.
646170d5fdcSmrgm4_ifval([$1],
647170d5fdcSmrg[if test "$have_xmlto" = yes; then
648170d5fdcSmrg    # scrape the xmlto version
649170d5fdcSmrg    AC_MSG_CHECKING([the xmlto version])
650170d5fdcSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
651170d5fdcSmrg    AC_MSG_RESULT([$xmlto_version])
652170d5fdcSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
653170d5fdcSmrg        [if test "x$use_xmlto" = xauto; then
654170d5fdcSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
655170d5fdcSmrg            have_xmlto=no
656170d5fdcSmrg        else
657170d5fdcSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
658170d5fdcSmrg        fi])
659170d5fdcSmrgfi])
660170d5fdcSmrg
66104007ebaSmrg# Test for the ability of xmlto to generate a text target
66204007ebaSmrghave_xmlto_text=no
66304007ebaSmrgcat > conftest.xml << "EOF"
66404007ebaSmrgEOF
66504007ebaSmrgAS_IF([test "$have_xmlto" = yes],
66604007ebaSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
66704007ebaSmrg             [have_xmlto_text=yes],
66804007ebaSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
66904007ebaSmrgrm -f conftest.xml
67004007ebaSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
67104007ebaSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
67204007ebaSmrg]) # XORG_WITH_XMLTO
67304007ebaSmrg
67404007ebaSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
67504007ebaSmrg# --------------------------------------------
67604007ebaSmrg# Minimum version: 1.12.0
67704007ebaSmrg# Minimum version for optional DEFAULT argument: 1.12.0
67804007ebaSmrg#
67904007ebaSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
68004007ebaSmrg# XML-based language used for the transformation of XML documents.
68104007ebaSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
68204007ebaSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
68304007ebaSmrg# The XSLT processor is often used as a standalone tool for transformations.
68404007ebaSmrg# It should not be assumed that this tool is used only to work with documnetation.
68504007ebaSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
68604007ebaSmrg#
68704007ebaSmrg# Interface to module:
68804007ebaSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
68904007ebaSmrg# XSLTPROC:	 returns the path of the xsltproc program found
69004007ebaSmrg#		 returns the path set by the user in the environment
69104007ebaSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
69204007ebaSmrg#		  'no' user instructs the module not to use xsltproc
69304007ebaSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
69404007ebaSmrg#
69504007ebaSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
69604007ebaSmrg#
69704007ebaSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
69804007ebaSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
69904007ebaSmrg# Preserves the interface, should it be implemented later
70004007ebaSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
70104007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
70204007ebaSmrgAC_ARG_WITH(xsltproc,
70304007ebaSmrg	AS_HELP_STRING([--with-xsltproc],
70404007ebaSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
70504007ebaSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
70604007ebaSmrgm4_undefine([_defopt])
70704007ebaSmrg
70804007ebaSmrgif test "x$use_xsltproc" = x"auto"; then
70904007ebaSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
71004007ebaSmrg   if test "x$XSLTPROC" = "x"; then
71104007ebaSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
71204007ebaSmrg	have_xsltproc=no
71304007ebaSmrg   else
71404007ebaSmrg        have_xsltproc=yes
71504007ebaSmrg   fi
71604007ebaSmrgelif test "x$use_xsltproc" = x"yes" ; then
71704007ebaSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
71804007ebaSmrg   if test "x$XSLTPROC" = "x"; then
71904007ebaSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
72004007ebaSmrg   fi
72104007ebaSmrg   have_xsltproc=yes
72204007ebaSmrgelif test "x$use_xsltproc" = x"no" ; then
72304007ebaSmrg   if test "x$XSLTPROC" != "x"; then
72404007ebaSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
72504007ebaSmrg   fi
72604007ebaSmrg   have_xsltproc=no
72704007ebaSmrgelse
72804007ebaSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
72904007ebaSmrgfi
73004007ebaSmrg
73104007ebaSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
73204007ebaSmrg]) # XORG_WITH_XSLTPROC
73304007ebaSmrg
73404007ebaSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
73504007ebaSmrg# ----------------------------------------
73604007ebaSmrg# Minimum version: 1.15.0
73704007ebaSmrg#
73804007ebaSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
73904007ebaSmrg# scanning arbitrary text files, extracting information from those text files,
74004007ebaSmrg# and printing reports based on that information.
74104007ebaSmrg#
74204007ebaSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
74304007ebaSmrg#
74404007ebaSmrg# Interface to module:
74504007ebaSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
74604007ebaSmrg# PERL:	     returns the path of the perl program found
74704007ebaSmrg#	     returns the path set by the user in the environment
74804007ebaSmrg# --with-perl: 'yes' user instructs the module to use perl
74904007ebaSmrg#	       'no' user instructs the module not to use perl
75004007ebaSmrg# have_perl: returns yes if perl found in PATH or no
75104007ebaSmrg#
75204007ebaSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
75304007ebaSmrg#
75404007ebaSmrgAC_DEFUN([XORG_WITH_PERL],[
75504007ebaSmrgAC_ARG_VAR([PERL], [Path to perl command])
75604007ebaSmrg# Preserves the interface, should it be implemented later
75704007ebaSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
75804007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
75904007ebaSmrgAC_ARG_WITH(perl,
76004007ebaSmrg	AS_HELP_STRING([--with-perl],
76104007ebaSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
76204007ebaSmrg	   [use_perl=$withval], [use_perl=]_defopt)
76304007ebaSmrgm4_undefine([_defopt])
76404007ebaSmrg
76504007ebaSmrgif test "x$use_perl" = x"auto"; then
76604007ebaSmrg   AC_PATH_PROG([PERL], [perl])
76704007ebaSmrg   if test "x$PERL" = "x"; then
76804007ebaSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
76904007ebaSmrg	have_perl=no
77004007ebaSmrg   else
77104007ebaSmrg        have_perl=yes
77204007ebaSmrg   fi
77304007ebaSmrgelif test "x$use_perl" = x"yes" ; then
77404007ebaSmrg   AC_PATH_PROG([PERL], [perl])
77504007ebaSmrg   if test "x$PERL" = "x"; then
77604007ebaSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
77704007ebaSmrg   fi
77804007ebaSmrg   have_perl=yes
77904007ebaSmrgelif test "x$use_perl" = x"no" ; then
78004007ebaSmrg   if test "x$PERL" != "x"; then
78104007ebaSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
78204007ebaSmrg   fi
78304007ebaSmrg   have_perl=no
78404007ebaSmrgelse
78504007ebaSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
78604007ebaSmrgfi
78704007ebaSmrg
78804007ebaSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
78904007ebaSmrg]) # XORG_WITH_PERL
790f29dbc25Smrg
791170d5fdcSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
792f29dbc25Smrg# ----------------
793f29dbc25Smrg# Minimum version: 1.5.0
794170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
795f29dbc25Smrg#
796f29dbc25Smrg# Documentation tools are not always available on all platforms and sometimes
797f29dbc25Smrg# not at the appropriate level. This macro enables a module to test for the
798f29dbc25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
799f29dbc25Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
800170d5fdcSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
801170d5fdcSmrg# --with-asciidoc assumes 'auto'.
802f29dbc25Smrg#
803f29dbc25Smrg# Interface to module:
804f29dbc25Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
805f29dbc25Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
806f29dbc25Smrg#		 returns the path set by the user in the environment
807f29dbc25Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
808f29dbc25Smrg#		  'no' user instructs the module not to use asciidoc
809f29dbc25Smrg#
810f29dbc25Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
811f29dbc25Smrg#
812f29dbc25SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
813f29dbc25SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
814170d5fdcSmrgm4_define([_defopt], m4_default([$2], [auto]))
815f29dbc25SmrgAC_ARG_WITH(asciidoc,
816f29dbc25Smrg	AS_HELP_STRING([--with-asciidoc],
817170d5fdcSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
818170d5fdcSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
819170d5fdcSmrgm4_undefine([_defopt])
820f29dbc25Smrg
821f29dbc25Smrgif test "x$use_asciidoc" = x"auto"; then
822f29dbc25Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
823f29dbc25Smrg   if test "x$ASCIIDOC" = "x"; then
824f29dbc25Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
825f29dbc25Smrg	have_asciidoc=no
826f29dbc25Smrg   else
827f29dbc25Smrg        have_asciidoc=yes
828f29dbc25Smrg   fi
829f29dbc25Smrgelif test "x$use_asciidoc" = x"yes" ; then
830f29dbc25Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
831f29dbc25Smrg   if test "x$ASCIIDOC" = "x"; then
832f29dbc25Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
833f29dbc25Smrg   fi
834f29dbc25Smrg   have_asciidoc=yes
835f29dbc25Smrgelif test "x$use_asciidoc" = x"no" ; then
836f29dbc25Smrg   if test "x$ASCIIDOC" != "x"; then
837f29dbc25Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
838f29dbc25Smrg   fi
839f29dbc25Smrg   have_asciidoc=no
840f29dbc25Smrgelse
841f29dbc25Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
842f29dbc25Smrgfi
843170d5fdcSmrgm4_ifval([$1],
844170d5fdcSmrg[if test "$have_asciidoc" = yes; then
845170d5fdcSmrg    # scrape the asciidoc version
846170d5fdcSmrg    AC_MSG_CHECKING([the asciidoc version])
847170d5fdcSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
848170d5fdcSmrg    AC_MSG_RESULT([$asciidoc_version])
849170d5fdcSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
850170d5fdcSmrg        [if test "x$use_asciidoc" = xauto; then
851170d5fdcSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
852170d5fdcSmrg            have_asciidoc=no
853170d5fdcSmrg        else
854170d5fdcSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
855170d5fdcSmrg        fi])
856170d5fdcSmrgfi])
857f29dbc25SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
858170d5fdcSmrg]) # XORG_WITH_ASCIIDOC
859f29dbc25Smrg
860170d5fdcSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
8617f419768Smrg# -------------------------------------------
862f29dbc25Smrg# Minimum version: 1.5.0
863170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
8647f419768Smrg# Minimum version for optional DOT checking: 1.18.0
865f29dbc25Smrg#
866f29dbc25Smrg# Documentation tools are not always available on all platforms and sometimes
867f29dbc25Smrg# not at the appropriate level. This macro enables a module to test for the
868f29dbc25Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
869f29dbc25Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
870170d5fdcSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
871170d5fdcSmrg# --with-doxygen assumes 'auto'.
872f29dbc25Smrg#
873f29dbc25Smrg# Interface to module:
874f29dbc25Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
875f29dbc25Smrg# DOXYGEN:	 returns the path of the doxygen program found
876f29dbc25Smrg#		 returns the path set by the user in the environment
877f29dbc25Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
878f29dbc25Smrg#		  'no' user instructs the module not to use doxygen
879f29dbc25Smrg#
880f29dbc25Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
881f29dbc25Smrg#
882f29dbc25SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
883f29dbc25SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
8847f419768SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
885170d5fdcSmrgm4_define([_defopt], m4_default([$2], [auto]))
886f29dbc25SmrgAC_ARG_WITH(doxygen,
887f29dbc25Smrg	AS_HELP_STRING([--with-doxygen],
888170d5fdcSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
889170d5fdcSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
890170d5fdcSmrgm4_undefine([_defopt])
891f29dbc25Smrg
892f29dbc25Smrgif test "x$use_doxygen" = x"auto"; then
893f29dbc25Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
894f29dbc25Smrg   if test "x$DOXYGEN" = "x"; then
895f29dbc25Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
896f29dbc25Smrg	have_doxygen=no
897f29dbc25Smrg   else
898f29dbc25Smrg        have_doxygen=yes
899f29dbc25Smrg   fi
900f29dbc25Smrgelif test "x$use_doxygen" = x"yes" ; then
901f29dbc25Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
902f29dbc25Smrg   if test "x$DOXYGEN" = "x"; then
903f29dbc25Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
904f29dbc25Smrg   fi
905f29dbc25Smrg   have_doxygen=yes
906f29dbc25Smrgelif test "x$use_doxygen" = x"no" ; then
907f29dbc25Smrg   if test "x$DOXYGEN" != "x"; then
908f29dbc25Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
909f29dbc25Smrg   fi
910f29dbc25Smrg   have_doxygen=no
911f29dbc25Smrgelse
912f29dbc25Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
913f29dbc25Smrgfi
914170d5fdcSmrgm4_ifval([$1],
915170d5fdcSmrg[if test "$have_doxygen" = yes; then
916170d5fdcSmrg    # scrape the doxygen version
917170d5fdcSmrg    AC_MSG_CHECKING([the doxygen version])
918170d5fdcSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
919170d5fdcSmrg    AC_MSG_RESULT([$doxygen_version])
920170d5fdcSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
921170d5fdcSmrg        [if test "x$use_doxygen" = xauto; then
922170d5fdcSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
923170d5fdcSmrg            have_doxygen=no
924170d5fdcSmrg        else
925170d5fdcSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
926170d5fdcSmrg        fi])
927170d5fdcSmrgfi])
9287f419768Smrg
9297f419768Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
9307f419768Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
9317f419768Smrgdnl 	HAVE_DOT = @HAVE_DOT@
9327f419768SmrgHAVE_DOT=no
9337f419768Smrgif test "x$have_doxygen" = "xyes"; then
9347f419768Smrg  AC_PATH_PROG([DOT], [dot])
9357f419768Smrg    if test "x$DOT" != "x"; then
9367f419768Smrg      HAVE_DOT=yes
9377f419768Smrg    fi
9387f419768Smrgfi
9397f419768Smrg
9407f419768SmrgAC_SUBST([HAVE_DOT])
9417f419768SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
942f29dbc25SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
943170d5fdcSmrg]) # XORG_WITH_DOXYGEN
944170d5fdcSmrg
945170d5fdcSmrg# XORG_WITH_GROFF([DEFAULT])
946170d5fdcSmrg# ----------------
947170d5fdcSmrg# Minimum version: 1.6.0
948170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
949170d5fdcSmrg#
950170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
951170d5fdcSmrg# not at the appropriate level. This macro enables a module to test for the
952170d5fdcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
953170d5fdcSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
954170d5fdcSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
955170d5fdcSmrg# --with-groff assumes 'auto'.
956170d5fdcSmrg#
957170d5fdcSmrg# Interface to module:
958170d5fdcSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
959170d5fdcSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
960170d5fdcSmrg# HAVE_GROFF_MS: the -ms macros package
961170d5fdcSmrg# GROFF:	 returns the path of the groff program found
962170d5fdcSmrg#		 returns the path set by the user in the environment
963170d5fdcSmrg# --with-groff:	 'yes' user instructs the module to use groff
964170d5fdcSmrg#		 'no' user instructs the module not to use groff
965170d5fdcSmrg#
966170d5fdcSmrg# Added in version 1.9.0:
967170d5fdcSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
968170d5fdcSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
969170d5fdcSmrg#		   psselect from the psutils package.
970170d5fdcSmrg#		   the ghostcript package. Refer to the grohtml man pages
971170d5fdcSmrg#
972170d5fdcSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
973170d5fdcSmrg#
974170d5fdcSmrg# OS and distros often splits groff in a basic and full package, the former
975170d5fdcSmrg# having the groff program and the later having devices, fonts and macros
976170d5fdcSmrg# Checking for the groff executable is not enough.
977170d5fdcSmrg#
978170d5fdcSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
979170d5fdcSmrg# unset HAVE_GROFF or GROFF env variables.
980170d5fdcSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
981170d5fdcSmrg#
982170d5fdcSmrgAC_DEFUN([XORG_WITH_GROFF],[
983170d5fdcSmrgAC_ARG_VAR([GROFF], [Path to groff command])
984170d5fdcSmrgm4_define([_defopt], m4_default([$1], [auto]))
985170d5fdcSmrgAC_ARG_WITH(groff,
986170d5fdcSmrg	AS_HELP_STRING([--with-groff],
987170d5fdcSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
988170d5fdcSmrg	   [use_groff=$withval], [use_groff=]_defopt)
989170d5fdcSmrgm4_undefine([_defopt])
990170d5fdcSmrg
991170d5fdcSmrgif test "x$use_groff" = x"auto"; then
992170d5fdcSmrg   AC_PATH_PROG([GROFF], [groff])
993170d5fdcSmrg   if test "x$GROFF" = "x"; then
994170d5fdcSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
995170d5fdcSmrg	have_groff=no
996170d5fdcSmrg   else
997170d5fdcSmrg        have_groff=yes
998170d5fdcSmrg   fi
999170d5fdcSmrgelif test "x$use_groff" = x"yes" ; then
1000170d5fdcSmrg   AC_PATH_PROG([GROFF], [groff])
1001170d5fdcSmrg   if test "x$GROFF" = "x"; then
1002170d5fdcSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1003170d5fdcSmrg   fi
1004170d5fdcSmrg   have_groff=yes
1005170d5fdcSmrgelif test "x$use_groff" = x"no" ; then
1006170d5fdcSmrg   if test "x$GROFF" != "x"; then
1007170d5fdcSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1008170d5fdcSmrg   fi
1009170d5fdcSmrg   have_groff=no
1010170d5fdcSmrgelse
1011170d5fdcSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1012170d5fdcSmrgfi
1013170d5fdcSmrg
1014170d5fdcSmrg# We have groff, test for the presence of the macro packages
1015170d5fdcSmrgif test "x$have_groff" = x"yes"; then
1016170d5fdcSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1017170d5fdcSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1018170d5fdcSmrg        groff_ms_works=yes
1019170d5fdcSmrg    else
1020170d5fdcSmrg        groff_ms_works=no
1021170d5fdcSmrg    fi
1022170d5fdcSmrg    AC_MSG_RESULT([$groff_ms_works])
1023170d5fdcSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1024170d5fdcSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1025170d5fdcSmrg        groff_mm_works=yes
1026170d5fdcSmrg    else
1027170d5fdcSmrg        groff_mm_works=no
1028170d5fdcSmrg    fi
1029170d5fdcSmrg    AC_MSG_RESULT([$groff_mm_works])
1030170d5fdcSmrgfi
1031170d5fdcSmrg
1032170d5fdcSmrg# We have groff, test for HTML dependencies, one command per package
1033170d5fdcSmrgif test "x$have_groff" = x"yes"; then
1034170d5fdcSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1035170d5fdcSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1036170d5fdcSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1037170d5fdcSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1038170d5fdcSmrg      have_groff_html=yes
1039170d5fdcSmrg   else
1040170d5fdcSmrg      have_groff_html=no
1041170d5fdcSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1042170d5fdcSmrg   fi
1043170d5fdcSmrgfi
1044170d5fdcSmrg
1045170d5fdcSmrg# Set Automake conditionals for Makefiles
1046170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1047170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1048170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1049170d5fdcSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1050170d5fdcSmrg]) # XORG_WITH_GROFF
1051170d5fdcSmrg
105204007ebaSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
105304007ebaSmrg# ---------------------------------------
1054170d5fdcSmrg# Minimum version: 1.6.0
1055170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
105604007ebaSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1057170d5fdcSmrg#
1058170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1059170d5fdcSmrg# not at the appropriate level. This macro enables a module to test for the
1060170d5fdcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1061170d5fdcSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1062170d5fdcSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1063170d5fdcSmrg# --with-fop assumes 'auto'.
1064170d5fdcSmrg#
1065170d5fdcSmrg# Interface to module:
1066170d5fdcSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1067170d5fdcSmrg# FOP:	 	returns the path of the fop program found
1068170d5fdcSmrg#		returns the path set by the user in the environment
1069170d5fdcSmrg# --with-fop: 	'yes' user instructs the module to use fop
1070170d5fdcSmrg#		'no' user instructs the module not to use fop
1071170d5fdcSmrg#
1072170d5fdcSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1073170d5fdcSmrg#
1074170d5fdcSmrgAC_DEFUN([XORG_WITH_FOP],[
1075170d5fdcSmrgAC_ARG_VAR([FOP], [Path to fop command])
107604007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
1077170d5fdcSmrgAC_ARG_WITH(fop,
1078170d5fdcSmrg	AS_HELP_STRING([--with-fop],
1079170d5fdcSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1080170d5fdcSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1081170d5fdcSmrgm4_undefine([_defopt])
1082170d5fdcSmrg
1083170d5fdcSmrgif test "x$use_fop" = x"auto"; then
1084170d5fdcSmrg   AC_PATH_PROG([FOP], [fop])
1085170d5fdcSmrg   if test "x$FOP" = "x"; then
1086170d5fdcSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1087170d5fdcSmrg	have_fop=no
1088170d5fdcSmrg   else
1089170d5fdcSmrg        have_fop=yes
1090170d5fdcSmrg   fi
1091170d5fdcSmrgelif test "x$use_fop" = x"yes" ; then
1092170d5fdcSmrg   AC_PATH_PROG([FOP], [fop])
1093170d5fdcSmrg   if test "x$FOP" = "x"; then
1094170d5fdcSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1095170d5fdcSmrg   fi
1096170d5fdcSmrg   have_fop=yes
1097170d5fdcSmrgelif test "x$use_fop" = x"no" ; then
1098170d5fdcSmrg   if test "x$FOP" != "x"; then
1099170d5fdcSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1100170d5fdcSmrg   fi
1101170d5fdcSmrg   have_fop=no
1102170d5fdcSmrgelse
1103170d5fdcSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1104170d5fdcSmrgfi
110504007ebaSmrg
110604007ebaSmrg# Test for a minimum version of fop, if provided.
110704007ebaSmrgm4_ifval([$1],
110804007ebaSmrg[if test "$have_fop" = yes; then
110904007ebaSmrg    # scrape the fop version
111004007ebaSmrg    AC_MSG_CHECKING([for fop minimum version])
111104007ebaSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
111204007ebaSmrg    AC_MSG_RESULT([$fop_version])
111304007ebaSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
111404007ebaSmrg        [if test "x$use_fop" = xauto; then
111504007ebaSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
111604007ebaSmrg            have_fop=no
111704007ebaSmrg        else
111804007ebaSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
111904007ebaSmrg        fi])
112004007ebaSmrgfi])
1121170d5fdcSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1122170d5fdcSmrg]) # XORG_WITH_FOP
1123170d5fdcSmrg
11247f419768Smrg# XORG_WITH_M4([MIN-VERSION])
11257f419768Smrg# ---------------------------
11267f419768Smrg# Minimum version: 1.19.0
11277f419768Smrg#
11287f419768Smrg# This macro attempts to locate an m4 macro processor which supports
11297f419768Smrg# -I option and is only useful for modules relying on M4 in order to
11307f419768Smrg# expand macros in source code files.
11317f419768Smrg#
11327f419768Smrg# Interface to module:
11337f419768Smrg# M4:	 	returns the path of the m4 program found
11347f419768Smrg#		returns the path set by the user in the environment
11357f419768Smrg#
11367f419768SmrgAC_DEFUN([XORG_WITH_M4], [
11377f419768SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
11387f419768Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
11397f419768Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
11407f419768Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
11417f419768Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
11427f419768Smrg   [$PATH:/usr/gnu/bin])])
11437f419768Smrg
11447f419768SmrgAC_SUBST([M4], [$ac_cv_path_M4])
11457f419768Smrg]) # XORG_WITH_M4
11467f419768Smrg
1147170d5fdcSmrg# XORG_WITH_PS2PDF([DEFAULT])
1148170d5fdcSmrg# ----------------
1149170d5fdcSmrg# Minimum version: 1.6.0
1150170d5fdcSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1151170d5fdcSmrg#
1152170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1153170d5fdcSmrg# not at the appropriate level. This macro enables a module to test for the
1154170d5fdcSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1155170d5fdcSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1156170d5fdcSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1157170d5fdcSmrg# --with-ps2pdf assumes 'auto'.
1158170d5fdcSmrg#
1159170d5fdcSmrg# Interface to module:
1160170d5fdcSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1161170d5fdcSmrg# PS2PDF:	returns the path of the ps2pdf program found
1162170d5fdcSmrg#		returns the path set by the user in the environment
1163170d5fdcSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1164170d5fdcSmrg#		 'no' user instructs the module not to use ps2pdf
1165170d5fdcSmrg#
1166170d5fdcSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1167170d5fdcSmrg#
1168170d5fdcSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1169170d5fdcSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1170170d5fdcSmrgm4_define([_defopt], m4_default([$1], [auto]))
1171170d5fdcSmrgAC_ARG_WITH(ps2pdf,
1172170d5fdcSmrg	AS_HELP_STRING([--with-ps2pdf],
1173170d5fdcSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1174170d5fdcSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1175170d5fdcSmrgm4_undefine([_defopt])
1176170d5fdcSmrg
1177170d5fdcSmrgif test "x$use_ps2pdf" = x"auto"; then
1178170d5fdcSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1179170d5fdcSmrg   if test "x$PS2PDF" = "x"; then
1180170d5fdcSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1181170d5fdcSmrg	have_ps2pdf=no
1182170d5fdcSmrg   else
1183170d5fdcSmrg        have_ps2pdf=yes
1184170d5fdcSmrg   fi
1185170d5fdcSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1186170d5fdcSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1187170d5fdcSmrg   if test "x$PS2PDF" = "x"; then
1188170d5fdcSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1189170d5fdcSmrg   fi
1190170d5fdcSmrg   have_ps2pdf=yes
1191170d5fdcSmrgelif test "x$use_ps2pdf" = x"no" ; then
1192170d5fdcSmrg   if test "x$PS2PDF" != "x"; then
1193170d5fdcSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1194170d5fdcSmrg   fi
1195170d5fdcSmrg   have_ps2pdf=no
1196170d5fdcSmrgelse
1197170d5fdcSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1198170d5fdcSmrgfi
1199170d5fdcSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1200170d5fdcSmrg]) # XORG_WITH_PS2PDF
1201170d5fdcSmrg
1202170d5fdcSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1203170d5fdcSmrg# ----------------
1204170d5fdcSmrg# Minimum version: 1.6.0
1205170d5fdcSmrg#
1206170d5fdcSmrg# Documentation tools are not always available on all platforms and sometimes
1207170d5fdcSmrg# not at the appropriate level. This macro enables a builder to skip all
1208170d5fdcSmrg# documentation targets except traditional man pages.
1209170d5fdcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1210170d5fdcSmrg# maximum flexibilty in controlling documentation building.
1211170d5fdcSmrg# Refer to:
1212170d5fdcSmrg# XORG_WITH_XMLTO         --with-xmlto
1213170d5fdcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1214170d5fdcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1215170d5fdcSmrg# XORG_WITH_FOP           --with-fop
1216170d5fdcSmrg# XORG_WITH_GROFF         --with-groff
1217170d5fdcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1218170d5fdcSmrg#
1219170d5fdcSmrg# Interface to module:
1220170d5fdcSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1221170d5fdcSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1222170d5fdcSmrg#		 'no' user instructs the module not to generate docs
1223170d5fdcSmrg# parm1:	specify the default value, yes or no.
1224170d5fdcSmrg#
1225170d5fdcSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
122604007ebaSmrgm4_define([docs_default], m4_default([$1], [yes]))
1227170d5fdcSmrgAC_ARG_ENABLE(docs,
1228170d5fdcSmrg	AS_HELP_STRING([--enable-docs],
122904007ebaSmrg	   [Enable building the documentation (default: ]docs_default[)]),
123004007ebaSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
123104007ebaSmrgm4_undefine([docs_default])
1232170d5fdcSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1233170d5fdcSmrgAC_MSG_CHECKING([whether to build documentation])
1234170d5fdcSmrgAC_MSG_RESULT([$build_docs])
1235170d5fdcSmrg]) # XORG_ENABLE_DOCS
1236170d5fdcSmrg
1237170d5fdcSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1238170d5fdcSmrg# ----------------
1239170d5fdcSmrg# Minimum version: 1.6.0
1240170d5fdcSmrg#
1241170d5fdcSmrg# This macro enables a builder to skip all developer documentation.
1242170d5fdcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1243170d5fdcSmrg# maximum flexibilty in controlling documentation building.
1244170d5fdcSmrg# Refer to:
1245170d5fdcSmrg# XORG_WITH_XMLTO         --with-xmlto
1246170d5fdcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1247170d5fdcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1248170d5fdcSmrg# XORG_WITH_FOP           --with-fop
1249170d5fdcSmrg# XORG_WITH_GROFF         --with-groff
1250170d5fdcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1251170d5fdcSmrg#
1252170d5fdcSmrg# Interface to module:
1253170d5fdcSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1254170d5fdcSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1255170d5fdcSmrg#			'no' user instructs the module not to generate developer docs
1256170d5fdcSmrg# parm1:		specify the default value, yes or no.
1257170d5fdcSmrg#
1258170d5fdcSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1259170d5fdcSmrgm4_define([devel_default], m4_default([$1], [yes]))
1260170d5fdcSmrgAC_ARG_ENABLE(devel-docs,
1261170d5fdcSmrg	AS_HELP_STRING([--enable-devel-docs],
1262170d5fdcSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1263170d5fdcSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1264170d5fdcSmrgm4_undefine([devel_default])
1265170d5fdcSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1266170d5fdcSmrgAC_MSG_CHECKING([whether to build developer documentation])
1267170d5fdcSmrgAC_MSG_RESULT([$build_devel_docs])
1268170d5fdcSmrg]) # XORG_ENABLE_DEVEL_DOCS
1269170d5fdcSmrg
1270170d5fdcSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1271170d5fdcSmrg# ----------------
1272170d5fdcSmrg# Minimum version: 1.6.0
1273170d5fdcSmrg#
1274170d5fdcSmrg# This macro enables a builder to skip all functional specification targets.
1275170d5fdcSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1276170d5fdcSmrg# maximum flexibilty in controlling documentation building.
1277170d5fdcSmrg# Refer to:
1278170d5fdcSmrg# XORG_WITH_XMLTO         --with-xmlto
1279170d5fdcSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1280170d5fdcSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1281170d5fdcSmrg# XORG_WITH_FOP           --with-fop
1282170d5fdcSmrg# XORG_WITH_GROFF         --with-groff
1283170d5fdcSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1284170d5fdcSmrg#
1285170d5fdcSmrg# Interface to module:
1286170d5fdcSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1287170d5fdcSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1288170d5fdcSmrg#			'no' user instructs the module not to generate specs
1289170d5fdcSmrg# parm1:		specify the default value, yes or no.
1290170d5fdcSmrg#
1291170d5fdcSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1292170d5fdcSmrgm4_define([spec_default], m4_default([$1], [yes]))
1293170d5fdcSmrgAC_ARG_ENABLE(specs,
1294170d5fdcSmrg	AS_HELP_STRING([--enable-specs],
1295170d5fdcSmrg	   [Enable building the specs (default: ]spec_default[)]),
1296170d5fdcSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1297170d5fdcSmrgm4_undefine([spec_default])
1298170d5fdcSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1299170d5fdcSmrgAC_MSG_CHECKING([whether to build functional specifications])
1300170d5fdcSmrgAC_MSG_RESULT([$build_specs])
1301170d5fdcSmrg]) # XORG_ENABLE_SPECS
1302f29dbc25Smrg
130304007ebaSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
130404007ebaSmrg# ----------------------------------------------
130504007ebaSmrg# Minimum version: 1.13.0
130604007ebaSmrg#
130704007ebaSmrg# This macro enables a builder to enable/disable unit testing
130804007ebaSmrg# It makes no assumption about the test cases implementation
130904007ebaSmrg# Test cases may or may not use Automake "Support for test suites"
131004007ebaSmrg# They may or may not use the software utility library GLib
131104007ebaSmrg#
131204007ebaSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
131304007ebaSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
131404007ebaSmrg# The variable enable_unit_tests is used by other macros in this file.
131504007ebaSmrg#
131604007ebaSmrg# Interface to module:
131704007ebaSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
131804007ebaSmrg# enable_unit_tests:    used in configure.ac for additional configuration
131904007ebaSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
132004007ebaSmrg#			'no' user instructs the module not to build tests
132104007ebaSmrg# parm1:		specify the default value, yes or no.
132204007ebaSmrg#
132304007ebaSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
132404007ebaSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
132504007ebaSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
132604007ebaSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
132704007ebaSmrgm4_define([_defopt], m4_default([$1], [auto]))
132804007ebaSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
132904007ebaSmrg	[Enable building unit test cases (default: ]_defopt[)]),
133004007ebaSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
133104007ebaSmrgm4_undefine([_defopt])
133204007ebaSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
133304007ebaSmrgAC_MSG_CHECKING([whether to build unit test cases])
133404007ebaSmrgAC_MSG_RESULT([$enable_unit_tests])
133504007ebaSmrg]) # XORG_ENABLE_UNIT_TESTS
133604007ebaSmrg
133704007ebaSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
133804007ebaSmrg# ------------------------------------------------------
133904007ebaSmrg# Minimum version: 1.17.0
134004007ebaSmrg#
134104007ebaSmrg# This macro enables a builder to enable/disable integration testing
134204007ebaSmrg# It makes no assumption about the test cases' implementation
134304007ebaSmrg# Test cases may or may not use Automake "Support for test suites"
134404007ebaSmrg#
134504007ebaSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
134604007ebaSmrg# usually requires less dependencies and may be built and run under less
134704007ebaSmrg# stringent environments than integration tests.
134804007ebaSmrg#
134904007ebaSmrg# Interface to module:
135004007ebaSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
135104007ebaSmrg# enable_integration_tests:   used in configure.ac for additional configuration
135204007ebaSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
135304007ebaSmrg#                             'no' user instructs the module not to build tests
135404007ebaSmrg# parm1:                      specify the default value, yes or no.
135504007ebaSmrg#
135604007ebaSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
135704007ebaSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
135804007ebaSmrgm4_define([_defopt], m4_default([$1], [auto]))
135904007ebaSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
136004007ebaSmrg	[Enable building integration test cases (default: ]_defopt[)]),
136104007ebaSmrg	[enable_integration_tests=$enableval],
136204007ebaSmrg	[enable_integration_tests=]_defopt)
136304007ebaSmrgm4_undefine([_defopt])
136404007ebaSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
136504007ebaSmrg	[test "x$enable_integration_tests" != xno])
136604007ebaSmrgAC_MSG_CHECKING([whether to build unit test cases])
136704007ebaSmrgAC_MSG_RESULT([$enable_integration_tests])
136804007ebaSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
136904007ebaSmrg
137004007ebaSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
137104007ebaSmrg# ----------------------------------------
137204007ebaSmrg# Minimum version: 1.13.0
137304007ebaSmrg#
137404007ebaSmrg# GLib is a library which provides advanced data structures and functions.
137504007ebaSmrg# This macro enables a module to test for the presence of Glib.
137604007ebaSmrg#
137704007ebaSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
137804007ebaSmrg# Otherwise the value of $enable_unit_tests is blank.
137904007ebaSmrg#
138004007ebaSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
138104007ebaSmrg# test support usually requires less dependencies and may be built and run under
138204007ebaSmrg# less stringent environments than integration tests.
138304007ebaSmrg#
138404007ebaSmrg# Interface to module:
138504007ebaSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
138604007ebaSmrg# with_glib: used in configure.ac to know if GLib has been found
138704007ebaSmrg# --with-glib:	'yes' user instructs the module to use glib
138804007ebaSmrg#		'no' user instructs the module not to use glib
138904007ebaSmrg#
139004007ebaSmrgAC_DEFUN([XORG_WITH_GLIB],[
139104007ebaSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
139204007ebaSmrgm4_define([_defopt], m4_default([$2], [auto]))
139304007ebaSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
139404007ebaSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
139504007ebaSmrg	[with_glib=$withval], [with_glib=]_defopt)
139604007ebaSmrgm4_undefine([_defopt])
139704007ebaSmrg
139804007ebaSmrghave_glib=no
139904007ebaSmrg# Do not probe GLib if user explicitly disabled unit testing
140004007ebaSmrgif test "x$enable_unit_tests" != x"no"; then
140104007ebaSmrg  # Do not probe GLib if user explicitly disabled it
140204007ebaSmrg  if test "x$with_glib" != x"no"; then
140304007ebaSmrg    m4_ifval(
140404007ebaSmrg      [$1],
140504007ebaSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
140604007ebaSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
140704007ebaSmrg    )
140804007ebaSmrg  fi
140904007ebaSmrgfi
141004007ebaSmrg
141104007ebaSmrg# Not having GLib when unit testing has been explicitly requested is an error
141204007ebaSmrgif test "x$enable_unit_tests" = x"yes"; then
141304007ebaSmrg  if test "x$have_glib" = x"no"; then
141404007ebaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
141504007ebaSmrg  fi
141604007ebaSmrgfi
141704007ebaSmrg
141804007ebaSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
141904007ebaSmrgif test "x$enable_unit_tests" = x"no"; then
142004007ebaSmrg  if test "x$with_glib" = x"yes"; then
142104007ebaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
142204007ebaSmrg  fi
142304007ebaSmrgfi
142404007ebaSmrg
142504007ebaSmrg# Not having GLib when it has been explicitly requested is an error
142604007ebaSmrgif test "x$with_glib" = x"yes"; then
142704007ebaSmrg  if test "x$have_glib" = x"no"; then
142804007ebaSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
142904007ebaSmrg  fi
143004007ebaSmrgfi
143104007ebaSmrg
143204007ebaSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
143304007ebaSmrg]) # XORG_WITH_GLIB
143404007ebaSmrg
143504007ebaSmrg# XORG_LD_WRAP([required|optional])
143604007ebaSmrg# ---------------------------------
143704007ebaSmrg# Minimum version: 1.13.0
143804007ebaSmrg#
143904007ebaSmrg# Check if linker supports -wrap, passed via compiler flags
144004007ebaSmrg#
144104007ebaSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
144204007ebaSmrg# Otherwise the value of $enable_unit_tests is blank.
144304007ebaSmrg#
144404007ebaSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
144504007ebaSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
144604007ebaSmrg# available, an argument of "optional" allows use when some unit tests require
144704007ebaSmrg# ld -wrap and others do not.
144804007ebaSmrg#
144904007ebaSmrgAC_DEFUN([XORG_LD_WRAP],[
145004007ebaSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
145104007ebaSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
145204007ebaSmrg                      void __wrap_exit(int status) { return; }],
145304007ebaSmrg                     [exit(0);])])
145404007ebaSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
145504007ebaSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
145604007ebaSmrg  if test "x$have_ld_wrap" = x"no"; then
145704007ebaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
145804007ebaSmrg  fi
145904007ebaSmrgfi
146004007ebaSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
146104007ebaSmrg#
146204007ebaSmrg]) # XORG_LD_WRAP
146304007ebaSmrg
146404007ebaSmrg# XORG_CHECK_LINKER_FLAGS
146504007ebaSmrg# -----------------------
146604007ebaSmrg# SYNOPSIS
146704007ebaSmrg#
146804007ebaSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
146904007ebaSmrg#
147004007ebaSmrg# DESCRIPTION
147104007ebaSmrg#
147204007ebaSmrg#   Check whether the given linker FLAGS work with the current language's
147304007ebaSmrg#   linker, or whether they give an error.
147404007ebaSmrg#
147504007ebaSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
147604007ebaSmrg#   success/failure.
147704007ebaSmrg#
147804007ebaSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
147904007ebaSmrg#
148004007ebaSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
148104007ebaSmrg#
148204007ebaSmrg# LICENSE
148304007ebaSmrg#
148404007ebaSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
148504007ebaSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
148604007ebaSmrg#   Copyright (c) 2009 Matteo Frigo
148704007ebaSmrg#
148804007ebaSmrg#   This program is free software: you can redistribute it and/or modify it
148904007ebaSmrg#   under the terms of the GNU General Public License as published by the
149004007ebaSmrg#   Free Software Foundation, either version 3 of the License, or (at your
149104007ebaSmrg#   option) any later version.
149204007ebaSmrg#
149304007ebaSmrg#   This program is distributed in the hope that it will be useful, but
149404007ebaSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
149504007ebaSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
149604007ebaSmrg#   Public License for more details.
149704007ebaSmrg#
149804007ebaSmrg#   You should have received a copy of the GNU General Public License along
149904007ebaSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
150004007ebaSmrg#
150104007ebaSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
150204007ebaSmrg#   gives unlimited permission to copy, distribute and modify the configure
150304007ebaSmrg#   scripts that are the output of Autoconf when processing the Macro. You
150404007ebaSmrg#   need not follow the terms of the GNU General Public License when using
150504007ebaSmrg#   or distributing such scripts, even though portions of the text of the
150604007ebaSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
150704007ebaSmrg#   all other use of the material that constitutes the Autoconf Macro.
150804007ebaSmrg#
150904007ebaSmrg#   This special exception to the GPL applies to versions of the Autoconf
151004007ebaSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
151104007ebaSmrg#   modified version of the Autoconf Macro, you may extend this special
151204007ebaSmrg#   exception to the GPL to apply to your modified version as well.#
151304007ebaSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
151404007ebaSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
151504007ebaSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
151604007ebaSmrgAS_LITERAL_IF([$1],
151704007ebaSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
151804007ebaSmrg      ax_save_FLAGS=$LDFLAGS
151904007ebaSmrg      LDFLAGS="$1"
152004007ebaSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
152104007ebaSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
152204007ebaSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
152304007ebaSmrg      LDFLAGS=$ax_save_FLAGS])],
152404007ebaSmrg  [ax_save_FLAGS=$LDFLAGS
152504007ebaSmrg   LDFLAGS="$1"
152604007ebaSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
152704007ebaSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
152804007ebaSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
152904007ebaSmrg   LDFLAGS=$ax_save_FLAGS])
153004007ebaSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
153104007ebaSmrgAC_MSG_RESULT($xorg_check_linker_flags)
153204007ebaSmrgif test "x$xorg_check_linker_flags" = xyes; then
153304007ebaSmrg	m4_default([$2], :)
153404007ebaSmrgelse
153504007ebaSmrg	m4_default([$3], :)
153604007ebaSmrgfi
153704007ebaSmrg]) # XORG_CHECK_LINKER_FLAGS
153804007ebaSmrg
153904007ebaSmrg# XORG_MEMORY_CHECK_FLAGS
154004007ebaSmrg# -----------------------
154104007ebaSmrg# Minimum version: 1.16.0
154204007ebaSmrg#
154304007ebaSmrg# This macro attempts to find appropriate memory checking functionality
154404007ebaSmrg# for various platforms which unit testing code may use to catch various
154504007ebaSmrg# forms of memory allocation and access errors in testing.
154604007ebaSmrg#
154704007ebaSmrg# Interface to module:
154804007ebaSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
154904007ebaSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
155004007ebaSmrg#
155104007ebaSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
155204007ebaSmrg#
155304007ebaSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
155404007ebaSmrg
155504007ebaSmrgAC_REQUIRE([AC_CANONICAL_HOST])
155604007ebaSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
155704007ebaSmrg           [Environment variables to enable memory checking in tests])
155804007ebaSmrg
155904007ebaSmrg# Check for different types of support on different platforms
156004007ebaSmrgcase $host_os in
156104007ebaSmrg    solaris*)
156204007ebaSmrg        AC_CHECK_LIB([umem], [umem_alloc],
156304007ebaSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
156404007ebaSmrg        ;;
156504007ebaSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
156604007ebaSmrg        # both directly and inverted, so should not be 0 or 255.
156704007ebaSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
156804007ebaSmrg        ;;
156904007ebaSmrg    darwin*)
157004007ebaSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
157104007ebaSmrg        ;;
157204007ebaSmrg    *bsd*)
157304007ebaSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
157404007ebaSmrg        ;;
157504007ebaSmrgesac
157604007ebaSmrg
157704007ebaSmrg# User supplied flags override default flags
157804007ebaSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
157904007ebaSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
158004007ebaSmrgfi
158104007ebaSmrg
158204007ebaSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
158304007ebaSmrg]) # XORG_WITH_LINT
158404007ebaSmrg
1585f29dbc25Smrg# XORG_CHECK_MALLOC_ZERO
1586f29dbc25Smrg# ----------------------
1587f29dbc25Smrg# Minimum version: 1.0.0
1588f29dbc25Smrg#
1589f29dbc25Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1590f29dbc25Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1591f29dbc25Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1592f29dbc25SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1593f29dbc25SmrgAC_ARG_ENABLE(malloc0returnsnull,
1594f29dbc25Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1595f29dbc25Smrg		       [malloc(0) returns NULL (default: auto)]),
1596f29dbc25Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1597f29dbc25Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1598f29dbc25Smrg
1599f29dbc25SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1600f29dbc25Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
16017f419768SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
16027f419768Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
160304007ebaSmrg#include <stdlib.h>
160404007ebaSmrg],[
1605f29dbc25Smrg    char *m0, *r0, *c0, *p;
1606f29dbc25Smrg    m0 = malloc(0);
1607f29dbc25Smrg    p = malloc(10);
1608f29dbc25Smrg    r0 = realloc(p,0);
160904007ebaSmrg    c0 = calloc(0,10);
161004007ebaSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
161104007ebaSmrg])],
16127f419768Smrg		[xorg_cv_malloc0_returns_null=yes],
16137f419768Smrg		[xorg_cv_malloc0_returns_null=no])])
16147f419768SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1615f29dbc25Smrgfi
1616f29dbc25SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1617f29dbc25Smrg
1618f29dbc25Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1619f29dbc25Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1620f29dbc25Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1621f29dbc25Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1622f29dbc25Smrgelse
1623f29dbc25Smrg	MALLOC_ZERO_CFLAGS=""
1624f29dbc25Smrg	XMALLOC_ZERO_CFLAGS=""
1625f29dbc25Smrg	XTMALLOC_ZERO_CFLAGS=""
1626f29dbc25Smrgfi
1627f29dbc25Smrg
1628f29dbc25SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1629f29dbc25SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1630f29dbc25SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1631f29dbc25Smrg]) # XORG_CHECK_MALLOC_ZERO
1632f29dbc25Smrg
1633f29dbc25Smrg# XORG_WITH_LINT()
1634f29dbc25Smrg# ----------------
1635f29dbc25Smrg# Minimum version: 1.1.0
1636f29dbc25Smrg#
1637170d5fdcSmrg# This macro enables the use of a tool that flags some suspicious and
1638170d5fdcSmrg# non-portable constructs (likely to be bugs) in C language source code.
1639170d5fdcSmrg# It will attempt to locate the tool and use appropriate options.
1640170d5fdcSmrg# There are various lint type tools on different platforms.
1641170d5fdcSmrg#
1642170d5fdcSmrg# Interface to module:
1643170d5fdcSmrg# LINT:		returns the path to the tool found on the platform
1644170d5fdcSmrg#		or the value set to LINT on the configure cmd line
1645170d5fdcSmrg#		also an Automake conditional
1646170d5fdcSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1647170d5fdcSmrg#
1648170d5fdcSmrg# --with-lint:	'yes' user instructs the module to use lint
1649170d5fdcSmrg#		'no' user instructs the module not to use lint (default)
1650170d5fdcSmrg#
1651170d5fdcSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1652170d5fdcSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1653f29dbc25Smrg#
1654f29dbc25SmrgAC_DEFUN([XORG_WITH_LINT],[
1655f29dbc25Smrg
1656170d5fdcSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1657170d5fdcSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1658f29dbc25SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1659f29dbc25Smrg		[Use a lint-style source code checker (default: disabled)])],
1660f29dbc25Smrg		[use_lint=$withval], [use_lint=no])
1661170d5fdcSmrg
1662170d5fdcSmrg# Obtain platform specific info like program name and options
1663170d5fdcSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1664170d5fdcSmrgcase $host_os in
1665170d5fdcSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1666170d5fdcSmrg	lint_name=splint
1667170d5fdcSmrg	lint_options="-badflag"
1668170d5fdcSmrg	;;
1669170d5fdcSmrg  *freebsd* | *netbsd*)
1670170d5fdcSmrg	lint_name=lint
1671170d5fdcSmrg	lint_options="-u -b"
1672170d5fdcSmrg	;;
1673170d5fdcSmrg  *solaris*)
1674170d5fdcSmrg	lint_name=lint
1675170d5fdcSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1676170d5fdcSmrg	;;
1677170d5fdcSmrgesac
1678170d5fdcSmrg
1679170d5fdcSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1680170d5fdcSmrgif test "x$use_lint" = x"yes" ; then
1681170d5fdcSmrg   AC_PATH_PROG([LINT], [$lint_name])
1682170d5fdcSmrg   if test "x$LINT" = "x"; then
1683170d5fdcSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1684170d5fdcSmrg   fi
1685170d5fdcSmrgelif test "x$use_lint" = x"no" ; then
1686170d5fdcSmrg   if test "x$LINT" != "x"; then
1687170d5fdcSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1688170d5fdcSmrg   fi
1689f29dbc25Smrgelse
1690170d5fdcSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1691f29dbc25Smrgfi
1692170d5fdcSmrg
1693170d5fdcSmrg# User supplied flags override default flags
1694170d5fdcSmrgif test "x$LINT_FLAGS" != "x"; then
1695170d5fdcSmrg   lint_options=$LINT_FLAGS
1696f29dbc25Smrgfi
1697f29dbc25Smrg
1698170d5fdcSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1699170d5fdcSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1700f29dbc25Smrg
1701f29dbc25Smrg]) # XORG_WITH_LINT
1702f29dbc25Smrg
1703f29dbc25Smrg# XORG_LINT_LIBRARY(LIBNAME)
1704f29dbc25Smrg# --------------------------
1705f29dbc25Smrg# Minimum version: 1.1.0
1706f29dbc25Smrg#
1707f29dbc25Smrg# Sets up flags for building lint libraries for checking programs that call
1708f29dbc25Smrg# functions in the library.
1709f29dbc25Smrg#
1710170d5fdcSmrg# Interface to module:
1711170d5fdcSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1712170d5fdcSmrg# MAKE_LINT_LIB		- Automake conditional
1713170d5fdcSmrg#
1714170d5fdcSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1715170d5fdcSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1716f29dbc25Smrg
1717f29dbc25SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1718f29dbc25SmrgAC_REQUIRE([XORG_WITH_LINT])
1719f29dbc25SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1720f29dbc25Smrg	[Create lint library (default: disabled)])],
1721f29dbc25Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1722170d5fdcSmrg
1723170d5fdcSmrgif test "x$make_lint_lib" = x"yes" ; then
1724170d5fdcSmrg   LINTLIB=llib-l$1.ln
1725170d5fdcSmrg   if test "x$LINT" = "x"; then
1726170d5fdcSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1727170d5fdcSmrg   fi
1728170d5fdcSmrgelif test "x$make_lint_lib" != x"no" ; then
1729170d5fdcSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1730f29dbc25Smrgfi
1731170d5fdcSmrg
1732f29dbc25SmrgAC_SUBST(LINTLIB)
1733f29dbc25SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1734f29dbc25Smrg
1735f29dbc25Smrg]) # XORG_LINT_LIBRARY
1736f29dbc25Smrg
173704007ebaSmrg# XORG_COMPILER_BRAND
173804007ebaSmrg# -------------------
173904007ebaSmrg# Minimum version: 1.14.0
174004007ebaSmrg#
174104007ebaSmrg# Checks for various brands of compilers and sets flags as appropriate:
174204007ebaSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
174304007ebaSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
174404007ebaSmrg#   clang compiler - sets CLANGCC to "yes"
174504007ebaSmrg#   Intel compiler - sets INTELCC to "yes"
174604007ebaSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
174704007ebaSmrg#
174804007ebaSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
174904007ebaSmrgAC_LANG_CASE(
175004007ebaSmrg	[C], [
175104007ebaSmrg		AC_REQUIRE([AC_PROG_CC_C99])
175204007ebaSmrg	],
175304007ebaSmrg	[C++], [
175404007ebaSmrg		AC_REQUIRE([AC_PROG_CXX])
175504007ebaSmrg	]
175604007ebaSmrg)
175704007ebaSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
175804007ebaSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
175904007ebaSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
176004007ebaSmrg]) # XORG_COMPILER_BRAND
176104007ebaSmrg
176204007ebaSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
176304007ebaSmrg# ---------------
176404007ebaSmrg# Minimum version: 1.16.0
176504007ebaSmrg#
176604007ebaSmrg# Test if the compiler works when passed the given flag as a command line argument.
176704007ebaSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
176804007ebaSmrg# next flag in the list until there are no more options.
176904007ebaSmrg#
177004007ebaSmrg# Note that this does not guarantee that the compiler supports the flag as some
177104007ebaSmrg# compilers will simply ignore arguments that they do not understand, but we do
177204007ebaSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
177304007ebaSmrg# -Werror=unused-command-line-argument
177404007ebaSmrg#
177504007ebaSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
177604007ebaSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
177704007ebaSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
177804007ebaSmrg
177904007ebaSmrgAC_LANG_COMPILER_REQUIRE
178004007ebaSmrg
178104007ebaSmrgAC_LANG_CASE(
178204007ebaSmrg	[C], [
178304007ebaSmrg		AC_REQUIRE([AC_PROG_CC_C99])
178404007ebaSmrg		define([PREFIX], [C])
178504007ebaSmrg		define([CACHE_PREFIX], [cc])
178604007ebaSmrg		define([COMPILER], [$CC])
178704007ebaSmrg	],
178804007ebaSmrg	[C++], [
178904007ebaSmrg		define([PREFIX], [CXX])
179004007ebaSmrg		define([CACHE_PREFIX], [cxx])
179104007ebaSmrg		define([COMPILER], [$CXX])
179204007ebaSmrg	]
179304007ebaSmrg)
179404007ebaSmrg
179504007ebaSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
179604007ebaSmrg
179704007ebaSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
179804007ebaSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
179904007ebaSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
180004007ebaSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
180104007ebaSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
180204007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
180304007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
180404007ebaSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
180504007ebaSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
180604007ebaSmrgfi
180704007ebaSmrg
180804007ebaSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
180904007ebaSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
181004007ebaSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
181104007ebaSmrg	fi
181204007ebaSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
181304007ebaSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
181404007ebaSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
181504007ebaSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
181604007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
181704007ebaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
181804007ebaSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
181904007ebaSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
182004007ebaSmrgfi
182104007ebaSmrg
182204007ebaSmrgfound="no"
182304007ebaSmrgm4_foreach([flag], m4_cdr($@), [
182404007ebaSmrg	if test $found = "no" ; then
182504007ebaSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
182604007ebaSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
182704007ebaSmrg		fi
182804007ebaSmrg
182904007ebaSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
183004007ebaSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
183104007ebaSmrg		fi
183204007ebaSmrg
183304007ebaSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
183404007ebaSmrg
183504007ebaSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
183604007ebaSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
183704007ebaSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
183804007ebaSmrg		AC_CACHE_VAL($cacheid,
183904007ebaSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
184004007ebaSmrg					     [eval $cacheid=yes],
184104007ebaSmrg					     [eval $cacheid=no])])
184204007ebaSmrg
184304007ebaSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
184404007ebaSmrg
184504007ebaSmrg		eval supported=\$$cacheid
184604007ebaSmrg		AC_MSG_RESULT([$supported])
184704007ebaSmrg		if test "$supported" = "yes" ; then
184804007ebaSmrg			$1="$$1 ]flag["
184904007ebaSmrg			found="yes"
185004007ebaSmrg		fi
185104007ebaSmrg	fi
185204007ebaSmrg])
185304007ebaSmrg]) # XORG_TESTSET_CFLAG
185404007ebaSmrg
185504007ebaSmrg# XORG_COMPILER_FLAGS
185604007ebaSmrg# ---------------
185704007ebaSmrg# Minimum version: 1.16.0
185804007ebaSmrg#
185904007ebaSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
186004007ebaSmrg# arguments supported by the selected compiler which do NOT alter the generated
186104007ebaSmrg# code.  These arguments will cause the compiler to print various warnings
186204007ebaSmrg# during compilation AND turn a conservative set of warnings into errors.
186304007ebaSmrg#
186404007ebaSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
186504007ebaSmrg# future versions of util-macros as options are added to new compilers.
186604007ebaSmrg#
186704007ebaSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
186804007ebaSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
186904007ebaSmrg
187004007ebaSmrgAC_ARG_ENABLE(selective-werror,
187104007ebaSmrg              AS_HELP_STRING([--disable-selective-werror],
187204007ebaSmrg                             [Turn off selective compiler errors. (default: enabled)]),
187304007ebaSmrg              [SELECTIVE_WERROR=$enableval],
187404007ebaSmrg              [SELECTIVE_WERROR=yes])
187504007ebaSmrg
187604007ebaSmrgAC_LANG_CASE(
187704007ebaSmrg        [C], [
187804007ebaSmrg                define([PREFIX], [C])
187904007ebaSmrg        ],
188004007ebaSmrg        [C++], [
188104007ebaSmrg                define([PREFIX], [CXX])
188204007ebaSmrg        ]
188304007ebaSmrg)
188404007ebaSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
188504007ebaSmrgif test "x$SUNCC" = "xyes"; then
188604007ebaSmrg    [BASE_]PREFIX[FLAGS]="-v"
188704007ebaSmrgelse
188804007ebaSmrg    [BASE_]PREFIX[FLAGS]=""
188904007ebaSmrgfi
189004007ebaSmrg
189104007ebaSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
189204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
189304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
189404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
189504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
189604007ebaSmrg
189704007ebaSmrgAC_LANG_CASE(
189804007ebaSmrg	[C], [
189904007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
190004007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
190104007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
190204007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
19037f419768Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
190404007ebaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
190504007ebaSmrg	]
190604007ebaSmrg)
190704007ebaSmrg
190804007ebaSmrg# This chunk adds additional warnings that could catch undesired effects.
190904007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
191004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
191104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
191204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
191304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
191404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
19157f419768SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
191604007ebaSmrg
191704007ebaSmrg# These are currently disabled because they are noisy.  They will be enabled
191804007ebaSmrg# in the future once the codebase is sufficiently modernized to silence
191904007ebaSmrg# them.  For now, I don't want them to drown out the other warnings.
192004007ebaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
192104007ebaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
19227f419768Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
192304007ebaSmrg
192404007ebaSmrg# Turn some warnings into errors, so we don't accidently get successful builds
192504007ebaSmrg# when there are problems that should be fixed.
192604007ebaSmrg
192704007ebaSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
192804007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
192904007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
193004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
193104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
193204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
193304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
193404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
193504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
193604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
193704007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
193804007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
193904007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
194004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
194104007ebaSmrgelse
194204007ebaSmrgAC_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])
194304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
194404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
194504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
194604007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
194704007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
194804007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
194904007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
195004007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
195104007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
195204007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
195304007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
195404007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
195504007ebaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
195604007ebaSmrgfi
195704007ebaSmrg
195804007ebaSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
195904007ebaSmrg]) # XORG_COMPILER_FLAGS
196004007ebaSmrg
1961f29dbc25Smrg# XORG_CWARNFLAGS
1962f29dbc25Smrg# ---------------
1963f29dbc25Smrg# Minimum version: 1.2.0
196404007ebaSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
1965f29dbc25Smrg#
1966f29dbc25Smrg# Defines CWARNFLAGS to enable C compiler warnings.
1967f29dbc25Smrg#
196804007ebaSmrg# This function is deprecated because it defines -fno-strict-aliasing
196904007ebaSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
197004007ebaSmrg# is needed, then it should be added explicitly in the module when
197104007ebaSmrg# it is updated to use BASE_CFLAGS.
197204007ebaSmrg#
1973f29dbc25SmrgAC_DEFUN([XORG_CWARNFLAGS], [
197404007ebaSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
197504007ebaSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
197604007ebaSmrgAC_LANG_CASE(
197704007ebaSmrg	[C], [
197804007ebaSmrg		CWARNFLAGS="$BASE_CFLAGS"
197904007ebaSmrg		if  test "x$GCC" = xyes ; then
198004007ebaSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
198104007ebaSmrg		fi
198204007ebaSmrg		AC_SUBST(CWARNFLAGS)
198304007ebaSmrg	]
198404007ebaSmrg)
1985f29dbc25Smrg]) # XORG_CWARNFLAGS
1986f29dbc25Smrg
1987f29dbc25Smrg# XORG_STRICT_OPTION
1988f29dbc25Smrg# -----------------------
1989f29dbc25Smrg# Minimum version: 1.3.0
1990f29dbc25Smrg#
199104007ebaSmrg# Add configure option to enable strict compilation flags, such as treating
199204007ebaSmrg# warnings as fatal errors.
199304007ebaSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
199404007ebaSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
199504007ebaSmrg#
199604007ebaSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
199704007ebaSmrg# when strict compilation is unconditionally desired.
1998f29dbc25SmrgAC_DEFUN([XORG_STRICT_OPTION], [
1999f29dbc25SmrgAC_REQUIRE([XORG_CWARNFLAGS])
200004007ebaSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2001f29dbc25Smrg
2002f29dbc25SmrgAC_ARG_ENABLE(strict-compilation,
2003f29dbc25Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2004f29dbc25Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2005f29dbc25Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
200604007ebaSmrg
200704007ebaSmrgAC_LANG_CASE(
200804007ebaSmrg        [C], [
200904007ebaSmrg                define([PREFIX], [C])
201004007ebaSmrg        ],
201104007ebaSmrg        [C++], [
201204007ebaSmrg                define([PREFIX], [CXX])
201304007ebaSmrg        ]
201404007ebaSmrg)
201504007ebaSmrg
201604007ebaSmrg[STRICT_]PREFIX[FLAGS]=""
201704007ebaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
201804007ebaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
201904007ebaSmrg
202004007ebaSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
202104007ebaSmrg# activate it with -Werror, so we add it here explicitly.
202204007ebaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
202304007ebaSmrg
2024f29dbc25Smrgif test "x$STRICT_COMPILE" = "xyes"; then
202504007ebaSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
202604007ebaSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2027f29dbc25Smrgfi
202804007ebaSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
202904007ebaSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
203004007ebaSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2031f29dbc25Smrg]) # XORG_STRICT_OPTION
2032f29dbc25Smrg
2033f29dbc25Smrg# XORG_DEFAULT_OPTIONS
2034f29dbc25Smrg# --------------------
2035f29dbc25Smrg# Minimum version: 1.3.0
2036f29dbc25Smrg#
2037f29dbc25Smrg# Defines default options for X.Org modules.
2038f29dbc25Smrg#
2039f29dbc25SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2040170d5fdcSmrgAC_REQUIRE([AC_PROG_INSTALL])
204104007ebaSmrgXORG_COMPILER_FLAGS
2042f29dbc25SmrgXORG_CWARNFLAGS
2043f29dbc25SmrgXORG_STRICT_OPTION
2044f29dbc25SmrgXORG_RELEASE_VERSION
2045f29dbc25SmrgXORG_CHANGELOG
2046f29dbc25SmrgXORG_INSTALL
2047f29dbc25SmrgXORG_MANPAGE_SECTIONS
2048170d5fdcSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2049170d5fdcSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2050f29dbc25Smrg]) # XORG_DEFAULT_OPTIONS
2051f29dbc25Smrg
2052f29dbc25Smrg# XORG_INSTALL()
2053f29dbc25Smrg# ----------------
2054f29dbc25Smrg# Minimum version: 1.4.0
2055f29dbc25Smrg#
2056f29dbc25Smrg# Defines the variable INSTALL_CMD as the command to copy
2057f29dbc25Smrg# INSTALL from $prefix/share/util-macros.
2058f29dbc25Smrg#
2059f29dbc25SmrgAC_DEFUN([XORG_INSTALL], [
2060f29dbc25SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2061f29dbc25Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2062f29dbc25SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2063f29dbc25Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2064f29dbc25Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2065f29dbc25Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2066f29dbc25SmrgAC_SUBST([INSTALL_CMD])
2067f29dbc25Smrg]) # XORG_INSTALL
2068f29dbc25Smrgdnl Copyright 2005 Red Hat, Inc
2069f29dbc25Smrgdnl
2070f29dbc25Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2071f29dbc25Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2072f29dbc25Smrgdnl the above copyright notice appear in all copies and that both that
2073f29dbc25Smrgdnl copyright notice and this permission notice appear in supporting
2074f29dbc25Smrgdnl documentation.
2075f29dbc25Smrgdnl
2076f29dbc25Smrgdnl The above copyright notice and this permission notice shall be included
2077f29dbc25Smrgdnl in all copies or substantial portions of the Software.
2078f29dbc25Smrgdnl
2079f29dbc25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2080f29dbc25Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2081f29dbc25Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2082f29dbc25Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2083f29dbc25Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2084f29dbc25Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2085f29dbc25Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2086f29dbc25Smrgdnl
2087f29dbc25Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2088f29dbc25Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2089f29dbc25Smrgdnl other dealings in this Software without prior written authorization
2090f29dbc25Smrgdnl from the copyright holders.
2091f29dbc25Smrgdnl
2092f29dbc25Smrg
2093f29dbc25Smrg# XORG_RELEASE_VERSION
2094f29dbc25Smrg# --------------------
2095170d5fdcSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
209604007ebaSmrg
2097f29dbc25SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2098f29dbc25Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2099f29dbc25Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2100f29dbc25Smrg		[Major version of this package])
2101f29dbc25Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2102f29dbc25Smrg	if test "x$PVM" = "x"; then
2103f29dbc25Smrg		PVM="0"
2104f29dbc25Smrg	fi
2105f29dbc25Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2106f29dbc25Smrg		[$PVM],
2107f29dbc25Smrg		[Minor version of this package])
2108f29dbc25Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2109f29dbc25Smrg	if test "x$PVP" = "x"; then
2110f29dbc25Smrg		PVP="0"
2111f29dbc25Smrg	fi
2112f29dbc25Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2113f29dbc25Smrg		[$PVP],
2114f29dbc25Smrg		[Patch version of this package])
2115f29dbc25Smrg])
2116f29dbc25Smrg
2117f29dbc25Smrg# XORG_CHANGELOG()
2118f29dbc25Smrg# ----------------
2119f29dbc25Smrg# Minimum version: 1.2.0
2120f29dbc25Smrg#
2121f29dbc25Smrg# Defines the variable CHANGELOG_CMD as the command to generate
2122f29dbc25Smrg# ChangeLog from git.
2123f29dbc25Smrg#
2124f29dbc25Smrg#
2125f29dbc25SmrgAC_DEFUN([XORG_CHANGELOG], [
2126f29dbc25SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2127f29dbc25Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2128f29dbc25Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2129f29dbc25Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2130f29dbc25SmrgAC_SUBST([CHANGELOG_CMD])
2131f29dbc25Smrg]) # XORG_CHANGELOG
2132f29dbc25Smrg
2133f29dbc25Smrgdnl Copyright 2005 Red Hat, Inc
2134f29dbc25Smrgdnl 
2135f29dbc25Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2136f29dbc25Smrgdnl documentation for any purpose is hereby granted without fee, provided that
2137f29dbc25Smrgdnl the above copyright notice appear in all copies and that both that
2138f29dbc25Smrgdnl copyright notice and this permission notice appear in supporting
2139f29dbc25Smrgdnl documentation.
2140f29dbc25Smrgdnl 
2141f29dbc25Smrgdnl The above copyright notice and this permission notice shall be included
2142f29dbc25Smrgdnl in all copies or substantial portions of the Software.
2143f29dbc25Smrgdnl 
2144f29dbc25Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2145f29dbc25Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2146f29dbc25Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2147f29dbc25Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2148f29dbc25Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2149f29dbc25Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2150f29dbc25Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
2151f29dbc25Smrgdnl 
2152f29dbc25Smrgdnl Except as contained in this notice, the name of the copyright holders shall
2153f29dbc25Smrgdnl not be used in advertising or otherwise to promote the sale, use or
2154f29dbc25Smrgdnl other dealings in this Software without prior written authorization
2155f29dbc25Smrgdnl from the copyright holders.
2156f29dbc25Smrgdnl 
2157f29dbc25Smrg
215804007ebaSmrg# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2159f29dbc25Smrg# --------------------------
216004007ebaSmrg# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
216104007ebaSmrg# is defined, then add the given PROTO to $REQUIRED_MODULES.
2162f29dbc25Smrg
2163f29dbc25SmrgAC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2164f29dbc25Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2165f29dbc25Smrg	SAVE_CFLAGS="$CFLAGS"
2166f29dbc25Smrg	CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`"
2167f29dbc25Smrg	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2168f29dbc25Smrg#include "xorg-server.h"
2169f29dbc25Smrg#if !defined $1
2170f29dbc25Smrg#error $1 not defined
2171f29dbc25Smrg#endif
2172f29dbc25Smrg		]])],
2173f29dbc25Smrg		[_EXT_CHECK=yes],
2174f29dbc25Smrg		[_EXT_CHECK=no])
2175f29dbc25Smrg	CFLAGS="$SAVE_CFLAGS"
2176f29dbc25Smrg	AC_MSG_CHECKING([if $1 is defined])
2177f29dbc25Smrg	AC_MSG_RESULT([$_EXT_CHECK])
2178f29dbc25Smrg	if test "$_EXT_CHECK" != no; then
2179f29dbc25Smrg		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2180f29dbc25Smrg	fi
2181f29dbc25Smrg])
2182f29dbc25Smrg
218304007ebaSmrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
2184f29dbc25Smrg#
2185f29dbc25Smrg# This file is free software; the Free Software Foundation
2186f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2187f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2188f29dbc25Smrg
2189f29dbc25Smrg# AM_AUTOMAKE_VERSION(VERSION)
2190f29dbc25Smrg# ----------------------------
2191f29dbc25Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2192f29dbc25Smrg# generated from the m4 files accompanying Automake X.Y.
2193f29dbc25Smrg# (This private macro should not be called outside this file.)
2194f29dbc25SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
219504007ebaSmrg[am__api_version='1.14'
2196f29dbc25Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2197f29dbc25Smrgdnl require some minimum version.  Point them to the right macro.
21987f419768Smrgm4_if([$1], [1.14.1], [],
2199f29dbc25Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2200f29dbc25Smrg])
2201f29dbc25Smrg
2202f29dbc25Smrg# _AM_AUTOCONF_VERSION(VERSION)
2203f29dbc25Smrg# -----------------------------
2204f29dbc25Smrg# aclocal traces this macro to find the Autoconf version.
2205f29dbc25Smrg# This is a private macro too.  Using m4_define simplifies
2206f29dbc25Smrg# the logic in aclocal, which can simply ignore this definition.
2207f29dbc25Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2208f29dbc25Smrg
2209f29dbc25Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2210f29dbc25Smrg# -------------------------------
2211f29dbc25Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2212f29dbc25Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2213f29dbc25SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
22147f419768Smrg[AM_AUTOMAKE_VERSION([1.14.1])dnl
2215f29dbc25Smrgm4_ifndef([AC_AUTOCONF_VERSION],
2216f29dbc25Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2217f29dbc25Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2218f29dbc25Smrg
2219f29dbc25Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2220f29dbc25Smrg
222104007ebaSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2222f29dbc25Smrg#
2223f29dbc25Smrg# This file is free software; the Free Software Foundation
2224f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2225f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2226f29dbc25Smrg
2227f29dbc25Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
222804007ebaSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
222904007ebaSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2230f29dbc25Smrg#
2231f29dbc25Smrg# Of course, Automake must honor this variable whenever it calls a
2232f29dbc25Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2233f29dbc25Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2234f29dbc25Smrg# depending on how configure is run.  This is pretty annoying, since
2235f29dbc25Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2236f29dbc25Smrg# source directory, any form will work fine, but in subdirectories a
2237f29dbc25Smrg# relative path needs to be adjusted first.
2238f29dbc25Smrg#
2239f29dbc25Smrg# $ac_aux_dir/missing
2240f29dbc25Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2241f29dbc25Smrg# $top_srcdir/$ac_aux_dir/missing
2242f29dbc25Smrg#    fails if $ac_aux_dir is absolute,
2243f29dbc25Smrg#    fails when called from a subdirectory in a VPATH build with
2244f29dbc25Smrg#          a relative $ac_aux_dir
2245f29dbc25Smrg#
2246f29dbc25Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2247f29dbc25Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
224804007ebaSmrg# harmless because $srcdir is '.', but things will broke when you
2249f29dbc25Smrg# start a VPATH build or use an absolute $srcdir.
2250f29dbc25Smrg#
2251f29dbc25Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2252f29dbc25Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2253f29dbc25Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2254f29dbc25Smrg# and then we would define $MISSING as
2255f29dbc25Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2256f29dbc25Smrg# This will work as long as MISSING is not called from configure, because
2257f29dbc25Smrg# unfortunately $(top_srcdir) has no meaning in configure.
2258f29dbc25Smrg# However there are other variables, like CC, which are often used in
2259f29dbc25Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2260f29dbc25Smrg#
2261f29dbc25Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
2262f29dbc25Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
2263f29dbc25Smrg# configured tree to be moved without reconfiguration.
2264f29dbc25Smrg
2265f29dbc25SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
22667f419768Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
22677f419768Smrg# Expand $ac_aux_dir to an absolute path.
22687f419768Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
2269f29dbc25Smrg])
2270f29dbc25Smrg
2271f29dbc25Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2272f29dbc25Smrg
227304007ebaSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
2274f29dbc25Smrg#
2275f29dbc25Smrg# This file is free software; the Free Software Foundation
2276f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2277f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2278f29dbc25Smrg
2279f29dbc25Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2280f29dbc25Smrg# -------------------------------------
2281f29dbc25Smrg# Define a conditional.
2282f29dbc25SmrgAC_DEFUN([AM_CONDITIONAL],
228304007ebaSmrg[AC_PREREQ([2.52])dnl
228404007ebaSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
228504007ebaSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2286f29dbc25SmrgAC_SUBST([$1_TRUE])dnl
2287f29dbc25SmrgAC_SUBST([$1_FALSE])dnl
2288f29dbc25Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2289f29dbc25Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2290f29dbc25Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2291f29dbc25Smrgif $2; then
2292f29dbc25Smrg  $1_TRUE=
2293f29dbc25Smrg  $1_FALSE='#'
2294f29dbc25Smrgelse
2295f29dbc25Smrg  $1_TRUE='#'
2296f29dbc25Smrg  $1_FALSE=
2297f29dbc25Smrgfi
2298f29dbc25SmrgAC_CONFIG_COMMANDS_PRE(
2299f29dbc25Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2300f29dbc25Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2301f29dbc25SmrgUsually this means the macro was only invoked conditionally.]])
2302f29dbc25Smrgfi])])
2303f29dbc25Smrg
230404007ebaSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2305f29dbc25Smrg#
2306f29dbc25Smrg# This file is free software; the Free Software Foundation
2307f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2308f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2309f29dbc25Smrg
2310f29dbc25Smrg
231104007ebaSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2312f29dbc25Smrg# written in clear, in which case automake, when reading aclocal.m4,
2313f29dbc25Smrg# will think it sees a *use*, and therefore will trigger all it's
2314f29dbc25Smrg# C support machinery.  Also note that it means that autoscan, seeing
2315f29dbc25Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2316f29dbc25Smrg
2317f29dbc25Smrg
2318f29dbc25Smrg# _AM_DEPENDENCIES(NAME)
2319f29dbc25Smrg# ----------------------
2320f29dbc25Smrg# See how the compiler implements dependency checking.
232104007ebaSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2322f29dbc25Smrg# We try a few techniques and use that to set a single cache variable.
2323f29dbc25Smrg#
2324f29dbc25Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2325f29dbc25Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2326f29dbc25Smrg# dependency, and given that the user is not expected to run this macro,
2327f29dbc25Smrg# just rely on AC_PROG_CC.
2328f29dbc25SmrgAC_DEFUN([_AM_DEPENDENCIES],
2329f29dbc25Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2330f29dbc25SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2331f29dbc25SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2332f29dbc25SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2333f29dbc25Smrg
233404007ebaSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
233504007ebaSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
233604007ebaSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
233704007ebaSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
233804007ebaSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
233904007ebaSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
234004007ebaSmrg                    [depcc="$$1"   am_compiler_list=])
2341f29dbc25Smrg
2342f29dbc25SmrgAC_CACHE_CHECK([dependency style of $depcc],
2343f29dbc25Smrg               [am_cv_$1_dependencies_compiler_type],
2344f29dbc25Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2345f29dbc25Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
2346f29dbc25Smrg  # making bogus files that we don't know about and never remove.  For
2347f29dbc25Smrg  # instance it was reported that on HP-UX the gcc test will end up
234804007ebaSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
234904007ebaSmrg  # in D".
235004007ebaSmrg  rm -rf conftest.dir
2351f29dbc25Smrg  mkdir conftest.dir
2352f29dbc25Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2353f29dbc25Smrg  # using a relative directory.
2354f29dbc25Smrg  cp "$am_depcomp" conftest.dir
2355f29dbc25Smrg  cd conftest.dir
2356f29dbc25Smrg  # We will build objects and dependencies in a subdirectory because
2357f29dbc25Smrg  # it helps to detect inapplicable dependency modes.  For instance
2358f29dbc25Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2359f29dbc25Smrg  # side effect of compilation, but ICC will put the dependencies in
2360f29dbc25Smrg  # the current directory while Tru64 will put them in the object
2361f29dbc25Smrg  # directory.
2362f29dbc25Smrg  mkdir sub
2363f29dbc25Smrg
2364f29dbc25Smrg  am_cv_$1_dependencies_compiler_type=none
2365f29dbc25Smrg  if test "$am_compiler_list" = ""; then
2366f29dbc25Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2367f29dbc25Smrg  fi
2368f29dbc25Smrg  am__universal=false
2369f29dbc25Smrg  m4_case([$1], [CC],
2370f29dbc25Smrg    [case " $depcc " in #(
2371f29dbc25Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2372f29dbc25Smrg     esac],
2373f29dbc25Smrg    [CXX],
2374f29dbc25Smrg    [case " $depcc " in #(
2375f29dbc25Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2376f29dbc25Smrg     esac])
2377f29dbc25Smrg
2378f29dbc25Smrg  for depmode in $am_compiler_list; do
2379f29dbc25Smrg    # Setup a source with many dependencies, because some compilers
2380f29dbc25Smrg    # like to wrap large dependency lists on column 80 (with \), and
2381f29dbc25Smrg    # we should not choose a depcomp mode which is confused by this.
2382f29dbc25Smrg    #
2383f29dbc25Smrg    # We need to recreate these files for each test, as the compiler may
2384f29dbc25Smrg    # overwrite some of them when testing with obscure command lines.
2385f29dbc25Smrg    # This happens at least with the AIX C compiler.
2386f29dbc25Smrg    : > sub/conftest.c
2387f29dbc25Smrg    for i in 1 2 3 4 5 6; do
2388f29dbc25Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
238904007ebaSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
239004007ebaSmrg      # Solaris 10 /bin/sh.
239104007ebaSmrg      echo '/* dummy */' > sub/conftst$i.h
2392f29dbc25Smrg    done
2393f29dbc25Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2394f29dbc25Smrg
239504007ebaSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2396f29dbc25Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
239704007ebaSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239804007ebaSmrg    # versions had trouble with output in subdirs.
2399f29dbc25Smrg    am__obj=sub/conftest.${OBJEXT-o}
2400f29dbc25Smrg    am__minus_obj="-o $am__obj"
2401f29dbc25Smrg    case $depmode in
2402f29dbc25Smrg    gcc)
2403f29dbc25Smrg      # This depmode causes a compiler race in universal mode.
2404f29dbc25Smrg      test "$am__universal" = false || continue
2405f29dbc25Smrg      ;;
2406f29dbc25Smrg    nosideeffect)
240704007ebaSmrg      # After this tag, mechanisms are not by side-effect, so they'll
240804007ebaSmrg      # only be used when explicitly requested.
2409f29dbc25Smrg      if test "x$enable_dependency_tracking" = xyes; then
2410f29dbc25Smrg	continue
2411f29dbc25Smrg      else
2412f29dbc25Smrg	break
2413f29dbc25Smrg      fi
2414f29dbc25Smrg      ;;
241504007ebaSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
241604007ebaSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2417f29dbc25Smrg      # not run yet.  These depmodes are late enough in the game, and
2418f29dbc25Smrg      # so weak that their functioning should not be impacted.
2419f29dbc25Smrg      am__obj=conftest.${OBJEXT-o}
2420f29dbc25Smrg      am__minus_obj=
2421f29dbc25Smrg      ;;
2422f29dbc25Smrg    none) break ;;
2423f29dbc25Smrg    esac
2424f29dbc25Smrg    if depmode=$depmode \
2425f29dbc25Smrg       source=sub/conftest.c object=$am__obj \
2426f29dbc25Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2427f29dbc25Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2428f29dbc25Smrg         >/dev/null 2>conftest.err &&
2429f29dbc25Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2430f29dbc25Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2431f29dbc25Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2432f29dbc25Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2433f29dbc25Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2434f29dbc25Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2435f29dbc25Smrg      # that says an option was ignored or not supported.
2436f29dbc25Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2437f29dbc25Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2438f29dbc25Smrg      # The diagnosis changed in icc 8.0:
2439f29dbc25Smrg      #   icc: Command line remark: option '-MP' not supported
2440f29dbc25Smrg      if (grep 'ignoring option' conftest.err ||
2441f29dbc25Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2442f29dbc25Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2443f29dbc25Smrg        break
2444f29dbc25Smrg      fi
2445f29dbc25Smrg    fi
2446f29dbc25Smrg  done
2447f29dbc25Smrg
2448f29dbc25Smrg  cd ..
2449f29dbc25Smrg  rm -rf conftest.dir
2450f29dbc25Smrgelse
2451f29dbc25Smrg  am_cv_$1_dependencies_compiler_type=none
2452f29dbc25Smrgfi
2453f29dbc25Smrg])
2454f29dbc25SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2455f29dbc25SmrgAM_CONDITIONAL([am__fastdep$1], [
2456f29dbc25Smrg  test "x$enable_dependency_tracking" != xno \
2457f29dbc25Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2458f29dbc25Smrg])
2459f29dbc25Smrg
2460f29dbc25Smrg
2461f29dbc25Smrg# AM_SET_DEPDIR
2462f29dbc25Smrg# -------------
2463f29dbc25Smrg# Choose a directory name for dependency files.
246404007ebaSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2465f29dbc25SmrgAC_DEFUN([AM_SET_DEPDIR],
2466f29dbc25Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2467f29dbc25SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2468f29dbc25Smrg])
2469f29dbc25Smrg
2470f29dbc25Smrg
2471f29dbc25Smrg# AM_DEP_TRACK
2472f29dbc25Smrg# ------------
2473f29dbc25SmrgAC_DEFUN([AM_DEP_TRACK],
247404007ebaSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
247504007ebaSmrgAS_HELP_STRING(
247604007ebaSmrg  [--enable-dependency-tracking],
247704007ebaSmrg  [do not reject slow dependency extractors])
247804007ebaSmrgAS_HELP_STRING(
247904007ebaSmrg  [--disable-dependency-tracking],
248004007ebaSmrg  [speeds up one-time build])])
2481f29dbc25Smrgif test "x$enable_dependency_tracking" != xno; then
2482f29dbc25Smrg  am_depcomp="$ac_aux_dir/depcomp"
2483f29dbc25Smrg  AMDEPBACKSLASH='\'
248404007ebaSmrg  am__nodep='_no'
2485f29dbc25Smrgfi
2486f29dbc25SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2487f29dbc25SmrgAC_SUBST([AMDEPBACKSLASH])dnl
2488f29dbc25Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
248904007ebaSmrgAC_SUBST([am__nodep])dnl
249004007ebaSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2491f29dbc25Smrg])
2492f29dbc25Smrg
2493f29dbc25Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2494f29dbc25Smrg
249504007ebaSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2496f29dbc25Smrg#
2497f29dbc25Smrg# This file is free software; the Free Software Foundation
2498f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2499f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2500f29dbc25Smrg
2501f29dbc25Smrg
2502f29dbc25Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2503f29dbc25Smrg# ------------------------------
2504f29dbc25SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2505f29dbc25Smrg[{
250604007ebaSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
2507f29dbc25Smrg  # are listed without --file.  Let's play safe and only enable the eval
2508f29dbc25Smrg  # if we detect the quoting.
2509f29dbc25Smrg  case $CONFIG_FILES in
2510f29dbc25Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
2511f29dbc25Smrg  *)   set x $CONFIG_FILES ;;
2512f29dbc25Smrg  esac
2513f29dbc25Smrg  shift
2514f29dbc25Smrg  for mf
2515f29dbc25Smrg  do
2516f29dbc25Smrg    # Strip MF so we end up with the name of the file.
2517f29dbc25Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
2518f29dbc25Smrg    # Check whether this is an Automake generated Makefile or not.
251904007ebaSmrg    # We used to match only the files named 'Makefile.in', but
2520f29dbc25Smrg    # some people rename them; so instead we look at the file content.
2521f29dbc25Smrg    # Grep'ing the first line is not enough: some people post-process
2522f29dbc25Smrg    # each Makefile.in and add a new line on top of each file to say so.
2523f29dbc25Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
2524f29dbc25Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
2525f29dbc25Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2526f29dbc25Smrg      dirpart=`AS_DIRNAME("$mf")`
2527f29dbc25Smrg    else
2528f29dbc25Smrg      continue
2529f29dbc25Smrg    fi
2530f29dbc25Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
253104007ebaSmrg    # from the Makefile without running 'make'.
2532f29dbc25Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2533f29dbc25Smrg    test -z "$DEPDIR" && continue
2534f29dbc25Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
253504007ebaSmrg    test -z "$am__include" && continue
2536f29dbc25Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2537f29dbc25Smrg    # Find all dependency output files, they are included files with
2538f29dbc25Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2539f29dbc25Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
2540f29dbc25Smrg    # expansion.
2541f29dbc25Smrg    for file in `sed -n "
2542f29dbc25Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
254304007ebaSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2544f29dbc25Smrg      # Make sure the directory exists.
2545f29dbc25Smrg      test -f "$dirpart/$file" && continue
2546f29dbc25Smrg      fdir=`AS_DIRNAME(["$file"])`
2547f29dbc25Smrg      AS_MKDIR_P([$dirpart/$fdir])
2548f29dbc25Smrg      # echo "creating $dirpart/$file"
2549f29dbc25Smrg      echo '# dummy' > "$dirpart/$file"
2550f29dbc25Smrg    done
2551f29dbc25Smrg  done
2552f29dbc25Smrg}
2553f29dbc25Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2554f29dbc25Smrg
2555f29dbc25Smrg
2556f29dbc25Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2557f29dbc25Smrg# -----------------------------
2558f29dbc25Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2559f29dbc25Smrg#
2560f29dbc25Smrg# This code is only required when automatic dependency tracking
256104007ebaSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
2562f29dbc25Smrg# need in order to bootstrap the dependency handling code.
2563f29dbc25SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2564f29dbc25Smrg[AC_CONFIG_COMMANDS([depfiles],
2565f29dbc25Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2566f29dbc25Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2567f29dbc25Smrg])
2568f29dbc25Smrg
2569f29dbc25Smrg# Do all the work for Automake.                             -*- Autoconf -*-
2570f29dbc25Smrg
257104007ebaSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2572f29dbc25Smrg#
2573f29dbc25Smrg# This file is free software; the Free Software Foundation
2574f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2575f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2576f29dbc25Smrg
2577f29dbc25Smrg# This macro actually does too much.  Some checks are only needed if
2578f29dbc25Smrg# your package does certain things.  But this isn't really a big deal.
2579f29dbc25Smrg
258004007ebaSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
258104007ebaSmrgm4_define([AC_PROG_CC],
258204007ebaSmrgm4_defn([AC_PROG_CC])
258304007ebaSmrg[_AM_PROG_CC_C_O
258404007ebaSmrg])
258504007ebaSmrg
2586f29dbc25Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2587f29dbc25Smrg# AM_INIT_AUTOMAKE([OPTIONS])
2588f29dbc25Smrg# -----------------------------------------------
2589f29dbc25Smrg# The call with PACKAGE and VERSION arguments is the old style
2590f29dbc25Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2591f29dbc25Smrg# and VERSION should now be passed to AC_INIT and removed from
2592f29dbc25Smrg# the call to AM_INIT_AUTOMAKE.
2593f29dbc25Smrg# We support both call styles for the transition.  After
2594f29dbc25Smrg# the next Automake release, Autoconf can make the AC_INIT
2595f29dbc25Smrg# arguments mandatory, and then we can depend on a new Autoconf
2596f29dbc25Smrg# release and drop the old call support.
2597f29dbc25SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
259804007ebaSmrg[AC_PREREQ([2.65])dnl
2599f29dbc25Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2600f29dbc25Smrgdnl the ones we care about.
2601f29dbc25Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2602f29dbc25SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2603f29dbc25SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2604f29dbc25Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2605f29dbc25Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2606f29dbc25Smrg  # is not polluted with repeated "-I."
2607f29dbc25Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2608f29dbc25Smrg  # test to see if srcdir already configured
2609f29dbc25Smrg  if test -f $srcdir/config.status; then
2610f29dbc25Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2611f29dbc25Smrg  fi
2612f29dbc25Smrgfi
2613f29dbc25Smrg
2614f29dbc25Smrg# test whether we have cygpath
2615f29dbc25Smrgif test -z "$CYGPATH_W"; then
2616f29dbc25Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2617f29dbc25Smrg    CYGPATH_W='cygpath -w'
2618f29dbc25Smrg  else
2619f29dbc25Smrg    CYGPATH_W=echo
2620f29dbc25Smrg  fi
2621f29dbc25Smrgfi
2622f29dbc25SmrgAC_SUBST([CYGPATH_W])
2623f29dbc25Smrg
2624f29dbc25Smrg# Define the identity of the package.
2625f29dbc25Smrgdnl Distinguish between old-style and new-style calls.
2626f29dbc25Smrgm4_ifval([$2],
262704007ebaSmrg[AC_DIAGNOSE([obsolete],
262804007ebaSmrg             [$0: two- and three-arguments forms are deprecated.])
262904007ebaSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2630f29dbc25Smrg AC_SUBST([PACKAGE], [$1])dnl
2631f29dbc25Smrg AC_SUBST([VERSION], [$2])],
2632f29dbc25Smrg[_AM_SET_OPTIONS([$1])dnl
2633f29dbc25Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
263404007ebaSmrgm4_if(
263504007ebaSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
263604007ebaSmrg  [ok:ok],,
2637f29dbc25Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2638f29dbc25Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2639f29dbc25Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2640f29dbc25Smrg
2641f29dbc25Smrg_AM_IF_OPTION([no-define],,
264204007ebaSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
264304007ebaSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2644f29dbc25Smrg
2645f29dbc25Smrg# Some tools Automake needs.
2646f29dbc25SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2647f29dbc25SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
264804007ebaSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
264904007ebaSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
265004007ebaSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
265104007ebaSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
265204007ebaSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2653f29dbc25SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2654f29dbc25SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
265504007ebaSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
265604007ebaSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
265704007ebaSmrg# dies out for good.  For more background, see:
265804007ebaSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
265904007ebaSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
266004007ebaSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2661f29dbc25Smrg# We need awk for the "check" target.  The system "awk" is bad on
2662f29dbc25Smrg# some platforms.
2663f29dbc25SmrgAC_REQUIRE([AC_PROG_AWK])dnl
2664f29dbc25SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2665f29dbc25SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2666f29dbc25Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2667f29dbc25Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2668f29dbc25Smrg			     [_AM_PROG_TAR([v7])])])
2669f29dbc25Smrg_AM_IF_OPTION([no-dependencies],,
2670f29dbc25Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
267104007ebaSmrg		  [_AM_DEPENDENCIES([CC])],
267204007ebaSmrg		  [m4_define([AC_PROG_CC],
267304007ebaSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2674f29dbc25SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
267504007ebaSmrg		  [_AM_DEPENDENCIES([CXX])],
267604007ebaSmrg		  [m4_define([AC_PROG_CXX],
267704007ebaSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2678f29dbc25SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
267904007ebaSmrg		  [_AM_DEPENDENCIES([OBJC])],
268004007ebaSmrg		  [m4_define([AC_PROG_OBJC],
268104007ebaSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
268204007ebaSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
268304007ebaSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
268404007ebaSmrg		  [m4_define([AC_PROG_OBJCXX],
268504007ebaSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2686f29dbc25Smrg])
268704007ebaSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
268804007ebaSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
268904007ebaSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
269004007ebaSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2691f29dbc25SmrgAC_CONFIG_COMMANDS_PRE(dnl
2692f29dbc25Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2693f29dbc25Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2694f29dbc25Smrg
269504007ebaSmrg# POSIX will say in a future version that running "rm -f" with no argument
269604007ebaSmrg# is OK; and we want to be able to make that assumption in our Makefile
269704007ebaSmrg# recipes.  So use an aggressive probe to check that the usage we want is
269804007ebaSmrg# actually supported "in the wild" to an acceptable degree.
269904007ebaSmrg# See automake bug#10828.
270004007ebaSmrg# To make any issue more visible, cause the running configure to be aborted
270104007ebaSmrg# by default if the 'rm' program in use doesn't match our expectations; the
270204007ebaSmrg# user can still override this though.
270304007ebaSmrgif rm -f && rm -fr && rm -rf; then : OK; else
270404007ebaSmrg  cat >&2 <<'END'
270504007ebaSmrgOops!
270604007ebaSmrg
270704007ebaSmrgYour 'rm' program seems unable to run without file operands specified
270804007ebaSmrgon the command line, even when the '-f' option is present.  This is contrary
270904007ebaSmrgto the behaviour of most rm programs out there, and not conforming with
271004007ebaSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
271104007ebaSmrg
271204007ebaSmrgPlease tell bug-automake@gnu.org about your system, including the value
271304007ebaSmrgof your $PATH and any error possibly output before this message.  This
271404007ebaSmrgcan help us improve future automake versions.
271504007ebaSmrg
271604007ebaSmrgEND
271704007ebaSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
271804007ebaSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
271904007ebaSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
272004007ebaSmrg    echo >&2
272104007ebaSmrg  else
272204007ebaSmrg    cat >&2 <<'END'
272304007ebaSmrgAborting the configuration process, to ensure you take notice of the issue.
272404007ebaSmrg
272504007ebaSmrgYou can download and install GNU coreutils to get an 'rm' implementation
272604007ebaSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
272704007ebaSmrg
272804007ebaSmrgIf you want to complete the configuration process using your problematic
272904007ebaSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
273004007ebaSmrgto "yes", and re-run configure.
273104007ebaSmrg
273204007ebaSmrgEND
273304007ebaSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
273404007ebaSmrg  fi
27357f419768Smrgfi
27367f419768Smrg])
273704007ebaSmrg
273804007ebaSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2739f29dbc25Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2740f29dbc25Smrgdnl mangled by Autoconf and run in a shell conditional statement.
2741f29dbc25Smrgm4_define([_AC_COMPILER_EXEEXT],
2742f29dbc25Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2743f29dbc25Smrg
2744f29dbc25Smrg# When config.status generates a header, we must update the stamp-h file.
2745f29dbc25Smrg# This file resides in the same directory as the config header
2746f29dbc25Smrg# that is generated.  The stamp files are numbered to have different names.
2747f29dbc25Smrg
2748f29dbc25Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2749f29dbc25Smrg# loop where config.status creates the headers, so we can generate
2750f29dbc25Smrg# our stamp files there.
2751f29dbc25SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2752f29dbc25Smrg[# Compute $1's index in $config_headers.
2753f29dbc25Smrg_am_arg=$1
2754f29dbc25Smrg_am_stamp_count=1
2755f29dbc25Smrgfor _am_header in $config_headers :; do
2756f29dbc25Smrg  case $_am_header in
2757f29dbc25Smrg    $_am_arg | $_am_arg:* )
2758f29dbc25Smrg      break ;;
2759f29dbc25Smrg    * )
2760f29dbc25Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2761f29dbc25Smrg  esac
2762f29dbc25Smrgdone
2763f29dbc25Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2764f29dbc25Smrg
276504007ebaSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2766f29dbc25Smrg#
2767f29dbc25Smrg# This file is free software; the Free Software Foundation
2768f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2769f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2770f29dbc25Smrg
2771f29dbc25Smrg# AM_PROG_INSTALL_SH
2772f29dbc25Smrg# ------------------
2773f29dbc25Smrg# Define $install_sh.
2774f29dbc25SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2775f29dbc25Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2776f29dbc25Smrgif test x"${install_sh}" != xset; then
2777f29dbc25Smrg  case $am_aux_dir in
2778f29dbc25Smrg  *\ * | *\	*)
2779f29dbc25Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2780f29dbc25Smrg  *)
2781f29dbc25Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2782f29dbc25Smrg  esac
2783f29dbc25Smrgfi
278404007ebaSmrgAC_SUBST([install_sh])])
2785f29dbc25Smrg
278604007ebaSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
2787f29dbc25Smrg#
2788f29dbc25Smrg# This file is free software; the Free Software Foundation
2789f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2790f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2791f29dbc25Smrg
2792f29dbc25Smrg# Check whether the underlying file-system supports filenames
2793f29dbc25Smrg# with a leading dot.  For instance MS-DOS doesn't.
2794f29dbc25SmrgAC_DEFUN([AM_SET_LEADING_DOT],
2795f29dbc25Smrg[rm -rf .tst 2>/dev/null
2796f29dbc25Smrgmkdir .tst 2>/dev/null
2797f29dbc25Smrgif test -d .tst; then
2798f29dbc25Smrg  am__leading_dot=.
2799f29dbc25Smrgelse
2800f29dbc25Smrg  am__leading_dot=_
2801f29dbc25Smrgfi
2802f29dbc25Smrgrmdir .tst 2>/dev/null
2803f29dbc25SmrgAC_SUBST([am__leading_dot])])
2804f29dbc25Smrg
2805f29dbc25Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
2806f29dbc25Smrg# From Jim Meyering
2807f29dbc25Smrg
280804007ebaSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2809f29dbc25Smrg#
2810f29dbc25Smrg# This file is free software; the Free Software Foundation
2811f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2812f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2813f29dbc25Smrg
2814f29dbc25Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
2815f29dbc25Smrg# ----------------------------------
2816f29dbc25Smrg# Control maintainer-specific portions of Makefiles.
281704007ebaSmrg# Default is to disable them, unless 'enable' is passed literally.
281804007ebaSmrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
2819f29dbc25Smrg# can override the default with the --enable/--disable switch.
2820f29dbc25SmrgAC_DEFUN([AM_MAINTAINER_MODE],
2821f29dbc25Smrg[m4_case(m4_default([$1], [disable]),
2822f29dbc25Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
2823f29dbc25Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
2824f29dbc25Smrg       [m4_define([am_maintainer_other], [enable])
2825f29dbc25Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
282604007ebaSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2827f29dbc25Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
2828f29dbc25Smrg  AC_ARG_ENABLE([maintainer-mode],
282904007ebaSmrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
283004007ebaSmrg      am_maintainer_other[ make rules and dependencies not useful
283104007ebaSmrg      (and sometimes confusing) to the casual installer])],
283204007ebaSmrg    [USE_MAINTAINER_MODE=$enableval],
283304007ebaSmrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
2834f29dbc25Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
2835f29dbc25Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
2836f29dbc25Smrg  MAINT=$MAINTAINER_MODE_TRUE
2837f29dbc25Smrg  AC_SUBST([MAINT])dnl
2838f29dbc25Smrg]
2839f29dbc25Smrg)
2840f29dbc25Smrg
2841f29dbc25Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2842f29dbc25Smrg
284304007ebaSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2844f29dbc25Smrg#
2845f29dbc25Smrg# This file is free software; the Free Software Foundation
2846f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2847f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2848f29dbc25Smrg
2849f29dbc25Smrg# AM_MAKE_INCLUDE()
2850f29dbc25Smrg# -----------------
2851f29dbc25Smrg# Check to see how make treats includes.
2852f29dbc25SmrgAC_DEFUN([AM_MAKE_INCLUDE],
2853f29dbc25Smrg[am_make=${MAKE-make}
2854f29dbc25Smrgcat > confinc << 'END'
2855f29dbc25Smrgam__doit:
2856f29dbc25Smrg	@echo this is the am__doit target
2857f29dbc25Smrg.PHONY: am__doit
2858f29dbc25SmrgEND
2859f29dbc25Smrg# If we don't find an include directive, just comment out the code.
2860f29dbc25SmrgAC_MSG_CHECKING([for style of include used by $am_make])
2861f29dbc25Smrgam__include="#"
2862f29dbc25Smrgam__quote=
2863f29dbc25Smrg_am_result=none
2864f29dbc25Smrg# First try GNU make style include.
2865f29dbc25Smrgecho "include confinc" > confmf
286604007ebaSmrg# Ignore all kinds of additional output from 'make'.
2867f29dbc25Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
2868f29dbc25Smrg*the\ am__doit\ target*)
2869f29dbc25Smrg  am__include=include
2870f29dbc25Smrg  am__quote=
2871f29dbc25Smrg  _am_result=GNU
2872f29dbc25Smrg  ;;
2873f29dbc25Smrgesac
2874f29dbc25Smrg# Now try BSD make style include.
2875f29dbc25Smrgif test "$am__include" = "#"; then
2876f29dbc25Smrg   echo '.include "confinc"' > confmf
2877f29dbc25Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
2878f29dbc25Smrg   *the\ am__doit\ target*)
2879f29dbc25Smrg     am__include=.include
2880f29dbc25Smrg     am__quote="\""
2881f29dbc25Smrg     _am_result=BSD
2882f29dbc25Smrg     ;;
2883f29dbc25Smrg   esac
2884f29dbc25Smrgfi
2885f29dbc25SmrgAC_SUBST([am__include])
2886f29dbc25SmrgAC_SUBST([am__quote])
2887f29dbc25SmrgAC_MSG_RESULT([$_am_result])
2888f29dbc25Smrgrm -f confinc confmf
2889f29dbc25Smrg])
2890f29dbc25Smrg
2891f29dbc25Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2892f29dbc25Smrg
289304007ebaSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
2894f29dbc25Smrg#
2895f29dbc25Smrg# This file is free software; the Free Software Foundation
2896f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2897f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2898f29dbc25Smrg
2899f29dbc25Smrg# AM_MISSING_PROG(NAME, PROGRAM)
2900f29dbc25Smrg# ------------------------------
2901f29dbc25SmrgAC_DEFUN([AM_MISSING_PROG],
2902f29dbc25Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2903f29dbc25Smrg$1=${$1-"${am_missing_run}$2"}
2904f29dbc25SmrgAC_SUBST($1)])
2905f29dbc25Smrg
2906f29dbc25Smrg# AM_MISSING_HAS_RUN
2907f29dbc25Smrg# ------------------
290804007ebaSmrg# Define MISSING if not defined so far and test if it is modern enough.
290904007ebaSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
2910f29dbc25SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2911f29dbc25Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2912f29dbc25SmrgAC_REQUIRE_AUX_FILE([missing])dnl
2913f29dbc25Smrgif test x"${MISSING+set}" != xset; then
2914f29dbc25Smrg  case $am_aux_dir in
2915f29dbc25Smrg  *\ * | *\	*)
2916f29dbc25Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2917f29dbc25Smrg  *)
2918f29dbc25Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2919f29dbc25Smrg  esac
2920f29dbc25Smrgfi
2921f29dbc25Smrg# Use eval to expand $SHELL
292204007ebaSmrgif eval "$MISSING --is-lightweight"; then
292304007ebaSmrg  am_missing_run="$MISSING "
2924f29dbc25Smrgelse
2925f29dbc25Smrg  am_missing_run=
292604007ebaSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2927f29dbc25Smrgfi
2928f29dbc25Smrg])
2929f29dbc25Smrg
2930f29dbc25Smrg# Helper functions for option handling.                     -*- Autoconf -*-
2931f29dbc25Smrg
293204007ebaSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2933f29dbc25Smrg#
2934f29dbc25Smrg# This file is free software; the Free Software Foundation
2935f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
2936f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
2937f29dbc25Smrg
2938f29dbc25Smrg# _AM_MANGLE_OPTION(NAME)
2939f29dbc25Smrg# -----------------------
2940f29dbc25SmrgAC_DEFUN([_AM_MANGLE_OPTION],
2941f29dbc25Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2942f29dbc25Smrg
2943f29dbc25Smrg# _AM_SET_OPTION(NAME)
294404007ebaSmrg# --------------------
2945f29dbc25Smrg# Set option NAME.  Presently that only means defining a flag for this option.
2946f29dbc25SmrgAC_DEFUN([_AM_SET_OPTION],
294704007ebaSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2948f29dbc25Smrg
2949f29dbc25Smrg# _AM_SET_OPTIONS(OPTIONS)
295004007ebaSmrg# ------------------------
2951f29dbc25Smrg# OPTIONS is a space-separated list of Automake options.
2952f29dbc25SmrgAC_DEFUN([_AM_SET_OPTIONS],
2953f29dbc25Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2954f29dbc25Smrg
2955f29dbc25Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2956f29dbc25Smrg# -------------------------------------------
2957f29dbc25Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2958f29dbc25SmrgAC_DEFUN([_AM_IF_OPTION],
2959f29dbc25Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2960f29dbc25Smrg
296104007ebaSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
296204007ebaSmrg#
296304007ebaSmrg# This file is free software; the Free Software Foundation
296404007ebaSmrg# gives unlimited permission to copy and/or distribute it,
296504007ebaSmrg# with or without modifications, as long as this notice is preserved.
2966f29dbc25Smrg
296704007ebaSmrg# _AM_PROG_CC_C_O
296804007ebaSmrg# ---------------
296904007ebaSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
297004007ebaSmrg# to automatically call this.
297104007ebaSmrgAC_DEFUN([_AM_PROG_CC_C_O],
297204007ebaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
297304007ebaSmrgAC_REQUIRE_AUX_FILE([compile])dnl
297404007ebaSmrgAC_LANG_PUSH([C])dnl
297504007ebaSmrgAC_CACHE_CHECK(
297604007ebaSmrg  [whether $CC understands -c and -o together],
297704007ebaSmrg  [am_cv_prog_cc_c_o],
297804007ebaSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
297904007ebaSmrg  # Make sure it works both with $CC and with simple cc.
298004007ebaSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
298104007ebaSmrg  # compilers refuse to overwrite an existing .o file with -o,
298204007ebaSmrg  # though they will create one.
298304007ebaSmrg  am_cv_prog_cc_c_o=yes
298404007ebaSmrg  for am_i in 1 2; do
298504007ebaSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
298604007ebaSmrg         && test -f conftest2.$ac_objext; then
298704007ebaSmrg      : OK
298804007ebaSmrg    else
298904007ebaSmrg      am_cv_prog_cc_c_o=no
299004007ebaSmrg      break
299104007ebaSmrg    fi
299204007ebaSmrg  done
299304007ebaSmrg  rm -f core conftest*
299404007ebaSmrg  unset am_i])
299504007ebaSmrgif test "$am_cv_prog_cc_c_o" != yes; then
299604007ebaSmrg   # Losing compiler, so override with the script.
299704007ebaSmrg   # FIXME: It is wrong to rewrite CC.
299804007ebaSmrg   # But if we don't then we get into trouble of one sort or another.
299904007ebaSmrg   # A longer-term fix would be to have automake use am__CC in this case,
300004007ebaSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
300104007ebaSmrg   CC="$am_aux_dir/compile $CC"
300204007ebaSmrgfi
300304007ebaSmrgAC_LANG_POP([C])])
300404007ebaSmrg
300504007ebaSmrg# For backward compatibility.
300604007ebaSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
300704007ebaSmrg
300804007ebaSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
3009f29dbc25Smrg#
3010f29dbc25Smrg# This file is free software; the Free Software Foundation
3011f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3012f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3013f29dbc25Smrg
301404007ebaSmrg# AM_RUN_LOG(COMMAND)
301504007ebaSmrg# -------------------
301604007ebaSmrg# Run COMMAND, save the exit status in ac_status, and log it.
301704007ebaSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
301804007ebaSmrgAC_DEFUN([AM_RUN_LOG],
301904007ebaSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
302004007ebaSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
302104007ebaSmrg   ac_status=$?
302204007ebaSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
302304007ebaSmrg   (exit $ac_status); }])
302404007ebaSmrg
302504007ebaSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
302604007ebaSmrg
302704007ebaSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
302804007ebaSmrg#
302904007ebaSmrg# This file is free software; the Free Software Foundation
303004007ebaSmrg# gives unlimited permission to copy and/or distribute it,
303104007ebaSmrg# with or without modifications, as long as this notice is preserved.
3032f29dbc25Smrg
3033f29dbc25Smrg# AM_SANITY_CHECK
3034f29dbc25Smrg# ---------------
3035f29dbc25SmrgAC_DEFUN([AM_SANITY_CHECK],
3036f29dbc25Smrg[AC_MSG_CHECKING([whether build environment is sane])
3037f29dbc25Smrg# Reject unsafe characters in $srcdir or the absolute working directory
3038f29dbc25Smrg# name.  Accept space and tab only in the latter.
3039f29dbc25Smrgam_lf='
3040f29dbc25Smrg'
3041f29dbc25Smrgcase `pwd` in
3042f29dbc25Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
3043f29dbc25Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
3044f29dbc25Smrgesac
3045f29dbc25Smrgcase $srcdir in
3046f29dbc25Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
304704007ebaSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3048f29dbc25Smrgesac
3049f29dbc25Smrg
305004007ebaSmrg# Do 'set' in a subshell so we don't clobber the current shell's
3051f29dbc25Smrg# arguments.  Must try -L first in case configure is actually a
3052f29dbc25Smrg# symlink; some systems play weird games with the mod time of symlinks
3053f29dbc25Smrg# (eg FreeBSD returns the mod time of the symlink's containing
3054f29dbc25Smrg# directory).
3055f29dbc25Smrgif (
305604007ebaSmrg   am_has_slept=no
305704007ebaSmrg   for am_try in 1 2; do
305804007ebaSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
305904007ebaSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
306004007ebaSmrg     if test "$[*]" = "X"; then
306104007ebaSmrg	# -L didn't work.
306204007ebaSmrg	set X `ls -t "$srcdir/configure" conftest.file`
306304007ebaSmrg     fi
306404007ebaSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
306504007ebaSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
306604007ebaSmrg
306704007ebaSmrg	# If neither matched, then we have a broken ls.  This can happen
306804007ebaSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
306904007ebaSmrg	# broken ls alias from the environment.  This has actually
307004007ebaSmrg	# happened.  Such a system could not be considered "sane".
307104007ebaSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
307204007ebaSmrg  alias in your environment])
307304007ebaSmrg     fi
307404007ebaSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
307504007ebaSmrg       break
307604007ebaSmrg     fi
307704007ebaSmrg     # Just in case.
307804007ebaSmrg     sleep 1
307904007ebaSmrg     am_has_slept=yes
308004007ebaSmrg   done
3081f29dbc25Smrg   test "$[2]" = conftest.file
3082f29dbc25Smrg   )
3083f29dbc25Smrgthen
3084f29dbc25Smrg   # Ok.
3085f29dbc25Smrg   :
3086f29dbc25Smrgelse
3087f29dbc25Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
3088f29dbc25SmrgCheck your system clock])
3089f29dbc25Smrgfi
309004007ebaSmrgAC_MSG_RESULT([yes])
309104007ebaSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
309204007ebaSmrg# generated files are strictly newer.
309304007ebaSmrgam_sleep_pid=
309404007ebaSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
309504007ebaSmrg  ( sleep 1 ) &
309604007ebaSmrg  am_sleep_pid=$!
309704007ebaSmrgfi
309804007ebaSmrgAC_CONFIG_COMMANDS_PRE(
309904007ebaSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
310004007ebaSmrg   if test -n "$am_sleep_pid"; then
310104007ebaSmrg     # Hide warnings about reused PIDs.
310204007ebaSmrg     wait $am_sleep_pid 2>/dev/null
310304007ebaSmrg   fi
310404007ebaSmrg   AC_MSG_RESULT([done])])
310504007ebaSmrgrm -f conftest.file
310604007ebaSmrg])
3107f29dbc25Smrg
310804007ebaSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
3109f29dbc25Smrg#
3110f29dbc25Smrg# This file is free software; the Free Software Foundation
3111f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3112f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3113f29dbc25Smrg
3114f29dbc25Smrg# AM_SILENT_RULES([DEFAULT])
3115f29dbc25Smrg# --------------------------
3116f29dbc25Smrg# Enable less verbose build rules; with the default set to DEFAULT
311704007ebaSmrg# ("yes" being less verbose, "no" or empty being verbose).
3118f29dbc25SmrgAC_DEFUN([AM_SILENT_RULES],
311904007ebaSmrg[AC_ARG_ENABLE([silent-rules], [dnl
312004007ebaSmrgAS_HELP_STRING(
312104007ebaSmrg  [--enable-silent-rules],
312204007ebaSmrg  [less verbose build output (undo: "make V=1")])
312304007ebaSmrgAS_HELP_STRING(
312404007ebaSmrg  [--disable-silent-rules],
312504007ebaSmrg  [verbose build output (undo: "make V=0")])dnl
312604007ebaSmrg])
312704007ebaSmrgcase $enable_silent_rules in @%:@ (((
312804007ebaSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
312904007ebaSmrg   no) AM_DEFAULT_VERBOSITY=1;;
313004007ebaSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3131f29dbc25Smrgesac
313204007ebaSmrgdnl
313304007ebaSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
313404007ebaSmrgdnl do not support nested variable expansions.
313504007ebaSmrgdnl See automake bug#9928 and bug#10237.
313604007ebaSmrgam_make=${MAKE-make}
313704007ebaSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
313804007ebaSmrg   [am_cv_make_support_nested_variables],
313904007ebaSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
314004007ebaSmrgBAR0=false
314104007ebaSmrgBAR1=true
314204007ebaSmrgV=1
314304007ebaSmrgam__doit:
314404007ebaSmrg	@$(TRUE)
314504007ebaSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
314604007ebaSmrg  am_cv_make_support_nested_variables=yes
314704007ebaSmrgelse
314804007ebaSmrg  am_cv_make_support_nested_variables=no
314904007ebaSmrgfi])
315004007ebaSmrgif test $am_cv_make_support_nested_variables = yes; then
315104007ebaSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
315204007ebaSmrg  AM_V='$(V)'
315304007ebaSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
315404007ebaSmrgelse
315504007ebaSmrg  AM_V=$AM_DEFAULT_VERBOSITY
315604007ebaSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
315704007ebaSmrgfi
315804007ebaSmrgAC_SUBST([AM_V])dnl
315904007ebaSmrgAM_SUBST_NOTMAKE([AM_V])dnl
316004007ebaSmrgAC_SUBST([AM_DEFAULT_V])dnl
316104007ebaSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3162f29dbc25SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3163f29dbc25SmrgAM_BACKSLASH='\'
3164f29dbc25SmrgAC_SUBST([AM_BACKSLASH])dnl
3165f29dbc25Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3166f29dbc25Smrg])
3167f29dbc25Smrg
316804007ebaSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
3169f29dbc25Smrg#
3170f29dbc25Smrg# This file is free software; the Free Software Foundation
3171f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3172f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3173f29dbc25Smrg
3174f29dbc25Smrg# AM_PROG_INSTALL_STRIP
3175f29dbc25Smrg# ---------------------
317604007ebaSmrg# One issue with vendor 'install' (even GNU) is that you can't
3177f29dbc25Smrg# specify the program used to strip binaries.  This is especially
3178f29dbc25Smrg# annoying in cross-compiling environments, where the build's strip
3179f29dbc25Smrg# is unlikely to handle the host's binaries.
3180f29dbc25Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
318104007ebaSmrg# always use install-sh in "make install-strip", and initialize
3182f29dbc25Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
3183f29dbc25SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3184f29dbc25Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
318504007ebaSmrg# Installed binaries are usually stripped using 'strip' when the user
318604007ebaSmrg# run "make install-strip".  However 'strip' might not be the right
3187f29dbc25Smrg# tool to use in cross-compilation environments, therefore Automake
318804007ebaSmrg# will honor the 'STRIP' environment variable to overrule this program.
318904007ebaSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3190f29dbc25Smrgif test "$cross_compiling" != no; then
3191f29dbc25Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
3192f29dbc25Smrgfi
3193f29dbc25SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3194f29dbc25SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3195f29dbc25Smrg
319604007ebaSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
3197f29dbc25Smrg#
3198f29dbc25Smrg# This file is free software; the Free Software Foundation
3199f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3200f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3201f29dbc25Smrg
3202f29dbc25Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
3203f29dbc25Smrg# ---------------------------
3204f29dbc25Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3205f29dbc25Smrg# This macro is traced by Automake.
3206f29dbc25SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3207f29dbc25Smrg
3208f29dbc25Smrg# AM_SUBST_NOTMAKE(VARIABLE)
320904007ebaSmrg# --------------------------
3210f29dbc25Smrg# Public sister of _AM_SUBST_NOTMAKE.
3211f29dbc25SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3212f29dbc25Smrg
3213f29dbc25Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3214f29dbc25Smrg
321504007ebaSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
3216f29dbc25Smrg#
3217f29dbc25Smrg# This file is free software; the Free Software Foundation
3218f29dbc25Smrg# gives unlimited permission to copy and/or distribute it,
3219f29dbc25Smrg# with or without modifications, as long as this notice is preserved.
3220f29dbc25Smrg
3221f29dbc25Smrg# _AM_PROG_TAR(FORMAT)
3222f29dbc25Smrg# --------------------
3223f29dbc25Smrg# Check how to create a tarball in format FORMAT.
322404007ebaSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3225f29dbc25Smrg#
3226f29dbc25Smrg# Substitute a variable $(am__tar) that is a command
3227f29dbc25Smrg# writing to stdout a FORMAT-tarball containing the directory
3228f29dbc25Smrg# $tardir.
3229f29dbc25Smrg#     tardir=directory && $(am__tar) > result.tar
3230f29dbc25Smrg#
3231f29dbc25Smrg# Substitute a variable $(am__untar) that extract such
3232f29dbc25Smrg# a tarball read from stdin.
3233f29dbc25Smrg#     $(am__untar) < result.tar
323404007ebaSmrg#
3235f29dbc25SmrgAC_DEFUN([_AM_PROG_TAR],
323604007ebaSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
323704007ebaSmrg# in the wild :-(  We should find a proper way to deprecate it ...
323804007ebaSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
323904007ebaSmrg
324004007ebaSmrg# We'll loop over all known methods to create a tar archive until one works.
3241f29dbc25Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3242f29dbc25Smrg
324304007ebaSmrgm4_if([$1], [v7],
324404007ebaSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
324504007ebaSmrg
324604007ebaSmrg  [m4_case([$1],
324704007ebaSmrg    [ustar],
324804007ebaSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
324904007ebaSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
325004007ebaSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
325104007ebaSmrg      # and bug#13588).
325204007ebaSmrg      am_max_uid=2097151 # 2^21 - 1
325304007ebaSmrg      am_max_gid=$am_max_uid
325404007ebaSmrg      # The $UID and $GID variables are not portable, so we need to resort
325504007ebaSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
325604007ebaSmrg      # below are definitely unexpected, so allow the users to see them
325704007ebaSmrg      # (that is, avoid stderr redirection).
325804007ebaSmrg      am_uid=`id -u || echo unknown`
325904007ebaSmrg      am_gid=`id -g || echo unknown`
326004007ebaSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
326104007ebaSmrg      if test $am_uid -le $am_max_uid; then
326204007ebaSmrg         AC_MSG_RESULT([yes])
326304007ebaSmrg      else
326404007ebaSmrg         AC_MSG_RESULT([no])
326504007ebaSmrg         _am_tools=none
326604007ebaSmrg      fi
326704007ebaSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
326804007ebaSmrg      if test $am_gid -le $am_max_gid; then
326904007ebaSmrg         AC_MSG_RESULT([yes])
327004007ebaSmrg      else
327104007ebaSmrg        AC_MSG_RESULT([no])
327204007ebaSmrg        _am_tools=none
327304007ebaSmrg      fi],
327404007ebaSmrg
327504007ebaSmrg  [pax],
327604007ebaSmrg    [],
3277f29dbc25Smrg
327804007ebaSmrg  [m4_fatal([Unknown tar format])])
327904007ebaSmrg
328004007ebaSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
328104007ebaSmrg
328204007ebaSmrg  # Go ahead even if we have the value already cached.  We do so because we
328304007ebaSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
328404007ebaSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
328504007ebaSmrg
328604007ebaSmrg  for _am_tool in $_am_tools; do
328704007ebaSmrg    case $_am_tool in
328804007ebaSmrg    gnutar)
328904007ebaSmrg      for _am_tar in tar gnutar gtar; do
329004007ebaSmrg        AM_RUN_LOG([$_am_tar --version]) && break
329104007ebaSmrg      done
329204007ebaSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
329304007ebaSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
329404007ebaSmrg      am__untar="$_am_tar -xf -"
329504007ebaSmrg      ;;
329604007ebaSmrg    plaintar)
329704007ebaSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
329804007ebaSmrg      # ustar tarball either.
329904007ebaSmrg      (tar --version) >/dev/null 2>&1 && continue
330004007ebaSmrg      am__tar='tar chf - "$$tardir"'
330104007ebaSmrg      am__tar_='tar chf - "$tardir"'
330204007ebaSmrg      am__untar='tar xf -'
330304007ebaSmrg      ;;
330404007ebaSmrg    pax)
330504007ebaSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
330604007ebaSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
330704007ebaSmrg      am__untar='pax -r'
330804007ebaSmrg      ;;
330904007ebaSmrg    cpio)
331004007ebaSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
331104007ebaSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
331204007ebaSmrg      am__untar='cpio -i -H $1 -d'
331304007ebaSmrg      ;;
331404007ebaSmrg    none)
331504007ebaSmrg      am__tar=false
331604007ebaSmrg      am__tar_=false
331704007ebaSmrg      am__untar=false
331804007ebaSmrg      ;;
331904007ebaSmrg    esac
332004007ebaSmrg
332104007ebaSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
332204007ebaSmrg    # and am__untar set.
332304007ebaSmrg    test -n "${am_cv_prog_tar_$1}" && break
332404007ebaSmrg
332504007ebaSmrg    # tar/untar a dummy directory, and stop if the command works.
332604007ebaSmrg    rm -rf conftest.dir
332704007ebaSmrg    mkdir conftest.dir
332804007ebaSmrg    echo GrepMe > conftest.dir/file
332904007ebaSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
333004007ebaSmrg    rm -rf conftest.dir
333104007ebaSmrg    if test -s conftest.tar; then
333204007ebaSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
333304007ebaSmrg      AM_RUN_LOG([cat conftest.dir/file])
333404007ebaSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
333504007ebaSmrg    fi
333604007ebaSmrg  done
3337f29dbc25Smrg  rm -rf conftest.dir
3338f29dbc25Smrg
333904007ebaSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
334004007ebaSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
334104007ebaSmrg
3342f29dbc25SmrgAC_SUBST([am__tar])
3343f29dbc25SmrgAC_SUBST([am__untar])
3344f29dbc25Smrg]) # _AM_PROG_TAR
3345f29dbc25Smrg
334604007ebaSmrgm4_include([m4/libtool.m4])
334704007ebaSmrgm4_include([m4/ltoptions.m4])
334804007ebaSmrgm4_include([m4/ltsugar.m4])
334904007ebaSmrgm4_include([m4/ltversion.m4])
335004007ebaSmrgm4_include([m4/lt~obsolete.m4])
3351