aclocal.m4 revision 423b239c
11b983734Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
2a733a5bfSmrg
31b983734Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
41a30de1fSmrg
51a30de1fSmrg# This file is free software; the Free Software Foundation
61a30de1fSmrg# gives unlimited permission to copy and/or distribute it,
71a30de1fSmrg# with or without modifications, as long as this notice is preserved.
81a30de1fSmrg
91a30de1fSmrg# This program is distributed in the hope that it will be useful,
101a30de1fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
111a30de1fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
121a30de1fSmrg# PARTICULAR PURPOSE.
131a30de1fSmrg
14a733a5bfSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15b7fb5eacSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16b7fb5eacSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
171b983734Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
181b983734Smrg[m4_warning([this file was generated for autoconf 2.69.
19b7fb5eacSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20b7fb5eacSmrgIf you have problems, you may need to regenerate the build system entirely.
21a733a5bfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
221a30de1fSmrg
23423b239cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
24423b239cSmrgdnl serial 11 (pkg-config-0.29)
25423b239cSmrgdnl
26423b239cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27423b239cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
28423b239cSmrgdnl
29423b239cSmrgdnl This program is free software; you can redistribute it and/or modify
30423b239cSmrgdnl it under the terms of the GNU General Public License as published by
31423b239cSmrgdnl the Free Software Foundation; either version 2 of the License, or
32423b239cSmrgdnl (at your option) any later version.
33423b239cSmrgdnl
34423b239cSmrgdnl This program is distributed in the hope that it will be useful, but
35423b239cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
36423b239cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37423b239cSmrgdnl General Public License for more details.
38423b239cSmrgdnl
39423b239cSmrgdnl You should have received a copy of the GNU General Public License
40423b239cSmrgdnl along with this program; if not, write to the Free Software
41423b239cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
42423b239cSmrgdnl 02111-1307, USA.
43423b239cSmrgdnl
44423b239cSmrgdnl As a special exception to the GNU General Public License, if you
45423b239cSmrgdnl distribute this file as part of a program that contains a
46423b239cSmrgdnl configuration script generated by Autoconf, you may include it under
47423b239cSmrgdnl the same distribution terms that you use for the rest of that
48423b239cSmrgdnl program.
49423b239cSmrg
50423b239cSmrgdnl PKG_PREREQ(MIN-VERSION)
51423b239cSmrgdnl -----------------------
52423b239cSmrgdnl Since: 0.29
53423b239cSmrgdnl
54423b239cSmrgdnl Verify that the version of the pkg-config macros are at least
55423b239cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
56423b239cSmrgdnl installed version of pkg-config, this checks the developer's version
57423b239cSmrgdnl of pkg.m4 when generating configure.
58423b239cSmrgdnl
59423b239cSmrgdnl To ensure that this macro is defined, also add:
60423b239cSmrgdnl m4_ifndef([PKG_PREREQ],
61423b239cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
62423b239cSmrgdnl
63423b239cSmrgdnl See the "Since" comment for each macro you use to see what version
64423b239cSmrgdnl of the macros you require.
65423b239cSmrgm4_defun([PKG_PREREQ],
66423b239cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
67423b239cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
68423b239cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
69423b239cSmrg])dnl PKG_PREREQ
70423b239cSmrg
71423b239cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
72423b239cSmrgdnl ----------------------------------
73423b239cSmrgdnl Since: 0.16
74423b239cSmrgdnl
75423b239cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
76423b239cSmrgdnl first found in the path. Checks that the version of pkg-config found
77423b239cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
78423b239cSmrgdnl used since that's the first version where most current features of
79423b239cSmrgdnl pkg-config existed.
80423b239cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
81423b239cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
82423b239cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
83423b239cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
84423b239cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
85423b239cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
86423b239cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
871a30de1fSmrg
88423b239cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
89423b239cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
90423b239cSmrgfi
91423b239cSmrgif test -n "$PKG_CONFIG"; then
92423b239cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
93423b239cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
94423b239cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
95423b239cSmrg		AC_MSG_RESULT([yes])
96423b239cSmrg	else
97423b239cSmrg		AC_MSG_RESULT([no])
98423b239cSmrg		PKG_CONFIG=""
99423b239cSmrg	fi
100423b239cSmrgfi[]dnl
101423b239cSmrg])dnl PKG_PROG_PKG_CONFIG
1021a30de1fSmrg
103423b239cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
104423b239cSmrgdnl -------------------------------------------------------------------
105423b239cSmrgdnl Since: 0.18
106423b239cSmrgdnl
107423b239cSmrgdnl Check to see whether a particular set of modules exists. Similar to
108423b239cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
109423b239cSmrgdnl
110423b239cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
111423b239cSmrgdnl only at the first occurence in configure.ac, so if the first place
112423b239cSmrgdnl it's called might be skipped (such as if it is within an "if", you
113423b239cSmrgdnl have to call PKG_CHECK_EXISTS manually
114423b239cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
115423b239cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
116423b239cSmrgif test -n "$PKG_CONFIG" && \
117423b239cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
118423b239cSmrg  m4_default([$2], [:])
119423b239cSmrgm4_ifvaln([$3], [else
120423b239cSmrg  $3])dnl
121423b239cSmrgfi])
1221a30de1fSmrg
123423b239cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
124423b239cSmrgdnl ---------------------------------------------
125423b239cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
126423b239cSmrgdnl pkg_failed based on the result.
127423b239cSmrgm4_define([_PKG_CONFIG],
128423b239cSmrg[if test -n "$$1"; then
129423b239cSmrg    pkg_cv_[]$1="$$1"
130423b239cSmrg elif test -n "$PKG_CONFIG"; then
131423b239cSmrg    PKG_CHECK_EXISTS([$3],
132423b239cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
133423b239cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
134423b239cSmrg		     [pkg_failed=yes])
135423b239cSmrg else
136423b239cSmrg    pkg_failed=untried
137423b239cSmrgfi[]dnl
138423b239cSmrg])dnl _PKG_CONFIG
1391a30de1fSmrg
140423b239cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
141423b239cSmrgdnl ---------------------------
142423b239cSmrgdnl Internal check to see if pkg-config supports short errors.
143423b239cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
144423b239cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
145423b239cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
146423b239cSmrg        _pkg_short_errors_supported=yes
147423b239cSmrgelse
148423b239cSmrg        _pkg_short_errors_supported=no
149423b239cSmrgfi[]dnl
150423b239cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1511a30de1fSmrg
1521a30de1fSmrg
153423b239cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
154423b239cSmrgdnl   [ACTION-IF-NOT-FOUND])
155423b239cSmrgdnl --------------------------------------------------------------
156423b239cSmrgdnl Since: 0.4.0
157423b239cSmrgdnl
158423b239cSmrgdnl Note that if there is a possibility the first call to
159423b239cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
160423b239cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
161423b239cSmrgAC_DEFUN([PKG_CHECK_MODULES],
162423b239cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
163423b239cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
164423b239cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1651a30de1fSmrg
166423b239cSmrgpkg_failed=no
167423b239cSmrgAC_MSG_CHECKING([for $1])
1681a30de1fSmrg
169423b239cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
170423b239cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1711a30de1fSmrg
172423b239cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
173423b239cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
174423b239cSmrgSee the pkg-config man page for more details.])
1751a30de1fSmrg
176423b239cSmrgif test $pkg_failed = yes; then
177423b239cSmrg   	AC_MSG_RESULT([no])
178423b239cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
179423b239cSmrg        if test $_pkg_short_errors_supported = yes; then
180423b239cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
181423b239cSmrg        else 
182423b239cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
183423b239cSmrg        fi
184423b239cSmrg	# Put the nasty error message in config.log where it belongs
185423b239cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1861a30de1fSmrg
187423b239cSmrg	m4_default([$4], [AC_MSG_ERROR(
188423b239cSmrg[Package requirements ($2) were not met:
1891a30de1fSmrg
190423b239cSmrg$$1_PKG_ERRORS
1911a30de1fSmrg
192423b239cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
193423b239cSmrginstalled software in a non-standard prefix.
1941a30de1fSmrg
195423b239cSmrg_PKG_TEXT])[]dnl
196423b239cSmrg        ])
197423b239cSmrgelif test $pkg_failed = untried; then
198423b239cSmrg     	AC_MSG_RESULT([no])
199423b239cSmrg	m4_default([$4], [AC_MSG_FAILURE(
200423b239cSmrg[The pkg-config script could not be found or is too old.  Make sure it
201423b239cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
202423b239cSmrgpath to pkg-config.
2031a30de1fSmrg
204423b239cSmrg_PKG_TEXT
2051a30de1fSmrg
206423b239cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
207423b239cSmrg        ])
208423b239cSmrgelse
209423b239cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
210423b239cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
211423b239cSmrg        AC_MSG_RESULT([yes])
212423b239cSmrg	$3
213423b239cSmrgfi[]dnl
214423b239cSmrg])dnl PKG_CHECK_MODULES
2151a30de1fSmrg
2161a30de1fSmrg
217423b239cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
218423b239cSmrgdnl   [ACTION-IF-NOT-FOUND])
219423b239cSmrgdnl ---------------------------------------------------------------------
220423b239cSmrgdnl Since: 0.29
221423b239cSmrgdnl
222423b239cSmrgdnl Checks for existence of MODULES and gathers its build flags with
223423b239cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
224423b239cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
225423b239cSmrgdnl
226423b239cSmrgdnl Note that if there is a possibility the first call to
227423b239cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
228423b239cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
229423b239cSmrgdnl configure.ac.
230423b239cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
231423b239cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
232423b239cSmrg_save_PKG_CONFIG=$PKG_CONFIG
233423b239cSmrgPKG_CONFIG="$PKG_CONFIG --static"
234423b239cSmrgPKG_CHECK_MODULES($@)
235423b239cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
236423b239cSmrg])dnl PKG_CHECK_MODULES_STATIC
237b7fb5eacSmrg
2381a30de1fSmrg
239423b239cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
240423b239cSmrgdnl -------------------------
241423b239cSmrgdnl Since: 0.27
242423b239cSmrgdnl
243423b239cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
244423b239cSmrgdnl should install pkg-config .pc files. By default the directory is
245423b239cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
246423b239cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
247423b239cSmrgdnl parameter.
248423b239cSmrgAC_DEFUN([PKG_INSTALLDIR],
249423b239cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
250423b239cSmrgm4_pushdef([pkg_description],
251423b239cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
252423b239cSmrgAC_ARG_WITH([pkgconfigdir],
253423b239cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
254423b239cSmrg    [with_pkgconfigdir=]pkg_default)
255423b239cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
256423b239cSmrgm4_popdef([pkg_default])
257423b239cSmrgm4_popdef([pkg_description])
258423b239cSmrg])dnl PKG_INSTALLDIR
259423b239cSmrg
260423b239cSmrg
261423b239cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
262423b239cSmrgdnl --------------------------------
263423b239cSmrgdnl Since: 0.27
264423b239cSmrgdnl
265423b239cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
266423b239cSmrgdnl module should install arch-independent pkg-config .pc files. By
267423b239cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
268423b239cSmrgdnl changed by passing DIRECTORY. The user can override through the
269423b239cSmrgdnl --with-noarch-pkgconfigdir parameter.
270423b239cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
271423b239cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
272423b239cSmrgm4_pushdef([pkg_description],
273423b239cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
274423b239cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
275423b239cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
276423b239cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
277423b239cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
278423b239cSmrgm4_popdef([pkg_default])
279423b239cSmrgm4_popdef([pkg_description])
280423b239cSmrg])dnl PKG_NOARCH_INSTALLDIR
281423b239cSmrg
282423b239cSmrg
283423b239cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
284423b239cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
285423b239cSmrgdnl -------------------------------------------
286423b239cSmrgdnl Since: 0.28
287423b239cSmrgdnl
288423b239cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
289423b239cSmrgAC_DEFUN([PKG_CHECK_VAR],
290423b239cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
291423b239cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2921a30de1fSmrg
293423b239cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
294423b239cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
295423b239cSmrg
296423b239cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
297423b239cSmrg])dnl PKG_CHECK_VAR
298423b239cSmrg
299423b239cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
300423b239cSmrgdnl
301423b239cSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
302423b239cSmrgdnl
303423b239cSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
304423b239cSmrgdnl copy of this software and associated documentation files (the "Software"),
305423b239cSmrgdnl to deal in the Software without restriction, including without limitation
306423b239cSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
307423b239cSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
308423b239cSmrgdnl Software is furnished to do so, subject to the following conditions:
309423b239cSmrgdnl
310423b239cSmrgdnl The above copyright notice and this permission notice (including the next
311423b239cSmrgdnl paragraph) shall be included in all copies or substantial portions of the
312423b239cSmrgdnl Software.
313423b239cSmrgdnl
314423b239cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
315423b239cSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
316423b239cSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
317423b239cSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
318423b239cSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
319423b239cSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
320423b239cSmrgdnl DEALINGS IN THE SOFTWARE.
321423b239cSmrg
322423b239cSmrg# XORG_MACROS_VERSION(required-version)
323423b239cSmrg# -------------------------------------
324423b239cSmrg# Minimum version: 1.1.0
325423b239cSmrg#
326423b239cSmrg# If you're using a macro added in Version 1.1 or newer, include this in
327423b239cSmrg# your configure.ac with the minimum required version, such as:
328423b239cSmrg# XORG_MACROS_VERSION(1.1)
329423b239cSmrg#
330423b239cSmrg# To ensure that this macro is defined, also add:
331423b239cSmrg# m4_ifndef([XORG_MACROS_VERSION],
332423b239cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
333423b239cSmrg#
334423b239cSmrg#
335423b239cSmrg# See the "minimum version" comment for each macro you use to see what
336423b239cSmrg# version you require.
337423b239cSmrgm4_defun([XORG_MACROS_VERSION],[
338423b239cSmrgm4_define([vers_have], [1.19.0])
339423b239cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
340423b239cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
341423b239cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
342423b239cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
343423b239cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
344423b239cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
345423b239cSmrgm4_undefine([vers_have])
346423b239cSmrgm4_undefine([maj_have])
347423b239cSmrgm4_undefine([maj_needed])
348423b239cSmrg]) # XORG_MACROS_VERSION
349423b239cSmrg
350423b239cSmrg# XORG_PROG_RAWCPP()
351423b239cSmrg# ------------------
352423b239cSmrg# Minimum version: 1.0.0
353423b239cSmrg#
354423b239cSmrg# Find cpp program and necessary flags for use in pre-processing text files
355423b239cSmrg# such as man pages and config files
356423b239cSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
357423b239cSmrgAC_REQUIRE([AC_PROG_CPP])
358423b239cSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
359423b239cSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
360423b239cSmrg
361423b239cSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
362423b239cSmrg# which is not the best choice for supporting other OS'es, but covers most
363423b239cSmrg# of the ones we need for now.
364423b239cSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
365423b239cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
366423b239cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
367423b239cSmrg	AC_MSG_RESULT([no])
3681a30de1fSmrgelse
369423b239cSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
370423b239cSmrg		RAWCPPFLAGS=-undef
371423b239cSmrg		AC_MSG_RESULT([yes])
372423b239cSmrg	# under Cygwin unix is still defined even with -undef
373423b239cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
374423b239cSmrg		RAWCPPFLAGS="-undef -ansi"
375423b239cSmrg		AC_MSG_RESULT([yes, with -ansi])
376423b239cSmrg	else
377423b239cSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
378423b239cSmrg	fi
3791a30de1fSmrgfi
380423b239cSmrgrm -f conftest.$ac_ext
3811a30de1fSmrg
382423b239cSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
383423b239cSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
384423b239cSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
385423b239cSmrg	AC_MSG_RESULT([no])
386423b239cSmrgelse
387423b239cSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
388423b239cSmrg		TRADITIONALCPPFLAGS="-traditional"
389423b239cSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
390423b239cSmrg		AC_MSG_RESULT([yes])
391423b239cSmrg	else
392423b239cSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
393423b239cSmrg	fi
394423b239cSmrgfi
395423b239cSmrgrm -f conftest.$ac_ext
396423b239cSmrgAC_SUBST(RAWCPPFLAGS)
397423b239cSmrgAC_SUBST(TRADITIONALCPPFLAGS)
398423b239cSmrg]) # XORG_PROG_RAWCPP
3991a30de1fSmrg
400423b239cSmrg# XORG_MANPAGE_SECTIONS()
401423b239cSmrg# -----------------------
402423b239cSmrg# Minimum version: 1.0.0
403423b239cSmrg#
404423b239cSmrg# Determine which sections man pages go in for the different man page types
405423b239cSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
406423b239cSmrg# Not sure if there's any better way than just hardcoding by OS name.
407423b239cSmrg# Override default settings by setting environment variables
408423b239cSmrg# Added MAN_SUBSTS in version 1.8
409423b239cSmrg# Added AC_PROG_SED in version 1.8
4101a30de1fSmrg
411423b239cSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
412423b239cSmrgAC_REQUIRE([AC_CANONICAL_HOST])
413423b239cSmrgAC_REQUIRE([AC_PROG_SED])
4141a30de1fSmrg
415423b239cSmrgif test x$APP_MAN_SUFFIX = x    ; then
416423b239cSmrg    APP_MAN_SUFFIX=1
417423b239cSmrgfi
418423b239cSmrgif test x$APP_MAN_DIR = x    ; then
419423b239cSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4201a30de1fSmrgfi
4211a30de1fSmrg
422423b239cSmrgif test x$LIB_MAN_SUFFIX = x    ; then
423423b239cSmrg    LIB_MAN_SUFFIX=3
424423b239cSmrgfi
425423b239cSmrgif test x$LIB_MAN_DIR = x    ; then
426423b239cSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
427423b239cSmrgfi
4281a30de1fSmrg
429423b239cSmrgif test x$FILE_MAN_SUFFIX = x    ; then
430423b239cSmrg    case $host_os in
431423b239cSmrg	# Solaris 2.0 - 11 use SysV man page sections
432423b239cSmrg	solaris2.?|solaris2.1[[01]])	FILE_MAN_SUFFIX=4  ;;
433423b239cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
434423b239cSmrg    esac
435423b239cSmrgfi
436423b239cSmrgif test x$FILE_MAN_DIR = x    ; then
437423b239cSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
438423b239cSmrgfi
4391a30de1fSmrg
440423b239cSmrgif test x$MISC_MAN_SUFFIX = x    ; then
441423b239cSmrg    case $host_os in
442423b239cSmrg	# Solaris 2.0 - 11 use SysV man page sections
443423b239cSmrg	solaris2.?|solaris2.1[[01]])	MISC_MAN_SUFFIX=5  ;;
444423b239cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
445423b239cSmrg    esac
446423b239cSmrgfi
447423b239cSmrgif test x$MISC_MAN_DIR = x    ; then
448423b239cSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
449423b239cSmrgfi
4501a30de1fSmrg
451423b239cSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
452423b239cSmrg    case $host_os in
453423b239cSmrg	# Solaris 2.0 - 11 use SysV man page sections
454423b239cSmrg	solaris2.?|solaris2.1[[01]])	DRIVER_MAN_SUFFIX=7  ;;
455423b239cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
456423b239cSmrg    esac
457423b239cSmrgfi
458423b239cSmrgif test x$DRIVER_MAN_DIR = x    ; then
459423b239cSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
460423b239cSmrgfi
461423b239cSmrg
462423b239cSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
463423b239cSmrg    case $host_os in
464423b239cSmrg	# Solaris 2.0 - 11 use SysV man page sections
465423b239cSmrg	solaris2.?|solaris2.1[[01]])	ADMIN_MAN_SUFFIX=1m ;;
466423b239cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
467423b239cSmrg    esac
468423b239cSmrgfi
469423b239cSmrgif test x$ADMIN_MAN_DIR = x    ; then
470423b239cSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
471423b239cSmrgfi
4721a30de1fSmrg
4731a30de1fSmrg
474423b239cSmrgAC_SUBST([APP_MAN_SUFFIX])
475423b239cSmrgAC_SUBST([LIB_MAN_SUFFIX])
476423b239cSmrgAC_SUBST([FILE_MAN_SUFFIX])
477423b239cSmrgAC_SUBST([MISC_MAN_SUFFIX])
478423b239cSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
479423b239cSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
480423b239cSmrgAC_SUBST([APP_MAN_DIR])
481423b239cSmrgAC_SUBST([LIB_MAN_DIR])
482423b239cSmrgAC_SUBST([FILE_MAN_DIR])
483423b239cSmrgAC_SUBST([MISC_MAN_DIR])
484423b239cSmrgAC_SUBST([DRIVER_MAN_DIR])
485423b239cSmrgAC_SUBST([ADMIN_MAN_DIR])
486423b239cSmrg
487423b239cSmrgXORG_MAN_PAGE="X Version 11"
488423b239cSmrgAC_SUBST([XORG_MAN_PAGE])
489423b239cSmrgMAN_SUBSTS="\
490423b239cSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
491423b239cSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
492423b239cSmrg	-e 's|__xservername__|Xorg|g' \
493423b239cSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
494423b239cSmrg	-e 's|__projectroot__|\$(prefix)|g' \
495423b239cSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
496423b239cSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
497423b239cSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
498423b239cSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
499423b239cSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
500423b239cSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
501423b239cSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
502423b239cSmrgAC_SUBST([MAN_SUBSTS])
503423b239cSmrg
504423b239cSmrg]) # XORG_MANPAGE_SECTIONS
505423b239cSmrg
506423b239cSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
507423b239cSmrg# ------------------------
508423b239cSmrg# Minimum version: 1.7.0
5091a30de1fSmrg#
510423b239cSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
511423b239cSmrg# provided by xorg-sgml-doctools, if installed.
512423b239cSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
513423b239cSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
514423b239cSmrgXORG_SGML_PATH=
515423b239cSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
516423b239cSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
517423b239cSmrg    [m4_ifval([$1],[:],
518423b239cSmrg        [if test x"$cross_compiling" != x"yes" ; then
519423b239cSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
520423b239cSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
521423b239cSmrg         fi])
522423b239cSmrg    ])
5231a30de1fSmrg
524423b239cSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
525423b239cSmrg# the path and the name of the doc stylesheet
526423b239cSmrgif test "x$XORG_SGML_PATH" != "x" ; then
527423b239cSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
528423b239cSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
529423b239cSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
530423b239cSmrgelse
531423b239cSmrg   AC_MSG_RESULT([no])
532423b239cSmrgfi
5331a30de1fSmrg
534423b239cSmrgAC_SUBST(XORG_SGML_PATH)
535423b239cSmrgAC_SUBST(STYLESHEET_SRCDIR)
536423b239cSmrgAC_SUBST(XSL_STYLESHEET)
537423b239cSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
538423b239cSmrg]) # XORG_CHECK_SGML_DOCTOOLS
539423b239cSmrg
540423b239cSmrg# XORG_CHECK_LINUXDOC
541423b239cSmrg# -------------------
542423b239cSmrg# Minimum version: 1.0.0
5431a30de1fSmrg#
544423b239cSmrg# Defines the variable MAKE_TEXT if the necessary tools and
545423b239cSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
546423b239cSmrg# Whether or not the necessary tools and files are found can be checked
547423b239cSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
548423b239cSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
549423b239cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
550423b239cSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
5511a30de1fSmrg
552423b239cSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
5531a30de1fSmrg
554423b239cSmrgAC_MSG_CHECKING([whether to build documentation])
555a733a5bfSmrg
556423b239cSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
557423b239cSmrg   BUILDDOC=yes
558423b239cSmrgelse
559423b239cSmrg   BUILDDOC=no
5601a30de1fSmrgfi
5611a30de1fSmrg
562423b239cSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
563423b239cSmrg
564423b239cSmrgAC_MSG_RESULT([$BUILDDOC])
565423b239cSmrg
566423b239cSmrgAC_MSG_CHECKING([whether to build pdf documentation])
567423b239cSmrg
568423b239cSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
569423b239cSmrg   BUILDPDFDOC=yes
570423b239cSmrgelse
571423b239cSmrg   BUILDPDFDOC=no
5721a30de1fSmrgfi
5731a30de1fSmrg
574423b239cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
5751a30de1fSmrg
576423b239cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
5771a30de1fSmrg
578423b239cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
579423b239cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
580423b239cSmrgMAKE_PDF="$PS2PDF"
581423b239cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
5821a30de1fSmrg
583423b239cSmrgAC_SUBST(MAKE_TEXT)
584423b239cSmrgAC_SUBST(MAKE_PS)
585423b239cSmrgAC_SUBST(MAKE_PDF)
586423b239cSmrgAC_SUBST(MAKE_HTML)
587423b239cSmrg]) # XORG_CHECK_LINUXDOC
588a733a5bfSmrg
589423b239cSmrg# XORG_CHECK_DOCBOOK
590423b239cSmrg# -------------------
591423b239cSmrg# Minimum version: 1.0.0
592423b239cSmrg#
593423b239cSmrg# Checks for the ability to build output formats from SGML DocBook source.
594423b239cSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
595423b239cSmrg# indicates whether the necessary tools and files are found and, if set,
596423b239cSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
597423b239cSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
598423b239cSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
599a733a5bfSmrg
600423b239cSmrgBUILDTXTDOC=no
601423b239cSmrgBUILDPDFDOC=no
602423b239cSmrgBUILDPSDOC=no
603423b239cSmrgBUILDHTMLDOC=no
604a733a5bfSmrg
605423b239cSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
606423b239cSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
607423b239cSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
608423b239cSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
609a733a5bfSmrg
610423b239cSmrgAC_MSG_CHECKING([whether to build text documentation])
611423b239cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
612423b239cSmrg   test x$BUILD_TXTDOC != xno; then
613423b239cSmrg	BUILDTXTDOC=yes
614423b239cSmrgfi
615423b239cSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
616423b239cSmrgAC_MSG_RESULT([$BUILDTXTDOC])
617a733a5bfSmrg
618423b239cSmrgAC_MSG_CHECKING([whether to build PDF documentation])
619423b239cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
620423b239cSmrg   test x$BUILD_PDFDOC != xno; then
621423b239cSmrg	BUILDPDFDOC=yes
622423b239cSmrgfi
623423b239cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
624423b239cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
625a733a5bfSmrg
626423b239cSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
627423b239cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
628423b239cSmrg   test x$BUILD_PSDOC != xno; then
629423b239cSmrg	BUILDPSDOC=yes
6301b983734Smrgfi
631423b239cSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
632423b239cSmrgAC_MSG_RESULT([$BUILDPSDOC])
633a733a5bfSmrg
634423b239cSmrgAC_MSG_CHECKING([whether to build HTML documentation])
635423b239cSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
636423b239cSmrg   test x$BUILD_HTMLDOC != xno; then
637423b239cSmrg	BUILDHTMLDOC=yes
638423b239cSmrgfi
639423b239cSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
640423b239cSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
641b7fb5eacSmrg
642423b239cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
643423b239cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
644423b239cSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
645423b239cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
6461a30de1fSmrg
647423b239cSmrgAC_SUBST(MAKE_TEXT)
648423b239cSmrgAC_SUBST(MAKE_PS)
649423b239cSmrgAC_SUBST(MAKE_PDF)
650423b239cSmrgAC_SUBST(MAKE_HTML)
651423b239cSmrg]) # XORG_CHECK_DOCBOOK
6521a30de1fSmrg
653423b239cSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
654423b239cSmrg# ----------------
655423b239cSmrg# Minimum version: 1.5.0
656423b239cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
6571a30de1fSmrg#
658423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
659423b239cSmrg# not at the appropriate level. This macro enables a module to test for the
660423b239cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
661423b239cSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
662423b239cSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
663423b239cSmrg# --with-xmlto assumes 'auto'.
6641a30de1fSmrg#
665423b239cSmrg# Interface to module:
666423b239cSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
667423b239cSmrg# XMLTO:	returns the path of the xmlto program found
668423b239cSmrg#		returns the path set by the user in the environment
669423b239cSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
670423b239cSmrg#		'no' user instructs the module not to use xmlto
671423b239cSmrg#
672423b239cSmrg# Added in version 1.10.0
673423b239cSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
674423b239cSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
675423b239cSmrg#
676423b239cSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
677423b239cSmrg#
678423b239cSmrgAC_DEFUN([XORG_WITH_XMLTO],[
679423b239cSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
680423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
681423b239cSmrgAC_ARG_WITH(xmlto,
682423b239cSmrg	AS_HELP_STRING([--with-xmlto],
683423b239cSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
684423b239cSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
685423b239cSmrgm4_undefine([_defopt])
6861a30de1fSmrg
687423b239cSmrgif test "x$use_xmlto" = x"auto"; then
688423b239cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
689423b239cSmrg   if test "x$XMLTO" = "x"; then
690423b239cSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
691423b239cSmrg	have_xmlto=no
692423b239cSmrg   else
693423b239cSmrg        have_xmlto=yes
694423b239cSmrg   fi
695423b239cSmrgelif test "x$use_xmlto" = x"yes" ; then
696423b239cSmrg   AC_PATH_PROG([XMLTO], [xmlto])
697423b239cSmrg   if test "x$XMLTO" = "x"; then
698423b239cSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
699423b239cSmrg   fi
700423b239cSmrg   have_xmlto=yes
701423b239cSmrgelif test "x$use_xmlto" = x"no" ; then
702423b239cSmrg   if test "x$XMLTO" != "x"; then
703423b239cSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
704423b239cSmrg   fi
705423b239cSmrg   have_xmlto=no
7061a30de1fSmrgelse
707423b239cSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
7081a30de1fSmrgfi
7091a30de1fSmrg
710423b239cSmrg# Test for a minimum version of xmlto, if provided.
711423b239cSmrgm4_ifval([$1],
712423b239cSmrg[if test "$have_xmlto" = yes; then
713423b239cSmrg    # scrape the xmlto version
714423b239cSmrg    AC_MSG_CHECKING([the xmlto version])
715423b239cSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
716423b239cSmrg    AC_MSG_RESULT([$xmlto_version])
717423b239cSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
718423b239cSmrg        [if test "x$use_xmlto" = xauto; then
719423b239cSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
720423b239cSmrg            have_xmlto=no
721423b239cSmrg        else
722423b239cSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
723423b239cSmrg        fi])
724423b239cSmrgfi])
7251a30de1fSmrg
726423b239cSmrg# Test for the ability of xmlto to generate a text target
7271a30de1fSmrg#
728423b239cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
729423b239cSmrg# following test for empty XML docbook files.
730423b239cSmrg# For compatibility reasons use the following empty XML docbook file and if
731423b239cSmrg# it fails try it again with a non-empty XML file.
732423b239cSmrghave_xmlto_text=no
733423b239cSmrgcat > conftest.xml << "EOF"
734423b239cSmrgEOF
735423b239cSmrgAS_IF([test "$have_xmlto" = yes],
736423b239cSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
737423b239cSmrg             [have_xmlto_text=yes],
738423b239cSmrg             [# Try it again with a non-empty XML file.
739423b239cSmrg              cat > conftest.xml << "EOF"
740423b239cSmrg<x></x>
741423b239cSmrgEOF
742423b239cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
743423b239cSmrg                    [have_xmlto_text=yes],
744423b239cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
745423b239cSmrgrm -f conftest.xml
746423b239cSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
747423b239cSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
748423b239cSmrg]) # XORG_WITH_XMLTO
7491a30de1fSmrg
750423b239cSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
751423b239cSmrg# --------------------------------------------
752423b239cSmrg# Minimum version: 1.12.0
753423b239cSmrg# Minimum version for optional DEFAULT argument: 1.12.0
7541a30de1fSmrg#
755423b239cSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
756423b239cSmrg# XML-based language used for the transformation of XML documents.
757423b239cSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
758423b239cSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
759423b239cSmrg# The XSLT processor is often used as a standalone tool for transformations.
760423b239cSmrg# It should not be assumed that this tool is used only to work with documnetation.
761423b239cSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
762423b239cSmrg#
763423b239cSmrg# Interface to module:
764423b239cSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
765423b239cSmrg# XSLTPROC:	 returns the path of the xsltproc program found
766423b239cSmrg#		 returns the path set by the user in the environment
767423b239cSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
768423b239cSmrg#		  'no' user instructs the module not to use xsltproc
769423b239cSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
770423b239cSmrg#
771423b239cSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
772423b239cSmrg#
773423b239cSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
774423b239cSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
775423b239cSmrg# Preserves the interface, should it be implemented later
776423b239cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
777423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
778423b239cSmrgAC_ARG_WITH(xsltproc,
779423b239cSmrg	AS_HELP_STRING([--with-xsltproc],
780423b239cSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
781423b239cSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
782423b239cSmrgm4_undefine([_defopt])
7831a30de1fSmrg
784423b239cSmrgif test "x$use_xsltproc" = x"auto"; then
785423b239cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
786423b239cSmrg   if test "x$XSLTPROC" = "x"; then
787423b239cSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
788423b239cSmrg	have_xsltproc=no
789423b239cSmrg   else
790423b239cSmrg        have_xsltproc=yes
791423b239cSmrg   fi
792423b239cSmrgelif test "x$use_xsltproc" = x"yes" ; then
793423b239cSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
794423b239cSmrg   if test "x$XSLTPROC" = "x"; then
795423b239cSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
796423b239cSmrg   fi
797423b239cSmrg   have_xsltproc=yes
798423b239cSmrgelif test "x$use_xsltproc" = x"no" ; then
799423b239cSmrg   if test "x$XSLTPROC" != "x"; then
800423b239cSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
801423b239cSmrg   fi
802423b239cSmrg   have_xsltproc=no
8031a30de1fSmrgelse
804423b239cSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
8051a30de1fSmrgfi
8061a30de1fSmrg
807423b239cSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
808423b239cSmrg]) # XORG_WITH_XSLTPROC
8091a30de1fSmrg
810423b239cSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
811423b239cSmrg# ----------------------------------------
812423b239cSmrg# Minimum version: 1.15.0
8131a30de1fSmrg#
814423b239cSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
815423b239cSmrg# scanning arbitrary text files, extracting information from those text files,
816423b239cSmrg# and printing reports based on that information.
817423b239cSmrg#
818423b239cSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
819423b239cSmrg#
820423b239cSmrg# Interface to module:
821423b239cSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
822423b239cSmrg# PERL:	     returns the path of the perl program found
823423b239cSmrg#	     returns the path set by the user in the environment
824423b239cSmrg# --with-perl: 'yes' user instructs the module to use perl
825423b239cSmrg#	       'no' user instructs the module not to use perl
826423b239cSmrg# have_perl: returns yes if perl found in PATH or no
827423b239cSmrg#
828423b239cSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
829423b239cSmrg#
830423b239cSmrgAC_DEFUN([XORG_WITH_PERL],[
831423b239cSmrgAC_ARG_VAR([PERL], [Path to perl command])
832423b239cSmrg# Preserves the interface, should it be implemented later
833423b239cSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
834423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
835423b239cSmrgAC_ARG_WITH(perl,
836423b239cSmrg	AS_HELP_STRING([--with-perl],
837423b239cSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
838423b239cSmrg	   [use_perl=$withval], [use_perl=]_defopt)
839423b239cSmrgm4_undefine([_defopt])
8401a30de1fSmrg
841423b239cSmrgif test "x$use_perl" = x"auto"; then
842423b239cSmrg   AC_PATH_PROG([PERL], [perl])
843423b239cSmrg   if test "x$PERL" = "x"; then
844423b239cSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
845423b239cSmrg	have_perl=no
846423b239cSmrg   else
847423b239cSmrg        have_perl=yes
848423b239cSmrg   fi
849423b239cSmrgelif test "x$use_perl" = x"yes" ; then
850423b239cSmrg   AC_PATH_PROG([PERL], [perl])
851423b239cSmrg   if test "x$PERL" = "x"; then
852423b239cSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
853423b239cSmrg   fi
854423b239cSmrg   have_perl=yes
855423b239cSmrgelif test "x$use_perl" = x"no" ; then
856423b239cSmrg   if test "x$PERL" != "x"; then
857423b239cSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
858423b239cSmrg   fi
859423b239cSmrg   have_perl=no
860423b239cSmrgelse
861423b239cSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
862423b239cSmrgfi
8631a30de1fSmrg
864423b239cSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
865423b239cSmrg]) # XORG_WITH_PERL
8661a30de1fSmrg
867423b239cSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
868423b239cSmrg# ----------------
869423b239cSmrg# Minimum version: 1.5.0
870423b239cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
871a733a5bfSmrg#
872423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
873423b239cSmrg# not at the appropriate level. This macro enables a module to test for the
874423b239cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
875423b239cSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
876423b239cSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
877423b239cSmrg# --with-asciidoc assumes 'auto'.
878423b239cSmrg#
879423b239cSmrg# Interface to module:
880423b239cSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
881423b239cSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
882423b239cSmrg#		 returns the path set by the user in the environment
883423b239cSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
884423b239cSmrg#		  'no' user instructs the module not to use asciidoc
885423b239cSmrg#
886423b239cSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
887423b239cSmrg#
888423b239cSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
889423b239cSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
890423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
891423b239cSmrgAC_ARG_WITH(asciidoc,
892423b239cSmrg	AS_HELP_STRING([--with-asciidoc],
893423b239cSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
894423b239cSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
895423b239cSmrgm4_undefine([_defopt])
896a733a5bfSmrg
897423b239cSmrgif test "x$use_asciidoc" = x"auto"; then
898423b239cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
899423b239cSmrg   if test "x$ASCIIDOC" = "x"; then
900423b239cSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
901423b239cSmrg	have_asciidoc=no
902423b239cSmrg   else
903423b239cSmrg        have_asciidoc=yes
904423b239cSmrg   fi
905423b239cSmrgelif test "x$use_asciidoc" = x"yes" ; then
906423b239cSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
907423b239cSmrg   if test "x$ASCIIDOC" = "x"; then
908423b239cSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
909423b239cSmrg   fi
910423b239cSmrg   have_asciidoc=yes
911423b239cSmrgelif test "x$use_asciidoc" = x"no" ; then
912423b239cSmrg   if test "x$ASCIIDOC" != "x"; then
913423b239cSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
914423b239cSmrg   fi
915423b239cSmrg   have_asciidoc=no
916423b239cSmrgelse
917423b239cSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
918a733a5bfSmrgfi
919423b239cSmrgm4_ifval([$1],
920423b239cSmrg[if test "$have_asciidoc" = yes; then
921423b239cSmrg    # scrape the asciidoc version
922423b239cSmrg    AC_MSG_CHECKING([the asciidoc version])
923423b239cSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
924423b239cSmrg    AC_MSG_RESULT([$asciidoc_version])
925423b239cSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
926423b239cSmrg        [if test "x$use_asciidoc" = xauto; then
927423b239cSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
928423b239cSmrg            have_asciidoc=no
929423b239cSmrg        else
930423b239cSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
931423b239cSmrg        fi])
932423b239cSmrgfi])
933423b239cSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
934423b239cSmrg]) # XORG_WITH_ASCIIDOC
9351a30de1fSmrg
936423b239cSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
937423b239cSmrg# -------------------------------------------
938423b239cSmrg# Minimum version: 1.5.0
939423b239cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
940423b239cSmrg# Minimum version for optional DOT checking: 1.18.0
9411a30de1fSmrg#
942423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
943423b239cSmrg# not at the appropriate level. This macro enables a module to test for the
944423b239cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
945423b239cSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
946423b239cSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
947423b239cSmrg# --with-doxygen assumes 'auto'.
948a733a5bfSmrg#
949423b239cSmrg# Interface to module:
950423b239cSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
951423b239cSmrg# DOXYGEN:	 returns the path of the doxygen program found
952423b239cSmrg#		 returns the path set by the user in the environment
953423b239cSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
954423b239cSmrg#		  'no' user instructs the module not to use doxygen
955423b239cSmrg#
956423b239cSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
957423b239cSmrg#
958423b239cSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
959423b239cSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
960423b239cSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
961423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
962423b239cSmrgAC_ARG_WITH(doxygen,
963423b239cSmrg	AS_HELP_STRING([--with-doxygen],
964423b239cSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
965423b239cSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
966423b239cSmrgm4_undefine([_defopt])
967a733a5bfSmrg
968423b239cSmrgif test "x$use_doxygen" = x"auto"; then
969423b239cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
970423b239cSmrg   if test "x$DOXYGEN" = "x"; then
971423b239cSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
972423b239cSmrg	have_doxygen=no
973423b239cSmrg   else
974423b239cSmrg        have_doxygen=yes
975423b239cSmrg   fi
976423b239cSmrgelif test "x$use_doxygen" = x"yes" ; then
977423b239cSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
978423b239cSmrg   if test "x$DOXYGEN" = "x"; then
979423b239cSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
980423b239cSmrg   fi
981423b239cSmrg   have_doxygen=yes
982423b239cSmrgelif test "x$use_doxygen" = x"no" ; then
983423b239cSmrg   if test "x$DOXYGEN" != "x"; then
984423b239cSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
985423b239cSmrg   fi
986423b239cSmrg   have_doxygen=no
9871a30de1fSmrgelse
988423b239cSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
9891a30de1fSmrgfi
990423b239cSmrgm4_ifval([$1],
991423b239cSmrg[if test "$have_doxygen" = yes; then
992423b239cSmrg    # scrape the doxygen version
993423b239cSmrg    AC_MSG_CHECKING([the doxygen version])
994423b239cSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
995423b239cSmrg    AC_MSG_RESULT([$doxygen_version])
996423b239cSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
997423b239cSmrg        [if test "x$use_doxygen" = xauto; then
998423b239cSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
999423b239cSmrg            have_doxygen=no
1000423b239cSmrg        else
1001423b239cSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1002423b239cSmrg        fi])
1003423b239cSmrgfi])
1004423b239cSmrg
1005423b239cSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
1006423b239cSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
1007423b239cSmrgdnl 	HAVE_DOT = @HAVE_DOT@
1008423b239cSmrgHAVE_DOT=no
1009423b239cSmrgif test "x$have_doxygen" = "xyes"; then
1010423b239cSmrg  AC_PATH_PROG([DOT], [dot])
1011423b239cSmrg    if test "x$DOT" != "x"; then
1012423b239cSmrg      HAVE_DOT=yes
1013423b239cSmrg    fi
1014a733a5bfSmrgfi
10151a30de1fSmrg
1016423b239cSmrgAC_SUBST([HAVE_DOT])
1017423b239cSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
1018423b239cSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1019423b239cSmrg]) # XORG_WITH_DOXYGEN
1020b7fb5eacSmrg
1021423b239cSmrg# XORG_WITH_GROFF([DEFAULT])
1022423b239cSmrg# ----------------
1023423b239cSmrg# Minimum version: 1.6.0
1024423b239cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
10251a30de1fSmrg#
1026423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
1027423b239cSmrg# not at the appropriate level. This macro enables a module to test for the
1028423b239cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1029423b239cSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
1030423b239cSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
1031423b239cSmrg# --with-groff assumes 'auto'.
1032423b239cSmrg#
1033423b239cSmrg# Interface to module:
1034423b239cSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1035423b239cSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1036423b239cSmrg# HAVE_GROFF_MS: the -ms macros package
1037423b239cSmrg# GROFF:	 returns the path of the groff program found
1038423b239cSmrg#		 returns the path set by the user in the environment
1039423b239cSmrg# --with-groff:	 'yes' user instructs the module to use groff
1040423b239cSmrg#		 'no' user instructs the module not to use groff
1041423b239cSmrg#
1042423b239cSmrg# Added in version 1.9.0:
1043423b239cSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1044423b239cSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1045423b239cSmrg#		   psselect from the psutils package.
1046423b239cSmrg#		   the ghostcript package. Refer to the grohtml man pages
1047423b239cSmrg#
1048423b239cSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1049423b239cSmrg#
1050423b239cSmrg# OS and distros often splits groff in a basic and full package, the former
1051423b239cSmrg# having the groff program and the later having devices, fonts and macros
1052423b239cSmrg# Checking for the groff executable is not enough.
1053423b239cSmrg#
1054423b239cSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
1055423b239cSmrg# unset HAVE_GROFF or GROFF env variables.
1056423b239cSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1057423b239cSmrg#
1058423b239cSmrgAC_DEFUN([XORG_WITH_GROFF],[
1059423b239cSmrgAC_ARG_VAR([GROFF], [Path to groff command])
1060423b239cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1061423b239cSmrgAC_ARG_WITH(groff,
1062423b239cSmrg	AS_HELP_STRING([--with-groff],
1063423b239cSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1064423b239cSmrg	   [use_groff=$withval], [use_groff=]_defopt)
1065423b239cSmrgm4_undefine([_defopt])
10661a30de1fSmrg
1067423b239cSmrgif test "x$use_groff" = x"auto"; then
1068423b239cSmrg   AC_PATH_PROG([GROFF], [groff])
1069423b239cSmrg   if test "x$GROFF" = "x"; then
1070423b239cSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1071423b239cSmrg	have_groff=no
1072423b239cSmrg   else
1073423b239cSmrg        have_groff=yes
1074423b239cSmrg   fi
1075423b239cSmrgelif test "x$use_groff" = x"yes" ; then
1076423b239cSmrg   AC_PATH_PROG([GROFF], [groff])
1077423b239cSmrg   if test "x$GROFF" = "x"; then
1078423b239cSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1079423b239cSmrg   fi
1080423b239cSmrg   have_groff=yes
1081423b239cSmrgelif test "x$use_groff" = x"no" ; then
1082423b239cSmrg   if test "x$GROFF" != "x"; then
1083423b239cSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1084423b239cSmrg   fi
1085423b239cSmrg   have_groff=no
1086423b239cSmrgelse
1087423b239cSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
10881a30de1fSmrgfi
10891a30de1fSmrg
1090423b239cSmrg# We have groff, test for the presence of the macro packages
1091423b239cSmrgif test "x$have_groff" = x"yes"; then
1092423b239cSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1093423b239cSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1094423b239cSmrg        groff_ms_works=yes
1095423b239cSmrg    else
1096423b239cSmrg        groff_ms_works=no
1097423b239cSmrg    fi
1098423b239cSmrg    AC_MSG_RESULT([$groff_ms_works])
1099423b239cSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1100423b239cSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1101423b239cSmrg        groff_mm_works=yes
1102423b239cSmrg    else
1103423b239cSmrg        groff_mm_works=no
1104423b239cSmrg    fi
1105423b239cSmrg    AC_MSG_RESULT([$groff_mm_works])
1106423b239cSmrgfi
11071a30de1fSmrg
1108423b239cSmrg# We have groff, test for HTML dependencies, one command per package
1109423b239cSmrgif test "x$have_groff" = x"yes"; then
1110423b239cSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1111423b239cSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1112423b239cSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1113423b239cSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1114423b239cSmrg      have_groff_html=yes
1115423b239cSmrg   else
1116423b239cSmrg      have_groff_html=no
1117423b239cSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1118423b239cSmrg   fi
1119423b239cSmrgfi
1120b7fb5eacSmrg
1121423b239cSmrg# Set Automake conditionals for Makefiles
1122423b239cSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1123423b239cSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1124423b239cSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1125423b239cSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1126423b239cSmrg]) # XORG_WITH_GROFF
11271a30de1fSmrg
1128423b239cSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1129423b239cSmrg# ---------------------------------------
1130423b239cSmrg# Minimum version: 1.6.0
1131423b239cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1132423b239cSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
11331a30de1fSmrg#
1134423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
1135423b239cSmrg# not at the appropriate level. This macro enables a module to test for the
1136423b239cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1137423b239cSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
1138423b239cSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
1139423b239cSmrg# --with-fop assumes 'auto'.
11401a30de1fSmrg#
1141423b239cSmrg# Interface to module:
1142423b239cSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1143423b239cSmrg# FOP:	 	returns the path of the fop program found
1144423b239cSmrg#		returns the path set by the user in the environment
1145423b239cSmrg# --with-fop: 	'yes' user instructs the module to use fop
1146423b239cSmrg#		'no' user instructs the module not to use fop
11471a30de1fSmrg#
1148423b239cSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1149a733a5bfSmrg#
1150423b239cSmrgAC_DEFUN([XORG_WITH_FOP],[
1151423b239cSmrgAC_ARG_VAR([FOP], [Path to fop command])
1152423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1153423b239cSmrgAC_ARG_WITH(fop,
1154423b239cSmrg	AS_HELP_STRING([--with-fop],
1155423b239cSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1156423b239cSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1157423b239cSmrgm4_undefine([_defopt])
1158a733a5bfSmrg
1159423b239cSmrgif test "x$use_fop" = x"auto"; then
1160423b239cSmrg   AC_PATH_PROG([FOP], [fop])
1161423b239cSmrg   if test "x$FOP" = "x"; then
1162423b239cSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1163423b239cSmrg	have_fop=no
1164423b239cSmrg   else
1165423b239cSmrg        have_fop=yes
1166423b239cSmrg   fi
1167423b239cSmrgelif test "x$use_fop" = x"yes" ; then
1168423b239cSmrg   AC_PATH_PROG([FOP], [fop])
1169423b239cSmrg   if test "x$FOP" = "x"; then
1170423b239cSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1171423b239cSmrg   fi
1172423b239cSmrg   have_fop=yes
1173423b239cSmrgelif test "x$use_fop" = x"no" ; then
1174423b239cSmrg   if test "x$FOP" != "x"; then
1175423b239cSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1176423b239cSmrg   fi
1177423b239cSmrg   have_fop=no
1178423b239cSmrgelse
1179423b239cSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1180423b239cSmrgfi
1181a733a5bfSmrg
1182423b239cSmrg# Test for a minimum version of fop, if provided.
1183423b239cSmrgm4_ifval([$1],
1184423b239cSmrg[if test "$have_fop" = yes; then
1185423b239cSmrg    # scrape the fop version
1186423b239cSmrg    AC_MSG_CHECKING([for fop minimum version])
1187423b239cSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1188423b239cSmrg    AC_MSG_RESULT([$fop_version])
1189423b239cSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1190423b239cSmrg        [if test "x$use_fop" = xauto; then
1191423b239cSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1192423b239cSmrg            have_fop=no
1193423b239cSmrg        else
1194423b239cSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1195423b239cSmrg        fi])
1196423b239cSmrgfi])
1197423b239cSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1198423b239cSmrg]) # XORG_WITH_FOP
11991a30de1fSmrg
1200423b239cSmrg# XORG_WITH_M4([MIN-VERSION])
1201423b239cSmrg# ---------------------------
1202423b239cSmrg# Minimum version: 1.19.0
12031a30de1fSmrg#
1204423b239cSmrg# This macro attempts to locate an m4 macro processor which supports
1205423b239cSmrg# -I option and is only useful for modules relying on M4 in order to
1206423b239cSmrg# expand macros in source code files.
12071a30de1fSmrg#
1208423b239cSmrg# Interface to module:
1209423b239cSmrg# M4:	 	returns the path of the m4 program found
1210423b239cSmrg#		returns the path set by the user in the environment
12111a30de1fSmrg#
1212423b239cSmrgAC_DEFUN([XORG_WITH_M4], [
1213423b239cSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
1214423b239cSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
1215423b239cSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
1216423b239cSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
1217423b239cSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
1218423b239cSmrg   [$PATH:/usr/gnu/bin])])
12191a30de1fSmrg
1220423b239cSmrgAC_SUBST([M4], [$ac_cv_path_M4])
1221423b239cSmrg]) # XORG_WITH_M4
12221a30de1fSmrg
1223423b239cSmrg# XORG_WITH_PS2PDF([DEFAULT])
1224423b239cSmrg# ----------------
1225423b239cSmrg# Minimum version: 1.6.0
1226423b239cSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1227423b239cSmrg#
1228423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
1229423b239cSmrg# not at the appropriate level. This macro enables a module to test for the
1230423b239cSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1231423b239cSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1232423b239cSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1233423b239cSmrg# --with-ps2pdf assumes 'auto'.
12341a30de1fSmrg#
1235423b239cSmrg# Interface to module:
1236423b239cSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1237423b239cSmrg# PS2PDF:	returns the path of the ps2pdf program found
1238423b239cSmrg#		returns the path set by the user in the environment
1239423b239cSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1240423b239cSmrg#		 'no' user instructs the module not to use ps2pdf
1241a733a5bfSmrg#
1242423b239cSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1243a733a5bfSmrg#
1244423b239cSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1245423b239cSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1246423b239cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1247423b239cSmrgAC_ARG_WITH(ps2pdf,
1248423b239cSmrg	AS_HELP_STRING([--with-ps2pdf],
1249423b239cSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1250423b239cSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1251423b239cSmrgm4_undefine([_defopt])
1252a733a5bfSmrg
1253423b239cSmrgif test "x$use_ps2pdf" = x"auto"; then
1254423b239cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1255423b239cSmrg   if test "x$PS2PDF" = "x"; then
1256423b239cSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1257423b239cSmrg	have_ps2pdf=no
1258423b239cSmrg   else
1259423b239cSmrg        have_ps2pdf=yes
1260423b239cSmrg   fi
1261423b239cSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1262423b239cSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1263423b239cSmrg   if test "x$PS2PDF" = "x"; then
1264423b239cSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1265423b239cSmrg   fi
1266423b239cSmrg   have_ps2pdf=yes
1267423b239cSmrgelif test "x$use_ps2pdf" = x"no" ; then
1268423b239cSmrg   if test "x$PS2PDF" != "x"; then
1269423b239cSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1270423b239cSmrg   fi
1271423b239cSmrg   have_ps2pdf=no
1272a733a5bfSmrgelse
1273423b239cSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1274423b239cSmrgfi
1275423b239cSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1276423b239cSmrg]) # XORG_WITH_PS2PDF
1277a733a5bfSmrg
1278423b239cSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1279423b239cSmrg# ----------------
1280423b239cSmrg# Minimum version: 1.6.0
1281a733a5bfSmrg#
1282423b239cSmrg# Documentation tools are not always available on all platforms and sometimes
1283423b239cSmrg# not at the appropriate level. This macro enables a builder to skip all
1284423b239cSmrg# documentation targets except traditional man pages.
1285423b239cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1286423b239cSmrg# maximum flexibilty in controlling documentation building.
1287423b239cSmrg# Refer to:
1288423b239cSmrg# XORG_WITH_XMLTO         --with-xmlto
1289423b239cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1290423b239cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1291423b239cSmrg# XORG_WITH_FOP           --with-fop
1292423b239cSmrg# XORG_WITH_GROFF         --with-groff
1293423b239cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1294a733a5bfSmrg#
1295423b239cSmrg# Interface to module:
1296423b239cSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1297423b239cSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1298423b239cSmrg#		 'no' user instructs the module not to generate docs
1299423b239cSmrg# parm1:	specify the default value, yes or no.
1300a733a5bfSmrg#
1301423b239cSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1302423b239cSmrgm4_define([docs_default], m4_default([$1], [yes]))
1303423b239cSmrgAC_ARG_ENABLE(docs,
1304423b239cSmrg	AS_HELP_STRING([--enable-docs],
1305423b239cSmrg	   [Enable building the documentation (default: ]docs_default[)]),
1306423b239cSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
1307423b239cSmrgm4_undefine([docs_default])
1308423b239cSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1309423b239cSmrgAC_MSG_CHECKING([whether to build documentation])
1310423b239cSmrgAC_MSG_RESULT([$build_docs])
1311423b239cSmrg]) # XORG_ENABLE_DOCS
1312a733a5bfSmrg
1313423b239cSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1314423b239cSmrg# ----------------
1315423b239cSmrg# Minimum version: 1.6.0
1316423b239cSmrg#
1317423b239cSmrg# This macro enables a builder to skip all developer documentation.
1318423b239cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1319423b239cSmrg# maximum flexibilty in controlling documentation building.
1320423b239cSmrg# Refer to:
1321423b239cSmrg# XORG_WITH_XMLTO         --with-xmlto
1322423b239cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1323423b239cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1324423b239cSmrg# XORG_WITH_FOP           --with-fop
1325423b239cSmrg# XORG_WITH_GROFF         --with-groff
1326423b239cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1327423b239cSmrg#
1328423b239cSmrg# Interface to module:
1329423b239cSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1330423b239cSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1331423b239cSmrg#			'no' user instructs the module not to generate developer docs
1332423b239cSmrg# parm1:		specify the default value, yes or no.
1333423b239cSmrg#
1334423b239cSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1335423b239cSmrgm4_define([devel_default], m4_default([$1], [yes]))
1336423b239cSmrgAC_ARG_ENABLE(devel-docs,
1337423b239cSmrg	AS_HELP_STRING([--enable-devel-docs],
1338423b239cSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1339423b239cSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1340423b239cSmrgm4_undefine([devel_default])
1341423b239cSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1342423b239cSmrgAC_MSG_CHECKING([whether to build developer documentation])
1343423b239cSmrgAC_MSG_RESULT([$build_devel_docs])
1344423b239cSmrg]) # XORG_ENABLE_DEVEL_DOCS
1345a733a5bfSmrg
1346423b239cSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1347423b239cSmrg# ----------------
1348423b239cSmrg# Minimum version: 1.6.0
1349423b239cSmrg#
1350423b239cSmrg# This macro enables a builder to skip all functional specification targets.
1351423b239cSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1352423b239cSmrg# maximum flexibilty in controlling documentation building.
1353423b239cSmrg# Refer to:
1354423b239cSmrg# XORG_WITH_XMLTO         --with-xmlto
1355423b239cSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1356423b239cSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1357423b239cSmrg# XORG_WITH_FOP           --with-fop
1358423b239cSmrg# XORG_WITH_GROFF         --with-groff
1359423b239cSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1360423b239cSmrg#
1361423b239cSmrg# Interface to module:
1362423b239cSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1363423b239cSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1364423b239cSmrg#			'no' user instructs the module not to generate specs
1365423b239cSmrg# parm1:		specify the default value, yes or no.
1366423b239cSmrg#
1367423b239cSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1368423b239cSmrgm4_define([spec_default], m4_default([$1], [yes]))
1369423b239cSmrgAC_ARG_ENABLE(specs,
1370423b239cSmrg	AS_HELP_STRING([--enable-specs],
1371423b239cSmrg	   [Enable building the specs (default: ]spec_default[)]),
1372423b239cSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1373423b239cSmrgm4_undefine([spec_default])
1374423b239cSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1375423b239cSmrgAC_MSG_CHECKING([whether to build functional specifications])
1376423b239cSmrgAC_MSG_RESULT([$build_specs])
1377423b239cSmrg]) # XORG_ENABLE_SPECS
1378a733a5bfSmrg
1379423b239cSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
1380423b239cSmrg# ----------------------------------------------
1381423b239cSmrg# Minimum version: 1.13.0
1382423b239cSmrg#
1383423b239cSmrg# This macro enables a builder to enable/disable unit testing
1384423b239cSmrg# It makes no assumption about the test cases implementation
1385423b239cSmrg# Test cases may or may not use Automake "Support for test suites"
1386423b239cSmrg# They may or may not use the software utility library GLib
1387423b239cSmrg#
1388423b239cSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
1389423b239cSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
1390423b239cSmrg# The variable enable_unit_tests is used by other macros in this file.
1391423b239cSmrg#
1392423b239cSmrg# Interface to module:
1393423b239cSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
1394423b239cSmrg# enable_unit_tests:    used in configure.ac for additional configuration
1395423b239cSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
1396423b239cSmrg#			'no' user instructs the module not to build tests
1397423b239cSmrg# parm1:		specify the default value, yes or no.
1398423b239cSmrg#
1399423b239cSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
1400423b239cSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
1401423b239cSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1402423b239cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1403423b239cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1404423b239cSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
1405423b239cSmrg	[Enable building unit test cases (default: ]_defopt[)]),
1406423b239cSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
1407423b239cSmrgm4_undefine([_defopt])
1408423b239cSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
1409423b239cSmrgAC_MSG_CHECKING([whether to build unit test cases])
1410423b239cSmrgAC_MSG_RESULT([$enable_unit_tests])
1411423b239cSmrg]) # XORG_ENABLE_UNIT_TESTS
1412a733a5bfSmrg
1413423b239cSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
1414423b239cSmrg# ------------------------------------------------------
1415423b239cSmrg# Minimum version: 1.17.0
1416423b239cSmrg#
1417423b239cSmrg# This macro enables a builder to enable/disable integration testing
1418423b239cSmrg# It makes no assumption about the test cases' implementation
1419423b239cSmrg# Test cases may or may not use Automake "Support for test suites"
1420423b239cSmrg#
1421423b239cSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
1422423b239cSmrg# usually requires less dependencies and may be built and run under less
1423423b239cSmrg# stringent environments than integration tests.
1424423b239cSmrg#
1425423b239cSmrg# Interface to module:
1426423b239cSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
1427423b239cSmrg# enable_integration_tests:   used in configure.ac for additional configuration
1428423b239cSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
1429423b239cSmrg#                             'no' user instructs the module not to build tests
1430423b239cSmrg# parm1:                      specify the default value, yes or no.
1431423b239cSmrg#
1432423b239cSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
1433423b239cSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1434423b239cSmrgm4_define([_defopt], m4_default([$1], [auto]))
1435423b239cSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
1436423b239cSmrg	[Enable building integration test cases (default: ]_defopt[)]),
1437423b239cSmrg	[enable_integration_tests=$enableval],
1438423b239cSmrg	[enable_integration_tests=]_defopt)
1439423b239cSmrgm4_undefine([_defopt])
1440423b239cSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
1441423b239cSmrg	[test "x$enable_integration_tests" != xno])
1442423b239cSmrgAC_MSG_CHECKING([whether to build unit test cases])
1443423b239cSmrgAC_MSG_RESULT([$enable_integration_tests])
1444423b239cSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1445a733a5bfSmrg
1446423b239cSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
1447423b239cSmrg# ----------------------------------------
1448423b239cSmrg# Minimum version: 1.13.0
1449423b239cSmrg#
1450423b239cSmrg# GLib is a library which provides advanced data structures and functions.
1451423b239cSmrg# This macro enables a module to test for the presence of Glib.
1452423b239cSmrg#
1453423b239cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
1454423b239cSmrg# Otherwise the value of $enable_unit_tests is blank.
1455423b239cSmrg#
1456423b239cSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
1457423b239cSmrg# test support usually requires less dependencies and may be built and run under
1458423b239cSmrg# less stringent environments than integration tests.
1459423b239cSmrg#
1460423b239cSmrg# Interface to module:
1461423b239cSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
1462423b239cSmrg# with_glib: used in configure.ac to know if GLib has been found
1463423b239cSmrg# --with-glib:	'yes' user instructs the module to use glib
1464423b239cSmrg#		'no' user instructs the module not to use glib
1465423b239cSmrg#
1466423b239cSmrgAC_DEFUN([XORG_WITH_GLIB],[
1467423b239cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1468423b239cSmrgm4_define([_defopt], m4_default([$2], [auto]))
1469423b239cSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
1470423b239cSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
1471423b239cSmrg	[with_glib=$withval], [with_glib=]_defopt)
1472423b239cSmrgm4_undefine([_defopt])
1473a733a5bfSmrg
1474423b239cSmrghave_glib=no
1475423b239cSmrg# Do not probe GLib if user explicitly disabled unit testing
1476423b239cSmrgif test "x$enable_unit_tests" != x"no"; then
1477423b239cSmrg  # Do not probe GLib if user explicitly disabled it
1478423b239cSmrg  if test "x$with_glib" != x"no"; then
1479423b239cSmrg    m4_ifval(
1480423b239cSmrg      [$1],
1481423b239cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
1482423b239cSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
1483423b239cSmrg    )
1484423b239cSmrg  fi
1485423b239cSmrgfi
1486a733a5bfSmrg
1487423b239cSmrg# Not having GLib when unit testing has been explicitly requested is an error
1488423b239cSmrgif test "x$enable_unit_tests" = x"yes"; then
1489423b239cSmrg  if test "x$have_glib" = x"no"; then
1490423b239cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1491423b239cSmrg  fi
1492423b239cSmrgfi
1493a733a5bfSmrg
1494423b239cSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
1495423b239cSmrgif test "x$enable_unit_tests" = x"no"; then
1496423b239cSmrg  if test "x$with_glib" = x"yes"; then
1497423b239cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1498423b239cSmrg  fi
1499423b239cSmrgfi
1500a733a5bfSmrg
1501423b239cSmrg# Not having GLib when it has been explicitly requested is an error
1502423b239cSmrgif test "x$with_glib" = x"yes"; then
1503423b239cSmrg  if test "x$have_glib" = x"no"; then
1504423b239cSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
1505423b239cSmrg  fi
1506423b239cSmrgfi
1507a733a5bfSmrg
1508423b239cSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
1509423b239cSmrg]) # XORG_WITH_GLIB
1510a733a5bfSmrg
1511423b239cSmrg# XORG_LD_WRAP([required|optional])
1512423b239cSmrg# ---------------------------------
1513423b239cSmrg# Minimum version: 1.13.0
1514a733a5bfSmrg#
1515423b239cSmrg# Check if linker supports -wrap, passed via compiler flags
1516a733a5bfSmrg#
1517423b239cSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
1518423b239cSmrg# Otherwise the value of $enable_unit_tests is blank.
1519a733a5bfSmrg#
1520423b239cSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
1521423b239cSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
1522423b239cSmrg# available, an argument of "optional" allows use when some unit tests require
1523423b239cSmrg# ld -wrap and others do not.
1524a733a5bfSmrg#
1525423b239cSmrgAC_DEFUN([XORG_LD_WRAP],[
1526423b239cSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
1527423b239cSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
1528423b239cSmrg                      void __wrap_exit(int status) { return; }],
1529423b239cSmrg                     [exit(0);])])
1530423b239cSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
1531423b239cSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
1532423b239cSmrg  if test "x$have_ld_wrap" = x"no"; then
1533423b239cSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
1534423b239cSmrg  fi
1535a733a5bfSmrgfi
1536423b239cSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1537423b239cSmrg#
1538423b239cSmrg]) # XORG_LD_WRAP
1539a733a5bfSmrg
1540423b239cSmrg# XORG_CHECK_LINKER_FLAGS
1541423b239cSmrg# -----------------------
1542423b239cSmrg# SYNOPSIS
1543423b239cSmrg#
1544423b239cSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
1545423b239cSmrg#
1546423b239cSmrg# DESCRIPTION
1547423b239cSmrg#
1548423b239cSmrg#   Check whether the given linker FLAGS work with the current language's
1549423b239cSmrg#   linker, or whether they give an error.
1550423b239cSmrg#
1551423b239cSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
1552423b239cSmrg#   success/failure.
1553423b239cSmrg#
1554423b239cSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
1555423b239cSmrg#
1556423b239cSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
1557423b239cSmrg#
1558423b239cSmrg# LICENSE
1559423b239cSmrg#
1560423b239cSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
1561423b239cSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
1562423b239cSmrg#   Copyright (c) 2009 Matteo Frigo
1563423b239cSmrg#
1564423b239cSmrg#   This program is free software: you can redistribute it and/or modify it
1565423b239cSmrg#   under the terms of the GNU General Public License as published by the
1566423b239cSmrg#   Free Software Foundation, either version 3 of the License, or (at your
1567423b239cSmrg#   option) any later version.
1568423b239cSmrg#
1569423b239cSmrg#   This program is distributed in the hope that it will be useful, but
1570423b239cSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
1571423b239cSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1572423b239cSmrg#   Public License for more details.
1573423b239cSmrg#
1574423b239cSmrg#   You should have received a copy of the GNU General Public License along
1575423b239cSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
1576423b239cSmrg#
1577423b239cSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
1578423b239cSmrg#   gives unlimited permission to copy, distribute and modify the configure
1579423b239cSmrg#   scripts that are the output of Autoconf when processing the Macro. You
1580423b239cSmrg#   need not follow the terms of the GNU General Public License when using
1581423b239cSmrg#   or distributing such scripts, even though portions of the text of the
1582423b239cSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
1583423b239cSmrg#   all other use of the material that constitutes the Autoconf Macro.
1584423b239cSmrg#
1585423b239cSmrg#   This special exception to the GPL applies to versions of the Autoconf
1586423b239cSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
1587423b239cSmrg#   modified version of the Autoconf Macro, you may extend this special
1588423b239cSmrg#   exception to the GPL to apply to your modified version as well.#
1589423b239cSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
1590423b239cSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
1591423b239cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
1592423b239cSmrgAS_LITERAL_IF([$1],
1593423b239cSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
1594423b239cSmrg      ax_save_FLAGS=$LDFLAGS
1595423b239cSmrg      LDFLAGS="$1"
1596423b239cSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
1597423b239cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1598423b239cSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1599423b239cSmrg      LDFLAGS=$ax_save_FLAGS])],
1600423b239cSmrg  [ax_save_FLAGS=$LDFLAGS
1601423b239cSmrg   LDFLAGS="$1"
1602423b239cSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1603423b239cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1604423b239cSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1605423b239cSmrg   LDFLAGS=$ax_save_FLAGS])
1606423b239cSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
1607423b239cSmrgAC_MSG_RESULT($xorg_check_linker_flags)
1608423b239cSmrgif test "x$xorg_check_linker_flags" = xyes; then
1609423b239cSmrg	m4_default([$2], :)
1610a733a5bfSmrgelse
1611423b239cSmrg	m4_default([$3], :)
1612a733a5bfSmrgfi
1613423b239cSmrg]) # XORG_CHECK_LINKER_FLAGS
1614a733a5bfSmrg
1615423b239cSmrg# XORG_MEMORY_CHECK_FLAGS
1616a733a5bfSmrg# -----------------------
1617423b239cSmrg# Minimum version: 1.16.0
1618a733a5bfSmrg#
1619423b239cSmrg# This macro attempts to find appropriate memory checking functionality
1620423b239cSmrg# for various platforms which unit testing code may use to catch various
1621423b239cSmrg# forms of memory allocation and access errors in testing.
1622423b239cSmrg#
1623423b239cSmrg# Interface to module:
1624423b239cSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
1625423b239cSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
1626423b239cSmrg#
1627423b239cSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
1628423b239cSmrg#
1629423b239cSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1630a733a5bfSmrg
1631a733a5bfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1632423b239cSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
1633423b239cSmrg           [Environment variables to enable memory checking in tests])
16341a30de1fSmrg
1635423b239cSmrg# Check for different types of support on different platforms
1636423b239cSmrgcase $host_os in
1637423b239cSmrg    solaris*)
1638423b239cSmrg        AC_CHECK_LIB([umem], [umem_alloc],
1639423b239cSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
1640423b239cSmrg        ;;
1641423b239cSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
1642423b239cSmrg        # both directly and inverted, so should not be 0 or 255.
1643423b239cSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
1644423b239cSmrg        ;;
1645423b239cSmrg    darwin*)
1646423b239cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
1647423b239cSmrg        ;;
1648423b239cSmrg    *bsd*)
1649423b239cSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
1650423b239cSmrg        ;;
1651423b239cSmrgesac
16521a30de1fSmrg
1653423b239cSmrg# User supplied flags override default flags
1654423b239cSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
1655423b239cSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
16561a30de1fSmrgfi
16571a30de1fSmrg
1658423b239cSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
1659423b239cSmrg]) # XORG_WITH_LINT
16601a30de1fSmrg
1661423b239cSmrg# XORG_CHECK_MALLOC_ZERO
1662423b239cSmrg# ----------------------
1663423b239cSmrg# Minimum version: 1.0.0
1664423b239cSmrg#
1665423b239cSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1666423b239cSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1667423b239cSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1668423b239cSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1669423b239cSmrgAC_ARG_ENABLE(malloc0returnsnull,
1670423b239cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1671423b239cSmrg		       [malloc(0) returns NULL (default: auto)]),
1672423b239cSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1673423b239cSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
16741a30de1fSmrg
1675423b239cSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1676423b239cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1677423b239cSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
1678423b239cSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
1679423b239cSmrg#include <stdlib.h>
1680423b239cSmrg],[
1681423b239cSmrg    char *m0, *r0, *c0, *p;
1682423b239cSmrg    m0 = malloc(0);
1683423b239cSmrg    p = malloc(10);
1684423b239cSmrg    r0 = realloc(p,0);
1685423b239cSmrg    c0 = calloc(0,10);
1686423b239cSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
1687423b239cSmrg])],
1688423b239cSmrg		[xorg_cv_malloc0_returns_null=yes],
1689423b239cSmrg		[xorg_cv_malloc0_returns_null=no])])
1690423b239cSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
16911a30de1fSmrgfi
1692423b239cSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
16931a30de1fSmrg
1694423b239cSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1695423b239cSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1696423b239cSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1697423b239cSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1698ce62200cSmrgelse
1699423b239cSmrg	MALLOC_ZERO_CFLAGS=""
1700423b239cSmrg	XMALLOC_ZERO_CFLAGS=""
1701423b239cSmrg	XTMALLOC_ZERO_CFLAGS=""
1702ce62200cSmrgfi
1703ce62200cSmrg
1704423b239cSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1705423b239cSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1706423b239cSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1707423b239cSmrg]) # XORG_CHECK_MALLOC_ZERO
1708ce62200cSmrg
1709423b239cSmrg# XORG_WITH_LINT()
1710423b239cSmrg# ----------------
1711423b239cSmrg# Minimum version: 1.1.0
17121a30de1fSmrg#
1713423b239cSmrg# This macro enables the use of a tool that flags some suspicious and
1714423b239cSmrg# non-portable constructs (likely to be bugs) in C language source code.
1715423b239cSmrg# It will attempt to locate the tool and use appropriate options.
1716423b239cSmrg# There are various lint type tools on different platforms.
1717423b239cSmrg#
1718423b239cSmrg# Interface to module:
1719423b239cSmrg# LINT:		returns the path to the tool found on the platform
1720423b239cSmrg#		or the value set to LINT on the configure cmd line
1721423b239cSmrg#		also an Automake conditional
1722423b239cSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1723423b239cSmrg#
1724423b239cSmrg# --with-lint:	'yes' user instructs the module to use lint
1725423b239cSmrg#		'no' user instructs the module not to use lint (default)
1726423b239cSmrg#
1727423b239cSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1728423b239cSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1729423b239cSmrg#
1730423b239cSmrgAC_DEFUN([XORG_WITH_LINT],[
17311a30de1fSmrg
1732423b239cSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1733423b239cSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1734423b239cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1735423b239cSmrg		[Use a lint-style source code checker (default: disabled)])],
1736423b239cSmrg		[use_lint=$withval], [use_lint=no])
17371a30de1fSmrg
1738423b239cSmrg# Obtain platform specific info like program name and options
1739423b239cSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1740423b239cSmrgcase $host_os in
1741423b239cSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1742423b239cSmrg	lint_name=splint
1743423b239cSmrg	lint_options="-badflag"
1744423b239cSmrg	;;
1745423b239cSmrg  *freebsd* | *netbsd*)
1746423b239cSmrg	lint_name=lint
1747423b239cSmrg	lint_options="-u -b"
1748423b239cSmrg	;;
1749423b239cSmrg  *solaris*)
1750423b239cSmrg	lint_name=lint
1751423b239cSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1752423b239cSmrg	;;
1753423b239cSmrgesac
17541a30de1fSmrg
1755423b239cSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1756423b239cSmrgif test "x$use_lint" = x"yes" ; then
1757423b239cSmrg   AC_PATH_PROG([LINT], [$lint_name])
1758423b239cSmrg   if test "x$LINT" = "x"; then
1759423b239cSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1760423b239cSmrg   fi
1761423b239cSmrgelif test "x$use_lint" = x"no" ; then
1762423b239cSmrg   if test "x$LINT" != "x"; then
1763423b239cSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1764423b239cSmrg   fi
17651a30de1fSmrgelse
1766423b239cSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
17671a30de1fSmrgfi
17681a30de1fSmrg
1769423b239cSmrg# User supplied flags override default flags
1770423b239cSmrgif test "x$LINT_FLAGS" != "x"; then
1771423b239cSmrg   lint_options=$LINT_FLAGS
17721a30de1fSmrgfi
17731a30de1fSmrg
1774423b239cSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1775423b239cSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
17761a30de1fSmrg
1777423b239cSmrg]) # XORG_WITH_LINT
17781a30de1fSmrg
1779423b239cSmrg# XORG_LINT_LIBRARY(LIBNAME)
1780423b239cSmrg# --------------------------
1781423b239cSmrg# Minimum version: 1.1.0
17821a30de1fSmrg#
1783423b239cSmrg# Sets up flags for building lint libraries for checking programs that call
1784423b239cSmrg# functions in the library.
1785423b239cSmrg#
1786423b239cSmrg# Interface to module:
1787423b239cSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1788423b239cSmrg# MAKE_LINT_LIB		- Automake conditional
1789423b239cSmrg#
1790423b239cSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1791423b239cSmrg#			  - 'no' user instructs the module not to create a lint library (default)
17921a30de1fSmrg
1793423b239cSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1794423b239cSmrgAC_REQUIRE([XORG_WITH_LINT])
1795423b239cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1796423b239cSmrg	[Create lint library (default: disabled)])],
1797423b239cSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
17981a30de1fSmrg
1799423b239cSmrgif test "x$make_lint_lib" = x"yes" ; then
1800423b239cSmrg   LINTLIB=llib-l$1.ln
1801423b239cSmrg   if test "x$LINT" = "x"; then
1802423b239cSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1803423b239cSmrg   fi
1804423b239cSmrgelif test "x$make_lint_lib" != x"no" ; then
1805423b239cSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
18061a30de1fSmrgfi
18071a30de1fSmrg
1808423b239cSmrgAC_SUBST(LINTLIB)
1809423b239cSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18101a30de1fSmrg
1811423b239cSmrg]) # XORG_LINT_LIBRARY
18121a30de1fSmrg
1813423b239cSmrg# XORG_COMPILER_BRAND
1814423b239cSmrg# -------------------
1815423b239cSmrg# Minimum version: 1.14.0
1816ce62200cSmrg#
1817423b239cSmrg# Checks for various brands of compilers and sets flags as appropriate:
1818423b239cSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
1819423b239cSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
1820423b239cSmrg#   clang compiler - sets CLANGCC to "yes"
1821423b239cSmrg#   Intel compiler - sets INTELCC to "yes"
1822423b239cSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1823ce62200cSmrg#
1824423b239cSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
1825423b239cSmrgAC_LANG_CASE(
1826423b239cSmrg	[C], [
1827423b239cSmrg		AC_REQUIRE([AC_PROG_CC_C99])
1828423b239cSmrg	],
1829423b239cSmrg	[C++], [
1830423b239cSmrg		AC_REQUIRE([AC_PROG_CXX])
1831423b239cSmrg	]
1832423b239cSmrg)
1833423b239cSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
1834423b239cSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1835423b239cSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1836423b239cSmrg]) # XORG_COMPILER_BRAND
1837423b239cSmrg
1838423b239cSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
1839423b239cSmrg# ---------------
1840423b239cSmrg# Minimum version: 1.16.0
1841ce62200cSmrg#
1842423b239cSmrg# Test if the compiler works when passed the given flag as a command line argument.
1843423b239cSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
1844423b239cSmrg# next flag in the list until there are no more options.
1845ce62200cSmrg#
1846423b239cSmrg# Note that this does not guarantee that the compiler supports the flag as some
1847423b239cSmrg# compilers will simply ignore arguments that they do not understand, but we do
1848423b239cSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
1849423b239cSmrg# -Werror=unused-command-line-argument
1850ce62200cSmrg#
1851423b239cSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
1852423b239cSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1853423b239cSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1854ce62200cSmrg
1855423b239cSmrgAC_LANG_COMPILER_REQUIRE
1856423b239cSmrg
1857423b239cSmrgAC_LANG_CASE(
1858423b239cSmrg	[C], [
1859423b239cSmrg		AC_REQUIRE([AC_PROG_CC_C99])
1860423b239cSmrg		define([PREFIX], [C])
1861423b239cSmrg		define([CACHE_PREFIX], [cc])
1862423b239cSmrg		define([COMPILER], [$CC])
1863423b239cSmrg	],
1864423b239cSmrg	[C++], [
1865423b239cSmrg		define([PREFIX], [CXX])
1866423b239cSmrg		define([CACHE_PREFIX], [cxx])
1867423b239cSmrg		define([COMPILER], [$CXX])
1868423b239cSmrg	]
1869423b239cSmrg)
1870423b239cSmrg
1871423b239cSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1872423b239cSmrg
1873423b239cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
1874423b239cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1875423b239cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
1876423b239cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
1877423b239cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1878423b239cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
1879423b239cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
1880423b239cSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
1881423b239cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1882ce62200cSmrgfi
1883ce62200cSmrg
1884423b239cSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
1885423b239cSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
1886423b239cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1887423b239cSmrg	fi
1888423b239cSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1889423b239cSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
1890423b239cSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
1891423b239cSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1892423b239cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
1893423b239cSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
1894423b239cSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
1895423b239cSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1896423b239cSmrgfi
1897ce62200cSmrg
1898423b239cSmrgfound="no"
1899423b239cSmrgm4_foreach([flag], m4_cdr($@), [
1900423b239cSmrg	if test $found = "no" ; then
1901423b239cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
1902423b239cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1903423b239cSmrg		fi
1904ce62200cSmrg
1905423b239cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
1906423b239cSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1907423b239cSmrg		fi
1908423b239cSmrg
1909423b239cSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1910423b239cSmrg
1911423b239cSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
1912423b239cSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
1913423b239cSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
1914423b239cSmrg		AC_CACHE_VAL($cacheid,
1915423b239cSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
1916423b239cSmrg					     [eval $cacheid=yes],
1917423b239cSmrg					     [eval $cacheid=no])])
1918423b239cSmrg
1919423b239cSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1920423b239cSmrg
1921423b239cSmrg		eval supported=\$$cacheid
1922423b239cSmrg		AC_MSG_RESULT([$supported])
1923423b239cSmrg		if test "$supported" = "yes" ; then
1924423b239cSmrg			$1="$$1 ]flag["
1925423b239cSmrg			found="yes"
1926423b239cSmrg		fi
1927423b239cSmrg	fi
1928423b239cSmrg])
1929423b239cSmrg]) # XORG_TESTSET_CFLAG
1930423b239cSmrg
1931423b239cSmrg# XORG_COMPILER_FLAGS
1932423b239cSmrg# ---------------
1933423b239cSmrg# Minimum version: 1.16.0
1934a733a5bfSmrg#
1935423b239cSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
1936423b239cSmrg# arguments supported by the selected compiler which do NOT alter the generated
1937423b239cSmrg# code.  These arguments will cause the compiler to print various warnings
1938423b239cSmrg# during compilation AND turn a conservative set of warnings into errors.
1939a733a5bfSmrg#
1940423b239cSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
1941423b239cSmrg# future versions of util-macros as options are added to new compilers.
1942a733a5bfSmrg#
1943423b239cSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
1944423b239cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1945a733a5bfSmrg
1946423b239cSmrgAC_ARG_ENABLE(selective-werror,
1947423b239cSmrg              AS_HELP_STRING([--disable-selective-werror],
1948423b239cSmrg                             [Turn off selective compiler errors. (default: enabled)]),
1949423b239cSmrg              [SELECTIVE_WERROR=$enableval],
1950423b239cSmrg              [SELECTIVE_WERROR=yes])
1951423b239cSmrg
1952423b239cSmrgAC_LANG_CASE(
1953423b239cSmrg        [C], [
1954423b239cSmrg                define([PREFIX], [C])
1955423b239cSmrg        ],
1956423b239cSmrg        [C++], [
1957423b239cSmrg                define([PREFIX], [CXX])
1958423b239cSmrg        ]
1959423b239cSmrg)
1960423b239cSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
1961423b239cSmrgif test "x$SUNCC" = "xyes"; then
1962423b239cSmrg    [BASE_]PREFIX[FLAGS]="-v"
1963a733a5bfSmrgelse
1964423b239cSmrg    [BASE_]PREFIX[FLAGS]=""
1965a733a5bfSmrgfi
1966a733a5bfSmrg
1967423b239cSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
1968423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
1969423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
1970423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
1971423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1972a733a5bfSmrg
1973423b239cSmrgAC_LANG_CASE(
1974423b239cSmrg	[C], [
1975423b239cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
1976423b239cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
1977423b239cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
1978423b239cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
1979423b239cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
1980423b239cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
1981423b239cSmrg	]
1982423b239cSmrg)
1983423b239cSmrg
1984423b239cSmrg# This chunk adds additional warnings that could catch undesired effects.
1985423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
1986423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
1987423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
1988423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
1989423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
1990423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
1991423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
1992423b239cSmrg
1993423b239cSmrg# These are currently disabled because they are noisy.  They will be enabled
1994423b239cSmrg# in the future once the codebase is sufficiently modernized to silence
1995423b239cSmrg# them.  For now, I don't want them to drown out the other warnings.
1996423b239cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
1997423b239cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
1998423b239cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
1999423b239cSmrg
2000423b239cSmrg# Turn some warnings into errors, so we don't accidently get successful builds
2001423b239cSmrg# when there are problems that should be fixed.
2002423b239cSmrg
2003423b239cSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2004423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2005423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2006423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2007423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2008423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2009423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2010423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2011423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2012423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2013423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2014423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2015423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2016423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2017423b239cSmrgelse
2018423b239cSmrgAC_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])
2019423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2020423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2021423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2022423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2023423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2024423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2025423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2026423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2027423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2028423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2029423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2030423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2031423b239cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2032423b239cSmrgfi
2033423b239cSmrg
2034423b239cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2035423b239cSmrg]) # XORG_COMPILER_FLAGS
2036423b239cSmrg
2037423b239cSmrg# XORG_CWARNFLAGS
2038423b239cSmrg# ---------------
2039423b239cSmrg# Minimum version: 1.2.0
2040423b239cSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2041a733a5bfSmrg#
2042423b239cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
2043a733a5bfSmrg#
2044423b239cSmrg# This function is deprecated because it defines -fno-strict-aliasing
2045423b239cSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2046423b239cSmrg# is needed, then it should be added explicitly in the module when
2047423b239cSmrg# it is updated to use BASE_CFLAGS.
2048a733a5bfSmrg#
2049423b239cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
2050423b239cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2051423b239cSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2052423b239cSmrgAC_LANG_CASE(
2053423b239cSmrg	[C], [
2054423b239cSmrg		CWARNFLAGS="$BASE_CFLAGS"
2055423b239cSmrg		if  test "x$GCC" = xyes ; then
2056423b239cSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2057423b239cSmrg		fi
2058423b239cSmrg		AC_SUBST(CWARNFLAGS)
2059423b239cSmrg	]
2060423b239cSmrg)
2061423b239cSmrg]) # XORG_CWARNFLAGS
2062423b239cSmrg
2063423b239cSmrg# XORG_STRICT_OPTION
2064423b239cSmrg# -----------------------
2065423b239cSmrg# Minimum version: 1.3.0
2066a733a5bfSmrg#
2067423b239cSmrg# Add configure option to enable strict compilation flags, such as treating
2068423b239cSmrg# warnings as fatal errors.
2069423b239cSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2070423b239cSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2071a733a5bfSmrg#
2072423b239cSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2073423b239cSmrg# when strict compilation is unconditionally desired.
2074423b239cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
2075423b239cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
2076423b239cSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2077a733a5bfSmrg
2078423b239cSmrgAC_ARG_ENABLE(strict-compilation,
2079423b239cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
2080423b239cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2081423b239cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2082a733a5bfSmrg
2083423b239cSmrgAC_LANG_CASE(
2084423b239cSmrg        [C], [
2085423b239cSmrg                define([PREFIX], [C])
2086423b239cSmrg        ],
2087423b239cSmrg        [C++], [
2088423b239cSmrg                define([PREFIX], [CXX])
2089423b239cSmrg        ]
2090423b239cSmrg)
2091a733a5bfSmrg
2092423b239cSmrg[STRICT_]PREFIX[FLAGS]=""
2093423b239cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2094423b239cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2095423b239cSmrg
2096423b239cSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2097423b239cSmrg# activate it with -Werror, so we add it here explicitly.
2098423b239cSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2099423b239cSmrg
2100423b239cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
2101423b239cSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2102423b239cSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2103423b239cSmrgfi
2104423b239cSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2105423b239cSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2106423b239cSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2107423b239cSmrg]) # XORG_STRICT_OPTION
2108423b239cSmrg
2109423b239cSmrg# XORG_DEFAULT_OPTIONS
2110423b239cSmrg# --------------------
2111423b239cSmrg# Minimum version: 1.3.0
2112ce62200cSmrg#
2113423b239cSmrg# Defines default options for X.Org modules.
2114ce62200cSmrg#
2115423b239cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2116423b239cSmrgAC_REQUIRE([AC_PROG_INSTALL])
2117423b239cSmrgXORG_COMPILER_FLAGS
2118423b239cSmrgXORG_CWARNFLAGS
2119423b239cSmrgXORG_STRICT_OPTION
2120423b239cSmrgXORG_RELEASE_VERSION
2121423b239cSmrgXORG_CHANGELOG
2122423b239cSmrgXORG_INSTALL
2123423b239cSmrgXORG_MANPAGE_SECTIONS
2124423b239cSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2125423b239cSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2126423b239cSmrg]) # XORG_DEFAULT_OPTIONS
2127423b239cSmrg
2128423b239cSmrg# XORG_INSTALL()
2129423b239cSmrg# ----------------
2130423b239cSmrg# Minimum version: 1.4.0
2131ce62200cSmrg#
2132423b239cSmrg# Defines the variable INSTALL_CMD as the command to copy
2133423b239cSmrg# INSTALL from $prefix/share/util-macros.
2134ce62200cSmrg#
2135423b239cSmrgAC_DEFUN([XORG_INSTALL], [
2136423b239cSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2137423b239cSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2138423b239cSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2139423b239cSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2140423b239cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2141423b239cSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2142423b239cSmrgAC_SUBST([INSTALL_CMD])
2143423b239cSmrg]) # XORG_INSTALL
2144423b239cSmrgdnl Copyright 2005 Red Hat, Inc
2145423b239cSmrgdnl
2146423b239cSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2147423b239cSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2148423b239cSmrgdnl the above copyright notice appear in all copies and that both that
2149423b239cSmrgdnl copyright notice and this permission notice appear in supporting
2150423b239cSmrgdnl documentation.
2151423b239cSmrgdnl
2152423b239cSmrgdnl The above copyright notice and this permission notice shall be included
2153423b239cSmrgdnl in all copies or substantial portions of the Software.
2154423b239cSmrgdnl
2155423b239cSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2156423b239cSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2157423b239cSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2158423b239cSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2159423b239cSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2160423b239cSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2161423b239cSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2162423b239cSmrgdnl
2163423b239cSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2164423b239cSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2165423b239cSmrgdnl other dealings in this Software without prior written authorization
2166423b239cSmrgdnl from the copyright holders.
2167423b239cSmrgdnl
2168ce62200cSmrg
2169423b239cSmrg# XORG_RELEASE_VERSION
2170423b239cSmrg# --------------------
2171423b239cSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2172423b239cSmrg
2173423b239cSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2174423b239cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2175423b239cSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2176423b239cSmrg		[Major version of this package])
2177423b239cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2178423b239cSmrg	if test "x$PVM" = "x"; then
2179423b239cSmrg		PVM="0"
2180423b239cSmrg	fi
2181423b239cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2182423b239cSmrg		[$PVM],
2183423b239cSmrg		[Minor version of this package])
2184423b239cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2185423b239cSmrg	if test "x$PVP" = "x"; then
2186423b239cSmrg		PVP="0"
2187423b239cSmrg	fi
2188423b239cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2189423b239cSmrg		[$PVP],
2190423b239cSmrg		[Patch version of this package])
2191423b239cSmrg])
2192423b239cSmrg
2193423b239cSmrg# XORG_CHANGELOG()
2194423b239cSmrg# ----------------
2195423b239cSmrg# Minimum version: 1.2.0
2196ce62200cSmrg#
2197423b239cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2198423b239cSmrg# ChangeLog from git.
2199ce62200cSmrg#
2200ce62200cSmrg#
2201423b239cSmrgAC_DEFUN([XORG_CHANGELOG], [
2202423b239cSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2203423b239cSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2204423b239cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2205423b239cSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2206423b239cSmrgAC_SUBST([CHANGELOG_CMD])
2207423b239cSmrg]) # XORG_CHANGELOG
2208423b239cSmrg
2209423b239cSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2210ce62200cSmrg#
2211423b239cSmrg# This file is free software; the Free Software Foundation
2212423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2213423b239cSmrg# with or without modifications, as long as this notice is preserved.
2214ce62200cSmrg
2215423b239cSmrg# AM_AUTOMAKE_VERSION(VERSION)
2216423b239cSmrg# ----------------------------
2217423b239cSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2218423b239cSmrg# generated from the m4 files accompanying Automake X.Y.
2219423b239cSmrg# (This private macro should not be called outside this file.)
2220423b239cSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2221423b239cSmrg[am__api_version='1.15'
2222423b239cSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2223423b239cSmrgdnl require some minimum version.  Point them to the right macro.
2224423b239cSmrgm4_if([$1], [1.15], [],
2225423b239cSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2226423b239cSmrg])
22271b983734Smrg
2228423b239cSmrg# _AM_AUTOCONF_VERSION(VERSION)
2229423b239cSmrg# -----------------------------
2230423b239cSmrg# aclocal traces this macro to find the Autoconf version.
2231423b239cSmrg# This is a private macro too.  Using m4_define simplifies
2232423b239cSmrg# the logic in aclocal, which can simply ignore this definition.
2233423b239cSmrgm4_define([_AM_AUTOCONF_VERSION], [])
22341b983734Smrg
2235423b239cSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2236423b239cSmrg# -------------------------------
2237423b239cSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2238423b239cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2239423b239cSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2240423b239cSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
2241423b239cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
2242423b239cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2243423b239cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2244ce62200cSmrg
2245423b239cSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2246423b239cSmrg
2247423b239cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2248ce62200cSmrg#
2249423b239cSmrg# This file is free software; the Free Software Foundation
2250423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2251423b239cSmrg# with or without modifications, as long as this notice is preserved.
2252423b239cSmrg
2253423b239cSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2254423b239cSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2255423b239cSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2256ce62200cSmrg#
2257423b239cSmrg# Of course, Automake must honor this variable whenever it calls a
2258423b239cSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2259423b239cSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2260423b239cSmrg# depending on how configure is run.  This is pretty annoying, since
2261423b239cSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2262423b239cSmrg# source directory, any form will work fine, but in subdirectories a
2263423b239cSmrg# relative path needs to be adjusted first.
2264ce62200cSmrg#
2265423b239cSmrg# $ac_aux_dir/missing
2266423b239cSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2267423b239cSmrg# $top_srcdir/$ac_aux_dir/missing
2268423b239cSmrg#    fails if $ac_aux_dir is absolute,
2269423b239cSmrg#    fails when called from a subdirectory in a VPATH build with
2270423b239cSmrg#          a relative $ac_aux_dir
2271ce62200cSmrg#
2272423b239cSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2273423b239cSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
2274423b239cSmrg# harmless because $srcdir is '.', but things will broke when you
2275423b239cSmrg# start a VPATH build or use an absolute $srcdir.
2276ce62200cSmrg#
2277423b239cSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2278423b239cSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2279423b239cSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2280423b239cSmrg# and then we would define $MISSING as
2281423b239cSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2282423b239cSmrg# This will work as long as MISSING is not called from configure, because
2283423b239cSmrg# unfortunately $(top_srcdir) has no meaning in configure.
2284423b239cSmrg# However there are other variables, like CC, which are often used in
2285423b239cSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2286ce62200cSmrg#
2287423b239cSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
2288423b239cSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
2289423b239cSmrg# configured tree to be moved without reconfiguration.
2290ce62200cSmrg
2291423b239cSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
2292423b239cSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2293423b239cSmrg# Expand $ac_aux_dir to an absolute path.
2294423b239cSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
2295423b239cSmrg])
2296423b239cSmrg
2297423b239cSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2298423b239cSmrg
2299423b239cSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2300423b239cSmrg#
2301423b239cSmrg# This file is free software; the Free Software Foundation
2302423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2303423b239cSmrg# with or without modifications, as long as this notice is preserved.
2304423b239cSmrg
2305423b239cSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2306423b239cSmrg# -------------------------------------
2307423b239cSmrg# Define a conditional.
2308423b239cSmrgAC_DEFUN([AM_CONDITIONAL],
2309423b239cSmrg[AC_PREREQ([2.52])dnl
2310423b239cSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2311423b239cSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2312423b239cSmrgAC_SUBST([$1_TRUE])dnl
2313423b239cSmrgAC_SUBST([$1_FALSE])dnl
2314423b239cSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2315423b239cSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2316423b239cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2317423b239cSmrgif $2; then
2318423b239cSmrg  $1_TRUE=
2319423b239cSmrg  $1_FALSE='#'
2320ce62200cSmrgelse
2321423b239cSmrg  $1_TRUE='#'
2322423b239cSmrg  $1_FALSE=
2323ce62200cSmrgfi
2324423b239cSmrgAC_CONFIG_COMMANDS_PRE(
2325423b239cSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2326423b239cSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2327423b239cSmrgUsually this means the macro was only invoked conditionally.]])
2328423b239cSmrgfi])])
2329ce62200cSmrg
2330423b239cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2331423b239cSmrg#
2332423b239cSmrg# This file is free software; the Free Software Foundation
2333423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2334423b239cSmrg# with or without modifications, as long as this notice is preserved.
2335ce62200cSmrg
2336ce62200cSmrg
2337423b239cSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2338423b239cSmrg# written in clear, in which case automake, when reading aclocal.m4,
2339423b239cSmrg# will think it sees a *use*, and therefore will trigger all it's
2340423b239cSmrg# C support machinery.  Also note that it means that autoscan, seeing
2341423b239cSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2342ce62200cSmrg
2343423b239cSmrg
2344423b239cSmrg# _AM_DEPENDENCIES(NAME)
2345423b239cSmrg# ----------------------
2346423b239cSmrg# See how the compiler implements dependency checking.
2347423b239cSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2348423b239cSmrg# We try a few techniques and use that to set a single cache variable.
2349ce62200cSmrg#
2350423b239cSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2351423b239cSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2352423b239cSmrg# dependency, and given that the user is not expected to run this macro,
2353423b239cSmrg# just rely on AC_PROG_CC.
2354423b239cSmrgAC_DEFUN([_AM_DEPENDENCIES],
2355423b239cSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2356423b239cSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2357423b239cSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2358423b239cSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2359ce62200cSmrg
2360423b239cSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2361423b239cSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2362423b239cSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2363423b239cSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2364423b239cSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2365423b239cSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2366423b239cSmrg                    [depcc="$$1"   am_compiler_list=])
2367a733a5bfSmrg
2368423b239cSmrgAC_CACHE_CHECK([dependency style of $depcc],
2369423b239cSmrg               [am_cv_$1_dependencies_compiler_type],
2370423b239cSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2371423b239cSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
2372423b239cSmrg  # making bogus files that we don't know about and never remove.  For
2373423b239cSmrg  # instance it was reported that on HP-UX the gcc test will end up
2374423b239cSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
2375423b239cSmrg  # in D".
2376423b239cSmrg  rm -rf conftest.dir
2377423b239cSmrg  mkdir conftest.dir
2378423b239cSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2379423b239cSmrg  # using a relative directory.
2380423b239cSmrg  cp "$am_depcomp" conftest.dir
2381423b239cSmrg  cd conftest.dir
2382423b239cSmrg  # We will build objects and dependencies in a subdirectory because
2383423b239cSmrg  # it helps to detect inapplicable dependency modes.  For instance
2384423b239cSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2385423b239cSmrg  # side effect of compilation, but ICC will put the dependencies in
2386423b239cSmrg  # the current directory while Tru64 will put them in the object
2387423b239cSmrg  # directory.
2388423b239cSmrg  mkdir sub
2389ce62200cSmrg
2390423b239cSmrg  am_cv_$1_dependencies_compiler_type=none
2391423b239cSmrg  if test "$am_compiler_list" = ""; then
2392423b239cSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2393423b239cSmrg  fi
2394423b239cSmrg  am__universal=false
2395423b239cSmrg  m4_case([$1], [CC],
2396423b239cSmrg    [case " $depcc " in #(
2397423b239cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2398423b239cSmrg     esac],
2399423b239cSmrg    [CXX],
2400423b239cSmrg    [case " $depcc " in #(
2401423b239cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2402423b239cSmrg     esac])
24031b983734Smrg
2404423b239cSmrg  for depmode in $am_compiler_list; do
2405423b239cSmrg    # Setup a source with many dependencies, because some compilers
2406423b239cSmrg    # like to wrap large dependency lists on column 80 (with \), and
2407423b239cSmrg    # we should not choose a depcomp mode which is confused by this.
2408423b239cSmrg    #
2409423b239cSmrg    # We need to recreate these files for each test, as the compiler may
2410423b239cSmrg    # overwrite some of them when testing with obscure command lines.
2411423b239cSmrg    # This happens at least with the AIX C compiler.
2412423b239cSmrg    : > sub/conftest.c
2413423b239cSmrg    for i in 1 2 3 4 5 6; do
2414423b239cSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2415423b239cSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2416423b239cSmrg      # Solaris 10 /bin/sh.
2417423b239cSmrg      echo '/* dummy */' > sub/conftst$i.h
2418423b239cSmrg    done
2419423b239cSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24201b983734Smrg
2421423b239cSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2422423b239cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2423423b239cSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2424423b239cSmrg    # versions had trouble with output in subdirs.
2425423b239cSmrg    am__obj=sub/conftest.${OBJEXT-o}
2426423b239cSmrg    am__minus_obj="-o $am__obj"
2427423b239cSmrg    case $depmode in
2428423b239cSmrg    gcc)
2429423b239cSmrg      # This depmode causes a compiler race in universal mode.
2430423b239cSmrg      test "$am__universal" = false || continue
2431423b239cSmrg      ;;
2432423b239cSmrg    nosideeffect)
2433423b239cSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2434423b239cSmrg      # only be used when explicitly requested.
2435423b239cSmrg      if test "x$enable_dependency_tracking" = xyes; then
2436423b239cSmrg	continue
2437423b239cSmrg      else
2438423b239cSmrg	break
2439423b239cSmrg      fi
2440423b239cSmrg      ;;
2441423b239cSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2442423b239cSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2443423b239cSmrg      # not run yet.  These depmodes are late enough in the game, and
2444423b239cSmrg      # so weak that their functioning should not be impacted.
2445423b239cSmrg      am__obj=conftest.${OBJEXT-o}
2446423b239cSmrg      am__minus_obj=
2447423b239cSmrg      ;;
2448423b239cSmrg    none) break ;;
2449423b239cSmrg    esac
2450423b239cSmrg    if depmode=$depmode \
2451423b239cSmrg       source=sub/conftest.c object=$am__obj \
2452423b239cSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2453423b239cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2454423b239cSmrg         >/dev/null 2>conftest.err &&
2455423b239cSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2456423b239cSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2457423b239cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2458423b239cSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2459423b239cSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2460423b239cSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2461423b239cSmrg      # that says an option was ignored or not supported.
2462423b239cSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2463423b239cSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2464423b239cSmrg      # The diagnosis changed in icc 8.0:
2465423b239cSmrg      #   icc: Command line remark: option '-MP' not supported
2466423b239cSmrg      if (grep 'ignoring option' conftest.err ||
2467423b239cSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2468423b239cSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2469423b239cSmrg        break
2470423b239cSmrg      fi
2471423b239cSmrg    fi
2472423b239cSmrg  done
2473ce62200cSmrg
2474423b239cSmrg  cd ..
2475423b239cSmrg  rm -rf conftest.dir
2476ce62200cSmrgelse
2477423b239cSmrg  am_cv_$1_dependencies_compiler_type=none
2478ce62200cSmrgfi
2479423b239cSmrg])
2480423b239cSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2481423b239cSmrgAM_CONDITIONAL([am__fastdep$1], [
2482423b239cSmrg  test "x$enable_dependency_tracking" != xno \
2483423b239cSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2484423b239cSmrg])
2485ce62200cSmrg
2486ce62200cSmrg
2487423b239cSmrg# AM_SET_DEPDIR
2488423b239cSmrg# -------------
2489423b239cSmrg# Choose a directory name for dependency files.
2490423b239cSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2491423b239cSmrgAC_DEFUN([AM_SET_DEPDIR],
2492423b239cSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2493423b239cSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2494423b239cSmrg])
2495423b239cSmrg
2496423b239cSmrg
2497423b239cSmrg# AM_DEP_TRACK
2498423b239cSmrg# ------------
2499423b239cSmrgAC_DEFUN([AM_DEP_TRACK],
2500423b239cSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
2501423b239cSmrgAS_HELP_STRING(
2502423b239cSmrg  [--enable-dependency-tracking],
2503423b239cSmrg  [do not reject slow dependency extractors])
2504423b239cSmrgAS_HELP_STRING(
2505423b239cSmrg  [--disable-dependency-tracking],
2506423b239cSmrg  [speeds up one-time build])])
2507423b239cSmrgif test "x$enable_dependency_tracking" != xno; then
2508423b239cSmrg  am_depcomp="$ac_aux_dir/depcomp"
2509423b239cSmrg  AMDEPBACKSLASH='\'
2510423b239cSmrg  am__nodep='_no'
2511423b239cSmrgfi
2512423b239cSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2513423b239cSmrgAC_SUBST([AMDEPBACKSLASH])dnl
2514423b239cSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2515423b239cSmrgAC_SUBST([am__nodep])dnl
2516423b239cSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2517423b239cSmrg])
2518ce62200cSmrg
2519423b239cSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2520ce62200cSmrg
2521423b239cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2522a733a5bfSmrg#
2523423b239cSmrg# This file is free software; the Free Software Foundation
2524423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2525423b239cSmrg# with or without modifications, as long as this notice is preserved.
2526a733a5bfSmrg
2527a733a5bfSmrg
2528423b239cSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2529423b239cSmrg# ------------------------------
2530423b239cSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2531423b239cSmrg[{
2532423b239cSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
2533423b239cSmrg  # are listed without --file.  Let's play safe and only enable the eval
2534423b239cSmrg  # if we detect the quoting.
2535423b239cSmrg  case $CONFIG_FILES in
2536423b239cSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
2537423b239cSmrg  *)   set x $CONFIG_FILES ;;
2538423b239cSmrg  esac
2539423b239cSmrg  shift
2540423b239cSmrg  for mf
2541423b239cSmrg  do
2542423b239cSmrg    # Strip MF so we end up with the name of the file.
2543423b239cSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
2544423b239cSmrg    # Check whether this is an Automake generated Makefile or not.
2545423b239cSmrg    # We used to match only the files named 'Makefile.in', but
2546423b239cSmrg    # some people rename them; so instead we look at the file content.
2547423b239cSmrg    # Grep'ing the first line is not enough: some people post-process
2548423b239cSmrg    # each Makefile.in and add a new line on top of each file to say so.
2549423b239cSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
2550423b239cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
2551423b239cSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2552423b239cSmrg      dirpart=`AS_DIRNAME("$mf")`
2553423b239cSmrg    else
2554423b239cSmrg      continue
2555423b239cSmrg    fi
2556423b239cSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
2557423b239cSmrg    # from the Makefile without running 'make'.
2558423b239cSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2559423b239cSmrg    test -z "$DEPDIR" && continue
2560423b239cSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2561423b239cSmrg    test -z "$am__include" && continue
2562423b239cSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2563423b239cSmrg    # Find all dependency output files, they are included files with
2564423b239cSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2565423b239cSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
2566423b239cSmrg    # expansion.
2567423b239cSmrg    for file in `sed -n "
2568423b239cSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2569423b239cSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2570423b239cSmrg      # Make sure the directory exists.
2571423b239cSmrg      test -f "$dirpart/$file" && continue
2572423b239cSmrg      fdir=`AS_DIRNAME(["$file"])`
2573423b239cSmrg      AS_MKDIR_P([$dirpart/$fdir])
2574423b239cSmrg      # echo "creating $dirpart/$file"
2575423b239cSmrg      echo '# dummy' > "$dirpart/$file"
2576423b239cSmrg    done
2577423b239cSmrg  done
2578423b239cSmrg}
2579423b239cSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2580423b239cSmrg
2581423b239cSmrg
2582423b239cSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2583423b239cSmrg# -----------------------------
2584423b239cSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2585a733a5bfSmrg#
2586423b239cSmrg# This code is only required when automatic dependency tracking
2587423b239cSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
2588423b239cSmrg# need in order to bootstrap the dependency handling code.
2589423b239cSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2590423b239cSmrg[AC_CONFIG_COMMANDS([depfiles],
2591423b239cSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2592423b239cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2593423b239cSmrg])
2594423b239cSmrg
2595423b239cSmrg# Do all the work for Automake.                             -*- Autoconf -*-
2596423b239cSmrg
2597423b239cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
2598a733a5bfSmrg#
2599423b239cSmrg# This file is free software; the Free Software Foundation
2600423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2601423b239cSmrg# with or without modifications, as long as this notice is preserved.
2602a733a5bfSmrg
2603423b239cSmrg# This macro actually does too much.  Some checks are only needed if
2604423b239cSmrg# your package does certain things.  But this isn't really a big deal.
2605a733a5bfSmrg
2606423b239cSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2607423b239cSmrgm4_define([AC_PROG_CC],
2608423b239cSmrgm4_defn([AC_PROG_CC])
2609423b239cSmrg[_AM_PROG_CC_C_O
2610423b239cSmrg])
2611a733a5bfSmrg
2612423b239cSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2613423b239cSmrg# AM_INIT_AUTOMAKE([OPTIONS])
2614423b239cSmrg# -----------------------------------------------
2615423b239cSmrg# The call with PACKAGE and VERSION arguments is the old style
2616423b239cSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2617423b239cSmrg# and VERSION should now be passed to AC_INIT and removed from
2618423b239cSmrg# the call to AM_INIT_AUTOMAKE.
2619423b239cSmrg# We support both call styles for the transition.  After
2620423b239cSmrg# the next Automake release, Autoconf can make the AC_INIT
2621423b239cSmrg# arguments mandatory, and then we can depend on a new Autoconf
2622423b239cSmrg# release and drop the old call support.
2623423b239cSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
2624423b239cSmrg[AC_PREREQ([2.65])dnl
2625423b239cSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2626423b239cSmrgdnl the ones we care about.
2627423b239cSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2628423b239cSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2629423b239cSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2630423b239cSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2631423b239cSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2632423b239cSmrg  # is not polluted with repeated "-I."
2633423b239cSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2634423b239cSmrg  # test to see if srcdir already configured
2635423b239cSmrg  if test -f $srcdir/config.status; then
2636423b239cSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2637a733a5bfSmrg  fi
2638a733a5bfSmrgfi
2639a733a5bfSmrg
2640423b239cSmrg# test whether we have cygpath
2641423b239cSmrgif test -z "$CYGPATH_W"; then
2642423b239cSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2643423b239cSmrg    CYGPATH_W='cygpath -w'
2644423b239cSmrg  else
2645423b239cSmrg    CYGPATH_W=echo
2646a733a5bfSmrg  fi
2647a733a5bfSmrgfi
2648423b239cSmrgAC_SUBST([CYGPATH_W])
2649a733a5bfSmrg
2650423b239cSmrg# Define the identity of the package.
2651423b239cSmrgdnl Distinguish between old-style and new-style calls.
2652423b239cSmrgm4_ifval([$2],
2653423b239cSmrg[AC_DIAGNOSE([obsolete],
2654423b239cSmrg             [$0: two- and three-arguments forms are deprecated.])
2655423b239cSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2656423b239cSmrg AC_SUBST([PACKAGE], [$1])dnl
2657423b239cSmrg AC_SUBST([VERSION], [$2])],
2658423b239cSmrg[_AM_SET_OPTIONS([$1])dnl
2659423b239cSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2660423b239cSmrgm4_if(
2661423b239cSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2662423b239cSmrg  [ok:ok],,
2663423b239cSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2664423b239cSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2665423b239cSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2666a733a5bfSmrg
2667423b239cSmrg_AM_IF_OPTION([no-define],,
2668423b239cSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2669423b239cSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2670a733a5bfSmrg
2671423b239cSmrg# Some tools Automake needs.
2672423b239cSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2673423b239cSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2674423b239cSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2675423b239cSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2676423b239cSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2677423b239cSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2678423b239cSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2679423b239cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2680423b239cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2681423b239cSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2682423b239cSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
2683423b239cSmrg# dies out for good.  For more background, see:
2684423b239cSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2685423b239cSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2686423b239cSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2687423b239cSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
2688423b239cSmrg# system "awk" is bad on some platforms.
2689423b239cSmrgAC_REQUIRE([AC_PROG_AWK])dnl
2690423b239cSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2691423b239cSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2692423b239cSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2693423b239cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2694423b239cSmrg			     [_AM_PROG_TAR([v7])])])
2695423b239cSmrg_AM_IF_OPTION([no-dependencies],,
2696423b239cSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2697423b239cSmrg		  [_AM_DEPENDENCIES([CC])],
2698423b239cSmrg		  [m4_define([AC_PROG_CC],
2699423b239cSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2700423b239cSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2701423b239cSmrg		  [_AM_DEPENDENCIES([CXX])],
2702423b239cSmrg		  [m4_define([AC_PROG_CXX],
2703423b239cSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2704423b239cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2705423b239cSmrg		  [_AM_DEPENDENCIES([OBJC])],
2706423b239cSmrg		  [m4_define([AC_PROG_OBJC],
2707423b239cSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2708423b239cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2709423b239cSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
2710423b239cSmrg		  [m4_define([AC_PROG_OBJCXX],
2711423b239cSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2712423b239cSmrg])
2713423b239cSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2714423b239cSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
2715423b239cSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2716423b239cSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2717423b239cSmrgAC_CONFIG_COMMANDS_PRE(dnl
2718423b239cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2719423b239cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2720a733a5bfSmrg
2721423b239cSmrg# POSIX will say in a future version that running "rm -f" with no argument
2722423b239cSmrg# is OK; and we want to be able to make that assumption in our Makefile
2723423b239cSmrg# recipes.  So use an aggressive probe to check that the usage we want is
2724423b239cSmrg# actually supported "in the wild" to an acceptable degree.
2725423b239cSmrg# See automake bug#10828.
2726423b239cSmrg# To make any issue more visible, cause the running configure to be aborted
2727423b239cSmrg# by default if the 'rm' program in use doesn't match our expectations; the
2728423b239cSmrg# user can still override this though.
2729423b239cSmrgif rm -f && rm -fr && rm -rf; then : OK; else
2730423b239cSmrg  cat >&2 <<'END'
2731423b239cSmrgOops!
2732a733a5bfSmrg
2733423b239cSmrgYour 'rm' program seems unable to run without file operands specified
2734423b239cSmrgon the command line, even when the '-f' option is present.  This is contrary
2735423b239cSmrgto the behaviour of most rm programs out there, and not conforming with
2736423b239cSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2737a733a5bfSmrg
2738423b239cSmrgPlease tell bug-automake@gnu.org about your system, including the value
2739423b239cSmrgof your $PATH and any error possibly output before this message.  This
2740423b239cSmrgcan help us improve future automake versions.
2741a733a5bfSmrg
2742423b239cSmrgEND
2743423b239cSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2744423b239cSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2745423b239cSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2746423b239cSmrg    echo >&2
2747423b239cSmrg  else
2748423b239cSmrg    cat >&2 <<'END'
2749423b239cSmrgAborting the configuration process, to ensure you take notice of the issue.
2750a733a5bfSmrg
2751423b239cSmrgYou can download and install GNU coreutils to get an 'rm' implementation
2752423b239cSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2753a733a5bfSmrg
2754423b239cSmrgIf you want to complete the configuration process using your problematic
2755423b239cSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2756423b239cSmrgto "yes", and re-run configure.
27571a30de1fSmrg
2758423b239cSmrgEND
2759423b239cSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2760423b239cSmrg  fi
27611a30de1fSmrgfi
2762423b239cSmrgdnl The trailing newline in this macro's definition is deliberate, for
2763423b239cSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
2764423b239cSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2765423b239cSmrg])
27661a30de1fSmrg
2767423b239cSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2768423b239cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2769423b239cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
2770423b239cSmrgm4_define([_AC_COMPILER_EXEEXT],
2771423b239cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
27721a30de1fSmrg
2773423b239cSmrg# When config.status generates a header, we must update the stamp-h file.
2774423b239cSmrg# This file resides in the same directory as the config header
2775423b239cSmrg# that is generated.  The stamp files are numbered to have different names.
27761a30de1fSmrg
2777423b239cSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2778423b239cSmrg# loop where config.status creates the headers, so we can generate
2779423b239cSmrg# our stamp files there.
2780423b239cSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2781423b239cSmrg[# Compute $1's index in $config_headers.
2782423b239cSmrg_am_arg=$1
2783423b239cSmrg_am_stamp_count=1
2784423b239cSmrgfor _am_header in $config_headers :; do
2785423b239cSmrg  case $_am_header in
2786423b239cSmrg    $_am_arg | $_am_arg:* )
2787423b239cSmrg      break ;;
2788423b239cSmrg    * )
2789423b239cSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2790423b239cSmrg  esac
2791423b239cSmrgdone
2792423b239cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2793423b239cSmrg
2794423b239cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27951a30de1fSmrg#
2796423b239cSmrg# This file is free software; the Free Software Foundation
2797423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2798423b239cSmrg# with or without modifications, as long as this notice is preserved.
27991a30de1fSmrg
2800423b239cSmrg# AM_PROG_INSTALL_SH
2801423b239cSmrg# ------------------
2802423b239cSmrg# Define $install_sh.
2803423b239cSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2804423b239cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2805423b239cSmrgif test x"${install_sh+set}" != xset; then
2806423b239cSmrg  case $am_aux_dir in
2807423b239cSmrg  *\ * | *\	*)
2808423b239cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2809423b239cSmrg  *)
2810423b239cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2811423b239cSmrg  esac
2812423b239cSmrgfi
2813423b239cSmrgAC_SUBST([install_sh])])
2814ce62200cSmrg
2815423b239cSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
2816423b239cSmrg#
2817423b239cSmrg# This file is free software; the Free Software Foundation
2818423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2819423b239cSmrg# with or without modifications, as long as this notice is preserved.
2820ce62200cSmrg
2821423b239cSmrg# Check whether the underlying file-system supports filenames
2822423b239cSmrg# with a leading dot.  For instance MS-DOS doesn't.
2823423b239cSmrgAC_DEFUN([AM_SET_LEADING_DOT],
2824423b239cSmrg[rm -rf .tst 2>/dev/null
2825423b239cSmrgmkdir .tst 2>/dev/null
2826423b239cSmrgif test -d .tst; then
2827423b239cSmrg  am__leading_dot=.
28281a30de1fSmrgelse
2829423b239cSmrg  am__leading_dot=_
28301a30de1fSmrgfi
2831423b239cSmrgrmdir .tst 2>/dev/null
2832423b239cSmrgAC_SUBST([am__leading_dot])])
28331a30de1fSmrg
2834423b239cSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
28351a30de1fSmrg
2836423b239cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2837ce62200cSmrg#
2838423b239cSmrg# This file is free software; the Free Software Foundation
2839423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2840423b239cSmrg# with or without modifications, as long as this notice is preserved.
2841ce62200cSmrg
2842423b239cSmrg# AM_MAKE_INCLUDE()
2843423b239cSmrg# -----------------
2844423b239cSmrg# Check to see how make treats includes.
2845423b239cSmrgAC_DEFUN([AM_MAKE_INCLUDE],
2846423b239cSmrg[am_make=${MAKE-make}
2847423b239cSmrgcat > confinc << 'END'
2848423b239cSmrgam__doit:
2849423b239cSmrg	@echo this is the am__doit target
2850423b239cSmrg.PHONY: am__doit
2851423b239cSmrgEND
2852423b239cSmrg# If we don't find an include directive, just comment out the code.
2853423b239cSmrgAC_MSG_CHECKING([for style of include used by $am_make])
2854423b239cSmrgam__include="#"
2855423b239cSmrgam__quote=
2856423b239cSmrg_am_result=none
2857423b239cSmrg# First try GNU make style include.
2858423b239cSmrgecho "include confinc" > confmf
2859423b239cSmrg# Ignore all kinds of additional output from 'make'.
2860423b239cSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
2861423b239cSmrg*the\ am__doit\ target*)
2862423b239cSmrg  am__include=include
2863423b239cSmrg  am__quote=
2864423b239cSmrg  _am_result=GNU
2865423b239cSmrg  ;;
2866423b239cSmrgesac
2867423b239cSmrg# Now try BSD make style include.
2868423b239cSmrgif test "$am__include" = "#"; then
2869423b239cSmrg   echo '.include "confinc"' > confmf
2870423b239cSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
2871423b239cSmrg   *the\ am__doit\ target*)
2872423b239cSmrg     am__include=.include
2873423b239cSmrg     am__quote="\""
2874423b239cSmrg     _am_result=BSD
2875423b239cSmrg     ;;
2876423b239cSmrg   esac
28771a30de1fSmrgfi
2878423b239cSmrgAC_SUBST([am__include])
2879423b239cSmrgAC_SUBST([am__quote])
2880423b239cSmrgAC_MSG_RESULT([$_am_result])
2881423b239cSmrgrm -f confinc confmf
2882423b239cSmrg])
2883ce62200cSmrg
2884423b239cSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2885a733a5bfSmrg
2886423b239cSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
2887a733a5bfSmrg#
2888423b239cSmrg# This file is free software; the Free Software Foundation
2889423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2890423b239cSmrg# with or without modifications, as long as this notice is preserved.
2891a733a5bfSmrg
2892423b239cSmrg# AM_MISSING_PROG(NAME, PROGRAM)
2893423b239cSmrg# ------------------------------
2894423b239cSmrgAC_DEFUN([AM_MISSING_PROG],
2895423b239cSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2896423b239cSmrg$1=${$1-"${am_missing_run}$2"}
2897423b239cSmrgAC_SUBST($1)])
2898a733a5bfSmrg
2899423b239cSmrg# AM_MISSING_HAS_RUN
2900423b239cSmrg# ------------------
2901423b239cSmrg# Define MISSING if not defined so far and test if it is modern enough.
2902423b239cSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
2903423b239cSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2904423b239cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2905423b239cSmrgAC_REQUIRE_AUX_FILE([missing])dnl
2906423b239cSmrgif test x"${MISSING+set}" != xset; then
2907423b239cSmrg  case $am_aux_dir in
2908423b239cSmrg  *\ * | *\	*)
2909423b239cSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2910423b239cSmrg  *)
2911423b239cSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2912423b239cSmrg  esac
2913a733a5bfSmrgfi
2914423b239cSmrg# Use eval to expand $SHELL
2915423b239cSmrgif eval "$MISSING --is-lightweight"; then
2916423b239cSmrg  am_missing_run="$MISSING "
2917423b239cSmrgelse
2918423b239cSmrg  am_missing_run=
2919423b239cSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2920a733a5bfSmrgfi
2921423b239cSmrg])
2922a733a5bfSmrg
2923423b239cSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2924a733a5bfSmrg
2925423b239cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
2926423b239cSmrg#
2927423b239cSmrg# This file is free software; the Free Software Foundation
2928423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2929423b239cSmrg# with or without modifications, as long as this notice is preserved.
2930a733a5bfSmrg
2931423b239cSmrg# _AM_MANGLE_OPTION(NAME)
2932423b239cSmrg# -----------------------
2933423b239cSmrgAC_DEFUN([_AM_MANGLE_OPTION],
2934423b239cSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2935a733a5bfSmrg
2936423b239cSmrg# _AM_SET_OPTION(NAME)
2937423b239cSmrg# --------------------
2938423b239cSmrg# Set option NAME.  Presently that only means defining a flag for this option.
2939423b239cSmrgAC_DEFUN([_AM_SET_OPTION],
2940423b239cSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2941a733a5bfSmrg
2942423b239cSmrg# _AM_SET_OPTIONS(OPTIONS)
2943423b239cSmrg# ------------------------
2944423b239cSmrg# OPTIONS is a space-separated list of Automake options.
2945423b239cSmrgAC_DEFUN([_AM_SET_OPTIONS],
2946423b239cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2947a733a5bfSmrg
2948423b239cSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2949423b239cSmrg# -------------------------------------------
2950423b239cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2951423b239cSmrgAC_DEFUN([_AM_IF_OPTION],
2952423b239cSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2953a733a5bfSmrg
2954423b239cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
2955a733a5bfSmrg#
2956423b239cSmrg# This file is free software; the Free Software Foundation
2957423b239cSmrg# gives unlimited permission to copy and/or distribute it,
2958423b239cSmrg# with or without modifications, as long as this notice is preserved.
2959a733a5bfSmrg
2960423b239cSmrg# _AM_PROG_CC_C_O
2961423b239cSmrg# ---------------
2962423b239cSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
2963423b239cSmrg# to automatically call this.
2964423b239cSmrgAC_DEFUN([_AM_PROG_CC_C_O],
2965423b239cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2966423b239cSmrgAC_REQUIRE_AUX_FILE([compile])dnl
2967423b239cSmrgAC_LANG_PUSH([C])dnl
2968423b239cSmrgAC_CACHE_CHECK(
2969423b239cSmrg  [whether $CC understands -c and -o together],
2970423b239cSmrg  [am_cv_prog_cc_c_o],
2971423b239cSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
2972423b239cSmrg  # Make sure it works both with $CC and with simple cc.
2973423b239cSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
2974423b239cSmrg  # compilers refuse to overwrite an existing .o file with -o,
2975423b239cSmrg  # though they will create one.
2976423b239cSmrg  am_cv_prog_cc_c_o=yes
2977423b239cSmrg  for am_i in 1 2; do
2978423b239cSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
2979423b239cSmrg         && test -f conftest2.$ac_objext; then
2980423b239cSmrg      : OK
2981423b239cSmrg    else
2982423b239cSmrg      am_cv_prog_cc_c_o=no
2983423b239cSmrg      break
2984423b239cSmrg    fi
2985423b239cSmrg  done
2986423b239cSmrg  rm -f core conftest*
2987423b239cSmrg  unset am_i])
2988423b239cSmrgif test "$am_cv_prog_cc_c_o" != yes; then
2989423b239cSmrg   # Losing compiler, so override with the script.
2990423b239cSmrg   # FIXME: It is wrong to rewrite CC.
2991423b239cSmrg   # But if we don't then we get into trouble of one sort or another.
2992423b239cSmrg   # A longer-term fix would be to have automake use am__CC in this case,
2993423b239cSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
2994423b239cSmrg   CC="$am_aux_dir/compile $CC"
2995a733a5bfSmrgfi
2996423b239cSmrgAC_LANG_POP([C])])
2997a733a5bfSmrg
2998423b239cSmrg# For backward compatibility.
2999423b239cSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
3000423b239cSmrg
3001423b239cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3002423b239cSmrg#
3003423b239cSmrg# This file is free software; the Free Software Foundation
3004423b239cSmrg# gives unlimited permission to copy and/or distribute it,
3005423b239cSmrg# with or without modifications, as long as this notice is preserved.
3006423b239cSmrg
3007423b239cSmrg# AM_RUN_LOG(COMMAND)
3008423b239cSmrg# -------------------
3009423b239cSmrg# Run COMMAND, save the exit status in ac_status, and log it.
3010423b239cSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
3011423b239cSmrgAC_DEFUN([AM_RUN_LOG],
3012423b239cSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
3013423b239cSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
3014423b239cSmrg   ac_status=$?
3015423b239cSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
3016423b239cSmrg   (exit $ac_status); }])
3017a733a5bfSmrg
3018423b239cSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3019a733a5bfSmrg
3020423b239cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
3021423b239cSmrg#
3022423b239cSmrg# This file is free software; the Free Software Foundation
3023423b239cSmrg# gives unlimited permission to copy and/or distribute it,
3024423b239cSmrg# with or without modifications, as long as this notice is preserved.
3025a733a5bfSmrg
3026423b239cSmrg# AM_SANITY_CHECK
3027423b239cSmrg# ---------------
3028423b239cSmrgAC_DEFUN([AM_SANITY_CHECK],
3029423b239cSmrg[AC_MSG_CHECKING([whether build environment is sane])
3030423b239cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
3031423b239cSmrg# name.  Accept space and tab only in the latter.
3032423b239cSmrgam_lf='
3033423b239cSmrg'
3034423b239cSmrgcase `pwd` in
3035423b239cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
3036423b239cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
3037423b239cSmrgesac
3038423b239cSmrgcase $srcdir in
3039423b239cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
3040423b239cSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
3041423b239cSmrgesac
3042a733a5bfSmrg
3043423b239cSmrg# Do 'set' in a subshell so we don't clobber the current shell's
3044423b239cSmrg# arguments.  Must try -L first in case configure is actually a
3045423b239cSmrg# symlink; some systems play weird games with the mod time of symlinks
3046423b239cSmrg# (eg FreeBSD returns the mod time of the symlink's containing
3047423b239cSmrg# directory).
3048423b239cSmrgif (
3049423b239cSmrg   am_has_slept=no
3050423b239cSmrg   for am_try in 1 2; do
3051423b239cSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
3052423b239cSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
3053423b239cSmrg     if test "$[*]" = "X"; then
3054423b239cSmrg	# -L didn't work.
3055423b239cSmrg	set X `ls -t "$srcdir/configure" conftest.file`
3056423b239cSmrg     fi
3057423b239cSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
3058423b239cSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
3059a733a5bfSmrg
3060423b239cSmrg	# If neither matched, then we have a broken ls.  This can happen
3061423b239cSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
3062423b239cSmrg	# broken ls alias from the environment.  This has actually
3063423b239cSmrg	# happened.  Such a system could not be considered "sane".
3064423b239cSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3065423b239cSmrg  alias in your environment])
3066423b239cSmrg     fi
3067423b239cSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
3068423b239cSmrg       break
3069423b239cSmrg     fi
3070423b239cSmrg     # Just in case.
3071423b239cSmrg     sleep 1
3072423b239cSmrg     am_has_slept=yes
3073423b239cSmrg   done
3074423b239cSmrg   test "$[2]" = conftest.file
3075423b239cSmrg   )
3076423b239cSmrgthen
3077423b239cSmrg   # Ok.
3078423b239cSmrg   :
3079a733a5bfSmrgelse
3080423b239cSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
3081423b239cSmrgCheck your system clock])
3082a733a5bfSmrgfi
3083423b239cSmrgAC_MSG_RESULT([yes])
3084423b239cSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
3085423b239cSmrg# generated files are strictly newer.
3086423b239cSmrgam_sleep_pid=
3087423b239cSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
3088423b239cSmrg  ( sleep 1 ) &
3089423b239cSmrg  am_sleep_pid=$!
3090423b239cSmrgfi
3091423b239cSmrgAC_CONFIG_COMMANDS_PRE(
3092423b239cSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
3093423b239cSmrg   if test -n "$am_sleep_pid"; then
3094423b239cSmrg     # Hide warnings about reused PIDs.
3095423b239cSmrg     wait $am_sleep_pid 2>/dev/null
3096423b239cSmrg   fi
3097423b239cSmrg   AC_MSG_RESULT([done])])
3098423b239cSmrgrm -f conftest.file
3099423b239cSmrg])
3100a733a5bfSmrg
3101423b239cSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
3102a733a5bfSmrg#
3103423b239cSmrg# This file is free software; the Free Software Foundation
3104423b239cSmrg# gives unlimited permission to copy and/or distribute it,
3105423b239cSmrg# with or without modifications, as long as this notice is preserved.
3106b7fb5eacSmrg
3107423b239cSmrg# AM_SILENT_RULES([DEFAULT])
3108423b239cSmrg# --------------------------
3109423b239cSmrg# Enable less verbose build rules; with the default set to DEFAULT
3110423b239cSmrg# ("yes" being less verbose, "no" or empty being verbose).
3111423b239cSmrgAC_DEFUN([AM_SILENT_RULES],
3112423b239cSmrg[AC_ARG_ENABLE([silent-rules], [dnl
3113423b239cSmrgAS_HELP_STRING(
3114423b239cSmrg  [--enable-silent-rules],
3115423b239cSmrg  [less verbose build output (undo: "make V=1")])
3116423b239cSmrgAS_HELP_STRING(
3117423b239cSmrg  [--disable-silent-rules],
3118423b239cSmrg  [verbose build output (undo: "make V=0")])dnl
3119423b239cSmrg])
3120423b239cSmrgcase $enable_silent_rules in @%:@ (((
3121423b239cSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
3122423b239cSmrg   no) AM_DEFAULT_VERBOSITY=1;;
3123423b239cSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
3124423b239cSmrgesac
3125423b239cSmrgdnl
3126423b239cSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3127423b239cSmrgdnl do not support nested variable expansions.
3128423b239cSmrgdnl See automake bug#9928 and bug#10237.
3129423b239cSmrgam_make=${MAKE-make}
3130423b239cSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
3131423b239cSmrg   [am_cv_make_support_nested_variables],
3132423b239cSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
3133423b239cSmrgBAR0=false
3134423b239cSmrgBAR1=true
3135423b239cSmrgV=1
3136423b239cSmrgam__doit:
3137423b239cSmrg	@$(TRUE)
3138423b239cSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3139423b239cSmrg  am_cv_make_support_nested_variables=yes
3140423b239cSmrgelse
3141423b239cSmrg  am_cv_make_support_nested_variables=no
3142423b239cSmrgfi])
3143423b239cSmrgif test $am_cv_make_support_nested_variables = yes; then
3144423b239cSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3145423b239cSmrg  AM_V='$(V)'
3146423b239cSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3147423b239cSmrgelse
3148423b239cSmrg  AM_V=$AM_DEFAULT_VERBOSITY
3149423b239cSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3150423b239cSmrgfi
3151423b239cSmrgAC_SUBST([AM_V])dnl
3152423b239cSmrgAM_SUBST_NOTMAKE([AM_V])dnl
3153423b239cSmrgAC_SUBST([AM_DEFAULT_V])dnl
3154423b239cSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3155423b239cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3156423b239cSmrgAM_BACKSLASH='\'
3157423b239cSmrgAC_SUBST([AM_BACKSLASH])dnl
3158423b239cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3159423b239cSmrg])
3160423b239cSmrg
3161423b239cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
3162a733a5bfSmrg#
3163423b239cSmrg# This file is free software; the Free Software Foundation
3164423b239cSmrg# gives unlimited permission to copy and/or distribute it,
3165423b239cSmrg# with or without modifications, as long as this notice is preserved.
3166423b239cSmrg
3167423b239cSmrg# AM_PROG_INSTALL_STRIP
3168423b239cSmrg# ---------------------
3169423b239cSmrg# One issue with vendor 'install' (even GNU) is that you can't
3170423b239cSmrg# specify the program used to strip binaries.  This is especially
3171423b239cSmrg# annoying in cross-compiling environments, where the build's strip
3172423b239cSmrg# is unlikely to handle the host's binaries.
3173423b239cSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
3174423b239cSmrg# always use install-sh in "make install-strip", and initialize
3175423b239cSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
3176423b239cSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3177423b239cSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3178423b239cSmrg# Installed binaries are usually stripped using 'strip' when the user
3179423b239cSmrg# run "make install-strip".  However 'strip' might not be the right
3180423b239cSmrg# tool to use in cross-compilation environments, therefore Automake
3181423b239cSmrg# will honor the 'STRIP' environment variable to overrule this program.
3182423b239cSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3183423b239cSmrgif test "$cross_compiling" != no; then
3184423b239cSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
3185423b239cSmrgfi
3186423b239cSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3187423b239cSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3188b7fb5eacSmrg
3189423b239cSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
3190423b239cSmrg#
3191423b239cSmrg# This file is free software; the Free Software Foundation
3192423b239cSmrg# gives unlimited permission to copy and/or distribute it,
3193423b239cSmrg# with or without modifications, as long as this notice is preserved.
3194a733a5bfSmrg
3195423b239cSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
3196423b239cSmrg# ---------------------------
3197423b239cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3198423b239cSmrg# This macro is traced by Automake.
3199423b239cSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3200a733a5bfSmrg
3201423b239cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
3202423b239cSmrg# --------------------------
3203423b239cSmrg# Public sister of _AM_SUBST_NOTMAKE.
3204423b239cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3205a733a5bfSmrg
3206423b239cSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3207a733a5bfSmrg
3208423b239cSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
3209423b239cSmrg#
3210423b239cSmrg# This file is free software; the Free Software Foundation
3211423b239cSmrg# gives unlimited permission to copy and/or distribute it,
3212423b239cSmrg# with or without modifications, as long as this notice is preserved.
3213b7fb5eacSmrg
3214423b239cSmrg# _AM_PROG_TAR(FORMAT)
3215b7fb5eacSmrg# --------------------
3216423b239cSmrg# Check how to create a tarball in format FORMAT.
3217423b239cSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3218b7fb5eacSmrg#
3219423b239cSmrg# Substitute a variable $(am__tar) that is a command
3220423b239cSmrg# writing to stdout a FORMAT-tarball containing the directory
3221423b239cSmrg# $tardir.
3222423b239cSmrg#     tardir=directory && $(am__tar) > result.tar
3223ce62200cSmrg#
3224423b239cSmrg# Substitute a variable $(am__untar) that extract such
3225423b239cSmrg# a tarball read from stdin.
3226423b239cSmrg#     $(am__untar) < result.tar
3227ce62200cSmrg#
3228423b239cSmrgAC_DEFUN([_AM_PROG_TAR],
3229423b239cSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
3230423b239cSmrg# in the wild :-(  We should find a proper way to deprecate it ...
3231423b239cSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32321a30de1fSmrg
3233423b239cSmrg# We'll loop over all known methods to create a tar archive until one works.
3234423b239cSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3235a733a5bfSmrg
3236423b239cSmrgm4_if([$1], [v7],
3237423b239cSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32381a30de1fSmrg
3239423b239cSmrg  [m4_case([$1],
3240423b239cSmrg    [ustar],
3241423b239cSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3242423b239cSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3243423b239cSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3244423b239cSmrg      # and bug#13588).
3245423b239cSmrg      am_max_uid=2097151 # 2^21 - 1
3246423b239cSmrg      am_max_gid=$am_max_uid
3247423b239cSmrg      # The $UID and $GID variables are not portable, so we need to resort
3248423b239cSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3249423b239cSmrg      # below are definitely unexpected, so allow the users to see them
3250423b239cSmrg      # (that is, avoid stderr redirection).
3251423b239cSmrg      am_uid=`id -u || echo unknown`
3252423b239cSmrg      am_gid=`id -g || echo unknown`
3253423b239cSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3254423b239cSmrg      if test $am_uid -le $am_max_uid; then
3255423b239cSmrg         AC_MSG_RESULT([yes])
3256423b239cSmrg      else
3257423b239cSmrg         AC_MSG_RESULT([no])
3258423b239cSmrg         _am_tools=none
3259423b239cSmrg      fi
3260423b239cSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3261423b239cSmrg      if test $am_gid -le $am_max_gid; then
3262423b239cSmrg         AC_MSG_RESULT([yes])
3263423b239cSmrg      else
3264423b239cSmrg        AC_MSG_RESULT([no])
3265423b239cSmrg        _am_tools=none
3266423b239cSmrg      fi],
3267423b239cSmrg
3268423b239cSmrg  [pax],
3269423b239cSmrg    [],
3270423b239cSmrg
3271423b239cSmrg  [m4_fatal([Unknown tar format])])
3272423b239cSmrg
3273423b239cSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3274423b239cSmrg
3275423b239cSmrg  # Go ahead even if we have the value already cached.  We do so because we
3276423b239cSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
3277423b239cSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3278423b239cSmrg
3279423b239cSmrg  for _am_tool in $_am_tools; do
3280423b239cSmrg    case $_am_tool in
3281423b239cSmrg    gnutar)
3282423b239cSmrg      for _am_tar in tar gnutar gtar; do
3283423b239cSmrg        AM_RUN_LOG([$_am_tar --version]) && break
3284423b239cSmrg      done
3285423b239cSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3286423b239cSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3287423b239cSmrg      am__untar="$_am_tar -xf -"
3288423b239cSmrg      ;;
3289423b239cSmrg    plaintar)
3290423b239cSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
3291423b239cSmrg      # ustar tarball either.
3292423b239cSmrg      (tar --version) >/dev/null 2>&1 && continue
3293423b239cSmrg      am__tar='tar chf - "$$tardir"'
3294423b239cSmrg      am__tar_='tar chf - "$tardir"'
3295423b239cSmrg      am__untar='tar xf -'
3296423b239cSmrg      ;;
3297423b239cSmrg    pax)
3298423b239cSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
3299423b239cSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
3300423b239cSmrg      am__untar='pax -r'
3301423b239cSmrg      ;;
3302423b239cSmrg    cpio)
3303423b239cSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3304423b239cSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3305423b239cSmrg      am__untar='cpio -i -H $1 -d'
3306423b239cSmrg      ;;
3307423b239cSmrg    none)
3308423b239cSmrg      am__tar=false
3309423b239cSmrg      am__tar_=false
3310423b239cSmrg      am__untar=false
3311423b239cSmrg      ;;
3312423b239cSmrg    esac
3313423b239cSmrg
3314423b239cSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
3315423b239cSmrg    # and am__untar set.
3316423b239cSmrg    test -n "${am_cv_prog_tar_$1}" && break
3317423b239cSmrg
3318423b239cSmrg    # tar/untar a dummy directory, and stop if the command works.
3319423b239cSmrg    rm -rf conftest.dir
3320423b239cSmrg    mkdir conftest.dir
3321423b239cSmrg    echo GrepMe > conftest.dir/file
3322423b239cSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3323423b239cSmrg    rm -rf conftest.dir
3324423b239cSmrg    if test -s conftest.tar; then
3325423b239cSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
3326423b239cSmrg      AM_RUN_LOG([cat conftest.dir/file])
3327423b239cSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3328423b239cSmrg    fi
3329423b239cSmrg  done
3330423b239cSmrg  rm -rf conftest.dir
3331423b239cSmrg
3332423b239cSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3333423b239cSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3334423b239cSmrg
3335423b239cSmrgAC_SUBST([am__tar])
3336423b239cSmrgAC_SUBST([am__untar])
3337423b239cSmrg]) # _AM_PROG_TAR
3338b7fb5eacSmrg
3339