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