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