aclocal.m4 revision edce3322
1edce3322Smrg# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
2ac92798bSmrg
3edce3322Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
4a966c04fSmrg
5a966c04fSmrg# This file is free software; the Free Software Foundation
6a966c04fSmrg# gives unlimited permission to copy and/or distribute it,
7a966c04fSmrg# with or without modifications, as long as this notice is preserved.
8a966c04fSmrg
9a966c04fSmrg# This program is distributed in the hope that it will be useful,
10a966c04fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a966c04fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a966c04fSmrg# PARTICULAR PURPOSE.
13a966c04fSmrg
14ac92798bSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
152e2dd055Smrgm4_ifndef([AC_AUTOCONF_VERSION],
162e2dd055Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179f00f3a1Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
189f00f3a1Smrg[m4_warning([this file was generated for autoconf 2.69.
192e2dd055SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
202e2dd055SmrgIf you have problems, you may need to regenerate the build system entirely.
21ac92798bSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22a966c04fSmrg
23edce3322Smrg# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
24edce3322Smrg# serial 11 (pkg-config-0.29.1)
25a966c04fSmrg
26edce3322Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27edce3322Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
28edce3322Smrgdnl
29edce3322Smrgdnl This program is free software; you can redistribute it and/or modify
30edce3322Smrgdnl it under the terms of the GNU General Public License as published by
31edce3322Smrgdnl the Free Software Foundation; either version 2 of the License, or
32edce3322Smrgdnl (at your option) any later version.
33edce3322Smrgdnl
34edce3322Smrgdnl This program is distributed in the hope that it will be useful, but
35edce3322Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
36edce3322Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37edce3322Smrgdnl General Public License for more details.
38edce3322Smrgdnl
39edce3322Smrgdnl You should have received a copy of the GNU General Public License
40edce3322Smrgdnl along with this program; if not, write to the Free Software
41edce3322Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
42edce3322Smrgdnl 02111-1307, USA.
43edce3322Smrgdnl
44edce3322Smrgdnl As a special exception to the GNU General Public License, if you
45edce3322Smrgdnl distribute this file as part of a program that contains a
46edce3322Smrgdnl configuration script generated by Autoconf, you may include it under
47edce3322Smrgdnl the same distribution terms that you use for the rest of that
48edce3322Smrgdnl program.
49edce3322Smrg
50edce3322Smrgdnl PKG_PREREQ(MIN-VERSION)
51edce3322Smrgdnl -----------------------
52edce3322Smrgdnl Since: 0.29
53edce3322Smrgdnl
54edce3322Smrgdnl Verify that the version of the pkg-config macros are at least
55edce3322Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
56edce3322Smrgdnl installed version of pkg-config, this checks the developer's version
57edce3322Smrgdnl of pkg.m4 when generating configure.
58edce3322Smrgdnl
59edce3322Smrgdnl To ensure that this macro is defined, also add:
60edce3322Smrgdnl m4_ifndef([PKG_PREREQ],
61edce3322Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
62edce3322Smrgdnl
63edce3322Smrgdnl See the "Since" comment for each macro you use to see what version
64edce3322Smrgdnl of the macros you require.
65edce3322Smrgm4_defun([PKG_PREREQ],
66edce3322Smrg[m4_define([PKG_MACROS_VERSION], [0.29.1])
67edce3322Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
68edce3322Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
69edce3322Smrg])dnl PKG_PREREQ
70edce3322Smrg
71edce3322Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
72edce3322Smrgdnl ----------------------------------
73edce3322Smrgdnl Since: 0.16
74edce3322Smrgdnl
75edce3322Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
76edce3322Smrgdnl first found in the path. Checks that the version of pkg-config found
77edce3322Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
78edce3322Smrgdnl used since that's the first version where most current features of
79edce3322Smrgdnl pkg-config existed.
809f00f3a1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
819f00f3a1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
829f00f3a1Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
839f00f3a1Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
849f00f3a1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
859f00f3a1SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
869f00f3a1SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
87a966c04fSmrg
889f00f3a1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
899f00f3a1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
909f00f3a1Smrgfi
919f00f3a1Smrgif test -n "$PKG_CONFIG"; then
929f00f3a1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
939f00f3a1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
949f00f3a1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
959f00f3a1Smrg		AC_MSG_RESULT([yes])
969f00f3a1Smrg	else
979f00f3a1Smrg		AC_MSG_RESULT([no])
989f00f3a1Smrg		PKG_CONFIG=""
999f00f3a1Smrg	fi
1009f00f3a1Smrgfi[]dnl
101edce3322Smrg])dnl PKG_PROG_PKG_CONFIG
102a966c04fSmrg
103edce3322Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
104edce3322Smrgdnl -------------------------------------------------------------------
105edce3322Smrgdnl Since: 0.18
106edce3322Smrgdnl
107edce3322Smrgdnl Check to see whether a particular set of modules exists. Similar to
108edce3322Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
109edce3322Smrgdnl
110edce3322Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
111edce3322Smrgdnl only at the first occurence in configure.ac, so if the first place
112edce3322Smrgdnl it's called might be skipped (such as if it is within an "if", you
113edce3322Smrgdnl have to call PKG_CHECK_EXISTS manually
1149f00f3a1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1159f00f3a1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1169f00f3a1Smrgif test -n "$PKG_CONFIG" && \
1179f00f3a1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1189f00f3a1Smrg  m4_default([$2], [:])
1199f00f3a1Smrgm4_ifvaln([$3], [else
1209f00f3a1Smrg  $3])dnl
1219f00f3a1Smrgfi])
122a966c04fSmrg
123edce3322Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
124edce3322Smrgdnl ---------------------------------------------
125edce3322Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
126edce3322Smrgdnl pkg_failed based on the result.
1279f00f3a1Smrgm4_define([_PKG_CONFIG],
1289f00f3a1Smrg[if test -n "$$1"; then
1299f00f3a1Smrg    pkg_cv_[]$1="$$1"
1309f00f3a1Smrg elif test -n "$PKG_CONFIG"; then
1319f00f3a1Smrg    PKG_CHECK_EXISTS([$3],
1329f00f3a1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1339f00f3a1Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1349f00f3a1Smrg		     [pkg_failed=yes])
1359f00f3a1Smrg else
1369f00f3a1Smrg    pkg_failed=untried
1379f00f3a1Smrgfi[]dnl
138edce3322Smrg])dnl _PKG_CONFIG
139a966c04fSmrg
140edce3322Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
141edce3322Smrgdnl ---------------------------
142edce3322Smrgdnl Internal check to see if pkg-config supports short errors.
1439f00f3a1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1449f00f3a1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1459f00f3a1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1469f00f3a1Smrg        _pkg_short_errors_supported=yes
1479f00f3a1Smrgelse
1489f00f3a1Smrg        _pkg_short_errors_supported=no
1499f00f3a1Smrgfi[]dnl
150edce3322Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
151a966c04fSmrg
1529f00f3a1Smrg
153edce3322Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
154edce3322Smrgdnl   [ACTION-IF-NOT-FOUND])
155edce3322Smrgdnl --------------------------------------------------------------
156edce3322Smrgdnl Since: 0.4.0
157edce3322Smrgdnl
158edce3322Smrgdnl Note that if there is a possibility the first call to
159edce3322Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
160edce3322Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1619f00f3a1SmrgAC_DEFUN([PKG_CHECK_MODULES],
1629f00f3a1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1639f00f3a1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1649f00f3a1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
165a966c04fSmrg
1669f00f3a1Smrgpkg_failed=no
1679f00f3a1SmrgAC_MSG_CHECKING([for $1])
168a966c04fSmrg
1699f00f3a1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1709f00f3a1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171a966c04fSmrg
1729f00f3a1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1739f00f3a1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1749f00f3a1SmrgSee the pkg-config man page for more details.])
175a966c04fSmrg
1769f00f3a1Smrgif test $pkg_failed = yes; then
1779f00f3a1Smrg   	AC_MSG_RESULT([no])
1789f00f3a1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1799f00f3a1Smrg        if test $_pkg_short_errors_supported = yes; then
1809f00f3a1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1819f00f3a1Smrg        else 
1829f00f3a1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1839f00f3a1Smrg        fi
1849f00f3a1Smrg	# Put the nasty error message in config.log where it belongs
1859f00f3a1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186a966c04fSmrg
1879f00f3a1Smrg	m4_default([$4], [AC_MSG_ERROR(
1889f00f3a1Smrg[Package requirements ($2) were not met:
189a966c04fSmrg
1909f00f3a1Smrg$$1_PKG_ERRORS
191a966c04fSmrg
1929f00f3a1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1939f00f3a1Smrginstalled software in a non-standard prefix.
194a966c04fSmrg
1959f00f3a1Smrg_PKG_TEXT])[]dnl
1969f00f3a1Smrg        ])
1979f00f3a1Smrgelif test $pkg_failed = untried; then
1989f00f3a1Smrg     	AC_MSG_RESULT([no])
1999f00f3a1Smrg	m4_default([$4], [AC_MSG_FAILURE(
2009f00f3a1Smrg[The pkg-config script could not be found or is too old.  Make sure it
2019f00f3a1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
2029f00f3a1Smrgpath to pkg-config.
203a966c04fSmrg
2049f00f3a1Smrg_PKG_TEXT
205a966c04fSmrg
2069f00f3a1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
2079f00f3a1Smrg        ])
2089f00f3a1Smrgelse
2099f00f3a1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2109f00f3a1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2119f00f3a1Smrg        AC_MSG_RESULT([yes])
2129f00f3a1Smrg	$3
2139f00f3a1Smrgfi[]dnl
214edce3322Smrg])dnl PKG_CHECK_MODULES
215edce3322Smrg
216edce3322Smrg
217edce3322Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
218edce3322Smrgdnl   [ACTION-IF-NOT-FOUND])
219edce3322Smrgdnl ---------------------------------------------------------------------
220edce3322Smrgdnl Since: 0.29
221edce3322Smrgdnl
222edce3322Smrgdnl Checks for existence of MODULES and gathers its build flags with
223edce3322Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
224edce3322Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
225edce3322Smrgdnl
226edce3322Smrgdnl Note that if there is a possibility the first call to
227edce3322Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
228edce3322Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
229edce3322Smrgdnl configure.ac.
230edce3322SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
231edce3322Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
232edce3322Smrg_save_PKG_CONFIG=$PKG_CONFIG
233edce3322SmrgPKG_CONFIG="$PKG_CONFIG --static"
234edce3322SmrgPKG_CHECK_MODULES($@)
235edce3322SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
236edce3322Smrg])dnl PKG_CHECK_MODULES_STATIC
237edce3322Smrg
238edce3322Smrg
239edce3322Smrgdnl PKG_INSTALLDIR([DIRECTORY])
240edce3322Smrgdnl -------------------------
241edce3322Smrgdnl Since: 0.27
242edce3322Smrgdnl
243edce3322Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
244edce3322Smrgdnl should install pkg-config .pc files. By default the directory is
245edce3322Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
246edce3322Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
247edce3322Smrgdnl parameter.
248edce3322SmrgAC_DEFUN([PKG_INSTALLDIR],
249edce3322Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
250edce3322Smrgm4_pushdef([pkg_description],
251edce3322Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
252edce3322SmrgAC_ARG_WITH([pkgconfigdir],
253edce3322Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
254edce3322Smrg    [with_pkgconfigdir=]pkg_default)
255edce3322SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
256edce3322Smrgm4_popdef([pkg_default])
257edce3322Smrgm4_popdef([pkg_description])
258edce3322Smrg])dnl PKG_INSTALLDIR
259edce3322Smrg
260edce3322Smrg
261edce3322Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
262edce3322Smrgdnl --------------------------------
263edce3322Smrgdnl Since: 0.27
264edce3322Smrgdnl
265edce3322Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
266edce3322Smrgdnl module should install arch-independent pkg-config .pc files. By
267edce3322Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
268edce3322Smrgdnl changed by passing DIRECTORY. The user can override through the
269edce3322Smrgdnl --with-noarch-pkgconfigdir parameter.
270edce3322SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
271edce3322Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
272edce3322Smrgm4_pushdef([pkg_description],
273edce3322Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
274edce3322SmrgAC_ARG_WITH([noarch-pkgconfigdir],
275edce3322Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
276edce3322Smrg    [with_noarch_pkgconfigdir=]pkg_default)
277edce3322SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
278edce3322Smrgm4_popdef([pkg_default])
279edce3322Smrgm4_popdef([pkg_description])
280edce3322Smrg])dnl PKG_NOARCH_INSTALLDIR
281edce3322Smrg
282edce3322Smrg
283edce3322Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
284edce3322Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
285edce3322Smrgdnl -------------------------------------------
286edce3322Smrgdnl Since: 0.28
287edce3322Smrgdnl
288edce3322Smrgdnl Retrieves the value of the pkg-config variable for the given module.
289edce3322SmrgAC_DEFUN([PKG_CHECK_VAR],
290edce3322Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
291edce3322SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
292edce3322Smrg
293edce3322Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
294edce3322SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
295edce3322Smrg
296edce3322SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
297edce3322Smrg])dnl PKG_CHECK_VAR
298edce3322Smrg
299edce3322Smrgdnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
300edce3322Smrgdnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
301edce3322Smrgdnl   [DESCRIPTION], [DEFAULT])
302edce3322Smrgdnl ------------------------------------------
303edce3322Smrgdnl
304edce3322Smrgdnl Prepare a "--with-" configure option using the lowercase
305edce3322Smrgdnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
306edce3322Smrgdnl PKG_CHECK_MODULES in a single macro.
307edce3322SmrgAC_DEFUN([PKG_WITH_MODULES],
308edce3322Smrg[
309edce3322Smrgm4_pushdef([with_arg], m4_tolower([$1]))
310edce3322Smrg
311edce3322Smrgm4_pushdef([description],
312edce3322Smrg           [m4_default([$5], [build with ]with_arg[ support])])
313edce3322Smrg
314edce3322Smrgm4_pushdef([def_arg], [m4_default([$6], [auto])])
315edce3322Smrgm4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
316edce3322Smrgm4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
317edce3322Smrg
318edce3322Smrgm4_case(def_arg,
319edce3322Smrg            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
320edce3322Smrg            [m4_pushdef([with_without],[--with-]with_arg)])
321edce3322Smrg
322edce3322SmrgAC_ARG_WITH(with_arg,
323edce3322Smrg     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
324edce3322Smrg    [AS_TR_SH([with_]with_arg)=def_arg])
325edce3322Smrg
326edce3322SmrgAS_CASE([$AS_TR_SH([with_]with_arg)],
327edce3322Smrg            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
328edce3322Smrg            [auto],[PKG_CHECK_MODULES([$1],[$2],
329edce3322Smrg                                        [m4_n([def_action_if_found]) $3],
330edce3322Smrg                                        [m4_n([def_action_if_not_found]) $4])])
331edce3322Smrg
332edce3322Smrgm4_popdef([with_arg])
333edce3322Smrgm4_popdef([description])
334edce3322Smrgm4_popdef([def_arg])
335edce3322Smrg
336edce3322Smrg])dnl PKG_WITH_MODULES
337edce3322Smrg
338edce3322Smrgdnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
339edce3322Smrgdnl   [DESCRIPTION], [DEFAULT])
340edce3322Smrgdnl -----------------------------------------------
341edce3322Smrgdnl
342edce3322Smrgdnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
343edce3322Smrgdnl check._[VARIABLE-PREFIX] is exported as make variable.
344edce3322SmrgAC_DEFUN([PKG_HAVE_WITH_MODULES],
345edce3322Smrg[
346edce3322SmrgPKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
347edce3322Smrg
348edce3322SmrgAM_CONDITIONAL([HAVE_][$1],
349edce3322Smrg               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
350edce3322Smrg])dnl PKG_HAVE_WITH_MODULES
351edce3322Smrg
352edce3322Smrgdnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
353edce3322Smrgdnl   [DESCRIPTION], [DEFAULT])
354edce3322Smrgdnl ------------------------------------------------------
355edce3322Smrgdnl
356edce3322Smrgdnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
357edce3322Smrgdnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
358edce3322Smrgdnl and preprocessor variable.
359edce3322SmrgAC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
360edce3322Smrg[
361edce3322SmrgPKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
362edce3322Smrg
363edce3322SmrgAS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
364edce3322Smrg        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
365edce3322Smrg])dnl PKG_HAVE_DEFINE_WITH_MODULES
366a966c04fSmrg
3679f00f3a1Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
3689f00f3a1Smrgdnl
369edce3322Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
370edce3322Smrgdnl
3719f00f3a1Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3729f00f3a1Smrgdnl copy of this software and associated documentation files (the "Software"),
3739f00f3a1Smrgdnl to deal in the Software without restriction, including without limitation
3749f00f3a1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3759f00f3a1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3769f00f3a1Smrgdnl Software is furnished to do so, subject to the following conditions:
3779f00f3a1Smrgdnl
3789f00f3a1Smrgdnl The above copyright notice and this permission notice (including the next
3799f00f3a1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3809f00f3a1Smrgdnl Software.
3819f00f3a1Smrgdnl
3829f00f3a1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3839f00f3a1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3849f00f3a1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3859f00f3a1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3869f00f3a1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3879f00f3a1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3889f00f3a1Smrgdnl DEALINGS IN THE SOFTWARE.
389a966c04fSmrg
3909f00f3a1Smrg# XORG_MACROS_VERSION(required-version)
3919f00f3a1Smrg# -------------------------------------
3929f00f3a1Smrg# Minimum version: 1.1.0
3939f00f3a1Smrg#
3949f00f3a1Smrg# If you're using a macro added in Version 1.1 or newer, include this in
3959f00f3a1Smrg# your configure.ac with the minimum required version, such as:
3969f00f3a1Smrg# XORG_MACROS_VERSION(1.1)
3979f00f3a1Smrg#
3989f00f3a1Smrg# To ensure that this macro is defined, also add:
3999f00f3a1Smrg# m4_ifndef([XORG_MACROS_VERSION],
4009f00f3a1Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
4019f00f3a1Smrg#
4029f00f3a1Smrg#
403edce3322Smrg# See the "minimum version" comment for each macro you use to see what
4049f00f3a1Smrg# version you require.
4059f00f3a1Smrgm4_defun([XORG_MACROS_VERSION],[
406edce3322Smrgm4_define([vers_have], [1.19.2])
4079f00f3a1Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
4089f00f3a1Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
4099f00f3a1Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
4109f00f3a1Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
4119f00f3a1Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
4129f00f3a1Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
4139f00f3a1Smrgm4_undefine([vers_have])
4149f00f3a1Smrgm4_undefine([maj_have])
4159f00f3a1Smrgm4_undefine([maj_needed])
4169f00f3a1Smrg]) # XORG_MACROS_VERSION
4172e2dd055Smrg
4189f00f3a1Smrg# XORG_PROG_RAWCPP()
4199f00f3a1Smrg# ------------------
4209f00f3a1Smrg# Minimum version: 1.0.0
4219f00f3a1Smrg#
4229f00f3a1Smrg# Find cpp program and necessary flags for use in pre-processing text files
4239f00f3a1Smrg# such as man pages and config files
4249f00f3a1SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
4259f00f3a1SmrgAC_REQUIRE([AC_PROG_CPP])
426edce3322SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
4279f00f3a1Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
428a966c04fSmrg
4299f00f3a1Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
4309f00f3a1Smrg# which is not the best choice for supporting other OS'es, but covers most
4319f00f3a1Smrg# of the ones we need for now.
4329f00f3a1SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
4339f00f3a1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
4349f00f3a1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4359f00f3a1Smrg	AC_MSG_RESULT([no])
4369f00f3a1Smrgelse
4379f00f3a1Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4389f00f3a1Smrg		RAWCPPFLAGS=-undef
4399f00f3a1Smrg		AC_MSG_RESULT([yes])
4409f00f3a1Smrg	# under Cygwin unix is still defined even with -undef
4419f00f3a1Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
4429f00f3a1Smrg		RAWCPPFLAGS="-undef -ansi"
4439f00f3a1Smrg		AC_MSG_RESULT([yes, with -ansi])
4449f00f3a1Smrg	else
4459f00f3a1Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
4469f00f3a1Smrg	fi
4479f00f3a1Smrgfi
4489f00f3a1Smrgrm -f conftest.$ac_ext
449a966c04fSmrg
4509f00f3a1SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
4519f00f3a1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
4529f00f3a1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
4539f00f3a1Smrg	AC_MSG_RESULT([no])
454a966c04fSmrgelse
4559f00f3a1Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
456edce3322Smrg		TRADITIONALCPPFLAGS="-traditional"
4579f00f3a1Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
4589f00f3a1Smrg		AC_MSG_RESULT([yes])
4599f00f3a1Smrg	else
4609f00f3a1Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
4619f00f3a1Smrg	fi
462a966c04fSmrgfi
4639f00f3a1Smrgrm -f conftest.$ac_ext
4649f00f3a1SmrgAC_SUBST(RAWCPPFLAGS)
465edce3322SmrgAC_SUBST(TRADITIONALCPPFLAGS)
4669f00f3a1Smrg]) # XORG_PROG_RAWCPP
467a966c04fSmrg
4689f00f3a1Smrg# XORG_MANPAGE_SECTIONS()
4699f00f3a1Smrg# -----------------------
4709f00f3a1Smrg# Minimum version: 1.0.0
4719f00f3a1Smrg#
4729f00f3a1Smrg# Determine which sections man pages go in for the different man page types
4739f00f3a1Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
4749f00f3a1Smrg# Not sure if there's any better way than just hardcoding by OS name.
4759f00f3a1Smrg# Override default settings by setting environment variables
4769f00f3a1Smrg# Added MAN_SUBSTS in version 1.8
4779f00f3a1Smrg# Added AC_PROG_SED in version 1.8
478a966c04fSmrg
4799f00f3a1SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
4809f00f3a1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
4819f00f3a1SmrgAC_REQUIRE([AC_PROG_SED])
482a966c04fSmrg
483edce3322Smrgcase $host_os in
484edce3322Smrg    solaris*)
485edce3322Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
486edce3322Smrg        # check for a man page file found in later versions that use
487edce3322Smrg        # traditional section numbers instead
488edce3322Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
489edce3322Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
490edce3322Smrg        ;;
491edce3322Smrg    *) SYSV_MAN_SECTIONS=false ;;
492edce3322Smrgesac
493edce3322Smrg
4949f00f3a1Smrgif test x$APP_MAN_SUFFIX = x    ; then
4959f00f3a1Smrg    APP_MAN_SUFFIX=1
4969f00f3a1Smrgfi
4979f00f3a1Smrgif test x$APP_MAN_DIR = x    ; then
4989f00f3a1Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
4999f00f3a1Smrgfi
500a966c04fSmrg
5019f00f3a1Smrgif test x$LIB_MAN_SUFFIX = x    ; then
5029f00f3a1Smrg    LIB_MAN_SUFFIX=3
5039f00f3a1Smrgfi
5049f00f3a1Smrgif test x$LIB_MAN_DIR = x    ; then
5059f00f3a1Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
506a966c04fSmrgfi
507a966c04fSmrg
5089f00f3a1Smrgif test x$FILE_MAN_SUFFIX = x    ; then
509edce3322Smrg    case $SYSV_MAN_SECTIONS in
510edce3322Smrg	true)				FILE_MAN_SUFFIX=4  ;;
511edce3322Smrg	*)				FILE_MAN_SUFFIX=5  ;;
5129f00f3a1Smrg    esac
5139f00f3a1Smrgfi
5149f00f3a1Smrgif test x$FILE_MAN_DIR = x    ; then
5159f00f3a1Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
5169f00f3a1Smrgfi
517a966c04fSmrg
5189f00f3a1Smrgif test x$MISC_MAN_SUFFIX = x    ; then
519edce3322Smrg    case $SYSV_MAN_SECTIONS in
520edce3322Smrg	true)				MISC_MAN_SUFFIX=5  ;;
521edce3322Smrg	*)				MISC_MAN_SUFFIX=7  ;;
5229f00f3a1Smrg    esac
5239f00f3a1Smrgfi
5249f00f3a1Smrgif test x$MISC_MAN_DIR = x    ; then
5259f00f3a1Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
5269f00f3a1Smrgfi
527a966c04fSmrg
5289f00f3a1Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
529edce3322Smrg    case $SYSV_MAN_SECTIONS in
530edce3322Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
531edce3322Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
5329f00f3a1Smrg    esac
5339f00f3a1Smrgfi
5349f00f3a1Smrgif test x$DRIVER_MAN_DIR = x    ; then
5359f00f3a1Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
5369f00f3a1Smrgfi
537a966c04fSmrg
5389f00f3a1Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
539edce3322Smrg    case $SYSV_MAN_SECTIONS in
540edce3322Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
541edce3322Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
5429f00f3a1Smrg    esac
5439f00f3a1Smrgfi
5449f00f3a1Smrgif test x$ADMIN_MAN_DIR = x    ; then
5459f00f3a1Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
5469f00f3a1Smrgfi
547a966c04fSmrg
548a966c04fSmrg
5499f00f3a1SmrgAC_SUBST([APP_MAN_SUFFIX])
5509f00f3a1SmrgAC_SUBST([LIB_MAN_SUFFIX])
5519f00f3a1SmrgAC_SUBST([FILE_MAN_SUFFIX])
5529f00f3a1SmrgAC_SUBST([MISC_MAN_SUFFIX])
5539f00f3a1SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
5549f00f3a1SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
5559f00f3a1SmrgAC_SUBST([APP_MAN_DIR])
5569f00f3a1SmrgAC_SUBST([LIB_MAN_DIR])
5579f00f3a1SmrgAC_SUBST([FILE_MAN_DIR])
5589f00f3a1SmrgAC_SUBST([MISC_MAN_DIR])
5599f00f3a1SmrgAC_SUBST([DRIVER_MAN_DIR])
5609f00f3a1SmrgAC_SUBST([ADMIN_MAN_DIR])
5619f00f3a1Smrg
5629f00f3a1SmrgXORG_MAN_PAGE="X Version 11"
5639f00f3a1SmrgAC_SUBST([XORG_MAN_PAGE])
5649f00f3a1SmrgMAN_SUBSTS="\
5659f00f3a1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5669f00f3a1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
5679f00f3a1Smrg	-e 's|__xservername__|Xorg|g' \
5689f00f3a1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
5699f00f3a1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
5709f00f3a1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
5719f00f3a1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
5729f00f3a1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
5739f00f3a1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
5749f00f3a1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
5759f00f3a1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
5769f00f3a1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
5779f00f3a1SmrgAC_SUBST([MAN_SUBSTS])
5789f00f3a1Smrg
5799f00f3a1Smrg]) # XORG_MANPAGE_SECTIONS
5809f00f3a1Smrg
5819f00f3a1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
5829f00f3a1Smrg# ------------------------
5839f00f3a1Smrg# Minimum version: 1.7.0
584a966c04fSmrg#
5859f00f3a1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
5869f00f3a1Smrg# provided by xorg-sgml-doctools, if installed.
5879f00f3a1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
5889f00f3a1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
5899f00f3a1SmrgXORG_SGML_PATH=
5909f00f3a1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
5919f00f3a1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
5929f00f3a1Smrg    [m4_ifval([$1],[:],
5939f00f3a1Smrg        [if test x"$cross_compiling" != x"yes" ; then
5949f00f3a1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
5959f00f3a1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
5969f00f3a1Smrg         fi])
5979f00f3a1Smrg    ])
598a966c04fSmrg
5999f00f3a1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
6009f00f3a1Smrg# the path and the name of the doc stylesheet
6019f00f3a1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
6029f00f3a1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
6039f00f3a1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
6049f00f3a1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
6059f00f3a1Smrgelse
6069f00f3a1Smrg   AC_MSG_RESULT([no])
6079f00f3a1Smrgfi
608a966c04fSmrg
6099f00f3a1SmrgAC_SUBST(XORG_SGML_PATH)
6109f00f3a1SmrgAC_SUBST(STYLESHEET_SRCDIR)
6119f00f3a1SmrgAC_SUBST(XSL_STYLESHEET)
6129f00f3a1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
6139f00f3a1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
6149f00f3a1Smrg
6159f00f3a1Smrg# XORG_CHECK_LINUXDOC
6169f00f3a1Smrg# -------------------
6179f00f3a1Smrg# Minimum version: 1.0.0
618a966c04fSmrg#
6199f00f3a1Smrg# Defines the variable MAKE_TEXT if the necessary tools and
6209f00f3a1Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
6219f00f3a1Smrg# Whether or not the necessary tools and files are found can be checked
6229f00f3a1Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
6239f00f3a1SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
6249f00f3a1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
6259f00f3a1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
626a966c04fSmrg
6279f00f3a1SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
628a966c04fSmrg
6299f00f3a1SmrgAC_MSG_CHECKING([whether to build documentation])
630ac92798bSmrg
6319f00f3a1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
6329f00f3a1Smrg   BUILDDOC=yes
6339f00f3a1Smrgelse
6349f00f3a1Smrg   BUILDDOC=no
635a966c04fSmrgfi
636a966c04fSmrg
6379f00f3a1SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
6389f00f3a1Smrg
6399f00f3a1SmrgAC_MSG_RESULT([$BUILDDOC])
6409f00f3a1Smrg
6419f00f3a1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
6429f00f3a1Smrg
6439f00f3a1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
6449f00f3a1Smrg   BUILDPDFDOC=yes
6459f00f3a1Smrgelse
6469f00f3a1Smrg   BUILDPDFDOC=no
647a966c04fSmrgfi
648a966c04fSmrg
6499f00f3a1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
650a966c04fSmrg
6519f00f3a1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
652a966c04fSmrg
6539f00f3a1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
6549f00f3a1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
6559f00f3a1SmrgMAKE_PDF="$PS2PDF"
6569f00f3a1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
657a966c04fSmrg
6589f00f3a1SmrgAC_SUBST(MAKE_TEXT)
6599f00f3a1SmrgAC_SUBST(MAKE_PS)
6609f00f3a1SmrgAC_SUBST(MAKE_PDF)
6619f00f3a1SmrgAC_SUBST(MAKE_HTML)
6629f00f3a1Smrg]) # XORG_CHECK_LINUXDOC
663ac92798bSmrg
6649f00f3a1Smrg# XORG_CHECK_DOCBOOK
6659f00f3a1Smrg# -------------------
6669f00f3a1Smrg# Minimum version: 1.0.0
6679f00f3a1Smrg#
6689f00f3a1Smrg# Checks for the ability to build output formats from SGML DocBook source.
6699f00f3a1Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
6709f00f3a1Smrg# indicates whether the necessary tools and files are found and, if set,
6719f00f3a1Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
6729f00f3a1SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
6739f00f3a1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
674ac92798bSmrg
6759f00f3a1SmrgBUILDTXTDOC=no
6769f00f3a1SmrgBUILDPDFDOC=no
6779f00f3a1SmrgBUILDPSDOC=no
6789f00f3a1SmrgBUILDHTMLDOC=no
679ac92798bSmrg
6809f00f3a1SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
6819f00f3a1SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
6829f00f3a1SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
6839f00f3a1SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
684ac92798bSmrg
6859f00f3a1SmrgAC_MSG_CHECKING([whether to build text documentation])
6869f00f3a1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
6879f00f3a1Smrg   test x$BUILD_TXTDOC != xno; then
6889f00f3a1Smrg	BUILDTXTDOC=yes
6899f00f3a1Smrgfi
6909f00f3a1SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
6919f00f3a1SmrgAC_MSG_RESULT([$BUILDTXTDOC])
692ac92798bSmrg
6939f00f3a1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
6949f00f3a1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
6959f00f3a1Smrg   test x$BUILD_PDFDOC != xno; then
6969f00f3a1Smrg	BUILDPDFDOC=yes
6979f00f3a1Smrgfi
6989f00f3a1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
6999f00f3a1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
700ac92798bSmrg
7019f00f3a1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
7029f00f3a1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
7039f00f3a1Smrg   test x$BUILD_PSDOC != xno; then
7049f00f3a1Smrg	BUILDPSDOC=yes
7059f00f3a1Smrgfi
7069f00f3a1SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
7079f00f3a1SmrgAC_MSG_RESULT([$BUILDPSDOC])
708ac92798bSmrg
7099f00f3a1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
7109f00f3a1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
7119f00f3a1Smrg   test x$BUILD_HTMLDOC != xno; then
7129f00f3a1Smrg	BUILDHTMLDOC=yes
7139f00f3a1Smrgfi
7149f00f3a1SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
7159f00f3a1SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
7162e2dd055Smrg
7179f00f3a1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
7189f00f3a1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
7199f00f3a1SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
7209f00f3a1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
721a966c04fSmrg
7229f00f3a1SmrgAC_SUBST(MAKE_TEXT)
7239f00f3a1SmrgAC_SUBST(MAKE_PS)
7249f00f3a1SmrgAC_SUBST(MAKE_PDF)
7259f00f3a1SmrgAC_SUBST(MAKE_HTML)
7269f00f3a1Smrg]) # XORG_CHECK_DOCBOOK
727a966c04fSmrg
7289f00f3a1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
7299f00f3a1Smrg# ----------------
7309f00f3a1Smrg# Minimum version: 1.5.0
7319f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
732a966c04fSmrg#
7339f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
7349f00f3a1Smrg# not at the appropriate level. This macro enables a module to test for the
7359f00f3a1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
7369f00f3a1Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
7379f00f3a1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
7389f00f3a1Smrg# --with-xmlto assumes 'auto'.
739a966c04fSmrg#
7409f00f3a1Smrg# Interface to module:
7419f00f3a1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
7429f00f3a1Smrg# XMLTO:	returns the path of the xmlto program found
7439f00f3a1Smrg#		returns the path set by the user in the environment
7449f00f3a1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
7459f00f3a1Smrg#		'no' user instructs the module not to use xmlto
7469f00f3a1Smrg#
7479f00f3a1Smrg# Added in version 1.10.0
7489f00f3a1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
7499f00f3a1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
7509f00f3a1Smrg#
7519f00f3a1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
7529f00f3a1Smrg#
7539f00f3a1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
7549f00f3a1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
7559f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
7569f00f3a1SmrgAC_ARG_WITH(xmlto,
7579f00f3a1Smrg	AS_HELP_STRING([--with-xmlto],
7589f00f3a1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
7599f00f3a1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
7609f00f3a1Smrgm4_undefine([_defopt])
761a966c04fSmrg
7629f00f3a1Smrgif test "x$use_xmlto" = x"auto"; then
7639f00f3a1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7649f00f3a1Smrg   if test "x$XMLTO" = "x"; then
7659f00f3a1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
7669f00f3a1Smrg	have_xmlto=no
7679f00f3a1Smrg   else
7689f00f3a1Smrg        have_xmlto=yes
7699f00f3a1Smrg   fi
7709f00f3a1Smrgelif test "x$use_xmlto" = x"yes" ; then
7719f00f3a1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
7729f00f3a1Smrg   if test "x$XMLTO" = "x"; then
7739f00f3a1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
7749f00f3a1Smrg   fi
7759f00f3a1Smrg   have_xmlto=yes
7769f00f3a1Smrgelif test "x$use_xmlto" = x"no" ; then
7779f00f3a1Smrg   if test "x$XMLTO" != "x"; then
7789f00f3a1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
7799f00f3a1Smrg   fi
7809f00f3a1Smrg   have_xmlto=no
781a966c04fSmrgelse
7829f00f3a1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
783a966c04fSmrgfi
784a966c04fSmrg
7859f00f3a1Smrg# Test for a minimum version of xmlto, if provided.
7869f00f3a1Smrgm4_ifval([$1],
7879f00f3a1Smrg[if test "$have_xmlto" = yes; then
7889f00f3a1Smrg    # scrape the xmlto version
7899f00f3a1Smrg    AC_MSG_CHECKING([the xmlto version])
7909f00f3a1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
7919f00f3a1Smrg    AC_MSG_RESULT([$xmlto_version])
7929f00f3a1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
7939f00f3a1Smrg        [if test "x$use_xmlto" = xauto; then
7949f00f3a1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
7959f00f3a1Smrg            have_xmlto=no
7969f00f3a1Smrg        else
7979f00f3a1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
7989f00f3a1Smrg        fi])
7999f00f3a1Smrgfi])
800a966c04fSmrg
8019f00f3a1Smrg# Test for the ability of xmlto to generate a text target
802edce3322Smrg#
803edce3322Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
804edce3322Smrg# following test for empty XML docbook files.
805edce3322Smrg# For compatibility reasons use the following empty XML docbook file and if
806edce3322Smrg# it fails try it again with a non-empty XML file.
8079f00f3a1Smrghave_xmlto_text=no
8089f00f3a1Smrgcat > conftest.xml << "EOF"
8099f00f3a1SmrgEOF
8109f00f3a1SmrgAS_IF([test "$have_xmlto" = yes],
8119f00f3a1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
8129f00f3a1Smrg             [have_xmlto_text=yes],
813edce3322Smrg             [# Try it again with a non-empty XML file.
814edce3322Smrg              cat > conftest.xml << "EOF"
815edce3322Smrg<x></x>
816edce3322SmrgEOF
817edce3322Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
818edce3322Smrg                    [have_xmlto_text=yes],
819edce3322Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
8209f00f3a1Smrgrm -f conftest.xml
8219f00f3a1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
8229f00f3a1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
8239f00f3a1Smrg]) # XORG_WITH_XMLTO
824a966c04fSmrg
8259f00f3a1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
8269f00f3a1Smrg# --------------------------------------------
8279f00f3a1Smrg# Minimum version: 1.12.0
8289f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
829a966c04fSmrg#
8309f00f3a1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
8319f00f3a1Smrg# XML-based language used for the transformation of XML documents.
8329f00f3a1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
8339f00f3a1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
8349f00f3a1Smrg# The XSLT processor is often used as a standalone tool for transformations.
8359f00f3a1Smrg# It should not be assumed that this tool is used only to work with documnetation.
8369f00f3a1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
8379f00f3a1Smrg#
8389f00f3a1Smrg# Interface to module:
8399f00f3a1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
8409f00f3a1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
8419f00f3a1Smrg#		 returns the path set by the user in the environment
8429f00f3a1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
8439f00f3a1Smrg#		  'no' user instructs the module not to use xsltproc
8449f00f3a1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
8459f00f3a1Smrg#
8469f00f3a1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
8479f00f3a1Smrg#
8489f00f3a1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
8499f00f3a1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
8509f00f3a1Smrg# Preserves the interface, should it be implemented later
8519f00f3a1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
8529f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
8539f00f3a1SmrgAC_ARG_WITH(xsltproc,
8549f00f3a1Smrg	AS_HELP_STRING([--with-xsltproc],
8559f00f3a1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
8569f00f3a1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
8579f00f3a1Smrgm4_undefine([_defopt])
858a966c04fSmrg
8599f00f3a1Smrgif test "x$use_xsltproc" = x"auto"; then
8609f00f3a1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8619f00f3a1Smrg   if test "x$XSLTPROC" = "x"; then
8629f00f3a1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
8639f00f3a1Smrg	have_xsltproc=no
8649f00f3a1Smrg   else
8659f00f3a1Smrg        have_xsltproc=yes
8669f00f3a1Smrg   fi
8679f00f3a1Smrgelif test "x$use_xsltproc" = x"yes" ; then
8689f00f3a1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
8699f00f3a1Smrg   if test "x$XSLTPROC" = "x"; then
8709f00f3a1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
8719f00f3a1Smrg   fi
8729f00f3a1Smrg   have_xsltproc=yes
8739f00f3a1Smrgelif test "x$use_xsltproc" = x"no" ; then
8749f00f3a1Smrg   if test "x$XSLTPROC" != "x"; then
8759f00f3a1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
8769f00f3a1Smrg   fi
8779f00f3a1Smrg   have_xsltproc=no
878a966c04fSmrgelse
8799f00f3a1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
880a966c04fSmrgfi
881a966c04fSmrg
8829f00f3a1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
8839f00f3a1Smrg]) # XORG_WITH_XSLTPROC
884a966c04fSmrg
8859f00f3a1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
8869f00f3a1Smrg# ----------------------------------------
8879f00f3a1Smrg# Minimum version: 1.15.0
888a966c04fSmrg#
8899f00f3a1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
8909f00f3a1Smrg# scanning arbitrary text files, extracting information from those text files,
8919f00f3a1Smrg# and printing reports based on that information.
8929f00f3a1Smrg#
8939f00f3a1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
8949f00f3a1Smrg#
8959f00f3a1Smrg# Interface to module:
8969f00f3a1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
8979f00f3a1Smrg# PERL:	     returns the path of the perl program found
8989f00f3a1Smrg#	     returns the path set by the user in the environment
8999f00f3a1Smrg# --with-perl: 'yes' user instructs the module to use perl
9009f00f3a1Smrg#	       'no' user instructs the module not to use perl
9019f00f3a1Smrg# have_perl: returns yes if perl found in PATH or no
9029f00f3a1Smrg#
9039f00f3a1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
9049f00f3a1Smrg#
9059f00f3a1SmrgAC_DEFUN([XORG_WITH_PERL],[
9069f00f3a1SmrgAC_ARG_VAR([PERL], [Path to perl command])
9079f00f3a1Smrg# Preserves the interface, should it be implemented later
9089f00f3a1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
9099f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
9109f00f3a1SmrgAC_ARG_WITH(perl,
9119f00f3a1Smrg	AS_HELP_STRING([--with-perl],
9129f00f3a1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
9139f00f3a1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
9149f00f3a1Smrgm4_undefine([_defopt])
915a966c04fSmrg
9169f00f3a1Smrgif test "x$use_perl" = x"auto"; then
9179f00f3a1Smrg   AC_PATH_PROG([PERL], [perl])
9189f00f3a1Smrg   if test "x$PERL" = "x"; then
9199f00f3a1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
9209f00f3a1Smrg	have_perl=no
9219f00f3a1Smrg   else
9229f00f3a1Smrg        have_perl=yes
9239f00f3a1Smrg   fi
9249f00f3a1Smrgelif test "x$use_perl" = x"yes" ; then
9259f00f3a1Smrg   AC_PATH_PROG([PERL], [perl])
9269f00f3a1Smrg   if test "x$PERL" = "x"; then
9279f00f3a1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
9289f00f3a1Smrg   fi
9299f00f3a1Smrg   have_perl=yes
9309f00f3a1Smrgelif test "x$use_perl" = x"no" ; then
9319f00f3a1Smrg   if test "x$PERL" != "x"; then
9329f00f3a1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
9339f00f3a1Smrg   fi
9349f00f3a1Smrg   have_perl=no
9359f00f3a1Smrgelse
9369f00f3a1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
9379f00f3a1Smrgfi
938a966c04fSmrg
9399f00f3a1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
9409f00f3a1Smrg]) # XORG_WITH_PERL
941a966c04fSmrg
9429f00f3a1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
9439f00f3a1Smrg# ----------------
9449f00f3a1Smrg# Minimum version: 1.5.0
9459f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
946ac92798bSmrg#
9479f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
9489f00f3a1Smrg# not at the appropriate level. This macro enables a module to test for the
9499f00f3a1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
9509f00f3a1Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
9519f00f3a1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
9529f00f3a1Smrg# --with-asciidoc assumes 'auto'.
953a966c04fSmrg#
9549f00f3a1Smrg# Interface to module:
9559f00f3a1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
9569f00f3a1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
9579f00f3a1Smrg#		 returns the path set by the user in the environment
9589f00f3a1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
9599f00f3a1Smrg#		  'no' user instructs the module not to use asciidoc
960ac92798bSmrg#
9619f00f3a1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
9629f00f3a1Smrg#
9639f00f3a1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
9649f00f3a1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
9659f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
9669f00f3a1SmrgAC_ARG_WITH(asciidoc,
9679f00f3a1Smrg	AS_HELP_STRING([--with-asciidoc],
9689f00f3a1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
9699f00f3a1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
9709f00f3a1Smrgm4_undefine([_defopt])
971a966c04fSmrg
9729f00f3a1Smrgif test "x$use_asciidoc" = x"auto"; then
9739f00f3a1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9749f00f3a1Smrg   if test "x$ASCIIDOC" = "x"; then
9759f00f3a1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
9769f00f3a1Smrg	have_asciidoc=no
9779f00f3a1Smrg   else
9789f00f3a1Smrg        have_asciidoc=yes
9799f00f3a1Smrg   fi
9809f00f3a1Smrgelif test "x$use_asciidoc" = x"yes" ; then
9819f00f3a1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
9829f00f3a1Smrg   if test "x$ASCIIDOC" = "x"; then
9839f00f3a1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
9849f00f3a1Smrg   fi
9859f00f3a1Smrg   have_asciidoc=yes
9869f00f3a1Smrgelif test "x$use_asciidoc" = x"no" ; then
9879f00f3a1Smrg   if test "x$ASCIIDOC" != "x"; then
9889f00f3a1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
9899f00f3a1Smrg   fi
9909f00f3a1Smrg   have_asciidoc=no
9919f00f3a1Smrgelse
9929f00f3a1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
9939f00f3a1Smrgfi
9949f00f3a1Smrgm4_ifval([$1],
9959f00f3a1Smrg[if test "$have_asciidoc" = yes; then
9969f00f3a1Smrg    # scrape the asciidoc version
9979f00f3a1Smrg    AC_MSG_CHECKING([the asciidoc version])
9989f00f3a1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
9999f00f3a1Smrg    AC_MSG_RESULT([$asciidoc_version])
10009f00f3a1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
10019f00f3a1Smrg        [if test "x$use_asciidoc" = xauto; then
10029f00f3a1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
10039f00f3a1Smrg            have_asciidoc=no
10049f00f3a1Smrg        else
10059f00f3a1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
10069f00f3a1Smrg        fi])
10079f00f3a1Smrgfi])
10089f00f3a1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
10099f00f3a1Smrg]) # XORG_WITH_ASCIIDOC
10102e2dd055Smrg
10119f00f3a1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1012edce3322Smrg# -------------------------------------------
10139f00f3a1Smrg# Minimum version: 1.5.0
10149f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1015edce3322Smrg# Minimum version for optional DOT checking: 1.18.0
10169f00f3a1Smrg#
10179f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
10189f00f3a1Smrg# not at the appropriate level. This macro enables a module to test for the
10199f00f3a1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
10209f00f3a1Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
10219f00f3a1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
10229f00f3a1Smrg# --with-doxygen assumes 'auto'.
10239f00f3a1Smrg#
10249f00f3a1Smrg# Interface to module:
10259f00f3a1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
10269f00f3a1Smrg# DOXYGEN:	 returns the path of the doxygen program found
10279f00f3a1Smrg#		 returns the path set by the user in the environment
10289f00f3a1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
10299f00f3a1Smrg#		  'no' user instructs the module not to use doxygen
10309f00f3a1Smrg#
10319f00f3a1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
10329f00f3a1Smrg#
10339f00f3a1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
10349f00f3a1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1035edce3322SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
10369f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
10379f00f3a1SmrgAC_ARG_WITH(doxygen,
10389f00f3a1Smrg	AS_HELP_STRING([--with-doxygen],
10399f00f3a1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
10409f00f3a1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
10419f00f3a1Smrgm4_undefine([_defopt])
1042ac92798bSmrg
10439f00f3a1Smrgif test "x$use_doxygen" = x"auto"; then
10449f00f3a1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10459f00f3a1Smrg   if test "x$DOXYGEN" = "x"; then
10469f00f3a1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
10479f00f3a1Smrg	have_doxygen=no
10489f00f3a1Smrg   else
10499f00f3a1Smrg        have_doxygen=yes
10509f00f3a1Smrg   fi
10519f00f3a1Smrgelif test "x$use_doxygen" = x"yes" ; then
10529f00f3a1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
10539f00f3a1Smrg   if test "x$DOXYGEN" = "x"; then
10549f00f3a1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
10559f00f3a1Smrg   fi
10569f00f3a1Smrg   have_doxygen=yes
10579f00f3a1Smrgelif test "x$use_doxygen" = x"no" ; then
10589f00f3a1Smrg   if test "x$DOXYGEN" != "x"; then
10599f00f3a1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
10609f00f3a1Smrg   fi
10619f00f3a1Smrg   have_doxygen=no
1062a966c04fSmrgelse
10639f00f3a1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1064ac92798bSmrgfi
10659f00f3a1Smrgm4_ifval([$1],
10669f00f3a1Smrg[if test "$have_doxygen" = yes; then
10679f00f3a1Smrg    # scrape the doxygen version
10689f00f3a1Smrg    AC_MSG_CHECKING([the doxygen version])
10699f00f3a1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
10709f00f3a1Smrg    AC_MSG_RESULT([$doxygen_version])
10719f00f3a1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
10729f00f3a1Smrg        [if test "x$use_doxygen" = xauto; then
10739f00f3a1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
10749f00f3a1Smrg            have_doxygen=no
10759f00f3a1Smrg        else
10769f00f3a1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
10779f00f3a1Smrg        fi])
10789f00f3a1Smrgfi])
1079edce3322Smrg
1080edce3322Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
1081edce3322Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
1082edce3322Smrgdnl 	HAVE_DOT = @HAVE_DOT@
1083edce3322SmrgHAVE_DOT=no
1084edce3322Smrgif test "x$have_doxygen" = "xyes"; then
1085edce3322Smrg  AC_PATH_PROG([DOT], [dot])
1086edce3322Smrg    if test "x$DOT" != "x"; then
1087edce3322Smrg      HAVE_DOT=yes
1088edce3322Smrg    fi
1089edce3322Smrgfi
1090edce3322Smrg
1091edce3322SmrgAC_SUBST([HAVE_DOT])
1092edce3322SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
10939f00f3a1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
10949f00f3a1Smrg]) # XORG_WITH_DOXYGEN
1095a966c04fSmrg
10969f00f3a1Smrg# XORG_WITH_GROFF([DEFAULT])
10979f00f3a1Smrg# ----------------
10989f00f3a1Smrg# Minimum version: 1.6.0
10999f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
11002e2dd055Smrg#
11019f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
11029f00f3a1Smrg# not at the appropriate level. This macro enables a module to test for the
11039f00f3a1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
11049f00f3a1Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
11059f00f3a1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
11069f00f3a1Smrg# --with-groff assumes 'auto'.
11079f00f3a1Smrg#
11089f00f3a1Smrg# Interface to module:
11099f00f3a1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
11109f00f3a1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
11119f00f3a1Smrg# HAVE_GROFF_MS: the -ms macros package
11129f00f3a1Smrg# GROFF:	 returns the path of the groff program found
11139f00f3a1Smrg#		 returns the path set by the user in the environment
11149f00f3a1Smrg# --with-groff:	 'yes' user instructs the module to use groff
11159f00f3a1Smrg#		 'no' user instructs the module not to use groff
11169f00f3a1Smrg#
11179f00f3a1Smrg# Added in version 1.9.0:
11189f00f3a1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
11199f00f3a1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
11209f00f3a1Smrg#		   psselect from the psutils package.
11219f00f3a1Smrg#		   the ghostcript package. Refer to the grohtml man pages
11229f00f3a1Smrg#
11239f00f3a1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
11249f00f3a1Smrg#
11259f00f3a1Smrg# OS and distros often splits groff in a basic and full package, the former
11269f00f3a1Smrg# having the groff program and the later having devices, fonts and macros
11279f00f3a1Smrg# Checking for the groff executable is not enough.
11289f00f3a1Smrg#
11299f00f3a1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
11309f00f3a1Smrg# unset HAVE_GROFF or GROFF env variables.
11319f00f3a1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
11329f00f3a1Smrg#
11339f00f3a1SmrgAC_DEFUN([XORG_WITH_GROFF],[
11349f00f3a1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
11359f00f3a1Smrgm4_define([_defopt], m4_default([$1], [auto]))
11369f00f3a1SmrgAC_ARG_WITH(groff,
11379f00f3a1Smrg	AS_HELP_STRING([--with-groff],
11389f00f3a1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
11399f00f3a1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
11409f00f3a1Smrgm4_undefine([_defopt])
11412e2dd055Smrg
11429f00f3a1Smrgif test "x$use_groff" = x"auto"; then
11439f00f3a1Smrg   AC_PATH_PROG([GROFF], [groff])
11449f00f3a1Smrg   if test "x$GROFF" = "x"; then
11459f00f3a1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
11469f00f3a1Smrg	have_groff=no
11479f00f3a1Smrg   else
11489f00f3a1Smrg        have_groff=yes
11499f00f3a1Smrg   fi
11509f00f3a1Smrgelif test "x$use_groff" = x"yes" ; then
11519f00f3a1Smrg   AC_PATH_PROG([GROFF], [groff])
11529f00f3a1Smrg   if test "x$GROFF" = "x"; then
11539f00f3a1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
11549f00f3a1Smrg   fi
11559f00f3a1Smrg   have_groff=yes
11569f00f3a1Smrgelif test "x$use_groff" = x"no" ; then
11579f00f3a1Smrg   if test "x$GROFF" != "x"; then
11589f00f3a1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
11599f00f3a1Smrg   fi
11609f00f3a1Smrg   have_groff=no
1161ac92798bSmrgelse
11629f00f3a1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1163ac92798bSmrgfi
1164a966c04fSmrg
11659f00f3a1Smrg# We have groff, test for the presence of the macro packages
11669f00f3a1Smrgif test "x$have_groff" = x"yes"; then
11679f00f3a1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
11689f00f3a1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
11699f00f3a1Smrg        groff_ms_works=yes
11709f00f3a1Smrg    else
11719f00f3a1Smrg        groff_ms_works=no
11729f00f3a1Smrg    fi
11739f00f3a1Smrg    AC_MSG_RESULT([$groff_ms_works])
11749f00f3a1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
11759f00f3a1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
11769f00f3a1Smrg        groff_mm_works=yes
11779f00f3a1Smrg    else
11789f00f3a1Smrg        groff_mm_works=no
11799f00f3a1Smrg    fi
11809f00f3a1Smrg    AC_MSG_RESULT([$groff_mm_works])
1181a966c04fSmrgfi
1182a966c04fSmrg
11839f00f3a1Smrg# We have groff, test for HTML dependencies, one command per package
11849f00f3a1Smrgif test "x$have_groff" = x"yes"; then
11859f00f3a1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
11869f00f3a1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
11879f00f3a1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
11889f00f3a1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
11899f00f3a1Smrg      have_groff_html=yes
11909f00f3a1Smrg   else
11919f00f3a1Smrg      have_groff_html=no
11929f00f3a1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
11939f00f3a1Smrg   fi
11949f00f3a1Smrgfi
11952e2dd055Smrg
11969f00f3a1Smrg# Set Automake conditionals for Makefiles
11979f00f3a1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
11989f00f3a1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
11999f00f3a1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
12009f00f3a1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
12019f00f3a1Smrg]) # XORG_WITH_GROFF
1202a966c04fSmrg
12039f00f3a1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
12049f00f3a1Smrg# ---------------------------------------
12059f00f3a1Smrg# Minimum version: 1.6.0
12069f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
12079f00f3a1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1208a966c04fSmrg#
12099f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
12109f00f3a1Smrg# not at the appropriate level. This macro enables a module to test for the
12119f00f3a1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
12129f00f3a1Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
12139f00f3a1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
12149f00f3a1Smrg# --with-fop assumes 'auto'.
1215a966c04fSmrg#
12169f00f3a1Smrg# Interface to module:
12179f00f3a1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
12189f00f3a1Smrg# FOP:	 	returns the path of the fop program found
12199f00f3a1Smrg#		returns the path set by the user in the environment
12209f00f3a1Smrg# --with-fop: 	'yes' user instructs the module to use fop
12219f00f3a1Smrg#		'no' user instructs the module not to use fop
1222a966c04fSmrg#
12239f00f3a1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1224a966c04fSmrg#
12259f00f3a1SmrgAC_DEFUN([XORG_WITH_FOP],[
12269f00f3a1SmrgAC_ARG_VAR([FOP], [Path to fop command])
12279f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
12289f00f3a1SmrgAC_ARG_WITH(fop,
12299f00f3a1Smrg	AS_HELP_STRING([--with-fop],
12309f00f3a1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
12319f00f3a1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
12329f00f3a1Smrgm4_undefine([_defopt])
1233ac92798bSmrg
12349f00f3a1Smrgif test "x$use_fop" = x"auto"; then
12359f00f3a1Smrg   AC_PATH_PROG([FOP], [fop])
12369f00f3a1Smrg   if test "x$FOP" = "x"; then
12379f00f3a1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
12389f00f3a1Smrg	have_fop=no
12399f00f3a1Smrg   else
12409f00f3a1Smrg        have_fop=yes
12419f00f3a1Smrg   fi
12429f00f3a1Smrgelif test "x$use_fop" = x"yes" ; then
12439f00f3a1Smrg   AC_PATH_PROG([FOP], [fop])
12449f00f3a1Smrg   if test "x$FOP" = "x"; then
12459f00f3a1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
12469f00f3a1Smrg   fi
12479f00f3a1Smrg   have_fop=yes
12489f00f3a1Smrgelif test "x$use_fop" = x"no" ; then
12499f00f3a1Smrg   if test "x$FOP" != "x"; then
12509f00f3a1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
12519f00f3a1Smrg   fi
12529f00f3a1Smrg   have_fop=no
12539f00f3a1Smrgelse
12549f00f3a1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
12559f00f3a1Smrgfi
1256ac92798bSmrg
12579f00f3a1Smrg# Test for a minimum version of fop, if provided.
12589f00f3a1Smrgm4_ifval([$1],
12599f00f3a1Smrg[if test "$have_fop" = yes; then
12609f00f3a1Smrg    # scrape the fop version
12619f00f3a1Smrg    AC_MSG_CHECKING([for fop minimum version])
12629f00f3a1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
12639f00f3a1Smrg    AC_MSG_RESULT([$fop_version])
12649f00f3a1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
12659f00f3a1Smrg        [if test "x$use_fop" = xauto; then
12669f00f3a1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
12679f00f3a1Smrg            have_fop=no
12689f00f3a1Smrg        else
12699f00f3a1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
12709f00f3a1Smrg        fi])
12719f00f3a1Smrgfi])
12729f00f3a1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
12739f00f3a1Smrg]) # XORG_WITH_FOP
1274a966c04fSmrg
1275edce3322Smrg# XORG_WITH_M4([MIN-VERSION])
1276edce3322Smrg# ---------------------------
1277edce3322Smrg# Minimum version: 1.19.0
1278edce3322Smrg#
1279edce3322Smrg# This macro attempts to locate an m4 macro processor which supports
1280edce3322Smrg# -I option and is only useful for modules relying on M4 in order to
1281edce3322Smrg# expand macros in source code files.
1282edce3322Smrg#
1283edce3322Smrg# Interface to module:
1284edce3322Smrg# M4:	 	returns the path of the m4 program found
1285edce3322Smrg#		returns the path set by the user in the environment
1286edce3322Smrg#
1287edce3322SmrgAC_DEFUN([XORG_WITH_M4], [
1288edce3322SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
1289edce3322Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
1290edce3322Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
1291edce3322Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
1292edce3322Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
1293edce3322Smrg   [$PATH:/usr/gnu/bin])])
1294edce3322Smrg
1295edce3322SmrgAC_SUBST([M4], [$ac_cv_path_M4])
1296edce3322Smrg]) # XORG_WITH_M4
1297edce3322Smrg
12989f00f3a1Smrg# XORG_WITH_PS2PDF([DEFAULT])
12999f00f3a1Smrg# ----------------
13009f00f3a1Smrg# Minimum version: 1.6.0
13019f00f3a1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13029f00f3a1Smrg#
13039f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
13049f00f3a1Smrg# not at the appropriate level. This macro enables a module to test for the
13059f00f3a1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
13069f00f3a1Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
13079f00f3a1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
13089f00f3a1Smrg# --with-ps2pdf assumes 'auto'.
13099f00f3a1Smrg#
13109f00f3a1Smrg# Interface to module:
13119f00f3a1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
13129f00f3a1Smrg# PS2PDF:	returns the path of the ps2pdf program found
13139f00f3a1Smrg#		returns the path set by the user in the environment
13149f00f3a1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
13159f00f3a1Smrg#		 'no' user instructs the module not to use ps2pdf
13169f00f3a1Smrg#
13179f00f3a1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
13189f00f3a1Smrg#
13199f00f3a1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
13209f00f3a1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
13219f00f3a1Smrgm4_define([_defopt], m4_default([$1], [auto]))
13229f00f3a1SmrgAC_ARG_WITH(ps2pdf,
13239f00f3a1Smrg	AS_HELP_STRING([--with-ps2pdf],
13249f00f3a1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
13259f00f3a1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
13269f00f3a1Smrgm4_undefine([_defopt])
1327a966c04fSmrg
13289f00f3a1Smrgif test "x$use_ps2pdf" = x"auto"; then
13299f00f3a1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13309f00f3a1Smrg   if test "x$PS2PDF" = "x"; then
13319f00f3a1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
13329f00f3a1Smrg	have_ps2pdf=no
13339f00f3a1Smrg   else
13349f00f3a1Smrg        have_ps2pdf=yes
13359f00f3a1Smrg   fi
13369f00f3a1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
13379f00f3a1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
13389f00f3a1Smrg   if test "x$PS2PDF" = "x"; then
13399f00f3a1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
13409f00f3a1Smrg   fi
13419f00f3a1Smrg   have_ps2pdf=yes
13429f00f3a1Smrgelif test "x$use_ps2pdf" = x"no" ; then
13439f00f3a1Smrg   if test "x$PS2PDF" != "x"; then
13449f00f3a1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
13459f00f3a1Smrg   fi
13469f00f3a1Smrg   have_ps2pdf=no
13479f00f3a1Smrgelse
13489f00f3a1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
13499f00f3a1Smrgfi
13509f00f3a1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
13519f00f3a1Smrg]) # XORG_WITH_PS2PDF
1352a966c04fSmrg
13539f00f3a1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
13549f00f3a1Smrg# ----------------
13559f00f3a1Smrg# Minimum version: 1.6.0
135697cf2ee2Smrg#
13579f00f3a1Smrg# Documentation tools are not always available on all platforms and sometimes
13589f00f3a1Smrg# not at the appropriate level. This macro enables a builder to skip all
13599f00f3a1Smrg# documentation targets except traditional man pages.
13609f00f3a1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13619f00f3a1Smrg# maximum flexibilty in controlling documentation building.
13629f00f3a1Smrg# Refer to:
13639f00f3a1Smrg# XORG_WITH_XMLTO         --with-xmlto
13649f00f3a1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13659f00f3a1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13669f00f3a1Smrg# XORG_WITH_FOP           --with-fop
13679f00f3a1Smrg# XORG_WITH_GROFF         --with-groff
13689f00f3a1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
13699f00f3a1Smrg#
13709f00f3a1Smrg# Interface to module:
13719f00f3a1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
13729f00f3a1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
13739f00f3a1Smrg#		 'no' user instructs the module not to generate docs
13749f00f3a1Smrg# parm1:	specify the default value, yes or no.
137597cf2ee2Smrg#
13769f00f3a1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
13779f00f3a1Smrgm4_define([docs_default], m4_default([$1], [yes]))
13789f00f3a1SmrgAC_ARG_ENABLE(docs,
13799f00f3a1Smrg	AS_HELP_STRING([--enable-docs],
13809f00f3a1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
13819f00f3a1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
13829f00f3a1Smrgm4_undefine([docs_default])
13839f00f3a1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
13849f00f3a1SmrgAC_MSG_CHECKING([whether to build documentation])
13859f00f3a1SmrgAC_MSG_RESULT([$build_docs])
13869f00f3a1Smrg]) # XORG_ENABLE_DOCS
1387a966c04fSmrg
13889f00f3a1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
13899f00f3a1Smrg# ----------------
13909f00f3a1Smrg# Minimum version: 1.6.0
139197cf2ee2Smrg#
13929f00f3a1Smrg# This macro enables a builder to skip all developer documentation.
13939f00f3a1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
13949f00f3a1Smrg# maximum flexibilty in controlling documentation building.
13959f00f3a1Smrg# Refer to:
13969f00f3a1Smrg# XORG_WITH_XMLTO         --with-xmlto
13979f00f3a1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
13989f00f3a1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
13999f00f3a1Smrg# XORG_WITH_FOP           --with-fop
14009f00f3a1Smrg# XORG_WITH_GROFF         --with-groff
14019f00f3a1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
140297cf2ee2Smrg#
14039f00f3a1Smrg# Interface to module:
14049f00f3a1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
14059f00f3a1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
14069f00f3a1Smrg#			'no' user instructs the module not to generate developer docs
14079f00f3a1Smrg# parm1:		specify the default value, yes or no.
140897cf2ee2Smrg#
14099f00f3a1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
14109f00f3a1Smrgm4_define([devel_default], m4_default([$1], [yes]))
14119f00f3a1SmrgAC_ARG_ENABLE(devel-docs,
14129f00f3a1Smrg	AS_HELP_STRING([--enable-devel-docs],
14139f00f3a1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
14149f00f3a1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
14159f00f3a1Smrgm4_undefine([devel_default])
14169f00f3a1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
14179f00f3a1SmrgAC_MSG_CHECKING([whether to build developer documentation])
14189f00f3a1SmrgAC_MSG_RESULT([$build_devel_docs])
14199f00f3a1Smrg]) # XORG_ENABLE_DEVEL_DOCS
14209f00f3a1Smrg
14219f00f3a1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
14229f00f3a1Smrg# ----------------
14239f00f3a1Smrg# Minimum version: 1.6.0
142497cf2ee2Smrg#
14259f00f3a1Smrg# This macro enables a builder to skip all functional specification targets.
14269f00f3a1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
14279f00f3a1Smrg# maximum flexibilty in controlling documentation building.
14289f00f3a1Smrg# Refer to:
14299f00f3a1Smrg# XORG_WITH_XMLTO         --with-xmlto
14309f00f3a1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
14319f00f3a1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
14329f00f3a1Smrg# XORG_WITH_FOP           --with-fop
14339f00f3a1Smrg# XORG_WITH_GROFF         --with-groff
14349f00f3a1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
143597cf2ee2Smrg#
14369f00f3a1Smrg# Interface to module:
14379f00f3a1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
14389f00f3a1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
14399f00f3a1Smrg#			'no' user instructs the module not to generate specs
14409f00f3a1Smrg# parm1:		specify the default value, yes or no.
14419f00f3a1Smrg#
14429f00f3a1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
14439f00f3a1Smrgm4_define([spec_default], m4_default([$1], [yes]))
14449f00f3a1SmrgAC_ARG_ENABLE(specs,
14459f00f3a1Smrg	AS_HELP_STRING([--enable-specs],
14469f00f3a1Smrg	   [Enable building the specs (default: ]spec_default[)]),
14479f00f3a1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
14489f00f3a1Smrgm4_undefine([spec_default])
14499f00f3a1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
14509f00f3a1SmrgAC_MSG_CHECKING([whether to build functional specifications])
14519f00f3a1SmrgAC_MSG_RESULT([$build_specs])
14529f00f3a1Smrg]) # XORG_ENABLE_SPECS
1453a966c04fSmrg
14549f00f3a1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
14559f00f3a1Smrg# ----------------------------------------------
14569f00f3a1Smrg# Minimum version: 1.13.0
14579f00f3a1Smrg#
14589f00f3a1Smrg# This macro enables a builder to enable/disable unit testing
14599f00f3a1Smrg# It makes no assumption about the test cases implementation
14609f00f3a1Smrg# Test cases may or may not use Automake "Support for test suites"
14619f00f3a1Smrg# They may or may not use the software utility library GLib
14629f00f3a1Smrg#
14639f00f3a1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
14649f00f3a1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
14659f00f3a1Smrg# The variable enable_unit_tests is used by other macros in this file.
14669f00f3a1Smrg#
14679f00f3a1Smrg# Interface to module:
14689f00f3a1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
14699f00f3a1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
14709f00f3a1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
14719f00f3a1Smrg#			'no' user instructs the module not to build tests
14729f00f3a1Smrg# parm1:		specify the default value, yes or no.
14739f00f3a1Smrg#
14749f00f3a1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
14759f00f3a1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
14769f00f3a1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
14779f00f3a1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
14789f00f3a1Smrgm4_define([_defopt], m4_default([$1], [auto]))
14799f00f3a1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
14809f00f3a1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
14819f00f3a1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
14829f00f3a1Smrgm4_undefine([_defopt])
14839f00f3a1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
14849f00f3a1SmrgAC_MSG_CHECKING([whether to build unit test cases])
14859f00f3a1SmrgAC_MSG_RESULT([$enable_unit_tests])
14869f00f3a1Smrg]) # XORG_ENABLE_UNIT_TESTS
1487a966c04fSmrg
14889f00f3a1Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
14899f00f3a1Smrg# ------------------------------------------------------
14909f00f3a1Smrg# Minimum version: 1.17.0
14919f00f3a1Smrg#
14929f00f3a1Smrg# This macro enables a builder to enable/disable integration testing
14939f00f3a1Smrg# It makes no assumption about the test cases' implementation
14949f00f3a1Smrg# Test cases may or may not use Automake "Support for test suites"
14959f00f3a1Smrg#
14969f00f3a1Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
14979f00f3a1Smrg# usually requires less dependencies and may be built and run under less
14989f00f3a1Smrg# stringent environments than integration tests.
14999f00f3a1Smrg#
15009f00f3a1Smrg# Interface to module:
15019f00f3a1Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
15029f00f3a1Smrg# enable_integration_tests:   used in configure.ac for additional configuration
15039f00f3a1Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
15049f00f3a1Smrg#                             'no' user instructs the module not to build tests
15059f00f3a1Smrg# parm1:                      specify the default value, yes or no.
15069f00f3a1Smrg#
15079f00f3a1SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
15089f00f3a1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
15099f00f3a1Smrgm4_define([_defopt], m4_default([$1], [auto]))
15109f00f3a1SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
15119f00f3a1Smrg	[Enable building integration test cases (default: ]_defopt[)]),
15129f00f3a1Smrg	[enable_integration_tests=$enableval],
15139f00f3a1Smrg	[enable_integration_tests=]_defopt)
15149f00f3a1Smrgm4_undefine([_defopt])
15159f00f3a1SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
15169f00f3a1Smrg	[test "x$enable_integration_tests" != xno])
15179f00f3a1SmrgAC_MSG_CHECKING([whether to build unit test cases])
15189f00f3a1SmrgAC_MSG_RESULT([$enable_integration_tests])
15199f00f3a1Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
15206e7d3316Smrg
15219f00f3a1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
15229f00f3a1Smrg# ----------------------------------------
15239f00f3a1Smrg# Minimum version: 1.13.0
15249f00f3a1Smrg#
15259f00f3a1Smrg# GLib is a library which provides advanced data structures and functions.
15269f00f3a1Smrg# This macro enables a module to test for the presence of Glib.
15279f00f3a1Smrg#
15289f00f3a1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
15299f00f3a1Smrg# Otherwise the value of $enable_unit_tests is blank.
15309f00f3a1Smrg#
15319f00f3a1Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
15329f00f3a1Smrg# test support usually requires less dependencies and may be built and run under
15339f00f3a1Smrg# less stringent environments than integration tests.
15349f00f3a1Smrg#
15359f00f3a1Smrg# Interface to module:
15369f00f3a1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
15379f00f3a1Smrg# with_glib: used in configure.ac to know if GLib has been found
15389f00f3a1Smrg# --with-glib:	'yes' user instructs the module to use glib
15399f00f3a1Smrg#		'no' user instructs the module not to use glib
15409f00f3a1Smrg#
15419f00f3a1SmrgAC_DEFUN([XORG_WITH_GLIB],[
15429f00f3a1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
15439f00f3a1Smrgm4_define([_defopt], m4_default([$2], [auto]))
15449f00f3a1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
15459f00f3a1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
15469f00f3a1Smrg	[with_glib=$withval], [with_glib=]_defopt)
15479f00f3a1Smrgm4_undefine([_defopt])
15486e7d3316Smrg
15499f00f3a1Smrghave_glib=no
15509f00f3a1Smrg# Do not probe GLib if user explicitly disabled unit testing
15519f00f3a1Smrgif test "x$enable_unit_tests" != x"no"; then
15529f00f3a1Smrg  # Do not probe GLib if user explicitly disabled it
15539f00f3a1Smrg  if test "x$with_glib" != x"no"; then
15549f00f3a1Smrg    m4_ifval(
15559f00f3a1Smrg      [$1],
15569f00f3a1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
15579f00f3a1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
15589f00f3a1Smrg    )
15599f00f3a1Smrg  fi
15606e7d3316Smrgfi
15616e7d3316Smrg
15629f00f3a1Smrg# Not having GLib when unit testing has been explicitly requested is an error
15639f00f3a1Smrgif test "x$enable_unit_tests" = x"yes"; then
15649f00f3a1Smrg  if test "x$have_glib" = x"no"; then
15659f00f3a1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
156697cf2ee2Smrg  fi
15679f00f3a1Smrgfi
15686e7d3316Smrg
15699f00f3a1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
15709f00f3a1Smrgif test "x$enable_unit_tests" = x"no"; then
15719f00f3a1Smrg  if test "x$with_glib" = x"yes"; then
15729f00f3a1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
157397cf2ee2Smrg  fi
15749f00f3a1Smrgfi
15756e7d3316Smrg
15769f00f3a1Smrg# Not having GLib when it has been explicitly requested is an error
15779f00f3a1Smrgif test "x$with_glib" = x"yes"; then
15789f00f3a1Smrg  if test "x$have_glib" = x"no"; then
15799f00f3a1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
15809f00f3a1Smrg  fi
15819f00f3a1Smrgfi
15826e7d3316Smrg
15839f00f3a1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
15849f00f3a1Smrg]) # XORG_WITH_GLIB
15856e7d3316Smrg
15869f00f3a1Smrg# XORG_LD_WRAP([required|optional])
15879f00f3a1Smrg# ---------------------------------
15889f00f3a1Smrg# Minimum version: 1.13.0
158997cf2ee2Smrg#
15909f00f3a1Smrg# Check if linker supports -wrap, passed via compiler flags
15919f00f3a1Smrg#
15929f00f3a1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
15939f00f3a1Smrg# Otherwise the value of $enable_unit_tests is blank.
15949f00f3a1Smrg#
15959f00f3a1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
15969f00f3a1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
15979f00f3a1Smrg# available, an argument of "optional" allows use when some unit tests require
15989f00f3a1Smrg# ld -wrap and others do not.
15999f00f3a1Smrg#
16009f00f3a1SmrgAC_DEFUN([XORG_LD_WRAP],[
16019f00f3a1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
16029f00f3a1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
16039f00f3a1Smrg                      void __wrap_exit(int status) { return; }],
16049f00f3a1Smrg                     [exit(0);])])
16059f00f3a1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
16069f00f3a1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
16079f00f3a1Smrg  if test "x$have_ld_wrap" = x"no"; then
16089f00f3a1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
16099f00f3a1Smrg  fi
16109f00f3a1Smrgfi
16119f00f3a1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
16129f00f3a1Smrg#
16139f00f3a1Smrg]) # XORG_LD_WRAP
16146e7d3316Smrg
16159f00f3a1Smrg# XORG_CHECK_LINKER_FLAGS
161697cf2ee2Smrg# -----------------------
16179f00f3a1Smrg# SYNOPSIS
16189f00f3a1Smrg#
16199f00f3a1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
16209f00f3a1Smrg#
16219f00f3a1Smrg# DESCRIPTION
16229f00f3a1Smrg#
16239f00f3a1Smrg#   Check whether the given linker FLAGS work with the current language's
16249f00f3a1Smrg#   linker, or whether they give an error.
16259f00f3a1Smrg#
16269f00f3a1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
16279f00f3a1Smrg#   success/failure.
16289f00f3a1Smrg#
16299f00f3a1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
16309f00f3a1Smrg#
16319f00f3a1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
16329f00f3a1Smrg#
16339f00f3a1Smrg# LICENSE
16349f00f3a1Smrg#
16359f00f3a1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
16369f00f3a1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
16379f00f3a1Smrg#   Copyright (c) 2009 Matteo Frigo
16389f00f3a1Smrg#
16399f00f3a1Smrg#   This program is free software: you can redistribute it and/or modify it
16409f00f3a1Smrg#   under the terms of the GNU General Public License as published by the
16419f00f3a1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
16429f00f3a1Smrg#   option) any later version.
16439f00f3a1Smrg#
16449f00f3a1Smrg#   This program is distributed in the hope that it will be useful, but
16459f00f3a1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
16469f00f3a1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16479f00f3a1Smrg#   Public License for more details.
16489f00f3a1Smrg#
16499f00f3a1Smrg#   You should have received a copy of the GNU General Public License along
16509f00f3a1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
16519f00f3a1Smrg#
16529f00f3a1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
16539f00f3a1Smrg#   gives unlimited permission to copy, distribute and modify the configure
16549f00f3a1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
16559f00f3a1Smrg#   need not follow the terms of the GNU General Public License when using
16569f00f3a1Smrg#   or distributing such scripts, even though portions of the text of the
16579f00f3a1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
16589f00f3a1Smrg#   all other use of the material that constitutes the Autoconf Macro.
16599f00f3a1Smrg#
16609f00f3a1Smrg#   This special exception to the GPL applies to versions of the Autoconf
16619f00f3a1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
16629f00f3a1Smrg#   modified version of the Autoconf Macro, you may extend this special
16639f00f3a1Smrg#   exception to the GPL to apply to your modified version as well.#
16649f00f3a1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
16659f00f3a1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
16669f00f3a1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
16679f00f3a1SmrgAS_LITERAL_IF([$1],
16689f00f3a1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
16699f00f3a1Smrg      ax_save_FLAGS=$LDFLAGS
16709f00f3a1Smrg      LDFLAGS="$1"
16719f00f3a1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
16729f00f3a1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16739f00f3a1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16749f00f3a1Smrg      LDFLAGS=$ax_save_FLAGS])],
16759f00f3a1Smrg  [ax_save_FLAGS=$LDFLAGS
16769f00f3a1Smrg   LDFLAGS="$1"
16779f00f3a1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
16789f00f3a1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
16799f00f3a1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
16809f00f3a1Smrg   LDFLAGS=$ax_save_FLAGS])
16819f00f3a1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
16829f00f3a1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
16839f00f3a1Smrgif test "x$xorg_check_linker_flags" = xyes; then
16849f00f3a1Smrg	m4_default([$2], :)
16859f00f3a1Smrgelse
16869f00f3a1Smrg	m4_default([$3], :)
16879f00f3a1Smrgfi
16889f00f3a1Smrg]) # XORG_CHECK_LINKER_FLAGS
16896e7d3316Smrg
16909f00f3a1Smrg# XORG_MEMORY_CHECK_FLAGS
16919f00f3a1Smrg# -----------------------
16929f00f3a1Smrg# Minimum version: 1.16.0
16939f00f3a1Smrg#
16949f00f3a1Smrg# This macro attempts to find appropriate memory checking functionality
16959f00f3a1Smrg# for various platforms which unit testing code may use to catch various
16969f00f3a1Smrg# forms of memory allocation and access errors in testing.
16979f00f3a1Smrg#
16989f00f3a1Smrg# Interface to module:
16999f00f3a1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
17009f00f3a1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
17019f00f3a1Smrg#
17029f00f3a1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
17039f00f3a1Smrg#
17049f00f3a1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
17056e7d3316Smrg
17069f00f3a1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
17079f00f3a1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
17089f00f3a1Smrg           [Environment variables to enable memory checking in tests])
1709a966c04fSmrg
17109f00f3a1Smrg# Check for different types of support on different platforms
17119f00f3a1Smrgcase $host_os in
17129f00f3a1Smrg    solaris*)
17139f00f3a1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
17149f00f3a1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
17159f00f3a1Smrg        ;;
17169f00f3a1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
17179f00f3a1Smrg        # both directly and inverted, so should not be 0 or 255.
17189f00f3a1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
17199f00f3a1Smrg        ;;
17209f00f3a1Smrg    darwin*)
17219f00f3a1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
17229f00f3a1Smrg        ;;
17239f00f3a1Smrg    *bsd*)
17249f00f3a1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
17259f00f3a1Smrg        ;;
17269f00f3a1Smrgesac
1727a966c04fSmrg
17289f00f3a1Smrg# User supplied flags override default flags
17299f00f3a1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
17309f00f3a1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
173197cf2ee2Smrgfi
17326e7d3316Smrg
17339f00f3a1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
17349f00f3a1Smrg]) # XORG_WITH_LINT
1735a966c04fSmrg
17369f00f3a1Smrg# XORG_CHECK_MALLOC_ZERO
17379f00f3a1Smrg# ----------------------
17389f00f3a1Smrg# Minimum version: 1.0.0
17399f00f3a1Smrg#
17409f00f3a1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
17419f00f3a1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
17429f00f3a1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
17439f00f3a1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
17449f00f3a1SmrgAC_ARG_ENABLE(malloc0returnsnull,
17459f00f3a1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
17469f00f3a1Smrg		       [malloc(0) returns NULL (default: auto)]),
17479f00f3a1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
17489f00f3a1Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1749a966c04fSmrg
17509f00f3a1SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
17519f00f3a1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1752edce3322SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
1753edce3322Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
17549f00f3a1Smrg#include <stdlib.h>
17559f00f3a1Smrg],[
17569f00f3a1Smrg    char *m0, *r0, *c0, *p;
17579f00f3a1Smrg    m0 = malloc(0);
17589f00f3a1Smrg    p = malloc(10);
17599f00f3a1Smrg    r0 = realloc(p,0);
17609f00f3a1Smrg    c0 = calloc(0,10);
17619f00f3a1Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
17629f00f3a1Smrg])],
1763edce3322Smrg		[xorg_cv_malloc0_returns_null=yes],
1764edce3322Smrg		[xorg_cv_malloc0_returns_null=no])])
1765edce3322SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
1766ac92798bSmrgfi
17679f00f3a1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
17689f00f3a1Smrg
17699f00f3a1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
17709f00f3a1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
17719f00f3a1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
17729f00f3a1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
17739f00f3a1Smrgelse
17749f00f3a1Smrg	MALLOC_ZERO_CFLAGS=""
17759f00f3a1Smrg	XMALLOC_ZERO_CFLAGS=""
17769f00f3a1Smrg	XTMALLOC_ZERO_CFLAGS=""
1777ac92798bSmrgfi
1778ac92798bSmrg
17799f00f3a1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
17809f00f3a1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
17819f00f3a1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
17829f00f3a1Smrg]) # XORG_CHECK_MALLOC_ZERO
1783ac92798bSmrg
17849f00f3a1Smrg# XORG_WITH_LINT()
178597cf2ee2Smrg# ----------------
17869f00f3a1Smrg# Minimum version: 1.1.0
17879f00f3a1Smrg#
17889f00f3a1Smrg# This macro enables the use of a tool that flags some suspicious and
17899f00f3a1Smrg# non-portable constructs (likely to be bugs) in C language source code.
17909f00f3a1Smrg# It will attempt to locate the tool and use appropriate options.
17919f00f3a1Smrg# There are various lint type tools on different platforms.
17929f00f3a1Smrg#
17939f00f3a1Smrg# Interface to module:
17949f00f3a1Smrg# LINT:		returns the path to the tool found on the platform
17959f00f3a1Smrg#		or the value set to LINT on the configure cmd line
17969f00f3a1Smrg#		also an Automake conditional
17979f00f3a1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
17989f00f3a1Smrg#
17999f00f3a1Smrg# --with-lint:	'yes' user instructs the module to use lint
18009f00f3a1Smrg#		'no' user instructs the module not to use lint (default)
18019f00f3a1Smrg#
18029f00f3a1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
18039f00f3a1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
18049f00f3a1Smrg#
18059f00f3a1SmrgAC_DEFUN([XORG_WITH_LINT],[
18066e7d3316Smrg
18079f00f3a1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
18089f00f3a1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
18099f00f3a1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
18109f00f3a1Smrg		[Use a lint-style source code checker (default: disabled)])],
18119f00f3a1Smrg		[use_lint=$withval], [use_lint=no])
18126e7d3316Smrg
18139f00f3a1Smrg# Obtain platform specific info like program name and options
18149f00f3a1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
18159f00f3a1Smrgcase $host_os in
18169f00f3a1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
18179f00f3a1Smrg	lint_name=splint
18189f00f3a1Smrg	lint_options="-badflag"
18199f00f3a1Smrg	;;
18209f00f3a1Smrg  *freebsd* | *netbsd*)
18219f00f3a1Smrg	lint_name=lint
18229f00f3a1Smrg	lint_options="-u -b"
18239f00f3a1Smrg	;;
18249f00f3a1Smrg  *solaris*)
18259f00f3a1Smrg	lint_name=lint
18269f00f3a1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
18279f00f3a1Smrg	;;
18289f00f3a1Smrgesac
18296e7d3316Smrg
18309f00f3a1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
18319f00f3a1Smrgif test "x$use_lint" = x"yes" ; then
18329f00f3a1Smrg   AC_PATH_PROG([LINT], [$lint_name])
18339f00f3a1Smrg   if test "x$LINT" = "x"; then
18349f00f3a1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
18359f00f3a1Smrg   fi
18369f00f3a1Smrgelif test "x$use_lint" = x"no" ; then
18379f00f3a1Smrg   if test "x$LINT" != "x"; then
18389f00f3a1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
18399f00f3a1Smrg   fi
18409f00f3a1Smrgelse
18419f00f3a1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
18429f00f3a1Smrgfi
18436e7d3316Smrg
18449f00f3a1Smrg# User supplied flags override default flags
18459f00f3a1Smrgif test "x$LINT_FLAGS" != "x"; then
18469f00f3a1Smrg   lint_options=$LINT_FLAGS
18479f00f3a1Smrgfi
18486e7d3316Smrg
18499f00f3a1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
18509f00f3a1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
18516e7d3316Smrg
18529f00f3a1Smrg]) # XORG_WITH_LINT
18536e7d3316Smrg
18549f00f3a1Smrg# XORG_LINT_LIBRARY(LIBNAME)
18559f00f3a1Smrg# --------------------------
18569f00f3a1Smrg# Minimum version: 1.1.0
18579f00f3a1Smrg#
18589f00f3a1Smrg# Sets up flags for building lint libraries for checking programs that call
18599f00f3a1Smrg# functions in the library.
18609f00f3a1Smrg#
18619f00f3a1Smrg# Interface to module:
18629f00f3a1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
18639f00f3a1Smrg# MAKE_LINT_LIB		- Automake conditional
18649f00f3a1Smrg#
18659f00f3a1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
18669f00f3a1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
18676e7d3316Smrg
18689f00f3a1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
18699f00f3a1SmrgAC_REQUIRE([XORG_WITH_LINT])
18709f00f3a1SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
18719f00f3a1Smrg	[Create lint library (default: disabled)])],
18729f00f3a1Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
18736e7d3316Smrg
18749f00f3a1Smrgif test "x$make_lint_lib" = x"yes" ; then
18759f00f3a1Smrg   LINTLIB=llib-l$1.ln
18769f00f3a1Smrg   if test "x$LINT" = "x"; then
18779f00f3a1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
18789f00f3a1Smrg   fi
18799f00f3a1Smrgelif test "x$make_lint_lib" != x"no" ; then
18809f00f3a1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
188197cf2ee2Smrgfi
18826e7d3316Smrg
18839f00f3a1SmrgAC_SUBST(LINTLIB)
18849f00f3a1SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
18859f00f3a1Smrg
18869f00f3a1Smrg]) # XORG_LINT_LIBRARY
18876e7d3316Smrg
18889f00f3a1Smrg# XORG_COMPILER_BRAND
18896e7d3316Smrg# -------------------
18909f00f3a1Smrg# Minimum version: 1.14.0
18919f00f3a1Smrg#
18929f00f3a1Smrg# Checks for various brands of compilers and sets flags as appropriate:
18939f00f3a1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
18949f00f3a1Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
18959f00f3a1Smrg#   clang compiler - sets CLANGCC to "yes"
18969f00f3a1Smrg#   Intel compiler - sets INTELCC to "yes"
18979f00f3a1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
18989f00f3a1Smrg#
18999f00f3a1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
19009f00f3a1SmrgAC_LANG_CASE(
19019f00f3a1Smrg	[C], [
19029f00f3a1Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19039f00f3a1Smrg	],
19049f00f3a1Smrg	[C++], [
19059f00f3a1Smrg		AC_REQUIRE([AC_PROG_CXX])
19069f00f3a1Smrg	]
19079f00f3a1Smrg)
19089f00f3a1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
19099f00f3a1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
19109f00f3a1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
19119f00f3a1Smrg]) # XORG_COMPILER_BRAND
19126e7d3316Smrg
19139f00f3a1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
19149f00f3a1Smrg# ---------------
19159f00f3a1Smrg# Minimum version: 1.16.0
19169f00f3a1Smrg#
19179f00f3a1Smrg# Test if the compiler works when passed the given flag as a command line argument.
19189f00f3a1Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
19199f00f3a1Smrg# next flag in the list until there are no more options.
19209f00f3a1Smrg#
19219f00f3a1Smrg# Note that this does not guarantee that the compiler supports the flag as some
19229f00f3a1Smrg# compilers will simply ignore arguments that they do not understand, but we do
19239f00f3a1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
19249f00f3a1Smrg# -Werror=unused-command-line-argument
19259f00f3a1Smrg#
19269f00f3a1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
19279f00f3a1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19289f00f3a1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
19296e7d3316Smrg
19309f00f3a1SmrgAC_LANG_COMPILER_REQUIRE
19316e7d3316Smrg
19329f00f3a1SmrgAC_LANG_CASE(
19339f00f3a1Smrg	[C], [
19349f00f3a1Smrg		AC_REQUIRE([AC_PROG_CC_C99])
19359f00f3a1Smrg		define([PREFIX], [C])
19369f00f3a1Smrg		define([CACHE_PREFIX], [cc])
19379f00f3a1Smrg		define([COMPILER], [$CC])
19389f00f3a1Smrg	],
19399f00f3a1Smrg	[C++], [
19409f00f3a1Smrg		define([PREFIX], [CXX])
19419f00f3a1Smrg		define([CACHE_PREFIX], [cxx])
19429f00f3a1Smrg		define([COMPILER], [$CXX])
19439f00f3a1Smrg	]
19449f00f3a1Smrg)
19456e7d3316Smrg
19469f00f3a1Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
19476e7d3316Smrg
19489f00f3a1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
19499f00f3a1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19509f00f3a1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
19519f00f3a1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
19529f00f3a1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19539f00f3a1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
19549f00f3a1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
19559f00f3a1Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
19569f00f3a1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19579f00f3a1Smrgfi
19586e7d3316Smrg
19599f00f3a1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
19609f00f3a1Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
19619f00f3a1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19629f00f3a1Smrg	fi
19639f00f3a1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19649f00f3a1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
19659f00f3a1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
19669f00f3a1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
19679f00f3a1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
19689f00f3a1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
19699f00f3a1Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
19709f00f3a1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19719f00f3a1Smrgfi
19726e7d3316Smrg
19739f00f3a1Smrgfound="no"
19749f00f3a1Smrgm4_foreach([flag], m4_cdr($@), [
19759f00f3a1Smrg	if test $found = "no" ; then
1976edce3322Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
19779f00f3a1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
19789f00f3a1Smrg		fi
19796e7d3316Smrg
1980edce3322Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
19819f00f3a1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
19829f00f3a1Smrg		fi
19836e7d3316Smrg
19849f00f3a1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
19856e7d3316Smrg
19869f00f3a1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
1987edce3322Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
19889f00f3a1Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
19899f00f3a1Smrg		AC_CACHE_VAL($cacheid,
19909f00f3a1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
19919f00f3a1Smrg					     [eval $cacheid=yes],
19929f00f3a1Smrg					     [eval $cacheid=no])])
19936e7d3316Smrg
19949f00f3a1Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
19956e7d3316Smrg
19969f00f3a1Smrg		eval supported=\$$cacheid
19979f00f3a1Smrg		AC_MSG_RESULT([$supported])
19989f00f3a1Smrg		if test "$supported" = "yes" ; then
19999f00f3a1Smrg			$1="$$1 ]flag["
20009f00f3a1Smrg			found="yes"
20019f00f3a1Smrg		fi
200297cf2ee2Smrg	fi
20039f00f3a1Smrg])
20049f00f3a1Smrg]) # XORG_TESTSET_CFLAG
20056e7d3316Smrg
20069f00f3a1Smrg# XORG_COMPILER_FLAGS
20079f00f3a1Smrg# ---------------
20089f00f3a1Smrg# Minimum version: 1.16.0
20099f00f3a1Smrg#
20109f00f3a1Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
20119f00f3a1Smrg# arguments supported by the selected compiler which do NOT alter the generated
20129f00f3a1Smrg# code.  These arguments will cause the compiler to print various warnings
20139f00f3a1Smrg# during compilation AND turn a conservative set of warnings into errors.
20149f00f3a1Smrg#
20159f00f3a1Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
20169f00f3a1Smrg# future versions of util-macros as options are added to new compilers.
20179f00f3a1Smrg#
20189f00f3a1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
20199f00f3a1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
20209f00f3a1Smrg
20219f00f3a1SmrgAC_ARG_ENABLE(selective-werror,
20229f00f3a1Smrg              AS_HELP_STRING([--disable-selective-werror],
20239f00f3a1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
20249f00f3a1Smrg              [SELECTIVE_WERROR=$enableval],
20259f00f3a1Smrg              [SELECTIVE_WERROR=yes])
20266e7d3316Smrg
20279f00f3a1SmrgAC_LANG_CASE(
20289f00f3a1Smrg        [C], [
20299f00f3a1Smrg                define([PREFIX], [C])
20309f00f3a1Smrg        ],
20319f00f3a1Smrg        [C++], [
20329f00f3a1Smrg                define([PREFIX], [CXX])
20339f00f3a1Smrg        ]
20349f00f3a1Smrg)
20359f00f3a1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
20369f00f3a1Smrgif test "x$SUNCC" = "xyes"; then
20379f00f3a1Smrg    [BASE_]PREFIX[FLAGS]="-v"
203897cf2ee2Smrgelse
20399f00f3a1Smrg    [BASE_]PREFIX[FLAGS]=""
20406e7d3316Smrgfi
20416e7d3316Smrg
20429f00f3a1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
20439f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
20449f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
20459f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
20469f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
20476e7d3316Smrg
20489f00f3a1SmrgAC_LANG_CASE(
20499f00f3a1Smrg	[C], [
20509f00f3a1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
20519f00f3a1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
20529f00f3a1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
20539f00f3a1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2054edce3322Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
20559f00f3a1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
20569f00f3a1Smrg	]
20579f00f3a1Smrg)
20586e7d3316Smrg
20599f00f3a1Smrg# This chunk adds additional warnings that could catch undesired effects.
20609f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
20619f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
20629f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
20639f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
20649f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
20659f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2066edce3322SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
20676e7d3316Smrg
20689f00f3a1Smrg# These are currently disabled because they are noisy.  They will be enabled
20699f00f3a1Smrg# in the future once the codebase is sufficiently modernized to silence
20709f00f3a1Smrg# them.  For now, I don't want them to drown out the other warnings.
20719f00f3a1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
20729f00f3a1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2073edce3322Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
20746e7d3316Smrg
20759f00f3a1Smrg# Turn some warnings into errors, so we don't accidently get successful builds
20769f00f3a1Smrg# when there are problems that should be fixed.
20776e7d3316Smrg
20789f00f3a1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
20799f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
20809f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
20819f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
20829f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
20839f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
20849f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
20859f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
20869f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
20879f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
20889f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
20899f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
20909f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
20919f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
209297cf2ee2Smrgelse
20939f00f3a1SmrgAC_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])
20949f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
20959f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
20969f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
20979f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
20989f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
20999f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
21009f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
21019f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
21029f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
21039f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
21049f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
21059f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
21069f00f3a1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
210797cf2ee2Smrgfi
21086e7d3316Smrg
21099f00f3a1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21109f00f3a1Smrg]) # XORG_COMPILER_FLAGS
2111a966c04fSmrg
21129f00f3a1Smrg# XORG_CWARNFLAGS
21139f00f3a1Smrg# ---------------
21149f00f3a1Smrg# Minimum version: 1.2.0
21159f00f3a1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
21169f00f3a1Smrg#
21179f00f3a1Smrg# Defines CWARNFLAGS to enable C compiler warnings.
21189f00f3a1Smrg#
21199f00f3a1Smrg# This function is deprecated because it defines -fno-strict-aliasing
21209f00f3a1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
21219f00f3a1Smrg# is needed, then it should be added explicitly in the module when
21229f00f3a1Smrg# it is updated to use BASE_CFLAGS.
21239f00f3a1Smrg#
21249f00f3a1SmrgAC_DEFUN([XORG_CWARNFLAGS], [
21259f00f3a1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
21269f00f3a1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
21279f00f3a1SmrgAC_LANG_CASE(
21289f00f3a1Smrg	[C], [
21299f00f3a1Smrg		CWARNFLAGS="$BASE_CFLAGS"
21309f00f3a1Smrg		if  test "x$GCC" = xyes ; then
21319f00f3a1Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
21329f00f3a1Smrg		fi
21339f00f3a1Smrg		AC_SUBST(CWARNFLAGS)
21349f00f3a1Smrg	]
21359f00f3a1Smrg)
21369f00f3a1Smrg]) # XORG_CWARNFLAGS
2137a966c04fSmrg
21389f00f3a1Smrg# XORG_STRICT_OPTION
21399f00f3a1Smrg# -----------------------
21409f00f3a1Smrg# Minimum version: 1.3.0
21419f00f3a1Smrg#
21429f00f3a1Smrg# Add configure option to enable strict compilation flags, such as treating
21439f00f3a1Smrg# warnings as fatal errors.
21449f00f3a1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
21459f00f3a1Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
21469f00f3a1Smrg#
21479f00f3a1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
21489f00f3a1Smrg# when strict compilation is unconditionally desired.
21499f00f3a1SmrgAC_DEFUN([XORG_STRICT_OPTION], [
21509f00f3a1SmrgAC_REQUIRE([XORG_CWARNFLAGS])
21519f00f3a1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
215297cf2ee2Smrg
21539f00f3a1SmrgAC_ARG_ENABLE(strict-compilation,
21549f00f3a1Smrg			  AS_HELP_STRING([--enable-strict-compilation],
21559f00f3a1Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
21569f00f3a1Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2157a966c04fSmrg
21589f00f3a1SmrgAC_LANG_CASE(
21599f00f3a1Smrg        [C], [
21609f00f3a1Smrg                define([PREFIX], [C])
21619f00f3a1Smrg        ],
21629f00f3a1Smrg        [C++], [
21639f00f3a1Smrg                define([PREFIX], [CXX])
21649f00f3a1Smrg        ]
21659f00f3a1Smrg)
2166a966c04fSmrg
21679f00f3a1Smrg[STRICT_]PREFIX[FLAGS]=""
21689f00f3a1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
21699f00f3a1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2170a966c04fSmrg
21719f00f3a1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
21729f00f3a1Smrg# activate it with -Werror, so we add it here explicitly.
21739f00f3a1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
21746e7d3316Smrg
21759f00f3a1Smrgif test "x$STRICT_COMPILE" = "xyes"; then
21769f00f3a1Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
21779f00f3a1Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2178a966c04fSmrgfi
21799f00f3a1SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
21809f00f3a1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
21819f00f3a1SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
21829f00f3a1Smrg]) # XORG_STRICT_OPTION
2183a966c04fSmrg
21849f00f3a1Smrg# XORG_DEFAULT_OPTIONS
21859f00f3a1Smrg# --------------------
21869f00f3a1Smrg# Minimum version: 1.3.0
21879f00f3a1Smrg#
21889f00f3a1Smrg# Defines default options for X.Org modules.
21899f00f3a1Smrg#
21909f00f3a1SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
21919f00f3a1SmrgAC_REQUIRE([AC_PROG_INSTALL])
21929f00f3a1SmrgXORG_COMPILER_FLAGS
21939f00f3a1SmrgXORG_CWARNFLAGS
21949f00f3a1SmrgXORG_STRICT_OPTION
21959f00f3a1SmrgXORG_RELEASE_VERSION
21969f00f3a1SmrgXORG_CHANGELOG
21979f00f3a1SmrgXORG_INSTALL
21989f00f3a1SmrgXORG_MANPAGE_SECTIONS
21999f00f3a1Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
22009f00f3a1Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
22019f00f3a1Smrg]) # XORG_DEFAULT_OPTIONS
2202a966c04fSmrg
22039f00f3a1Smrg# XORG_INSTALL()
22049f00f3a1Smrg# ----------------
22059f00f3a1Smrg# Minimum version: 1.4.0
22069f00f3a1Smrg#
22079f00f3a1Smrg# Defines the variable INSTALL_CMD as the command to copy
22089f00f3a1Smrg# INSTALL from $prefix/share/util-macros.
22099f00f3a1Smrg#
22109f00f3a1SmrgAC_DEFUN([XORG_INSTALL], [
22119f00f3a1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22129f00f3a1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
22139f00f3a1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
22149f00f3a1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2215edce3322Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
2216edce3322Smrgtouch \$(top_srcdir)/INSTALL; \
2217edce3322Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
22189f00f3a1SmrgAC_SUBST([INSTALL_CMD])
22199f00f3a1Smrg]) # XORG_INSTALL
22209f00f3a1Smrgdnl Copyright 2005 Red Hat, Inc
22219f00f3a1Smrgdnl
22229f00f3a1Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
22239f00f3a1Smrgdnl documentation for any purpose is hereby granted without fee, provided that
22249f00f3a1Smrgdnl the above copyright notice appear in all copies and that both that
22259f00f3a1Smrgdnl copyright notice and this permission notice appear in supporting
22269f00f3a1Smrgdnl documentation.
22279f00f3a1Smrgdnl
22289f00f3a1Smrgdnl The above copyright notice and this permission notice shall be included
22299f00f3a1Smrgdnl in all copies or substantial portions of the Software.
22309f00f3a1Smrgdnl
22319f00f3a1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22329f00f3a1Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22339f00f3a1Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22349f00f3a1Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
22359f00f3a1Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22369f00f3a1Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22379f00f3a1Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
22389f00f3a1Smrgdnl
22399f00f3a1Smrgdnl Except as contained in this notice, the name of the copyright holders shall
22409f00f3a1Smrgdnl not be used in advertising or otherwise to promote the sale, use or
22419f00f3a1Smrgdnl other dealings in this Software without prior written authorization
22429f00f3a1Smrgdnl from the copyright holders.
22439f00f3a1Smrgdnl
2244a966c04fSmrg
22459f00f3a1Smrg# XORG_RELEASE_VERSION
22469f00f3a1Smrg# --------------------
22479f00f3a1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2248edce3322Smrg
22499f00f3a1SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
22509f00f3a1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
22519f00f3a1Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
22529f00f3a1Smrg		[Major version of this package])
22539f00f3a1Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
22549f00f3a1Smrg	if test "x$PVM" = "x"; then
22559f00f3a1Smrg		PVM="0"
22569f00f3a1Smrg	fi
22579f00f3a1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
22589f00f3a1Smrg		[$PVM],
22599f00f3a1Smrg		[Minor version of this package])
22609f00f3a1Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
22619f00f3a1Smrg	if test "x$PVP" = "x"; then
22629f00f3a1Smrg		PVP="0"
22639f00f3a1Smrg	fi
22649f00f3a1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
22659f00f3a1Smrg		[$PVP],
22669f00f3a1Smrg		[Patch version of this package])
2267a966c04fSmrg])
22686e7d3316Smrg
22699f00f3a1Smrg# XORG_CHANGELOG()
227097cf2ee2Smrg# ----------------
22719f00f3a1Smrg# Minimum version: 1.2.0
22729f00f3a1Smrg#
22739f00f3a1Smrg# Defines the variable CHANGELOG_CMD as the command to generate
22749f00f3a1Smrg# ChangeLog from git.
22759f00f3a1Smrg#
22769f00f3a1Smrg#
22779f00f3a1SmrgAC_DEFUN([XORG_CHANGELOG], [
2278edce3322SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
22799f00f3a1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2280edce3322Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
2281edce3322Smrgtouch \$(top_srcdir)/ChangeLog; \
2282edce3322Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
22839f00f3a1SmrgAC_SUBST([CHANGELOG_CMD])
22849f00f3a1Smrg]) # XORG_CHANGELOG
2285a966c04fSmrg
2286edce3322Smrg# Copyright (C) 2002-2018 Free Software Foundation, Inc.
22879f00f3a1Smrg#
22889f00f3a1Smrg# This file is free software; the Free Software Foundation
22899f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
22909f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2291a966c04fSmrg
22929f00f3a1Smrg# AM_AUTOMAKE_VERSION(VERSION)
22939f00f3a1Smrg# ----------------------------
22949f00f3a1Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
22959f00f3a1Smrg# generated from the m4 files accompanying Automake X.Y.
22969f00f3a1Smrg# (This private macro should not be called outside this file.)
22979f00f3a1SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2298edce3322Smrg[am__api_version='1.16'
22999f00f3a1Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
23009f00f3a1Smrgdnl require some minimum version.  Point them to the right macro.
2301edce3322Smrgm4_if([$1], [1.16.1], [],
23029f00f3a1Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
23039f00f3a1Smrg])
230497cf2ee2Smrg
23059f00f3a1Smrg# _AM_AUTOCONF_VERSION(VERSION)
230697cf2ee2Smrg# -----------------------------
23079f00f3a1Smrg# aclocal traces this macro to find the Autoconf version.
23089f00f3a1Smrg# This is a private macro too.  Using m4_define simplifies
23099f00f3a1Smrg# the logic in aclocal, which can simply ignore this definition.
23109f00f3a1Smrgm4_define([_AM_AUTOCONF_VERSION], [])
2311a966c04fSmrg
23129f00f3a1Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
23139f00f3a1Smrg# -------------------------------
23149f00f3a1Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
23159f00f3a1Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
23169f00f3a1SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2317edce3322Smrg[AM_AUTOMAKE_VERSION([1.16.1])dnl
23189f00f3a1Smrgm4_ifndef([AC_AUTOCONF_VERSION],
23199f00f3a1Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
23209f00f3a1Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2321a966c04fSmrg
23229f00f3a1Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2323a966c04fSmrg
2324edce3322Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
23259f00f3a1Smrg#
23269f00f3a1Smrg# This file is free software; the Free Software Foundation
23279f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
23289f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2329a966c04fSmrg
23309f00f3a1Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23319f00f3a1Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
23329f00f3a1Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
23339f00f3a1Smrg#
23349f00f3a1Smrg# Of course, Automake must honor this variable whenever it calls a
23359f00f3a1Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
23369f00f3a1Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
23379f00f3a1Smrg# depending on how configure is run.  This is pretty annoying, since
23389f00f3a1Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
23399f00f3a1Smrg# source directory, any form will work fine, but in subdirectories a
23409f00f3a1Smrg# relative path needs to be adjusted first.
23419f00f3a1Smrg#
23429f00f3a1Smrg# $ac_aux_dir/missing
23439f00f3a1Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
23449f00f3a1Smrg# $top_srcdir/$ac_aux_dir/missing
23459f00f3a1Smrg#    fails if $ac_aux_dir is absolute,
23469f00f3a1Smrg#    fails when called from a subdirectory in a VPATH build with
23479f00f3a1Smrg#          a relative $ac_aux_dir
23489f00f3a1Smrg#
23499f00f3a1Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
23509f00f3a1Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
23519f00f3a1Smrg# harmless because $srcdir is '.', but things will broke when you
23529f00f3a1Smrg# start a VPATH build or use an absolute $srcdir.
23539f00f3a1Smrg#
23549f00f3a1Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
23559f00f3a1Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
23569f00f3a1Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
23579f00f3a1Smrg# and then we would define $MISSING as
23589f00f3a1Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
23599f00f3a1Smrg# This will work as long as MISSING is not called from configure, because
23609f00f3a1Smrg# unfortunately $(top_srcdir) has no meaning in configure.
23619f00f3a1Smrg# However there are other variables, like CC, which are often used in
23629f00f3a1Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
23639f00f3a1Smrg#
23649f00f3a1Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
23659f00f3a1Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
23669f00f3a1Smrg# configured tree to be moved without reconfiguration.
2367a966c04fSmrg
23689f00f3a1SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
2369edce3322Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
2370edce3322Smrg# Expand $ac_aux_dir to an absolute path.
2371edce3322Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
23729f00f3a1Smrg])
2373a966c04fSmrg
23749f00f3a1Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2375a966c04fSmrg
2376edce3322Smrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
23779f00f3a1Smrg#
23789f00f3a1Smrg# This file is free software; the Free Software Foundation
23799f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
23809f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2381a966c04fSmrg
23829f00f3a1Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
23839f00f3a1Smrg# -------------------------------------
23849f00f3a1Smrg# Define a conditional.
23859f00f3a1SmrgAC_DEFUN([AM_CONDITIONAL],
23869f00f3a1Smrg[AC_PREREQ([2.52])dnl
23879f00f3a1Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
23889f00f3a1Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
23899f00f3a1SmrgAC_SUBST([$1_TRUE])dnl
23909f00f3a1SmrgAC_SUBST([$1_FALSE])dnl
23919f00f3a1Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
23929f00f3a1Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
23939f00f3a1Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
23949f00f3a1Smrgif $2; then
23959f00f3a1Smrg  $1_TRUE=
23969f00f3a1Smrg  $1_FALSE='#'
23979f00f3a1Smrgelse
23989f00f3a1Smrg  $1_TRUE='#'
23999f00f3a1Smrg  $1_FALSE=
24009f00f3a1Smrgfi
24019f00f3a1SmrgAC_CONFIG_COMMANDS_PRE(
24029f00f3a1Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
24039f00f3a1Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
24049f00f3a1SmrgUsually this means the macro was only invoked conditionally.]])
24059f00f3a1Smrgfi])])
2406a966c04fSmrg
2407edce3322Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
24089f00f3a1Smrg#
24099f00f3a1Smrg# This file is free software; the Free Software Foundation
24109f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
24119f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2412a966c04fSmrg
2413a966c04fSmrg
24149f00f3a1Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
24159f00f3a1Smrg# written in clear, in which case automake, when reading aclocal.m4,
24169f00f3a1Smrg# will think it sees a *use*, and therefore will trigger all it's
24179f00f3a1Smrg# C support machinery.  Also note that it means that autoscan, seeing
24189f00f3a1Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2419a966c04fSmrg
24206e7d3316Smrg
24219f00f3a1Smrg# _AM_DEPENDENCIES(NAME)
24229f00f3a1Smrg# ----------------------
24239f00f3a1Smrg# See how the compiler implements dependency checking.
24249f00f3a1Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
24259f00f3a1Smrg# We try a few techniques and use that to set a single cache variable.
24269f00f3a1Smrg#
24279f00f3a1Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
24289f00f3a1Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
24299f00f3a1Smrg# dependency, and given that the user is not expected to run this macro,
24309f00f3a1Smrg# just rely on AC_PROG_CC.
24319f00f3a1SmrgAC_DEFUN([_AM_DEPENDENCIES],
24329f00f3a1Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
24339f00f3a1SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
24349f00f3a1SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
24359f00f3a1SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2436a966c04fSmrg
24379f00f3a1Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
24389f00f3a1Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
24399f00f3a1Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
24409f00f3a1Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
24419f00f3a1Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
24429f00f3a1Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
24439f00f3a1Smrg                    [depcc="$$1"   am_compiler_list=])
2444a966c04fSmrg
24459f00f3a1SmrgAC_CACHE_CHECK([dependency style of $depcc],
24469f00f3a1Smrg               [am_cv_$1_dependencies_compiler_type],
24479f00f3a1Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
24489f00f3a1Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
24499f00f3a1Smrg  # making bogus files that we don't know about and never remove.  For
24509f00f3a1Smrg  # instance it was reported that on HP-UX the gcc test will end up
24519f00f3a1Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
24529f00f3a1Smrg  # in D".
24539f00f3a1Smrg  rm -rf conftest.dir
24549f00f3a1Smrg  mkdir conftest.dir
24559f00f3a1Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
24569f00f3a1Smrg  # using a relative directory.
24579f00f3a1Smrg  cp "$am_depcomp" conftest.dir
24589f00f3a1Smrg  cd conftest.dir
24599f00f3a1Smrg  # We will build objects and dependencies in a subdirectory because
24609f00f3a1Smrg  # it helps to detect inapplicable dependency modes.  For instance
24619f00f3a1Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
24629f00f3a1Smrg  # side effect of compilation, but ICC will put the dependencies in
24639f00f3a1Smrg  # the current directory while Tru64 will put them in the object
24649f00f3a1Smrg  # directory.
24659f00f3a1Smrg  mkdir sub
2466a966c04fSmrg
24679f00f3a1Smrg  am_cv_$1_dependencies_compiler_type=none
24689f00f3a1Smrg  if test "$am_compiler_list" = ""; then
24699f00f3a1Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2470a966c04fSmrg  fi
24719f00f3a1Smrg  am__universal=false
24729f00f3a1Smrg  m4_case([$1], [CC],
24739f00f3a1Smrg    [case " $depcc " in #(
24749f00f3a1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24759f00f3a1Smrg     esac],
24769f00f3a1Smrg    [CXX],
24779f00f3a1Smrg    [case " $depcc " in #(
24789f00f3a1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
24799f00f3a1Smrg     esac])
2480a966c04fSmrg
24819f00f3a1Smrg  for depmode in $am_compiler_list; do
24829f00f3a1Smrg    # Setup a source with many dependencies, because some compilers
24839f00f3a1Smrg    # like to wrap large dependency lists on column 80 (with \), and
24849f00f3a1Smrg    # we should not choose a depcomp mode which is confused by this.
24859f00f3a1Smrg    #
24869f00f3a1Smrg    # We need to recreate these files for each test, as the compiler may
24879f00f3a1Smrg    # overwrite some of them when testing with obscure command lines.
24889f00f3a1Smrg    # This happens at least with the AIX C compiler.
24899f00f3a1Smrg    : > sub/conftest.c
24909f00f3a1Smrg    for i in 1 2 3 4 5 6; do
24919f00f3a1Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
24929f00f3a1Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
24939f00f3a1Smrg      # Solaris 10 /bin/sh.
24949f00f3a1Smrg      echo '/* dummy */' > sub/conftst$i.h
24959f00f3a1Smrg    done
24969f00f3a1Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
249797cf2ee2Smrg
24989f00f3a1Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
24999f00f3a1Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
25009f00f3a1Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
25019f00f3a1Smrg    # versions had trouble with output in subdirs.
25029f00f3a1Smrg    am__obj=sub/conftest.${OBJEXT-o}
25039f00f3a1Smrg    am__minus_obj="-o $am__obj"
25049f00f3a1Smrg    case $depmode in
25059f00f3a1Smrg    gcc)
25069f00f3a1Smrg      # This depmode causes a compiler race in universal mode.
25079f00f3a1Smrg      test "$am__universal" = false || continue
250897cf2ee2Smrg      ;;
25099f00f3a1Smrg    nosideeffect)
25109f00f3a1Smrg      # After this tag, mechanisms are not by side-effect, so they'll
25119f00f3a1Smrg      # only be used when explicitly requested.
25129f00f3a1Smrg      if test "x$enable_dependency_tracking" = xyes; then
25139f00f3a1Smrg	continue
25149f00f3a1Smrg      else
25159f00f3a1Smrg	break
25169f00f3a1Smrg      fi
251797cf2ee2Smrg      ;;
25189f00f3a1Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25199f00f3a1Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25209f00f3a1Smrg      # not run yet.  These depmodes are late enough in the game, and
25219f00f3a1Smrg      # so weak that their functioning should not be impacted.
25229f00f3a1Smrg      am__obj=conftest.${OBJEXT-o}
25239f00f3a1Smrg      am__minus_obj=
252497cf2ee2Smrg      ;;
25259f00f3a1Smrg    none) break ;;
2526a966c04fSmrg    esac
25279f00f3a1Smrg    if depmode=$depmode \
25289f00f3a1Smrg       source=sub/conftest.c object=$am__obj \
25299f00f3a1Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
25309f00f3a1Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
25319f00f3a1Smrg         >/dev/null 2>conftest.err &&
25329f00f3a1Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
25339f00f3a1Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
25349f00f3a1Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
25359f00f3a1Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
25369f00f3a1Smrg      # icc doesn't choke on unknown options, it will just issue warnings
25379f00f3a1Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
25389f00f3a1Smrg      # that says an option was ignored or not supported.
25399f00f3a1Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
25409f00f3a1Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
25419f00f3a1Smrg      # The diagnosis changed in icc 8.0:
25429f00f3a1Smrg      #   icc: Command line remark: option '-MP' not supported
25439f00f3a1Smrg      if (grep 'ignoring option' conftest.err ||
25449f00f3a1Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
25459f00f3a1Smrg        am_cv_$1_dependencies_compiler_type=$depmode
25469f00f3a1Smrg        break
254797cf2ee2Smrg      fi
254897cf2ee2Smrg    fi
254997cf2ee2Smrg  done
25506e7d3316Smrg
25519f00f3a1Smrg  cd ..
25529f00f3a1Smrg  rm -rf conftest.dir
25536e7d3316Smrgelse
25549f00f3a1Smrg  am_cv_$1_dependencies_compiler_type=none
25556e7d3316Smrgfi
255697cf2ee2Smrg])
25579f00f3a1SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
25589f00f3a1SmrgAM_CONDITIONAL([am__fastdep$1], [
25599f00f3a1Smrg  test "x$enable_dependency_tracking" != xno \
25609f00f3a1Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
25619f00f3a1Smrg])
256297cf2ee2Smrg
256397cf2ee2Smrg
25649f00f3a1Smrg# AM_SET_DEPDIR
25659f00f3a1Smrg# -------------
25669f00f3a1Smrg# Choose a directory name for dependency files.
25679f00f3a1Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
25689f00f3a1SmrgAC_DEFUN([AM_SET_DEPDIR],
25699f00f3a1Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
25709f00f3a1SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
25719f00f3a1Smrg])
257297cf2ee2Smrg
2573a966c04fSmrg
25749f00f3a1Smrg# AM_DEP_TRACK
25759f00f3a1Smrg# ------------
25769f00f3a1SmrgAC_DEFUN([AM_DEP_TRACK],
25779f00f3a1Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
25789f00f3a1SmrgAS_HELP_STRING(
25799f00f3a1Smrg  [--enable-dependency-tracking],
25809f00f3a1Smrg  [do not reject slow dependency extractors])
25819f00f3a1SmrgAS_HELP_STRING(
25829f00f3a1Smrg  [--disable-dependency-tracking],
25839f00f3a1Smrg  [speeds up one-time build])])
25849f00f3a1Smrgif test "x$enable_dependency_tracking" != xno; then
25859f00f3a1Smrg  am_depcomp="$ac_aux_dir/depcomp"
25869f00f3a1Smrg  AMDEPBACKSLASH='\'
25879f00f3a1Smrg  am__nodep='_no'
25889f00f3a1Smrgfi
25899f00f3a1SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
25909f00f3a1SmrgAC_SUBST([AMDEPBACKSLASH])dnl
25919f00f3a1Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
25929f00f3a1SmrgAC_SUBST([am__nodep])dnl
25939f00f3a1Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
25949f00f3a1Smrg])
2595a966c04fSmrg
25969f00f3a1Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2597a966c04fSmrg
2598edce3322Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
2599ac92798bSmrg#
26009f00f3a1Smrg# This file is free software; the Free Software Foundation
26019f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
26029f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2603ac92798bSmrg
26049f00f3a1Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
26059f00f3a1Smrg# ------------------------------
26069f00f3a1SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26079f00f3a1Smrg[{
26089f00f3a1Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
26099f00f3a1Smrg  # are listed without --file.  Let's play safe and only enable the eval
26109f00f3a1Smrg  # if we detect the quoting.
2611edce3322Smrg  # TODO: see whether this extra hack can be removed once we start
2612edce3322Smrg  # requiring Autoconf 2.70 or later.
2613edce3322Smrg  AS_CASE([$CONFIG_FILES],
2614edce3322Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
2615edce3322Smrg          [*], [set x $CONFIG_FILES])
26169f00f3a1Smrg  shift
2617edce3322Smrg  # Used to flag and report bootstrapping failures.
2618edce3322Smrg  am_rc=0
2619edce3322Smrg  for am_mf
26209f00f3a1Smrg  do
26219f00f3a1Smrg    # Strip MF so we end up with the name of the file.
2622edce3322Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
2623edce3322Smrg    # Check whether this is an Automake generated Makefile which includes
2624edce3322Smrg    # dependency-tracking related rules and includes.
2625edce3322Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
26269f00f3a1Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
2627edce3322Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
2628edce3322Smrg      || continue
2629edce3322Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
2630edce3322Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
2631edce3322Smrg    AM_RUN_LOG([cd "$am_dirpart" \
2632edce3322Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
2633edce3322Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
26349f00f3a1Smrg  done
2635edce3322Smrg  if test $am_rc -ne 0; then
2636edce3322Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
2637edce3322Smrg    for automatic dependency tracking.  Try re-running configure with the
2638edce3322Smrg    '--disable-dependency-tracking' option to at least be able to build
2639edce3322Smrg    the package (albeit without support for automatic dependency tracking).])
2640edce3322Smrg  fi
2641edce3322Smrg  AS_UNSET([am_dirpart])
2642edce3322Smrg  AS_UNSET([am_filepart])
2643edce3322Smrg  AS_UNSET([am_mf])
2644edce3322Smrg  AS_UNSET([am_rc])
2645edce3322Smrg  rm -f conftest-deps.mk
26469f00f3a1Smrg}
26479f00f3a1Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
26489f00f3a1Smrg
26499f00f3a1Smrg
26509f00f3a1Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
26519f00f3a1Smrg# -----------------------------
26529f00f3a1Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
2653ac92798bSmrg#
2654edce3322Smrg# This code is only required when automatic dependency tracking is enabled.
2655edce3322Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
2656edce3322Smrg# order to bootstrap the dependency handling code.
26579f00f3a1SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
26589f00f3a1Smrg[AC_CONFIG_COMMANDS([depfiles],
26599f00f3a1Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2660edce3322Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
26619f00f3a1Smrg
26629f00f3a1Smrg# Do all the work for Automake.                             -*- Autoconf -*-
26639f00f3a1Smrg
2664edce3322Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
266597cf2ee2Smrg#
26669f00f3a1Smrg# This file is free software; the Free Software Foundation
26679f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
26689f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2669a966c04fSmrg
26709f00f3a1Smrg# This macro actually does too much.  Some checks are only needed if
26719f00f3a1Smrg# your package does certain things.  But this isn't really a big deal.
2672a966c04fSmrg
26739f00f3a1Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
26749f00f3a1Smrgm4_define([AC_PROG_CC],
26759f00f3a1Smrgm4_defn([AC_PROG_CC])
26769f00f3a1Smrg[_AM_PROG_CC_C_O
26779f00f3a1Smrg])
26789f00f3a1Smrg
26799f00f3a1Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
26809f00f3a1Smrg# AM_INIT_AUTOMAKE([OPTIONS])
26819f00f3a1Smrg# -----------------------------------------------
26829f00f3a1Smrg# The call with PACKAGE and VERSION arguments is the old style
26839f00f3a1Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
26849f00f3a1Smrg# and VERSION should now be passed to AC_INIT and removed from
26859f00f3a1Smrg# the call to AM_INIT_AUTOMAKE.
26869f00f3a1Smrg# We support both call styles for the transition.  After
26879f00f3a1Smrg# the next Automake release, Autoconf can make the AC_INIT
26889f00f3a1Smrg# arguments mandatory, and then we can depend on a new Autoconf
26899f00f3a1Smrg# release and drop the old call support.
26909f00f3a1SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
26919f00f3a1Smrg[AC_PREREQ([2.65])dnl
26929f00f3a1Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
26939f00f3a1Smrgdnl the ones we care about.
26949f00f3a1Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
26959f00f3a1SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
26969f00f3a1SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
26979f00f3a1Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
26989f00f3a1Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
26999f00f3a1Smrg  # is not polluted with repeated "-I."
27009f00f3a1Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
27019f00f3a1Smrg  # test to see if srcdir already configured
27029f00f3a1Smrg  if test -f $srcdir/config.status; then
27039f00f3a1Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
270497cf2ee2Smrg  fi
270597cf2ee2Smrgfi
2706a966c04fSmrg
27079f00f3a1Smrg# test whether we have cygpath
27089f00f3a1Smrgif test -z "$CYGPATH_W"; then
27099f00f3a1Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
27109f00f3a1Smrg    CYGPATH_W='cygpath -w'
27119f00f3a1Smrg  else
27129f00f3a1Smrg    CYGPATH_W=echo
271397cf2ee2Smrg  fi
271497cf2ee2Smrgfi
27159f00f3a1SmrgAC_SUBST([CYGPATH_W])
2716a966c04fSmrg
27179f00f3a1Smrg# Define the identity of the package.
27189f00f3a1Smrgdnl Distinguish between old-style and new-style calls.
27199f00f3a1Smrgm4_ifval([$2],
27209f00f3a1Smrg[AC_DIAGNOSE([obsolete],
27219f00f3a1Smrg             [$0: two- and three-arguments forms are deprecated.])
27229f00f3a1Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
27239f00f3a1Smrg AC_SUBST([PACKAGE], [$1])dnl
27249f00f3a1Smrg AC_SUBST([VERSION], [$2])],
27259f00f3a1Smrg[_AM_SET_OPTIONS([$1])dnl
27269f00f3a1Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
27279f00f3a1Smrgm4_if(
27289f00f3a1Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
27299f00f3a1Smrg  [ok:ok],,
27309f00f3a1Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
27319f00f3a1Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
27329f00f3a1Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2733a966c04fSmrg
27349f00f3a1Smrg_AM_IF_OPTION([no-define],,
27359f00f3a1Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
27369f00f3a1Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2737a966c04fSmrg
27389f00f3a1Smrg# Some tools Automake needs.
27399f00f3a1SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
27409f00f3a1SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
27419f00f3a1SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
27429f00f3a1SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
27439f00f3a1SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
27449f00f3a1SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
27459f00f3a1SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
27469f00f3a1SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
27479f00f3a1SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
27489f00f3a1SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
27499f00f3a1Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
27509f00f3a1Smrg# dies out for good.  For more background, see:
2751edce3322Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2752edce3322Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
27539f00f3a1SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2754edce3322Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
2755edce3322Smrg# system "awk" is bad on some platforms.
27569f00f3a1SmrgAC_REQUIRE([AC_PROG_AWK])dnl
27579f00f3a1SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
27589f00f3a1SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
27599f00f3a1Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
27609f00f3a1Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
27619f00f3a1Smrg			     [_AM_PROG_TAR([v7])])])
27629f00f3a1Smrg_AM_IF_OPTION([no-dependencies],,
27639f00f3a1Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
27649f00f3a1Smrg		  [_AM_DEPENDENCIES([CC])],
27659f00f3a1Smrg		  [m4_define([AC_PROG_CC],
27669f00f3a1Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
27679f00f3a1SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
27689f00f3a1Smrg		  [_AM_DEPENDENCIES([CXX])],
27699f00f3a1Smrg		  [m4_define([AC_PROG_CXX],
27709f00f3a1Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
27719f00f3a1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
27729f00f3a1Smrg		  [_AM_DEPENDENCIES([OBJC])],
27739f00f3a1Smrg		  [m4_define([AC_PROG_OBJC],
27749f00f3a1Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
27759f00f3a1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
27769f00f3a1Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
27779f00f3a1Smrg		  [m4_define([AC_PROG_OBJCXX],
27789f00f3a1Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
27799f00f3a1Smrg])
27809f00f3a1SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
27819f00f3a1Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
27829f00f3a1Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
27839f00f3a1Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
27849f00f3a1SmrgAC_CONFIG_COMMANDS_PRE(dnl
27859f00f3a1Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
27869f00f3a1Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2787a966c04fSmrg
27889f00f3a1Smrg# POSIX will say in a future version that running "rm -f" with no argument
27899f00f3a1Smrg# is OK; and we want to be able to make that assumption in our Makefile
27909f00f3a1Smrg# recipes.  So use an aggressive probe to check that the usage we want is
27919f00f3a1Smrg# actually supported "in the wild" to an acceptable degree.
27929f00f3a1Smrg# See automake bug#10828.
27939f00f3a1Smrg# To make any issue more visible, cause the running configure to be aborted
27949f00f3a1Smrg# by default if the 'rm' program in use doesn't match our expectations; the
27959f00f3a1Smrg# user can still override this though.
27969f00f3a1Smrgif rm -f && rm -fr && rm -rf; then : OK; else
27979f00f3a1Smrg  cat >&2 <<'END'
27989f00f3a1SmrgOops!
2799a966c04fSmrg
28009f00f3a1SmrgYour 'rm' program seems unable to run without file operands specified
28019f00f3a1Smrgon the command line, even when the '-f' option is present.  This is contrary
28029f00f3a1Smrgto the behaviour of most rm programs out there, and not conforming with
28039f00f3a1Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
28042e2dd055Smrg
28059f00f3a1SmrgPlease tell bug-automake@gnu.org about your system, including the value
28069f00f3a1Smrgof your $PATH and any error possibly output before this message.  This
28079f00f3a1Smrgcan help us improve future automake versions.
28082e2dd055Smrg
28099f00f3a1SmrgEND
28109f00f3a1Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
28119f00f3a1Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
28129f00f3a1Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
28139f00f3a1Smrg    echo >&2
28149f00f3a1Smrg  else
28159f00f3a1Smrg    cat >&2 <<'END'
28169f00f3a1SmrgAborting the configuration process, to ensure you take notice of the issue.
28172e2dd055Smrg
28189f00f3a1SmrgYou can download and install GNU coreutils to get an 'rm' implementation
2819edce3322Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
28202e2dd055Smrg
28219f00f3a1SmrgIf you want to complete the configuration process using your problematic
28229f00f3a1Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
28239f00f3a1Smrgto "yes", and re-run configure.
2824a966c04fSmrg
28259f00f3a1SmrgEND
28269f00f3a1Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
28279f00f3a1Smrg  fi
2828edce3322Smrgfi
2829edce3322Smrgdnl The trailing newline in this macro's definition is deliberate, for
2830edce3322Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
2831edce3322Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
2832edce3322Smrg])
2833a966c04fSmrg
28349f00f3a1Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
28359f00f3a1Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
28369f00f3a1Smrgdnl mangled by Autoconf and run in a shell conditional statement.
28379f00f3a1Smrgm4_define([_AC_COMPILER_EXEEXT],
28389f00f3a1Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2839a966c04fSmrg
28409f00f3a1Smrg# When config.status generates a header, we must update the stamp-h file.
28419f00f3a1Smrg# This file resides in the same directory as the config header
28429f00f3a1Smrg# that is generated.  The stamp files are numbered to have different names.
28436e7d3316Smrg
28449f00f3a1Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
28459f00f3a1Smrg# loop where config.status creates the headers, so we can generate
28469f00f3a1Smrg# our stamp files there.
28479f00f3a1SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
28489f00f3a1Smrg[# Compute $1's index in $config_headers.
28499f00f3a1Smrg_am_arg=$1
28509f00f3a1Smrg_am_stamp_count=1
28519f00f3a1Smrgfor _am_header in $config_headers :; do
28529f00f3a1Smrg  case $_am_header in
28539f00f3a1Smrg    $_am_arg | $_am_arg:* )
28549f00f3a1Smrg      break ;;
28559f00f3a1Smrg    * )
28569f00f3a1Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
28579f00f3a1Smrg  esac
28589f00f3a1Smrgdone
28599f00f3a1Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
28606e7d3316Smrg
2861edce3322Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
286297cf2ee2Smrg#
28639f00f3a1Smrg# This file is free software; the Free Software Foundation
28649f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
28659f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
28666e7d3316Smrg
28679f00f3a1Smrg# AM_PROG_INSTALL_SH
28689f00f3a1Smrg# ------------------
28699f00f3a1Smrg# Define $install_sh.
28709f00f3a1SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
28719f00f3a1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2872edce3322Smrgif test x"${install_sh+set}" != xset; then
28739f00f3a1Smrg  case $am_aux_dir in
28749f00f3a1Smrg  *\ * | *\	*)
28759f00f3a1Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
28769f00f3a1Smrg  *)
28779f00f3a1Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
28789f00f3a1Smrg  esac
28799f00f3a1Smrgfi
28809f00f3a1SmrgAC_SUBST([install_sh])])
28816e7d3316Smrg
2882edce3322Smrg# Copyright (C) 2003-2018 Free Software Foundation, Inc.
28839f00f3a1Smrg#
28849f00f3a1Smrg# This file is free software; the Free Software Foundation
28859f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
28869f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
28876e7d3316Smrg
28889f00f3a1Smrg# Check whether the underlying file-system supports filenames
28899f00f3a1Smrg# with a leading dot.  For instance MS-DOS doesn't.
28909f00f3a1SmrgAC_DEFUN([AM_SET_LEADING_DOT],
28919f00f3a1Smrg[rm -rf .tst 2>/dev/null
28929f00f3a1Smrgmkdir .tst 2>/dev/null
28939f00f3a1Smrgif test -d .tst; then
28949f00f3a1Smrg  am__leading_dot=.
289597cf2ee2Smrgelse
28969f00f3a1Smrg  am__leading_dot=_
289797cf2ee2Smrgfi
28989f00f3a1Smrgrmdir .tst 2>/dev/null
28999f00f3a1SmrgAC_SUBST([am__leading_dot])])
29006e7d3316Smrg
29019f00f3a1Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
29026e7d3316Smrg
2903edce3322Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
290497cf2ee2Smrg#
29059f00f3a1Smrg# This file is free software; the Free Software Foundation
29069f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
29079f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
29086e7d3316Smrg
29099f00f3a1Smrg# AM_MAKE_INCLUDE()
29109f00f3a1Smrg# -----------------
2911edce3322Smrg# Check whether make has an 'include' directive that can support all
2912edce3322Smrg# the idioms we need for our automatic dependency tracking code.
29139f00f3a1SmrgAC_DEFUN([AM_MAKE_INCLUDE],
2914edce3322Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
2915edce3322Smrgcat > confinc.mk << 'END'
29169f00f3a1Smrgam__doit:
2917edce3322Smrg	@echo this is the am__doit target >confinc.out
29189f00f3a1Smrg.PHONY: am__doit
29199f00f3a1SmrgEND
29209f00f3a1Smrgam__include="#"
29219f00f3a1Smrgam__quote=
2922edce3322Smrg# BSD make does it like this.
2923edce3322Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
2924edce3322Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
2925edce3322Smrgecho 'include confinc.mk # ignored' > confmf.GNU
2926edce3322Smrg_am_result=no
2927edce3322Smrgfor s in GNU BSD; do
2928edce3322Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
2929edce3322Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
2930edce3322Smrg      ['0:this is the am__doit target'],
2931edce3322Smrg      [AS_CASE([$s],
2932edce3322Smrg          [BSD], [am__include='.include' am__quote='"'],
2933edce3322Smrg          [am__include='include' am__quote=''])])
2934edce3322Smrg  if test "$am__include" != "#"; then
2935edce3322Smrg    _am_result="yes ($s style)"
2936edce3322Smrg    break
2937edce3322Smrg  fi
2938edce3322Smrgdone
2939edce3322Smrgrm -f confinc.* confmf.*
2940edce3322SmrgAC_MSG_RESULT([${_am_result}])
2941edce3322SmrgAC_SUBST([am__include])])
2942edce3322SmrgAC_SUBST([am__quote])])
29436e7d3316Smrg
29449f00f3a1Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2945a966c04fSmrg
2946edce3322Smrg# Copyright (C) 1997-2018 Free Software Foundation, Inc.
294797cf2ee2Smrg#
29489f00f3a1Smrg# This file is free software; the Free Software Foundation
29499f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
29509f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
2951a966c04fSmrg
29529f00f3a1Smrg# AM_MISSING_PROG(NAME, PROGRAM)
29539f00f3a1Smrg# ------------------------------
29549f00f3a1SmrgAC_DEFUN([AM_MISSING_PROG],
29559f00f3a1Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
29569f00f3a1Smrg$1=${$1-"${am_missing_run}$2"}
29579f00f3a1SmrgAC_SUBST($1)])
295897cf2ee2Smrg
29599f00f3a1Smrg# AM_MISSING_HAS_RUN
29609f00f3a1Smrg# ------------------
29619f00f3a1Smrg# Define MISSING if not defined so far and test if it is modern enough.
29629f00f3a1Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
29639f00f3a1SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
29649f00f3a1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
29659f00f3a1SmrgAC_REQUIRE_AUX_FILE([missing])dnl
29669f00f3a1Smrgif test x"${MISSING+set}" != xset; then
29679f00f3a1Smrg  case $am_aux_dir in
29689f00f3a1Smrg  *\ * | *\	*)
29699f00f3a1Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
29709f00f3a1Smrg  *)
29719f00f3a1Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
29729f00f3a1Smrg  esac
297397cf2ee2Smrgfi
29749f00f3a1Smrg# Use eval to expand $SHELL
29759f00f3a1Smrgif eval "$MISSING --is-lightweight"; then
29769f00f3a1Smrg  am_missing_run="$MISSING "
29779f00f3a1Smrgelse
29789f00f3a1Smrg  am_missing_run=
29799f00f3a1Smrg  AC_MSG_WARN(['missing' script is too old or missing])
298097cf2ee2Smrgfi
29819f00f3a1Smrg])
29822e2dd055Smrg
29839f00f3a1Smrg# Helper functions for option handling.                     -*- Autoconf -*-
298497cf2ee2Smrg
2985edce3322Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
29869f00f3a1Smrg#
29879f00f3a1Smrg# This file is free software; the Free Software Foundation
29889f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
29899f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
299097cf2ee2Smrg
29919f00f3a1Smrg# _AM_MANGLE_OPTION(NAME)
29929f00f3a1Smrg# -----------------------
29939f00f3a1SmrgAC_DEFUN([_AM_MANGLE_OPTION],
29949f00f3a1Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
299597cf2ee2Smrg
29969f00f3a1Smrg# _AM_SET_OPTION(NAME)
29979f00f3a1Smrg# --------------------
29989f00f3a1Smrg# Set option NAME.  Presently that only means defining a flag for this option.
29999f00f3a1SmrgAC_DEFUN([_AM_SET_OPTION],
30009f00f3a1Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
300197cf2ee2Smrg
30029f00f3a1Smrg# _AM_SET_OPTIONS(OPTIONS)
30039f00f3a1Smrg# ------------------------
30049f00f3a1Smrg# OPTIONS is a space-separated list of Automake options.
30059f00f3a1SmrgAC_DEFUN([_AM_SET_OPTIONS],
30069f00f3a1Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
300797cf2ee2Smrg
30089f00f3a1Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
30099f00f3a1Smrg# -------------------------------------------
30109f00f3a1Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
30119f00f3a1SmrgAC_DEFUN([_AM_IF_OPTION],
30129f00f3a1Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
30132e2dd055Smrg
3014edce3322Smrg# Copyright (C) 1999-2018 Free Software Foundation, Inc.
301597cf2ee2Smrg#
30169f00f3a1Smrg# This file is free software; the Free Software Foundation
30179f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
30189f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
301997cf2ee2Smrg
30209f00f3a1Smrg# _AM_PROG_CC_C_O
30219f00f3a1Smrg# ---------------
30229f00f3a1Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
30239f00f3a1Smrg# to automatically call this.
30249f00f3a1SmrgAC_DEFUN([_AM_PROG_CC_C_O],
30259f00f3a1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
30269f00f3a1SmrgAC_REQUIRE_AUX_FILE([compile])dnl
30279f00f3a1SmrgAC_LANG_PUSH([C])dnl
30289f00f3a1SmrgAC_CACHE_CHECK(
30299f00f3a1Smrg  [whether $CC understands -c and -o together],
30309f00f3a1Smrg  [am_cv_prog_cc_c_o],
30319f00f3a1Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
30329f00f3a1Smrg  # Make sure it works both with $CC and with simple cc.
30339f00f3a1Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
30349f00f3a1Smrg  # compilers refuse to overwrite an existing .o file with -o,
30359f00f3a1Smrg  # though they will create one.
30369f00f3a1Smrg  am_cv_prog_cc_c_o=yes
30379f00f3a1Smrg  for am_i in 1 2; do
30389f00f3a1Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
30399f00f3a1Smrg         && test -f conftest2.$ac_objext; then
30409f00f3a1Smrg      : OK
30419f00f3a1Smrg    else
30429f00f3a1Smrg      am_cv_prog_cc_c_o=no
30439f00f3a1Smrg      break
30449f00f3a1Smrg    fi
30459f00f3a1Smrg  done
30469f00f3a1Smrg  rm -f core conftest*
30479f00f3a1Smrg  unset am_i])
30489f00f3a1Smrgif test "$am_cv_prog_cc_c_o" != yes; then
30499f00f3a1Smrg   # Losing compiler, so override with the script.
30509f00f3a1Smrg   # FIXME: It is wrong to rewrite CC.
30519f00f3a1Smrg   # But if we don't then we get into trouble of one sort or another.
30529f00f3a1Smrg   # A longer-term fix would be to have automake use am__CC in this case,
30539f00f3a1Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
30549f00f3a1Smrg   CC="$am_aux_dir/compile $CC"
305597cf2ee2Smrgfi
30569f00f3a1SmrgAC_LANG_POP([C])])
3057a966c04fSmrg
30589f00f3a1Smrg# For backward compatibility.
30599f00f3a1SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
30609f00f3a1Smrg
3061edce3322Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
30629f00f3a1Smrg#
30639f00f3a1Smrg# This file is free software; the Free Software Foundation
30649f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
30659f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
30669f00f3a1Smrg
30679f00f3a1Smrg# AM_RUN_LOG(COMMAND)
30689f00f3a1Smrg# -------------------
30699f00f3a1Smrg# Run COMMAND, save the exit status in ac_status, and log it.
30709f00f3a1Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
30719f00f3a1SmrgAC_DEFUN([AM_RUN_LOG],
30729f00f3a1Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
30739f00f3a1Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
30749f00f3a1Smrg   ac_status=$?
30759f00f3a1Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
30769f00f3a1Smrg   (exit $ac_status); }])
307797cf2ee2Smrg
30789f00f3a1Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3079a966c04fSmrg
3080edce3322Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc.
30819f00f3a1Smrg#
30829f00f3a1Smrg# This file is free software; the Free Software Foundation
30839f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
30849f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
308597cf2ee2Smrg
30869f00f3a1Smrg# AM_SANITY_CHECK
30879f00f3a1Smrg# ---------------
30889f00f3a1SmrgAC_DEFUN([AM_SANITY_CHECK],
30899f00f3a1Smrg[AC_MSG_CHECKING([whether build environment is sane])
30909f00f3a1Smrg# Reject unsafe characters in $srcdir or the absolute working directory
30919f00f3a1Smrg# name.  Accept space and tab only in the latter.
30929f00f3a1Smrgam_lf='
30939f00f3a1Smrg'
30949f00f3a1Smrgcase `pwd` in
30959f00f3a1Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
30969f00f3a1Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
30979f00f3a1Smrgesac
30989f00f3a1Smrgcase $srcdir in
30999f00f3a1Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
31009f00f3a1Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
31019f00f3a1Smrgesac
310297cf2ee2Smrg
31039f00f3a1Smrg# Do 'set' in a subshell so we don't clobber the current shell's
31049f00f3a1Smrg# arguments.  Must try -L first in case configure is actually a
31059f00f3a1Smrg# symlink; some systems play weird games with the mod time of symlinks
31069f00f3a1Smrg# (eg FreeBSD returns the mod time of the symlink's containing
31079f00f3a1Smrg# directory).
31089f00f3a1Smrgif (
31099f00f3a1Smrg   am_has_slept=no
31109f00f3a1Smrg   for am_try in 1 2; do
31119f00f3a1Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
31129f00f3a1Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
31139f00f3a1Smrg     if test "$[*]" = "X"; then
31149f00f3a1Smrg	# -L didn't work.
31159f00f3a1Smrg	set X `ls -t "$srcdir/configure" conftest.file`
31169f00f3a1Smrg     fi
31179f00f3a1Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
31189f00f3a1Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
311997cf2ee2Smrg
31209f00f3a1Smrg	# If neither matched, then we have a broken ls.  This can happen
31219f00f3a1Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
31229f00f3a1Smrg	# broken ls alias from the environment.  This has actually
31239f00f3a1Smrg	# happened.  Such a system could not be considered "sane".
31249f00f3a1Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
31259f00f3a1Smrg  alias in your environment])
31269f00f3a1Smrg     fi
31279f00f3a1Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
31289f00f3a1Smrg       break
31299f00f3a1Smrg     fi
31309f00f3a1Smrg     # Just in case.
31319f00f3a1Smrg     sleep 1
31329f00f3a1Smrg     am_has_slept=yes
31339f00f3a1Smrg   done
31349f00f3a1Smrg   test "$[2]" = conftest.file
31359f00f3a1Smrg   )
31369f00f3a1Smrgthen
31379f00f3a1Smrg   # Ok.
31389f00f3a1Smrg   :
313997cf2ee2Smrgelse
31409f00f3a1Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
31419f00f3a1SmrgCheck your system clock])
314297cf2ee2Smrgfi
31439f00f3a1SmrgAC_MSG_RESULT([yes])
31449f00f3a1Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
31459f00f3a1Smrg# generated files are strictly newer.
31469f00f3a1Smrgam_sleep_pid=
31479f00f3a1Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
31489f00f3a1Smrg  ( sleep 1 ) &
31499f00f3a1Smrg  am_sleep_pid=$!
31509f00f3a1Smrgfi
31519f00f3a1SmrgAC_CONFIG_COMMANDS_PRE(
31529f00f3a1Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
31539f00f3a1Smrg   if test -n "$am_sleep_pid"; then
31549f00f3a1Smrg     # Hide warnings about reused PIDs.
31559f00f3a1Smrg     wait $am_sleep_pid 2>/dev/null
31569f00f3a1Smrg   fi
31579f00f3a1Smrg   AC_MSG_RESULT([done])])
31589f00f3a1Smrgrm -f conftest.file
31599f00f3a1Smrg])
3160a966c04fSmrg
3161edce3322Smrg# Copyright (C) 2009-2018 Free Software Foundation, Inc.
316297cf2ee2Smrg#
31639f00f3a1Smrg# This file is free software; the Free Software Foundation
31649f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
31659f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
3166a966c04fSmrg
31679f00f3a1Smrg# AM_SILENT_RULES([DEFAULT])
31689f00f3a1Smrg# --------------------------
31699f00f3a1Smrg# Enable less verbose build rules; with the default set to DEFAULT
31709f00f3a1Smrg# ("yes" being less verbose, "no" or empty being verbose).
31719f00f3a1SmrgAC_DEFUN([AM_SILENT_RULES],
31729f00f3a1Smrg[AC_ARG_ENABLE([silent-rules], [dnl
31739f00f3a1SmrgAS_HELP_STRING(
31749f00f3a1Smrg  [--enable-silent-rules],
31759f00f3a1Smrg  [less verbose build output (undo: "make V=1")])
31769f00f3a1SmrgAS_HELP_STRING(
31779f00f3a1Smrg  [--disable-silent-rules],
31789f00f3a1Smrg  [verbose build output (undo: "make V=0")])dnl
31799f00f3a1Smrg])
31809f00f3a1Smrgcase $enable_silent_rules in @%:@ (((
31819f00f3a1Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
31829f00f3a1Smrg   no) AM_DEFAULT_VERBOSITY=1;;
31839f00f3a1Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
31849f00f3a1Smrgesac
31859f00f3a1Smrgdnl
31869f00f3a1Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
31879f00f3a1Smrgdnl do not support nested variable expansions.
31889f00f3a1Smrgdnl See automake bug#9928 and bug#10237.
31899f00f3a1Smrgam_make=${MAKE-make}
31909f00f3a1SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
31919f00f3a1Smrg   [am_cv_make_support_nested_variables],
31929f00f3a1Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
31939f00f3a1SmrgBAR0=false
31949f00f3a1SmrgBAR1=true
31959f00f3a1SmrgV=1
31969f00f3a1Smrgam__doit:
31979f00f3a1Smrg	@$(TRUE)
31989f00f3a1Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
31999f00f3a1Smrg  am_cv_make_support_nested_variables=yes
32009f00f3a1Smrgelse
32019f00f3a1Smrg  am_cv_make_support_nested_variables=no
32029f00f3a1Smrgfi])
32039f00f3a1Smrgif test $am_cv_make_support_nested_variables = yes; then
32049f00f3a1Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
32059f00f3a1Smrg  AM_V='$(V)'
32069f00f3a1Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
32079f00f3a1Smrgelse
32089f00f3a1Smrg  AM_V=$AM_DEFAULT_VERBOSITY
32099f00f3a1Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
32109f00f3a1Smrgfi
32119f00f3a1SmrgAC_SUBST([AM_V])dnl
32129f00f3a1SmrgAM_SUBST_NOTMAKE([AM_V])dnl
32139f00f3a1SmrgAC_SUBST([AM_DEFAULT_V])dnl
32149f00f3a1SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
32159f00f3a1SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
32169f00f3a1SmrgAM_BACKSLASH='\'
32179f00f3a1SmrgAC_SUBST([AM_BACKSLASH])dnl
32189f00f3a1Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
32199f00f3a1Smrg])
32209f00f3a1Smrg
3221edce3322Smrg# Copyright (C) 2001-2018 Free Software Foundation, Inc.
322297cf2ee2Smrg#
32239f00f3a1Smrg# This file is free software; the Free Software Foundation
32249f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
32259f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
32269f00f3a1Smrg
32279f00f3a1Smrg# AM_PROG_INSTALL_STRIP
32289f00f3a1Smrg# ---------------------
32299f00f3a1Smrg# One issue with vendor 'install' (even GNU) is that you can't
32309f00f3a1Smrg# specify the program used to strip binaries.  This is especially
32319f00f3a1Smrg# annoying in cross-compiling environments, where the build's strip
32329f00f3a1Smrg# is unlikely to handle the host's binaries.
32339f00f3a1Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
32349f00f3a1Smrg# always use install-sh in "make install-strip", and initialize
32359f00f3a1Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
32369f00f3a1SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
32379f00f3a1Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
32389f00f3a1Smrg# Installed binaries are usually stripped using 'strip' when the user
32399f00f3a1Smrg# run "make install-strip".  However 'strip' might not be the right
32409f00f3a1Smrg# tool to use in cross-compilation environments, therefore Automake
32419f00f3a1Smrg# will honor the 'STRIP' environment variable to overrule this program.
32429f00f3a1Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
32439f00f3a1Smrgif test "$cross_compiling" != no; then
32449f00f3a1Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
32459f00f3a1Smrgfi
32469f00f3a1SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
32479f00f3a1SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
32482e2dd055Smrg
3249edce3322Smrg# Copyright (C) 2006-2018 Free Software Foundation, Inc.
32509f00f3a1Smrg#
32519f00f3a1Smrg# This file is free software; the Free Software Foundation
32529f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
32539f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
32542e2dd055Smrg
32559f00f3a1Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
32569f00f3a1Smrg# ---------------------------
32579f00f3a1Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
32589f00f3a1Smrg# This macro is traced by Automake.
32599f00f3a1SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3260a966c04fSmrg
32619f00f3a1Smrg# AM_SUBST_NOTMAKE(VARIABLE)
32629f00f3a1Smrg# --------------------------
32639f00f3a1Smrg# Public sister of _AM_SUBST_NOTMAKE.
32649f00f3a1SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3265a966c04fSmrg
32669f00f3a1Smrg# Check how to create a tarball.                            -*- Autoconf -*-
3267a966c04fSmrg
3268edce3322Smrg# Copyright (C) 2004-2018 Free Software Foundation, Inc.
32699f00f3a1Smrg#
32709f00f3a1Smrg# This file is free software; the Free Software Foundation
32719f00f3a1Smrg# gives unlimited permission to copy and/or distribute it,
32729f00f3a1Smrg# with or without modifications, as long as this notice is preserved.
32736e7d3316Smrg
32749f00f3a1Smrg# _AM_PROG_TAR(FORMAT)
327597cf2ee2Smrg# --------------------
32769f00f3a1Smrg# Check how to create a tarball in format FORMAT.
32779f00f3a1Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
32786e7d3316Smrg#
32799f00f3a1Smrg# Substitute a variable $(am__tar) that is a command
32809f00f3a1Smrg# writing to stdout a FORMAT-tarball containing the directory
32819f00f3a1Smrg# $tardir.
32829f00f3a1Smrg#     tardir=directory && $(am__tar) > result.tar
32836e7d3316Smrg#
32849f00f3a1Smrg# Substitute a variable $(am__untar) that extract such
32859f00f3a1Smrg# a tarball read from stdin.
32869f00f3a1Smrg#     $(am__untar) < result.tar
32876e7d3316Smrg#
32889f00f3a1SmrgAC_DEFUN([_AM_PROG_TAR],
32899f00f3a1Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
32909f00f3a1Smrg# in the wild :-(  We should find a proper way to deprecate it ...
32919f00f3a1SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
32926e7d3316Smrg
32939f00f3a1Smrg# We'll loop over all known methods to create a tar archive until one works.
32949f00f3a1Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3295ac92798bSmrg
32969f00f3a1Smrgm4_if([$1], [v7],
32979f00f3a1Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
32986e7d3316Smrg
32999f00f3a1Smrg  [m4_case([$1],
33009f00f3a1Smrg    [ustar],
33019f00f3a1Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
33029f00f3a1Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
33039f00f3a1Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
33049f00f3a1Smrg      # and bug#13588).
33059f00f3a1Smrg      am_max_uid=2097151 # 2^21 - 1
33069f00f3a1Smrg      am_max_gid=$am_max_uid
33079f00f3a1Smrg      # The $UID and $GID variables are not portable, so we need to resort
33089f00f3a1Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
33099f00f3a1Smrg      # below are definitely unexpected, so allow the users to see them
33109f00f3a1Smrg      # (that is, avoid stderr redirection).
33119f00f3a1Smrg      am_uid=`id -u || echo unknown`
33129f00f3a1Smrg      am_gid=`id -g || echo unknown`
33139f00f3a1Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
33149f00f3a1Smrg      if test $am_uid -le $am_max_uid; then
33159f00f3a1Smrg         AC_MSG_RESULT([yes])
33169f00f3a1Smrg      else
33179f00f3a1Smrg         AC_MSG_RESULT([no])
33189f00f3a1Smrg         _am_tools=none
33199f00f3a1Smrg      fi
33209f00f3a1Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
33219f00f3a1Smrg      if test $am_gid -le $am_max_gid; then
33229f00f3a1Smrg         AC_MSG_RESULT([yes])
33239f00f3a1Smrg      else
33249f00f3a1Smrg        AC_MSG_RESULT([no])
33259f00f3a1Smrg        _am_tools=none
33269f00f3a1Smrg      fi],
33279f00f3a1Smrg
33289f00f3a1Smrg  [pax],
33299f00f3a1Smrg    [],
33309f00f3a1Smrg
33319f00f3a1Smrg  [m4_fatal([Unknown tar format])])
33329f00f3a1Smrg
33339f00f3a1Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
33349f00f3a1Smrg
33359f00f3a1Smrg  # Go ahead even if we have the value already cached.  We do so because we
33369f00f3a1Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
33379f00f3a1Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
33389f00f3a1Smrg
33399f00f3a1Smrg  for _am_tool in $_am_tools; do
33409f00f3a1Smrg    case $_am_tool in
33419f00f3a1Smrg    gnutar)
33429f00f3a1Smrg      for _am_tar in tar gnutar gtar; do
33439f00f3a1Smrg        AM_RUN_LOG([$_am_tar --version]) && break
33449f00f3a1Smrg      done
33459f00f3a1Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
33469f00f3a1Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
33479f00f3a1Smrg      am__untar="$_am_tar -xf -"
33489f00f3a1Smrg      ;;
33499f00f3a1Smrg    plaintar)
33509f00f3a1Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
33519f00f3a1Smrg      # ustar tarball either.
33529f00f3a1Smrg      (tar --version) >/dev/null 2>&1 && continue
33539f00f3a1Smrg      am__tar='tar chf - "$$tardir"'
33549f00f3a1Smrg      am__tar_='tar chf - "$tardir"'
33559f00f3a1Smrg      am__untar='tar xf -'
33569f00f3a1Smrg      ;;
33579f00f3a1Smrg    pax)
33589f00f3a1Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
33599f00f3a1Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
33609f00f3a1Smrg      am__untar='pax -r'
33619f00f3a1Smrg      ;;
33629f00f3a1Smrg    cpio)
33639f00f3a1Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
33649f00f3a1Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
33659f00f3a1Smrg      am__untar='cpio -i -H $1 -d'
33669f00f3a1Smrg      ;;
33679f00f3a1Smrg    none)
33689f00f3a1Smrg      am__tar=false
33699f00f3a1Smrg      am__tar_=false
33709f00f3a1Smrg      am__untar=false
33719f00f3a1Smrg      ;;
33729f00f3a1Smrg    esac
33739f00f3a1Smrg
33749f00f3a1Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
33759f00f3a1Smrg    # and am__untar set.
33769f00f3a1Smrg    test -n "${am_cv_prog_tar_$1}" && break
33779f00f3a1Smrg
33789f00f3a1Smrg    # tar/untar a dummy directory, and stop if the command works.
33799f00f3a1Smrg    rm -rf conftest.dir
33809f00f3a1Smrg    mkdir conftest.dir
33819f00f3a1Smrg    echo GrepMe > conftest.dir/file
33829f00f3a1Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
33839f00f3a1Smrg    rm -rf conftest.dir
33849f00f3a1Smrg    if test -s conftest.tar; then
33859f00f3a1Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
33869f00f3a1Smrg      AM_RUN_LOG([cat conftest.dir/file])
33879f00f3a1Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
33889f00f3a1Smrg    fi
33899f00f3a1Smrg  done
33909f00f3a1Smrg  rm -rf conftest.dir
3391a966c04fSmrg
33929f00f3a1Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
33939f00f3a1Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
33949f00f3a1Smrg
33959f00f3a1SmrgAC_SUBST([am__tar])
33969f00f3a1SmrgAC_SUBST([am__untar])
33979f00f3a1Smrg]) # _AM_PROG_TAR
33989f00f3a1Smrg
33999f00f3a1Smrgm4_include([m4/ax_define_dir.m4])
34009f00f3a1Smrgm4_include([m4/libtool.m4])
34019f00f3a1Smrgm4_include([m4/ltoptions.m4])
34029f00f3a1Smrgm4_include([m4/ltsugar.m4])
34039f00f3a1Smrgm4_include([m4/ltversion.m4])
34049f00f3a1Smrgm4_include([m4/lt~obsolete.m4])
3405