aclocal.m4 revision f765521f
1f765521fSmrg# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
2f765521fSmrg
3f765521fSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
45dfecf96Smrg
55dfecf96Smrg# This file is free software; the Free Software Foundation
65dfecf96Smrg# gives unlimited permission to copy and/or distribute it,
75dfecf96Smrg# with or without modifications, as long as this notice is preserved.
85dfecf96Smrg
95dfecf96Smrg# This program is distributed in the hope that it will be useful,
105dfecf96Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
115dfecf96Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
125dfecf96Smrg# PARTICULAR PURPOSE.
135dfecf96Smrg
14f765521fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15f14f4646Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f14f4646Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17f765521fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18f765521fSmrg[m4_warning([this file was generated for autoconf 2.69.
19f14f4646SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f14f4646SmrgIf you have problems, you may need to regenerate the build system entirely.
21f765521fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22f14f4646Smrg
23f765521fSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
24f765521fSmrg# serial 1 (pkg-config-0.24)
25f765521fSmrg# 
26f765521fSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
275dfecf96Smrg#
28f765521fSmrg# This program is free software; you can redistribute it and/or modify
29f765521fSmrg# it under the terms of the GNU General Public License as published by
30f765521fSmrg# the Free Software Foundation; either version 2 of the License, or
31f765521fSmrg# (at your option) any later version.
32f765521fSmrg#
33f765521fSmrg# This program is distributed in the hope that it will be useful, but
34f765521fSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
35f765521fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36f765521fSmrg# General Public License for more details.
37f765521fSmrg#
38f765521fSmrg# You should have received a copy of the GNU General Public License
39f765521fSmrg# along with this program; if not, write to the Free Software
40f765521fSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41f765521fSmrg#
42f765521fSmrg# As a special exception to the GNU General Public License, if you
43f765521fSmrg# distribute this file as part of a program that contains a
44f765521fSmrg# configuration script generated by Autoconf, you may include it under
45f765521fSmrg# the same distribution terms that you use for the rest of that program.
4631de2854Smrg
47f765521fSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
48f765521fSmrg# ----------------------------------
49f765521fSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
50f765521fSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
51f765521fSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
52f765521fSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
53f765521fSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
54f765521fSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
55f765521fSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
565dfecf96Smrg
57f765521fSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
58f765521fSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
59f765521fSmrgfi
60f765521fSmrgif test -n "$PKG_CONFIG"; then
61f765521fSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
62f765521fSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
63f765521fSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
64f765521fSmrg		AC_MSG_RESULT([yes])
65f765521fSmrg	else
66f765521fSmrg		AC_MSG_RESULT([no])
67f765521fSmrg		PKG_CONFIG=""
68f765521fSmrg	fi
69f765521fSmrgfi[]dnl
70f765521fSmrg])# PKG_PROG_PKG_CONFIG
715dfecf96Smrg
72f765521fSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
73f765521fSmrg#
74f765521fSmrg# Check to see whether a particular set of modules exists.  Similar
75f765521fSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
76f765521fSmrg#
77f765521fSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
78f765521fSmrg# only at the first occurence in configure.ac, so if the first place
79f765521fSmrg# it's called might be skipped (such as if it is within an "if", you
80f765521fSmrg# have to call PKG_CHECK_EXISTS manually
81f765521fSmrg# --------------------------------------------------------------
82f765521fSmrgAC_DEFUN([PKG_CHECK_EXISTS],
83f765521fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84f765521fSmrgif test -n "$PKG_CONFIG" && \
85f765521fSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
86f765521fSmrg  m4_default([$2], [:])
87f765521fSmrgm4_ifvaln([$3], [else
88f765521fSmrg  $3])dnl
89f765521fSmrgfi])
905dfecf96Smrg
91f765521fSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
92f765521fSmrg# ---------------------------------------------
93f765521fSmrgm4_define([_PKG_CONFIG],
94f765521fSmrg[if test -n "$$1"; then
95f765521fSmrg    pkg_cv_[]$1="$$1"
96f765521fSmrg elif test -n "$PKG_CONFIG"; then
97f765521fSmrg    PKG_CHECK_EXISTS([$3],
98f765521fSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
99f765521fSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
100f765521fSmrg		     [pkg_failed=yes])
101f765521fSmrg else
102f765521fSmrg    pkg_failed=untried
103f765521fSmrgfi[]dnl
104f765521fSmrg])# _PKG_CONFIG
1055dfecf96Smrg
106f765521fSmrg# _PKG_SHORT_ERRORS_SUPPORTED
107f765521fSmrg# -----------------------------
108f765521fSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
109f765521fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110f765521fSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
111f765521fSmrg        _pkg_short_errors_supported=yes
112f765521fSmrgelse
113f765521fSmrg        _pkg_short_errors_supported=no
114f765521fSmrgfi[]dnl
115f765521fSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1165dfecf96Smrg
11731de2854Smrg
118f765521fSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
119f765521fSmrg# [ACTION-IF-NOT-FOUND])
1205dfecf96Smrg#
1215dfecf96Smrg#
122f765521fSmrg# Note that if there is a possibility the first call to
123f765521fSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
124f765521fSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1255dfecf96Smrg#
126c05e22d7Smrg#
127f765521fSmrg# --------------------------------------------------------------
128f765521fSmrgAC_DEFUN([PKG_CHECK_MODULES],
129f765521fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
130f765521fSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
131f765521fSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1325dfecf96Smrg
133f765521fSmrgpkg_failed=no
134f765521fSmrgAC_MSG_CHECKING([for $1])
1355dfecf96Smrg
136f765521fSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
137f765521fSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1385dfecf96Smrg
139f765521fSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
140f765521fSmrgand $1[]_LIBS to avoid the need to call pkg-config.
141f765521fSmrgSee the pkg-config man page for more details.])
1425dfecf96Smrg
143f765521fSmrgif test $pkg_failed = yes; then
144f765521fSmrg   	AC_MSG_RESULT([no])
145f765521fSmrg        _PKG_SHORT_ERRORS_SUPPORTED
146f765521fSmrg        if test $_pkg_short_errors_supported = yes; then
147f765521fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
148f765521fSmrg        else 
149f765521fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
150f765521fSmrg        fi
151f765521fSmrg	# Put the nasty error message in config.log where it belongs
152f765521fSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1535dfecf96Smrg
154f765521fSmrg	m4_default([$4], [AC_MSG_ERROR(
155f765521fSmrg[Package requirements ($2) were not met:
1565dfecf96Smrg
157f765521fSmrg$$1_PKG_ERRORS
1585dfecf96Smrg
159f765521fSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
160f765521fSmrginstalled software in a non-standard prefix.
1615dfecf96Smrg
162f765521fSmrg_PKG_TEXT])[]dnl
163f765521fSmrg        ])
164f765521fSmrgelif test $pkg_failed = untried; then
165f765521fSmrg     	AC_MSG_RESULT([no])
166f765521fSmrg	m4_default([$4], [AC_MSG_FAILURE(
167f765521fSmrg[The pkg-config script could not be found or is too old.  Make sure it
168f765521fSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
169f765521fSmrgpath to pkg-config.
1705dfecf96Smrg
171f765521fSmrg_PKG_TEXT
1725dfecf96Smrg
173f765521fSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
174f765521fSmrg        ])
175f765521fSmrgelse
176f765521fSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
177f765521fSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
178f765521fSmrg        AC_MSG_RESULT([yes])
179f765521fSmrg	$3
180f765521fSmrgfi[]dnl
181f765521fSmrg])# PKG_CHECK_MODULES
1825dfecf96Smrg
1835dfecf96Smrg
184f765521fSmrg# PKG_INSTALLDIR(DIRECTORY)
185f765521fSmrg# -------------------------
186f765521fSmrg# Substitutes the variable pkgconfigdir as the location where a module
187f765521fSmrg# should install pkg-config .pc files. By default the directory is
188f765521fSmrg# $libdir/pkgconfig, but the default can be changed by passing
189f765521fSmrg# DIRECTORY. The user can override through the --with-pkgconfigdir
190f765521fSmrg# parameter.
191f765521fSmrgAC_DEFUN([PKG_INSTALLDIR],
192f765521fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
193f765521fSmrgm4_pushdef([pkg_description],
194f765521fSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
195f765521fSmrgAC_ARG_WITH([pkgconfigdir],
196f765521fSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
197f765521fSmrg    [with_pkgconfigdir=]pkg_default)
198f765521fSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
199f765521fSmrgm4_popdef([pkg_default])
200f765521fSmrgm4_popdef([pkg_description])
201f765521fSmrg]) dnl PKG_INSTALLDIR
202f765521fSmrg
203f765521fSmrg
204f765521fSmrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
205f765521fSmrg# -------------------------
206f765521fSmrg# Substitutes the variable noarch_pkgconfigdir as the location where a
207f765521fSmrg# module should install arch-independent pkg-config .pc files. By
208f765521fSmrg# default the directory is $datadir/pkgconfig, but the default can be
209f765521fSmrg# changed by passing DIRECTORY. The user can override through the
210f765521fSmrg# --with-noarch-pkgconfigdir parameter.
211f765521fSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
212f765521fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
213f765521fSmrgm4_pushdef([pkg_description],
214f765521fSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
215f765521fSmrgAC_ARG_WITH([noarch-pkgconfigdir],
216f765521fSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
217f765521fSmrg    [with_noarch_pkgconfigdir=]pkg_default)
218f765521fSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
219f765521fSmrgm4_popdef([pkg_default])
220f765521fSmrgm4_popdef([pkg_description])
221f765521fSmrg]) dnl PKG_NOARCH_INSTALLDIR
222f765521fSmrg
223f765521fSmrg
224f765521fSmrg# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
225f765521fSmrg# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
226f765521fSmrg# -------------------------------------------
227f765521fSmrg# Retrieves the value of the pkg-config variable for the given module.
228f765521fSmrgAC_DEFUN([PKG_CHECK_VAR],
229f765521fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
230f765521fSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2315dfecf96Smrg
232f765521fSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
233f765521fSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2345dfecf96Smrg
235f765521fSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
236f765521fSmrg])# PKG_CHECK_VAR
2375dfecf96Smrg
238f765521fSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
239f765521fSmrgdnl
240f765521fSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
241f765521fSmrgdnl
242f765521fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
243f765521fSmrgdnl copy of this software and associated documentation files (the "Software"),
244f765521fSmrgdnl to deal in the Software without restriction, including without limitation
245f765521fSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
246f765521fSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
247f765521fSmrgdnl Software is furnished to do so, subject to the following conditions:
248f765521fSmrgdnl
249f765521fSmrgdnl The above copyright notice and this permission notice (including the next
250f765521fSmrgdnl paragraph) shall be included in all copies or substantial portions of the
251f765521fSmrgdnl Software.
252f765521fSmrgdnl
253f765521fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
254f765521fSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
255f765521fSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
256f765521fSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
257f765521fSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
258f765521fSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
259f765521fSmrgdnl DEALINGS IN THE SOFTWARE.
2605dfecf96Smrg
261f765521fSmrg# XORG_MACROS_VERSION(required-version)
262f765521fSmrg# -------------------------------------
263f765521fSmrg# Minimum version: 1.1.0
264f765521fSmrg#
265f765521fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
266f765521fSmrg# your configure.ac with the minimum required version, such as:
267f765521fSmrg# XORG_MACROS_VERSION(1.1)
268f765521fSmrg#
269f765521fSmrg# To ensure that this macro is defined, also add:
270f765521fSmrg# m4_ifndef([XORG_MACROS_VERSION],
271f765521fSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
272f765521fSmrg#
273f765521fSmrg#
274f765521fSmrg# See the "minimum version" comment for each macro you use to see what
275f765521fSmrg# version you require.
276f765521fSmrgm4_defun([XORG_MACROS_VERSION],[
277f765521fSmrgm4_define([vers_have], [1.19.0])
278f765521fSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
279f765521fSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
280f765521fSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
281f765521fSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
282f765521fSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
283f765521fSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
284f765521fSmrgm4_undefine([vers_have])
285f765521fSmrgm4_undefine([maj_have])
286f765521fSmrgm4_undefine([maj_needed])
287f765521fSmrg]) # XORG_MACROS_VERSION
288f765521fSmrg
289f765521fSmrg# XORG_PROG_RAWCPP()
290f765521fSmrg# ------------------
291f765521fSmrg# Minimum version: 1.0.0
292f765521fSmrg#
293f765521fSmrg# Find cpp program and necessary flags for use in pre-processing text files
294f765521fSmrg# such as man pages and config files
295f765521fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
296f765521fSmrgAC_REQUIRE([AC_PROG_CPP])
297f765521fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
298f765521fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
299f765521fSmrg
300f765521fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
301f765521fSmrg# which is not the best choice for supporting other OS'es, but covers most
302f765521fSmrg# of the ones we need for now.
303f765521fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
304f765521fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
305f765521fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
306f765521fSmrg	AC_MSG_RESULT([no])
307c05e22d7Smrgelse
308f765521fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
309f765521fSmrg		RAWCPPFLAGS=-undef
310f765521fSmrg		AC_MSG_RESULT([yes])
311f765521fSmrg	# under Cygwin unix is still defined even with -undef
312f765521fSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
313f765521fSmrg		RAWCPPFLAGS="-undef -ansi"
314f765521fSmrg		AC_MSG_RESULT([yes, with -ansi])
315f765521fSmrg	else
316f765521fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
317f765521fSmrg	fi
3185dfecf96Smrgfi
319f765521fSmrgrm -f conftest.$ac_ext
3205dfecf96Smrg
321f765521fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
322f765521fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
323f765521fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
324f765521fSmrg	AC_MSG_RESULT([no])
325f765521fSmrgelse
326f765521fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
327f765521fSmrg		TRADITIONALCPPFLAGS="-traditional"
328f765521fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
329f765521fSmrg		AC_MSG_RESULT([yes])
330f765521fSmrg	else
331f765521fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
332f765521fSmrg	fi
333f765521fSmrgfi
334f765521fSmrgrm -f conftest.$ac_ext
335f765521fSmrgAC_SUBST(RAWCPPFLAGS)
336f765521fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
337f765521fSmrg]) # XORG_PROG_RAWCPP
3385dfecf96Smrg
339f765521fSmrg# XORG_MANPAGE_SECTIONS()
340f765521fSmrg# -----------------------
341f765521fSmrg# Minimum version: 1.0.0
342f765521fSmrg#
343f765521fSmrg# Determine which sections man pages go in for the different man page types
344f765521fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
345f765521fSmrg# Not sure if there's any better way than just hardcoding by OS name.
346f765521fSmrg# Override default settings by setting environment variables
347f765521fSmrg# Added MAN_SUBSTS in version 1.8
348f765521fSmrg# Added AC_PROG_SED in version 1.8
3495dfecf96Smrg
350f765521fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
351f765521fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
352f765521fSmrgAC_REQUIRE([AC_PROG_SED])
3535dfecf96Smrg
354f765521fSmrgif test x$APP_MAN_SUFFIX = x    ; then
355f765521fSmrg    APP_MAN_SUFFIX=1
356f765521fSmrgfi
357f765521fSmrgif test x$APP_MAN_DIR = x    ; then
358f765521fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
3595dfecf96Smrgfi
3605dfecf96Smrg
361f765521fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
362f765521fSmrg    LIB_MAN_SUFFIX=3
363f765521fSmrgfi
364f765521fSmrgif test x$LIB_MAN_DIR = x    ; then
365f765521fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
366f765521fSmrgfi
3675dfecf96Smrg
368f765521fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
369f765521fSmrg    case $host_os in
370f765521fSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
371f765521fSmrg	*)		FILE_MAN_SUFFIX=5  ;;
372f765521fSmrg    esac
373f765521fSmrgfi
374f765521fSmrgif test x$FILE_MAN_DIR = x    ; then
375f765521fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
376f765521fSmrgfi
3775dfecf96Smrg
378f765521fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
379f765521fSmrg    case $host_os in
380f765521fSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
381f765521fSmrg	*)		MISC_MAN_SUFFIX=7  ;;
382f765521fSmrg    esac
383f765521fSmrgfi
384f765521fSmrgif test x$MISC_MAN_DIR = x    ; then
385f765521fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
386f765521fSmrgfi
3875dfecf96Smrg
388f765521fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
389f765521fSmrg    case $host_os in
390f765521fSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
391f765521fSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
392f765521fSmrg    esac
393f765521fSmrgfi
394f765521fSmrgif test x$DRIVER_MAN_DIR = x    ; then
395f765521fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
396f765521fSmrgfi
397c05e22d7Smrg
398f765521fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
399f765521fSmrg    case $host_os in
400f765521fSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
401f765521fSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
402f765521fSmrg    esac
403f765521fSmrgfi
404f765521fSmrgif test x$ADMIN_MAN_DIR = x    ; then
405f765521fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
406f765521fSmrgfi
407c05e22d7Smrg
408f14f4646Smrg
409f765521fSmrgAC_SUBST([APP_MAN_SUFFIX])
410f765521fSmrgAC_SUBST([LIB_MAN_SUFFIX])
411f765521fSmrgAC_SUBST([FILE_MAN_SUFFIX])
412f765521fSmrgAC_SUBST([MISC_MAN_SUFFIX])
413f765521fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
414f765521fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
415f765521fSmrgAC_SUBST([APP_MAN_DIR])
416f765521fSmrgAC_SUBST([LIB_MAN_DIR])
417f765521fSmrgAC_SUBST([FILE_MAN_DIR])
418f765521fSmrgAC_SUBST([MISC_MAN_DIR])
419f765521fSmrgAC_SUBST([DRIVER_MAN_DIR])
420f765521fSmrgAC_SUBST([ADMIN_MAN_DIR])
4215dfecf96Smrg
422f765521fSmrgXORG_MAN_PAGE="X Version 11"
423f765521fSmrgAC_SUBST([XORG_MAN_PAGE])
424f765521fSmrgMAN_SUBSTS="\
425f765521fSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
426f765521fSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
427f765521fSmrg	-e 's|__xservername__|Xorg|g' \
428f765521fSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
429f765521fSmrg	-e 's|__projectroot__|\$(prefix)|g' \
430f765521fSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
431f765521fSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
432f765521fSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
433f765521fSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
434f765521fSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
435f765521fSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
436f765521fSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
437f765521fSmrgAC_SUBST([MAN_SUBSTS])
4385dfecf96Smrg
439f765521fSmrg]) # XORG_MANPAGE_SECTIONS
4405dfecf96Smrg
441f765521fSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
442f765521fSmrg# ------------------------
443f765521fSmrg# Minimum version: 1.7.0
444f765521fSmrg#
445f765521fSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
446f765521fSmrg# provided by xorg-sgml-doctools, if installed.
447f765521fSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
448f765521fSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
449f765521fSmrgXORG_SGML_PATH=
450f765521fSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
451f765521fSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
452f765521fSmrg    [m4_ifval([$1],[:],
453f765521fSmrg        [if test x"$cross_compiling" != x"yes" ; then
454f765521fSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
455f765521fSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
456f765521fSmrg         fi])
457f765521fSmrg    ])
4585dfecf96Smrg
459f765521fSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
460f765521fSmrg# the path and the name of the doc stylesheet
461f765521fSmrgif test "x$XORG_SGML_PATH" != "x" ; then
462f765521fSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
463f765521fSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
464f765521fSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
465f765521fSmrgelse
466f765521fSmrg   AC_MSG_RESULT([no])
4675dfecf96Smrgfi
4685dfecf96Smrg
469f765521fSmrgAC_SUBST(XORG_SGML_PATH)
470f765521fSmrgAC_SUBST(STYLESHEET_SRCDIR)
471f765521fSmrgAC_SUBST(XSL_STYLESHEET)
472f765521fSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
473f765521fSmrg]) # XORG_CHECK_SGML_DOCTOOLS
4745dfecf96Smrg
475f765521fSmrg# XORG_CHECK_LINUXDOC
476f765521fSmrg# -------------------
477f765521fSmrg# Minimum version: 1.0.0
478f765521fSmrg#
479f765521fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
480f765521fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
481f765521fSmrg# Whether or not the necessary tools and files are found can be checked
482f765521fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
483f765521fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
484f765521fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
485f765521fSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
4865dfecf96Smrg
487f765521fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
4885dfecf96Smrg
489f765521fSmrgAC_MSG_CHECKING([whether to build documentation])
4905dfecf96Smrg
491f765521fSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
492f765521fSmrg   BUILDDOC=yes
493f765521fSmrgelse
494f765521fSmrg   BUILDDOC=no
495f765521fSmrgfi
496f14f4646Smrg
497f765521fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
498f14f4646Smrg
499f765521fSmrgAC_MSG_RESULT([$BUILDDOC])
500f14f4646Smrg
501f765521fSmrgAC_MSG_CHECKING([whether to build pdf documentation])
502f14f4646Smrg
503f765521fSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
504f765521fSmrg   BUILDPDFDOC=yes
505f765521fSmrgelse
506f765521fSmrg   BUILDPDFDOC=no
507f765521fSmrgfi
508f14f4646Smrg
509f765521fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
51031de2854Smrg
511f765521fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
512f14f4646Smrg
513f765521fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
514f765521fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
515f765521fSmrgMAKE_PDF="$PS2PDF"
516f765521fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
517f14f4646Smrg
518f765521fSmrgAC_SUBST(MAKE_TEXT)
519f765521fSmrgAC_SUBST(MAKE_PS)
520f765521fSmrgAC_SUBST(MAKE_PDF)
521f765521fSmrgAC_SUBST(MAKE_HTML)
522f765521fSmrg]) # XORG_CHECK_LINUXDOC
523c05e22d7Smrg
524f765521fSmrg# XORG_CHECK_DOCBOOK
525f765521fSmrg# -------------------
526f765521fSmrg# Minimum version: 1.0.0
527f14f4646Smrg#
528f765521fSmrg# Checks for the ability to build output formats from SGML DocBook source.
529f765521fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
530f765521fSmrg# indicates whether the necessary tools and files are found and, if set,
531f765521fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
532f765521fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
533f765521fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
5345dfecf96Smrg
535f765521fSmrgBUILDTXTDOC=no
536f765521fSmrgBUILDPDFDOC=no
537f765521fSmrgBUILDPSDOC=no
538f765521fSmrgBUILDHTMLDOC=no
539c05e22d7Smrg
540f765521fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
541f765521fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
542f765521fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
543f765521fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
544f14f4646Smrg
545f765521fSmrgAC_MSG_CHECKING([whether to build text documentation])
546f765521fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
547f765521fSmrg   test x$BUILD_TXTDOC != xno; then
548f765521fSmrg	BUILDTXTDOC=yes
549f765521fSmrgfi
550f765521fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
551f765521fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
552c05e22d7Smrg
553f765521fSmrgAC_MSG_CHECKING([whether to build PDF documentation])
554f765521fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
555f765521fSmrg   test x$BUILD_PDFDOC != xno; then
556f765521fSmrg	BUILDPDFDOC=yes
557f14f4646Smrgfi
558f765521fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
559f765521fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
560f14f4646Smrg
561f765521fSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
562f765521fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
563f765521fSmrg   test x$BUILD_PSDOC != xno; then
564f765521fSmrg	BUILDPSDOC=yes
565f765521fSmrgfi
566f765521fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
567f765521fSmrgAC_MSG_RESULT([$BUILDPSDOC])
568f14f4646Smrg
569f765521fSmrgAC_MSG_CHECKING([whether to build HTML documentation])
570f765521fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
571f765521fSmrg   test x$BUILD_HTMLDOC != xno; then
572f765521fSmrg	BUILDHTMLDOC=yes
573f765521fSmrgfi
574f765521fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
575f765521fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
576f14f4646Smrg
577f765521fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
578f765521fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
579f765521fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
580f765521fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
581c05e22d7Smrg
582f765521fSmrgAC_SUBST(MAKE_TEXT)
583f765521fSmrgAC_SUBST(MAKE_PS)
584f765521fSmrgAC_SUBST(MAKE_PDF)
585f765521fSmrgAC_SUBST(MAKE_HTML)
586f765521fSmrg]) # XORG_CHECK_DOCBOOK
587c05e22d7Smrg
588f765521fSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
589f765521fSmrg# ----------------
590f765521fSmrg# Minimum version: 1.5.0
591f765521fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
592f14f4646Smrg#
593f765521fSmrg# Documentation tools are not always available on all platforms and sometimes
594f765521fSmrg# not at the appropriate level. This macro enables a module to test for the
595f765521fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
596f765521fSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
597f765521fSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
598f765521fSmrg# --with-xmlto assumes 'auto'.
599f765521fSmrg#
600f765521fSmrg# Interface to module:
601f765521fSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
602f765521fSmrg# XMLTO:	returns the path of the xmlto program found
603f765521fSmrg#		returns the path set by the user in the environment
604f765521fSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
605f765521fSmrg#		'no' user instructs the module not to use xmlto
606f765521fSmrg#
607f765521fSmrg# Added in version 1.10.0
608f765521fSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
609f765521fSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
610f765521fSmrg#
611f765521fSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
612f765521fSmrg#
613f765521fSmrgAC_DEFUN([XORG_WITH_XMLTO],[
614f765521fSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
615f765521fSmrgm4_define([_defopt], m4_default([$2], [auto]))
616f765521fSmrgAC_ARG_WITH(xmlto,
617f765521fSmrg	AS_HELP_STRING([--with-xmlto],
618f765521fSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
619f765521fSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
620f765521fSmrgm4_undefine([_defopt])
6215dfecf96Smrg
622f765521fSmrgif test "x$use_xmlto" = x"auto"; then
623f765521fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
624f765521fSmrg   if test "x$XMLTO" = "x"; then
625f765521fSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
626f765521fSmrg	have_xmlto=no
627f765521fSmrg   else
628f765521fSmrg        have_xmlto=yes
629f765521fSmrg   fi
630f765521fSmrgelif test "x$use_xmlto" = x"yes" ; then
631f765521fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
632f765521fSmrg   if test "x$XMLTO" = "x"; then
633f765521fSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
634f765521fSmrg   fi
635f765521fSmrg   have_xmlto=yes
636f765521fSmrgelif test "x$use_xmlto" = x"no" ; then
637f765521fSmrg   if test "x$XMLTO" != "x"; then
638f765521fSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
639f765521fSmrg   fi
640f765521fSmrg   have_xmlto=no
641c05e22d7Smrgelse
642f765521fSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
643c05e22d7Smrgfi
6445dfecf96Smrg
645f765521fSmrg# Test for a minimum version of xmlto, if provided.
646f765521fSmrgm4_ifval([$1],
647f765521fSmrg[if test "$have_xmlto" = yes; then
648f765521fSmrg    # scrape the xmlto version
649f765521fSmrg    AC_MSG_CHECKING([the xmlto version])
650f765521fSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
651f765521fSmrg    AC_MSG_RESULT([$xmlto_version])
652f765521fSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
653f765521fSmrg        [if test "x$use_xmlto" = xauto; then
654f765521fSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
655f765521fSmrg            have_xmlto=no
656f765521fSmrg        else
657f765521fSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
658f765521fSmrg        fi])
659f765521fSmrgfi])
66031de2854Smrg
661f765521fSmrg# Test for the ability of xmlto to generate a text target
662f765521fSmrghave_xmlto_text=no
663f765521fSmrgcat > conftest.xml << "EOF"
664f765521fSmrgEOF
665f765521fSmrgAS_IF([test "$have_xmlto" = yes],
666f765521fSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
667f765521fSmrg             [have_xmlto_text=yes],
668f765521fSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
669f765521fSmrgrm -f conftest.xml
670f765521fSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
671f765521fSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
672f765521fSmrg]) # XORG_WITH_XMLTO
673f14f4646Smrg
674f765521fSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
675f765521fSmrg# --------------------------------------------
676f765521fSmrg# Minimum version: 1.12.0
677f765521fSmrg# Minimum version for optional DEFAULT argument: 1.12.0
6785dfecf96Smrg#
679f765521fSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
680f765521fSmrg# XML-based language used for the transformation of XML documents.
681f765521fSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
682f765521fSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
683f765521fSmrg# The XSLT processor is often used as a standalone tool for transformations.
684f765521fSmrg# It should not be assumed that this tool is used only to work with documnetation.
685f765521fSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
6865dfecf96Smrg#
687f765521fSmrg# Interface to module:
688f765521fSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
689f765521fSmrg# XSLTPROC:	 returns the path of the xsltproc program found
690f765521fSmrg#		 returns the path set by the user in the environment
691f765521fSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
692f765521fSmrg#		  'no' user instructs the module not to use xsltproc
693f765521fSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
694f765521fSmrg#
695f765521fSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
696f765521fSmrg#
697f765521fSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
698f765521fSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
699f765521fSmrg# Preserves the interface, should it be implemented later
700f765521fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
701f765521fSmrgm4_define([_defopt], m4_default([$2], [auto]))
702f765521fSmrgAC_ARG_WITH(xsltproc,
703f765521fSmrg	AS_HELP_STRING([--with-xsltproc],
704f765521fSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
705f765521fSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
706f765521fSmrgm4_undefine([_defopt])
707c05e22d7Smrg
708f765521fSmrgif test "x$use_xsltproc" = x"auto"; then
709f765521fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
710f765521fSmrg   if test "x$XSLTPROC" = "x"; then
711f765521fSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
712f765521fSmrg	have_xsltproc=no
713f765521fSmrg   else
714f765521fSmrg        have_xsltproc=yes
715f765521fSmrg   fi
716f765521fSmrgelif test "x$use_xsltproc" = x"yes" ; then
717f765521fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
718f765521fSmrg   if test "x$XSLTPROC" = "x"; then
719f765521fSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
720c05e22d7Smrg   fi
721f765521fSmrg   have_xsltproc=yes
722f765521fSmrgelif test "x$use_xsltproc" = x"no" ; then
723f765521fSmrg   if test "x$XSLTPROC" != "x"; then
724f765521fSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
725c05e22d7Smrg   fi
726f765521fSmrg   have_xsltproc=no
7275dfecf96Smrgelse
728f765521fSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
7295dfecf96Smrgfi
7305dfecf96Smrg
731f765521fSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
732f765521fSmrg]) # XORG_WITH_XSLTPROC
7335dfecf96Smrg
734f765521fSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
735f765521fSmrg# ----------------------------------------
736f765521fSmrg# Minimum version: 1.15.0
737c05e22d7Smrg#
738f765521fSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
739f765521fSmrg# scanning arbitrary text files, extracting information from those text files,
740f765521fSmrg# and printing reports based on that information.
7415dfecf96Smrg#
742f765521fSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
743c05e22d7Smrg#
744f765521fSmrg# Interface to module:
745f765521fSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
746f765521fSmrg# PERL:	     returns the path of the perl program found
747f765521fSmrg#	     returns the path set by the user in the environment
748f765521fSmrg# --with-perl: 'yes' user instructs the module to use perl
749f765521fSmrg#	       'no' user instructs the module not to use perl
750f765521fSmrg# have_perl: returns yes if perl found in PATH or no
751c05e22d7Smrg#
752f765521fSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
753c05e22d7Smrg#
754f765521fSmrgAC_DEFUN([XORG_WITH_PERL],[
755f765521fSmrgAC_ARG_VAR([PERL], [Path to perl command])
756f765521fSmrg# Preserves the interface, should it be implemented later
757f765521fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
758f765521fSmrgm4_define([_defopt], m4_default([$2], [auto]))
759f765521fSmrgAC_ARG_WITH(perl,
760f765521fSmrg	AS_HELP_STRING([--with-perl],
761f765521fSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
762f765521fSmrg	   [use_perl=$withval], [use_perl=]_defopt)
763f765521fSmrgm4_undefine([_defopt])
764c05e22d7Smrg
765f765521fSmrgif test "x$use_perl" = x"auto"; then
766f765521fSmrg   AC_PATH_PROG([PERL], [perl])
767f765521fSmrg   if test "x$PERL" = "x"; then
768f765521fSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
769f765521fSmrg	have_perl=no
770f765521fSmrg   else
771f765521fSmrg        have_perl=yes
772f765521fSmrg   fi
773f765521fSmrgelif test "x$use_perl" = x"yes" ; then
774f765521fSmrg   AC_PATH_PROG([PERL], [perl])
775f765521fSmrg   if test "x$PERL" = "x"; then
776f765521fSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
777f765521fSmrg   fi
778f765521fSmrg   have_perl=yes
779f765521fSmrgelif test "x$use_perl" = x"no" ; then
780f765521fSmrg   if test "x$PERL" != "x"; then
781f765521fSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
782f765521fSmrg   fi
783f765521fSmrg   have_perl=no
784f765521fSmrgelse
785f765521fSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
786f765521fSmrgfi
787c05e22d7Smrg
788f765521fSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
789f765521fSmrg]) # XORG_WITH_PERL
790c05e22d7Smrg
791f765521fSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
792f765521fSmrg# ----------------
793f765521fSmrg# Minimum version: 1.5.0
794f765521fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
79531de2854Smrg#
796f765521fSmrg# Documentation tools are not always available on all platforms and sometimes
797f765521fSmrg# not at the appropriate level. This macro enables a module to test for the
798f765521fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
799f765521fSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
800f765521fSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
801f765521fSmrg# --with-asciidoc assumes 'auto'.
80231de2854Smrg#
803f765521fSmrg# Interface to module:
804f765521fSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
805f765521fSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
806f765521fSmrg#		 returns the path set by the user in the environment
807f765521fSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
808f765521fSmrg#		  'no' user instructs the module not to use asciidoc
80931de2854Smrg#
810f765521fSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
81131de2854Smrg#
812f765521fSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
813f765521fSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
814f765521fSmrgm4_define([_defopt], m4_default([$2], [auto]))
815f765521fSmrgAC_ARG_WITH(asciidoc,
816f765521fSmrg	AS_HELP_STRING([--with-asciidoc],
817f765521fSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
818f765521fSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
819f765521fSmrgm4_undefine([_defopt])
82031de2854Smrg
821f765521fSmrgif test "x$use_asciidoc" = x"auto"; then
822f765521fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
823f765521fSmrg   if test "x$ASCIIDOC" = "x"; then
824f765521fSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
825f765521fSmrg	have_asciidoc=no
826f765521fSmrg   else
827f765521fSmrg        have_asciidoc=yes
828f765521fSmrg   fi
829f765521fSmrgelif test "x$use_asciidoc" = x"yes" ; then
830f765521fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
831f765521fSmrg   if test "x$ASCIIDOC" = "x"; then
832f765521fSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
833f765521fSmrg   fi
834f765521fSmrg   have_asciidoc=yes
835f765521fSmrgelif test "x$use_asciidoc" = x"no" ; then
836f765521fSmrg   if test "x$ASCIIDOC" != "x"; then
837f765521fSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
838f765521fSmrg   fi
839f765521fSmrg   have_asciidoc=no
840f765521fSmrgelse
841f765521fSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
84231de2854Smrgfi
843f765521fSmrgm4_ifval([$1],
844f765521fSmrg[if test "$have_asciidoc" = yes; then
845f765521fSmrg    # scrape the asciidoc version
846f765521fSmrg    AC_MSG_CHECKING([the asciidoc version])
847f765521fSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
848f765521fSmrg    AC_MSG_RESULT([$asciidoc_version])
849f765521fSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
850f765521fSmrg        [if test "x$use_asciidoc" = xauto; then
851f765521fSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
852f765521fSmrg            have_asciidoc=no
853f765521fSmrg        else
854f765521fSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
855f765521fSmrg        fi])
856f765521fSmrgfi])
857f765521fSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
858f765521fSmrg]) # XORG_WITH_ASCIIDOC
85931de2854Smrg
860f765521fSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
861f765521fSmrg# -------------------------------------------
862f765521fSmrg# Minimum version: 1.5.0
863f765521fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
864f765521fSmrg# Minimum version for optional DOT checking: 1.18.0
86531de2854Smrg#
866f765521fSmrg# Documentation tools are not always available on all platforms and sometimes
867f765521fSmrg# not at the appropriate level. This macro enables a module to test for the
868f765521fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
869f765521fSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
870f765521fSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
871f765521fSmrg# --with-doxygen assumes 'auto'.
87231de2854Smrg#
873f765521fSmrg# Interface to module:
874f765521fSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
875f765521fSmrg# DOXYGEN:	 returns the path of the doxygen program found
876f765521fSmrg#		 returns the path set by the user in the environment
877f765521fSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
878f765521fSmrg#		  'no' user instructs the module not to use doxygen
87931de2854Smrg#
880f765521fSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
881f765521fSmrg#
882f765521fSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
883f765521fSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
884f765521fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
885f765521fSmrgm4_define([_defopt], m4_default([$2], [auto]))
886f765521fSmrgAC_ARG_WITH(doxygen,
887f765521fSmrg	AS_HELP_STRING([--with-doxygen],
888f765521fSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
889f765521fSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
890f765521fSmrgm4_undefine([_defopt])
89131de2854Smrg
892f765521fSmrgif test "x$use_doxygen" = x"auto"; then
893f765521fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
894f765521fSmrg   if test "x$DOXYGEN" = "x"; then
895f765521fSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
896f765521fSmrg	have_doxygen=no
897f765521fSmrg   else
898f765521fSmrg        have_doxygen=yes
899f765521fSmrg   fi
900f765521fSmrgelif test "x$use_doxygen" = x"yes" ; then
901f765521fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
902f765521fSmrg   if test "x$DOXYGEN" = "x"; then
903f765521fSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
904f765521fSmrg   fi
905f765521fSmrg   have_doxygen=yes
906f765521fSmrgelif test "x$use_doxygen" = x"no" ; then
907f765521fSmrg   if test "x$DOXYGEN" != "x"; then
908f765521fSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
909f765521fSmrg   fi
910f765521fSmrg   have_doxygen=no
91131de2854Smrgelse
912f765521fSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
913f765521fSmrgfi
914f765521fSmrgm4_ifval([$1],
915f765521fSmrg[if test "$have_doxygen" = yes; then
916f765521fSmrg    # scrape the doxygen version
917f765521fSmrg    AC_MSG_CHECKING([the doxygen version])
918f765521fSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
919f765521fSmrg    AC_MSG_RESULT([$doxygen_version])
920f765521fSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
921f765521fSmrg        [if test "x$use_doxygen" = xauto; then
922f765521fSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
923f765521fSmrg            have_doxygen=no
924f765521fSmrg        else
925f765521fSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
926f765521fSmrg        fi])
927f765521fSmrgfi])
928f765521fSmrg
929f765521fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
930f765521fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
931f765521fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
932f765521fSmrgHAVE_DOT=no
933f765521fSmrgif test "x$have_doxygen" = "xyes"; then
934f765521fSmrg  AC_PATH_PROG([DOT], [dot])
935f765521fSmrg    if test "x$DOT" != "x"; then
936f765521fSmrg      HAVE_DOT=yes
937f765521fSmrg    fi
938f765521fSmrgfi
93931de2854Smrg
940f765521fSmrgAC_SUBST([HAVE_DOT])
941f765521fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
942f765521fSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
943f765521fSmrg]) # XORG_WITH_DOXYGEN
94431de2854Smrg
945f765521fSmrg# XORG_WITH_GROFF([DEFAULT])
946f765521fSmrg# ----------------
947f765521fSmrg# Minimum version: 1.6.0
948f765521fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
94931de2854Smrg#
950f765521fSmrg# Documentation tools are not always available on all platforms and sometimes
951f765521fSmrg# not at the appropriate level. This macro enables a module to test for the
952f765521fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
953f765521fSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
954f765521fSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
955f765521fSmrg# --with-groff assumes 'auto'.
95631de2854Smrg#
957f765521fSmrg# Interface to module:
958f765521fSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
959f765521fSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
960f765521fSmrg# HAVE_GROFF_MS: the -ms macros package
961f765521fSmrg# GROFF:	 returns the path of the groff program found
962f765521fSmrg#		 returns the path set by the user in the environment
963f765521fSmrg# --with-groff:	 'yes' user instructs the module to use groff
964f765521fSmrg#		 'no' user instructs the module not to use groff
96531de2854Smrg#
966f765521fSmrg# Added in version 1.9.0:
967f765521fSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
968f765521fSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
969f765521fSmrg#		   psselect from the psutils package.
970f765521fSmrg#		   the ghostcript package. Refer to the grohtml man pages
97131de2854Smrg#
972f765521fSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
973f765521fSmrg#
974f765521fSmrg# OS and distros often splits groff in a basic and full package, the former
975f765521fSmrg# having the groff program and the later having devices, fonts and macros
976f765521fSmrg# Checking for the groff executable is not enough.
977f765521fSmrg#
978f765521fSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
979f765521fSmrg# unset HAVE_GROFF or GROFF env variables.
980f765521fSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
981f765521fSmrg#
982f765521fSmrgAC_DEFUN([XORG_WITH_GROFF],[
983f765521fSmrgAC_ARG_VAR([GROFF], [Path to groff command])
984f765521fSmrgm4_define([_defopt], m4_default([$1], [auto]))
985f765521fSmrgAC_ARG_WITH(groff,
986f765521fSmrg	AS_HELP_STRING([--with-groff],
987f765521fSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
988f765521fSmrg	   [use_groff=$withval], [use_groff=]_defopt)
989f765521fSmrgm4_undefine([_defopt])
99031de2854Smrg
991f765521fSmrgif test "x$use_groff" = x"auto"; then
992f765521fSmrg   AC_PATH_PROG([GROFF], [groff])
993f765521fSmrg   if test "x$GROFF" = "x"; then
994f765521fSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
995f765521fSmrg	have_groff=no
996f765521fSmrg   else
997f765521fSmrg        have_groff=yes
998f765521fSmrg   fi
999f765521fSmrgelif test "x$use_groff" = x"yes" ; then
1000f765521fSmrg   AC_PATH_PROG([GROFF], [groff])
1001f765521fSmrg   if test "x$GROFF" = "x"; then
1002f765521fSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1003f765521fSmrg   fi
1004f765521fSmrg   have_groff=yes
1005f765521fSmrgelif test "x$use_groff" = x"no" ; then
1006f765521fSmrg   if test "x$GROFF" != "x"; then
1007f765521fSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1008f765521fSmrg   fi
1009f765521fSmrg   have_groff=no
1010f765521fSmrgelse
1011f765521fSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1012f765521fSmrgfi
101331de2854Smrg
1014f765521fSmrg# We have groff, test for the presence of the macro packages
1015f765521fSmrgif test "x$have_groff" = x"yes"; then
1016f765521fSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1017f765521fSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1018f765521fSmrg        groff_ms_works=yes
1019f765521fSmrg    else
1020f765521fSmrg        groff_ms_works=no
1021f765521fSmrg    fi
1022f765521fSmrg    AC_MSG_RESULT([$groff_ms_works])
1023f765521fSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1024f765521fSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1025f765521fSmrg        groff_mm_works=yes
1026f765521fSmrg    else
1027f765521fSmrg        groff_mm_works=no
1028f765521fSmrg    fi
1029f765521fSmrg    AC_MSG_RESULT([$groff_mm_works])
1030f765521fSmrgfi
103131de2854Smrg
1032f765521fSmrg# We have groff, test for HTML dependencies, one command per package
1033f765521fSmrgif test "x$have_groff" = x"yes"; then
1034f765521fSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1035f765521fSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1036f765521fSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1037f765521fSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1038f765521fSmrg      have_groff_html=yes
1039f765521fSmrg   else
1040f765521fSmrg      have_groff_html=no
1041f765521fSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1042f765521fSmrg   fi
1043f765521fSmrgfi
104431de2854Smrg
1045f765521fSmrg# Set Automake conditionals for Makefiles
1046f765521fSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1047f765521fSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1048f765521fSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1049f765521fSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1050f765521fSmrg]) # XORG_WITH_GROFF
1051c05e22d7Smrg
1052f765521fSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1053f765521fSmrg# ---------------------------------------
1054f765521fSmrg# Minimum version: 1.6.0
1055f765521fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1056f765521fSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1057c05e22d7Smrg#
1058f765521fSmrg# Documentation tools are not always available on all platforms and sometimes
1059f765521fSmrg# not at the appropriate level. This macro enables a module to test for the
1060f765521fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1061f765521fSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1062f765521fSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1063f765521fSmrg# --with-fop assumes 'auto'.
1064c05e22d7Smrg#
1065f765521fSmrg# Interface to module:
1066f765521fSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1067f765521fSmrg# FOP:	 	returns the path of the fop program found
1068f765521fSmrg#		returns the path set by the user in the environment
1069f765521fSmrg# --with-fop: 	'yes' user instructs the module to use fop
1070f765521fSmrg#		'no' user instructs the module not to use fop
1071c05e22d7Smrg#
1072f765521fSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1073c05e22d7Smrg#
1074f765521fSmrgAC_DEFUN([XORG_WITH_FOP],[
1075f765521fSmrgAC_ARG_VAR([FOP], [Path to fop command])
1076f765521fSmrgm4_define([_defopt], m4_default([$2], [auto]))
1077f765521fSmrgAC_ARG_WITH(fop,
1078f765521fSmrg	AS_HELP_STRING([--with-fop],
1079f765521fSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1080f765521fSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1081f765521fSmrgm4_undefine([_defopt])
1082c05e22d7Smrg
1083f765521fSmrgif test "x$use_fop" = x"auto"; then
1084f765521fSmrg   AC_PATH_PROG([FOP], [fop])
1085f765521fSmrg   if test "x$FOP" = "x"; then
1086f765521fSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1087f765521fSmrg	have_fop=no
1088f765521fSmrg   else
1089f765521fSmrg        have_fop=yes
1090f765521fSmrg   fi
1091f765521fSmrgelif test "x$use_fop" = x"yes" ; then
1092f765521fSmrg   AC_PATH_PROG([FOP], [fop])
1093f765521fSmrg   if test "x$FOP" = "x"; then
1094f765521fSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1095f765521fSmrg   fi
1096f765521fSmrg   have_fop=yes
1097f765521fSmrgelif test "x$use_fop" = x"no" ; then
1098f765521fSmrg   if test "x$FOP" != "x"; then
1099f765521fSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1100f765521fSmrg   fi
1101f765521fSmrg   have_fop=no
1102c05e22d7Smrgelse
1103f765521fSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1104c05e22d7Smrgfi
11055dfecf96Smrg
1106f765521fSmrg# Test for a minimum version of fop, if provided.
1107f765521fSmrgm4_ifval([$1],
1108f765521fSmrg[if test "$have_fop" = yes; then
1109f765521fSmrg    # scrape the fop version
1110f765521fSmrg    AC_MSG_CHECKING([for fop minimum version])
1111f765521fSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1112f765521fSmrg    AC_MSG_RESULT([$fop_version])
1113f765521fSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1114f765521fSmrg        [if test "x$use_fop" = xauto; then
1115f765521fSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1116f765521fSmrg            have_fop=no
1117f765521fSmrg        else
1118f765521fSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1119f765521fSmrg        fi])
1120f765521fSmrgfi])
1121f765521fSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1122f765521fSmrg]) # XORG_WITH_FOP
11235dfecf96Smrg
1124f765521fSmrg# XORG_WITH_M4([MIN-VERSION])
1125f765521fSmrg# ---------------------------
1126f765521fSmrg# Minimum version: 1.19.0
1127c05e22d7Smrg#
1128f765521fSmrg# This macro attempts to locate an m4 macro processor which supports
1129f765521fSmrg# -I option and is only useful for modules relying on M4 in order to
1130f765521fSmrg# expand macros in source code files.
1131f765521fSmrg#
1132f765521fSmrg# Interface to module:
1133f765521fSmrg# M4:	 	returns the path of the m4 program found
1134f765521fSmrg#		returns the path set by the user in the environment
1135f765521fSmrg#
1136f765521fSmrgAC_DEFUN([XORG_WITH_M4], [
1137f765521fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
1138f765521fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
1139f765521fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
1140f765521fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
1141f765521fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
1142f765521fSmrg   [$PATH:/usr/gnu/bin])])
11435dfecf96Smrg
1144f765521fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
1145f765521fSmrg]) # XORG_WITH_M4
11465dfecf96Smrg
1147f765521fSmrg# XORG_WITH_PS2PDF([DEFAULT])
1148c05e22d7Smrg# ----------------
1149f765521fSmrg# Minimum version: 1.6.0
1150c05e22d7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11515dfecf96Smrg#
1152c05e22d7Smrg# Documentation tools are not always available on all platforms and sometimes
1153c05e22d7Smrg# not at the appropriate level. This macro enables a module to test for the
1154c05e22d7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1155f765521fSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1156f765521fSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1157f765521fSmrg# --with-ps2pdf assumes 'auto'.
1158c05e22d7Smrg#
1159c05e22d7Smrg# Interface to module:
1160f765521fSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1161f765521fSmrg# PS2PDF:	returns the path of the ps2pdf program found
1162c05e22d7Smrg#		returns the path set by the user in the environment
1163f765521fSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1164f765521fSmrg#		 'no' user instructs the module not to use ps2pdf
1165c05e22d7Smrg#
1166f765521fSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1167c05e22d7Smrg#
1168f765521fSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1169f765521fSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1170f765521fSmrgm4_define([_defopt], m4_default([$1], [auto]))
1171f765521fSmrgAC_ARG_WITH(ps2pdf,
1172f765521fSmrg	AS_HELP_STRING([--with-ps2pdf],
1173f765521fSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1174f765521fSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1175c05e22d7Smrgm4_undefine([_defopt])
1176c05e22d7Smrg
1177f765521fSmrgif test "x$use_ps2pdf" = x"auto"; then
1178f765521fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1179f765521fSmrg   if test "x$PS2PDF" = "x"; then
1180f765521fSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1181f765521fSmrg	have_ps2pdf=no
1182c05e22d7Smrg   else
1183f765521fSmrg        have_ps2pdf=yes
1184c05e22d7Smrg   fi
1185f765521fSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1186f765521fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1187f765521fSmrg   if test "x$PS2PDF" = "x"; then
1188f765521fSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1189c05e22d7Smrg   fi
1190f765521fSmrg   have_ps2pdf=yes
1191f765521fSmrgelif test "x$use_ps2pdf" = x"no" ; then
1192f765521fSmrg   if test "x$PS2PDF" != "x"; then
1193f765521fSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1194c05e22d7Smrg   fi
1195f765521fSmrg   have_ps2pdf=no
1196c05e22d7Smrgelse
1197f765521fSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1198c05e22d7Smrgfi
1199f765521fSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1200f765521fSmrg]) # XORG_WITH_PS2PDF
12015dfecf96Smrg
1202f765521fSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1203f765521fSmrg# ----------------
1204f765521fSmrg# Minimum version: 1.6.0
1205f765521fSmrg#
1206f765521fSmrg# Documentation tools are not always available on all platforms and sometimes
1207f765521fSmrg# not at the appropriate level. This macro enables a builder to skip all
1208f765521fSmrg# documentation targets except traditional man pages.
1209f765521fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1210f765521fSmrg# maximum flexibilty in controlling documentation building.
1211f765521fSmrg# Refer to:
1212f765521fSmrg# XORG_WITH_XMLTO         --with-xmlto
1213f765521fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1214f765521fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1215f765521fSmrg# XORG_WITH_FOP           --with-fop
1216f765521fSmrg# XORG_WITH_GROFF         --with-groff
1217f765521fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1218f765521fSmrg#
1219f765521fSmrg# Interface to module:
1220f765521fSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1221f765521fSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1222f765521fSmrg#		 'no' user instructs the module not to generate docs
1223f765521fSmrg# parm1:	specify the default value, yes or no.
1224f765521fSmrg#
1225f765521fSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1226f765521fSmrgm4_define([docs_default], m4_default([$1], [yes]))
1227f765521fSmrgAC_ARG_ENABLE(docs,
1228f765521fSmrg	AS_HELP_STRING([--enable-docs],
1229f765521fSmrg	   [Enable building the documentation (default: ]docs_default[)]),
1230f765521fSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
1231f765521fSmrgm4_undefine([docs_default])
1232f765521fSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1233f765521fSmrgAC_MSG_CHECKING([whether to build documentation])
1234f765521fSmrgAC_MSG_RESULT([$build_docs])
1235f765521fSmrg]) # XORG_ENABLE_DOCS
12365dfecf96Smrg
1237f765521fSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1238f765521fSmrg# ----------------
1239f765521fSmrg# Minimum version: 1.6.0
1240f765521fSmrg#
1241f765521fSmrg# This macro enables a builder to skip all developer documentation.
1242f765521fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1243f765521fSmrg# maximum flexibilty in controlling documentation building.
1244f765521fSmrg# Refer to:
1245f765521fSmrg# XORG_WITH_XMLTO         --with-xmlto
1246f765521fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1247f765521fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1248f765521fSmrg# XORG_WITH_FOP           --with-fop
1249f765521fSmrg# XORG_WITH_GROFF         --with-groff
1250f765521fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1251f765521fSmrg#
1252f765521fSmrg# Interface to module:
1253f765521fSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1254f765521fSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1255f765521fSmrg#			'no' user instructs the module not to generate developer docs
1256f765521fSmrg# parm1:		specify the default value, yes or no.
1257f765521fSmrg#
1258f765521fSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1259f765521fSmrgm4_define([devel_default], m4_default([$1], [yes]))
1260f765521fSmrgAC_ARG_ENABLE(devel-docs,
1261f765521fSmrg	AS_HELP_STRING([--enable-devel-docs],
1262f765521fSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1263f765521fSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1264f765521fSmrgm4_undefine([devel_default])
1265f765521fSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1266f765521fSmrgAC_MSG_CHECKING([whether to build developer documentation])
1267f765521fSmrgAC_MSG_RESULT([$build_devel_docs])
1268f765521fSmrg]) # XORG_ENABLE_DEVEL_DOCS
1269c05e22d7Smrg
1270f765521fSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1271f765521fSmrg# ----------------
1272f765521fSmrg# Minimum version: 1.6.0
1273f765521fSmrg#
1274f765521fSmrg# This macro enables a builder to skip all functional specification targets.
1275f765521fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1276f765521fSmrg# maximum flexibilty in controlling documentation building.
1277f765521fSmrg# Refer to:
1278f765521fSmrg# XORG_WITH_XMLTO         --with-xmlto
1279f765521fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1280f765521fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1281f765521fSmrg# XORG_WITH_FOP           --with-fop
1282f765521fSmrg# XORG_WITH_GROFF         --with-groff
1283f765521fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1284f765521fSmrg#
1285f765521fSmrg# Interface to module:
1286f765521fSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1287f765521fSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1288f765521fSmrg#			'no' user instructs the module not to generate specs
1289f765521fSmrg# parm1:		specify the default value, yes or no.
1290f765521fSmrg#
1291f765521fSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1292f765521fSmrgm4_define([spec_default], m4_default([$1], [yes]))
1293f765521fSmrgAC_ARG_ENABLE(specs,
1294f765521fSmrg	AS_HELP_STRING([--enable-specs],
1295f765521fSmrg	   [Enable building the specs (default: ]spec_default[)]),
1296f765521fSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1297f765521fSmrgm4_undefine([spec_default])
1298f765521fSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1299f765521fSmrgAC_MSG_CHECKING([whether to build functional specifications])
1300f765521fSmrgAC_MSG_RESULT([$build_specs])
1301f765521fSmrg]) # XORG_ENABLE_SPECS
1302f765521fSmrg
1303f765521fSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
1304f765521fSmrg# ----------------------------------------------
1305f765521fSmrg# Minimum version: 1.13.0
1306f765521fSmrg#
1307f765521fSmrg# This macro enables a builder to enable/disable unit testing
1308f765521fSmrg# It makes no assumption about the test cases implementation
1309f765521fSmrg# Test cases may or may not use Automake "Support for test suites"
1310f765521fSmrg# They may or may not use the software utility library GLib
1311f765521fSmrg#
1312f765521fSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
1313f765521fSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
1314f765521fSmrg# The variable enable_unit_tests is used by other macros in this file.
1315f765521fSmrg#
1316f765521fSmrg# Interface to module:
1317f765521fSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
1318f765521fSmrg# enable_unit_tests:    used in configure.ac for additional configuration
1319f765521fSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
1320f765521fSmrg#			'no' user instructs the module not to build tests
1321f765521fSmrg# parm1:		specify the default value, yes or no.
1322f765521fSmrg#
1323f765521fSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
1324f765521fSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
1325f765521fSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1326f765521fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1327f765521fSmrgm4_define([_defopt], m4_default([$1], [auto]))
1328f765521fSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
1329f765521fSmrg	[Enable building unit test cases (default: ]_defopt[)]),
1330f765521fSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
1331f765521fSmrgm4_undefine([_defopt])
1332f765521fSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
1333f765521fSmrgAC_MSG_CHECKING([whether to build unit test cases])
1334f765521fSmrgAC_MSG_RESULT([$enable_unit_tests])
1335f765521fSmrg]) # XORG_ENABLE_UNIT_TESTS
1336f765521fSmrg
1337f765521fSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
1338f765521fSmrg# ------------------------------------------------------
1339f765521fSmrg# Minimum version: 1.17.0
1340f765521fSmrg#
1341f765521fSmrg# This macro enables a builder to enable/disable integration testing
1342f765521fSmrg# It makes no assumption about the test cases' implementation
1343f765521fSmrg# Test cases may or may not use Automake "Support for test suites"
1344f765521fSmrg#
1345f765521fSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
1346f765521fSmrg# usually requires less dependencies and may be built and run under less
1347f765521fSmrg# stringent environments than integration tests.
1348f765521fSmrg#
1349f765521fSmrg# Interface to module:
1350f765521fSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
1351f765521fSmrg# enable_integration_tests:   used in configure.ac for additional configuration
1352f765521fSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
1353f765521fSmrg#                             'no' user instructs the module not to build tests
1354f765521fSmrg# parm1:                      specify the default value, yes or no.
1355f765521fSmrg#
1356f765521fSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
1357f765521fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1358f765521fSmrgm4_define([_defopt], m4_default([$1], [auto]))
1359f765521fSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
1360f765521fSmrg	[Enable building integration test cases (default: ]_defopt[)]),
1361f765521fSmrg	[enable_integration_tests=$enableval],
1362f765521fSmrg	[enable_integration_tests=]_defopt)
1363f765521fSmrgm4_undefine([_defopt])
1364f765521fSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
1365f765521fSmrg	[test "x$enable_integration_tests" != xno])
1366f765521fSmrgAC_MSG_CHECKING([whether to build unit test cases])
1367f765521fSmrgAC_MSG_RESULT([$enable_integration_tests])
1368f765521fSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1369f765521fSmrg
1370f765521fSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
1371f765521fSmrg# ----------------------------------------
1372f765521fSmrg# Minimum version: 1.13.0
1373f765521fSmrg#
1374f765521fSmrg# GLib is a library which provides advanced data structures and functions.
1375f765521fSmrg# This macro enables a module to test for the presence of Glib.
137631de2854Smrg#
1377f765521fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
1378f765521fSmrg# Otherwise the value of $enable_unit_tests is blank.
137931de2854Smrg#
1380f765521fSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
1381f765521fSmrg# test support usually requires less dependencies and may be built and run under
1382f765521fSmrg# less stringent environments than integration tests.
138331de2854Smrg#
1384f765521fSmrg# Interface to module:
1385f765521fSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
1386f765521fSmrg# with_glib: used in configure.ac to know if GLib has been found
1387f765521fSmrg# --with-glib:	'yes' user instructs the module to use glib
1388f765521fSmrg#		'no' user instructs the module not to use glib
138931de2854Smrg#
1390f765521fSmrgAC_DEFUN([XORG_WITH_GLIB],[
1391f765521fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
139231de2854Smrgm4_define([_defopt], m4_default([$2], [auto]))
1393f765521fSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
1394f765521fSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
1395f765521fSmrg	[with_glib=$withval], [with_glib=]_defopt)
139631de2854Smrgm4_undefine([_defopt])
139731de2854Smrg
1398f765521fSmrghave_glib=no
1399f765521fSmrg# Do not probe GLib if user explicitly disabled unit testing
1400f765521fSmrgif test "x$enable_unit_tests" != x"no"; then
1401f765521fSmrg  # Do not probe GLib if user explicitly disabled it
1402f765521fSmrg  if test "x$with_glib" != x"no"; then
1403f765521fSmrg    m4_ifval(
1404f765521fSmrg      [$1],
1405f765521fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
1406f765521fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
1407f765521fSmrg    )
1408f765521fSmrg  fi
140931de2854Smrgfi
141031de2854Smrg
1411f765521fSmrg# Not having GLib when unit testing has been explicitly requested is an error
1412f765521fSmrgif test "x$enable_unit_tests" = x"yes"; then
1413f765521fSmrg  if test "x$have_glib" = x"no"; then
1414f765521fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1415f765521fSmrg  fi
1416f765521fSmrgfi
141731de2854Smrg
1418f765521fSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
1419f765521fSmrgif test "x$enable_unit_tests" = x"no"; then
1420f765521fSmrg  if test "x$with_glib" = x"yes"; then
1421f765521fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1422f765521fSmrg  fi
1423f765521fSmrgfi
1424f765521fSmrg
1425f765521fSmrg# Not having GLib when it has been explicitly requested is an error
1426f765521fSmrgif test "x$with_glib" = x"yes"; then
1427f765521fSmrg  if test "x$have_glib" = x"no"; then
1428f765521fSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
1429f765521fSmrg  fi
1430f765521fSmrgfi
1431f765521fSmrg
1432f765521fSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
1433f765521fSmrg]) # XORG_WITH_GLIB
1434f765521fSmrg
1435f765521fSmrg# XORG_LD_WRAP([required|optional])
1436f765521fSmrg# ---------------------------------
1437f765521fSmrg# Minimum version: 1.13.0
143831de2854Smrg#
1439f765521fSmrg# Check if linker supports -wrap, passed via compiler flags
144031de2854Smrg#
1441f765521fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
1442f765521fSmrg# Otherwise the value of $enable_unit_tests is blank.
144331de2854Smrg#
1444f765521fSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
1445f765521fSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
1446f765521fSmrg# available, an argument of "optional" allows use when some unit tests require
1447f765521fSmrg# ld -wrap and others do not.
144831de2854Smrg#
1449f765521fSmrgAC_DEFUN([XORG_LD_WRAP],[
1450f765521fSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
1451f765521fSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
1452f765521fSmrg                      void __wrap_exit(int status) { return; }],
1453f765521fSmrg                     [exit(0);])])
1454f765521fSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
1455f765521fSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
1456f765521fSmrg  if test "x$have_ld_wrap" = x"no"; then
1457f765521fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
1458f765521fSmrg  fi
145931de2854Smrgfi
1460f765521fSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1461f765521fSmrg#
1462f765521fSmrg]) # XORG_LD_WRAP
146331de2854Smrg
1464f765521fSmrg# XORG_CHECK_LINKER_FLAGS
1465f765521fSmrg# -----------------------
1466f765521fSmrg# SYNOPSIS
1467c05e22d7Smrg#
1468f765521fSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
1469c05e22d7Smrg#
1470f765521fSmrg# DESCRIPTION
1471c05e22d7Smrg#
1472f765521fSmrg#   Check whether the given linker FLAGS work with the current language's
1473f765521fSmrg#   linker, or whether they give an error.
1474c05e22d7Smrg#
1475f765521fSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
1476f765521fSmrg#   success/failure.
1477f765521fSmrg#
1478f765521fSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
1479f765521fSmrg#
1480f765521fSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
1481f765521fSmrg#
1482f765521fSmrg# LICENSE
1483f765521fSmrg#
1484f765521fSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
1485f765521fSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
1486f765521fSmrg#   Copyright (c) 2009 Matteo Frigo
1487f765521fSmrg#
1488f765521fSmrg#   This program is free software: you can redistribute it and/or modify it
1489f765521fSmrg#   under the terms of the GNU General Public License as published by the
1490f765521fSmrg#   Free Software Foundation, either version 3 of the License, or (at your
1491f765521fSmrg#   option) any later version.
1492f765521fSmrg#
1493f765521fSmrg#   This program is distributed in the hope that it will be useful, but
1494f765521fSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
1495f765521fSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1496f765521fSmrg#   Public License for more details.
1497f765521fSmrg#
1498f765521fSmrg#   You should have received a copy of the GNU General Public License along
1499f765521fSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
1500f765521fSmrg#
1501f765521fSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
1502f765521fSmrg#   gives unlimited permission to copy, distribute and modify the configure
1503f765521fSmrg#   scripts that are the output of Autoconf when processing the Macro. You
1504f765521fSmrg#   need not follow the terms of the GNU General Public License when using
1505f765521fSmrg#   or distributing such scripts, even though portions of the text of the
1506f765521fSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
1507f765521fSmrg#   all other use of the material that constitutes the Autoconf Macro.
1508f765521fSmrg#
1509f765521fSmrg#   This special exception to the GPL applies to versions of the Autoconf
1510f765521fSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
1511f765521fSmrg#   modified version of the Autoconf Macro, you may extend this special
1512f765521fSmrg#   exception to the GPL to apply to your modified version as well.#
1513f765521fSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
1514f765521fSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
1515f765521fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
1516f765521fSmrgAS_LITERAL_IF([$1],
1517f765521fSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
1518f765521fSmrg      ax_save_FLAGS=$LDFLAGS
1519f765521fSmrg      LDFLAGS="$1"
1520f765521fSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
1521f765521fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1522f765521fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1523f765521fSmrg      LDFLAGS=$ax_save_FLAGS])],
1524f765521fSmrg  [ax_save_FLAGS=$LDFLAGS
1525f765521fSmrg   LDFLAGS="$1"
1526f765521fSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1527f765521fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1528f765521fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1529f765521fSmrg   LDFLAGS=$ax_save_FLAGS])
1530f765521fSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
1531f765521fSmrgAC_MSG_RESULT($xorg_check_linker_flags)
1532f765521fSmrgif test "x$xorg_check_linker_flags" = xyes; then
1533f765521fSmrg	m4_default([$2], :)
15345dfecf96Smrgelse
1535f765521fSmrg	m4_default([$3], :)
15365dfecf96Smrgfi
1537f765521fSmrg]) # XORG_CHECK_LINKER_FLAGS
15385dfecf96Smrg
1539f765521fSmrg# XORG_MEMORY_CHECK_FLAGS
1540f765521fSmrg# -----------------------
1541f765521fSmrg# Minimum version: 1.16.0
1542c05e22d7Smrg#
1543f765521fSmrg# This macro attempts to find appropriate memory checking functionality
1544f765521fSmrg# for various platforms which unit testing code may use to catch various
1545f765521fSmrg# forms of memory allocation and access errors in testing.
1546c05e22d7Smrg#
1547c05e22d7Smrg# Interface to module:
1548f765521fSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
1549f765521fSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
1550c05e22d7Smrg#
1551f765521fSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
1552c05e22d7Smrg#
1553f765521fSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1554c05e22d7Smrg
1555f765521fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1556f765521fSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
1557f765521fSmrg           [Environment variables to enable memory checking in tests])
1558f765521fSmrg
1559f765521fSmrg# Check for different types of support on different platforms
1560f765521fSmrgcase $host_os in
1561f765521fSmrg    solaris*)
1562f765521fSmrg        AC_CHECK_LIB([umem], [umem_alloc],
1563f765521fSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
1564f765521fSmrg        ;;
1565f765521fSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
1566f765521fSmrg        # both directly and inverted, so should not be 0 or 255.
1567f765521fSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
1568f765521fSmrg        ;;
1569f765521fSmrg    darwin*)
1570f765521fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
1571f765521fSmrg        ;;
1572f765521fSmrg    *bsd*)
1573f765521fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
1574f765521fSmrg        ;;
1575f765521fSmrgesac
1576f765521fSmrg
1577f765521fSmrg# User supplied flags override default flags
1578f765521fSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
1579f765521fSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1580f765521fSmrgfi
1581f765521fSmrg
1582f765521fSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
1583f765521fSmrg]) # XORG_WITH_LINT
1584f765521fSmrg
1585f765521fSmrg# XORG_CHECK_MALLOC_ZERO
1586f765521fSmrg# ----------------------
1587f765521fSmrg# Minimum version: 1.0.0
1588f765521fSmrg#
1589f765521fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1590f765521fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1591f765521fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1592f765521fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1593f765521fSmrgAC_ARG_ENABLE(malloc0returnsnull,
1594f765521fSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1595f765521fSmrg		       [malloc(0) returns NULL (default: auto)]),
1596f765521fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1597f765521fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1598f765521fSmrg
1599f765521fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1600f765521fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1601f765521fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
1602f765521fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
1603f765521fSmrg#include <stdlib.h>
1604f765521fSmrg],[
1605f765521fSmrg    char *m0, *r0, *c0, *p;
1606f765521fSmrg    m0 = malloc(0);
1607f765521fSmrg    p = malloc(10);
1608f765521fSmrg    r0 = realloc(p,0);
1609f765521fSmrg    c0 = calloc(0,10);
1610f765521fSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
1611f765521fSmrg])],
1612f765521fSmrg		[xorg_cv_malloc0_returns_null=yes],
1613f765521fSmrg		[xorg_cv_malloc0_returns_null=no])])
1614f765521fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1615f765521fSmrgfi
1616f765521fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1617f765521fSmrg
1618f765521fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1619f765521fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1620f765521fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1621f765521fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1622c05e22d7Smrgelse
1623f765521fSmrg	MALLOC_ZERO_CFLAGS=""
1624f765521fSmrg	XMALLOC_ZERO_CFLAGS=""
1625f765521fSmrg	XTMALLOC_ZERO_CFLAGS=""
1626c05e22d7Smrgfi
16275dfecf96Smrg
1628f765521fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1629f765521fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1630f765521fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1631f765521fSmrg]) # XORG_CHECK_MALLOC_ZERO
1632f765521fSmrg
1633f765521fSmrg# XORG_WITH_LINT()
1634c05e22d7Smrg# ----------------
1635f765521fSmrg# Minimum version: 1.1.0
16365dfecf96Smrg#
1637f765521fSmrg# This macro enables the use of a tool that flags some suspicious and
1638f765521fSmrg# non-portable constructs (likely to be bugs) in C language source code.
1639f765521fSmrg# It will attempt to locate the tool and use appropriate options.
1640f765521fSmrg# There are various lint type tools on different platforms.
1641c05e22d7Smrg#
1642c05e22d7Smrg# Interface to module:
1643f765521fSmrg# LINT:		returns the path to the tool found on the platform
1644f765521fSmrg#		or the value set to LINT on the configure cmd line
1645f765521fSmrg#		also an Automake conditional
1646f765521fSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1647c05e22d7Smrg#
1648f765521fSmrg# --with-lint:	'yes' user instructs the module to use lint
1649f765521fSmrg#		'no' user instructs the module not to use lint (default)
1650c05e22d7Smrg#
1651f765521fSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1652f765521fSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1653c05e22d7Smrg#
1654f765521fSmrgAC_DEFUN([XORG_WITH_LINT],[
1655f765521fSmrg
1656f765521fSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1657f765521fSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1658f765521fSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1659f765521fSmrg		[Use a lint-style source code checker (default: disabled)])],
1660f765521fSmrg		[use_lint=$withval], [use_lint=no])
1661f765521fSmrg
1662f765521fSmrg# Obtain platform specific info like program name and options
1663f765521fSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1664f765521fSmrgcase $host_os in
1665f765521fSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1666f765521fSmrg	lint_name=splint
1667f765521fSmrg	lint_options="-badflag"
1668f765521fSmrg	;;
1669f765521fSmrg  *freebsd* | *netbsd*)
1670f765521fSmrg	lint_name=lint
1671f765521fSmrg	lint_options="-u -b"
1672f765521fSmrg	;;
1673f765521fSmrg  *solaris*)
1674f765521fSmrg	lint_name=lint
1675f765521fSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1676f765521fSmrg	;;
1677f765521fSmrgesac
1678c05e22d7Smrg
1679f765521fSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1680f765521fSmrgif test "x$use_lint" = x"yes" ; then
1681f765521fSmrg   AC_PATH_PROG([LINT], [$lint_name])
1682f765521fSmrg   if test "x$LINT" = "x"; then
1683f765521fSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1684c05e22d7Smrg   fi
1685f765521fSmrgelif test "x$use_lint" = x"no" ; then
1686f765521fSmrg   if test "x$LINT" != "x"; then
1687f765521fSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1688c05e22d7Smrg   fi
1689c05e22d7Smrgelse
1690f765521fSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1691c05e22d7Smrgfi
16925dfecf96Smrg
1693f765521fSmrg# User supplied flags override default flags
1694f765521fSmrgif test "x$LINT_FLAGS" != "x"; then
1695f765521fSmrg   lint_options=$LINT_FLAGS
1696c05e22d7Smrgfi
16975dfecf96Smrg
1698f765521fSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1699f765521fSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1700f765521fSmrg
1701f765521fSmrg]) # XORG_WITH_LINT
1702f765521fSmrg
1703f765521fSmrg# XORG_LINT_LIBRARY(LIBNAME)
1704f765521fSmrg# --------------------------
1705f765521fSmrg# Minimum version: 1.1.0
1706f765521fSmrg#
1707f765521fSmrg# Sets up flags for building lint libraries for checking programs that call
1708f765521fSmrg# functions in the library.
1709f765521fSmrg#
1710f765521fSmrg# Interface to module:
1711f765521fSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1712f765521fSmrg# MAKE_LINT_LIB		- Automake conditional
1713f765521fSmrg#
1714f765521fSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1715f765521fSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1716f765521fSmrg
1717f765521fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1718f765521fSmrgAC_REQUIRE([XORG_WITH_LINT])
1719f765521fSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1720f765521fSmrg	[Create lint library (default: disabled)])],
1721f765521fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1722f765521fSmrg
1723f765521fSmrgif test "x$make_lint_lib" = x"yes" ; then
1724f765521fSmrg   LINTLIB=llib-l$1.ln
1725f765521fSmrg   if test "x$LINT" = "x"; then
1726f765521fSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1727c05e22d7Smrg   fi
1728f765521fSmrgelif test "x$make_lint_lib" != x"no" ; then
1729f765521fSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1730c05e22d7Smrgfi
17315dfecf96Smrg
1732f765521fSmrgAC_SUBST(LINTLIB)
1733f765521fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
17345dfecf96Smrg
1735f765521fSmrg]) # XORG_LINT_LIBRARY
1736f765521fSmrg
1737f765521fSmrg# XORG_COMPILER_BRAND
1738f765521fSmrg# -------------------
1739f765521fSmrg# Minimum version: 1.14.0
1740c05e22d7Smrg#
1741f765521fSmrg# Checks for various brands of compilers and sets flags as appropriate:
1742f765521fSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
1743f765521fSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
1744f765521fSmrg#   clang compiler - sets CLANGCC to "yes"
1745f765521fSmrg#   Intel compiler - sets INTELCC to "yes"
1746f765521fSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1747c05e22d7Smrg#
1748f765521fSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
1749f765521fSmrgAC_LANG_CASE(
1750f765521fSmrg	[C], [
1751f765521fSmrg		AC_REQUIRE([AC_PROG_CC_C99])
1752f765521fSmrg	],
1753f765521fSmrg	[C++], [
1754f765521fSmrg		AC_REQUIRE([AC_PROG_CXX])
1755f765521fSmrg	]
1756f765521fSmrg)
1757f765521fSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
1758f765521fSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1759f765521fSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1760f765521fSmrg]) # XORG_COMPILER_BRAND
1761f765521fSmrg
1762f765521fSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
1763f765521fSmrg# ---------------
1764f765521fSmrg# Minimum version: 1.16.0
1765c05e22d7Smrg#
1766f765521fSmrg# Test if the compiler works when passed the given flag as a command line argument.
1767f765521fSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
1768f765521fSmrg# next flag in the list until there are no more options.
1769c05e22d7Smrg#
1770f765521fSmrg# Note that this does not guarantee that the compiler supports the flag as some
1771f765521fSmrg# compilers will simply ignore arguments that they do not understand, but we do
1772f765521fSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
1773f765521fSmrg# -Werror=unused-command-line-argument
1774f765521fSmrg#
1775f765521fSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
1776f765521fSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1777f765521fSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1778c05e22d7Smrg
1779f765521fSmrgAC_LANG_COMPILER_REQUIRE
1780f765521fSmrg
1781f765521fSmrgAC_LANG_CASE(
1782f765521fSmrg	[C], [
1783f765521fSmrg		AC_REQUIRE([AC_PROG_CC_C99])
1784f765521fSmrg		define([PREFIX], [C])
1785f765521fSmrg		define([CACHE_PREFIX], [cc])
1786f765521fSmrg		define([COMPILER], [$CC])
1787f765521fSmrg	],
1788f765521fSmrg	[C++], [
1789f765521fSmrg		define([PREFIX], [CXX])
1790f765521fSmrg		define([CACHE_PREFIX], [cxx])
1791f765521fSmrg		define([COMPILER], [$CXX])
1792f765521fSmrg	]
1793f765521fSmrg)
1794f765521fSmrg
1795f765521fSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1796f765521fSmrg
1797f765521fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
1798f765521fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1799f765521fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
1800f765521fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
1801f765521fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1802f765521fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
1803f765521fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
1804f765521fSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
1805f765521fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1806c05e22d7Smrgfi
180731de2854Smrg
1808f765521fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
1809f765521fSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
1810f765521fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1811f765521fSmrg	fi
1812f765521fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1813f765521fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
1814f765521fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
1815f765521fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1816f765521fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
1817f765521fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
1818f765521fSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
1819f765521fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1820f765521fSmrgfi
1821f765521fSmrg
1822f765521fSmrgfound="no"
1823f765521fSmrgm4_foreach([flag], m4_cdr($@), [
1824f765521fSmrg	if test $found = "no" ; then
1825f765521fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
1826f765521fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1827f765521fSmrg		fi
1828f765521fSmrg
1829f765521fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
1830f765521fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1831f765521fSmrg		fi
1832f765521fSmrg
1833f765521fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1834f765521fSmrg
1835f765521fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
1836f765521fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
1837f765521fSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
1838f765521fSmrg		AC_CACHE_VAL($cacheid,
1839f765521fSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
1840f765521fSmrg					     [eval $cacheid=yes],
1841f765521fSmrg					     [eval $cacheid=no])])
1842c05e22d7Smrg
1843f765521fSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1844f765521fSmrg
1845f765521fSmrg		eval supported=\$$cacheid
1846f765521fSmrg		AC_MSG_RESULT([$supported])
1847f765521fSmrg		if test "$supported" = "yes" ; then
1848f765521fSmrg			$1="$$1 ]flag["
1849f765521fSmrg			found="yes"
1850f765521fSmrg		fi
1851f765521fSmrg	fi
1852f765521fSmrg])
1853f765521fSmrg]) # XORG_TESTSET_CFLAG
1854f765521fSmrg
1855f765521fSmrg# XORG_COMPILER_FLAGS
1856f765521fSmrg# ---------------
1857f765521fSmrg# Minimum version: 1.16.0
1858c05e22d7Smrg#
1859f765521fSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
1860f765521fSmrg# arguments supported by the selected compiler which do NOT alter the generated
1861f765521fSmrg# code.  These arguments will cause the compiler to print various warnings
1862f765521fSmrg# during compilation AND turn a conservative set of warnings into errors.
1863c05e22d7Smrg#
1864f765521fSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
1865f765521fSmrg# future versions of util-macros as options are added to new compilers.
1866c05e22d7Smrg#
1867f765521fSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
1868f765521fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1869c05e22d7Smrg
1870f765521fSmrgAC_ARG_ENABLE(selective-werror,
1871f765521fSmrg              AS_HELP_STRING([--disable-selective-werror],
1872f765521fSmrg                             [Turn off selective compiler errors. (default: enabled)]),
1873f765521fSmrg              [SELECTIVE_WERROR=$enableval],
1874f765521fSmrg              [SELECTIVE_WERROR=yes])
1875f765521fSmrg
1876f765521fSmrgAC_LANG_CASE(
1877f765521fSmrg        [C], [
1878f765521fSmrg                define([PREFIX], [C])
1879f765521fSmrg        ],
1880f765521fSmrg        [C++], [
1881f765521fSmrg                define([PREFIX], [CXX])
1882f765521fSmrg        ]
1883f765521fSmrg)
1884f765521fSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
1885f765521fSmrgif test "x$SUNCC" = "xyes"; then
1886f765521fSmrg    [BASE_]PREFIX[FLAGS]="-v"
1887c05e22d7Smrgelse
1888f765521fSmrg    [BASE_]PREFIX[FLAGS]=""
1889c05e22d7Smrgfi
18905dfecf96Smrg
1891f765521fSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
1892f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
1893f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
1894f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
1895f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1896c05e22d7Smrg
1897f765521fSmrgAC_LANG_CASE(
1898f765521fSmrg	[C], [
1899f765521fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
1900f765521fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
1901f765521fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
1902f765521fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
1903f765521fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
1904f765521fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
1905f765521fSmrg	]
1906f765521fSmrg)
1907c05e22d7Smrg
1908f765521fSmrg# This chunk adds additional warnings that could catch undesired effects.
1909f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
1910f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
1911f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
1912f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
1913f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
1914f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
1915f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
19165dfecf96Smrg
1917f765521fSmrg# These are currently disabled because they are noisy.  They will be enabled
1918f765521fSmrg# in the future once the codebase is sufficiently modernized to silence
1919f765521fSmrg# them.  For now, I don't want them to drown out the other warnings.
1920f765521fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
1921f765521fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
1922f765521fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
1923f765521fSmrg
1924f765521fSmrg# Turn some warnings into errors, so we don't accidently get successful builds
1925f765521fSmrg# when there are problems that should be fixed.
1926f765521fSmrg
1927f765521fSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
1928f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
1929f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
1930f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
1931f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
1932f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
1933f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
1934f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
1935f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
1936f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
1937f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
1938f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
1939f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
1940f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
1941f765521fSmrgelse
1942f765521fSmrgAC_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])
1943f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
1944f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
1945f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
1946f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
1947f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
1948f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
1949f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
1950f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
1951f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
1952f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
1953f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
1954f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
1955f765521fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
1956f765521fSmrgfi
195731de2854Smrg
1958f765521fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
1959f765521fSmrg]) # XORG_COMPILER_FLAGS
196031de2854Smrg
1961f765521fSmrg# XORG_CWARNFLAGS
1962f765521fSmrg# ---------------
1963f765521fSmrg# Minimum version: 1.2.0
1964f765521fSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
196531de2854Smrg#
1966f765521fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
196731de2854Smrg#
1968f765521fSmrg# This function is deprecated because it defines -fno-strict-aliasing
1969f765521fSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
1970f765521fSmrg# is needed, then it should be added explicitly in the module when
1971f765521fSmrg# it is updated to use BASE_CFLAGS.
197231de2854Smrg#
1973f765521fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
1974f765521fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
1975f765521fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1976f765521fSmrgAC_LANG_CASE(
1977f765521fSmrg	[C], [
1978f765521fSmrg		CWARNFLAGS="$BASE_CFLAGS"
1979f765521fSmrg		if  test "x$GCC" = xyes ; then
1980f765521fSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
1981f765521fSmrg		fi
1982f765521fSmrg		AC_SUBST(CWARNFLAGS)
1983f765521fSmrg	]
1984f765521fSmrg)
1985f765521fSmrg]) # XORG_CWARNFLAGS
1986f765521fSmrg
1987f765521fSmrg# XORG_STRICT_OPTION
1988f765521fSmrg# -----------------------
1989f765521fSmrg# Minimum version: 1.3.0
199031de2854Smrg#
1991f765521fSmrg# Add configure option to enable strict compilation flags, such as treating
1992f765521fSmrg# warnings as fatal errors.
1993f765521fSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
1994f765521fSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
199531de2854Smrg#
1996f765521fSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
1997f765521fSmrg# when strict compilation is unconditionally desired.
1998f765521fSmrgAC_DEFUN([XORG_STRICT_OPTION], [
1999f765521fSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2000f765521fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
200131de2854Smrg
2002f765521fSmrgAC_ARG_ENABLE(strict-compilation,
2003f765521fSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2004f765521fSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2005f765521fSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
200631de2854Smrg
2007f765521fSmrgAC_LANG_CASE(
2008f765521fSmrg        [C], [
2009f765521fSmrg                define([PREFIX], [C])
2010f765521fSmrg        ],
2011f765521fSmrg        [C++], [
2012f765521fSmrg                define([PREFIX], [CXX])
2013f765521fSmrg        ]
2014f765521fSmrg)
201531de2854Smrg
2016f765521fSmrg[STRICT_]PREFIX[FLAGS]=""
2017f765521fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2018f765521fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
201931de2854Smrg
2020f765521fSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2021f765521fSmrg# activate it with -Werror, so we add it here explicitly.
2022f765521fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
202331de2854Smrg
2024f765521fSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2025f765521fSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2026f765521fSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2027f765521fSmrgfi
2028f765521fSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2029f765521fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2030f765521fSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2031f765521fSmrg]) # XORG_STRICT_OPTION
203231de2854Smrg
2033f765521fSmrg# XORG_DEFAULT_OPTIONS
2034f765521fSmrg# --------------------
2035f765521fSmrg# Minimum version: 1.3.0
203631de2854Smrg#
2037f765521fSmrg# Defines default options for X.Org modules.
203831de2854Smrg#
2039f765521fSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2040f765521fSmrgAC_REQUIRE([AC_PROG_INSTALL])
2041f765521fSmrgXORG_COMPILER_FLAGS
2042f765521fSmrgXORG_CWARNFLAGS
2043f765521fSmrgXORG_STRICT_OPTION
2044f765521fSmrgXORG_RELEASE_VERSION
2045f765521fSmrgXORG_CHANGELOG
2046f765521fSmrgXORG_INSTALL
2047f765521fSmrgXORG_MANPAGE_SECTIONS
2048f765521fSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2049f765521fSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2050f765521fSmrg]) # XORG_DEFAULT_OPTIONS
2051f765521fSmrg
2052f765521fSmrg# XORG_INSTALL()
2053f765521fSmrg# ----------------
2054f765521fSmrg# Minimum version: 1.4.0
205531de2854Smrg#
2056f765521fSmrg# Defines the variable INSTALL_CMD as the command to copy
2057f765521fSmrg# INSTALL from $prefix/share/util-macros.
205831de2854Smrg#
2059f765521fSmrgAC_DEFUN([XORG_INSTALL], [
2060f765521fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2061f765521fSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2062f765521fSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2063f765521fSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2064f765521fSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2065f765521fSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2066f765521fSmrgAC_SUBST([INSTALL_CMD])
2067f765521fSmrg]) # XORG_INSTALL
2068f765521fSmrgdnl Copyright 2005 Red Hat, Inc
2069f765521fSmrgdnl
2070f765521fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2071f765521fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2072f765521fSmrgdnl the above copyright notice appear in all copies and that both that
2073f765521fSmrgdnl copyright notice and this permission notice appear in supporting
2074f765521fSmrgdnl documentation.
2075f765521fSmrgdnl
2076f765521fSmrgdnl The above copyright notice and this permission notice shall be included
2077f765521fSmrgdnl in all copies or substantial portions of the Software.
2078f765521fSmrgdnl
2079f765521fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2080f765521fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2081f765521fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2082f765521fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2083f765521fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2084f765521fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2085f765521fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2086f765521fSmrgdnl
2087f765521fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2088f765521fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2089f765521fSmrgdnl other dealings in this Software without prior written authorization
2090f765521fSmrgdnl from the copyright holders.
2091f765521fSmrgdnl
209231de2854Smrg
2093f765521fSmrg# XORG_RELEASE_VERSION
2094f765521fSmrg# --------------------
2095f765521fSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2096f765521fSmrg
2097f765521fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2098f765521fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2099f765521fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2100f765521fSmrg		[Major version of this package])
2101f765521fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2102f765521fSmrg	if test "x$PVM" = "x"; then
2103f765521fSmrg		PVM="0"
2104f765521fSmrg	fi
2105f765521fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2106f765521fSmrg		[$PVM],
2107f765521fSmrg		[Minor version of this package])
2108f765521fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2109f765521fSmrg	if test "x$PVP" = "x"; then
2110f765521fSmrg		PVP="0"
2111f765521fSmrg	fi
2112f765521fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2113f765521fSmrg		[$PVP],
2114f765521fSmrg		[Patch version of this package])
2115f765521fSmrg])
2116f765521fSmrg
2117f765521fSmrg# XORG_CHANGELOG()
2118f765521fSmrg# ----------------
2119f765521fSmrg# Minimum version: 1.2.0
212031de2854Smrg#
2121f765521fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2122f765521fSmrg# ChangeLog from git.
212331de2854Smrg#
212431de2854Smrg#
2125f765521fSmrgAC_DEFUN([XORG_CHANGELOG], [
2126f765521fSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2127f765521fSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2128f765521fSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2129f765521fSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2130f765521fSmrgAC_SUBST([CHANGELOG_CMD])
2131f765521fSmrg]) # XORG_CHANGELOG
2132f765521fSmrg
2133f765521fSmrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
213431de2854Smrg#
2135f765521fSmrg# This file is free software; the Free Software Foundation
2136f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2137f765521fSmrg# with or without modifications, as long as this notice is preserved.
2138f765521fSmrg
2139f765521fSmrg# AM_AUTOMAKE_VERSION(VERSION)
2140f765521fSmrg# ----------------------------
2141f765521fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2142f765521fSmrg# generated from the m4 files accompanying Automake X.Y.
2143f765521fSmrg# (This private macro should not be called outside this file.)
2144f765521fSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2145f765521fSmrg[am__api_version='1.13'
2146f765521fSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2147f765521fSmrgdnl require some minimum version.  Point them to the right macro.
2148f765521fSmrgm4_if([$1], [1.13.4], [],
2149f765521fSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2150f765521fSmrg])
2151f765521fSmrg
2152f765521fSmrg# _AM_AUTOCONF_VERSION(VERSION)
2153f765521fSmrg# -----------------------------
2154f765521fSmrg# aclocal traces this macro to find the Autoconf version.
2155f765521fSmrg# This is a private macro too.  Using m4_define simplifies
2156f765521fSmrg# the logic in aclocal, which can simply ignore this definition.
2157f765521fSmrgm4_define([_AM_AUTOCONF_VERSION], [])
2158f765521fSmrg
2159f765521fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2160f765521fSmrg# -------------------------------
2161f765521fSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2162f765521fSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2163f765521fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2164f765521fSmrg[AM_AUTOMAKE_VERSION([1.13.4])dnl
2165f765521fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
2166f765521fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2167f765521fSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2168f765521fSmrg
2169f765521fSmrg# Copyright (C) 2011-2013 Free Software Foundation, Inc.
217031de2854Smrg#
2171f765521fSmrg# This file is free software; the Free Software Foundation
2172f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2173f765521fSmrg# with or without modifications, as long as this notice is preserved.
2174f765521fSmrg
2175f765521fSmrg# AM_PROG_AR([ACT-IF-FAIL])
2176f765521fSmrg# -------------------------
2177f765521fSmrg# Try to determine the archiver interface, and trigger the ar-lib wrapper
2178f765521fSmrg# if it is needed.  If the detection of archiver interface fails, run
2179f765521fSmrg# ACT-IF-FAIL (default is to abort configure with a proper error message).
2180f765521fSmrgAC_DEFUN([AM_PROG_AR],
2181f765521fSmrg[AC_BEFORE([$0], [LT_INIT])dnl
2182f765521fSmrgAC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
2183f765521fSmrgAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2184f765521fSmrgAC_REQUIRE_AUX_FILE([ar-lib])dnl
2185f765521fSmrgAC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
2186f765521fSmrg: ${AR=ar}
2187f765521fSmrg
2188f765521fSmrgAC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
2189f765521fSmrg  [am_cv_ar_interface=ar
2190f765521fSmrg   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
2191f765521fSmrg     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
2192f765521fSmrg      AC_TRY_EVAL([am_ar_try])
2193f765521fSmrg      if test "$ac_status" -eq 0; then
2194f765521fSmrg        am_cv_ar_interface=ar
2195f765521fSmrg      else
2196f765521fSmrg        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
2197f765521fSmrg        AC_TRY_EVAL([am_ar_try])
2198f765521fSmrg        if test "$ac_status" -eq 0; then
2199f765521fSmrg          am_cv_ar_interface=lib
2200f765521fSmrg        else
2201f765521fSmrg          am_cv_ar_interface=unknown
2202f765521fSmrg        fi
2203f765521fSmrg      fi
2204f765521fSmrg      rm -f conftest.lib libconftest.a
2205f765521fSmrg     ])
2206f765521fSmrg   ])
2207f765521fSmrg
2208f765521fSmrgcase $am_cv_ar_interface in
2209f765521fSmrgar)
2210f765521fSmrg  ;;
2211f765521fSmrglib)
2212f765521fSmrg  # Microsoft lib, so override with the ar-lib wrapper script.
2213f765521fSmrg  # FIXME: It is wrong to rewrite AR.
2214f765521fSmrg  # But if we don't then we get into trouble of one sort or another.
2215f765521fSmrg  # A longer-term fix would be to have automake use am__AR in this case,
2216f765521fSmrg  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
2217f765521fSmrg  # similar.
2218f765521fSmrg  AR="$am_aux_dir/ar-lib $AR"
2219f765521fSmrg  ;;
2220f765521fSmrgunknown)
2221f765521fSmrg  m4_default([$1],
2222f765521fSmrg             [AC_MSG_ERROR([could not determine $AR interface])])
2223f765521fSmrg  ;;
2224f765521fSmrgesac
2225f765521fSmrgAC_SUBST([AR])dnl
2226f765521fSmrg])
2227f765521fSmrg
2228f765521fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2229f765521fSmrg
2230f765521fSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
223131de2854Smrg#
2232f765521fSmrg# This file is free software; the Free Software Foundation
2233f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2234f765521fSmrg# with or without modifications, as long as this notice is preserved.
2235f765521fSmrg
2236f765521fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2237f765521fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2238f765521fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
223931de2854Smrg#
2240f765521fSmrg# Of course, Automake must honor this variable whenever it calls a
2241f765521fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2242f765521fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2243f765521fSmrg# depending on how configure is run.  This is pretty annoying, since
2244f765521fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2245f765521fSmrg# source directory, any form will work fine, but in subdirectories a
2246f765521fSmrg# relative path needs to be adjusted first.
224731de2854Smrg#
2248f765521fSmrg# $ac_aux_dir/missing
2249f765521fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2250f765521fSmrg# $top_srcdir/$ac_aux_dir/missing
2251f765521fSmrg#    fails if $ac_aux_dir is absolute,
2252f765521fSmrg#    fails when called from a subdirectory in a VPATH build with
2253f765521fSmrg#          a relative $ac_aux_dir
225431de2854Smrg#
2255f765521fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2256f765521fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
2257f765521fSmrg# harmless because $srcdir is '.', but things will broke when you
2258f765521fSmrg# start a VPATH build or use an absolute $srcdir.
225931de2854Smrg#
2260f765521fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2261f765521fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2262f765521fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2263f765521fSmrg# and then we would define $MISSING as
2264f765521fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2265f765521fSmrg# This will work as long as MISSING is not called from configure, because
2266f765521fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
2267f765521fSmrg# However there are other variables, like CC, which are often used in
2268f765521fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
226931de2854Smrg#
2270f765521fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
2271f765521fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
2272f765521fSmrg# configured tree to be moved without reconfiguration.
2273f765521fSmrg
2274f765521fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
2275f765521fSmrg[dnl Rely on autoconf to set up CDPATH properly.
2276f765521fSmrgAC_PREREQ([2.50])dnl
2277f765521fSmrg# expand $ac_aux_dir to an absolute path
2278f765521fSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
2279f765521fSmrg])
2280f765521fSmrg
2281f765521fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2282f765521fSmrg
2283f765521fSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
228431de2854Smrg#
2285f765521fSmrg# This file is free software; the Free Software Foundation
2286f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2287f765521fSmrg# with or without modifications, as long as this notice is preserved.
2288f765521fSmrg
2289f765521fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2290f765521fSmrg# -------------------------------------
2291f765521fSmrg# Define a conditional.
2292f765521fSmrgAC_DEFUN([AM_CONDITIONAL],
2293f765521fSmrg[AC_PREREQ([2.52])dnl
2294f765521fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2295f765521fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2296f765521fSmrgAC_SUBST([$1_TRUE])dnl
2297f765521fSmrgAC_SUBST([$1_FALSE])dnl
2298f765521fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2299f765521fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2300f765521fSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2301f765521fSmrgif $2; then
2302f765521fSmrg  $1_TRUE=
2303f765521fSmrg  $1_FALSE='#'
230431de2854Smrgelse
2305f765521fSmrg  $1_TRUE='#'
2306f765521fSmrg  $1_FALSE=
230731de2854Smrgfi
2308f765521fSmrgAC_CONFIG_COMMANDS_PRE(
2309f765521fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2310f765521fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2311f765521fSmrgUsually this means the macro was only invoked conditionally.]])
2312f765521fSmrgfi])])
231331de2854Smrg
2314f765521fSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
231531de2854Smrg#
2316f765521fSmrg# This file is free software; the Free Software Foundation
2317f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2318f765521fSmrg# with or without modifications, as long as this notice is preserved.
231931de2854Smrg
232031de2854Smrg
2321f765521fSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2322f765521fSmrg# written in clear, in which case automake, when reading aclocal.m4,
2323f765521fSmrg# will think it sees a *use*, and therefore will trigger all it's
2324f765521fSmrg# C support machinery.  Also note that it means that autoscan, seeing
2325f765521fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
232631de2854Smrg
232731de2854Smrg
2328f765521fSmrg# _AM_DEPENDENCIES(NAME)
2329c05e22d7Smrg# ----------------------
2330f765521fSmrg# See how the compiler implements dependency checking.
2331f765521fSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2332f765521fSmrg# We try a few techniques and use that to set a single cache variable.
2333c05e22d7Smrg#
2334f765521fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2335f765521fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2336f765521fSmrg# dependency, and given that the user is not expected to run this macro,
2337f765521fSmrg# just rely on AC_PROG_CC.
2338f765521fSmrgAC_DEFUN([_AM_DEPENDENCIES],
2339f765521fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2340f765521fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2341f765521fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2342f765521fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2343c05e22d7Smrg
2344f765521fSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2345f765521fSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2346f765521fSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2347f765521fSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2348f765521fSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2349f765521fSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2350f765521fSmrg                    [depcc="$$1"   am_compiler_list=])
23515dfecf96Smrg
2352f765521fSmrgAC_CACHE_CHECK([dependency style of $depcc],
2353f765521fSmrg               [am_cv_$1_dependencies_compiler_type],
2354f765521fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2355f765521fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
2356f765521fSmrg  # making bogus files that we don't know about and never remove.  For
2357f765521fSmrg  # instance it was reported that on HP-UX the gcc test will end up
2358f765521fSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
2359f765521fSmrg  # in D".
2360f765521fSmrg  rm -rf conftest.dir
2361f765521fSmrg  mkdir conftest.dir
2362f765521fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2363f765521fSmrg  # using a relative directory.
2364f765521fSmrg  cp "$am_depcomp" conftest.dir
2365f765521fSmrg  cd conftest.dir
2366f765521fSmrg  # We will build objects and dependencies in a subdirectory because
2367f765521fSmrg  # it helps to detect inapplicable dependency modes.  For instance
2368f765521fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2369f765521fSmrg  # side effect of compilation, but ICC will put the dependencies in
2370f765521fSmrg  # the current directory while Tru64 will put them in the object
2371f765521fSmrg  # directory.
2372f765521fSmrg  mkdir sub
2373c05e22d7Smrg
2374f765521fSmrg  am_cv_$1_dependencies_compiler_type=none
2375f765521fSmrg  if test "$am_compiler_list" = ""; then
2376f765521fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2377f765521fSmrg  fi
2378f765521fSmrg  am__universal=false
2379f765521fSmrg  m4_case([$1], [CC],
2380f765521fSmrg    [case " $depcc " in #(
2381f765521fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2382f765521fSmrg     esac],
2383f765521fSmrg    [CXX],
2384f765521fSmrg    [case " $depcc " in #(
2385f765521fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2386f765521fSmrg     esac])
2387f14f4646Smrg
2388f765521fSmrg  for depmode in $am_compiler_list; do
2389f765521fSmrg    # Setup a source with many dependencies, because some compilers
2390f765521fSmrg    # like to wrap large dependency lists on column 80 (with \), and
2391f765521fSmrg    # we should not choose a depcomp mode which is confused by this.
2392f765521fSmrg    #
2393f765521fSmrg    # We need to recreate these files for each test, as the compiler may
2394f765521fSmrg    # overwrite some of them when testing with obscure command lines.
2395f765521fSmrg    # This happens at least with the AIX C compiler.
2396f765521fSmrg    : > sub/conftest.c
2397f765521fSmrg    for i in 1 2 3 4 5 6; do
2398f765521fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2399f765521fSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2400f765521fSmrg      # Solaris 10 /bin/sh.
2401f765521fSmrg      echo '/* dummy */' > sub/conftst$i.h
2402f765521fSmrg    done
2403f765521fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2404f14f4646Smrg
2405f765521fSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2406f765521fSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2407f765521fSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2408f765521fSmrg    # versions had trouble with output in subdirs.
2409f765521fSmrg    am__obj=sub/conftest.${OBJEXT-o}
2410f765521fSmrg    am__minus_obj="-o $am__obj"
2411f765521fSmrg    case $depmode in
2412f765521fSmrg    gcc)
2413f765521fSmrg      # This depmode causes a compiler race in universal mode.
2414f765521fSmrg      test "$am__universal" = false || continue
2415f765521fSmrg      ;;
2416f765521fSmrg    nosideeffect)
2417f765521fSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2418f765521fSmrg      # only be used when explicitly requested.
2419f765521fSmrg      if test "x$enable_dependency_tracking" = xyes; then
2420f765521fSmrg	continue
2421f765521fSmrg      else
2422f765521fSmrg	break
2423f765521fSmrg      fi
2424f765521fSmrg      ;;
2425f765521fSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2426f765521fSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2427f765521fSmrg      # not run yet.  These depmodes are late enough in the game, and
2428f765521fSmrg      # so weak that their functioning should not be impacted.
2429f765521fSmrg      am__obj=conftest.${OBJEXT-o}
2430f765521fSmrg      am__minus_obj=
2431f765521fSmrg      ;;
2432f765521fSmrg    none) break ;;
2433f765521fSmrg    esac
2434f765521fSmrg    if depmode=$depmode \
2435f765521fSmrg       source=sub/conftest.c object=$am__obj \
2436f765521fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2437f765521fSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2438f765521fSmrg         >/dev/null 2>conftest.err &&
2439f765521fSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2440f765521fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2441f765521fSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2442f765521fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2443f765521fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2444f765521fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2445f765521fSmrg      # that says an option was ignored or not supported.
2446f765521fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2447f765521fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2448f765521fSmrg      # The diagnosis changed in icc 8.0:
2449f765521fSmrg      #   icc: Command line remark: option '-MP' not supported
2450f765521fSmrg      if (grep 'ignoring option' conftest.err ||
2451f765521fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2452f765521fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2453f765521fSmrg        break
2454f765521fSmrg      fi
2455f765521fSmrg    fi
2456f765521fSmrg  done
2457c05e22d7Smrg
2458f765521fSmrg  cd ..
2459f765521fSmrg  rm -rf conftest.dir
2460c05e22d7Smrgelse
2461f765521fSmrg  am_cv_$1_dependencies_compiler_type=none
2462c05e22d7Smrgfi
2463f765521fSmrg])
2464f765521fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2465f765521fSmrgAM_CONDITIONAL([am__fastdep$1], [
2466f765521fSmrg  test "x$enable_dependency_tracking" != xno \
2467f765521fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2468f765521fSmrg])
24695dfecf96Smrg
24705dfecf96Smrg
2471f765521fSmrg# AM_SET_DEPDIR
2472f765521fSmrg# -------------
2473f765521fSmrg# Choose a directory name for dependency files.
2474f765521fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2475f765521fSmrgAC_DEFUN([AM_SET_DEPDIR],
2476f765521fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2477f765521fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2478f765521fSmrg])
24795dfecf96Smrg
24805dfecf96Smrg
2481f765521fSmrg# AM_DEP_TRACK
2482f765521fSmrg# ------------
2483f765521fSmrgAC_DEFUN([AM_DEP_TRACK],
2484f765521fSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
2485f765521fSmrgAS_HELP_STRING(
2486f765521fSmrg  [--enable-dependency-tracking],
2487f765521fSmrg  [do not reject slow dependency extractors])
2488f765521fSmrgAS_HELP_STRING(
2489f765521fSmrg  [--disable-dependency-tracking],
2490f765521fSmrg  [speeds up one-time build])])
2491f765521fSmrgif test "x$enable_dependency_tracking" != xno; then
2492f765521fSmrg  am_depcomp="$ac_aux_dir/depcomp"
2493f765521fSmrg  AMDEPBACKSLASH='\'
2494f765521fSmrg  am__nodep='_no'
24955dfecf96Smrgfi
2496f765521fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2497f765521fSmrgAC_SUBST([AMDEPBACKSLASH])dnl
2498f765521fSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2499f765521fSmrgAC_SUBST([am__nodep])dnl
2500f765521fSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2501f765521fSmrg])
25025dfecf96Smrg
2503f765521fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
25045dfecf96Smrg
2505f765521fSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
250631de2854Smrg#
2507f765521fSmrg# This file is free software; the Free Software Foundation
2508f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2509f765521fSmrg# with or without modifications, as long as this notice is preserved.
251031de2854Smrg
2511f765521fSmrg
2512f765521fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2513f765521fSmrg# ------------------------------
2514f765521fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2515f765521fSmrg[{
2516f765521fSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
2517f765521fSmrg  # are listed without --file.  Let's play safe and only enable the eval
2518f765521fSmrg  # if we detect the quoting.
2519f765521fSmrg  case $CONFIG_FILES in
2520f765521fSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
2521f765521fSmrg  *)   set x $CONFIG_FILES ;;
2522f765521fSmrg  esac
2523f765521fSmrg  shift
2524f765521fSmrg  for mf
2525f765521fSmrg  do
2526f765521fSmrg    # Strip MF so we end up with the name of the file.
2527f765521fSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
2528f765521fSmrg    # Check whether this is an Automake generated Makefile or not.
2529f765521fSmrg    # We used to match only the files named 'Makefile.in', but
2530f765521fSmrg    # some people rename them; so instead we look at the file content.
2531f765521fSmrg    # Grep'ing the first line is not enough: some people post-process
2532f765521fSmrg    # each Makefile.in and add a new line on top of each file to say so.
2533f765521fSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
2534f765521fSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
2535f765521fSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2536f765521fSmrg      dirpart=`AS_DIRNAME("$mf")`
2537f765521fSmrg    else
2538f765521fSmrg      continue
2539f765521fSmrg    fi
2540f765521fSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
2541f765521fSmrg    # from the Makefile without running 'make'.
2542f765521fSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2543f765521fSmrg    test -z "$DEPDIR" && continue
2544f765521fSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2545f765521fSmrg    test -z "$am__include" && continue
2546f765521fSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2547f765521fSmrg    # Find all dependency output files, they are included files with
2548f765521fSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2549f765521fSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
2550f765521fSmrg    # expansion.
2551f765521fSmrg    for file in `sed -n "
2552f765521fSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2553f765521fSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2554f765521fSmrg      # Make sure the directory exists.
2555f765521fSmrg      test -f "$dirpart/$file" && continue
2556f765521fSmrg      fdir=`AS_DIRNAME(["$file"])`
2557f765521fSmrg      AS_MKDIR_P([$dirpart/$fdir])
2558f765521fSmrg      # echo "creating $dirpart/$file"
2559f765521fSmrg      echo '# dummy' > "$dirpart/$file"
2560f765521fSmrg    done
2561f765521fSmrg  done
2562f765521fSmrg}
2563f765521fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2564f765521fSmrg
2565f765521fSmrg
2566f765521fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2567f765521fSmrg# -----------------------------
2568f765521fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
256931de2854Smrg#
2570f765521fSmrg# This code is only required when automatic dependency tracking
2571f765521fSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
2572f765521fSmrg# need in order to bootstrap the dependency handling code.
2573f765521fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2574f765521fSmrg[AC_CONFIG_COMMANDS([depfiles],
2575f765521fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2576f765521fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2577f765521fSmrg])
257831de2854Smrg
2579f765521fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
258031de2854Smrg
2581f765521fSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2582f765521fSmrg#
2583f765521fSmrg# This file is free software; the Free Software Foundation
2584f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2585f765521fSmrg# with or without modifications, as long as this notice is preserved.
258631de2854Smrg
2587f765521fSmrg# This macro actually does too much.  Some checks are only needed if
2588f765521fSmrg# your package does certain things.  But this isn't really a big deal.
258931de2854Smrg
2590f765521fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2591f765521fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
2592f765521fSmrg# -----------------------------------------------
2593f765521fSmrg# The call with PACKAGE and VERSION arguments is the old style
2594f765521fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2595f765521fSmrg# and VERSION should now be passed to AC_INIT and removed from
2596f765521fSmrg# the call to AM_INIT_AUTOMAKE.
2597f765521fSmrg# We support both call styles for the transition.  After
2598f765521fSmrg# the next Automake release, Autoconf can make the AC_INIT
2599f765521fSmrg# arguments mandatory, and then we can depend on a new Autoconf
2600f765521fSmrg# release and drop the old call support.
2601f765521fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
2602f765521fSmrg[AC_PREREQ([2.65])dnl
2603f765521fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2604f765521fSmrgdnl the ones we care about.
2605f765521fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2606f765521fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2607f765521fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2608f765521fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2609f765521fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2610f765521fSmrg  # is not polluted with repeated "-I."
2611f765521fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2612f765521fSmrg  # test to see if srcdir already configured
2613f765521fSmrg  if test -f $srcdir/config.status; then
2614f765521fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2615f765521fSmrg  fi
261631de2854Smrgfi
261731de2854Smrg
2618f765521fSmrg# test whether we have cygpath
2619f765521fSmrgif test -z "$CYGPATH_W"; then
2620f765521fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2621f765521fSmrg    CYGPATH_W='cygpath -w'
2622f765521fSmrg  else
2623f765521fSmrg    CYGPATH_W=echo
2624f765521fSmrg  fi
262531de2854Smrgfi
2626f765521fSmrgAC_SUBST([CYGPATH_W])
262731de2854Smrg
2628f765521fSmrg# Define the identity of the package.
2629f765521fSmrgdnl Distinguish between old-style and new-style calls.
2630f765521fSmrgm4_ifval([$2],
2631f765521fSmrg[AC_DIAGNOSE([obsolete],
2632f765521fSmrg             [$0: two- and three-arguments forms are deprecated.])
2633f765521fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2634f765521fSmrg AC_SUBST([PACKAGE], [$1])dnl
2635f765521fSmrg AC_SUBST([VERSION], [$2])],
2636f765521fSmrg[_AM_SET_OPTIONS([$1])dnl
2637f765521fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2638f765521fSmrgm4_if(
2639f765521fSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2640f765521fSmrg  [ok:ok],,
2641f765521fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2642f765521fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2643f765521fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
264431de2854Smrg
2645f765521fSmrg_AM_IF_OPTION([no-define],,
2646f765521fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2647f765521fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
264831de2854Smrg
2649f765521fSmrg# Some tools Automake needs.
2650f765521fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2651f765521fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2652f765521fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2653f765521fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2654f765521fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2655f765521fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2656f765521fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2657f765521fSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2658f765521fSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2659f765521fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2660f765521fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
2661f765521fSmrg# dies out for good.  For more background, see:
2662f765521fSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2663f765521fSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2664f765521fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2665f765521fSmrg# We need awk for the "check" target.  The system "awk" is bad on
2666f765521fSmrg# some platforms.
2667f765521fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
2668f765521fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2669f765521fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2670f765521fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2671f765521fSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2672f765521fSmrg			     [_AM_PROG_TAR([v7])])])
2673f765521fSmrg_AM_IF_OPTION([no-dependencies],,
2674f765521fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2675f765521fSmrg		  [_AM_DEPENDENCIES([CC])],
2676f765521fSmrg		  [m4_define([AC_PROG_CC],
2677f765521fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2678f765521fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2679f765521fSmrg		  [_AM_DEPENDENCIES([CXX])],
2680f765521fSmrg		  [m4_define([AC_PROG_CXX],
2681f765521fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2682f765521fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2683f765521fSmrg		  [_AM_DEPENDENCIES([OBJC])],
2684f765521fSmrg		  [m4_define([AC_PROG_OBJC],
2685f765521fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2686f765521fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2687f765521fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
2688f765521fSmrg		  [m4_define([AC_PROG_OBJCXX],
2689f765521fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2690f765521fSmrg])
2691f765521fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2692f765521fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
2693f765521fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2694f765521fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2695f765521fSmrgAC_CONFIG_COMMANDS_PRE(dnl
2696f765521fSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2697f765521fSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2698f765521fSmrg])
269931de2854Smrg
2700f765521fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2701f765521fSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2702f765521fSmrgdnl mangled by Autoconf and run in a shell conditional statement.
2703f765521fSmrgm4_define([_AC_COMPILER_EXEEXT],
2704f765521fSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2705f765521fSmrg
2706f765521fSmrg
2707f765521fSmrg# When config.status generates a header, we must update the stamp-h file.
2708f765521fSmrg# This file resides in the same directory as the config header
2709f765521fSmrg# that is generated.  The stamp files are numbered to have different names.
2710f765521fSmrg
2711f765521fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2712f765521fSmrg# loop where config.status creates the headers, so we can generate
2713f765521fSmrg# our stamp files there.
2714f765521fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2715f765521fSmrg[# Compute $1's index in $config_headers.
2716f765521fSmrg_am_arg=$1
2717f765521fSmrg_am_stamp_count=1
2718f765521fSmrgfor _am_header in $config_headers :; do
2719f765521fSmrg  case $_am_header in
2720f765521fSmrg    $_am_arg | $_am_arg:* )
2721f765521fSmrg      break ;;
2722f765521fSmrg    * )
2723f765521fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2724f765521fSmrg  esac
2725f765521fSmrgdone
2726f765521fSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
272731de2854Smrg
2728f765521fSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2729f765521fSmrg#
2730f765521fSmrg# This file is free software; the Free Software Foundation
2731f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2732f765521fSmrg# with or without modifications, as long as this notice is preserved.
273331de2854Smrg
2734f765521fSmrg# AM_PROG_INSTALL_SH
2735f765521fSmrg# ------------------
2736f765521fSmrg# Define $install_sh.
2737f765521fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2738f765521fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2739f765521fSmrgif test x"${install_sh}" != xset; then
2740f765521fSmrg  case $am_aux_dir in
2741f765521fSmrg  *\ * | *\	*)
2742f765521fSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2743f765521fSmrg  *)
2744f765521fSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2745f765521fSmrg  esac
2746f765521fSmrgfi
2747f765521fSmrgAC_SUBST([install_sh])])
274831de2854Smrg
2749f765521fSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
275031de2854Smrg#
2751f765521fSmrg# This file is free software; the Free Software Foundation
2752f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2753f765521fSmrg# with or without modifications, as long as this notice is preserved.
275431de2854Smrg
2755f765521fSmrg# Check whether the underlying file-system supports filenames
2756f765521fSmrg# with a leading dot.  For instance MS-DOS doesn't.
2757f765521fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
2758f765521fSmrg[rm -rf .tst 2>/dev/null
2759f765521fSmrgmkdir .tst 2>/dev/null
2760f765521fSmrgif test -d .tst; then
2761f765521fSmrg  am__leading_dot=.
276231de2854Smrgelse
2763f765521fSmrg  am__leading_dot=_
276431de2854Smrgfi
2765f765521fSmrgrmdir .tst 2>/dev/null
2766f765521fSmrgAC_SUBST([am__leading_dot])])
276731de2854Smrg
2768f765521fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
276931de2854Smrg
2770f765521fSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2771f765521fSmrg#
2772f765521fSmrg# This file is free software; the Free Software Foundation
2773f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2774f765521fSmrg# with or without modifications, as long as this notice is preserved.
277531de2854Smrg
2776f765521fSmrg# AM_MAKE_INCLUDE()
2777f765521fSmrg# -----------------
2778f765521fSmrg# Check to see how make treats includes.
2779f765521fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
2780f765521fSmrg[am_make=${MAKE-make}
2781f765521fSmrgcat > confinc << 'END'
2782f765521fSmrgam__doit:
2783f765521fSmrg	@echo this is the am__doit target
2784f765521fSmrg.PHONY: am__doit
2785f765521fSmrgEND
2786f765521fSmrg# If we don't find an include directive, just comment out the code.
2787f765521fSmrgAC_MSG_CHECKING([for style of include used by $am_make])
2788f765521fSmrgam__include="#"
2789f765521fSmrgam__quote=
2790f765521fSmrg_am_result=none
2791f765521fSmrg# First try GNU make style include.
2792f765521fSmrgecho "include confinc" > confmf
2793f765521fSmrg# Ignore all kinds of additional output from 'make'.
2794f765521fSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
2795f765521fSmrg*the\ am__doit\ target*)
2796f765521fSmrg  am__include=include
2797f765521fSmrg  am__quote=
2798f765521fSmrg  _am_result=GNU
2799f765521fSmrg  ;;
2800f765521fSmrgesac
2801f765521fSmrg# Now try BSD make style include.
2802f765521fSmrgif test "$am__include" = "#"; then
2803f765521fSmrg   echo '.include "confinc"' > confmf
2804f765521fSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
2805f765521fSmrg   *the\ am__doit\ target*)
2806f765521fSmrg     am__include=.include
2807f765521fSmrg     am__quote="\""
2808f765521fSmrg     _am_result=BSD
2809f765521fSmrg     ;;
2810f765521fSmrg   esac
2811f765521fSmrgfi
2812f765521fSmrgAC_SUBST([am__include])
2813f765521fSmrgAC_SUBST([am__quote])
2814f765521fSmrgAC_MSG_RESULT([$_am_result])
2815f765521fSmrgrm -f confinc confmf
2816f765521fSmrg])
281731de2854Smrg
2818f765521fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
281931de2854Smrg
2820f765521fSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
2821f765521fSmrg#
2822f765521fSmrg# This file is free software; the Free Software Foundation
2823f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2824f765521fSmrg# with or without modifications, as long as this notice is preserved.
282531de2854Smrg
2826f765521fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
2827f765521fSmrg# ------------------------------
2828f765521fSmrgAC_DEFUN([AM_MISSING_PROG],
2829f765521fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2830f765521fSmrg$1=${$1-"${am_missing_run}$2"}
2831f765521fSmrgAC_SUBST($1)])
2832f765521fSmrg
2833f765521fSmrg# AM_MISSING_HAS_RUN
2834f765521fSmrg# ------------------
2835f765521fSmrg# Define MISSING if not defined so far and test if it is modern enough.
2836f765521fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
2837f765521fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2838f765521fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2839f765521fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
2840f765521fSmrgif test x"${MISSING+set}" != xset; then
2841f765521fSmrg  case $am_aux_dir in
2842f765521fSmrg  *\ * | *\	*)
2843f765521fSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2844f765521fSmrg  *)
2845f765521fSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2846f765521fSmrg  esac
2847f765521fSmrgfi
2848f765521fSmrg# Use eval to expand $SHELL
2849f765521fSmrgif eval "$MISSING --is-lightweight"; then
2850f765521fSmrg  am_missing_run="$MISSING "
285131de2854Smrgelse
2852f765521fSmrg  am_missing_run=
2853f765521fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
285431de2854Smrgfi
2855f765521fSmrg])
285631de2854Smrg
2857f765521fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
285831de2854Smrg
2859f765521fSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2860c05e22d7Smrg#
2861f765521fSmrg# This file is free software; the Free Software Foundation
2862f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2863f765521fSmrg# with or without modifications, as long as this notice is preserved.
28645dfecf96Smrg
2865f765521fSmrg# _AM_MANGLE_OPTION(NAME)
28665dfecf96Smrg# -----------------------
2867f765521fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
2868f765521fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2869f765521fSmrg
2870f765521fSmrg# _AM_SET_OPTION(NAME)
2871f765521fSmrg# --------------------
2872f765521fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
2873f765521fSmrgAC_DEFUN([_AM_SET_OPTION],
2874f765521fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2875c05e22d7Smrg
2876f765521fSmrg# _AM_SET_OPTIONS(OPTIONS)
2877f765521fSmrg# ------------------------
2878f765521fSmrg# OPTIONS is a space-separated list of Automake options.
2879f765521fSmrgAC_DEFUN([_AM_SET_OPTIONS],
2880f765521fSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
288131de2854Smrg
2882f765521fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2883f765521fSmrg# -------------------------------------------
2884f765521fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2885f765521fSmrgAC_DEFUN([_AM_IF_OPTION],
2886f765521fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
288731de2854Smrg
2888f765521fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
288931de2854Smrg
2890f765521fSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2891f765521fSmrg#
2892f765521fSmrg# This file is free software; the Free Software Foundation
2893f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2894f765521fSmrg# with or without modifications, as long as this notice is preserved.
289531de2854Smrg
2896f765521fSmrg# AM_SANITY_CHECK
2897f765521fSmrg# ---------------
2898f765521fSmrgAC_DEFUN([AM_SANITY_CHECK],
2899f765521fSmrg[AC_MSG_CHECKING([whether build environment is sane])
2900f765521fSmrg# Reject unsafe characters in $srcdir or the absolute working directory
2901f765521fSmrg# name.  Accept space and tab only in the latter.
2902f765521fSmrgam_lf='
2903f765521fSmrg'
2904f765521fSmrgcase `pwd` in
2905f765521fSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
2906f765521fSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
2907f765521fSmrgesac
2908f765521fSmrgcase $srcdir in
2909f765521fSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
2910f765521fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
2911f765521fSmrgesac
2912f765521fSmrg
2913f765521fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
2914f765521fSmrg# arguments.  Must try -L first in case configure is actually a
2915f765521fSmrg# symlink; some systems play weird games with the mod time of symlinks
2916f765521fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
2917f765521fSmrg# directory).
2918f765521fSmrgif (
2919f765521fSmrg   am_has_slept=no
2920f765521fSmrg   for am_try in 1 2; do
2921f765521fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
2922f765521fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
2923f765521fSmrg     if test "$[*]" = "X"; then
2924f765521fSmrg	# -L didn't work.
2925f765521fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
2926f765521fSmrg     fi
2927f765521fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
2928f765521fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
2929f765521fSmrg
2930f765521fSmrg	# If neither matched, then we have a broken ls.  This can happen
2931f765521fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
2932f765521fSmrg	# broken ls alias from the environment.  This has actually
2933f765521fSmrg	# happened.  Such a system could not be considered "sane".
2934f765521fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2935f765521fSmrg  alias in your environment])
2936f765521fSmrg     fi
2937f765521fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
2938f765521fSmrg       break
2939f765521fSmrg     fi
2940f765521fSmrg     # Just in case.
2941f765521fSmrg     sleep 1
2942f765521fSmrg     am_has_slept=yes
2943f765521fSmrg   done
2944f765521fSmrg   test "$[2]" = conftest.file
2945f765521fSmrg   )
2946f765521fSmrgthen
2947f765521fSmrg   # Ok.
2948f765521fSmrg   :
2949f765521fSmrgelse
2950f765521fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
2951f765521fSmrgCheck your system clock])
2952c05e22d7Smrgfi
2953f765521fSmrgAC_MSG_RESULT([yes])
2954f765521fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
2955f765521fSmrg# generated files are strictly newer.
2956f765521fSmrgam_sleep_pid=
2957f765521fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
2958f765521fSmrg  ( sleep 1 ) &
2959f765521fSmrg  am_sleep_pid=$!
2960f765521fSmrgfi
2961f765521fSmrgAC_CONFIG_COMMANDS_PRE(
2962f765521fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
2963f765521fSmrg   if test -n "$am_sleep_pid"; then
2964f765521fSmrg     # Hide warnings about reused PIDs.
2965f765521fSmrg     wait $am_sleep_pid 2>/dev/null
2966f765521fSmrg   fi
2967f765521fSmrg   AC_MSG_RESULT([done])])
2968f765521fSmrgrm -f conftest.file
2969f765521fSmrg])
29705dfecf96Smrg
2971f765521fSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
2972c05e22d7Smrg#
2973f765521fSmrg# This file is free software; the Free Software Foundation
2974f765521fSmrg# gives unlimited permission to copy and/or distribute it,
2975f765521fSmrg# with or without modifications, as long as this notice is preserved.
2976f765521fSmrg
2977f765521fSmrg# AM_SILENT_RULES([DEFAULT])
2978f765521fSmrg# --------------------------
2979f765521fSmrg# Enable less verbose build rules; with the default set to DEFAULT
2980f765521fSmrg# ("yes" being less verbose, "no" or empty being verbose).
2981f765521fSmrgAC_DEFUN([AM_SILENT_RULES],
2982f765521fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
2983f765521fSmrgAS_HELP_STRING(
2984f765521fSmrg  [--enable-silent-rules],
2985f765521fSmrg  [less verbose build output (undo: "make V=1")])
2986f765521fSmrgAS_HELP_STRING(
2987f765521fSmrg  [--disable-silent-rules],
2988f765521fSmrg  [verbose build output (undo: "make V=0")])dnl
2989f765521fSmrg])
2990f765521fSmrgcase $enable_silent_rules in @%:@ (((
2991f765521fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
2992f765521fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
2993f765521fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
2994f765521fSmrgesac
2995f765521fSmrgdnl
2996f765521fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
2997f765521fSmrgdnl do not support nested variable expansions.
2998f765521fSmrgdnl See automake bug#9928 and bug#10237.
2999f765521fSmrgam_make=${MAKE-make}
3000f765521fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
3001f765521fSmrg   [am_cv_make_support_nested_variables],
3002f765521fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
3003f765521fSmrgBAR0=false
3004f765521fSmrgBAR1=true
3005f765521fSmrgV=1
3006f765521fSmrgam__doit:
3007f765521fSmrg	@$(TRUE)
3008f765521fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3009f765521fSmrg  am_cv_make_support_nested_variables=yes
3010f765521fSmrgelse
3011f765521fSmrg  am_cv_make_support_nested_variables=no
3012f765521fSmrgfi])
3013f765521fSmrgif test $am_cv_make_support_nested_variables = yes; then
3014f765521fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3015f765521fSmrg  AM_V='$(V)'
3016f765521fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3017f765521fSmrgelse
3018f765521fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
3019f765521fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3020f765521fSmrgfi
3021f765521fSmrgAC_SUBST([AM_V])dnl
3022f765521fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
3023f765521fSmrgAC_SUBST([AM_DEFAULT_V])dnl
3024f765521fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3025f765521fSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3026f765521fSmrgAM_BACKSLASH='\'
3027f765521fSmrgAC_SUBST([AM_BACKSLASH])dnl
3028f765521fSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3029f765521fSmrg])
3030f765521fSmrg
3031f765521fSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
3032c05e22d7Smrg#
3033f765521fSmrg# This file is free software; the Free Software Foundation
3034f765521fSmrg# gives unlimited permission to copy and/or distribute it,
3035f765521fSmrg# with or without modifications, as long as this notice is preserved.
3036c05e22d7Smrg
3037f765521fSmrg# AM_PROG_INSTALL_STRIP
3038f765521fSmrg# ---------------------
3039f765521fSmrg# One issue with vendor 'install' (even GNU) is that you can't
3040f765521fSmrg# specify the program used to strip binaries.  This is especially
3041f765521fSmrg# annoying in cross-compiling environments, where the build's strip
3042f765521fSmrg# is unlikely to handle the host's binaries.
3043f765521fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
3044f765521fSmrg# always use install-sh in "make install-strip", and initialize
3045f765521fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
3046f765521fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3047f765521fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3048f765521fSmrg# Installed binaries are usually stripped using 'strip' when the user
3049f765521fSmrg# run "make install-strip".  However 'strip' might not be the right
3050f765521fSmrg# tool to use in cross-compilation environments, therefore Automake
3051f765521fSmrg# will honor the 'STRIP' environment variable to overrule this program.
3052f765521fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3053f765521fSmrgif test "$cross_compiling" != no; then
3054f765521fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
3055f765521fSmrgfi
3056f765521fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3057f765521fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3058f765521fSmrg
3059f765521fSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
3060c05e22d7Smrg#
3061f765521fSmrg# This file is free software; the Free Software Foundation
3062f765521fSmrg# gives unlimited permission to copy and/or distribute it,
3063f765521fSmrg# with or without modifications, as long as this notice is preserved.
3064f765521fSmrg
3065f765521fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
3066f765521fSmrg# ---------------------------
3067f765521fSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3068f765521fSmrg# This macro is traced by Automake.
3069f765521fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3070f765521fSmrg
3071f765521fSmrg# AM_SUBST_NOTMAKE(VARIABLE)
3072f765521fSmrg# --------------------------
3073f765521fSmrg# Public sister of _AM_SUBST_NOTMAKE.
3074f765521fSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3075f765521fSmrg
3076f765521fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3077f765521fSmrg
3078f765521fSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
3079c05e22d7Smrg#
3080f765521fSmrg# This file is free software; the Free Software Foundation
3081f765521fSmrg# gives unlimited permission to copy and/or distribute it,
3082f765521fSmrg# with or without modifications, as long as this notice is preserved.
30835dfecf96Smrg
3084f765521fSmrg# _AM_PROG_TAR(FORMAT)
3085c05e22d7Smrg# --------------------
3086f765521fSmrg# Check how to create a tarball in format FORMAT.
3087f765521fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3088c05e22d7Smrg#
3089f765521fSmrg# Substitute a variable $(am__tar) that is a command
3090f765521fSmrg# writing to stdout a FORMAT-tarball containing the directory
3091f765521fSmrg# $tardir.
3092f765521fSmrg#     tardir=directory && $(am__tar) > result.tar
3093c05e22d7Smrg#
3094f765521fSmrg# Substitute a variable $(am__untar) that extract such
3095f765521fSmrg# a tarball read from stdin.
3096f765521fSmrg#     $(am__untar) < result.tar
3097c05e22d7Smrg#
3098f765521fSmrgAC_DEFUN([_AM_PROG_TAR],
3099f765521fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
3100f765521fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
3101f765521fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3102f765521fSmrg
3103f765521fSmrg# We'll loop over all known methods to create a tar archive until one works.
3104f765521fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3105f765521fSmrg
3106f765521fSmrgm4_if([$1], [v7],
3107f765521fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3108f765521fSmrg
3109f765521fSmrg  [m4_case([$1],
3110f765521fSmrg    [ustar],
3111f765521fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3112f765521fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3113f765521fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3114f765521fSmrg      # and bug#13588).
3115f765521fSmrg      am_max_uid=2097151 # 2^21 - 1
3116f765521fSmrg      am_max_gid=$am_max_uid
3117f765521fSmrg      # The $UID and $GID variables are not portable, so we need to resort
3118f765521fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3119f765521fSmrg      # below are definitely unexpected, so allow the users to see them
3120f765521fSmrg      # (that is, avoid stderr redirection).
3121f765521fSmrg      am_uid=`id -u || echo unknown`
3122f765521fSmrg      am_gid=`id -g || echo unknown`
3123f765521fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3124f765521fSmrg      if test $am_uid -le $am_max_uid; then
3125f765521fSmrg         AC_MSG_RESULT([yes])
3126f765521fSmrg      else
3127f765521fSmrg         AC_MSG_RESULT([no])
3128f765521fSmrg         _am_tools=none
3129f765521fSmrg      fi
3130f765521fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3131f765521fSmrg      if test $am_gid -le $am_max_gid; then
3132f765521fSmrg         AC_MSG_RESULT([yes])
3133f765521fSmrg      else
3134f765521fSmrg        AC_MSG_RESULT([no])
3135f765521fSmrg        _am_tools=none
3136f765521fSmrg      fi],
3137f765521fSmrg
3138f765521fSmrg  [pax],
3139f765521fSmrg    [],
3140f765521fSmrg
3141f765521fSmrg  [m4_fatal([Unknown tar format])])
3142f765521fSmrg
3143f765521fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3144f765521fSmrg
3145f765521fSmrg  # Go ahead even if we have the value already cached.  We do so because we
3146f765521fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
3147f765521fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3148f765521fSmrg
3149f765521fSmrg  for _am_tool in $_am_tools; do
3150f765521fSmrg    case $_am_tool in
3151f765521fSmrg    gnutar)
3152f765521fSmrg      for _am_tar in tar gnutar gtar; do
3153f765521fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
3154f765521fSmrg      done
3155f765521fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3156f765521fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3157f765521fSmrg      am__untar="$_am_tar -xf -"
3158f765521fSmrg      ;;
3159f765521fSmrg    plaintar)
3160f765521fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
3161f765521fSmrg      # ustar tarball either.
3162f765521fSmrg      (tar --version) >/dev/null 2>&1 && continue
3163f765521fSmrg      am__tar='tar chf - "$$tardir"'
3164f765521fSmrg      am__tar_='tar chf - "$tardir"'
3165f765521fSmrg      am__untar='tar xf -'
3166f765521fSmrg      ;;
3167f765521fSmrg    pax)
3168f765521fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
3169f765521fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
3170f765521fSmrg      am__untar='pax -r'
3171f765521fSmrg      ;;
3172f765521fSmrg    cpio)
3173f765521fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3174f765521fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3175f765521fSmrg      am__untar='cpio -i -H $1 -d'
3176f765521fSmrg      ;;
3177f765521fSmrg    none)
3178f765521fSmrg      am__tar=false
3179f765521fSmrg      am__tar_=false
3180f765521fSmrg      am__untar=false
3181f765521fSmrg      ;;
3182f765521fSmrg    esac
3183f765521fSmrg
3184f765521fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
3185f765521fSmrg    # and am__untar set.
3186f765521fSmrg    test -n "${am_cv_prog_tar_$1}" && break
3187f765521fSmrg
3188f765521fSmrg    # tar/untar a dummy directory, and stop if the command works.
3189f765521fSmrg    rm -rf conftest.dir
3190f765521fSmrg    mkdir conftest.dir
3191f765521fSmrg    echo GrepMe > conftest.dir/file
3192f765521fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3193f765521fSmrg    rm -rf conftest.dir
3194f765521fSmrg    if test -s conftest.tar; then
3195f765521fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
3196f765521fSmrg      AM_RUN_LOG([cat conftest.dir/file])
3197f765521fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3198f765521fSmrg    fi
3199f765521fSmrg  done
3200f765521fSmrg  rm -rf conftest.dir
3201f765521fSmrg
3202f765521fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3203f765521fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3204f765521fSmrg
3205f765521fSmrgAC_SUBST([am__tar])
3206f765521fSmrgAC_SUBST([am__untar])
3207f765521fSmrg]) # _AM_PROG_TAR
32085dfecf96Smrg
3209