aclocal.m4 revision e73734d1
1e73734d1Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
233734831Smrg
3e73734d1Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
4b1297603Smrg
5b1297603Smrg# This file is free software; the Free Software Foundation
6b1297603Smrg# gives unlimited permission to copy and/or distribute it,
7b1297603Smrg# with or without modifications, as long as this notice is preserved.
8b1297603Smrg
9b1297603Smrg# This program is distributed in the hope that it will be useful,
10b1297603Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b1297603Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b1297603Smrg# PARTICULAR PURPOSE.
13b1297603Smrg
1433734831Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
155b944e2aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
165b944e2aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1733734831Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1833734831Smrg[m4_warning([this file was generated for autoconf 2.69.
195b944e2aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
205b944e2aSmrgIf you have problems, you may need to regenerate the build system entirely.
2133734831SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
225b944e2aSmrg
23e73734d1Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
24e73734d1Smrg# serial 1 (pkg-config-0.24)
25e73734d1Smrg# 
26e73734d1Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27e73734d1Smrg#
28e73734d1Smrg# This program is free software; you can redistribute it and/or modify
29e73734d1Smrg# it under the terms of the GNU General Public License as published by
30e73734d1Smrg# the Free Software Foundation; either version 2 of the License, or
31e73734d1Smrg# (at your option) any later version.
32e73734d1Smrg#
33e73734d1Smrg# This program is distributed in the hope that it will be useful, but
34e73734d1Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
35e73734d1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36e73734d1Smrg# General Public License for more details.
37e73734d1Smrg#
38e73734d1Smrg# You should have received a copy of the GNU General Public License
39e73734d1Smrg# along with this program; if not, write to the Free Software
40e73734d1Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41e73734d1Smrg#
42e73734d1Smrg# As a special exception to the GNU General Public License, if you
43e73734d1Smrg# distribute this file as part of a program that contains a
44e73734d1Smrg# configuration script generated by Autoconf, you may include it under
45e73734d1Smrg# the same distribution terms that you use for the rest of that program.
46e73734d1Smrg
47e73734d1Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
48e73734d1Smrg# ----------------------------------
49e73734d1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
50e73734d1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
51e73734d1Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
52e73734d1Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
53e73734d1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
54e73734d1SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
55e73734d1SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
56e73734d1Smrg
57e73734d1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
58e73734d1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
59e73734d1Smrgfi
60e73734d1Smrgif test -n "$PKG_CONFIG"; then
61e73734d1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
62e73734d1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
63e73734d1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
64e73734d1Smrg		AC_MSG_RESULT([yes])
65e73734d1Smrg	else
66e73734d1Smrg		AC_MSG_RESULT([no])
67e73734d1Smrg		PKG_CONFIG=""
68e73734d1Smrg	fi
69e73734d1Smrgfi[]dnl
70e73734d1Smrg])# PKG_PROG_PKG_CONFIG
71e73734d1Smrg
72e73734d1Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
73e73734d1Smrg#
74e73734d1Smrg# Check to see whether a particular set of modules exists.  Similar
75e73734d1Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
76e73734d1Smrg#
77e73734d1Smrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
78e73734d1Smrg# only at the first occurence in configure.ac, so if the first place
79e73734d1Smrg# it's called might be skipped (such as if it is within an "if", you
80e73734d1Smrg# have to call PKG_CHECK_EXISTS manually
81e73734d1Smrg# --------------------------------------------------------------
82e73734d1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
83e73734d1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84e73734d1Smrgif test -n "$PKG_CONFIG" && \
85e73734d1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
86e73734d1Smrg  m4_default([$2], [:])
87e73734d1Smrgm4_ifvaln([$3], [else
88e73734d1Smrg  $3])dnl
89e73734d1Smrgfi])
90e73734d1Smrg
91e73734d1Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
92e73734d1Smrg# ---------------------------------------------
93e73734d1Smrgm4_define([_PKG_CONFIG],
94e73734d1Smrg[if test -n "$$1"; then
95e73734d1Smrg    pkg_cv_[]$1="$$1"
96e73734d1Smrg elif test -n "$PKG_CONFIG"; then
97e73734d1Smrg    PKG_CHECK_EXISTS([$3],
98e73734d1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
99e73734d1Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
100e73734d1Smrg		     [pkg_failed=yes])
101e73734d1Smrg else
102e73734d1Smrg    pkg_failed=untried
103e73734d1Smrgfi[]dnl
104e73734d1Smrg])# _PKG_CONFIG
105e73734d1Smrg
106e73734d1Smrg# _PKG_SHORT_ERRORS_SUPPORTED
107e73734d1Smrg# -----------------------------
108e73734d1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
109e73734d1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110e73734d1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
111e73734d1Smrg        _pkg_short_errors_supported=yes
112e73734d1Smrgelse
113e73734d1Smrg        _pkg_short_errors_supported=no
114e73734d1Smrgfi[]dnl
115e73734d1Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
116e73734d1Smrg
117e73734d1Smrg
118e73734d1Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
119e73734d1Smrg# [ACTION-IF-NOT-FOUND])
120e73734d1Smrg#
121e73734d1Smrg#
122e73734d1Smrg# Note that if there is a possibility the first call to
123e73734d1Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
124e73734d1Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125e73734d1Smrg#
126e73734d1Smrg#
127e73734d1Smrg# --------------------------------------------------------------
128e73734d1SmrgAC_DEFUN([PKG_CHECK_MODULES],
129e73734d1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
130e73734d1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
131e73734d1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
132e73734d1Smrg
133e73734d1Smrgpkg_failed=no
134e73734d1SmrgAC_MSG_CHECKING([for $1])
135e73734d1Smrg
136e73734d1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
137e73734d1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138e73734d1Smrg
139e73734d1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
140e73734d1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
141e73734d1SmrgSee the pkg-config man page for more details.])
142e73734d1Smrg
143e73734d1Smrgif test $pkg_failed = yes; then
144e73734d1Smrg   	AC_MSG_RESULT([no])
145e73734d1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146e73734d1Smrg        if test $_pkg_short_errors_supported = yes; then
147e73734d1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
148e73734d1Smrg        else 
149e73734d1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
150e73734d1Smrg        fi
151e73734d1Smrg	# Put the nasty error message in config.log where it belongs
152e73734d1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
153e73734d1Smrg
154e73734d1Smrg	m4_default([$4], [AC_MSG_ERROR(
155e73734d1Smrg[Package requirements ($2) were not met:
156e73734d1Smrg
157e73734d1Smrg$$1_PKG_ERRORS
158e73734d1Smrg
159e73734d1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
160e73734d1Smrginstalled software in a non-standard prefix.
161e73734d1Smrg
162e73734d1Smrg_PKG_TEXT])[]dnl
163e73734d1Smrg        ])
164e73734d1Smrgelif test $pkg_failed = untried; then
165e73734d1Smrg     	AC_MSG_RESULT([no])
166e73734d1Smrg	m4_default([$4], [AC_MSG_FAILURE(
167e73734d1Smrg[The pkg-config script could not be found or is too old.  Make sure it
168e73734d1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
169e73734d1Smrgpath to pkg-config.
170e73734d1Smrg
171e73734d1Smrg_PKG_TEXT
172e73734d1Smrg
173e73734d1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
174e73734d1Smrg        ])
175e73734d1Smrgelse
176e73734d1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
177e73734d1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
178e73734d1Smrg        AC_MSG_RESULT([yes])
179e73734d1Smrg	$3
180e73734d1Smrgfi[]dnl
181e73734d1Smrg])# PKG_CHECK_MODULES
182e73734d1Smrg
183e73734d1Smrg
184e73734d1Smrg# PKG_INSTALLDIR(DIRECTORY)
185e73734d1Smrg# -------------------------
186e73734d1Smrg# Substitutes the variable pkgconfigdir as the location where a module
187e73734d1Smrg# should install pkg-config .pc files. By default the directory is
188e73734d1Smrg# $libdir/pkgconfig, but the default can be changed by passing
189e73734d1Smrg# DIRECTORY. The user can override through the --with-pkgconfigdir
190e73734d1Smrg# parameter.
191e73734d1SmrgAC_DEFUN([PKG_INSTALLDIR],
192e73734d1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
193e73734d1Smrgm4_pushdef([pkg_description],
194e73734d1Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
195e73734d1SmrgAC_ARG_WITH([pkgconfigdir],
196e73734d1Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
197e73734d1Smrg    [with_pkgconfigdir=]pkg_default)
198e73734d1SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
199e73734d1Smrgm4_popdef([pkg_default])
200e73734d1Smrgm4_popdef([pkg_description])
201e73734d1Smrg]) dnl PKG_INSTALLDIR
202e73734d1Smrg
203e73734d1Smrg
204e73734d1Smrg# PKG_NOARCH_INSTALLDIR(DIRECTORY)
205e73734d1Smrg# -------------------------
206e73734d1Smrg# Substitutes the variable noarch_pkgconfigdir as the location where a
207e73734d1Smrg# module should install arch-independent pkg-config .pc files. By
208e73734d1Smrg# default the directory is $datadir/pkgconfig, but the default can be
209e73734d1Smrg# changed by passing DIRECTORY. The user can override through the
210e73734d1Smrg# --with-noarch-pkgconfigdir parameter.
211e73734d1SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
212e73734d1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
213e73734d1Smrgm4_pushdef([pkg_description],
214e73734d1Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
215e73734d1SmrgAC_ARG_WITH([noarch-pkgconfigdir],
216e73734d1Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
217e73734d1Smrg    [with_noarch_pkgconfigdir=]pkg_default)
218e73734d1SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
219e73734d1Smrgm4_popdef([pkg_default])
220e73734d1Smrgm4_popdef([pkg_description])
221e73734d1Smrg]) dnl PKG_NOARCH_INSTALLDIR
222e73734d1Smrg
223e73734d1Smrg
224e73734d1Smrg# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
225e73734d1Smrg# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
226e73734d1Smrg# -------------------------------------------
227e73734d1Smrg# Retrieves the value of the pkg-config variable for the given module.
228e73734d1SmrgAC_DEFUN([PKG_CHECK_VAR],
229e73734d1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
230e73734d1SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
231e73734d1Smrg
232e73734d1Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
233e73734d1SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
234e73734d1Smrg
235e73734d1SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
236e73734d1Smrg])# PKG_CHECK_VAR
237e73734d1Smrg
238e73734d1Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
239b1297603Smrg#
24033734831Smrg# This file is free software; the Free Software Foundation
24133734831Smrg# gives unlimited permission to copy and/or distribute it,
24233734831Smrg# with or without modifications, as long as this notice is preserved.
24354e0bb33Smrg
24433734831Smrg# AM_AUTOMAKE_VERSION(VERSION)
24533734831Smrg# ----------------------------
24633734831Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
24733734831Smrg# generated from the m4 files accompanying Automake X.Y.
24833734831Smrg# (This private macro should not be called outside this file.)
24933734831SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
250e73734d1Smrg[am__api_version='1.15'
25133734831Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
25233734831Smrgdnl require some minimum version.  Point them to the right macro.
253e73734d1Smrgm4_if([$1], [1.15], [],
25433734831Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
25533734831Smrg])
256b1297603Smrg
25733734831Smrg# _AM_AUTOCONF_VERSION(VERSION)
25833734831Smrg# -----------------------------
25933734831Smrg# aclocal traces this macro to find the Autoconf version.
26033734831Smrg# This is a private macro too.  Using m4_define simplifies
26133734831Smrg# the logic in aclocal, which can simply ignore this definition.
26233734831Smrgm4_define([_AM_AUTOCONF_VERSION], [])
263b1297603Smrg
26433734831Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
26533734831Smrg# -------------------------------
26633734831Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
26733734831Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
26833734831SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
269e73734d1Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
27033734831Smrgm4_ifndef([AC_AUTOCONF_VERSION],
27133734831Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
27233734831Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
273b1297603Smrg
27433734831Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
275b1297603Smrg
276e73734d1Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
27733734831Smrg#
27833734831Smrg# This file is free software; the Free Software Foundation
27933734831Smrg# gives unlimited permission to copy and/or distribute it,
28033734831Smrg# with or without modifications, as long as this notice is preserved.
281b1297603Smrg
28233734831Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
28333734831Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
28433734831Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
28533734831Smrg#
28633734831Smrg# Of course, Automake must honor this variable whenever it calls a
28733734831Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
28833734831Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
28933734831Smrg# depending on how configure is run.  This is pretty annoying, since
29033734831Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
29133734831Smrg# source directory, any form will work fine, but in subdirectories a
29233734831Smrg# relative path needs to be adjusted first.
293b1297603Smrg#
29433734831Smrg# $ac_aux_dir/missing
29533734831Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
29633734831Smrg# $top_srcdir/$ac_aux_dir/missing
29733734831Smrg#    fails if $ac_aux_dir is absolute,
29833734831Smrg#    fails when called from a subdirectory in a VPATH build with
29933734831Smrg#          a relative $ac_aux_dir
300b1297603Smrg#
30133734831Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
30233734831Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
30333734831Smrg# harmless because $srcdir is '.', but things will broke when you
30433734831Smrg# start a VPATH build or use an absolute $srcdir.
305b1297603Smrg#
30633734831Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
30733734831Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
30833734831Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
30933734831Smrg# and then we would define $MISSING as
31033734831Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
31133734831Smrg# This will work as long as MISSING is not called from configure, because
31233734831Smrg# unfortunately $(top_srcdir) has no meaning in configure.
31333734831Smrg# However there are other variables, like CC, which are often used in
31433734831Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
315b1297603Smrg#
31633734831Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
31733734831Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
31833734831Smrg# configured tree to be moved without reconfiguration.
319b1297603Smrg
32033734831SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
321e73734d1Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
322e73734d1Smrg# Expand $ac_aux_dir to an absolute path.
323e73734d1Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
32433734831Smrg])
325b1297603Smrg
32633734831Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
327b1297603Smrg
328e73734d1Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
32933734831Smrg#
33033734831Smrg# This file is free software; the Free Software Foundation
33133734831Smrg# gives unlimited permission to copy and/or distribute it,
33233734831Smrg# with or without modifications, as long as this notice is preserved.
333b1297603Smrg
33433734831Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
33533734831Smrg# -------------------------------------
33633734831Smrg# Define a conditional.
33733734831SmrgAC_DEFUN([AM_CONDITIONAL],
33833734831Smrg[AC_PREREQ([2.52])dnl
33933734831Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
34033734831Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
34133734831SmrgAC_SUBST([$1_TRUE])dnl
34233734831SmrgAC_SUBST([$1_FALSE])dnl
34333734831Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
34433734831Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
34533734831Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
34633734831Smrgif $2; then
34733734831Smrg  $1_TRUE=
34833734831Smrg  $1_FALSE='#'
34933734831Smrgelse
35033734831Smrg  $1_TRUE='#'
35133734831Smrg  $1_FALSE=
35233734831Smrgfi
35333734831SmrgAC_CONFIG_COMMANDS_PRE(
35433734831Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
35533734831Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
35633734831SmrgUsually this means the macro was only invoked conditionally.]])
35733734831Smrgfi])])
358b1297603Smrg
359e73734d1Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
36033734831Smrg#
36133734831Smrg# This file is free software; the Free Software Foundation
36233734831Smrg# gives unlimited permission to copy and/or distribute it,
36333734831Smrg# with or without modifications, as long as this notice is preserved.
364b1297603Smrg
365b1297603Smrg
36633734831Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
36733734831Smrg# written in clear, in which case automake, when reading aclocal.m4,
36833734831Smrg# will think it sees a *use*, and therefore will trigger all it's
36933734831Smrg# C support machinery.  Also note that it means that autoscan, seeing
37033734831Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
371b1297603Smrg
372b1297603Smrg
37333734831Smrg# _AM_DEPENDENCIES(NAME)
37433734831Smrg# ----------------------
37533734831Smrg# See how the compiler implements dependency checking.
37633734831Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
37733734831Smrg# We try a few techniques and use that to set a single cache variable.
37833734831Smrg#
37933734831Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
38033734831Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
38133734831Smrg# dependency, and given that the user is not expected to run this macro,
38233734831Smrg# just rely on AC_PROG_CC.
38333734831SmrgAC_DEFUN([_AM_DEPENDENCIES],
38433734831Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
38533734831SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
38633734831SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
38733734831SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
388b1297603Smrg
38933734831Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
39033734831Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
39133734831Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
39233734831Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
39333734831Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
39433734831Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
39533734831Smrg                    [depcc="$$1"   am_compiler_list=])
396b1297603Smrg
39733734831SmrgAC_CACHE_CHECK([dependency style of $depcc],
39833734831Smrg               [am_cv_$1_dependencies_compiler_type],
39933734831Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
40033734831Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
40133734831Smrg  # making bogus files that we don't know about and never remove.  For
40233734831Smrg  # instance it was reported that on HP-UX the gcc test will end up
40333734831Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
40433734831Smrg  # in D".
40533734831Smrg  rm -rf conftest.dir
40633734831Smrg  mkdir conftest.dir
40733734831Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
40833734831Smrg  # using a relative directory.
40933734831Smrg  cp "$am_depcomp" conftest.dir
41033734831Smrg  cd conftest.dir
41133734831Smrg  # We will build objects and dependencies in a subdirectory because
41233734831Smrg  # it helps to detect inapplicable dependency modes.  For instance
41333734831Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
41433734831Smrg  # side effect of compilation, but ICC will put the dependencies in
41533734831Smrg  # the current directory while Tru64 will put them in the object
41633734831Smrg  # directory.
41733734831Smrg  mkdir sub
418cea37944Smrg
41933734831Smrg  am_cv_$1_dependencies_compiler_type=none
42033734831Smrg  if test "$am_compiler_list" = ""; then
42133734831Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
42233734831Smrg  fi
42333734831Smrg  am__universal=false
42433734831Smrg  m4_case([$1], [CC],
42533734831Smrg    [case " $depcc " in #(
42633734831Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
42733734831Smrg     esac],
42833734831Smrg    [CXX],
42933734831Smrg    [case " $depcc " in #(
43033734831Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
43133734831Smrg     esac])
432cea37944Smrg
43333734831Smrg  for depmode in $am_compiler_list; do
43433734831Smrg    # Setup a source with many dependencies, because some compilers
43533734831Smrg    # like to wrap large dependency lists on column 80 (with \), and
43633734831Smrg    # we should not choose a depcomp mode which is confused by this.
43733734831Smrg    #
43833734831Smrg    # We need to recreate these files for each test, as the compiler may
43933734831Smrg    # overwrite some of them when testing with obscure command lines.
44033734831Smrg    # This happens at least with the AIX C compiler.
44133734831Smrg    : > sub/conftest.c
44233734831Smrg    for i in 1 2 3 4 5 6; do
44333734831Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
44433734831Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
44533734831Smrg      # Solaris 10 /bin/sh.
44633734831Smrg      echo '/* dummy */' > sub/conftst$i.h
44733734831Smrg    done
44833734831Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
449b1297603Smrg
45033734831Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
45133734831Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
45233734831Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
45333734831Smrg    # versions had trouble with output in subdirs.
45433734831Smrg    am__obj=sub/conftest.${OBJEXT-o}
45533734831Smrg    am__minus_obj="-o $am__obj"
45633734831Smrg    case $depmode in
45733734831Smrg    gcc)
45833734831Smrg      # This depmode causes a compiler race in universal mode.
45933734831Smrg      test "$am__universal" = false || continue
46033734831Smrg      ;;
46133734831Smrg    nosideeffect)
46233734831Smrg      # After this tag, mechanisms are not by side-effect, so they'll
46333734831Smrg      # only be used when explicitly requested.
46433734831Smrg      if test "x$enable_dependency_tracking" = xyes; then
46533734831Smrg	continue
46633734831Smrg      else
46733734831Smrg	break
46833734831Smrg      fi
46933734831Smrg      ;;
47033734831Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
47133734831Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
47233734831Smrg      # not run yet.  These depmodes are late enough in the game, and
47333734831Smrg      # so weak that their functioning should not be impacted.
47433734831Smrg      am__obj=conftest.${OBJEXT-o}
47533734831Smrg      am__minus_obj=
47633734831Smrg      ;;
47733734831Smrg    none) break ;;
47833734831Smrg    esac
47933734831Smrg    if depmode=$depmode \
48033734831Smrg       source=sub/conftest.c object=$am__obj \
48133734831Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
48233734831Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
48333734831Smrg         >/dev/null 2>conftest.err &&
48433734831Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
48533734831Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
48633734831Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
48733734831Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
48833734831Smrg      # icc doesn't choke on unknown options, it will just issue warnings
48933734831Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
49033734831Smrg      # that says an option was ignored or not supported.
49133734831Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
49233734831Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
49333734831Smrg      # The diagnosis changed in icc 8.0:
49433734831Smrg      #   icc: Command line remark: option '-MP' not supported
49533734831Smrg      if (grep 'ignoring option' conftest.err ||
49633734831Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
49733734831Smrg        am_cv_$1_dependencies_compiler_type=$depmode
49833734831Smrg        break
49933734831Smrg      fi
50033734831Smrg    fi
50133734831Smrg  done
502b1297603Smrg
50333734831Smrg  cd ..
50433734831Smrg  rm -rf conftest.dir
505b1297603Smrgelse
50633734831Smrg  am_cv_$1_dependencies_compiler_type=none
507b1297603Smrgfi
50833734831Smrg])
50933734831SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
51033734831SmrgAM_CONDITIONAL([am__fastdep$1], [
51133734831Smrg  test "x$enable_dependency_tracking" != xno \
51233734831Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
51333734831Smrg])
514b1297603Smrg
515b1297603Smrg
51633734831Smrg# AM_SET_DEPDIR
51733734831Smrg# -------------
51833734831Smrg# Choose a directory name for dependency files.
51933734831Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
52033734831SmrgAC_DEFUN([AM_SET_DEPDIR],
52133734831Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
52233734831SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
52333734831Smrg])
524b1297603Smrg
525b1297603Smrg
52633734831Smrg# AM_DEP_TRACK
52733734831Smrg# ------------
52833734831SmrgAC_DEFUN([AM_DEP_TRACK],
52933734831Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
53033734831SmrgAS_HELP_STRING(
53133734831Smrg  [--enable-dependency-tracking],
53233734831Smrg  [do not reject slow dependency extractors])
53333734831SmrgAS_HELP_STRING(
53433734831Smrg  [--disable-dependency-tracking],
53533734831Smrg  [speeds up one-time build])])
53633734831Smrgif test "x$enable_dependency_tracking" != xno; then
53733734831Smrg  am_depcomp="$ac_aux_dir/depcomp"
53833734831Smrg  AMDEPBACKSLASH='\'
53933734831Smrg  am__nodep='_no'
54054e0bb33Smrgfi
54133734831SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
54233734831SmrgAC_SUBST([AMDEPBACKSLASH])dnl
54333734831Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
54433734831SmrgAC_SUBST([am__nodep])dnl
54533734831Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
54633734831Smrg])
547b1297603Smrg
54833734831Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
549b1297603Smrg
550e73734d1Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
55133734831Smrg#
55233734831Smrg# This file is free software; the Free Software Foundation
55333734831Smrg# gives unlimited permission to copy and/or distribute it,
55433734831Smrg# with or without modifications, as long as this notice is preserved.
555b1297603Smrg
55654e0bb33Smrg
55733734831Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
55833734831Smrg# ------------------------------
55933734831SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
56033734831Smrg[{
56133734831Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
56233734831Smrg  # are listed without --file.  Let's play safe and only enable the eval
56333734831Smrg  # if we detect the quoting.
56433734831Smrg  case $CONFIG_FILES in
56533734831Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
56633734831Smrg  *)   set x $CONFIG_FILES ;;
56733734831Smrg  esac
56833734831Smrg  shift
56933734831Smrg  for mf
57033734831Smrg  do
57133734831Smrg    # Strip MF so we end up with the name of the file.
57233734831Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
57333734831Smrg    # Check whether this is an Automake generated Makefile or not.
57433734831Smrg    # We used to match only the files named 'Makefile.in', but
57533734831Smrg    # some people rename them; so instead we look at the file content.
57633734831Smrg    # Grep'ing the first line is not enough: some people post-process
57733734831Smrg    # each Makefile.in and add a new line on top of each file to say so.
57833734831Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
57933734831Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
58033734831Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
58133734831Smrg      dirpart=`AS_DIRNAME("$mf")`
58233734831Smrg    else
58333734831Smrg      continue
58433734831Smrg    fi
58533734831Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
58633734831Smrg    # from the Makefile without running 'make'.
58733734831Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
58833734831Smrg    test -z "$DEPDIR" && continue
58933734831Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
59033734831Smrg    test -z "$am__include" && continue
59133734831Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
59233734831Smrg    # Find all dependency output files, they are included files with
59333734831Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
59433734831Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
59533734831Smrg    # expansion.
59633734831Smrg    for file in `sed -n "
59733734831Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
59833734831Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
59933734831Smrg      # Make sure the directory exists.
60033734831Smrg      test -f "$dirpart/$file" && continue
60133734831Smrg      fdir=`AS_DIRNAME(["$file"])`
60233734831Smrg      AS_MKDIR_P([$dirpart/$fdir])
60333734831Smrg      # echo "creating $dirpart/$file"
60433734831Smrg      echo '# dummy' > "$dirpart/$file"
60533734831Smrg    done
60633734831Smrg  done
60733734831Smrg}
60833734831Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
60954e0bb33Smrg
61054e0bb33Smrg
61133734831Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
61233734831Smrg# -----------------------------
61333734831Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
61454e0bb33Smrg#
61533734831Smrg# This code is only required when automatic dependency tracking
61633734831Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
61733734831Smrg# need in order to bootstrap the dependency handling code.
61833734831SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
61933734831Smrg[AC_CONFIG_COMMANDS([depfiles],
62033734831Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
62133734831Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
62233734831Smrg])
623b1297603Smrg
62433734831Smrg# Do all the work for Automake.                             -*- Autoconf -*-
625b1297603Smrg
626e73734d1Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
62754e0bb33Smrg#
62833734831Smrg# This file is free software; the Free Software Foundation
62933734831Smrg# gives unlimited permission to copy and/or distribute it,
63033734831Smrg# with or without modifications, as long as this notice is preserved.
6315b944e2aSmrg
63233734831Smrg# This macro actually does too much.  Some checks are only needed if
63333734831Smrg# your package does certain things.  But this isn't really a big deal.
634b1297603Smrg
635e73734d1Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
636e73734d1Smrgm4_define([AC_PROG_CC],
637e73734d1Smrgm4_defn([AC_PROG_CC])
638e73734d1Smrg[_AM_PROG_CC_C_O
639e73734d1Smrg])
640e73734d1Smrg
64133734831Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
64233734831Smrg# AM_INIT_AUTOMAKE([OPTIONS])
64333734831Smrg# -----------------------------------------------
64433734831Smrg# The call with PACKAGE and VERSION arguments is the old style
64533734831Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
64633734831Smrg# and VERSION should now be passed to AC_INIT and removed from
64733734831Smrg# the call to AM_INIT_AUTOMAKE.
64833734831Smrg# We support both call styles for the transition.  After
64933734831Smrg# the next Automake release, Autoconf can make the AC_INIT
65033734831Smrg# arguments mandatory, and then we can depend on a new Autoconf
65133734831Smrg# release and drop the old call support.
65233734831SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
65333734831Smrg[AC_PREREQ([2.65])dnl
65433734831Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
65533734831Smrgdnl the ones we care about.
65633734831Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
65733734831SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
65833734831SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
65933734831Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
66033734831Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
66133734831Smrg  # is not polluted with repeated "-I."
66233734831Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
66333734831Smrg  # test to see if srcdir already configured
66433734831Smrg  if test -f $srcdir/config.status; then
66533734831Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
66633734831Smrg  fi
66753719b08Smrgfi
668b1297603Smrg
66933734831Smrg# test whether we have cygpath
67033734831Smrgif test -z "$CYGPATH_W"; then
67133734831Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
67233734831Smrg    CYGPATH_W='cygpath -w'
67333734831Smrg  else
67433734831Smrg    CYGPATH_W=echo
67533734831Smrg  fi
67633734831Smrgfi
67733734831SmrgAC_SUBST([CYGPATH_W])
678b1297603Smrg
67933734831Smrg# Define the identity of the package.
68033734831Smrgdnl Distinguish between old-style and new-style calls.
68133734831Smrgm4_ifval([$2],
68233734831Smrg[AC_DIAGNOSE([obsolete],
68333734831Smrg             [$0: two- and three-arguments forms are deprecated.])
68433734831Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
68533734831Smrg AC_SUBST([PACKAGE], [$1])dnl
68633734831Smrg AC_SUBST([VERSION], [$2])],
68733734831Smrg[_AM_SET_OPTIONS([$1])dnl
68833734831Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
68933734831Smrgm4_if(
69033734831Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
69133734831Smrg  [ok:ok],,
69233734831Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
69333734831Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
69433734831Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
695b1297603Smrg
69633734831Smrg_AM_IF_OPTION([no-define],,
69733734831Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
69833734831Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
699cea37944Smrg
70033734831Smrg# Some tools Automake needs.
70133734831SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
70233734831SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
70333734831SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
70433734831SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
70533734831SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
70633734831SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
70733734831SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
70833734831SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
70933734831SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
71033734831SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
71133734831Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
71233734831Smrg# dies out for good.  For more background, see:
71333734831Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
71433734831Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
71533734831SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
716e73734d1Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
717e73734d1Smrg# system "awk" is bad on some platforms.
71833734831SmrgAC_REQUIRE([AC_PROG_AWK])dnl
71933734831SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
72033734831SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
72133734831Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
72233734831Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
72333734831Smrg			     [_AM_PROG_TAR([v7])])])
72433734831Smrg_AM_IF_OPTION([no-dependencies],,
72533734831Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
72633734831Smrg		  [_AM_DEPENDENCIES([CC])],
72733734831Smrg		  [m4_define([AC_PROG_CC],
72833734831Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
72933734831SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
73033734831Smrg		  [_AM_DEPENDENCIES([CXX])],
73133734831Smrg		  [m4_define([AC_PROG_CXX],
73233734831Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
73333734831SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
73433734831Smrg		  [_AM_DEPENDENCIES([OBJC])],
73533734831Smrg		  [m4_define([AC_PROG_OBJC],
73633734831Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
73733734831SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
73833734831Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
73933734831Smrg		  [m4_define([AC_PROG_OBJCXX],
74033734831Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
74133734831Smrg])
74233734831SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
74333734831Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
74433734831Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
74533734831Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
74633734831SmrgAC_CONFIG_COMMANDS_PRE(dnl
74733734831Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
74833734831Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
749e73734d1Smrg
750e73734d1Smrg# POSIX will say in a future version that running "rm -f" with no argument
751e73734d1Smrg# is OK; and we want to be able to make that assumption in our Makefile
752e73734d1Smrg# recipes.  So use an aggressive probe to check that the usage we want is
753e73734d1Smrg# actually supported "in the wild" to an acceptable degree.
754e73734d1Smrg# See automake bug#10828.
755e73734d1Smrg# To make any issue more visible, cause the running configure to be aborted
756e73734d1Smrg# by default if the 'rm' program in use doesn't match our expectations; the
757e73734d1Smrg# user can still override this though.
758e73734d1Smrgif rm -f && rm -fr && rm -rf; then : OK; else
759e73734d1Smrg  cat >&2 <<'END'
760e73734d1SmrgOops!
761e73734d1Smrg
762e73734d1SmrgYour 'rm' program seems unable to run without file operands specified
763e73734d1Smrgon the command line, even when the '-f' option is present.  This is contrary
764e73734d1Smrgto the behaviour of most rm programs out there, and not conforming with
765e73734d1Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
766e73734d1Smrg
767e73734d1SmrgPlease tell bug-automake@gnu.org about your system, including the value
768e73734d1Smrgof your $PATH and any error possibly output before this message.  This
769e73734d1Smrgcan help us improve future automake versions.
770e73734d1Smrg
771e73734d1SmrgEND
772e73734d1Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
773e73734d1Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
774e73734d1Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
775e73734d1Smrg    echo >&2
776e73734d1Smrg  else
777e73734d1Smrg    cat >&2 <<'END'
778e73734d1SmrgAborting the configuration process, to ensure you take notice of the issue.
779e73734d1Smrg
780e73734d1SmrgYou can download and install GNU coreutils to get an 'rm' implementation
781e73734d1Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
782e73734d1Smrg
783e73734d1SmrgIf you want to complete the configuration process using your problematic
784e73734d1Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
785e73734d1Smrgto "yes", and re-run configure.
786e73734d1Smrg
787e73734d1SmrgEND
788e73734d1Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
789e73734d1Smrg  fi
790e73734d1Smrgfi
791e73734d1Smrgdnl The trailing newline in this macro's definition is deliberate, for
792e73734d1Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
793e73734d1Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
79433734831Smrg])
795cea37944Smrg
79633734831Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
79733734831Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
79833734831Smrgdnl mangled by Autoconf and run in a shell conditional statement.
79933734831Smrgm4_define([_AC_COMPILER_EXEEXT],
80033734831Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
801cea37944Smrg
80233734831Smrg# When config.status generates a header, we must update the stamp-h file.
80333734831Smrg# This file resides in the same directory as the config header
80433734831Smrg# that is generated.  The stamp files are numbered to have different names.
805cea37944Smrg
80633734831Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
80733734831Smrg# loop where config.status creates the headers, so we can generate
80833734831Smrg# our stamp files there.
80933734831SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
81033734831Smrg[# Compute $1's index in $config_headers.
81133734831Smrg_am_arg=$1
81233734831Smrg_am_stamp_count=1
81333734831Smrgfor _am_header in $config_headers :; do
81433734831Smrg  case $_am_header in
81533734831Smrg    $_am_arg | $_am_arg:* )
81633734831Smrg      break ;;
81733734831Smrg    * )
81833734831Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
81933734831Smrg  esac
82033734831Smrgdone
82133734831Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
822cea37944Smrg
823e73734d1Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
82433734831Smrg#
82533734831Smrg# This file is free software; the Free Software Foundation
82633734831Smrg# gives unlimited permission to copy and/or distribute it,
82733734831Smrg# with or without modifications, as long as this notice is preserved.
828cea37944Smrg
82933734831Smrg# AM_PROG_INSTALL_SH
83033734831Smrg# ------------------
83133734831Smrg# Define $install_sh.
83233734831SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
83333734831Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
834e73734d1Smrgif test x"${install_sh+set}" != xset; then
83533734831Smrg  case $am_aux_dir in
83633734831Smrg  *\ * | *\	*)
83733734831Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
83833734831Smrg  *)
83933734831Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
84033734831Smrg  esac
84153719b08Smrgfi
84233734831SmrgAC_SUBST([install_sh])])
843b1297603Smrg
844e73734d1Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
84533734831Smrg#
84633734831Smrg# This file is free software; the Free Software Foundation
84733734831Smrg# gives unlimited permission to copy and/or distribute it,
84833734831Smrg# with or without modifications, as long as this notice is preserved.
849cea37944Smrg
85033734831Smrg# Check whether the underlying file-system supports filenames
85133734831Smrg# with a leading dot.  For instance MS-DOS doesn't.
85233734831SmrgAC_DEFUN([AM_SET_LEADING_DOT],
85333734831Smrg[rm -rf .tst 2>/dev/null
85433734831Smrgmkdir .tst 2>/dev/null
85533734831Smrgif test -d .tst; then
85633734831Smrg  am__leading_dot=.
85733734831Smrgelse
85833734831Smrg  am__leading_dot=_
85954e0bb33Smrgfi
86033734831Smrgrmdir .tst 2>/dev/null
86133734831SmrgAC_SUBST([am__leading_dot])])
862cea37944Smrg
86333734831Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
86433734831Smrg
865e73734d1Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
86654e0bb33Smrg#
86733734831Smrg# This file is free software; the Free Software Foundation
86833734831Smrg# gives unlimited permission to copy and/or distribute it,
86933734831Smrg# with or without modifications, as long as this notice is preserved.
870cea37944Smrg
87133734831Smrg# AM_MAKE_INCLUDE()
87233734831Smrg# -----------------
87333734831Smrg# Check to see how make treats includes.
87433734831SmrgAC_DEFUN([AM_MAKE_INCLUDE],
87533734831Smrg[am_make=${MAKE-make}
87633734831Smrgcat > confinc << 'END'
87733734831Smrgam__doit:
87833734831Smrg	@echo this is the am__doit target
87933734831Smrg.PHONY: am__doit
88033734831SmrgEND
88133734831Smrg# If we don't find an include directive, just comment out the code.
88233734831SmrgAC_MSG_CHECKING([for style of include used by $am_make])
88333734831Smrgam__include="#"
88433734831Smrgam__quote=
88533734831Smrg_am_result=none
88633734831Smrg# First try GNU make style include.
88733734831Smrgecho "include confinc" > confmf
88833734831Smrg# Ignore all kinds of additional output from 'make'.
88933734831Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
89033734831Smrg*the\ am__doit\ target*)
89133734831Smrg  am__include=include
89233734831Smrg  am__quote=
89333734831Smrg  _am_result=GNU
89433734831Smrg  ;;
89533734831Smrgesac
89633734831Smrg# Now try BSD make style include.
89733734831Smrgif test "$am__include" = "#"; then
89833734831Smrg   echo '.include "confinc"' > confmf
89933734831Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
90033734831Smrg   *the\ am__doit\ target*)
90133734831Smrg     am__include=.include
90233734831Smrg     am__quote="\""
90333734831Smrg     _am_result=BSD
90433734831Smrg     ;;
90533734831Smrg   esac
90653719b08Smrgfi
90733734831SmrgAC_SUBST([am__include])
90833734831SmrgAC_SUBST([am__quote])
90933734831SmrgAC_MSG_RESULT([$_am_result])
91033734831Smrgrm -f confinc confmf
91133734831Smrg])
912cea37944Smrg
91333734831Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
914cea37944Smrg
915e73734d1Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
9160309d3b3Smrg#
91733734831Smrg# This file is free software; the Free Software Foundation
91833734831Smrg# gives unlimited permission to copy and/or distribute it,
91933734831Smrg# with or without modifications, as long as this notice is preserved.
9200309d3b3Smrg
92133734831Smrg# AM_MISSING_PROG(NAME, PROGRAM)
92233734831Smrg# ------------------------------
92333734831SmrgAC_DEFUN([AM_MISSING_PROG],
92433734831Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
92533734831Smrg$1=${$1-"${am_missing_run}$2"}
92633734831SmrgAC_SUBST($1)])
92733734831Smrg
92833734831Smrg# AM_MISSING_HAS_RUN
92933734831Smrg# ------------------
93033734831Smrg# Define MISSING if not defined so far and test if it is modern enough.
93133734831Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
93233734831SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
93333734831Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
93433734831SmrgAC_REQUIRE_AUX_FILE([missing])dnl
93533734831Smrgif test x"${MISSING+set}" != xset; then
93633734831Smrg  case $am_aux_dir in
93733734831Smrg  *\ * | *\	*)
93833734831Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
93933734831Smrg  *)
94033734831Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
94133734831Smrg  esac
94233734831Smrgfi
94333734831Smrg# Use eval to expand $SHELL
94433734831Smrgif eval "$MISSING --is-lightweight"; then
94533734831Smrg  am_missing_run="$MISSING "
9460309d3b3Smrgelse
94733734831Smrg  am_missing_run=
94833734831Smrg  AC_MSG_WARN(['missing' script is too old or missing])
9490309d3b3Smrgfi
95033734831Smrg])
9510309d3b3Smrg
95233734831Smrg# Helper functions for option handling.                     -*- Autoconf -*-
9530309d3b3Smrg
954e73734d1Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
9550309d3b3Smrg#
95633734831Smrg# This file is free software; the Free Software Foundation
95733734831Smrg# gives unlimited permission to copy and/or distribute it,
95833734831Smrg# with or without modifications, as long as this notice is preserved.
9590309d3b3Smrg
96033734831Smrg# _AM_MANGLE_OPTION(NAME)
96133734831Smrg# -----------------------
96233734831SmrgAC_DEFUN([_AM_MANGLE_OPTION],
96333734831Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
9640309d3b3Smrg
96533734831Smrg# _AM_SET_OPTION(NAME)
96633734831Smrg# --------------------
96733734831Smrg# Set option NAME.  Presently that only means defining a flag for this option.
96833734831SmrgAC_DEFUN([_AM_SET_OPTION],
96933734831Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
9700309d3b3Smrg
97133734831Smrg# _AM_SET_OPTIONS(OPTIONS)
97233734831Smrg# ------------------------
97333734831Smrg# OPTIONS is a space-separated list of Automake options.
97433734831SmrgAC_DEFUN([_AM_SET_OPTIONS],
97533734831Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
97633734831Smrg
97733734831Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
97833734831Smrg# -------------------------------------------
97933734831Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
98033734831SmrgAC_DEFUN([_AM_IF_OPTION],
98133734831Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
98233734831Smrg
983e73734d1Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
984e73734d1Smrg#
985e73734d1Smrg# This file is free software; the Free Software Foundation
986e73734d1Smrg# gives unlimited permission to copy and/or distribute it,
987e73734d1Smrg# with or without modifications, as long as this notice is preserved.
988e73734d1Smrg
989e73734d1Smrg# _AM_PROG_CC_C_O
990e73734d1Smrg# ---------------
991e73734d1Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
992e73734d1Smrg# to automatically call this.
993e73734d1SmrgAC_DEFUN([_AM_PROG_CC_C_O],
994e73734d1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
995e73734d1SmrgAC_REQUIRE_AUX_FILE([compile])dnl
996e73734d1SmrgAC_LANG_PUSH([C])dnl
997e73734d1SmrgAC_CACHE_CHECK(
998e73734d1Smrg  [whether $CC understands -c and -o together],
999e73734d1Smrg  [am_cv_prog_cc_c_o],
1000e73734d1Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
1001e73734d1Smrg  # Make sure it works both with $CC and with simple cc.
1002e73734d1Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
1003e73734d1Smrg  # compilers refuse to overwrite an existing .o file with -o,
1004e73734d1Smrg  # though they will create one.
1005e73734d1Smrg  am_cv_prog_cc_c_o=yes
1006e73734d1Smrg  for am_i in 1 2; do
1007e73734d1Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
1008e73734d1Smrg         && test -f conftest2.$ac_objext; then
1009e73734d1Smrg      : OK
1010e73734d1Smrg    else
1011e73734d1Smrg      am_cv_prog_cc_c_o=no
1012e73734d1Smrg      break
1013e73734d1Smrg    fi
1014e73734d1Smrg  done
1015e73734d1Smrg  rm -f core conftest*
1016e73734d1Smrg  unset am_i])
1017e73734d1Smrgif test "$am_cv_prog_cc_c_o" != yes; then
1018e73734d1Smrg   # Losing compiler, so override with the script.
1019e73734d1Smrg   # FIXME: It is wrong to rewrite CC.
1020e73734d1Smrg   # But if we don't then we get into trouble of one sort or another.
1021e73734d1Smrg   # A longer-term fix would be to have automake use am__CC in this case,
1022e73734d1Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
1023e73734d1Smrg   CC="$am_aux_dir/compile $CC"
1024e73734d1Smrgfi
1025e73734d1SmrgAC_LANG_POP([C])])
1026e73734d1Smrg
1027e73734d1Smrg# For backward compatibility.
1028e73734d1SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
1029e73734d1Smrg
1030e73734d1Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
1031e73734d1Smrg#
1032e73734d1Smrg# This file is free software; the Free Software Foundation
1033e73734d1Smrg# gives unlimited permission to copy and/or distribute it,
1034e73734d1Smrg# with or without modifications, as long as this notice is preserved.
1035e73734d1Smrg
1036e73734d1Smrg# AM_RUN_LOG(COMMAND)
1037e73734d1Smrg# -------------------
1038e73734d1Smrg# Run COMMAND, save the exit status in ac_status, and log it.
1039e73734d1Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
1040e73734d1SmrgAC_DEFUN([AM_RUN_LOG],
1041e73734d1Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
1042e73734d1Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
1043e73734d1Smrg   ac_status=$?
1044e73734d1Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1045e73734d1Smrg   (exit $ac_status); }])
1046e73734d1Smrg
104733734831Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
104833734831Smrg
1049e73734d1Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
105054e0bb33Smrg#
105133734831Smrg# This file is free software; the Free Software Foundation
105233734831Smrg# gives unlimited permission to copy and/or distribute it,
105333734831Smrg# with or without modifications, as long as this notice is preserved.
1054cea37944Smrg
105533734831Smrg# AM_SANITY_CHECK
105633734831Smrg# ---------------
105733734831SmrgAC_DEFUN([AM_SANITY_CHECK],
105833734831Smrg[AC_MSG_CHECKING([whether build environment is sane])
105933734831Smrg# Reject unsafe characters in $srcdir or the absolute working directory
106033734831Smrg# name.  Accept space and tab only in the latter.
106133734831Smrgam_lf='
106233734831Smrg'
106333734831Smrgcase `pwd` in
106433734831Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
106533734831Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
106633734831Smrgesac
106733734831Smrgcase $srcdir in
106833734831Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
106933734831Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
107033734831Smrgesac
107133734831Smrg
107233734831Smrg# Do 'set' in a subshell so we don't clobber the current shell's
107333734831Smrg# arguments.  Must try -L first in case configure is actually a
107433734831Smrg# symlink; some systems play weird games with the mod time of symlinks
107533734831Smrg# (eg FreeBSD returns the mod time of the symlink's containing
107633734831Smrg# directory).
107733734831Smrgif (
107833734831Smrg   am_has_slept=no
107933734831Smrg   for am_try in 1 2; do
108033734831Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
108133734831Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
108233734831Smrg     if test "$[*]" = "X"; then
108333734831Smrg	# -L didn't work.
108433734831Smrg	set X `ls -t "$srcdir/configure" conftest.file`
108533734831Smrg     fi
108633734831Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
108733734831Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
108833734831Smrg
108933734831Smrg	# If neither matched, then we have a broken ls.  This can happen
109033734831Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
109133734831Smrg	# broken ls alias from the environment.  This has actually
109233734831Smrg	# happened.  Such a system could not be considered "sane".
109333734831Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
109433734831Smrg  alias in your environment])
109533734831Smrg     fi
109633734831Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
109733734831Smrg       break
109833734831Smrg     fi
109933734831Smrg     # Just in case.
110033734831Smrg     sleep 1
110133734831Smrg     am_has_slept=yes
110233734831Smrg   done
110333734831Smrg   test "$[2]" = conftest.file
110433734831Smrg   )
110533734831Smrgthen
110633734831Smrg   # Ok.
110733734831Smrg   :
110854e0bb33Smrgelse
110933734831Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
111033734831SmrgCheck your system clock])
111153719b08Smrgfi
111233734831SmrgAC_MSG_RESULT([yes])
111333734831Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
111433734831Smrg# generated files are strictly newer.
111533734831Smrgam_sleep_pid=
111633734831Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
111733734831Smrg  ( sleep 1 ) &
111833734831Smrg  am_sleep_pid=$!
111933734831Smrgfi
112033734831SmrgAC_CONFIG_COMMANDS_PRE(
112133734831Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
112233734831Smrg   if test -n "$am_sleep_pid"; then
112333734831Smrg     # Hide warnings about reused PIDs.
112433734831Smrg     wait $am_sleep_pid 2>/dev/null
112533734831Smrg   fi
112633734831Smrg   AC_MSG_RESULT([done])])
112733734831Smrgrm -f conftest.file
112833734831Smrg])
11295b944e2aSmrg
1130e73734d1Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
113154e0bb33Smrg#
113233734831Smrg# This file is free software; the Free Software Foundation
113333734831Smrg# gives unlimited permission to copy and/or distribute it,
113433734831Smrg# with or without modifications, as long as this notice is preserved.
1135cea37944Smrg
113633734831Smrg# AM_SILENT_RULES([DEFAULT])
113733734831Smrg# --------------------------
113833734831Smrg# Enable less verbose build rules; with the default set to DEFAULT
113933734831Smrg# ("yes" being less verbose, "no" or empty being verbose).
114033734831SmrgAC_DEFUN([AM_SILENT_RULES],
114133734831Smrg[AC_ARG_ENABLE([silent-rules], [dnl
114233734831SmrgAS_HELP_STRING(
114333734831Smrg  [--enable-silent-rules],
114433734831Smrg  [less verbose build output (undo: "make V=1")])
114533734831SmrgAS_HELP_STRING(
114633734831Smrg  [--disable-silent-rules],
114733734831Smrg  [verbose build output (undo: "make V=0")])dnl
114833734831Smrg])
114933734831Smrgcase $enable_silent_rules in @%:@ (((
115033734831Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
115133734831Smrg   no) AM_DEFAULT_VERBOSITY=1;;
115233734831Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
115333734831Smrgesac
115433734831Smrgdnl
115533734831Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
115633734831Smrgdnl do not support nested variable expansions.
115733734831Smrgdnl See automake bug#9928 and bug#10237.
115833734831Smrgam_make=${MAKE-make}
115933734831SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
116033734831Smrg   [am_cv_make_support_nested_variables],
116133734831Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
116233734831SmrgBAR0=false
116333734831SmrgBAR1=true
116433734831SmrgV=1
116533734831Smrgam__doit:
116633734831Smrg	@$(TRUE)
116733734831Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
116833734831Smrg  am_cv_make_support_nested_variables=yes
1169b1297603Smrgelse
117033734831Smrg  am_cv_make_support_nested_variables=no
117154e0bb33Smrgfi])
117233734831Smrgif test $am_cv_make_support_nested_variables = yes; then
117333734831Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
117433734831Smrg  AM_V='$(V)'
117533734831Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
117633734831Smrgelse
117733734831Smrg  AM_V=$AM_DEFAULT_VERBOSITY
117833734831Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
117933734831Smrgfi
118033734831SmrgAC_SUBST([AM_V])dnl
118133734831SmrgAM_SUBST_NOTMAKE([AM_V])dnl
118233734831SmrgAC_SUBST([AM_DEFAULT_V])dnl
118333734831SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
118433734831SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
118533734831SmrgAM_BACKSLASH='\'
118633734831SmrgAC_SUBST([AM_BACKSLASH])dnl
118733734831Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
118833734831Smrg])
1189b1297603Smrg
1190e73734d1Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
119153719b08Smrg#
119233734831Smrg# This file is free software; the Free Software Foundation
119333734831Smrg# gives unlimited permission to copy and/or distribute it,
119433734831Smrg# with or without modifications, as long as this notice is preserved.
119533734831Smrg
119633734831Smrg# AM_PROG_INSTALL_STRIP
119733734831Smrg# ---------------------
119833734831Smrg# One issue with vendor 'install' (even GNU) is that you can't
119933734831Smrg# specify the program used to strip binaries.  This is especially
120033734831Smrg# annoying in cross-compiling environments, where the build's strip
120133734831Smrg# is unlikely to handle the host's binaries.
120233734831Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
120333734831Smrg# always use install-sh in "make install-strip", and initialize
120433734831Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
120533734831SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
120633734831Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
120733734831Smrg# Installed binaries are usually stripped using 'strip' when the user
120833734831Smrg# run "make install-strip".  However 'strip' might not be the right
120933734831Smrg# tool to use in cross-compilation environments, therefore Automake
121033734831Smrg# will honor the 'STRIP' environment variable to overrule this program.
121133734831Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
121233734831Smrgif test "$cross_compiling" != no; then
121333734831Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
121433734831Smrgfi
121533734831SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
121633734831SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
121733734831Smrg
1218e73734d1Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
121954e0bb33Smrg#
122033734831Smrg# This file is free software; the Free Software Foundation
122133734831Smrg# gives unlimited permission to copy and/or distribute it,
122233734831Smrg# with or without modifications, as long as this notice is preserved.
122333734831Smrg
122433734831Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
122533734831Smrg# ---------------------------
122633734831Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
122733734831Smrg# This macro is traced by Automake.
122833734831SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
122933734831Smrg
123033734831Smrg# AM_SUBST_NOTMAKE(VARIABLE)
123133734831Smrg# --------------------------
123233734831Smrg# Public sister of _AM_SUBST_NOTMAKE.
123333734831SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
123433734831Smrg
123533734831Smrg# Check how to create a tarball.                            -*- Autoconf -*-
123633734831Smrg
1237e73734d1Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
123854e0bb33Smrg#
123933734831Smrg# This file is free software; the Free Software Foundation
124033734831Smrg# gives unlimited permission to copy and/or distribute it,
124133734831Smrg# with or without modifications, as long as this notice is preserved.
124233734831Smrg
124333734831Smrg# _AM_PROG_TAR(FORMAT)
124433734831Smrg# --------------------
124533734831Smrg# Check how to create a tarball in format FORMAT.
124633734831Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
124754e0bb33Smrg#
124833734831Smrg# Substitute a variable $(am__tar) that is a command
124933734831Smrg# writing to stdout a FORMAT-tarball containing the directory
125033734831Smrg# $tardir.
125133734831Smrg#     tardir=directory && $(am__tar) > result.tar
125254e0bb33Smrg#
125333734831Smrg# Substitute a variable $(am__untar) that extract such
125433734831Smrg# a tarball read from stdin.
125533734831Smrg#     $(am__untar) < result.tar
125654e0bb33Smrg#
125733734831SmrgAC_DEFUN([_AM_PROG_TAR],
125833734831Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
125933734831Smrg# in the wild :-(  We should find a proper way to deprecate it ...
126033734831SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1261b1297603Smrg
126233734831Smrg# We'll loop over all known methods to create a tar archive until one works.
126333734831Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1264b1297603Smrg
126533734831Smrgm4_if([$1], [v7],
126633734831Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
126733734831Smrg
126833734831Smrg  [m4_case([$1],
126933734831Smrg    [ustar],
127033734831Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
127133734831Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
127233734831Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
127333734831Smrg      # and bug#13588).
127433734831Smrg      am_max_uid=2097151 # 2^21 - 1
127533734831Smrg      am_max_gid=$am_max_uid
127633734831Smrg      # The $UID and $GID variables are not portable, so we need to resort
127733734831Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
127833734831Smrg      # below are definitely unexpected, so allow the users to see them
127933734831Smrg      # (that is, avoid stderr redirection).
128033734831Smrg      am_uid=`id -u || echo unknown`
128133734831Smrg      am_gid=`id -g || echo unknown`
128233734831Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
128333734831Smrg      if test $am_uid -le $am_max_uid; then
128433734831Smrg         AC_MSG_RESULT([yes])
128533734831Smrg      else
128633734831Smrg         AC_MSG_RESULT([no])
128733734831Smrg         _am_tools=none
128833734831Smrg      fi
128933734831Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
129033734831Smrg      if test $am_gid -le $am_max_gid; then
129133734831Smrg         AC_MSG_RESULT([yes])
129233734831Smrg      else
129333734831Smrg        AC_MSG_RESULT([no])
129433734831Smrg        _am_tools=none
129533734831Smrg      fi],
129633734831Smrg
129733734831Smrg  [pax],
129833734831Smrg    [],
129933734831Smrg
130033734831Smrg  [m4_fatal([Unknown tar format])])
130133734831Smrg
130233734831Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
130333734831Smrg
130433734831Smrg  # Go ahead even if we have the value already cached.  We do so because we
130533734831Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
130633734831Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
130733734831Smrg
130833734831Smrg  for _am_tool in $_am_tools; do
130933734831Smrg    case $_am_tool in
131033734831Smrg    gnutar)
131133734831Smrg      for _am_tar in tar gnutar gtar; do
131233734831Smrg        AM_RUN_LOG([$_am_tar --version]) && break
131333734831Smrg      done
131433734831Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
131533734831Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
131633734831Smrg      am__untar="$_am_tar -xf -"
131733734831Smrg      ;;
131833734831Smrg    plaintar)
131933734831Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
132033734831Smrg      # ustar tarball either.
132133734831Smrg      (tar --version) >/dev/null 2>&1 && continue
132233734831Smrg      am__tar='tar chf - "$$tardir"'
132333734831Smrg      am__tar_='tar chf - "$tardir"'
132433734831Smrg      am__untar='tar xf -'
132533734831Smrg      ;;
132633734831Smrg    pax)
132733734831Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
132833734831Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
132933734831Smrg      am__untar='pax -r'
133033734831Smrg      ;;
133133734831Smrg    cpio)
133233734831Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
133333734831Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
133433734831Smrg      am__untar='cpio -i -H $1 -d'
133533734831Smrg      ;;
133633734831Smrg    none)
133733734831Smrg      am__tar=false
133833734831Smrg      am__tar_=false
133933734831Smrg      am__untar=false
134033734831Smrg      ;;
134133734831Smrg    esac
134233734831Smrg
134333734831Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
134433734831Smrg    # and am__untar set.
134533734831Smrg    test -n "${am_cv_prog_tar_$1}" && break
134633734831Smrg
134733734831Smrg    # tar/untar a dummy directory, and stop if the command works.
134833734831Smrg    rm -rf conftest.dir
134933734831Smrg    mkdir conftest.dir
135033734831Smrg    echo GrepMe > conftest.dir/file
135133734831Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
135233734831Smrg    rm -rf conftest.dir
135333734831Smrg    if test -s conftest.tar; then
135433734831Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
135533734831Smrg      AM_RUN_LOG([cat conftest.dir/file])
135633734831Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
135754e0bb33Smrg    fi
135833734831Smrg  done
135933734831Smrg  rm -rf conftest.dir
1360b1297603Smrg
136133734831Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
136233734831Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1363b1297603Smrg
136433734831SmrgAC_SUBST([am__tar])
136533734831SmrgAC_SUBST([am__untar])
136633734831Smrg]) # _AM_PROG_TAR
1367b1297603Smrg
136833734831Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
136933734831Smrgdnl
137033734831Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1371e73734d1Smrgdnl
137233734831Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
137333734831Smrgdnl copy of this software and associated documentation files (the "Software"),
137433734831Smrgdnl to deal in the Software without restriction, including without limitation
137533734831Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
137633734831Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
137733734831Smrgdnl Software is furnished to do so, subject to the following conditions:
137833734831Smrgdnl
137933734831Smrgdnl The above copyright notice and this permission notice (including the next
138033734831Smrgdnl paragraph) shall be included in all copies or substantial portions of the
138133734831Smrgdnl Software.
138233734831Smrgdnl
138333734831Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
138433734831Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
138533734831Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
138633734831Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
138733734831Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
138833734831Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
138933734831Smrgdnl DEALINGS IN THE SOFTWARE.
139033734831Smrg
139133734831Smrg# XORG_MACROS_VERSION(required-version)
139233734831Smrg# -------------------------------------
139333734831Smrg# Minimum version: 1.1.0
13940309d3b3Smrg#
139533734831Smrg# If you're using a macro added in Version 1.1 or newer, include this in
139633734831Smrg# your configure.ac with the minimum required version, such as:
139733734831Smrg# XORG_MACROS_VERSION(1.1)
13980309d3b3Smrg#
139933734831Smrg# To ensure that this macro is defined, also add:
140033734831Smrg# m4_ifndef([XORG_MACROS_VERSION],
140133734831Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14020309d3b3Smrg#
14030309d3b3Smrg#
1404e73734d1Smrg# See the "minimum version" comment for each macro you use to see what
140533734831Smrg# version you require.
140633734831Smrgm4_defun([XORG_MACROS_VERSION],[
1407e73734d1Smrgm4_define([vers_have], [1.19.0])
140833734831Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
140933734831Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
141033734831Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
141133734831Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
141233734831Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
141333734831Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
141433734831Smrgm4_undefine([vers_have])
141533734831Smrgm4_undefine([maj_have])
141633734831Smrgm4_undefine([maj_needed])
141733734831Smrg]) # XORG_MACROS_VERSION
141833734831Smrg
141933734831Smrg# XORG_PROG_RAWCPP()
142033734831Smrg# ------------------
142133734831Smrg# Minimum version: 1.0.0
14220309d3b3Smrg#
142333734831Smrg# Find cpp program and necessary flags for use in pre-processing text files
142433734831Smrg# such as man pages and config files
142533734831SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
142633734831SmrgAC_REQUIRE([AC_PROG_CPP])
1427e73734d1SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
142833734831Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
142933734831Smrg
143033734831Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
143133734831Smrg# which is not the best choice for supporting other OS'es, but covers most
143233734831Smrg# of the ones we need for now.
143333734831SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
143433734831SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
143533734831Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
143633734831Smrg	AC_MSG_RESULT([no])
14370309d3b3Smrgelse
143833734831Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
143933734831Smrg		RAWCPPFLAGS=-undef
144033734831Smrg		AC_MSG_RESULT([yes])
144133734831Smrg	# under Cygwin unix is still defined even with -undef
144233734831Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
144333734831Smrg		RAWCPPFLAGS="-undef -ansi"
144433734831Smrg		AC_MSG_RESULT([yes, with -ansi])
144533734831Smrg	else
144633734831Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
144733734831Smrg	fi
14480309d3b3Smrgfi
144933734831Smrgrm -f conftest.$ac_ext
14500309d3b3Smrg
145133734831SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
145233734831SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
145333734831Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
145433734831Smrg	AC_MSG_RESULT([no])
145533734831Smrgelse
145633734831Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1457e73734d1Smrg		TRADITIONALCPPFLAGS="-traditional"
145833734831Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
145933734831Smrg		AC_MSG_RESULT([yes])
146033734831Smrg	else
146133734831Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
146233734831Smrg	fi
146333734831Smrgfi
146433734831Smrgrm -f conftest.$ac_ext
146533734831SmrgAC_SUBST(RAWCPPFLAGS)
1466e73734d1SmrgAC_SUBST(TRADITIONALCPPFLAGS)
146733734831Smrg]) # XORG_PROG_RAWCPP
146833734831Smrg
146933734831Smrg# XORG_MANPAGE_SECTIONS()
14700309d3b3Smrg# -----------------------
147133734831Smrg# Minimum version: 1.0.0
14720309d3b3Smrg#
147333734831Smrg# Determine which sections man pages go in for the different man page types
147433734831Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
147533734831Smrg# Not sure if there's any better way than just hardcoding by OS name.
147633734831Smrg# Override default settings by setting environment variables
147733734831Smrg# Added MAN_SUBSTS in version 1.8
147833734831Smrg# Added AC_PROG_SED in version 1.8
14790309d3b3Smrg
148033734831SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
14810309d3b3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
148233734831SmrgAC_REQUIRE([AC_PROG_SED])
14830309d3b3Smrg
148433734831Smrgif test x$APP_MAN_SUFFIX = x    ; then
148533734831Smrg    APP_MAN_SUFFIX=1
148633734831Smrgfi
148733734831Smrgif test x$APP_MAN_DIR = x    ; then
148833734831Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
148933734831Smrgfi
14900309d3b3Smrg
149133734831Smrgif test x$LIB_MAN_SUFFIX = x    ; then
149233734831Smrg    LIB_MAN_SUFFIX=3
149333734831Smrgfi
149433734831Smrgif test x$LIB_MAN_DIR = x    ; then
149533734831Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
14960309d3b3Smrgfi
14970309d3b3Smrg
149833734831Smrgif test x$FILE_MAN_SUFFIX = x    ; then
149933734831Smrg    case $host_os in
150033734831Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
150133734831Smrg	*)		FILE_MAN_SUFFIX=5  ;;
150233734831Smrg    esac
150333734831Smrgfi
150433734831Smrgif test x$FILE_MAN_DIR = x    ; then
150533734831Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
150633734831Smrgfi
15070309d3b3Smrg
150833734831Smrgif test x$MISC_MAN_SUFFIX = x    ; then
150933734831Smrg    case $host_os in
151033734831Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
151133734831Smrg	*)		MISC_MAN_SUFFIX=7  ;;
151233734831Smrg    esac
151333734831Smrgfi
151433734831Smrgif test x$MISC_MAN_DIR = x    ; then
151533734831Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
151633734831Smrgfi
151753719b08Smrg
151833734831Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
151933734831Smrg    case $host_os in
152033734831Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
152133734831Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
152233734831Smrg    esac
152333734831Smrgfi
152433734831Smrgif test x$DRIVER_MAN_DIR = x    ; then
152533734831Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15265b944e2aSmrgfi
15275b944e2aSmrg
152833734831Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
152933734831Smrg    case $host_os in
153033734831Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
153133734831Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
153233734831Smrg    esac
153333734831Smrgfi
153433734831Smrgif test x$ADMIN_MAN_DIR = x    ; then
153533734831Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1536cea37944Smrgfi
1537b1297603Smrg
153854e0bb33Smrg
153933734831SmrgAC_SUBST([APP_MAN_SUFFIX])
154033734831SmrgAC_SUBST([LIB_MAN_SUFFIX])
154133734831SmrgAC_SUBST([FILE_MAN_SUFFIX])
154233734831SmrgAC_SUBST([MISC_MAN_SUFFIX])
154333734831SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
154433734831SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
154533734831SmrgAC_SUBST([APP_MAN_DIR])
154633734831SmrgAC_SUBST([LIB_MAN_DIR])
154733734831SmrgAC_SUBST([FILE_MAN_DIR])
154833734831SmrgAC_SUBST([MISC_MAN_DIR])
154933734831SmrgAC_SUBST([DRIVER_MAN_DIR])
155033734831SmrgAC_SUBST([ADMIN_MAN_DIR])
155133734831Smrg
155233734831SmrgXORG_MAN_PAGE="X Version 11"
155333734831SmrgAC_SUBST([XORG_MAN_PAGE])
155433734831SmrgMAN_SUBSTS="\
155533734831Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
155633734831Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
155733734831Smrg	-e 's|__xservername__|Xorg|g' \
155833734831Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
155933734831Smrg	-e 's|__xorgconfdir__|xorg.conf.d|g' \
156033734831Smrg	-e 's|__projectroot__|\$(prefix)|g' \
156133734831Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
156233734831Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
156333734831Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
156433734831Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
156533734831Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
156633734831Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
156733734831Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
156833734831SmrgAC_SUBST([MAN_SUBSTS])
156933734831Smrg
157033734831Smrg]) # XORG_MANPAGE_SECTIONS
157133734831Smrg
157233734831Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
157333734831Smrg# ------------------------
157433734831Smrg# Minimum version: 1.7.0
157554e0bb33Smrg#
157633734831Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
157733734831Smrg# provided by xorg-sgml-doctools, if installed.
157833734831SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
157933734831SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
158033734831SmrgXORG_SGML_PATH=
158133734831SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
158233734831Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
158333734831Smrg    [m4_ifval([$1],[:],
158433734831Smrg        [if test x"$cross_compiling" != x"yes" ; then
158533734831Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
158633734831Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
158733734831Smrg         fi])
158833734831Smrg    ])
158933734831Smrg
159033734831Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
159133734831Smrg# the path and the name of the doc stylesheet
159233734831Smrgif test "x$XORG_SGML_PATH" != "x" ; then
159333734831Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
159433734831Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
159533734831Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
159633734831Smrgelse
159733734831Smrg   AC_MSG_RESULT([no])
159833734831Smrgfi
159933734831Smrg
160033734831SmrgAC_SUBST(XORG_SGML_PATH)
160133734831SmrgAC_SUBST(STYLESHEET_SRCDIR)
160233734831SmrgAC_SUBST(XSL_STYLESHEET)
160333734831SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
160433734831Smrg]) # XORG_CHECK_SGML_DOCTOOLS
160533734831Smrg
160633734831Smrg# XORG_CHECK_LINUXDOC
160733734831Smrg# -------------------
160833734831Smrg# Minimum version: 1.0.0
160954e0bb33Smrg#
161033734831Smrg# Defines the variable MAKE_TEXT if the necessary tools and
161133734831Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
161233734831Smrg# Whether or not the necessary tools and files are found can be checked
161333734831Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
161433734831SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
161533734831SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
161633734831SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1617b1297603Smrg
161833734831SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1619b1297603Smrg
162033734831SmrgAC_MSG_CHECKING([whether to build documentation])
1621b1297603Smrg
162233734831Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
162333734831Smrg   BUILDDOC=yes
162454e0bb33Smrgelse
162533734831Smrg   BUILDDOC=no
1626cea37944Smrgfi
1627b1297603Smrg
162833734831SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1629b1297603Smrg
163033734831SmrgAC_MSG_RESULT([$BUILDDOC])
1631b1297603Smrg
163233734831SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1633b1297603Smrg
163433734831Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
163533734831Smrg   BUILDPDFDOC=yes
163633734831Smrgelse
163733734831Smrg   BUILDPDFDOC=no
163833734831Smrgfi
1639b1297603Smrg
164033734831SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1641b1297603Smrg
164233734831SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1643b1297603Smrg
164433734831SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
164533734831SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
164633734831SmrgMAKE_PDF="$PS2PDF"
164733734831SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1648b1297603Smrg
164933734831SmrgAC_SUBST(MAKE_TEXT)
165033734831SmrgAC_SUBST(MAKE_PS)
165133734831SmrgAC_SUBST(MAKE_PDF)
165233734831SmrgAC_SUBST(MAKE_HTML)
165333734831Smrg]) # XORG_CHECK_LINUXDOC
1654b1297603Smrg
165533734831Smrg# XORG_CHECK_DOCBOOK
16560309d3b3Smrg# -------------------
165733734831Smrg# Minimum version: 1.0.0
16580309d3b3Smrg#
165933734831Smrg# Checks for the ability to build output formats from SGML DocBook source.
166033734831Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
166133734831Smrg# indicates whether the necessary tools and files are found and, if set,
166233734831Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
166333734831SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
166433734831SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16650309d3b3Smrg
166633734831SmrgBUILDTXTDOC=no
166733734831SmrgBUILDPDFDOC=no
166833734831SmrgBUILDPSDOC=no
166933734831SmrgBUILDHTMLDOC=no
16700309d3b3Smrg
167133734831SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
167233734831SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
167333734831SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
167433734831SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16750309d3b3Smrg
167633734831SmrgAC_MSG_CHECKING([whether to build text documentation])
167733734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
167833734831Smrg   test x$BUILD_TXTDOC != xno; then
167933734831Smrg	BUILDTXTDOC=yes
16800309d3b3Smrgfi
168133734831SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
168233734831SmrgAC_MSG_RESULT([$BUILDTXTDOC])
16830309d3b3Smrg
168433734831SmrgAC_MSG_CHECKING([whether to build PDF documentation])
168533734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
168633734831Smrg   test x$BUILD_PDFDOC != xno; then
168733734831Smrg	BUILDPDFDOC=yes
16880309d3b3Smrgfi
168933734831SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
169033734831SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16910309d3b3Smrg
169233734831SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
169333734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
169433734831Smrg   test x$BUILD_PSDOC != xno; then
169533734831Smrg	BUILDPSDOC=yes
169633734831Smrgfi
169733734831SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
169833734831SmrgAC_MSG_RESULT([$BUILDPSDOC])
16990309d3b3Smrg
170033734831SmrgAC_MSG_CHECKING([whether to build HTML documentation])
170133734831Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
170233734831Smrg   test x$BUILD_HTMLDOC != xno; then
170333734831Smrg	BUILDHTMLDOC=yes
170433734831Smrgfi
170533734831SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
170633734831SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17070309d3b3Smrg
170833734831SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
170933734831SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
171033734831SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
171133734831SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
171233734831Smrg
171333734831SmrgAC_SUBST(MAKE_TEXT)
171433734831SmrgAC_SUBST(MAKE_PS)
171533734831SmrgAC_SUBST(MAKE_PDF)
171633734831SmrgAC_SUBST(MAKE_HTML)
171733734831Smrg]) # XORG_CHECK_DOCBOOK
171833734831Smrg
171933734831Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
172033734831Smrg# ----------------
172133734831Smrg# Minimum version: 1.5.0
172233734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
172333734831Smrg#
172433734831Smrg# Documentation tools are not always available on all platforms and sometimes
172533734831Smrg# not at the appropriate level. This macro enables a module to test for the
172633734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
172733734831Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
172833734831Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
172933734831Smrg# --with-xmlto assumes 'auto'.
17300309d3b3Smrg#
173133734831Smrg# Interface to module:
173233734831Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
173333734831Smrg# XMLTO:	returns the path of the xmlto program found
173433734831Smrg#		returns the path set by the user in the environment
173533734831Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
173633734831Smrg#		'no' user instructs the module not to use xmlto
17370309d3b3Smrg#
173833734831Smrg# Added in version 1.10.0
173933734831Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
174033734831Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
17410309d3b3Smrg#
174233734831Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
174333734831Smrg#
174433734831SmrgAC_DEFUN([XORG_WITH_XMLTO],[
174533734831SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
174633734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
174733734831SmrgAC_ARG_WITH(xmlto,
174833734831Smrg	AS_HELP_STRING([--with-xmlto],
174933734831Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
175033734831Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
175133734831Smrgm4_undefine([_defopt])
17520309d3b3Smrg
175333734831Smrgif test "x$use_xmlto" = x"auto"; then
175433734831Smrg   AC_PATH_PROG([XMLTO], [xmlto])
175533734831Smrg   if test "x$XMLTO" = "x"; then
175633734831Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
175733734831Smrg	have_xmlto=no
175833734831Smrg   else
175933734831Smrg        have_xmlto=yes
176033734831Smrg   fi
176133734831Smrgelif test "x$use_xmlto" = x"yes" ; then
176233734831Smrg   AC_PATH_PROG([XMLTO], [xmlto])
176333734831Smrg   if test "x$XMLTO" = "x"; then
176433734831Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
176533734831Smrg   fi
176633734831Smrg   have_xmlto=yes
176733734831Smrgelif test "x$use_xmlto" = x"no" ; then
176833734831Smrg   if test "x$XMLTO" != "x"; then
176933734831Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
177033734831Smrg   fi
177133734831Smrg   have_xmlto=no
17720309d3b3Smrgelse
177333734831Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17740309d3b3Smrgfi
17750309d3b3Smrg
177633734831Smrg# Test for a minimum version of xmlto, if provided.
177733734831Smrgm4_ifval([$1],
177833734831Smrg[if test "$have_xmlto" = yes; then
177933734831Smrg    # scrape the xmlto version
178033734831Smrg    AC_MSG_CHECKING([the xmlto version])
178133734831Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
178233734831Smrg    AC_MSG_RESULT([$xmlto_version])
178333734831Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
178433734831Smrg        [if test "x$use_xmlto" = xauto; then
178533734831Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
178633734831Smrg            have_xmlto=no
178733734831Smrg        else
178833734831Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
178933734831Smrg        fi])
179033734831Smrgfi])
17910309d3b3Smrg
179233734831Smrg# Test for the ability of xmlto to generate a text target
179333734831Smrghave_xmlto_text=no
179433734831Smrgcat > conftest.xml << "EOF"
179533734831SmrgEOF
179633734831SmrgAS_IF([test "$have_xmlto" = yes],
179733734831Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
179833734831Smrg             [have_xmlto_text=yes],
179933734831Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
180033734831Smrgrm -f conftest.xml
180133734831SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
180233734831SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
180333734831Smrg]) # XORG_WITH_XMLTO
18040309d3b3Smrg
180533734831Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
180633734831Smrg# --------------------------------------------
180733734831Smrg# Minimum version: 1.12.0
180833734831Smrg# Minimum version for optional DEFAULT argument: 1.12.0
180933734831Smrg#
181033734831Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
181133734831Smrg# XML-based language used for the transformation of XML documents.
181233734831Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
181333734831Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
181433734831Smrg# The XSLT processor is often used as a standalone tool for transformations.
181533734831Smrg# It should not be assumed that this tool is used only to work with documnetation.
181633734831Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
181733734831Smrg#
181833734831Smrg# Interface to module:
181933734831Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
182033734831Smrg# XSLTPROC:	 returns the path of the xsltproc program found
182133734831Smrg#		 returns the path set by the user in the environment
182233734831Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
182333734831Smrg#		  'no' user instructs the module not to use xsltproc
182433734831Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
182533734831Smrg#
182633734831Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
182733734831Smrg#
182833734831SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
182933734831SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
183033734831Smrg# Preserves the interface, should it be implemented later
183133734831Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
183233734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
183333734831SmrgAC_ARG_WITH(xsltproc,
183433734831Smrg	AS_HELP_STRING([--with-xsltproc],
183533734831Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
183633734831Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
183733734831Smrgm4_undefine([_defopt])
18380309d3b3Smrg
183933734831Smrgif test "x$use_xsltproc" = x"auto"; then
184033734831Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
184133734831Smrg   if test "x$XSLTPROC" = "x"; then
184233734831Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
184333734831Smrg	have_xsltproc=no
184433734831Smrg   else
184533734831Smrg        have_xsltproc=yes
184633734831Smrg   fi
184733734831Smrgelif test "x$use_xsltproc" = x"yes" ; then
184833734831Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
184933734831Smrg   if test "x$XSLTPROC" = "x"; then
185033734831Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
185133734831Smrg   fi
185233734831Smrg   have_xsltproc=yes
185333734831Smrgelif test "x$use_xsltproc" = x"no" ; then
185433734831Smrg   if test "x$XSLTPROC" != "x"; then
185533734831Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
185633734831Smrg   fi
185733734831Smrg   have_xsltproc=no
18580309d3b3Smrgelse
185933734831Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18600309d3b3Smrgfi
18610309d3b3Smrg
186233734831SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
186333734831Smrg]) # XORG_WITH_XSLTPROC
18640309d3b3Smrg
186533734831Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
186633734831Smrg# ----------------------------------------
186733734831Smrg# Minimum version: 1.15.0
186854e0bb33Smrg#
186933734831Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
187033734831Smrg# scanning arbitrary text files, extracting information from those text files,
187133734831Smrg# and printing reports based on that information.
187254e0bb33Smrg#
187333734831Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18740309d3b3Smrg#
187533734831Smrg# Interface to module:
187633734831Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
187733734831Smrg# PERL:	     returns the path of the perl program found
187833734831Smrg#	     returns the path set by the user in the environment
187933734831Smrg# --with-perl: 'yes' user instructs the module to use perl
188033734831Smrg#	       'no' user instructs the module not to use perl
188133734831Smrg# have_perl: returns yes if perl found in PATH or no
188254e0bb33Smrg#
188333734831Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18840309d3b3Smrg#
188533734831SmrgAC_DEFUN([XORG_WITH_PERL],[
188633734831SmrgAC_ARG_VAR([PERL], [Path to perl command])
188733734831Smrg# Preserves the interface, should it be implemented later
188833734831Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
188933734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
189033734831SmrgAC_ARG_WITH(perl,
189133734831Smrg	AS_HELP_STRING([--with-perl],
189233734831Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
189333734831Smrg	   [use_perl=$withval], [use_perl=]_defopt)
189433734831Smrgm4_undefine([_defopt])
1895b1297603Smrg
189633734831Smrgif test "x$use_perl" = x"auto"; then
189733734831Smrg   AC_PATH_PROG([PERL], [perl])
189833734831Smrg   if test "x$PERL" = "x"; then
189933734831Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
190033734831Smrg	have_perl=no
190133734831Smrg   else
190233734831Smrg        have_perl=yes
190333734831Smrg   fi
190433734831Smrgelif test "x$use_perl" = x"yes" ; then
190533734831Smrg   AC_PATH_PROG([PERL], [perl])
190633734831Smrg   if test "x$PERL" = "x"; then
190733734831Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
190833734831Smrg   fi
190933734831Smrg   have_perl=yes
191033734831Smrgelif test "x$use_perl" = x"no" ; then
191133734831Smrg   if test "x$PERL" != "x"; then
191233734831Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
191333734831Smrg   fi
191433734831Smrg   have_perl=no
191533734831Smrgelse
191633734831Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
191733734831Smrgfi
191853719b08Smrg
191933734831SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
192033734831Smrg]) # XORG_WITH_PERL
192153719b08Smrg
192233734831Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
192354e0bb33Smrg# ----------------
192433734831Smrg# Minimum version: 1.5.0
192533734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
192654e0bb33Smrg#
192733734831Smrg# Documentation tools are not always available on all platforms and sometimes
192833734831Smrg# not at the appropriate level. This macro enables a module to test for the
192933734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
193033734831Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
193133734831Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
193233734831Smrg# --with-asciidoc assumes 'auto'.
193354e0bb33Smrg#
193433734831Smrg# Interface to module:
193533734831Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
193633734831Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
193733734831Smrg#		 returns the path set by the user in the environment
193833734831Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
193933734831Smrg#		  'no' user instructs the module not to use asciidoc
194054e0bb33Smrg#
194133734831Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
194254e0bb33Smrg#
194333734831SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
194433734831SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
194533734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
194633734831SmrgAC_ARG_WITH(asciidoc,
194733734831Smrg	AS_HELP_STRING([--with-asciidoc],
194833734831Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
194933734831Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
195033734831Smrgm4_undefine([_defopt])
1951cea37944Smrg
195233734831Smrgif test "x$use_asciidoc" = x"auto"; then
195333734831Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
195433734831Smrg   if test "x$ASCIIDOC" = "x"; then
195533734831Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
195633734831Smrg	have_asciidoc=no
195733734831Smrg   else
195833734831Smrg        have_asciidoc=yes
195933734831Smrg   fi
196033734831Smrgelif test "x$use_asciidoc" = x"yes" ; then
196133734831Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
196233734831Smrg   if test "x$ASCIIDOC" = "x"; then
196333734831Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
196433734831Smrg   fi
196533734831Smrg   have_asciidoc=yes
196633734831Smrgelif test "x$use_asciidoc" = x"no" ; then
196733734831Smrg   if test "x$ASCIIDOC" != "x"; then
196833734831Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
196933734831Smrg   fi
197033734831Smrg   have_asciidoc=no
197133734831Smrgelse
197233734831Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
197333734831Smrgfi
197433734831Smrgm4_ifval([$1],
197533734831Smrg[if test "$have_asciidoc" = yes; then
197633734831Smrg    # scrape the asciidoc version
197733734831Smrg    AC_MSG_CHECKING([the asciidoc version])
197833734831Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
197933734831Smrg    AC_MSG_RESULT([$asciidoc_version])
198033734831Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
198133734831Smrg        [if test "x$use_asciidoc" = xauto; then
198233734831Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
198333734831Smrg            have_asciidoc=no
198433734831Smrg        else
198533734831Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
198633734831Smrg        fi])
198733734831Smrgfi])
198833734831SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
198933734831Smrg]) # XORG_WITH_ASCIIDOC
19900309d3b3Smrg
199133734831Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1992e73734d1Smrg# -------------------------------------------
199333734831Smrg# Minimum version: 1.5.0
199433734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1995e73734d1Smrg# Minimum version for optional DOT checking: 1.18.0
1996cea37944Smrg#
199733734831Smrg# Documentation tools are not always available on all platforms and sometimes
199833734831Smrg# not at the appropriate level. This macro enables a module to test for the
199933734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
200033734831Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
200133734831Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
200233734831Smrg# --with-doxygen assumes 'auto'.
2003cea37944Smrg#
200433734831Smrg# Interface to module:
200533734831Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
200633734831Smrg# DOXYGEN:	 returns the path of the doxygen program found
200733734831Smrg#		 returns the path set by the user in the environment
200833734831Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
200933734831Smrg#		  'no' user instructs the module not to use doxygen
2010cea37944Smrg#
201133734831Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2012cea37944Smrg#
201333734831SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
201433734831SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2015e73734d1SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
201633734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
201733734831SmrgAC_ARG_WITH(doxygen,
201833734831Smrg	AS_HELP_STRING([--with-doxygen],
201933734831Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
202033734831Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
202133734831Smrgm4_undefine([_defopt])
2022b1297603Smrg
202333734831Smrgif test "x$use_doxygen" = x"auto"; then
202433734831Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
202533734831Smrg   if test "x$DOXYGEN" = "x"; then
202633734831Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
202733734831Smrg	have_doxygen=no
202833734831Smrg   else
202933734831Smrg        have_doxygen=yes
203033734831Smrg   fi
203133734831Smrgelif test "x$use_doxygen" = x"yes" ; then
203233734831Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
203333734831Smrg   if test "x$DOXYGEN" = "x"; then
203433734831Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
203533734831Smrg   fi
203633734831Smrg   have_doxygen=yes
203733734831Smrgelif test "x$use_doxygen" = x"no" ; then
203833734831Smrg   if test "x$DOXYGEN" != "x"; then
203933734831Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
204033734831Smrg   fi
204133734831Smrg   have_doxygen=no
204233734831Smrgelse
204333734831Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
204433734831Smrgfi
204533734831Smrgm4_ifval([$1],
204633734831Smrg[if test "$have_doxygen" = yes; then
204733734831Smrg    # scrape the doxygen version
204833734831Smrg    AC_MSG_CHECKING([the doxygen version])
204933734831Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
205033734831Smrg    AC_MSG_RESULT([$doxygen_version])
205133734831Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
205233734831Smrg        [if test "x$use_doxygen" = xauto; then
205333734831Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
205433734831Smrg            have_doxygen=no
205533734831Smrg        else
205633734831Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
205733734831Smrg        fi])
205833734831Smrgfi])
2059e73734d1Smrg
2060e73734d1Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2061e73734d1Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2062e73734d1Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2063e73734d1SmrgHAVE_DOT=no
2064e73734d1Smrgif test "x$have_doxygen" = "xyes"; then
2065e73734d1Smrg  AC_PATH_PROG([DOT], [dot])
2066e73734d1Smrg    if test "x$DOT" != "x"; then
2067e73734d1Smrg      HAVE_DOT=yes
2068e73734d1Smrg    fi
2069e73734d1Smrgfi
2070e73734d1Smrg
2071e73734d1SmrgAC_SUBST([HAVE_DOT])
2072e73734d1SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
207333734831SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
207433734831Smrg]) # XORG_WITH_DOXYGEN
207554e0bb33Smrg
207633734831Smrg# XORG_WITH_GROFF([DEFAULT])
207733734831Smrg# ----------------
207833734831Smrg# Minimum version: 1.6.0
207933734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2080cea37944Smrg#
208133734831Smrg# Documentation tools are not always available on all platforms and sometimes
208233734831Smrg# not at the appropriate level. This macro enables a module to test for the
208333734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208433734831Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
208533734831Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
208633734831Smrg# --with-groff assumes 'auto'.
208733734831Smrg#
208833734831Smrg# Interface to module:
208933734831Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
209033734831Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
209133734831Smrg# HAVE_GROFF_MS: the -ms macros package
209233734831Smrg# GROFF:	 returns the path of the groff program found
209333734831Smrg#		 returns the path set by the user in the environment
209433734831Smrg# --with-groff:	 'yes' user instructs the module to use groff
209533734831Smrg#		 'no' user instructs the module not to use groff
209633734831Smrg#
209733734831Smrg# Added in version 1.9.0:
209833734831Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
209933734831Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
210033734831Smrg#		   psselect from the psutils package.
210133734831Smrg#		   the ghostcript package. Refer to the grohtml man pages
210233734831Smrg#
210333734831Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
210433734831Smrg#
210533734831Smrg# OS and distros often splits groff in a basic and full package, the former
210633734831Smrg# having the groff program and the later having devices, fonts and macros
210733734831Smrg# Checking for the groff executable is not enough.
210833734831Smrg#
210933734831Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
211033734831Smrg# unset HAVE_GROFF or GROFF env variables.
211133734831Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
211233734831Smrg#
211333734831SmrgAC_DEFUN([XORG_WITH_GROFF],[
211433734831SmrgAC_ARG_VAR([GROFF], [Path to groff command])
211533734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
211633734831SmrgAC_ARG_WITH(groff,
211733734831Smrg	AS_HELP_STRING([--with-groff],
211833734831Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
211933734831Smrg	   [use_groff=$withval], [use_groff=]_defopt)
212033734831Smrgm4_undefine([_defopt])
212154e0bb33Smrg
212233734831Smrgif test "x$use_groff" = x"auto"; then
212333734831Smrg   AC_PATH_PROG([GROFF], [groff])
212433734831Smrg   if test "x$GROFF" = "x"; then
212533734831Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
212633734831Smrg	have_groff=no
212733734831Smrg   else
212833734831Smrg        have_groff=yes
212933734831Smrg   fi
213033734831Smrgelif test "x$use_groff" = x"yes" ; then
213133734831Smrg   AC_PATH_PROG([GROFF], [groff])
213233734831Smrg   if test "x$GROFF" = "x"; then
213333734831Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
213433734831Smrg   fi
213533734831Smrg   have_groff=yes
213633734831Smrgelif test "x$use_groff" = x"no" ; then
213733734831Smrg   if test "x$GROFF" != "x"; then
213833734831Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
213933734831Smrg   fi
214033734831Smrg   have_groff=no
2141cea37944Smrgelse
214233734831Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
21435b944e2aSmrgfi
2144cea37944Smrg
214533734831Smrg# We have groff, test for the presence of the macro packages
214633734831Smrgif test "x$have_groff" = x"yes"; then
214733734831Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
214833734831Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
214933734831Smrg        groff_ms_works=yes
215033734831Smrg    else
215133734831Smrg        groff_ms_works=no
215233734831Smrg    fi
215333734831Smrg    AC_MSG_RESULT([$groff_ms_works])
215433734831Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
215533734831Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
215633734831Smrg        groff_mm_works=yes
215733734831Smrg    else
215833734831Smrg        groff_mm_works=no
215933734831Smrg    fi
216033734831Smrg    AC_MSG_RESULT([$groff_mm_works])
216133734831Smrgfi
216254e0bb33Smrg
216333734831Smrg# We have groff, test for HTML dependencies, one command per package
216433734831Smrgif test "x$have_groff" = x"yes"; then
216533734831Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
216633734831Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
216733734831Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
216833734831Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
216933734831Smrg      have_groff_html=yes
217033734831Smrg   else
217133734831Smrg      have_groff_html=no
217233734831Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
217333734831Smrg   fi
217433734831Smrgfi
217554e0bb33Smrg
217633734831Smrg# Set Automake conditionals for Makefiles
217733734831SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
217833734831SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
217933734831SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
218033734831SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
218133734831Smrg]) # XORG_WITH_GROFF
218254e0bb33Smrg
218333734831Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
218433734831Smrg# ---------------------------------------
218533734831Smrg# Minimum version: 1.6.0
218633734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
218733734831Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
218854e0bb33Smrg#
218933734831Smrg# Documentation tools are not always available on all platforms and sometimes
219033734831Smrg# not at the appropriate level. This macro enables a module to test for the
219133734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
219233734831Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
219333734831Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
219433734831Smrg# --with-fop assumes 'auto'.
219533734831Smrg#
219633734831Smrg# Interface to module:
219733734831Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
219833734831Smrg# FOP:	 	returns the path of the fop program found
219933734831Smrg#		returns the path set by the user in the environment
220033734831Smrg# --with-fop: 	'yes' user instructs the module to use fop
220133734831Smrg#		'no' user instructs the module not to use fop
220233734831Smrg#
220333734831Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
220433734831Smrg#
220533734831SmrgAC_DEFUN([XORG_WITH_FOP],[
220633734831SmrgAC_ARG_VAR([FOP], [Path to fop command])
220733734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
220833734831SmrgAC_ARG_WITH(fop,
220933734831Smrg	AS_HELP_STRING([--with-fop],
221033734831Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
221133734831Smrg	   [use_fop=$withval], [use_fop=]_defopt)
221233734831Smrgm4_undefine([_defopt])
221354e0bb33Smrg
221433734831Smrgif test "x$use_fop" = x"auto"; then
221533734831Smrg   AC_PATH_PROG([FOP], [fop])
221633734831Smrg   if test "x$FOP" = "x"; then
221733734831Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
221833734831Smrg	have_fop=no
221933734831Smrg   else
222033734831Smrg        have_fop=yes
222133734831Smrg   fi
222233734831Smrgelif test "x$use_fop" = x"yes" ; then
222333734831Smrg   AC_PATH_PROG([FOP], [fop])
222433734831Smrg   if test "x$FOP" = "x"; then
222533734831Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
222633734831Smrg   fi
222733734831Smrg   have_fop=yes
222833734831Smrgelif test "x$use_fop" = x"no" ; then
222933734831Smrg   if test "x$FOP" != "x"; then
223033734831Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
223133734831Smrg   fi
223233734831Smrg   have_fop=no
223333734831Smrgelse
223433734831Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
223533734831Smrgfi
223654e0bb33Smrg
223733734831Smrg# Test for a minimum version of fop, if provided.
223833734831Smrgm4_ifval([$1],
223933734831Smrg[if test "$have_fop" = yes; then
224033734831Smrg    # scrape the fop version
224133734831Smrg    AC_MSG_CHECKING([for fop minimum version])
224233734831Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
224333734831Smrg    AC_MSG_RESULT([$fop_version])
224433734831Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
224533734831Smrg        [if test "x$use_fop" = xauto; then
224633734831Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
224733734831Smrg            have_fop=no
224833734831Smrg        else
224933734831Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
225033734831Smrg        fi])
225133734831Smrgfi])
225233734831SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
225333734831Smrg]) # XORG_WITH_FOP
225454e0bb33Smrg
2255e73734d1Smrg# XORG_WITH_M4([MIN-VERSION])
2256e73734d1Smrg# ---------------------------
2257e73734d1Smrg# Minimum version: 1.19.0
2258e73734d1Smrg#
2259e73734d1Smrg# This macro attempts to locate an m4 macro processor which supports
2260e73734d1Smrg# -I option and is only useful for modules relying on M4 in order to
2261e73734d1Smrg# expand macros in source code files.
2262e73734d1Smrg#
2263e73734d1Smrg# Interface to module:
2264e73734d1Smrg# M4:	 	returns the path of the m4 program found
2265e73734d1Smrg#		returns the path set by the user in the environment
2266e73734d1Smrg#
2267e73734d1SmrgAC_DEFUN([XORG_WITH_M4], [
2268e73734d1SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2269e73734d1Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2270e73734d1Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2271e73734d1Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2272e73734d1Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2273e73734d1Smrg   [$PATH:/usr/gnu/bin])])
2274e73734d1Smrg
2275e73734d1SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2276e73734d1Smrg]) # XORG_WITH_M4
2277e73734d1Smrg
227833734831Smrg# XORG_WITH_PS2PDF([DEFAULT])
227933734831Smrg# ----------------
228033734831Smrg# Minimum version: 1.6.0
228133734831Smrg# Minimum version for optional DEFAULT argument: 1.11.0
228233734831Smrg#
228333734831Smrg# Documentation tools are not always available on all platforms and sometimes
228433734831Smrg# not at the appropriate level. This macro enables a module to test for the
228533734831Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
228633734831Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
228733734831Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
228833734831Smrg# --with-ps2pdf assumes 'auto'.
228933734831Smrg#
229033734831Smrg# Interface to module:
229133734831Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
229233734831Smrg# PS2PDF:	returns the path of the ps2pdf program found
229333734831Smrg#		returns the path set by the user in the environment
229433734831Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
229533734831Smrg#		 'no' user instructs the module not to use ps2pdf
229633734831Smrg#
229733734831Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
229833734831Smrg#
229933734831SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
230033734831SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
230133734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
230233734831SmrgAC_ARG_WITH(ps2pdf,
230333734831Smrg	AS_HELP_STRING([--with-ps2pdf],
230433734831Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
230533734831Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
230633734831Smrgm4_undefine([_defopt])
230754e0bb33Smrg
230833734831Smrgif test "x$use_ps2pdf" = x"auto"; then
230933734831Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
231033734831Smrg   if test "x$PS2PDF" = "x"; then
231133734831Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
231233734831Smrg	have_ps2pdf=no
231333734831Smrg   else
231433734831Smrg        have_ps2pdf=yes
231533734831Smrg   fi
231633734831Smrgelif test "x$use_ps2pdf" = x"yes" ; then
231733734831Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
231833734831Smrg   if test "x$PS2PDF" = "x"; then
231933734831Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
232033734831Smrg   fi
232133734831Smrg   have_ps2pdf=yes
232233734831Smrgelif test "x$use_ps2pdf" = x"no" ; then
232333734831Smrg   if test "x$PS2PDF" != "x"; then
232433734831Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
232533734831Smrg   fi
232633734831Smrg   have_ps2pdf=no
2327cea37944Smrgelse
232833734831Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2329cea37944Smrgfi
233033734831SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
233133734831Smrg]) # XORG_WITH_PS2PDF
233254e0bb33Smrg
233333734831Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
233433734831Smrg# ----------------
233533734831Smrg# Minimum version: 1.6.0
2336cea37944Smrg#
233733734831Smrg# Documentation tools are not always available on all platforms and sometimes
233833734831Smrg# not at the appropriate level. This macro enables a builder to skip all
233933734831Smrg# documentation targets except traditional man pages.
234033734831Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
234133734831Smrg# maximum flexibilty in controlling documentation building.
234233734831Smrg# Refer to:
234333734831Smrg# XORG_WITH_XMLTO         --with-xmlto
234433734831Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
234533734831Smrg# XORG_WITH_DOXYGEN       --with-doxygen
234633734831Smrg# XORG_WITH_FOP           --with-fop
234733734831Smrg# XORG_WITH_GROFF         --with-groff
234833734831Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
234933734831Smrg#
235033734831Smrg# Interface to module:
235133734831Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
235233734831Smrg# --enable-docs: 'yes' user instructs the module to generate docs
235333734831Smrg#		 'no' user instructs the module not to generate docs
235433734831Smrg# parm1:	specify the default value, yes or no.
235533734831Smrg#
235633734831SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
235733734831Smrgm4_define([docs_default], m4_default([$1], [yes]))
235833734831SmrgAC_ARG_ENABLE(docs,
235933734831Smrg	AS_HELP_STRING([--enable-docs],
236033734831Smrg	   [Enable building the documentation (default: ]docs_default[)]),
236133734831Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
236233734831Smrgm4_undefine([docs_default])
236333734831SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
236433734831SmrgAC_MSG_CHECKING([whether to build documentation])
236533734831SmrgAC_MSG_RESULT([$build_docs])
236633734831Smrg]) # XORG_ENABLE_DOCS
2367b1297603Smrg
236833734831Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
236933734831Smrg# ----------------
237033734831Smrg# Minimum version: 1.6.0
237133734831Smrg#
237233734831Smrg# This macro enables a builder to skip all developer documentation.
237333734831Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
237433734831Smrg# maximum flexibilty in controlling documentation building.
237533734831Smrg# Refer to:
237633734831Smrg# XORG_WITH_XMLTO         --with-xmlto
237733734831Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
237833734831Smrg# XORG_WITH_DOXYGEN       --with-doxygen
237933734831Smrg# XORG_WITH_FOP           --with-fop
238033734831Smrg# XORG_WITH_GROFF         --with-groff
238133734831Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
238233734831Smrg#
238333734831Smrg# Interface to module:
238433734831Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
238533734831Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
238633734831Smrg#			'no' user instructs the module not to generate developer docs
238733734831Smrg# parm1:		specify the default value, yes or no.
2388b1297603Smrg#
238933734831SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
239033734831Smrgm4_define([devel_default], m4_default([$1], [yes]))
239133734831SmrgAC_ARG_ENABLE(devel-docs,
239233734831Smrg	AS_HELP_STRING([--enable-devel-docs],
239333734831Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
239433734831Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
239533734831Smrgm4_undefine([devel_default])
239633734831SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
239733734831SmrgAC_MSG_CHECKING([whether to build developer documentation])
239833734831SmrgAC_MSG_RESULT([$build_devel_docs])
239933734831Smrg]) # XORG_ENABLE_DEVEL_DOCS
240054e0bb33Smrg
240133734831Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
240233734831Smrg# ----------------
240333734831Smrg# Minimum version: 1.6.0
240433734831Smrg#
240533734831Smrg# This macro enables a builder to skip all functional specification targets.
240633734831Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
240733734831Smrg# maximum flexibilty in controlling documentation building.
240833734831Smrg# Refer to:
240933734831Smrg# XORG_WITH_XMLTO         --with-xmlto
241033734831Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
241133734831Smrg# XORG_WITH_DOXYGEN       --with-doxygen
241233734831Smrg# XORG_WITH_FOP           --with-fop
241333734831Smrg# XORG_WITH_GROFF         --with-groff
241433734831Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
241533734831Smrg#
241633734831Smrg# Interface to module:
241733734831Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
241833734831Smrg# --enable-specs:	'yes' user instructs the module to generate specs
241933734831Smrg#			'no' user instructs the module not to generate specs
242033734831Smrg# parm1:		specify the default value, yes or no.
242133734831Smrg#
242233734831SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
242333734831Smrgm4_define([spec_default], m4_default([$1], [yes]))
242433734831SmrgAC_ARG_ENABLE(specs,
242533734831Smrg	AS_HELP_STRING([--enable-specs],
242633734831Smrg	   [Enable building the specs (default: ]spec_default[)]),
242733734831Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
242833734831Smrgm4_undefine([spec_default])
242933734831SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
243033734831SmrgAC_MSG_CHECKING([whether to build functional specifications])
243133734831SmrgAC_MSG_RESULT([$build_specs])
243233734831Smrg]) # XORG_ENABLE_SPECS
243354e0bb33Smrg
243433734831Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
243533734831Smrg# ----------------------------------------------
243633734831Smrg# Minimum version: 1.13.0
2437cea37944Smrg#
243833734831Smrg# This macro enables a builder to enable/disable unit testing
243933734831Smrg# It makes no assumption about the test cases implementation
244033734831Smrg# Test cases may or may not use Automake "Support for test suites"
244133734831Smrg# They may or may not use the software utility library GLib
244233734831Smrg#
244333734831Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
244433734831Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
244533734831Smrg# The variable enable_unit_tests is used by other macros in this file.
244633734831Smrg#
244733734831Smrg# Interface to module:
244833734831Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
244933734831Smrg# enable_unit_tests:    used in configure.ac for additional configuration
245033734831Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
245133734831Smrg#			'no' user instructs the module not to build tests
245233734831Smrg# parm1:		specify the default value, yes or no.
245333734831Smrg#
245433734831SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
245533734831SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
245633734831SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
245733734831SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
245833734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
245933734831SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
246033734831Smrg	[Enable building unit test cases (default: ]_defopt[)]),
246133734831Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
246233734831Smrgm4_undefine([_defopt])
246333734831SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
246433734831SmrgAC_MSG_CHECKING([whether to build unit test cases])
246533734831SmrgAC_MSG_RESULT([$enable_unit_tests])
246633734831Smrg]) # XORG_ENABLE_UNIT_TESTS
2467cea37944Smrg
246833734831Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
246933734831Smrg# ------------------------------------------------------
247033734831Smrg# Minimum version: 1.17.0
247133734831Smrg#
247233734831Smrg# This macro enables a builder to enable/disable integration testing
247333734831Smrg# It makes no assumption about the test cases' implementation
247433734831Smrg# Test cases may or may not use Automake "Support for test suites"
247533734831Smrg#
247633734831Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
247733734831Smrg# usually requires less dependencies and may be built and run under less
247833734831Smrg# stringent environments than integration tests.
247933734831Smrg#
248033734831Smrg# Interface to module:
248133734831Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
248233734831Smrg# enable_integration_tests:   used in configure.ac for additional configuration
248333734831Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
248433734831Smrg#                             'no' user instructs the module not to build tests
248533734831Smrg# parm1:                      specify the default value, yes or no.
248633734831Smrg#
248733734831SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
248833734831SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
248933734831Smrgm4_define([_defopt], m4_default([$1], [auto]))
249033734831SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
249133734831Smrg	[Enable building integration test cases (default: ]_defopt[)]),
249233734831Smrg	[enable_integration_tests=$enableval],
249333734831Smrg	[enable_integration_tests=]_defopt)
249433734831Smrgm4_undefine([_defopt])
249533734831SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
249633734831Smrg	[test "x$enable_integration_tests" != xno])
249733734831SmrgAC_MSG_CHECKING([whether to build unit test cases])
249833734831SmrgAC_MSG_RESULT([$enable_integration_tests])
249933734831Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
250054e0bb33Smrg
250133734831Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
250233734831Smrg# ----------------------------------------
250333734831Smrg# Minimum version: 1.13.0
250433734831Smrg#
250533734831Smrg# GLib is a library which provides advanced data structures and functions.
250633734831Smrg# This macro enables a module to test for the presence of Glib.
250733734831Smrg#
250833734831Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
250933734831Smrg# Otherwise the value of $enable_unit_tests is blank.
251033734831Smrg#
251133734831Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
251233734831Smrg# test support usually requires less dependencies and may be built and run under
251333734831Smrg# less stringent environments than integration tests.
251433734831Smrg#
251533734831Smrg# Interface to module:
251633734831Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
251733734831Smrg# with_glib: used in configure.ac to know if GLib has been found
251833734831Smrg# --with-glib:	'yes' user instructs the module to use glib
251933734831Smrg#		'no' user instructs the module not to use glib
252033734831Smrg#
252133734831SmrgAC_DEFUN([XORG_WITH_GLIB],[
252233734831SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
252333734831Smrgm4_define([_defopt], m4_default([$2], [auto]))
252433734831SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
252533734831Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
252633734831Smrg	[with_glib=$withval], [with_glib=]_defopt)
252733734831Smrgm4_undefine([_defopt])
252854e0bb33Smrg
252933734831Smrghave_glib=no
253033734831Smrg# Do not probe GLib if user explicitly disabled unit testing
253133734831Smrgif test "x$enable_unit_tests" != x"no"; then
253233734831Smrg  # Do not probe GLib if user explicitly disabled it
253333734831Smrg  if test "x$with_glib" != x"no"; then
253433734831Smrg    m4_ifval(
253533734831Smrg      [$1],
253633734831Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
253733734831Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
253833734831Smrg    )
253954e0bb33Smrg  fi
2540cea37944Smrgfi
254153719b08Smrg
254233734831Smrg# Not having GLib when unit testing has been explicitly requested is an error
254333734831Smrgif test "x$enable_unit_tests" = x"yes"; then
254433734831Smrg  if test "x$have_glib" = x"no"; then
254533734831Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
254654e0bb33Smrg  fi
254754e0bb33Smrgfi
254854e0bb33Smrg
254933734831Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
255033734831Smrgif test "x$enable_unit_tests" = x"no"; then
255133734831Smrg  if test "x$with_glib" = x"yes"; then
255233734831Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
255333734831Smrg  fi
255433734831Smrgfi
255533734831Smrg
255633734831Smrg# Not having GLib when it has been explicitly requested is an error
255733734831Smrgif test "x$with_glib" = x"yes"; then
255833734831Smrg  if test "x$have_glib" = x"no"; then
255933734831Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
256033734831Smrg  fi
2561cea37944Smrgfi
2562cea37944Smrg
256333734831SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
256433734831Smrg]) # XORG_WITH_GLIB
256554e0bb33Smrg
256633734831Smrg# XORG_LD_WRAP([required|optional])
256733734831Smrg# ---------------------------------
256833734831Smrg# Minimum version: 1.13.0
256933734831Smrg#
257033734831Smrg# Check if linker supports -wrap, passed via compiler flags
257133734831Smrg#
257233734831Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
257333734831Smrg# Otherwise the value of $enable_unit_tests is blank.
257433734831Smrg#
257533734831Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
257633734831Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
257733734831Smrg# available, an argument of "optional" allows use when some unit tests require
257833734831Smrg# ld -wrap and others do not.
257933734831Smrg#
258033734831SmrgAC_DEFUN([XORG_LD_WRAP],[
258133734831SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
258233734831Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
258333734831Smrg                      void __wrap_exit(int status) { return; }],
258433734831Smrg                     [exit(0);])])
258533734831Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
258633734831Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
258733734831Smrg  if test "x$have_ld_wrap" = x"no"; then
258833734831Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
258933734831Smrg  fi
259033734831Smrgfi
259133734831SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
259233734831Smrg#
259333734831Smrg]) # XORG_LD_WRAP
259454e0bb33Smrg
259533734831Smrg# XORG_CHECK_LINKER_FLAGS
259633734831Smrg# -----------------------
259733734831Smrg# SYNOPSIS
259833734831Smrg#
259933734831Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
260033734831Smrg#
260133734831Smrg# DESCRIPTION
260233734831Smrg#
260333734831Smrg#   Check whether the given linker FLAGS work with the current language's
260433734831Smrg#   linker, or whether they give an error.
260533734831Smrg#
260633734831Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
260733734831Smrg#   success/failure.
260833734831Smrg#
260933734831Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
261033734831Smrg#
261133734831Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
261233734831Smrg#
261333734831Smrg# LICENSE
261433734831Smrg#
261533734831Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
261633734831Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
261733734831Smrg#   Copyright (c) 2009 Matteo Frigo
261833734831Smrg#
261933734831Smrg#   This program is free software: you can redistribute it and/or modify it
262033734831Smrg#   under the terms of the GNU General Public License as published by the
262133734831Smrg#   Free Software Foundation, either version 3 of the License, or (at your
262233734831Smrg#   option) any later version.
262333734831Smrg#
262433734831Smrg#   This program is distributed in the hope that it will be useful, but
262533734831Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
262633734831Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
262733734831Smrg#   Public License for more details.
262833734831Smrg#
262933734831Smrg#   You should have received a copy of the GNU General Public License along
263033734831Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
263133734831Smrg#
263233734831Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
263333734831Smrg#   gives unlimited permission to copy, distribute and modify the configure
263433734831Smrg#   scripts that are the output of Autoconf when processing the Macro. You
263533734831Smrg#   need not follow the terms of the GNU General Public License when using
263633734831Smrg#   or distributing such scripts, even though portions of the text of the
263733734831Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
263833734831Smrg#   all other use of the material that constitutes the Autoconf Macro.
263933734831Smrg#
264033734831Smrg#   This special exception to the GPL applies to versions of the Autoconf
264133734831Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
264233734831Smrg#   modified version of the Autoconf Macro, you may extend this special
264333734831Smrg#   exception to the GPL to apply to your modified version as well.#
264433734831SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
264533734831Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
264633734831Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
264733734831SmrgAS_LITERAL_IF([$1],
264833734831Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
264933734831Smrg      ax_save_FLAGS=$LDFLAGS
265033734831Smrg      LDFLAGS="$1"
265133734831Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
265233734831Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
265333734831Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
265433734831Smrg      LDFLAGS=$ax_save_FLAGS])],
265533734831Smrg  [ax_save_FLAGS=$LDFLAGS
265633734831Smrg   LDFLAGS="$1"
265733734831Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
265833734831Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
265933734831Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
266033734831Smrg   LDFLAGS=$ax_save_FLAGS])
266133734831Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
266233734831SmrgAC_MSG_RESULT($xorg_check_linker_flags)
266333734831Smrgif test "x$xorg_check_linker_flags" = xyes; then
266433734831Smrg	m4_default([$2], :)
266554e0bb33Smrgelse
266633734831Smrg	m4_default([$3], :)
2667cea37944Smrgfi
266833734831Smrg]) # XORG_CHECK_LINKER_FLAGS
266954e0bb33Smrg
267033734831Smrg# XORG_MEMORY_CHECK_FLAGS
267133734831Smrg# -----------------------
267233734831Smrg# Minimum version: 1.16.0
2673cea37944Smrg#
267433734831Smrg# This macro attempts to find appropriate memory checking functionality
267533734831Smrg# for various platforms which unit testing code may use to catch various
267633734831Smrg# forms of memory allocation and access errors in testing.
267733734831Smrg#
267833734831Smrg# Interface to module:
267933734831Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
268033734831Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
268133734831Smrg#
268233734831Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
268333734831Smrg#
268433734831SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
268554e0bb33Smrg
268633734831SmrgAC_REQUIRE([AC_CANONICAL_HOST])
268733734831SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
268833734831Smrg           [Environment variables to enable memory checking in tests])
268954e0bb33Smrg
269033734831Smrg# Check for different types of support on different platforms
269133734831Smrgcase $host_os in
269233734831Smrg    solaris*)
269333734831Smrg        AC_CHECK_LIB([umem], [umem_alloc],
269433734831Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
269533734831Smrg        ;;
269633734831Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
269733734831Smrg        # both directly and inverted, so should not be 0 or 255.
269833734831Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
269933734831Smrg        ;;
270033734831Smrg    darwin*)
270133734831Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
270233734831Smrg        ;;
270333734831Smrg    *bsd*)
270433734831Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
270533734831Smrg        ;;
270633734831Smrgesac
270754e0bb33Smrg
270833734831Smrg# User supplied flags override default flags
270933734831Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
271033734831Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
271133734831Smrgfi
271254e0bb33Smrg
271333734831SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
271433734831Smrg]) # XORG_WITH_LINT
271554e0bb33Smrg
271633734831Smrg# XORG_CHECK_MALLOC_ZERO
271733734831Smrg# ----------------------
271833734831Smrg# Minimum version: 1.0.0
2719cea37944Smrg#
272033734831Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
272133734831Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
272233734831Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
272333734831SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
272433734831SmrgAC_ARG_ENABLE(malloc0returnsnull,
272533734831Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
272633734831Smrg		       [malloc(0) returns NULL (default: auto)]),
272733734831Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
272833734831Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
272954e0bb33Smrg
273033734831SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
273133734831Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2732e73734d1SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2733e73734d1Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
273433734831Smrg#include <stdlib.h>
273533734831Smrg],[
273633734831Smrg    char *m0, *r0, *c0, *p;
273733734831Smrg    m0 = malloc(0);
273833734831Smrg    p = malloc(10);
273933734831Smrg    r0 = realloc(p,0);
274033734831Smrg    c0 = calloc(0,10);
274133734831Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
274233734831Smrg])],
2743e73734d1Smrg		[xorg_cv_malloc0_returns_null=yes],
2744e73734d1Smrg		[xorg_cv_malloc0_returns_null=no])])
2745e73734d1SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
274633734831Smrgfi
274733734831SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
274854e0bb33Smrg
274933734831Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
275033734831Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
275133734831Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
275233734831Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
275333734831Smrgelse
275433734831Smrg	MALLOC_ZERO_CFLAGS=""
275533734831Smrg	XMALLOC_ZERO_CFLAGS=""
275633734831Smrg	XTMALLOC_ZERO_CFLAGS=""
2757cea37944Smrgfi
275853719b08Smrg
275933734831SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
276033734831SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
276133734831SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
276233734831Smrg]) # XORG_CHECK_MALLOC_ZERO
276354e0bb33Smrg
276433734831Smrg# XORG_WITH_LINT()
276533734831Smrg# ----------------
276633734831Smrg# Minimum version: 1.1.0
2767cea37944Smrg#
276833734831Smrg# This macro enables the use of a tool that flags some suspicious and
276933734831Smrg# non-portable constructs (likely to be bugs) in C language source code.
277033734831Smrg# It will attempt to locate the tool and use appropriate options.
277133734831Smrg# There are various lint type tools on different platforms.
277233734831Smrg#
277333734831Smrg# Interface to module:
277433734831Smrg# LINT:		returns the path to the tool found on the platform
277533734831Smrg#		or the value set to LINT on the configure cmd line
277633734831Smrg#		also an Automake conditional
277733734831Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
277833734831Smrg#
277933734831Smrg# --with-lint:	'yes' user instructs the module to use lint
278033734831Smrg#		'no' user instructs the module not to use lint (default)
278133734831Smrg#
278233734831Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
278333734831Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
278433734831Smrg#
278533734831SmrgAC_DEFUN([XORG_WITH_LINT],[
278654e0bb33Smrg
278733734831SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
278833734831SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
278933734831SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
279033734831Smrg		[Use a lint-style source code checker (default: disabled)])],
279133734831Smrg		[use_lint=$withval], [use_lint=no])
279254e0bb33Smrg
279333734831Smrg# Obtain platform specific info like program name and options
279433734831Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
279533734831Smrgcase $host_os in
279633734831Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
279733734831Smrg	lint_name=splint
279833734831Smrg	lint_options="-badflag"
279933734831Smrg	;;
280033734831Smrg  *freebsd* | *netbsd*)
280133734831Smrg	lint_name=lint
280233734831Smrg	lint_options="-u -b"
280333734831Smrg	;;
280433734831Smrg  *solaris*)
280533734831Smrg	lint_name=lint
280633734831Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
280733734831Smrg	;;
280833734831Smrgesac
280954e0bb33Smrg
281033734831Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
281133734831Smrgif test "x$use_lint" = x"yes" ; then
281233734831Smrg   AC_PATH_PROG([LINT], [$lint_name])
281333734831Smrg   if test "x$LINT" = "x"; then
281433734831Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
281533734831Smrg   fi
281633734831Smrgelif test "x$use_lint" = x"no" ; then
281733734831Smrg   if test "x$LINT" != "x"; then
281833734831Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
281933734831Smrg   fi
2820cea37944Smrgelse
282133734831Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2822cea37944Smrgfi
282353719b08Smrg
282433734831Smrg# User supplied flags override default flags
282533734831Smrgif test "x$LINT_FLAGS" != "x"; then
282633734831Smrg   lint_options=$LINT_FLAGS
282733734831Smrgfi
282833734831Smrg
282933734831SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
283033734831SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
283133734831Smrg
283233734831Smrg]) # XORG_WITH_LINT
283333734831Smrg
283433734831Smrg# XORG_LINT_LIBRARY(LIBNAME)
283533734831Smrg# --------------------------
283633734831Smrg# Minimum version: 1.1.0
2837cea37944Smrg#
283833734831Smrg# Sets up flags for building lint libraries for checking programs that call
283933734831Smrg# functions in the library.
284033734831Smrg#
284133734831Smrg# Interface to module:
284233734831Smrg# LINTLIB		- Automake variable with the name of lint library file to make
284333734831Smrg# MAKE_LINT_LIB		- Automake conditional
284433734831Smrg#
284533734831Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
284633734831Smrg#			  - 'no' user instructs the module not to create a lint library (default)
284754e0bb33Smrg
284833734831SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
284933734831SmrgAC_REQUIRE([XORG_WITH_LINT])
285033734831SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
285133734831Smrg	[Create lint library (default: disabled)])],
285233734831Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
28530309d3b3Smrg
285433734831Smrgif test "x$make_lint_lib" = x"yes" ; then
285533734831Smrg   LINTLIB=llib-l$1.ln
285633734831Smrg   if test "x$LINT" = "x"; then
285733734831Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
285833734831Smrg   fi
285933734831Smrgelif test "x$make_lint_lib" != x"no" ; then
286033734831Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
286133734831Smrgfi
286254e0bb33Smrg
286333734831SmrgAC_SUBST(LINTLIB)
286433734831SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
286554e0bb33Smrg
286633734831Smrg]) # XORG_LINT_LIBRARY
286754e0bb33Smrg
286833734831Smrg# XORG_COMPILER_BRAND
286933734831Smrg# -------------------
287033734831Smrg# Minimum version: 1.14.0
287133734831Smrg#
287233734831Smrg# Checks for various brands of compilers and sets flags as appropriate:
287333734831Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
287433734831Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
287533734831Smrg#   clang compiler - sets CLANGCC to "yes"
287633734831Smrg#   Intel compiler - sets INTELCC to "yes"
287733734831Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
287833734831Smrg#
287933734831SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
288033734831SmrgAC_LANG_CASE(
288133734831Smrg	[C], [
288233734831Smrg		AC_REQUIRE([AC_PROG_CC_C99])
288333734831Smrg	],
288433734831Smrg	[C++], [
288533734831Smrg		AC_REQUIRE([AC_PROG_CXX])
288633734831Smrg	]
288733734831Smrg)
288833734831SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
288933734831SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
289033734831SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
289133734831Smrg]) # XORG_COMPILER_BRAND
289254e0bb33Smrg
289333734831Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
289433734831Smrg# ---------------
289533734831Smrg# Minimum version: 1.16.0
289633734831Smrg#
289733734831Smrg# Test if the compiler works when passed the given flag as a command line argument.
289833734831Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
289933734831Smrg# next flag in the list until there are no more options.
290033734831Smrg#
290133734831Smrg# Note that this does not guarantee that the compiler supports the flag as some
290233734831Smrg# compilers will simply ignore arguments that they do not understand, but we do
290333734831Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
290433734831Smrg# -Werror=unused-command-line-argument
290533734831Smrg#
290633734831SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
290733734831Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
290833734831Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
290954e0bb33Smrg
291033734831SmrgAC_LANG_COMPILER_REQUIRE
291133734831Smrg
291233734831SmrgAC_LANG_CASE(
291333734831Smrg	[C], [
291433734831Smrg		AC_REQUIRE([AC_PROG_CC_C99])
291533734831Smrg		define([PREFIX], [C])
291633734831Smrg		define([CACHE_PREFIX], [cc])
291733734831Smrg		define([COMPILER], [$CC])
291833734831Smrg	],
291933734831Smrg	[C++], [
292033734831Smrg		define([PREFIX], [CXX])
292133734831Smrg		define([CACHE_PREFIX], [cxx])
292233734831Smrg		define([COMPILER], [$CXX])
292333734831Smrg	]
292433734831Smrg)
292554e0bb33Smrg
292633734831Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
292733734831Smrg
292833734831Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
292933734831Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
293033734831Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
293133734831Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
293233734831Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
293333734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
293433734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
293533734831Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
293633734831Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
293733734831Smrgfi
293854e0bb33Smrg
293933734831Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
294033734831Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
294133734831Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
294233734831Smrg	fi
294333734831Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
294433734831Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
294533734831Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
294633734831Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
294733734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
294833734831Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
294933734831Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
295033734831Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
295133734831Smrgfi
295254e0bb33Smrg
295333734831Smrgfound="no"
295433734831Smrgm4_foreach([flag], m4_cdr($@), [
295533734831Smrg	if test $found = "no" ; then
2956e73734d1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
295733734831Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
295833734831Smrg		fi
295954e0bb33Smrg
2960e73734d1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
296133734831Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
296233734831Smrg		fi
2963b1297603Smrg
296433734831Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
296553719b08Smrg
296633734831Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
296733734831Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
296833734831Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
296933734831Smrg		AC_CACHE_VAL($cacheid,
297033734831Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
297133734831Smrg					     [eval $cacheid=yes],
297233734831Smrg					     [eval $cacheid=no])])
297353719b08Smrg
297433734831Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29755b944e2aSmrg
297633734831Smrg		eval supported=\$$cacheid
297733734831Smrg		AC_MSG_RESULT([$supported])
297833734831Smrg		if test "$supported" = "yes" ; then
297933734831Smrg			$1="$$1 ]flag["
298033734831Smrg			found="yes"
298133734831Smrg		fi
298233734831Smrg	fi
298333734831Smrg])
298433734831Smrg]) # XORG_TESTSET_CFLAG
298553719b08Smrg
298633734831Smrg# XORG_COMPILER_FLAGS
298733734831Smrg# ---------------
298833734831Smrg# Minimum version: 1.16.0
298954e0bb33Smrg#
299033734831Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
299133734831Smrg# arguments supported by the selected compiler which do NOT alter the generated
299233734831Smrg# code.  These arguments will cause the compiler to print various warnings
299333734831Smrg# during compilation AND turn a conservative set of warnings into errors.
299433734831Smrg#
299533734831Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
299633734831Smrg# future versions of util-macros as options are added to new compilers.
299733734831Smrg#
299833734831SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
299933734831SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3000b1297603Smrg
300133734831SmrgAC_ARG_ENABLE(selective-werror,
300233734831Smrg              AS_HELP_STRING([--disable-selective-werror],
300333734831Smrg                             [Turn off selective compiler errors. (default: enabled)]),
300433734831Smrg              [SELECTIVE_WERROR=$enableval],
300533734831Smrg              [SELECTIVE_WERROR=yes])
3006b1297603Smrg
300733734831SmrgAC_LANG_CASE(
300833734831Smrg        [C], [
300933734831Smrg                define([PREFIX], [C])
301033734831Smrg        ],
301133734831Smrg        [C++], [
301233734831Smrg                define([PREFIX], [CXX])
301333734831Smrg        ]
301433734831Smrg)
301533734831Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
301633734831Smrgif test "x$SUNCC" = "xyes"; then
301733734831Smrg    [BASE_]PREFIX[FLAGS]="-v"
30180309d3b3Smrgelse
301933734831Smrg    [BASE_]PREFIX[FLAGS]=""
30200309d3b3Smrgfi
3021b1297603Smrg
302233734831Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
302333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
302433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
302533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
302633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
302733734831Smrg
302833734831SmrgAC_LANG_CASE(
302933734831Smrg	[C], [
303033734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
303133734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
303233734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
303333734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3034e73734d1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
303533734831Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
303633734831Smrg	]
303733734831Smrg)
30385b944e2aSmrg
303933734831Smrg# This chunk adds additional warnings that could catch undesired effects.
304033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
304133734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
304233734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
304333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
304433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
304533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3046e73734d1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
30470309d3b3Smrg
304833734831Smrg# These are currently disabled because they are noisy.  They will be enabled
304933734831Smrg# in the future once the codebase is sufficiently modernized to silence
305033734831Smrg# them.  For now, I don't want them to drown out the other warnings.
305133734831Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
305233734831Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3053e73734d1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
305433734831Smrg
305533734831Smrg# Turn some warnings into errors, so we don't accidently get successful builds
305633734831Smrg# when there are problems that should be fixed.
305733734831Smrg
305833734831Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
305933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
306033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
306133734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
306233734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
306333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
306433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
306533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
306633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
306733734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
306833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
306933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
307033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
307133734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
307233734831Smrgelse
307333734831SmrgAC_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])
307433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
307533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
307633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
307733734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
307833734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
307933734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
308033734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
308133734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
308233734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
308333734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
308433734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
308533734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
308633734831SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3087cea37944Smrgfi
308853719b08Smrg
308933734831SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
309033734831Smrg]) # XORG_COMPILER_FLAGS
309133734831Smrg
309233734831Smrg# XORG_CWARNFLAGS
309333734831Smrg# ---------------
309433734831Smrg# Minimum version: 1.2.0
309533734831Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
309654e0bb33Smrg#
309733734831Smrg# Defines CWARNFLAGS to enable C compiler warnings.
309833734831Smrg#
309933734831Smrg# This function is deprecated because it defines -fno-strict-aliasing
310033734831Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
310133734831Smrg# is needed, then it should be added explicitly in the module when
310233734831Smrg# it is updated to use BASE_CFLAGS.
310333734831Smrg#
310433734831SmrgAC_DEFUN([XORG_CWARNFLAGS], [
310533734831SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
310633734831SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
310733734831SmrgAC_LANG_CASE(
310833734831Smrg	[C], [
310933734831Smrg		CWARNFLAGS="$BASE_CFLAGS"
311033734831Smrg		if  test "x$GCC" = xyes ; then
311133734831Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
311233734831Smrg		fi
311333734831Smrg		AC_SUBST(CWARNFLAGS)
311433734831Smrg	]
311533734831Smrg)
311633734831Smrg]) # XORG_CWARNFLAGS
311753719b08Smrg
311833734831Smrg# XORG_STRICT_OPTION
311933734831Smrg# -----------------------
312033734831Smrg# Minimum version: 1.3.0
312133734831Smrg#
312233734831Smrg# Add configure option to enable strict compilation flags, such as treating
312333734831Smrg# warnings as fatal errors.
312433734831Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
312533734831Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
312633734831Smrg#
312733734831Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
312833734831Smrg# when strict compilation is unconditionally desired.
312933734831SmrgAC_DEFUN([XORG_STRICT_OPTION], [
313033734831SmrgAC_REQUIRE([XORG_CWARNFLAGS])
313133734831SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
313253719b08Smrg
313333734831SmrgAC_ARG_ENABLE(strict-compilation,
313433734831Smrg			  AS_HELP_STRING([--enable-strict-compilation],
313533734831Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
313633734831Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
313753719b08Smrg
313833734831SmrgAC_LANG_CASE(
313933734831Smrg        [C], [
314033734831Smrg                define([PREFIX], [C])
314133734831Smrg        ],
314233734831Smrg        [C++], [
314333734831Smrg                define([PREFIX], [CXX])
314433734831Smrg        ]
314533734831Smrg)
314654e0bb33Smrg
314733734831Smrg[STRICT_]PREFIX[FLAGS]=""
314833734831SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
314933734831SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
315054e0bb33Smrg
315133734831Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
315233734831Smrg# activate it with -Werror, so we add it here explicitly.
315333734831SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
315453719b08Smrg
315533734831Smrgif test "x$STRICT_COMPILE" = "xyes"; then
315633734831Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
315733734831Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
315833734831Smrgfi
315933734831SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
316033734831SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
316133734831SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
316233734831Smrg]) # XORG_STRICT_OPTION
3163cea37944Smrg
316433734831Smrg# XORG_DEFAULT_OPTIONS
316553719b08Smrg# --------------------
316633734831Smrg# Minimum version: 1.3.0
3167b1297603Smrg#
316833734831Smrg# Defines default options for X.Org modules.
3169d3263506Smrg#
317033734831SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
317133734831SmrgAC_REQUIRE([AC_PROG_INSTALL])
317233734831SmrgXORG_COMPILER_FLAGS
317333734831SmrgXORG_CWARNFLAGS
317433734831SmrgXORG_STRICT_OPTION
317533734831SmrgXORG_RELEASE_VERSION
317633734831SmrgXORG_CHANGELOG
317733734831SmrgXORG_INSTALL
317833734831SmrgXORG_MANPAGE_SECTIONS
317933734831Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
318033734831Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
318133734831Smrg]) # XORG_DEFAULT_OPTIONS
318253719b08Smrg
318333734831Smrg# XORG_INSTALL()
318433734831Smrg# ----------------
318533734831Smrg# Minimum version: 1.4.0
318633734831Smrg#
318733734831Smrg# Defines the variable INSTALL_CMD as the command to copy
318833734831Smrg# INSTALL from $prefix/share/util-macros.
318933734831Smrg#
319033734831SmrgAC_DEFUN([XORG_INSTALL], [
319133734831SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
319233734831Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
319333734831SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
319433734831Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
319533734831Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
319633734831Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
319733734831SmrgAC_SUBST([INSTALL_CMD])
319833734831Smrg]) # XORG_INSTALL
319933734831Smrgdnl Copyright 2005 Red Hat, Inc
320033734831Smrgdnl
320133734831Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
320233734831Smrgdnl documentation for any purpose is hereby granted without fee, provided that
320333734831Smrgdnl the above copyright notice appear in all copies and that both that
320433734831Smrgdnl copyright notice and this permission notice appear in supporting
320533734831Smrgdnl documentation.
320633734831Smrgdnl
320733734831Smrgdnl The above copyright notice and this permission notice shall be included
320833734831Smrgdnl in all copies or substantial portions of the Software.
320933734831Smrgdnl
321033734831Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
321133734831Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
321233734831Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
321333734831Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
321433734831Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
321533734831Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
321633734831Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
321733734831Smrgdnl
321833734831Smrgdnl Except as contained in this notice, the name of the copyright holders shall
321933734831Smrgdnl not be used in advertising or otherwise to promote the sale, use or
322033734831Smrgdnl other dealings in this Software without prior written authorization
322133734831Smrgdnl from the copyright holders.
322233734831Smrgdnl
322353719b08Smrg
322433734831Smrg# XORG_RELEASE_VERSION
322533734831Smrg# --------------------
322633734831Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3227e73734d1Smrg
322833734831SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
322933734831Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
323033734831Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
323133734831Smrg		[Major version of this package])
323233734831Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
323333734831Smrg	if test "x$PVM" = "x"; then
323433734831Smrg		PVM="0"
323533734831Smrg	fi
323633734831Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
323733734831Smrg		[$PVM],
323833734831Smrg		[Minor version of this package])
323933734831Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
324033734831Smrg	if test "x$PVP" = "x"; then
324133734831Smrg		PVP="0"
324233734831Smrg	fi
324333734831Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
324433734831Smrg		[$PVP],
324533734831Smrg		[Patch version of this package])
324633734831Smrg])
324753719b08Smrg
324833734831Smrg# XORG_CHANGELOG()
324933734831Smrg# ----------------
325033734831Smrg# Minimum version: 1.2.0
325133734831Smrg#
325233734831Smrg# Defines the variable CHANGELOG_CMD as the command to generate
325333734831Smrg# ChangeLog from git.
325433734831Smrg#
325533734831Smrg#
325633734831SmrgAC_DEFUN([XORG_CHANGELOG], [
325733734831SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
325833734831Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
325933734831Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
326033734831Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
326133734831SmrgAC_SUBST([CHANGELOG_CMD])
326233734831Smrg]) # XORG_CHANGELOG
3263b1297603Smrg
3264