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