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