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