18 | 18 |
You have another version of autoconf. It may work, but is not guaranteed to.
|
19 | 19 |
If you have problems, you may need to regenerate the build system entirely.
|
20 | 20 |
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
|
21 |
|
|
22 |
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
|
23 |
dnl serial 11 (pkg-config-0.29)
|
|
24 |
dnl
|
|
25 |
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
|
26 |
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
|
27 |
dnl
|
|
28 |
dnl This program is free software; you can redistribute it and/or modify
|
|
29 |
dnl it under the terms of the GNU General Public License as published by
|
|
30 |
dnl the Free Software Foundation; either version 2 of the License, or
|
|
31 |
dnl (at your option) any later version.
|
|
32 |
dnl
|
|
33 |
dnl This program is distributed in the hope that it will be useful, but
|
|
34 |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
35 |
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
36 |
dnl General Public License for more details.
|
|
37 |
dnl
|
|
38 |
dnl You should have received a copy of the GNU General Public License
|
|
39 |
dnl along with this program; if not, write to the Free Software
|
|
40 |
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
41 |
dnl 02111-1307, USA.
|
|
42 |
dnl
|
|
43 |
dnl As a special exception to the GNU General Public License, if you
|
|
44 |
dnl distribute this file as part of a program that contains a
|
|
45 |
dnl configuration script generated by Autoconf, you may include it under
|
|
46 |
dnl the same distribution terms that you use for the rest of that
|
|
47 |
dnl program.
|
|
48 |
|
|
49 |
dnl PKG_PREREQ(MIN-VERSION)
|
|
50 |
dnl -----------------------
|
|
51 |
dnl Since: 0.29
|
|
52 |
dnl
|
|
53 |
dnl Verify that the version of the pkg-config macros are at least
|
|
54 |
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
|
55 |
dnl installed version of pkg-config, this checks the developer's version
|
|
56 |
dnl of pkg.m4 when generating configure.
|
|
57 |
dnl
|
|
58 |
dnl To ensure that this macro is defined, also add:
|
|
59 |
dnl m4_ifndef([PKG_PREREQ],
|
|
60 |
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
|
61 |
dnl
|
|
62 |
dnl See the "Since" comment for each macro you use to see what version
|
|
63 |
dnl of the macros you require.
|
|
64 |
m4_defun([PKG_PREREQ],
|
|
65 |
[m4_define([PKG_MACROS_VERSION], [0.29])
|
|
66 |
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
|
67 |
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
|
68 |
])dnl PKG_PREREQ
|
|
69 |
|
|
70 |
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
|
71 |
dnl ----------------------------------
|
|
72 |
dnl Since: 0.16
|
|
73 |
dnl
|
|
74 |
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
|
75 |
dnl first found in the path. Checks that the version of pkg-config found
|
|
76 |
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
|
77 |
dnl used since that's the first version where most current features of
|
|
78 |
dnl pkg-config existed.
|
|
79 |
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
|
80 |
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
|
81 |
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
|
82 |
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
|
83 |
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
|
84 |
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
|
85 |
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
|
86 |
|
|
87 |
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
|
88 |
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
|
89 |
fi
|
|
90 |
if test -n "$PKG_CONFIG"; then
|
|
91 |
_pkg_min_version=m4_default([$1], [0.9.0])
|
|
92 |
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
|
93 |
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
|
94 |
AC_MSG_RESULT([yes])
|
|
95 |
else
|
|
96 |
AC_MSG_RESULT([no])
|
|
97 |
PKG_CONFIG=""
|
|
98 |
fi
|
|
99 |
fi[]dnl
|
|
100 |
])dnl PKG_PROG_PKG_CONFIG
|
|
101 |
|
|
102 |
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
103 |
dnl -------------------------------------------------------------------
|
|
104 |
dnl Since: 0.18
|
|
105 |
dnl
|
|
106 |
dnl Check to see whether a particular set of modules exists. Similar to
|
|
107 |
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
108 |
dnl
|
|
109 |
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
110 |
dnl only at the first occurence in configure.ac, so if the first place
|
|
111 |
dnl it's called might be skipped (such as if it is within an "if", you
|
|
112 |
dnl have to call PKG_CHECK_EXISTS manually
|
|
113 |
AC_DEFUN([PKG_CHECK_EXISTS],
|
|
114 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
115 |
if test -n "$PKG_CONFIG" && \
|
|
116 |
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
|
117 |
m4_default([$2], [:])
|
|
118 |
m4_ifvaln([$3], [else
|
|
119 |
$3])dnl
|
|
120 |
fi])
|
|
121 |
|
|
122 |
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
|
123 |
dnl ---------------------------------------------
|
|
124 |
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
|
125 |
dnl pkg_failed based on the result.
|
|
126 |
m4_define([_PKG_CONFIG],
|
|
127 |
[if test -n "$$1"; then
|
|
128 |
pkg_cv_[]$1="$$1"
|
|
129 |
elif test -n "$PKG_CONFIG"; then
|
|
130 |
PKG_CHECK_EXISTS([$3],
|
|
131 |
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
|
132 |
test "x$?" != "x0" && pkg_failed=yes ],
|
|
133 |
[pkg_failed=yes])
|
|
134 |
else
|
|
135 |
pkg_failed=untried
|
|
136 |
fi[]dnl
|
|
137 |
])dnl _PKG_CONFIG
|
|
138 |
|
|
139 |
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
|
140 |
dnl ---------------------------
|
|
141 |
dnl Internal check to see if pkg-config supports short errors.
|
|
142 |
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
|
143 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
144 |
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
145 |
_pkg_short_errors_supported=yes
|
|
146 |
else
|
|
147 |
_pkg_short_errors_supported=no
|
|
148 |
fi[]dnl
|
|
149 |
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
|
150 |
|
|
151 |
|
|
152 |
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
153 |
dnl [ACTION-IF-NOT-FOUND])
|
|
154 |
dnl --------------------------------------------------------------
|
|
155 |
dnl Since: 0.4.0
|
|
156 |
dnl
|
|
157 |
dnl Note that if there is a possibility the first call to
|
|
158 |
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
159 |
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
|
160 |
AC_DEFUN([PKG_CHECK_MODULES],
|
|
161 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
162 |
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
|
163 |
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
|
164 |
|
|
165 |
pkg_failed=no
|
|
166 |
AC_MSG_CHECKING([for $1])
|
|
167 |
|
|
168 |
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
|
169 |
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
|
170 |
|
|
171 |
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
|
172 |
and $1[]_LIBS to avoid the need to call pkg-config.
|
|
173 |
See the pkg-config man page for more details.])
|
|
174 |
|
|
175 |
if test $pkg_failed = yes; then
|
|
176 |
AC_MSG_RESULT([no])
|
|
177 |
_PKG_SHORT_ERRORS_SUPPORTED
|
|
178 |
if test $_pkg_short_errors_supported = yes; then
|
|
179 |
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
|
180 |
else
|
|
181 |
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
|
182 |
fi
|
|
183 |
# Put the nasty error message in config.log where it belongs
|
|
184 |
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
|
185 |
|
|
186 |
m4_default([$4], [AC_MSG_ERROR(
|
|
187 |
[Package requirements ($2) were not met:
|
|
188 |
|
|
189 |
$$1_PKG_ERRORS
|
|
190 |
|
|
191 |
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
|
192 |
installed software in a non-standard prefix.
|
|
193 |
|
|
194 |
_PKG_TEXT])[]dnl
|
|
195 |
])
|
|
196 |
elif test $pkg_failed = untried; then
|
|
197 |
AC_MSG_RESULT([no])
|
|
198 |
m4_default([$4], [AC_MSG_FAILURE(
|
|
199 |
[The pkg-config script could not be found or is too old. Make sure it
|
|
200 |
is in your PATH or set the PKG_CONFIG environment variable to the full
|
|
201 |
path to pkg-config.
|
|
202 |
|
|
203 |
_PKG_TEXT
|
|
204 |
|
|
205 |
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
|
206 |
])
|
|
207 |
else
|
|
208 |
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
|
209 |
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
|
210 |
AC_MSG_RESULT([yes])
|
|
211 |
$3
|
|
212 |
fi[]dnl
|
|
213 |
])dnl PKG_CHECK_MODULES
|
|
214 |
|
|
215 |
|
|
216 |
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
217 |
dnl [ACTION-IF-NOT-FOUND])
|
|
218 |
dnl ---------------------------------------------------------------------
|
|
219 |
dnl Since: 0.29
|
|
220 |
dnl
|
|
221 |
dnl Checks for existence of MODULES and gathers its build flags with
|
|
222 |
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
|
223 |
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
|
224 |
dnl
|
|
225 |
dnl Note that if there is a possibility the first call to
|
|
226 |
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
|
227 |
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
|
228 |
dnl configure.ac.
|
|
229 |
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
|
230 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
231 |
_save_PKG_CONFIG=$PKG_CONFIG
|
|
232 |
PKG_CONFIG="$PKG_CONFIG --static"
|
|
233 |
PKG_CHECK_MODULES($@)
|
|
234 |
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
|
235 |
])dnl PKG_CHECK_MODULES_STATIC
|
|
236 |
|
|
237 |
|
|
238 |
dnl PKG_INSTALLDIR([DIRECTORY])
|
|
239 |
dnl -------------------------
|
|
240 |
dnl Since: 0.27
|
|
241 |
dnl
|
|
242 |
dnl Substitutes the variable pkgconfigdir as the location where a module
|
|
243 |
dnl should install pkg-config .pc files. By default the directory is
|
|
244 |
dnl $libdir/pkgconfig, but the default can be changed by passing
|
|
245 |
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
|
246 |
dnl parameter.
|
|
247 |
AC_DEFUN([PKG_INSTALLDIR],
|
|
248 |
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
|
249 |
m4_pushdef([pkg_description],
|
|
250 |
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
|
251 |
AC_ARG_WITH([pkgconfigdir],
|
|
252 |
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
|
253 |
[with_pkgconfigdir=]pkg_default)
|
|
254 |
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
|
255 |
m4_popdef([pkg_default])
|
|
256 |
m4_popdef([pkg_description])
|
|
257 |
])dnl PKG_INSTALLDIR
|
|
258 |
|
|
259 |
|
|
260 |
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
|
261 |
dnl --------------------------------
|
|
262 |
dnl Since: 0.27
|
|
263 |
dnl
|
|
264 |
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
|
265 |
dnl module should install arch-independent pkg-config .pc files. By
|
|
266 |
dnl default the directory is $datadir/pkgconfig, but the default can be
|
|
267 |
dnl changed by passing DIRECTORY. The user can override through the
|
|
268 |
dnl --with-noarch-pkgconfigdir parameter.
|
|
269 |
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
|
270 |
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
|
271 |
m4_pushdef([pkg_description],
|
|
272 |
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
|
273 |
AC_ARG_WITH([noarch-pkgconfigdir],
|
|
274 |
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
|
275 |
[with_noarch_pkgconfigdir=]pkg_default)
|
|
276 |
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
|
277 |
m4_popdef([pkg_default])
|
|
278 |
m4_popdef([pkg_description])
|
|
279 |
])dnl PKG_NOARCH_INSTALLDIR
|
|
280 |
|
|
281 |
|
|
282 |
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
|
283 |
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
284 |
dnl -------------------------------------------
|
|
285 |
dnl Since: 0.28
|
|
286 |
dnl
|
|
287 |
dnl Retrieves the value of the pkg-config variable for the given module.
|
|
288 |
AC_DEFUN([PKG_CHECK_VAR],
|
|
289 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
290 |
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
|
291 |
|
|
292 |
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
|
293 |
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
|
294 |
|
|
295 |
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
|
296 |
])dnl PKG_CHECK_VAR
|
|
297 |
|
|
298 |
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
|
|
299 |
dnl
|
|
300 |
dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
|
301 |
dnl
|
|
302 |
dnl Permission is hereby granted, free of charge, to any person obtaining a
|
|
303 |
dnl copy of this software and associated documentation files (the "Software"),
|
|
304 |
dnl to deal in the Software without restriction, including without limitation
|
|
305 |
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
306 |
dnl and/or sell copies of the Software, and to permit persons to whom the
|
|
307 |
dnl Software is furnished to do so, subject to the following conditions:
|
|
308 |
dnl
|
|
309 |
dnl The above copyright notice and this permission notice (including the next
|
|
310 |
dnl paragraph) shall be included in all copies or substantial portions of the
|
|
311 |
dnl Software.
|
|
312 |
dnl
|
|
313 |
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
314 |
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
315 |
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
316 |
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
317 |
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
318 |
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
319 |
dnl DEALINGS IN THE SOFTWARE.
|
|
320 |
|
|
321 |
# XORG_MACROS_VERSION(required-version)
|
|
322 |
# -------------------------------------
|
|
323 |
# Minimum version: 1.1.0
|
|
324 |
#
|
|
325 |
# If you're using a macro added in Version 1.1 or newer, include this in
|
|
326 |
# your configure.ac with the minimum required version, such as:
|
|
327 |
# XORG_MACROS_VERSION(1.1)
|
|
328 |
#
|
|
329 |
# To ensure that this macro is defined, also add:
|
|
330 |
# m4_ifndef([XORG_MACROS_VERSION],
|
|
331 |
# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
|
|
332 |
#
|
|
333 |
#
|
|
334 |
# See the "minimum version" comment for each macro you use to see what
|
|
335 |
# version you require.
|
|
336 |
m4_defun([XORG_MACROS_VERSION],[
|
|
337 |
m4_define([vers_have], [1.19.0])
|
|
338 |
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
|
|
339 |
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
|
|
340 |
m4_if(m4_cmp(maj_have, maj_needed), 0,,
|
|
341 |
[m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
|
|
342 |
m4_if(m4_version_compare(vers_have, [$1]), -1,
|
|
343 |
[m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
|
|
344 |
m4_undefine([vers_have])
|
|
345 |
m4_undefine([maj_have])
|
|
346 |
m4_undefine([maj_needed])
|
|
347 |
]) # XORG_MACROS_VERSION
|
|
348 |
|
|
349 |
# XORG_PROG_RAWCPP()
|
|
350 |
# ------------------
|
|
351 |
# Minimum version: 1.0.0
|
|
352 |
#
|
|
353 |
# Find cpp program and necessary flags for use in pre-processing text files
|
|
354 |
# such as man pages and config files
|
|
355 |
AC_DEFUN([XORG_PROG_RAWCPP],[
|
|
356 |
AC_REQUIRE([AC_PROG_CPP])
|
|
357 |
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
|
|
358 |
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
|
|
359 |
|
|
360 |
# Check for flag to avoid builtin definitions - assumes unix is predefined,
|
|
361 |
# which is not the best choice for supporting other OS'es, but covers most
|
|
362 |
# of the ones we need for now.
|
|
363 |
AC_MSG_CHECKING([if $RAWCPP requires -undef])
|
|
364 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
|
|
365 |
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
|
366 |
AC_MSG_RESULT([no])
|
|
367 |
else
|
|
368 |
if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
|
369 |
RAWCPPFLAGS=-undef
|
|
370 |
AC_MSG_RESULT([yes])
|
|
371 |
# under Cygwin unix is still defined even with -undef
|
|
372 |
elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
|
373 |
RAWCPPFLAGS="-undef -ansi"
|
|
374 |
AC_MSG_RESULT([yes, with -ansi])
|
|
375 |
else
|
|
376 |
AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.])
|
|
377 |
fi
|
|
378 |
fi
|
|
379 |
rm -f conftest.$ac_ext
|
|
380 |
|
|
381 |
AC_MSG_CHECKING([if $RAWCPP requires -traditional])
|
|
382 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])])
|
|
383 |
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
|
|
384 |
AC_MSG_RESULT([no])
|
|
385 |
else
|
|
386 |
if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
|
|
387 |
TRADITIONALCPPFLAGS="-traditional"
|
|
388 |
RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
|
|
389 |
AC_MSG_RESULT([yes])
|
|
390 |
else
|
|
391 |
AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.])
|
|
392 |
fi
|
|
393 |
fi
|
|
394 |
rm -f conftest.$ac_ext
|
|
395 |
AC_SUBST(RAWCPPFLAGS)
|
|
396 |
AC_SUBST(TRADITIONALCPPFLAGS)
|
|
397 |
]) # XORG_PROG_RAWCPP
|
|
398 |
|
|
399 |
# XORG_MANPAGE_SECTIONS()
|
|
400 |
# -----------------------
|
|
401 |
# Minimum version: 1.0.0
|
|
402 |
#
|
|
403 |
# Determine which sections man pages go in for the different man page types
|
|
404 |
# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
|
|
405 |
# Not sure if there's any better way than just hardcoding by OS name.
|
|
406 |
# Override default settings by setting environment variables
|
|
407 |
# Added MAN_SUBSTS in version 1.8
|
|
408 |
# Added AC_PROG_SED in version 1.8
|
|
409 |
|
|
410 |
AC_DEFUN([XORG_MANPAGE_SECTIONS],[
|
|
411 |
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
412 |
AC_REQUIRE([AC_PROG_SED])
|
|
413 |
|
|
414 |
if test x$APP_MAN_SUFFIX = x ; then
|
|
415 |
APP_MAN_SUFFIX=1
|
|
416 |
fi
|
|
417 |
if test x$APP_MAN_DIR = x ; then
|
|
418 |
APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
|
|
419 |
fi
|
|
420 |
|
|
421 |
if test x$LIB_MAN_SUFFIX = x ; then
|
|
422 |
LIB_MAN_SUFFIX=3
|
|
423 |
fi
|
|
424 |
if test x$LIB_MAN_DIR = x ; then
|
|
425 |
LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
|
|
426 |
fi
|
|
427 |
|
|
428 |
if test x$FILE_MAN_SUFFIX = x ; then
|
|
429 |
case $host_os in
|
|
430 |
# Solaris 2.0 - 11 use SysV man page sections
|
|
431 |
solaris2.?|solaris2.1[[01]]) FILE_MAN_SUFFIX=4 ;;
|
|
432 |
*) FILE_MAN_SUFFIX=5 ;;
|
|
433 |
esac
|
|
434 |
fi
|
|
435 |
if test x$FILE_MAN_DIR = x ; then
|
|
436 |
FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
|
|
437 |
fi
|
|
438 |
|
|
439 |
if test x$MISC_MAN_SUFFIX = x ; then
|
|
440 |
case $host_os in
|
|
441 |
# Solaris 2.0 - 11 use SysV man page sections
|
|
442 |
solaris2.?|solaris2.1[[01]]) MISC_MAN_SUFFIX=5 ;;
|
|
443 |
*) MISC_MAN_SUFFIX=7 ;;
|
|
444 |
esac
|
|
445 |
fi
|
|
446 |
if test x$MISC_MAN_DIR = x ; then
|
|
447 |
MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
|
|
448 |
fi
|
|
449 |
|
|
450 |
if test x$DRIVER_MAN_SUFFIX = x ; then
|
|
451 |
case $host_os in
|
|
452 |
# Solaris 2.0 - 11 use SysV man page sections
|
|
453 |
solaris2.?|solaris2.1[[01]]) DRIVER_MAN_SUFFIX=7 ;;
|
|
454 |
*) DRIVER_MAN_SUFFIX=4 ;;
|
|
455 |
esac
|
|
456 |
fi
|
|
457 |
if test x$DRIVER_MAN_DIR = x ; then
|
|
458 |
DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
|
|
459 |
fi
|
|
460 |
|
|
461 |
if test x$ADMIN_MAN_SUFFIX = x ; then
|
|
462 |
case $host_os in
|
|
463 |
# Solaris 2.0 - 11 use SysV man page sections
|
|
464 |
solaris2.?|solaris2.1[[01]]) ADMIN_MAN_SUFFIX=1m ;;
|
|
465 |
*) ADMIN_MAN_SUFFIX=8 ;;
|
|
466 |
esac
|
|
467 |
fi
|
|
468 |
if test x$ADMIN_MAN_DIR = x ; then
|
|
469 |
ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
|
|
470 |
fi
|
|
471 |
|
|
472 |
|
|
473 |
AC_SUBST([APP_MAN_SUFFIX])
|
|
474 |
AC_SUBST([LIB_MAN_SUFFIX])
|
|
475 |
AC_SUBST([FILE_MAN_SUFFIX])
|
|
476 |
AC_SUBST([MISC_MAN_SUFFIX])
|
|
477 |
AC_SUBST([DRIVER_MAN_SUFFIX])
|
|
478 |
AC_SUBST([ADMIN_MAN_SUFFIX])
|
|
479 |
AC_SUBST([APP_MAN_DIR])
|
|
480 |
AC_SUBST([LIB_MAN_DIR])
|
|
481 |
AC_SUBST([FILE_MAN_DIR])
|
|
482 |
AC_SUBST([MISC_MAN_DIR])
|
|
483 |
AC_SUBST([DRIVER_MAN_DIR])
|
|
484 |
AC_SUBST([ADMIN_MAN_DIR])
|
|
485 |
|
|
486 |
XORG_MAN_PAGE="X Version 11"
|
|
487 |
AC_SUBST([XORG_MAN_PAGE])
|
|
488 |
MAN_SUBSTS="\
|
|
489 |
-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
|
|
490 |
-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
|
|
491 |
-e 's|__xservername__|Xorg|g' \
|
|
492 |
-e 's|__xconfigfile__|xorg.conf|g' \
|
|
493 |
-e 's|__projectroot__|\$(prefix)|g' \
|
|
494 |
-e 's|__apploaddir__|\$(appdefaultdir)|g' \
|
|
495 |
-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
|
|
496 |
-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
|
|
497 |
-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
|
|
498 |
-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
|
|
499 |
-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
|
|
500 |
-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
|
|
501 |
AC_SUBST([MAN_SUBSTS])
|
|
502 |
|
|
503 |
]) # XORG_MANPAGE_SECTIONS
|
|
504 |
|
|
505 |
# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
|
|
506 |
# ------------------------
|
|
507 |
# Minimum version: 1.7.0
|
|
508 |
#
|
|
509 |
# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
|
|
510 |
# provided by xorg-sgml-doctools, if installed.
|
|
511 |
AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
|
|
512 |
AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
|
|
513 |
XORG_SGML_PATH=
|
|
514 |
PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
|
|
515 |
[XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
|
|
516 |
[m4_ifval([$1],[:],
|
|
517 |
[if test x"$cross_compiling" != x"yes" ; then
|
|
518 |
AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
|
|
519 |
[XORG_SGML_PATH=$prefix/share/sgml])
|
|
520 |
fi])
|
|
521 |
])
|
|
522 |
|
|
523 |
# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
|
|
524 |
# the path and the name of the doc stylesheet
|
|
525 |
if test "x$XORG_SGML_PATH" != "x" ; then
|
|
526 |
AC_MSG_RESULT([$XORG_SGML_PATH])
|
|
527 |
STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
|
|
528 |
XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
|
|
529 |
else
|
|
530 |
AC_MSG_RESULT([no])
|
|
531 |
fi
|
|
532 |
|
|
533 |
AC_SUBST(XORG_SGML_PATH)
|
|
534 |
AC_SUBST(STYLESHEET_SRCDIR)
|
|
535 |
AC_SUBST(XSL_STYLESHEET)
|
|
536 |
AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
|
|
537 |
]) # XORG_CHECK_SGML_DOCTOOLS
|
|
538 |
|
|
539 |
# XORG_CHECK_LINUXDOC
|
|
540 |
# -------------------
|
|
541 |
# Minimum version: 1.0.0
|
|
542 |
#
|
|
543 |
# Defines the variable MAKE_TEXT if the necessary tools and
|
|
544 |
# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
|
|
545 |
# Whether or not the necessary tools and files are found can be checked
|
|
546 |
# with the AM_CONDITIONAL "BUILD_LINUXDOC"
|
|
547 |
AC_DEFUN([XORG_CHECK_LINUXDOC],[
|
|
548 |
AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
|
|
549 |
AC_REQUIRE([XORG_WITH_PS2PDF])
|
|
550 |
|
|
551 |
AC_PATH_PROG(LINUXDOC, linuxdoc)
|
|
552 |
|
|
553 |
AC_MSG_CHECKING([whether to build documentation])
|
|
554 |
|
|
555 |
if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
|
|
556 |
BUILDDOC=yes
|
|
557 |
else
|
|
558 |
BUILDDOC=no
|
|
559 |
fi
|
|
560 |
|
|
561 |
AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
|
|
562 |
|
|
563 |
AC_MSG_RESULT([$BUILDDOC])
|
|
564 |
|
|
565 |
AC_MSG_CHECKING([whether to build pdf documentation])
|
|
566 |
|
|
567 |
if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
|
|
568 |
BUILDPDFDOC=yes
|
|
569 |
else
|
|
570 |
BUILDPDFDOC=no
|
|
571 |
fi
|
|
572 |
|
|
573 |
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
|
|
574 |
|
|
575 |
AC_MSG_RESULT([$BUILDPDFDOC])
|
|
576 |
|
|
577 |
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
|
|
578 |
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
|
|
579 |
MAKE_PDF="$PS2PDF"
|
|
580 |
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0"
|
|
581 |
|
|
582 |
AC_SUBST(MAKE_TEXT)
|
|
583 |
AC_SUBST(MAKE_PS)
|
|
584 |
AC_SUBST(MAKE_PDF)
|
|
585 |
AC_SUBST(MAKE_HTML)
|
|
586 |
]) # XORG_CHECK_LINUXDOC
|
|
587 |
|
|
588 |
# XORG_CHECK_DOCBOOK
|
|
589 |
# -------------------
|
|
590 |
# Minimum version: 1.0.0
|
|
591 |
#
|
|
592 |
# Checks for the ability to build output formats from SGML DocBook source.
|
|
593 |
# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
|
|
594 |
# indicates whether the necessary tools and files are found and, if set,
|
|
595 |
# $(MAKE_XXX) blah.sgml will produce blah.xxx.
|
|
596 |
AC_DEFUN([XORG_CHECK_DOCBOOK],[
|
|
597 |
AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
|
|
598 |
|
|
599 |
BUILDTXTDOC=no
|
|
600 |
BUILDPDFDOC=no
|
|
601 |
BUILDPSDOC=no
|
|
602 |
BUILDHTMLDOC=no
|
|
603 |
|
|
604 |
AC_PATH_PROG(DOCBOOKPS, docbook2ps)
|
|
605 |
AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
|
|
606 |
AC_PATH_PROG(DOCBOOKHTML, docbook2html)
|
|
607 |
AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
|
|
608 |
|
|
609 |
AC_MSG_CHECKING([whether to build text documentation])
|
|
610 |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
|
|
611 |
test x$BUILD_TXTDOC != xno; then
|
|
612 |
BUILDTXTDOC=yes
|
|
613 |
fi
|
|
614 |
AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
|
|
615 |
AC_MSG_RESULT([$BUILDTXTDOC])
|
|
616 |
|
|
617 |
AC_MSG_CHECKING([whether to build PDF documentation])
|
|
618 |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
|
|
619 |
test x$BUILD_PDFDOC != xno; then
|
|
620 |
BUILDPDFDOC=yes
|
|
621 |
fi
|
|
622 |
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
|
|
623 |
AC_MSG_RESULT([$BUILDPDFDOC])
|
|
624 |
|
|
625 |
AC_MSG_CHECKING([whether to build PostScript documentation])
|
|
626 |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
|
|
627 |
test x$BUILD_PSDOC != xno; then
|
|
628 |
BUILDPSDOC=yes
|
|
629 |
fi
|
|
630 |
AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
|
|
631 |
AC_MSG_RESULT([$BUILDPSDOC])
|
|
632 |
|
|
633 |
AC_MSG_CHECKING([whether to build HTML documentation])
|
|
634 |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
|
|
635 |
test x$BUILD_HTMLDOC != xno; then
|
|
636 |
BUILDHTMLDOC=yes
|
|
637 |
fi
|
|
638 |
AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
|
|
639 |
AC_MSG_RESULT([$BUILDHTMLDOC])
|
|
640 |
|
|
641 |
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
|
|
642 |
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
|
|
643 |
MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
|
|
644 |
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
|
|
645 |
|
|
646 |
AC_SUBST(MAKE_TEXT)
|
|
647 |
AC_SUBST(MAKE_PS)
|
|
648 |
AC_SUBST(MAKE_PDF)
|
|
649 |
AC_SUBST(MAKE_HTML)
|
|
650 |
]) # XORG_CHECK_DOCBOOK
|
|
651 |
|
|
652 |
# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
|
|
653 |
# ----------------
|
|
654 |
# Minimum version: 1.5.0
|
|
655 |
# Minimum version for optional DEFAULT argument: 1.11.0
|
|
656 |
#
|
|
657 |
# Documentation tools are not always available on all platforms and sometimes
|
|
658 |
# not at the appropriate level. This macro enables a module to test for the
|
|
659 |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
|
660 |
# the --with-xmlto option, it allows maximum flexibilty in making decisions
|
|
661 |
# as whether or not to use the xmlto package. When DEFAULT is not specified,
|
|
662 |
# --with-xmlto assumes 'auto'.
|
|
663 |
#
|
|
664 |
# Interface to module:
|
|
665 |
# HAVE_XMLTO: used in makefiles to conditionally generate documentation
|
|
666 |
# XMLTO: returns the path of the xmlto program found
|
|
667 |
# returns the path set by the user in the environment
|
|
668 |
# --with-xmlto: 'yes' user instructs the module to use xmlto
|
|
669 |
# 'no' user instructs the module not to use xmlto
|
|
670 |
#
|
|
671 |
# Added in version 1.10.0
|
|
672 |
# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
|
|
673 |
# xmlto for text output requires either lynx, links, or w3m browsers
|
|
674 |
#
|
|
675 |
# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
|
|
676 |
#
|
|
677 |
AC_DEFUN([XORG_WITH_XMLTO],[
|
|
678 |
AC_ARG_VAR([XMLTO], [Path to xmlto command])
|
|
679 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
680 |
AC_ARG_WITH(xmlto,
|
|
681 |
AS_HELP_STRING([--with-xmlto],
|
|
682 |
[Use xmlto to regenerate documentation (default: ]_defopt[)]),
|
|
683 |
[use_xmlto=$withval], [use_xmlto=]_defopt)
|
|
684 |
m4_undefine([_defopt])
|
|
685 |
|
|
686 |
if test "x$use_xmlto" = x"auto"; then
|
|
687 |
AC_PATH_PROG([XMLTO], [xmlto])
|
|
688 |
if test "x$XMLTO" = "x"; then
|
|
689 |
AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
|
|
690 |
have_xmlto=no
|
|
691 |
else
|
|
692 |
have_xmlto=yes
|
|
693 |
fi
|
|
694 |
elif test "x$use_xmlto" = x"yes" ; then
|
|
695 |
AC_PATH_PROG([XMLTO], [xmlto])
|
|
696 |
if test "x$XMLTO" = "x"; then
|
|
697 |
AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
|
|
698 |
fi
|
|
699 |
have_xmlto=yes
|
|
700 |
elif test "x$use_xmlto" = x"no" ; then
|
|
701 |
if test "x$XMLTO" != "x"; then
|
|
702 |
AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
|
|
703 |
fi
|
|
704 |
have_xmlto=no
|
|
705 |
else
|
|
706 |
AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
|
|
707 |
fi
|
|
708 |
|
|
709 |
# Test for a minimum version of xmlto, if provided.
|
|
710 |
m4_ifval([$1],
|
|
711 |
[if test "$have_xmlto" = yes; then
|
|
712 |
# scrape the xmlto version
|
|
713 |
AC_MSG_CHECKING([the xmlto version])
|
|
714 |
xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
|
|
715 |
AC_MSG_RESULT([$xmlto_version])
|
|
716 |
AS_VERSION_COMPARE([$xmlto_version], [$1],
|
|
717 |
[if test "x$use_xmlto" = xauto; then
|
|
718 |
AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
|
|
719 |
have_xmlto=no
|
|
720 |
else
|
|
721 |
AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
|
|
722 |
fi])
|
|
723 |
fi])
|
|
724 |
|
|
725 |
# Test for the ability of xmlto to generate a text target
|
|
726 |
#
|
|
727 |
# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
|
|
728 |
# following test for empty XML docbook files.
|
|
729 |
# For compatibility reasons use the following empty XML docbook file and if
|
|
730 |
# it fails try it again with a non-empty XML file.
|
|
731 |
have_xmlto_text=no
|
|
732 |
cat > conftest.xml << "EOF"
|
|
733 |
EOF
|
|
734 |
AS_IF([test "$have_xmlto" = yes],
|
|
735 |
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
|
|
736 |
[have_xmlto_text=yes],
|
|
737 |
[# Try it again with a non-empty XML file.
|
|
738 |
cat > conftest.xml << "EOF"
|
|
739 |
<x></x>
|
|
740 |
EOF
|
|
741 |
AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
|
|
742 |
[have_xmlto_text=yes],
|
|
743 |
[AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
|
|
744 |
rm -f conftest.xml
|
|
745 |
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
|
|
746 |
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
|
|
747 |
]) # XORG_WITH_XMLTO
|
|
748 |
|
|
749 |
# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
|
|
750 |
# --------------------------------------------
|
|
751 |
# Minimum version: 1.12.0
|
|
752 |
# Minimum version for optional DEFAULT argument: 1.12.0
|
|
753 |
#
|
|
754 |
# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
|
|
755 |
# XML-based language used for the transformation of XML documents.
|
|
756 |
# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
|
|
757 |
# It is used under the cover by xmlto to generate html files from DocBook/XML.
|
|
758 |
# The XSLT processor is often used as a standalone tool for transformations.
|
|
759 |
# It should not be assumed that this tool is used only to work with documnetation.
|
|
760 |
# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
|
|
761 |
#
|
|
762 |
# Interface to module:
|
|
763 |
# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
|
|
764 |
# XSLTPROC: returns the path of the xsltproc program found
|
|
765 |
# returns the path set by the user in the environment
|
|
766 |
# --with-xsltproc: 'yes' user instructs the module to use xsltproc
|
|
767 |
# 'no' user instructs the module not to use xsltproc
|
|
768 |
# have_xsltproc: returns yes if xsltproc found in PATH or no
|
|
769 |
#
|
|
770 |
# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
|
|
771 |
#
|
|
772 |
AC_DEFUN([XORG_WITH_XSLTPROC],[
|
|
773 |
AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
|
|
774 |
# Preserves the interface, should it be implemented later
|
|
775 |
m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
|
|
776 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
777 |
AC_ARG_WITH(xsltproc,
|
|
778 |
AS_HELP_STRING([--with-xsltproc],
|
|
779 |
[Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
|
|
780 |
[use_xsltproc=$withval], [use_xsltproc=]_defopt)
|
|
781 |
m4_undefine([_defopt])
|
|
782 |
|
|
783 |
if test "x$use_xsltproc" = x"auto"; then
|
|
784 |
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
|
785 |
if test "x$XSLTPROC" = "x"; then
|
|
786 |
AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
|
|
787 |
have_xsltproc=no
|
|
788 |
else
|
|
789 |
have_xsltproc=yes
|
|
790 |
fi
|
|
791 |
elif test "x$use_xsltproc" = x"yes" ; then
|
|
792 |
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
|
793 |
if test "x$XSLTPROC" = "x"; then
|
|
794 |
AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
|
|
795 |
fi
|
|
796 |
have_xsltproc=yes
|
|
797 |
elif test "x$use_xsltproc" = x"no" ; then
|
|
798 |
if test "x$XSLTPROC" != "x"; then
|
|
799 |
AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
|
|
800 |
fi
|
|
801 |
have_xsltproc=no
|
|
802 |
else
|
|
803 |
AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
|
|
804 |
fi
|
|
805 |
|
|
806 |
AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
|
|
807 |
]) # XORG_WITH_XSLTPROC
|
|
808 |
|
|
809 |
# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
|
|
810 |
# ----------------------------------------
|
|
811 |
# Minimum version: 1.15.0
|
|
812 |
#
|
|
813 |
# PERL (Practical Extraction and Report Language) is a language optimized for
|
|
814 |
# scanning arbitrary text files, extracting information from those text files,
|
|
815 |
# and printing reports based on that information.
|
|
816 |
#
|
|
817 |
# When DEFAULT is not specified, --with-perl assumes 'auto'.
|
|
818 |
#
|
|
819 |
# Interface to module:
|
|
820 |
# HAVE_PERL: used in makefiles to conditionally scan text files
|
|
821 |
# PERL: returns the path of the perl program found
|
|
822 |
# returns the path set by the user in the environment
|
|
823 |
# --with-perl: 'yes' user instructs the module to use perl
|
|
824 |
# 'no' user instructs the module not to use perl
|
|
825 |
# have_perl: returns yes if perl found in PATH or no
|
|
826 |
#
|
|
827 |
# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
|
|
828 |
#
|
|
829 |
AC_DEFUN([XORG_WITH_PERL],[
|
|
830 |
AC_ARG_VAR([PERL], [Path to perl command])
|
|
831 |
# Preserves the interface, should it be implemented later
|
|
832 |
m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
|
|
833 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
834 |
AC_ARG_WITH(perl,
|
|
835 |
AS_HELP_STRING([--with-perl],
|
|
836 |
[Use perl for extracting information from files (default: ]_defopt[)]),
|
|
837 |
[use_perl=$withval], [use_perl=]_defopt)
|
|
838 |
m4_undefine([_defopt])
|
|
839 |
|
|
840 |
if test "x$use_perl" = x"auto"; then
|
|
841 |
AC_PATH_PROG([PERL], [perl])
|
|
842 |
if test "x$PERL" = "x"; then
|
|
843 |
AC_MSG_WARN([perl not found - cannot extract information and report])
|
|
844 |
have_perl=no
|
|
845 |
else
|
|
846 |
have_perl=yes
|
|
847 |
fi
|
|
848 |
elif test "x$use_perl" = x"yes" ; then
|
|
849 |
AC_PATH_PROG([PERL], [perl])
|
|
850 |
if test "x$PERL" = "x"; then
|
|
851 |
AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
|
|
852 |
fi
|
|
853 |
have_perl=yes
|
|
854 |
elif test "x$use_perl" = x"no" ; then
|
|
855 |
if test "x$PERL" != "x"; then
|
|
856 |
AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
|
|
857 |
fi
|
|
858 |
have_perl=no
|
|
859 |
else
|
|
860 |
AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
|
|
861 |
fi
|
|
862 |
|
|
863 |
AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
|
|
864 |
]) # XORG_WITH_PERL
|
|
865 |
|
|
866 |
# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
|
|
867 |
# ----------------
|
|
868 |
# Minimum version: 1.5.0
|
|
869 |
# Minimum version for optional DEFAULT argument: 1.11.0
|
|
870 |
#
|
|
871 |
# Documentation tools are not always available on all platforms and sometimes
|
|
872 |
# not at the appropriate level. This macro enables a module to test for the
|
|
873 |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
|
874 |
# the --with-asciidoc option, it allows maximum flexibilty in making decisions
|
|
875 |
# as whether or not to use the asciidoc package. When DEFAULT is not specified,
|
|
876 |
# --with-asciidoc assumes 'auto'.
|
|
877 |
#
|
|
878 |
# Interface to module:
|
|
879 |
# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
|
|
880 |
# ASCIIDOC: returns the path of the asciidoc program found
|
|
881 |
# returns the path set by the user in the environment
|
|
882 |
# --with-asciidoc: 'yes' user instructs the module to use asciidoc
|
|
883 |
# 'no' user instructs the module not to use asciidoc
|
|
884 |
#
|
|
885 |
# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
|
|
886 |
#
|
|
887 |
AC_DEFUN([XORG_WITH_ASCIIDOC],[
|
|
888 |
AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
|
|
889 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
890 |
AC_ARG_WITH(asciidoc,
|
|
891 |
AS_HELP_STRING([--with-asciidoc],
|
|
892 |
[Use asciidoc to regenerate documentation (default: ]_defopt[)]),
|
|
893 |
[use_asciidoc=$withval], [use_asciidoc=]_defopt)
|
|
894 |
m4_undefine([_defopt])
|
|
895 |
|
|
896 |
if test "x$use_asciidoc" = x"auto"; then
|
|
897 |
AC_PATH_PROG([ASCIIDOC], [asciidoc])
|
|
898 |
if test "x$ASCIIDOC" = "x"; then
|
|
899 |
AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
|
|
900 |
have_asciidoc=no
|
|
901 |
else
|
|
902 |
have_asciidoc=yes
|
|
903 |
fi
|
|
904 |
elif test "x$use_asciidoc" = x"yes" ; then
|
|
905 |
AC_PATH_PROG([ASCIIDOC], [asciidoc])
|
|
906 |
if test "x$ASCIIDOC" = "x"; then
|
|
907 |
AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
|
|
908 |
fi
|
|
909 |
have_asciidoc=yes
|
|
910 |
elif test "x$use_asciidoc" = x"no" ; then
|
|
911 |
if test "x$ASCIIDOC" != "x"; then
|
|
912 |
AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
|
|
913 |
fi
|
|
914 |
have_asciidoc=no
|
|
915 |
else
|
|
916 |
AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
|
|
917 |
fi
|
|
918 |
m4_ifval([$1],
|
|
919 |
[if test "$have_asciidoc" = yes; then
|
|
920 |
# scrape the asciidoc version
|
|
921 |
AC_MSG_CHECKING([the asciidoc version])
|
|
922 |
asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
|
|
923 |
AC_MSG_RESULT([$asciidoc_version])
|
|
924 |
AS_VERSION_COMPARE([$asciidoc_version], [$1],
|
|
925 |
[if test "x$use_asciidoc" = xauto; then
|
|
926 |
AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
|
|
927 |
have_asciidoc=no
|
|
928 |
else
|
|
929 |
AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
|
|
930 |
fi])
|
|
931 |
fi])
|
|
932 |
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
|
|
933 |
]) # XORG_WITH_ASCIIDOC
|
|
934 |
|
|
935 |
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
|
|
936 |
# -------------------------------------------
|
|
937 |
# Minimum version: 1.5.0
|
|
938 |
# Minimum version for optional DEFAULT argument: 1.11.0
|
|
939 |
# Minimum version for optional DOT checking: 1.18.0
|
|
940 |
#
|
|
941 |
# Documentation tools are not always available on all platforms and sometimes
|
|
942 |
# not at the appropriate level. This macro enables a module to test for the
|
|
943 |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
|
944 |
# the --with-doxygen option, it allows maximum flexibilty in making decisions
|
|
945 |
# as whether or not to use the doxygen package. When DEFAULT is not specified,
|
|
946 |
# --with-doxygen assumes 'auto'.
|
|
947 |
#
|
|
948 |
# Interface to module:
|
|
949 |
# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
|
|
950 |
# DOXYGEN: returns the path of the doxygen program found
|
|
951 |
# returns the path set by the user in the environment
|
|
952 |
# --with-doxygen: 'yes' user instructs the module to use doxygen
|
|
953 |
# 'no' user instructs the module not to use doxygen
|
|
954 |
#
|
|
955 |
# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
|
|
956 |
#
|
|
957 |
AC_DEFUN([XORG_WITH_DOXYGEN],[
|
|
958 |
AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
|
|
959 |
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
|
|
960 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
961 |
AC_ARG_WITH(doxygen,
|
|
962 |
AS_HELP_STRING([--with-doxygen],
|
|
963 |
[Use doxygen to regenerate documentation (default: ]_defopt[)]),
|
|
964 |
[use_doxygen=$withval], [use_doxygen=]_defopt)
|
|
965 |
m4_undefine([_defopt])
|
|
966 |
|
|
967 |
if test "x$use_doxygen" = x"auto"; then
|
|
968 |
AC_PATH_PROG([DOXYGEN], [doxygen])
|
|
969 |
if test "x$DOXYGEN" = "x"; then
|
|
970 |
AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
|
|
971 |
have_doxygen=no
|
|
972 |
else
|
|
973 |
have_doxygen=yes
|
|
974 |
fi
|
|
975 |
elif test "x$use_doxygen" = x"yes" ; then
|
|
976 |
AC_PATH_PROG([DOXYGEN], [doxygen])
|
|
977 |
if test "x$DOXYGEN" = "x"; then
|
|
978 |
AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
|
|
979 |
fi
|
|
980 |
have_doxygen=yes
|
|
981 |
elif test "x$use_doxygen" = x"no" ; then
|
|
982 |
if test "x$DOXYGEN" != "x"; then
|
|
983 |
AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
|
|
984 |
fi
|
|
985 |
have_doxygen=no
|
|
986 |
else
|
|
987 |
AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
|
|
988 |
fi
|
|
989 |
m4_ifval([$1],
|
|
990 |
[if test "$have_doxygen" = yes; then
|
|
991 |
# scrape the doxygen version
|
|
992 |
AC_MSG_CHECKING([the doxygen version])
|
|
993 |
doxygen_version=`$DOXYGEN --version 2>/dev/null`
|
|
994 |
AC_MSG_RESULT([$doxygen_version])
|
|
995 |
AS_VERSION_COMPARE([$doxygen_version], [$1],
|
|
996 |
[if test "x$use_doxygen" = xauto; then
|
|
997 |
AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
|
|
998 |
have_doxygen=no
|
|
999 |
else
|
|
1000 |
AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
|
|
1001 |
fi])
|
|
1002 |
fi])
|
|
1003 |
|
|
1004 |
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
|
|
1005 |
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
|
|
1006 |
dnl HAVE_DOT = @HAVE_DOT@
|
|
1007 |
HAVE_DOT=no
|
|
1008 |
if test "x$have_doxygen" = "xyes"; then
|
|
1009 |
AC_PATH_PROG([DOT], [dot])
|
|
1010 |
if test "x$DOT" != "x"; then
|
|
1011 |
HAVE_DOT=yes
|
|
1012 |
fi
|
|
1013 |
fi
|
|
1014 |
|
|
1015 |
AC_SUBST([HAVE_DOT])
|
|
1016 |
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
|
|
1017 |
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
|
|
1018 |
]) # XORG_WITH_DOXYGEN
|
|
1019 |
|
|
1020 |
# XORG_WITH_GROFF([DEFAULT])
|
|
1021 |
# ----------------
|
|
1022 |
# Minimum version: 1.6.0
|
|
1023 |
# Minimum version for optional DEFAULT argument: 1.11.0
|
|
1024 |
#
|
|
1025 |
# Documentation tools are not always available on all platforms and sometimes
|
|
1026 |
# not at the appropriate level. This macro enables a module to test for the
|
|
1027 |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
|
1028 |
# the --with-groff option, it allows maximum flexibilty in making decisions
|
|
1029 |
# as whether or not to use the groff package. When DEFAULT is not specified,
|
|
1030 |
# --with-groff assumes 'auto'.
|
|
1031 |
#
|
|
1032 |
# Interface to module:
|
|
1033 |
# HAVE_GROFF: used in makefiles to conditionally generate documentation
|
|
1034 |
# HAVE_GROFF_MM: the memorandum macros (-mm) package
|
|
1035 |
# HAVE_GROFF_MS: the -ms macros package
|
|
1036 |
# GROFF: returns the path of the groff program found
|
|
1037 |
# returns the path set by the user in the environment
|
|
1038 |
# --with-groff: 'yes' user instructs the module to use groff
|
|
1039 |
# 'no' user instructs the module not to use groff
|
|
1040 |
#
|
|
1041 |
# Added in version 1.9.0:
|
|
1042 |
# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
|
|
1043 |
# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
|
|
1044 |
# psselect from the psutils package.
|
|
1045 |
# the ghostcript package. Refer to the grohtml man pages
|
|
1046 |
#
|
|
1047 |
# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
|
|
1048 |
#
|
|
1049 |
# OS and distros often splits groff in a basic and full package, the former
|
|
1050 |
# having the groff program and the later having devices, fonts and macros
|
|
1051 |
# Checking for the groff executable is not enough.
|
|
1052 |
#
|
|
1053 |
# If macros are missing, we cannot assume that groff is useless, so we don't
|
|
1054 |
# unset HAVE_GROFF or GROFF env variables.
|
|
1055 |
# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
|
|
1056 |
#
|
|
1057 |
AC_DEFUN([XORG_WITH_GROFF],[
|
|
1058 |
AC_ARG_VAR([GROFF], [Path to groff command])
|
|
1059 |
m4_define([_defopt], m4_default([$1], [auto]))
|
|
1060 |
AC_ARG_WITH(groff,
|
|
1061 |
AS_HELP_STRING([--with-groff],
|
|
1062 |
[Use groff to regenerate documentation (default: ]_defopt[)]),
|
|
1063 |
[use_groff=$withval], [use_groff=]_defopt)
|
|
1064 |
m4_undefine([_defopt])
|
|
1065 |
|
|
1066 |
if test "x$use_groff" = x"auto"; then
|
|
1067 |
AC_PATH_PROG([GROFF], [groff])
|
|
1068 |
if test "x$GROFF" = "x"; then
|
|
1069 |
AC_MSG_WARN([groff not found - documentation targets will be skipped])
|
|
1070 |
have_groff=no
|
|
1071 |
else
|
|
1072 |
have_groff=yes
|
|
1073 |
fi
|
|
1074 |
elif test "x$use_groff" = x"yes" ; then
|
|
1075 |
AC_PATH_PROG([GROFF], [groff])
|
|
1076 |
if test "x$GROFF" = "x"; then
|
|
1077 |
AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
|
|
1078 |
fi
|
|
1079 |
have_groff=yes
|
|
1080 |
elif test "x$use_groff" = x"no" ; then
|
|
1081 |
if test "x$GROFF" != "x"; then
|
|
1082 |
AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
|
|
1083 |
fi
|
|
1084 |
have_groff=no
|
|
1085 |
else
|
|
1086 |
AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
|
|
1087 |
fi
|
|
1088 |
|
|
1089 |
# We have groff, test for the presence of the macro packages
|
|
1090 |
if test "x$have_groff" = x"yes"; then
|
|
1091 |
AC_MSG_CHECKING([for ${GROFF} -ms macros])
|
|
1092 |
if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
|
|
1093 |
groff_ms_works=yes
|
|
1094 |
else
|
|
1095 |
groff_ms_works=no
|
|
1096 |
fi
|
|
1097 |
AC_MSG_RESULT([$groff_ms_works])
|
|
1098 |
AC_MSG_CHECKING([for ${GROFF} -mm macros])
|
|
1099 |
if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
|
|
1100 |
groff_mm_works=yes
|
|
1101 |
else
|
|
1102 |
groff_mm_works=no
|
|
1103 |
fi
|
|
1104 |
AC_MSG_RESULT([$groff_mm_works])
|
|
1105 |
fi
|
|
1106 |
|
|
1107 |
# We have groff, test for HTML dependencies, one command per package
|
|
1108 |
if test "x$have_groff" = x"yes"; then
|
|
1109 |
AC_PATH_PROGS(GS_PATH, [gs gswin32c])
|
|
1110 |
AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
|
|
1111 |
AC_PATH_PROG(PSSELECT_PATH, [psselect])
|
|
1112 |
if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
|
|
1113 |
have_groff_html=yes
|
|
1114 |
else
|
|
1115 |
have_groff_html=no
|
|
1116 |
AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
|
|
1117 |
fi
|
|
1118 |
fi
|
|
1119 |
|
|
1120 |
# Set Automake conditionals for Makefiles
|
|
1121 |
AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
|
|
1122 |
AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
|
|
1123 |
AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
|
|
1124 |
AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
|
|
1125 |
]) # XORG_WITH_GROFF
|
|
1126 |
|
|
1127 |
# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
|
|
1128 |
# ---------------------------------------
|
|
1129 |
# Minimum version: 1.6.0
|
|
1130 |
# Minimum version for optional DEFAULT argument: 1.11.0
|
|
1131 |
# Minimum version for optional MIN-VERSION argument: 1.15.0
|
|
1132 |
#
|
|
1133 |
# Documentation tools are not always available on all platforms and sometimes
|
|
1134 |
# not at the appropriate level. This macro enables a module to test for the
|
|
1135 |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
|
1136 |
# the --with-fop option, it allows maximum flexibilty in making decisions
|
|
1137 |
# as whether or not to use the fop package. When DEFAULT is not specified,
|
|
1138 |
# --with-fop assumes 'auto'.
|
|
1139 |
#
|
|
1140 |
# Interface to module:
|
|
1141 |
# HAVE_FOP: used in makefiles to conditionally generate documentation
|
|
1142 |
# FOP: returns the path of the fop program found
|
|
1143 |
# returns the path set by the user in the environment
|
|
1144 |
# --with-fop: 'yes' user instructs the module to use fop
|
|
1145 |
# 'no' user instructs the module not to use fop
|
|
1146 |
#
|
|
1147 |
# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
|
|
1148 |
#
|
|
1149 |
AC_DEFUN([XORG_WITH_FOP],[
|
|
1150 |
AC_ARG_VAR([FOP], [Path to fop command])
|
|
1151 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
1152 |
AC_ARG_WITH(fop,
|
|
1153 |
AS_HELP_STRING([--with-fop],
|
|
1154 |
[Use fop to regenerate documentation (default: ]_defopt[)]),
|
|
1155 |
[use_fop=$withval], [use_fop=]_defopt)
|
|
1156 |
m4_undefine([_defopt])
|
|
1157 |
|
|
1158 |
if test "x$use_fop" = x"auto"; then
|
|
1159 |
AC_PATH_PROG([FOP], [fop])
|
|
1160 |
if test "x$FOP" = "x"; then
|
|
1161 |
AC_MSG_WARN([fop not found - documentation targets will be skipped])
|
|
1162 |
have_fop=no
|
|
1163 |
else
|
|
1164 |
have_fop=yes
|
|
1165 |
fi
|
|
1166 |
elif test "x$use_fop" = x"yes" ; then
|
|
1167 |
AC_PATH_PROG([FOP], [fop])
|
|
1168 |
if test "x$FOP" = "x"; then
|
|
1169 |
AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
|
|
1170 |
fi
|
|
1171 |
have_fop=yes
|
|
1172 |
elif test "x$use_fop" = x"no" ; then
|
|
1173 |
if test "x$FOP" != "x"; then
|
|
1174 |
AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
|
|
1175 |
fi
|
|
1176 |
have_fop=no
|
|
1177 |
else
|
|
1178 |
AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
|
|
1179 |
fi
|
|
1180 |
|
|
1181 |
# Test for a minimum version of fop, if provided.
|
|
1182 |
m4_ifval([$1],
|
|
1183 |
[if test "$have_fop" = yes; then
|
|
1184 |
# scrape the fop version
|
|
1185 |
AC_MSG_CHECKING([for fop minimum version])
|
|
1186 |
fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
|
|
1187 |
AC_MSG_RESULT([$fop_version])
|
|
1188 |
AS_VERSION_COMPARE([$fop_version], [$1],
|
|
1189 |
[if test "x$use_fop" = xauto; then
|
|
1190 |
AC_MSG_WARN([fop version $fop_version found, but $1 needed])
|
|
1191 |
have_fop=no
|
|
1192 |
else
|
|
1193 |
AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
|
|
1194 |
fi])
|
|
1195 |
fi])
|
|
1196 |
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
|
|
1197 |
]) # XORG_WITH_FOP
|
|
1198 |
|
|
1199 |
# XORG_WITH_M4([MIN-VERSION])
|
|
1200 |
# ---------------------------
|
|
1201 |
# Minimum version: 1.19.0
|
|
1202 |
#
|
|
1203 |
# This macro attempts to locate an m4 macro processor which supports
|
|
1204 |
# -I option and is only useful for modules relying on M4 in order to
|
|
1205 |
# expand macros in source code files.
|
|
1206 |
#
|
|
1207 |
# Interface to module:
|
|
1208 |
# M4: returns the path of the m4 program found
|
|
1209 |
# returns the path set by the user in the environment
|
|
1210 |
#
|
|
1211 |
AC_DEFUN([XORG_WITH_M4], [
|
|
1212 |
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
|
|
1213 |
[AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
|
|
1214 |
[[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
|
|
1215 |
ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
|
|
1216 |
[AC_MSG_ERROR([could not find m4 that supports -I option])],
|
|
1217 |
[$PATH:/usr/gnu/bin])])
|
|
1218 |
|
|
1219 |
AC_SUBST([M4], [$ac_cv_path_M4])
|
|
1220 |
]) # XORG_WITH_M4
|
|
1221 |
|
|
1222 |
# XORG_WITH_PS2PDF([DEFAULT])
|
|
1223 |
# ----------------
|
|
1224 |
# Minimum version: 1.6.0
|
|
1225 |
# Minimum version for optional DEFAULT argument: 1.11.0
|
|
1226 |
#
|
|
1227 |
# Documentation tools are not always available on all platforms and sometimes
|
|
1228 |
# not at the appropriate level. This macro enables a module to test for the
|
|
1229 |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
|
1230 |
# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
|
|
1231 |
# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
|
|
1232 |
# --with-ps2pdf assumes 'auto'.
|
|
1233 |
#
|
|
1234 |
# Interface to module:
|
|
1235 |
# HAVE_PS2PDF: used in makefiles to conditionally generate documentation
|
|
1236 |
# PS2PDF: returns the path of the ps2pdf program found
|
|
1237 |
# returns the path set by the user in the environment
|
|
1238 |
# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
|
|
1239 |
# 'no' user instructs the module not to use ps2pdf
|
|
1240 |
#
|
|
1241 |
# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
|
|
1242 |
#
|
|
1243 |
AC_DEFUN([XORG_WITH_PS2PDF],[
|
|
1244 |
AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
|
|
1245 |
m4_define([_defopt], m4_default([$1], [auto]))
|
|
1246 |
AC_ARG_WITH(ps2pdf,
|
|
1247 |
AS_HELP_STRING([--with-ps2pdf],
|
|
1248 |
[Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
|
|
1249 |
[use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
|
|
1250 |
m4_undefine([_defopt])
|
|
1251 |
|
|
1252 |
if test "x$use_ps2pdf" = x"auto"; then
|
|
1253 |
AC_PATH_PROG([PS2PDF], [ps2pdf])
|
|
1254 |
if test "x$PS2PDF" = "x"; then
|
|
1255 |
AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
|
|
1256 |
have_ps2pdf=no
|
|
1257 |
else
|
|
1258 |
have_ps2pdf=yes
|
|
1259 |
fi
|
|
1260 |
elif test "x$use_ps2pdf" = x"yes" ; then
|
|
1261 |
AC_PATH_PROG([PS2PDF], [ps2pdf])
|
|
1262 |
if test "x$PS2PDF" = "x"; then
|
|
1263 |
AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
|
|
1264 |
fi
|
|
1265 |
have_ps2pdf=yes
|
|
1266 |
elif test "x$use_ps2pdf" = x"no" ; then
|
|
1267 |
if test "x$PS2PDF" != "x"; then
|
|
1268 |
AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
|
|
1269 |
fi
|
|
1270 |
have_ps2pdf=no
|
|
1271 |
else
|
|
1272 |
AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
|
|
1273 |
fi
|
|
1274 |
AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
|
|
1275 |
]) # XORG_WITH_PS2PDF
|
|
1276 |
|
|
1277 |
# XORG_ENABLE_DOCS (enable_docs=yes)
|
|
1278 |
# ----------------
|
|
1279 |
# Minimum version: 1.6.0
|
|
1280 |
#
|
|
1281 |
# Documentation tools are not always available on all platforms and sometimes
|
|
1282 |
# not at the appropriate level. This macro enables a builder to skip all
|
|
1283 |
# documentation targets except traditional man pages.
|
|
1284 |
# Combined with the specific tool checking macros XORG_WITH_*, it provides
|
|
1285 |
# maximum flexibilty in controlling documentation building.
|
|
1286 |
# Refer to:
|
|
1287 |
# XORG_WITH_XMLTO --with-xmlto
|
|
1288 |
# XORG_WITH_ASCIIDOC --with-asciidoc
|
|
1289 |
# XORG_WITH_DOXYGEN --with-doxygen
|
|
1290 |
# XORG_WITH_FOP --with-fop
|
|
1291 |
# XORG_WITH_GROFF --with-groff
|
|
1292 |
# XORG_WITH_PS2PDF --with-ps2pdf
|
|
1293 |
#
|
|
1294 |
# Interface to module:
|
|
1295 |
# ENABLE_DOCS: used in makefiles to conditionally generate documentation
|
|
1296 |
# --enable-docs: 'yes' user instructs the module to generate docs
|
|
1297 |
# 'no' user instructs the module not to generate docs
|
|
1298 |
# parm1: specify the default value, yes or no.
|
|
1299 |
#
|
|
1300 |
AC_DEFUN([XORG_ENABLE_DOCS],[
|
|
1301 |
m4_define([docs_default], m4_default([$1], [yes]))
|
|
1302 |
AC_ARG_ENABLE(docs,
|
|
1303 |
AS_HELP_STRING([--enable-docs],
|
|
1304 |
[Enable building the documentation (default: ]docs_default[)]),
|
|
1305 |
[build_docs=$enableval], [build_docs=]docs_default)
|
|
1306 |
m4_undefine([docs_default])
|
|
1307 |
AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
|
|
1308 |
AC_MSG_CHECKING([whether to build documentation])
|
|
1309 |
AC_MSG_RESULT([$build_docs])
|
|
1310 |
]) # XORG_ENABLE_DOCS
|
|
1311 |
|
|
1312 |
# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
|
|
1313 |
# ----------------
|
|
1314 |
# Minimum version: 1.6.0
|
|
1315 |
#
|
|
1316 |
# This macro enables a builder to skip all developer documentation.
|
|
1317 |
# Combined with the specific tool checking macros XORG_WITH_*, it provides
|
|
1318 |
# maximum flexibilty in controlling documentation building.
|
|
1319 |
# Refer to:
|
|
1320 |
# XORG_WITH_XMLTO --with-xmlto
|
|
1321 |
# XORG_WITH_ASCIIDOC --with-asciidoc
|
|
1322 |
# XORG_WITH_DOXYGEN --with-doxygen
|
|
1323 |
# XORG_WITH_FOP --with-fop
|
|
1324 |
# XORG_WITH_GROFF --with-groff
|
|
1325 |
# XORG_WITH_PS2PDF --with-ps2pdf
|
|
1326 |
#
|
|
1327 |
# Interface to module:
|
|
1328 |
# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs
|
|
1329 |
# --enable-devel-docs: 'yes' user instructs the module to generate developer docs
|
|
1330 |
# 'no' user instructs the module not to generate developer docs
|
|
1331 |
# parm1: specify the default value, yes or no.
|
|
1332 |
#
|
|
1333 |
AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
|
|
1334 |
m4_define([devel_default], m4_default([$1], [yes]))
|
|
1335 |
AC_ARG_ENABLE(devel-docs,
|
|
1336 |
AS_HELP_STRING([--enable-devel-docs],
|
|
1337 |
[Enable building the developer documentation (default: ]devel_default[)]),
|
|
1338 |
[build_devel_docs=$enableval], [build_devel_docs=]devel_default)
|
|
1339 |
m4_undefine([devel_default])
|
|
1340 |
AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
|
|
1341 |
AC_MSG_CHECKING([whether to build developer documentation])
|
|
1342 |
AC_MSG_RESULT([$build_devel_docs])
|
|
1343 |
]) # XORG_ENABLE_DEVEL_DOCS
|
|
1344 |
|
|
1345 |
# XORG_ENABLE_SPECS (enable_specs=yes)
|
|
1346 |
# ----------------
|
|
1347 |
# Minimum version: 1.6.0
|
|
1348 |
#
|
|
1349 |
# This macro enables a builder to skip all functional specification targets.
|
|
1350 |
# Combined with the specific tool checking macros XORG_WITH_*, it provides
|
|
1351 |
# maximum flexibilty in controlling documentation building.
|
|
1352 |
# Refer to:
|
|
1353 |
# XORG_WITH_XMLTO --with-xmlto
|
|
1354 |
# XORG_WITH_ASCIIDOC --with-asciidoc
|
|
1355 |
# XORG_WITH_DOXYGEN --with-doxygen
|
|
1356 |
# XORG_WITH_FOP --with-fop
|
|
1357 |
# XORG_WITH_GROFF --with-groff
|
|
1358 |
# XORG_WITH_PS2PDF --with-ps2pdf
|
|
1359 |
#
|
|
1360 |
# Interface to module:
|
|
1361 |
# ENABLE_SPECS: used in makefiles to conditionally generate specs
|
|
1362 |
# --enable-specs: 'yes' user instructs the module to generate specs
|
|
1363 |
# 'no' user instructs the module not to generate specs
|
|
1364 |
# parm1: specify the default value, yes or no.
|
|
1365 |
#
|
|
1366 |
AC_DEFUN([XORG_ENABLE_SPECS],[
|
|
1367 |
m4_define([spec_default], m4_default([$1], [yes]))
|
|
1368 |
AC_ARG_ENABLE(specs,
|
|
1369 |
AS_HELP_STRING([--enable-specs],
|
|
1370 |
[Enable building the specs (default: ]spec_default[)]),
|
|
1371 |
[build_specs=$enableval], [build_specs=]spec_default)
|
|
1372 |
m4_undefine([spec_default])
|
|
1373 |
AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
|
|
1374 |
AC_MSG_CHECKING([whether to build functional specifications])
|
|
1375 |
AC_MSG_RESULT([$build_specs])
|
|
1376 |
]) # XORG_ENABLE_SPECS
|
|
1377 |
|
|
1378 |
# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
|
|
1379 |
# ----------------------------------------------
|
|
1380 |
# Minimum version: 1.13.0
|
|
1381 |
#
|
|
1382 |
# This macro enables a builder to enable/disable unit testing
|
|
1383 |
# It makes no assumption about the test cases implementation
|
|
1384 |
# Test cases may or may not use Automake "Support for test suites"
|
|
1385 |
# They may or may not use the software utility library GLib
|
|
1386 |
#
|
|
1387 |
# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
|
|
1388 |
# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
|
|
1389 |
# The variable enable_unit_tests is used by other macros in this file.
|
|
1390 |
#
|
|
1391 |
# Interface to module:
|
|
1392 |
# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests
|
|
1393 |
# enable_unit_tests: used in configure.ac for additional configuration
|
|
1394 |
# --enable-unit-tests: 'yes' user instructs the module to build tests
|
|
1395 |
# 'no' user instructs the module not to build tests
|
|
1396 |
# parm1: specify the default value, yes or no.
|
|
1397 |
#
|
|
1398 |
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
|
|
1399 |
AC_BEFORE([$0], [XORG_WITH_GLIB])
|
|
1400 |
AC_BEFORE([$0], [XORG_LD_WRAP])
|
|
1401 |
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
|
|
1402 |
m4_define([_defopt], m4_default([$1], [auto]))
|
|
1403 |
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
|
|
1404 |
[Enable building unit test cases (default: ]_defopt[)]),
|
|
1405 |
[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
|
|
1406 |
m4_undefine([_defopt])
|
|
1407 |
AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
|
|
1408 |
AC_MSG_CHECKING([whether to build unit test cases])
|
|
1409 |
AC_MSG_RESULT([$enable_unit_tests])
|
|
1410 |
]) # XORG_ENABLE_UNIT_TESTS
|
|
1411 |
|
|
1412 |
# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
|
|
1413 |
# ------------------------------------------------------
|
|
1414 |
# Minimum version: 1.17.0
|
|
1415 |
#
|
|
1416 |
# This macro enables a builder to enable/disable integration testing
|
|
1417 |
# It makes no assumption about the test cases' implementation
|
|
1418 |
# Test cases may or may not use Automake "Support for test suites"
|
|
1419 |
#
|
|
1420 |
# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
|
|
1421 |
# usually requires less dependencies and may be built and run under less
|
|
1422 |
# stringent environments than integration tests.
|
|
1423 |
#
|
|
1424 |
# Interface to module:
|
|
1425 |
# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests
|
|
1426 |
# enable_integration_tests: used in configure.ac for additional configuration
|
|
1427 |
# --enable-integration-tests: 'yes' user instructs the module to build tests
|
|
1428 |
# 'no' user instructs the module not to build tests
|
|
1429 |
# parm1: specify the default value, yes or no.
|
|
1430 |
#
|
|
1431 |
AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
|
|
1432 |
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
|
|
1433 |
m4_define([_defopt], m4_default([$1], [auto]))
|
|
1434 |
AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
|
|
1435 |
[Enable building integration test cases (default: ]_defopt[)]),
|
|
1436 |
[enable_integration_tests=$enableval],
|
|
1437 |
[enable_integration_tests=]_defopt)
|
|
1438 |
m4_undefine([_defopt])
|
|
1439 |
AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
|
|
1440 |
[test "x$enable_integration_tests" != xno])
|
|
1441 |
AC_MSG_CHECKING([whether to build unit test cases])
|
|
1442 |
AC_MSG_RESULT([$enable_integration_tests])
|
|
1443 |
]) # XORG_ENABLE_INTEGRATION_TESTS
|
|
1444 |
|
|
1445 |
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
|
|
1446 |
# ----------------------------------------
|
|
1447 |
# Minimum version: 1.13.0
|
|
1448 |
#
|
|
1449 |
# GLib is a library which provides advanced data structures and functions.
|
|
1450 |
# This macro enables a module to test for the presence of Glib.
|
|
1451 |
#
|
|
1452 |
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
|
|
1453 |
# Otherwise the value of $enable_unit_tests is blank.
|
|
1454 |
#
|
|
1455 |
# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
|
|
1456 |
# test support usually requires less dependencies and may be built and run under
|
|
1457 |
# less stringent environments than integration tests.
|
|
1458 |
#
|
|
1459 |
# Interface to module:
|
|
1460 |
# HAVE_GLIB: used in makefiles to conditionally build targets
|
|
1461 |
# with_glib: used in configure.ac to know if GLib has been found
|
|
1462 |
# --with-glib: 'yes' user instructs the module to use glib
|
|
1463 |
# 'no' user instructs the module not to use glib
|
|
1464 |
#
|
|
1465 |
AC_DEFUN([XORG_WITH_GLIB],[
|
|
1466 |
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
1467 |
m4_define([_defopt], m4_default([$2], [auto]))
|
|
1468 |
AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
|
|
1469 |
[Use GLib library for unit testing (default: ]_defopt[)]),
|
|
1470 |
[with_glib=$withval], [with_glib=]_defopt)
|
|
1471 |
m4_undefine([_defopt])
|
|
1472 |
|
|
1473 |
have_glib=no
|
|
1474 |
# Do not probe GLib if user explicitly disabled unit testing
|
|
1475 |
if test "x$enable_unit_tests" != x"no"; then
|
|
1476 |
# Do not probe GLib if user explicitly disabled it
|
|
1477 |
if test "x$with_glib" != x"no"; then
|
|
1478 |
m4_ifval(
|
|
1479 |
[$1],
|
|
1480 |
[PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
|
|
1481 |
[PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
|
|
1482 |
)
|
|
1483 |
fi
|
|
1484 |
fi
|
|
1485 |
|
|
1486 |
# Not having GLib when unit testing has been explicitly requested is an error
|
|
1487 |
if test "x$enable_unit_tests" = x"yes"; then
|
|
1488 |
if test "x$have_glib" = x"no"; then
|
|
1489 |
AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
|
|
1490 |
fi
|
|
1491 |
fi
|
|
1492 |
|
|
1493 |
# Having unit testing disabled when GLib has been explicitly requested is an error
|
|
1494 |
if test "x$enable_unit_tests" = x"no"; then
|
|
1495 |
if test "x$with_glib" = x"yes"; then
|
|
1496 |
AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
|
|
1497 |
fi
|
|
1498 |
fi
|
|
1499 |
|
|
1500 |
# Not having GLib when it has been explicitly requested is an error
|
|
1501 |
if test "x$with_glib" = x"yes"; then
|
|
1502 |
if test "x$have_glib" = x"no"; then
|
|
1503 |
AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
|
|
1504 |
fi
|
|
1505 |
fi
|
|
1506 |
|
|
1507 |
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
|
|
1508 |
]) # XORG_WITH_GLIB
|
|
1509 |
|
|
1510 |
# XORG_LD_WRAP([required|optional])
|
|
1511 |
# ---------------------------------
|
|
1512 |
# Minimum version: 1.13.0
|
|
1513 |
#
|
|
1514 |
# Check if linker supports -wrap, passed via compiler flags
|
|
1515 |
#
|
|
1516 |
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
|
|
1517 |
# Otherwise the value of $enable_unit_tests is blank.
|
|
1518 |
#
|
|
1519 |
# Argument added in 1.16.0 - default is "required", to match existing behavior
|
|
1520 |
# of returning an error if enable_unit_tests is yes, and ld -wrap is not
|
|
1521 |
# available, an argument of "optional" allows use when some unit tests require
|
|
1522 |
# ld -wrap and others do not.
|
|
1523 |
#
|
|
1524 |
AC_DEFUN([XORG_LD_WRAP],[
|
|
1525 |
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
|
|
1526 |
[AC_LANG_PROGRAM([#include <stdlib.h>
|
|
1527 |
void __wrap_exit(int status) { return; }],
|
|
1528 |
[exit(0);])])
|
|
1529 |
# Not having ld wrap when unit testing has been explicitly requested is an error
|
|
1530 |
if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
|
|
1531 |
if test "x$have_ld_wrap" = x"no"; then
|
|
1532 |
AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
|
|
1533 |
fi
|
|
1534 |
fi
|
|
1535 |
AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
|
|
1536 |
#
|
|
1537 |
]) # XORG_LD_WRAP
|
|
1538 |
|
|
1539 |
# XORG_CHECK_LINKER_FLAGS
|
|
1540 |
# -----------------------
|
|
1541 |
# SYNOPSIS
|
|
1542 |
#
|
|
1543 |
# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
|
|
1544 |
#
|
|
1545 |
# DESCRIPTION
|
|
1546 |
#
|
|
1547 |
# Check whether the given linker FLAGS work with the current language's
|
|
1548 |
# linker, or whether they give an error.
|
|
1549 |
#
|
|
1550 |
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
|
1551 |
# success/failure.
|
|
1552 |
#
|
|
1553 |
# PROGRAM-SOURCE is the program source to link with, if needed
|
|
1554 |
#
|
|
1555 |
# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
|
|
1556 |
#
|
|
1557 |
# LICENSE
|
|
1558 |
#
|
|
1559 |
# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
|
|
1560 |
# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
|
|
1561 |
# Copyright (c) 2009 Matteo Frigo
|
|
1562 |
#
|
|
1563 |
# This program is free software: you can redistribute it and/or modify it
|
|
1564 |
# under the terms of the GNU General Public License as published by the
|
|
1565 |
# Free Software Foundation, either version 3 of the License, or (at your
|
|
1566 |
# option) any later version.
|
|
1567 |
#
|
|
1568 |
# This program is distributed in the hope that it will be useful, but
|
|
1569 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1570 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
1571 |
# Public License for more details.
|
|
1572 |
#
|
|
1573 |
# You should have received a copy of the GNU General Public License along
|
|
1574 |
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1575 |
#
|
|
1576 |
# As a special exception, the respective Autoconf Macro's copyright owner
|
|
1577 |
# gives unlimited permission to copy, distribute and modify the configure
|
|
1578 |
# scripts that are the output of Autoconf when processing the Macro. You
|
|
1579 |
# need not follow the terms of the GNU General Public License when using
|
|
1580 |
# or distributing such scripts, even though portions of the text of the
|
|
1581 |
# Macro appear in them. The GNU General Public License (GPL) does govern
|
|
1582 |
# all other use of the material that constitutes the Autoconf Macro.
|
|
1583 |
#
|
|
1584 |
# This special exception to the GPL applies to versions of the Autoconf
|
|
1585 |
# Macro released by the Autoconf Archive. When you make and distribute a
|
|
1586 |
# modified version of the Autoconf Macro, you may extend this special
|
|
1587 |
# exception to the GPL to apply to your modified version as well.#
|
|
1588 |
AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
|
|
1589 |
[AC_MSG_CHECKING([whether the linker accepts $1])
|
|
1590 |
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
|
|
1591 |
AS_LITERAL_IF([$1],
|
|
1592 |
[AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
|
|
1593 |
ax_save_FLAGS=$LDFLAGS
|
|
1594 |
LDFLAGS="$1"
|
|
1595 |
AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
|
|
1596 |
AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
|
|
1597 |
AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
|
|
1598 |
LDFLAGS=$ax_save_FLAGS])],
|
|
1599 |
[ax_save_FLAGS=$LDFLAGS
|
|
1600 |
LDFLAGS="$1"
|
|
1601 |
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
|
1602 |
eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
|
|
1603 |
eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
|
|
1604 |
LDFLAGS=$ax_save_FLAGS])
|
|
1605 |
eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
|
|
1606 |
AC_MSG_RESULT($xorg_check_linker_flags)
|
|
1607 |
if test "x$xorg_check_linker_flags" = xyes; then
|
|
1608 |
m4_default([$2], :)
|
|
1609 |
else
|
|
1610 |
m4_default([$3], :)
|
|
1611 |
fi
|
|
1612 |
]) # XORG_CHECK_LINKER_FLAGS
|
|
1613 |
|
|
1614 |
# XORG_MEMORY_CHECK_FLAGS
|
|
1615 |
# -----------------------
|
|
1616 |
# Minimum version: 1.16.0
|
|
1617 |
#
|
|
1618 |
# This macro attempts to find appropriate memory checking functionality
|
|
1619 |
# for various platforms which unit testing code may use to catch various
|
|
1620 |
# forms of memory allocation and access errors in testing.
|
|
1621 |
#
|
|
1622 |
# Interface to module:
|
|
1623 |
# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
|
|
1624 |
# Usually added to TESTS_ENVIRONMENT in Makefile.am
|
|
1625 |
#
|
|
1626 |
# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
|
|
1627 |
#
|
|
1628 |
AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
|
|
1629 |
|
|
1630 |
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
1631 |
AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
|
|
1632 |
[Environment variables to enable memory checking in tests])
|
|
1633 |
|
|
1634 |
# Check for different types of support on different platforms
|
|
1635 |
case $host_os in
|
|
1636 |
solaris*)
|
|
1637 |
AC_CHECK_LIB([umem], [umem_alloc],
|
|
1638 |
[malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
|
|
1639 |
;;
|
|
1640 |
*-gnu*) # GNU libc - Value is used as a single byte bit pattern,
|
|
1641 |
# both directly and inverted, so should not be 0 or 255.
|
|
1642 |
malloc_debug_env='MALLOC_PERTURB_=15'
|
|
1643 |
;;
|
|
1644 |
darwin*)
|
|
1645 |
malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
|
|
1646 |
;;
|
|
1647 |
*bsd*)
|
|
1648 |
malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
|
|
1649 |
;;
|
|
1650 |
esac
|
|
1651 |
|
|
1652 |
# User supplied flags override default flags
|
|
1653 |
if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
|
|
1654 |
malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
|
|
1655 |
fi
|
|
1656 |
|
|
1657 |
AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
|
|
1658 |
]) # XORG_WITH_LINT
|
|
1659 |
|
|
1660 |
# XORG_CHECK_MALLOC_ZERO
|
|
1661 |
# ----------------------
|
|
1662 |
# Minimum version: 1.0.0
|
|
1663 |
#
|
|
1664 |
# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
|
|
1665 |
# malloc(0) returns NULL. Packages should add one of these cflags to
|
|
1666 |
# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
|
|
1667 |
AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
|
|
1668 |
AC_ARG_ENABLE(malloc0returnsnull,
|
|
1669 |
AS_HELP_STRING([--enable-malloc0returnsnull],
|
|
1670 |
[malloc(0) returns NULL (default: auto)]),
|
|
1671 |
[MALLOC_ZERO_RETURNS_NULL=$enableval],
|
|
1672 |
[MALLOC_ZERO_RETURNS_NULL=auto])
|
|
1673 |
|
|
1674 |
AC_MSG_CHECKING([whether malloc(0) returns NULL])
|
|
1675 |
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
|
|
1676 |
AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
|
|
1677 |
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
|
|
1678 |
#include <stdlib.h>
|
|
1679 |
],[
|
|
1680 |
char *m0, *r0, *c0, *p;
|
|
1681 |
m0 = malloc(0);
|
|
1682 |
p = malloc(10);
|
|
1683 |
r0 = realloc(p,0);
|
|
1684 |
c0 = calloc(0,10);
|
|
1685 |
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
|
|
1686 |
])],
|
|
1687 |
[xorg_cv_malloc0_returns_null=yes],
|
|
1688 |
[xorg_cv_malloc0_returns_null=no])])
|
|
1689 |
MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
|
|
1690 |
fi
|
|
1691 |
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
|
|
1692 |
|
|
1693 |
if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
|
|
1694 |
MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
|
|
1695 |
XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
|
|
1696 |
XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
|
|
1697 |
else
|
|
1698 |
MALLOC_ZERO_CFLAGS=""
|
|
1699 |
XMALLOC_ZERO_CFLAGS=""
|
|
1700 |
XTMALLOC_ZERO_CFLAGS=""
|
|
1701 |
fi
|
|
1702 |
|
|
1703 |
AC_SUBST([MALLOC_ZERO_CFLAGS])
|
|
1704 |
AC_SUBST([XMALLOC_ZERO_CFLAGS])
|
|
1705 |
AC_SUBST([XTMALLOC_ZERO_CFLAGS])
|
|
1706 |
]) # XORG_CHECK_MALLOC_ZERO
|
|
1707 |
|
|
1708 |
# XORG_WITH_LINT()
|
|
1709 |
# ----------------
|
|
1710 |
# Minimum version: 1.1.0
|
|
1711 |
#
|
|
1712 |
# This macro enables the use of a tool that flags some suspicious and
|
|
1713 |
# non-portable constructs (likely to be bugs) in C language source code.
|
|
1714 |
# It will attempt to locate the tool and use appropriate options.
|
|
1715 |
# There are various lint type tools on different platforms.
|
|
1716 |
#
|
|
1717 |
# Interface to module:
|
|
1718 |
# LINT: returns the path to the tool found on the platform
|
|
1719 |
# or the value set to LINT on the configure cmd line
|
|
1720 |
# also an Automake conditional
|
|
1721 |
# LINT_FLAGS: an Automake variable with appropriate flags
|
|
1722 |
#
|
|
1723 |
# --with-lint: 'yes' user instructs the module to use lint
|
|
1724 |
# 'no' user instructs the module not to use lint (default)
|
|
1725 |
#
|
|
1726 |
# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
|
|
1727 |
# If the user sets the value of LINT_FLAGS, they are used verbatim.
|
|
1728 |
#
|
|
1729 |
AC_DEFUN([XORG_WITH_LINT],[
|
|
1730 |
|
|
1731 |
AC_ARG_VAR([LINT], [Path to a lint-style command])
|
|
1732 |
AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
|
|
1733 |
AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
|
|
1734 |
[Use a lint-style source code checker (default: disabled)])],
|
|
1735 |
[use_lint=$withval], [use_lint=no])
|
|
1736 |
|
|
1737 |
# Obtain platform specific info like program name and options
|
|
1738 |
# The lint program on FreeBSD and NetBSD is different from the one on Solaris
|
|
1739 |
case $host_os in
|
|
1740 |
*linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
|
|
1741 |
lint_name=splint
|
|
1742 |
lint_options="-badflag"
|
|
1743 |
;;
|
|
1744 |
*freebsd* | *netbsd*)
|
|
1745 |
lint_name=lint
|
|
1746 |
lint_options="-u -b"
|
|
1747 |
;;
|
|
1748 |
*solaris*)
|
|
1749 |
lint_name=lint
|
|
1750 |
lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
|
|
1751 |
;;
|
|
1752 |
esac
|
|
1753 |
|
|
1754 |
# Test for the presence of the program (either guessed by the code or spelled out by the user)
|
|
1755 |
if test "x$use_lint" = x"yes" ; then
|
|
1756 |
AC_PATH_PROG([LINT], [$lint_name])
|
|
1757 |
if test "x$LINT" = "x"; then
|
|
1758 |
AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
|
|
1759 |
fi
|
|
1760 |
elif test "x$use_lint" = x"no" ; then
|
|
1761 |
if test "x$LINT" != "x"; then
|
|
1762 |
AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
|
|
1763 |
fi
|
|
1764 |
else
|
|
1765 |
AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
|
|
1766 |
fi
|
|
1767 |
|
|
1768 |
# User supplied flags override default flags
|
|
1769 |
if test "x$LINT_FLAGS" != "x"; then
|
|
1770 |
lint_options=$LINT_FLAGS
|
|
1771 |
fi
|
|
1772 |
|
|
1773 |
AC_SUBST([LINT_FLAGS],[$lint_options])
|
|
1774 |
AM_CONDITIONAL(LINT, [test "x$LINT" != x])
|
|
1775 |
|
|
1776 |
]) # XORG_WITH_LINT
|
|
1777 |
|
|
1778 |
# XORG_LINT_LIBRARY(LIBNAME)
|
|
1779 |
# --------------------------
|
|
1780 |
# Minimum version: 1.1.0
|
|
1781 |
#
|
|
1782 |
# Sets up flags for building lint libraries for checking programs that call
|
|
1783 |
# functions in the library.
|
|
1784 |
#
|
|
1785 |
# Interface to module:
|
|
1786 |
# LINTLIB - Automake variable with the name of lint library file to make
|
|
1787 |
# MAKE_LINT_LIB - Automake conditional
|
|
1788 |
#
|
|
1789 |
# --enable-lint-library: - 'yes' user instructs the module to created a lint library
|
|
1790 |
# - 'no' user instructs the module not to create a lint library (default)
|
|
1791 |
|
|
1792 |
AC_DEFUN([XORG_LINT_LIBRARY],[
|
|
1793 |
AC_REQUIRE([XORG_WITH_LINT])
|
|
1794 |
AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
|
|
1795 |
[Create lint library (default: disabled)])],
|
|
1796 |
[make_lint_lib=$enableval], [make_lint_lib=no])
|
|
1797 |
|
|
1798 |
if test "x$make_lint_lib" = x"yes" ; then
|
|
1799 |
LINTLIB=llib-l$1.ln
|
|
1800 |
if test "x$LINT" = "x"; then
|
|
1801 |
AC_MSG_ERROR([Cannot make lint library without --with-lint])
|
|
1802 |
fi
|
|
1803 |
elif test "x$make_lint_lib" != x"no" ; then
|
|
1804 |
AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
|
|
1805 |
fi
|
|
1806 |
|
|
1807 |
AC_SUBST(LINTLIB)
|
|
1808 |
AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
|
|
1809 |
|
|
1810 |
]) # XORG_LINT_LIBRARY
|
|
1811 |
|
|
1812 |
# XORG_COMPILER_BRAND
|
|
1813 |
# -------------------
|
|
1814 |
# Minimum version: 1.14.0
|
|
1815 |
#
|
|
1816 |
# Checks for various brands of compilers and sets flags as appropriate:
|
|
1817 |
# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
|
|
1818 |
# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
|
|
1819 |
# clang compiler - sets CLANGCC to "yes"
|
|
1820 |
# Intel compiler - sets INTELCC to "yes"
|
|
1821 |
# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
|
|
1822 |
#
|
|
1823 |
AC_DEFUN([XORG_COMPILER_BRAND], [
|
|
1824 |
AC_LANG_CASE(
|
|
1825 |
[C], [
|
|
1826 |
AC_REQUIRE([AC_PROG_CC_C99])
|
|
1827 |
],
|
|
1828 |
[C++], [
|
|
1829 |
AC_REQUIRE([AC_PROG_CXX])
|
|
1830 |
]
|
|
1831 |
)
|
|
1832 |
AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
|
|
1833 |
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
|
|
1834 |
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
|
|
1835 |
]) # XORG_COMPILER_BRAND
|
|
1836 |
|
|
1837 |
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
|
|
1838 |
# ---------------
|
|
1839 |
# Minimum version: 1.16.0
|
|
1840 |
#
|
|
1841 |
# Test if the compiler works when passed the given flag as a command line argument.
|
|
1842 |
# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
|
|
1843 |
# next flag in the list until there are no more options.
|
|
1844 |
#
|
|
1845 |
# Note that this does not guarantee that the compiler supports the flag as some
|
|
1846 |
# compilers will simply ignore arguments that they do not understand, but we do
|
|
1847 |
# attempt to weed out false positives by using -Werror=unknown-warning-option and
|
|
1848 |
# -Werror=unused-command-line-argument
|
|
1849 |
#
|
|
1850 |
AC_DEFUN([XORG_TESTSET_CFLAG], [
|
|
1851 |
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
|
|
1852 |
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
|
|
1853 |
|
|
1854 |
AC_LANG_COMPILER_REQUIRE
|
|
1855 |
|
|
1856 |
AC_LANG_CASE(
|
|
1857 |
[C], [
|
|
1858 |
AC_REQUIRE([AC_PROG_CC_C99])
|
|
1859 |
define([PREFIX], [C])
|
|
1860 |
define([CACHE_PREFIX], [cc])
|
|
1861 |
define([COMPILER], [$CC])
|
|
1862 |
],
|
|
1863 |
[C++], [
|
|
1864 |
define([PREFIX], [CXX])
|
|
1865 |
define([CACHE_PREFIX], [cxx])
|
|
1866 |
define([COMPILER], [$CXX])
|
|
1867 |
]
|
|
1868 |
)
|
|
1869 |
|
|
1870 |
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
|
|
1871 |
|
|
1872 |
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
|
|
1873 |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
|
|
1874 |
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
|
|
1875 |
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
|
|
1876 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
|
|
1877 |
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
|
|
1878 |
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
|
|
1879 |
[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
|
|
1880 |
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
|
|
1881 |
fi
|
|
1882 |
|
|
1883 |
if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
|
|
1884 |
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
|
|
1885 |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
|
|
1886 |
fi
|
|
1887 |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
|
|
1888 |
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
|
|
1889 |
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
|
|
1890 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
|
|
1891 |
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
|
|
1892 |
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
|
|
1893 |
[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
|
|
1894 |
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
|
|
1895 |
fi
|
|
1896 |
|
|
1897 |
found="no"
|
|
1898 |
m4_foreach([flag], m4_cdr($@), [
|
|
1899 |
if test $found = "no" ; then
|
|
1900 |
if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
|
|
1901 |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
|
|
1902 |
fi
|
|
1903 |
|
|
1904 |
if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
|
|
1905 |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
|
|
1906 |
fi
|
|
1907 |
|
|
1908 |
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
|
|
1909 |
|
|
1910 |
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
|
|
1911 |
AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
|
|
1912 |
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
|
|
1913 |
AC_CACHE_VAL($cacheid,
|
|
1914 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
|
|
1915 |
[eval $cacheid=yes],
|
|
1916 |
[eval $cacheid=no])])
|
|
1917 |
|
|
1918 |
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
|
|
1919 |
|
|
1920 |
eval supported=\$$cacheid
|
|
1921 |
AC_MSG_RESULT([$supported])
|
|
1922 |
if test "$supported" = "yes" ; then
|
|
1923 |
$1="$$1 ]flag["
|
|
1924 |
found="yes"
|
|
1925 |
fi
|
|
1926 |
fi
|
|
1927 |
])
|
|
1928 |
]) # XORG_TESTSET_CFLAG
|
|
1929 |
|
|
1930 |
# XORG_COMPILER_FLAGS
|
|
1931 |
# ---------------
|
|
1932 |
# Minimum version: 1.16.0
|
|
1933 |
#
|
|
1934 |
# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
|
|
1935 |
# arguments supported by the selected compiler which do NOT alter the generated
|
|
1936 |
# code. These arguments will cause the compiler to print various warnings
|
|
1937 |
# during compilation AND turn a conservative set of warnings into errors.
|
|
1938 |
#
|
|
1939 |
# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
|
|
1940 |
# future versions of util-macros as options are added to new compilers.
|
|
1941 |
#
|
|
1942 |
AC_DEFUN([XORG_COMPILER_FLAGS], [
|
|
1943 |
AC_REQUIRE([XORG_COMPILER_BRAND])
|
|
1944 |
|
|
1945 |
AC_ARG_ENABLE(selective-werror,
|
|
1946 |
AS_HELP_STRING([--disable-selective-werror],
|
|
1947 |
[Turn off selective compiler errors. (default: enabled)]),
|
|
1948 |
[SELECTIVE_WERROR=$enableval],
|
|
1949 |
[SELECTIVE_WERROR=yes])
|
|
1950 |
|
|
1951 |
AC_LANG_CASE(
|
|
1952 |
[C], [
|
|
1953 |
define([PREFIX], [C])
|
|
1954 |
],
|
|
1955 |
[C++], [
|
|
1956 |
define([PREFIX], [CXX])
|
|
1957 |
]
|
|
1958 |
)
|
|
1959 |
# -v is too short to test reliably with XORG_TESTSET_CFLAG
|
|
1960 |
if test "x$SUNCC" = "xyes"; then
|
|
1961 |
[BASE_]PREFIX[FLAGS]="-v"
|
|
1962 |
else
|
|
1963 |
[BASE_]PREFIX[FLAGS]=""
|
|
1964 |
fi
|
|
1965 |
|
|
1966 |
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
|
|
1967 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
|
|
1968 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
|
|
1969 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
|
|
1970 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
|
|
1971 |
|
|
1972 |
AC_LANG_CASE(
|
|
1973 |
[C], [
|
|
1974 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
|
|
1975 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
|
|
1976 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
|
|
1977 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
|
|
1978 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
|
|
1979 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
|
|
1980 |
]
|
|
1981 |
)
|
|
1982 |
|
|
1983 |
# This chunk adds additional warnings that could catch undesired effects.
|
|
1984 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
|
|
1985 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
|
|
1986 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
|
|
1987 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
|
|
1988 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
|
|
1989 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
|
|
1990 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
|
|
1991 |
|
|
1992 |
# These are currently disabled because they are noisy. They will be enabled
|
|
1993 |
# in the future once the codebase is sufficiently modernized to silence
|
|
1994 |
# them. For now, I don't want them to drown out the other warnings.
|
|
1995 |
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
|
|
1996 |
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
|
|
1997 |
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
|
|
1998 |
|
|
1999 |
# Turn some warnings into errors, so we don't accidently get successful builds
|
|
2000 |
# when there are problems that should be fixed.
|
|
2001 |
|
|
2002 |
if test "x$SELECTIVE_WERROR" = "xyes" ; then
|
|
2003 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
|
|
2004 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
|
|
2005 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
|
|
2006 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
|
|
2007 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
|
|
2008 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
|
|
2009 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
|
|
2010 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
|
|
2011 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
|
|
2012 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
|
|
2013 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
|
|
2014 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
|
|
2015 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
|
|
2016 |
else
|
|
2017 |
AC_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])
|
|
2018 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
|
|
2019 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
|
|
2020 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
|
|
2021 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
|
|
2022 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
|
|
2023 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
|
|
2024 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
|
|
2025 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
|
|
2026 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
|
|
2027 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
|
|
2028 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
|
|
2029 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
|
|
2030 |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
|
|
2031 |
fi
|
|
2032 |
|
|
2033 |
AC_SUBST([BASE_]PREFIX[FLAGS])
|
|
2034 |
]) # XORG_COMPILER_FLAGS
|
|
2035 |
|
|
2036 |
# XORG_CWARNFLAGS
|
|
2037 |
# ---------------
|
|
2038 |
# Minimum version: 1.2.0
|
|
2039 |
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
|
|
2040 |
#
|
|
2041 |
# Defines CWARNFLAGS to enable C compiler warnings.
|
|
2042 |
#
|
|
2043 |
# This function is deprecated because it defines -fno-strict-aliasing
|
|
2044 |
# which alters the code generated by the compiler. If -fno-strict-aliasing
|
|
2045 |
# is needed, then it should be added explicitly in the module when
|
|
2046 |
# it is updated to use BASE_CFLAGS.
|
|
2047 |
#
|
|
2048 |
AC_DEFUN([XORG_CWARNFLAGS], [
|
|
2049 |
AC_REQUIRE([XORG_COMPILER_FLAGS])
|
|
2050 |
AC_REQUIRE([XORG_COMPILER_BRAND])
|
|
2051 |
AC_LANG_CASE(
|
|
2052 |
[C], [
|
|
2053 |
CWARNFLAGS="$BASE_CFLAGS"
|
|
2054 |
if test "x$GCC" = xyes ; then
|
|
2055 |
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
|
|
2056 |
fi
|
|
2057 |
AC_SUBST(CWARNFLAGS)
|
|
2058 |
]
|
|
2059 |
)
|
|
2060 |
]) # XORG_CWARNFLAGS
|
|
2061 |
|
|
2062 |
# XORG_STRICT_OPTION
|
|
2063 |
# -----------------------
|
|
2064 |
# Minimum version: 1.3.0
|
|
2065 |
#
|
|
2066 |
# Add configure option to enable strict compilation flags, such as treating
|
|
2067 |
# warnings as fatal errors.
|
|
2068 |
# If --enable-strict-compilation is passed to configure, adds strict flags to
|
|
2069 |
# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
|
|
2070 |
#
|
|
2071 |
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
|
|
2072 |
# when strict compilation is unconditionally desired.
|
|
2073 |
AC_DEFUN([XORG_STRICT_OPTION], [
|
|
2074 |
AC_REQUIRE([XORG_CWARNFLAGS])
|
|
2075 |
AC_REQUIRE([XORG_COMPILER_FLAGS])
|
|
2076 |
|
|
2077 |
AC_ARG_ENABLE(strict-compilation,
|
|
2078 |
AS_HELP_STRING([--enable-strict-compilation],
|
|
2079 |
[Enable all warnings from compiler and make them errors (default: disabled)]),
|
|
2080 |
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
|
|
2081 |
|
|
2082 |
AC_LANG_CASE(
|
|
2083 |
[C], [
|
|
2084 |
define([PREFIX], [C])
|
|
2085 |
],
|
|
2086 |
[C++], [
|
|
2087 |
define([PREFIX], [CXX])
|
|
2088 |
]
|
|
2089 |
)
|
|
2090 |
|
|
2091 |
[STRICT_]PREFIX[FLAGS]=""
|
|
2092 |
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
|
|
2093 |
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
|
|
2094 |
|
|
2095 |
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
|
|
2096 |
# activate it with -Werror, so we add it here explicitly.
|
|
2097 |
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
|
|
2098 |
|
|
2099 |
if test "x$STRICT_COMPILE" = "xyes"; then
|
|
2100 |
[BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
|
|
2101 |
AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
|
|
2102 |
fi
|
|
2103 |
AC_SUBST([STRICT_]PREFIX[FLAGS])
|
|
2104 |
AC_SUBST([BASE_]PREFIX[FLAGS])
|
|
2105 |
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
|
|
2106 |
]) # XORG_STRICT_OPTION
|
|
2107 |
|
|
2108 |
# XORG_DEFAULT_OPTIONS
|
|
2109 |
# --------------------
|
|
2110 |
# Minimum version: 1.3.0
|
|
2111 |
#
|
|
2112 |
# Defines default options for X.Org modules.
|
|
2113 |
#
|
|
2114 |
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
|
|
2115 |
AC_REQUIRE([AC_PROG_INSTALL])
|
|
2116 |
XORG_COMPILER_FLAGS
|
|
2117 |
XORG_CWARNFLAGS
|
|
2118 |
XORG_STRICT_OPTION
|
|
2119 |
XORG_RELEASE_VERSION
|
|
2120 |
XORG_CHANGELOG
|
|
2121 |
XORG_INSTALL
|
|
2122 |
XORG_MANPAGE_SECTIONS
|
|
2123 |
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
|
|
2124 |
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
|
|
2125 |
]) # XORG_DEFAULT_OPTIONS
|
|
2126 |
|
|
2127 |
# XORG_INSTALL()
|
|
2128 |
# ----------------
|
|
2129 |
# Minimum version: 1.4.0
|
|
2130 |
#
|
|
2131 |
# Defines the variable INSTALL_CMD as the command to copy
|
|
2132 |
# INSTALL from $prefix/share/util-macros.
|
|
2133 |
#
|
|
2134 |
AC_DEFUN([XORG_INSTALL], [
|
|
2135 |
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
2136 |
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
|
|
2137 |
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
|
|
2138 |
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
|
|
2139 |
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
|
|
2140 |
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
|
|
2141 |
AC_SUBST([INSTALL_CMD])
|
|
2142 |
]) # XORG_INSTALL
|
|
2143 |
dnl Copyright 2005 Red Hat, Inc
|
|
2144 |
dnl
|
|
2145 |
dnl Permission to use, copy, modify, distribute, and sell this software and its
|
|
2146 |
dnl documentation for any purpose is hereby granted without fee, provided that
|
|
2147 |
dnl the above copyright notice appear in all copies and that both that
|
|
2148 |
dnl copyright notice and this permission notice appear in supporting
|
|
2149 |
dnl documentation.
|
|
2150 |
dnl
|
|
2151 |
dnl The above copyright notice and this permission notice shall be included
|
|
2152 |
dnl in all copies or substantial portions of the Software.
|
|
2153 |
dnl
|
|
2154 |
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
2155 |
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
2156 |
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
2157 |
dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
2158 |
dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
2159 |
dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
2160 |
dnl OTHER DEALINGS IN THE SOFTWARE.
|
|
2161 |
dnl
|
|
2162 |
dnl Except as contained in this notice, the name of the copyright holders shall
|
|
2163 |
dnl not be used in advertising or otherwise to promote the sale, use or
|
|
2164 |
dnl other dealings in this Software without prior written authorization
|
|
2165 |
dnl from the copyright holders.
|
|
2166 |
dnl
|
|
2167 |
|
|
2168 |
# XORG_RELEASE_VERSION
|
|
2169 |
# --------------------
|
|
2170 |
# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
|
|
2171 |
|
|
2172 |
AC_DEFUN([XORG_RELEASE_VERSION],[
|
|
2173 |
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
|
|
2174 |
[`echo $PACKAGE_VERSION | cut -d . -f 1`],
|
|
2175 |
[Major version of this package])
|
|
2176 |
PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
|
|
2177 |
if test "x$PVM" = "x"; then
|
|
2178 |
PVM="0"
|
|
2179 |
fi
|
|
2180 |
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
|
|
2181 |
[$PVM],
|
|
2182 |
[Minor version of this package])
|
|
2183 |
PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
|
|
2184 |
if test "x$PVP" = "x"; then
|
|
2185 |
PVP="0"
|
|
2186 |
fi
|
|
2187 |
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
|
|
2188 |
[$PVP],
|
|
2189 |
[Patch version of this package])
|
|
2190 |
])
|
|
2191 |
|
|
2192 |
# XORG_CHANGELOG()
|
|
2193 |
# ----------------
|
|
2194 |
# Minimum version: 1.2.0
|
|
2195 |
#
|
|
2196 |
# Defines the variable CHANGELOG_CMD as the command to generate
|
|
2197 |
# ChangeLog from git.
|
|
2198 |
#
|
|
2199 |
#
|
|
2200 |
AC_DEFUN([XORG_CHANGELOG], [
|
|
2201 |
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
|
|
2202 |
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
|
|
2203 |
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
|
|
2204 |
echo 'git directory not found: installing possibly empty changelog.' >&2)"
|
|
2205 |
AC_SUBST([CHANGELOG_CMD])
|
|
2206 |
]) # XORG_CHANGELOG
|
21 | 2207 |
|
22 | 2208 |
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
23 | 2209 |
#
|
|
1149 | 3335 |
AC_SUBST([am__untar])
|
1150 | 3336 |
]) # _AM_PROG_TAR
|
1151 | 3337 |
|
1152 | |
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
1153 | |
#
|
1154 | |
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
1155 | |
#
|
1156 | |
# This program is free software; you can redistribute it and/or modify
|
1157 | |
# it under the terms of the GNU General Public License as published by
|
1158 | |
# the Free Software Foundation; either version 2 of the License, or
|
1159 | |
# (at your option) any later version.
|
1160 | |
#
|
1161 | |
# This program is distributed in the hope that it will be useful, but
|
1162 | |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
1163 | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
1164 | |
# General Public License for more details.
|
1165 | |
#
|
1166 | |
# You should have received a copy of the GNU General Public License
|
1167 | |
# along with this program; if not, write to the Free Software
|
1168 | |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1169 | |
#
|
1170 | |
# As a special exception to the GNU General Public License, if you
|
1171 | |
# distribute this file as part of a program that contains a
|
1172 | |
# configuration script generated by Autoconf, you may include it under
|
1173 | |
# the same distribution terms that you use for the rest of that program.
|
1174 | |
|
1175 | |
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
1176 | |
# ----------------------------------
|
1177 | |
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
1178 | |
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
1179 | |
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
1180 | |
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
|
1181 | |
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
1182 | |
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
1183 | |
fi
|
1184 | |
if test -n "$PKG_CONFIG"; then
|
1185 | |
_pkg_min_version=m4_default([$1], [0.9.0])
|
1186 | |
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
1187 | |
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
1188 | |
AC_MSG_RESULT([yes])
|
1189 | |
else
|
1190 | |
AC_MSG_RESULT([no])
|
1191 | |
PKG_CONFIG=""
|
1192 | |
fi
|
1193 | |
|
1194 | |
fi[]dnl
|
1195 | |
])# PKG_PROG_PKG_CONFIG
|
1196 | |
|
1197 | |
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
1198 | |
#
|
1199 | |
# Check to see whether a particular set of modules exists. Similar
|
1200 | |
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
1201 | |
#
|
1202 | |
#
|
1203 | |
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
|
1204 | |
# this or PKG_CHECK_MODULES is called, or make sure to call
|
1205 | |
# PKG_CHECK_EXISTS manually
|
1206 | |
# --------------------------------------------------------------
|
1207 | |
AC_DEFUN([PKG_CHECK_EXISTS],
|
1208 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
1209 | |
if test -n "$PKG_CONFIG" && \
|
1210 | |
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
1211 | |
m4_ifval([$2], [$2], [:])
|
1212 | |
m4_ifvaln([$3], [else
|
1213 | |
$3])dnl
|
1214 | |
fi])
|
1215 | |
|
1216 | |
|
1217 | |
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
1218 | |
# ---------------------------------------------
|
1219 | |
m4_define([_PKG_CONFIG],
|
1220 | |
[if test -n "$$1"; then
|
1221 | |
pkg_cv_[]$1="$$1"
|
1222 | |
elif test -n "$PKG_CONFIG"; then
|
1223 | |
PKG_CHECK_EXISTS([$3],
|
1224 | |
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
|
1225 | |
[pkg_failed=yes])
|
1226 | |
else
|
1227 | |
pkg_failed=untried
|
1228 | |
fi[]dnl
|
1229 | |
])# _PKG_CONFIG
|
1230 | |
|
1231 | |
# _PKG_SHORT_ERRORS_SUPPORTED
|
1232 | |
# -----------------------------
|
1233 | |
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
1234 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
1235 | |
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
1236 | |
_pkg_short_errors_supported=yes
|
1237 | |
else
|
1238 | |
_pkg_short_errors_supported=no
|
1239 | |
fi[]dnl
|
1240 | |
])# _PKG_SHORT_ERRORS_SUPPORTED
|
1241 | |
|
1242 | |
|
1243 | |
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
1244 | |
# [ACTION-IF-NOT-FOUND])
|
1245 | |
#
|
1246 | |
#
|
1247 | |
# Note that if there is a possibility the first call to
|
1248 | |
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
1249 | |
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
1250 | |
#
|
1251 | |
#
|
1252 | |
# --------------------------------------------------------------
|
1253 | |
AC_DEFUN([PKG_CHECK_MODULES],
|
1254 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
1255 | |
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
1256 | |
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
1257 | |
|
1258 | |
pkg_failed=no
|
1259 | |
AC_MSG_CHECKING([for $1])
|
1260 | |
|
1261 | |
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
1262 | |
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
1263 | |
|
1264 | |
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
1265 | |
and $1[]_LIBS to avoid the need to call pkg-config.
|
1266 | |
See the pkg-config man page for more details.])
|
1267 | |
|
1268 | |
if test $pkg_failed = yes; then
|
1269 | |
_PKG_SHORT_ERRORS_SUPPORTED
|
1270 | |
if test $_pkg_short_errors_supported = yes; then
|
1271 | |
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
|
1272 | |
else
|
1273 | |
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
|
1274 | |
fi
|
1275 | |
# Put the nasty error message in config.log where it belongs
|
1276 | |
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
1277 | |
|
1278 | |
ifelse([$4], , [AC_MSG_ERROR(dnl
|
1279 | |
[Package requirements ($2) were not met:
|
1280 | |
|
1281 | |
$$1_PKG_ERRORS
|
1282 | |
|
1283 | |
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
1284 | |
installed software in a non-standard prefix.
|
1285 | |
|
1286 | |
_PKG_TEXT
|
1287 | |
])],
|
1288 | |
[AC_MSG_RESULT([no])
|
1289 | |
$4])
|
1290 | |
elif test $pkg_failed = untried; then
|
1291 | |
ifelse([$4], , [AC_MSG_FAILURE(dnl
|
1292 | |
[The pkg-config script could not be found or is too old. Make sure it
|
1293 | |
is in your PATH or set the PKG_CONFIG environment variable to the full
|
1294 | |
path to pkg-config.
|
1295 | |
|
1296 | |
_PKG_TEXT
|
1297 | |
|
1298 | |
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
|
1299 | |
[$4])
|
1300 | |
else
|
1301 | |
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
1302 | |
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
1303 | |
AC_MSG_RESULT([yes])
|
1304 | |
ifelse([$3], , :, [$3])
|
1305 | |
fi[]dnl
|
1306 | |
])# PKG_CHECK_MODULES
|
1307 | |
|
1308 | |
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
|
1309 | |
dnl
|
1310 | |
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
1311 | |
dnl
|
1312 | |
dnl Permission is hereby granted, free of charge, to any person obtaining a
|
1313 | |
dnl copy of this software and associated documentation files (the "Software"),
|
1314 | |
dnl to deal in the Software without restriction, including without limitation
|
1315 | |
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
1316 | |
dnl and/or sell copies of the Software, and to permit persons to whom the
|
1317 | |
dnl Software is furnished to do so, subject to the following conditions:
|
1318 | |
dnl
|
1319 | |
dnl The above copyright notice and this permission notice (including the next
|
1320 | |
dnl paragraph) shall be included in all copies or substantial portions of the
|
1321 | |
dnl Software.
|
1322 | |
dnl
|
1323 | |
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1324 | |
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1325 | |
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
1326 | |
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1327 | |
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
1328 | |
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
1329 | |
dnl DEALINGS IN THE SOFTWARE.
|
1330 | |
|
1331 | |
# XORG_MACROS_VERSION(required-version)
|
1332 | |
# -------------------------------------
|
1333 | |
# Minimum version: 1.1.0
|
1334 | |
#
|
1335 | |
# If you're using a macro added in Version 1.1 or newer, include this in
|
1336 | |
# your configure.ac with the minimum required version, such as:
|
1337 | |
# XORG_MACROS_VERSION(1.1)
|
1338 | |
#
|
1339 | |
# To ensure that this macro is defined, also add:
|
1340 | |
# m4_ifndef([XORG_MACROS_VERSION],
|
1341 | |
# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
|
1342 | |
#
|
1343 | |
#
|
1344 | |
# See the "minimum version" comment for each macro you use to see what
|
1345 | |
# version you require.
|
1346 | |
m4_defun([XORG_MACROS_VERSION],[
|
1347 | |
m4_define([vers_have], [1.19.0])
|
1348 | |
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
|
1349 | |
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
|
1350 | |
m4_if(m4_cmp(maj_have, maj_needed), 0,,
|
1351 | |
[m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
|
1352 | |
m4_if(m4_version_compare(vers_have, [$1]), -1,
|
1353 | |
[m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
|
1354 | |
m4_undefine([vers_have])
|
1355 | |
m4_undefine([maj_have])
|
1356 | |
m4_undefine([maj_needed])
|
1357 | |
]) # XORG_MACROS_VERSION
|
1358 | |
|
1359 | |
# XORG_PROG_RAWCPP()
|
1360 | |
# ------------------
|
1361 | |
# Minimum version: 1.0.0
|
1362 | |
#
|
1363 | |
# Find cpp program and necessary flags for use in pre-processing text files
|
1364 | |
# such as man pages and config files
|
1365 | |
AC_DEFUN([XORG_PROG_RAWCPP],[
|
1366 | |
AC_REQUIRE([AC_PROG_CPP])
|
1367 | |
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
|
1368 | |
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
|
1369 | |
|
1370 | |
# Check for flag to avoid builtin definitions - assumes unix is predefined,
|
1371 | |
# which is not the best choice for supporting other OS'es, but covers most
|
1372 | |
# of the ones we need for now.
|
1373 | |
AC_MSG_CHECKING([if $RAWCPP requires -undef])
|
1374 | |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
|
1375 | |
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
1376 | |
AC_MSG_RESULT([no])
|
1377 | |
else
|
1378 | |
if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
1379 | |
RAWCPPFLAGS=-undef
|
1380 | |
AC_MSG_RESULT([yes])
|
1381 | |
# under Cygwin unix is still defined even with -undef
|
1382 | |
elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
1383 | |
RAWCPPFLAGS="-undef -ansi"
|
1384 | |
AC_MSG_RESULT([yes, with -ansi])
|
1385 | |
else
|
1386 | |
AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.])
|
1387 | |
fi
|
1388 | |
fi
|
1389 | |
rm -f conftest.$ac_ext
|
1390 | |
|
1391 | |
AC_MSG_CHECKING([if $RAWCPP requires -traditional])
|
1392 | |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])])
|
1393 | |
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
|
1394 | |
AC_MSG_RESULT([no])
|
1395 | |
else
|
1396 | |
if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
|
1397 | |
TRADITIONALCPPFLAGS="-traditional"
|
1398 | |
RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
|
1399 | |
AC_MSG_RESULT([yes])
|
1400 | |
else
|
1401 | |
AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.])
|
1402 | |
fi
|
1403 | |
fi
|
1404 | |
rm -f conftest.$ac_ext
|
1405 | |
AC_SUBST(RAWCPPFLAGS)
|
1406 | |
AC_SUBST(TRADITIONALCPPFLAGS)
|
1407 | |
]) # XORG_PROG_RAWCPP
|
1408 | |
|
1409 | |
# XORG_MANPAGE_SECTIONS()
|
1410 | |
# -----------------------
|
1411 | |
# Minimum version: 1.0.0
|
1412 | |
#
|
1413 | |
# Determine which sections man pages go in for the different man page types
|
1414 | |
# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
|
1415 | |
# Not sure if there's any better way than just hardcoding by OS name.
|
1416 | |
# Override default settings by setting environment variables
|
1417 | |
# Added MAN_SUBSTS in version 1.8
|
1418 | |
# Added AC_PROG_SED in version 1.8
|
1419 | |
|
1420 | |
AC_DEFUN([XORG_MANPAGE_SECTIONS],[
|
1421 | |
AC_REQUIRE([AC_CANONICAL_HOST])
|
1422 | |
AC_REQUIRE([AC_PROG_SED])
|
1423 | |
|
1424 | |
if test x$APP_MAN_SUFFIX = x ; then
|
1425 | |
APP_MAN_SUFFIX=1
|
1426 | |
fi
|
1427 | |
if test x$APP_MAN_DIR = x ; then
|
1428 | |
APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
|
1429 | |
fi
|
1430 | |
|
1431 | |
if test x$LIB_MAN_SUFFIX = x ; then
|
1432 | |
LIB_MAN_SUFFIX=3
|
1433 | |
fi
|
1434 | |
if test x$LIB_MAN_DIR = x ; then
|
1435 | |
LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
|
1436 | |
fi
|
1437 | |
|
1438 | |
if test x$FILE_MAN_SUFFIX = x ; then
|
1439 | |
case $host_os in
|
1440 | |
solaris*) FILE_MAN_SUFFIX=4 ;;
|
1441 | |
*) FILE_MAN_SUFFIX=5 ;;
|
1442 | |
esac
|
1443 | |
fi
|
1444 | |
if test x$FILE_MAN_DIR = x ; then
|
1445 | |
FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
|
1446 | |
fi
|
1447 | |
|
1448 | |
if test x$MISC_MAN_SUFFIX = x ; then
|
1449 | |
case $host_os in
|
1450 | |
solaris*) MISC_MAN_SUFFIX=5 ;;
|
1451 | |
*) MISC_MAN_SUFFIX=7 ;;
|
1452 | |
esac
|
1453 | |
fi
|
1454 | |
if test x$MISC_MAN_DIR = x ; then
|
1455 | |
MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
|
1456 | |
fi
|
1457 | |
|
1458 | |
if test x$DRIVER_MAN_SUFFIX = x ; then
|
1459 | |
case $host_os in
|
1460 | |
solaris*) DRIVER_MAN_SUFFIX=7 ;;
|
1461 | |
*) DRIVER_MAN_SUFFIX=4 ;;
|
1462 | |
esac
|
1463 | |
fi
|
1464 | |
if test x$DRIVER_MAN_DIR = x ; then
|
1465 | |
DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
|
1466 | |
fi
|
1467 | |
|
1468 | |
if test x$ADMIN_MAN_SUFFIX = x ; then
|
1469 | |
case $host_os in
|
1470 | |
solaris*) ADMIN_MAN_SUFFIX=1m ;;
|
1471 | |
*) ADMIN_MAN_SUFFIX=8 ;;
|
1472 | |
esac
|
1473 | |
fi
|
1474 | |
if test x$ADMIN_MAN_DIR = x ; then
|
1475 | |
ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
|
1476 | |
fi
|
1477 | |
|
1478 | |
|
1479 | |
AC_SUBST([APP_MAN_SUFFIX])
|
1480 | |
AC_SUBST([LIB_MAN_SUFFIX])
|
1481 | |
AC_SUBST([FILE_MAN_SUFFIX])
|
1482 | |
AC_SUBST([MISC_MAN_SUFFIX])
|
1483 | |
AC_SUBST([DRIVER_MAN_SUFFIX])
|
1484 | |
AC_SUBST([ADMIN_MAN_SUFFIX])
|
1485 | |
AC_SUBST([APP_MAN_DIR])
|
1486 | |
AC_SUBST([LIB_MAN_DIR])
|
1487 | |
AC_SUBST([FILE_MAN_DIR])
|
1488 | |
AC_SUBST([MISC_MAN_DIR])
|
1489 | |
AC_SUBST([DRIVER_MAN_DIR])
|
1490 | |
AC_SUBST([ADMIN_MAN_DIR])
|
1491 | |
|
1492 | |
XORG_MAN_PAGE="X Version 11"
|
1493 | |
AC_SUBST([XORG_MAN_PAGE])
|
1494 | |
MAN_SUBSTS="\
|
1495 | |
-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
|
1496 | |
-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
|
1497 | |
-e 's|__xservername__|Xorg|g' \
|
1498 | |
-e 's|__xconfigfile__|xorg.conf|g' \
|
1499 | |
-e 's|__projectroot__|\$(prefix)|g' \
|
1500 | |
-e 's|__apploaddir__|\$(appdefaultdir)|g' \
|
1501 | |
-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
|
1502 | |
-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
|
1503 | |
-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
|
1504 | |
-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
|
1505 | |
-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
|
1506 | |
-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
|
1507 | |
AC_SUBST([MAN_SUBSTS])
|
1508 | |
|
1509 | |
]) # XORG_MANPAGE_SECTIONS
|
1510 | |
|
1511 | |
# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
|
1512 | |
# ------------------------
|
1513 | |
# Minimum version: 1.7.0
|
1514 | |
#
|
1515 | |
# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
|
1516 | |
# provided by xorg-sgml-doctools, if installed.
|
1517 | |
AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
|
1518 | |
AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
|
1519 | |
XORG_SGML_PATH=
|
1520 | |
PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
|
1521 | |
[XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
|
1522 | |
[m4_ifval([$1],[:],
|
1523 | |
[if test x"$cross_compiling" != x"yes" ; then
|
1524 | |
AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
|
1525 | |
[XORG_SGML_PATH=$prefix/share/sgml])
|
1526 | |
fi])
|
1527 | |
])
|
1528 | |
|
1529 | |
# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
|
1530 | |
# the path and the name of the doc stylesheet
|
1531 | |
if test "x$XORG_SGML_PATH" != "x" ; then
|
1532 | |
AC_MSG_RESULT([$XORG_SGML_PATH])
|
1533 | |
STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
|
1534 | |
XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
|
1535 | |
else
|
1536 | |
AC_MSG_RESULT([no])
|
1537 | |
fi
|
1538 | |
|
1539 | |
AC_SUBST(XORG_SGML_PATH)
|
1540 | |
AC_SUBST(STYLESHEET_SRCDIR)
|
1541 | |
AC_SUBST(XSL_STYLESHEET)
|
1542 | |
AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
|
1543 | |
]) # XORG_CHECK_SGML_DOCTOOLS
|
1544 | |
|
1545 | |
# XORG_CHECK_LINUXDOC
|
1546 | |
# -------------------
|
1547 | |
# Minimum version: 1.0.0
|
1548 | |
#
|
1549 | |
# Defines the variable MAKE_TEXT if the necessary tools and
|
1550 | |
# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
|
1551 | |
# Whether or not the necessary tools and files are found can be checked
|
1552 | |
# with the AM_CONDITIONAL "BUILD_LINUXDOC"
|
1553 | |
AC_DEFUN([XORG_CHECK_LINUXDOC],[
|
1554 | |
AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
|
1555 | |
AC_REQUIRE([XORG_WITH_PS2PDF])
|
1556 | |
|
1557 | |
AC_PATH_PROG(LINUXDOC, linuxdoc)
|
1558 | |
|
1559 | |
AC_MSG_CHECKING([whether to build documentation])
|
1560 | |
|
1561 | |
if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
|
1562 | |
BUILDDOC=yes
|
1563 | |
else
|
1564 | |
BUILDDOC=no
|
1565 | |
fi
|
1566 | |
|
1567 | |
AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
|
1568 | |
|
1569 | |
AC_MSG_RESULT([$BUILDDOC])
|
1570 | |
|
1571 | |
AC_MSG_CHECKING([whether to build pdf documentation])
|
1572 | |
|
1573 | |
if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
|
1574 | |
BUILDPDFDOC=yes
|
1575 | |
else
|
1576 | |
BUILDPDFDOC=no
|
1577 | |
fi
|
1578 | |
|
1579 | |
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
|
1580 | |
|
1581 | |
AC_MSG_RESULT([$BUILDPDFDOC])
|
1582 | |
|
1583 | |
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
|
1584 | |
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
|
1585 | |
MAKE_PDF="$PS2PDF"
|
1586 | |
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0"
|
1587 | |
|
1588 | |
AC_SUBST(MAKE_TEXT)
|
1589 | |
AC_SUBST(MAKE_PS)
|
1590 | |
AC_SUBST(MAKE_PDF)
|
1591 | |
AC_SUBST(MAKE_HTML)
|
1592 | |
]) # XORG_CHECK_LINUXDOC
|
1593 | |
|
1594 | |
# XORG_CHECK_DOCBOOK
|
1595 | |
# -------------------
|
1596 | |
# Minimum version: 1.0.0
|
1597 | |
#
|
1598 | |
# Checks for the ability to build output formats from SGML DocBook source.
|
1599 | |
# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
|
1600 | |
# indicates whether the necessary tools and files are found and, if set,
|
1601 | |
# $(MAKE_XXX) blah.sgml will produce blah.xxx.
|
1602 | |
AC_DEFUN([XORG_CHECK_DOCBOOK],[
|
1603 | |
AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
|
1604 | |
|
1605 | |
BUILDTXTDOC=no
|
1606 | |
BUILDPDFDOC=no
|
1607 | |
BUILDPSDOC=no
|
1608 | |
BUILDHTMLDOC=no
|
1609 | |
|
1610 | |
AC_PATH_PROG(DOCBOOKPS, docbook2ps)
|
1611 | |
AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
|
1612 | |
AC_PATH_PROG(DOCBOOKHTML, docbook2html)
|
1613 | |
AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
|
1614 | |
|
1615 | |
AC_MSG_CHECKING([whether to build text documentation])
|
1616 | |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
|
1617 | |
test x$BUILD_TXTDOC != xno; then
|
1618 | |
BUILDTXTDOC=yes
|
1619 | |
fi
|
1620 | |
AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
|
1621 | |
AC_MSG_RESULT([$BUILDTXTDOC])
|
1622 | |
|
1623 | |
AC_MSG_CHECKING([whether to build PDF documentation])
|
1624 | |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
|
1625 | |
test x$BUILD_PDFDOC != xno; then
|
1626 | |
BUILDPDFDOC=yes
|
1627 | |
fi
|
1628 | |
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
|
1629 | |
AC_MSG_RESULT([$BUILDPDFDOC])
|
1630 | |
|
1631 | |
AC_MSG_CHECKING([whether to build PostScript documentation])
|
1632 | |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
|
1633 | |
test x$BUILD_PSDOC != xno; then
|
1634 | |
BUILDPSDOC=yes
|
1635 | |
fi
|
1636 | |
AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
|
1637 | |
AC_MSG_RESULT([$BUILDPSDOC])
|
1638 | |
|
1639 | |
AC_MSG_CHECKING([whether to build HTML documentation])
|
1640 | |
if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
|
1641 | |
test x$BUILD_HTMLDOC != xno; then
|
1642 | |
BUILDHTMLDOC=yes
|
1643 | |
fi
|
1644 | |
AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
|
1645 | |
AC_MSG_RESULT([$BUILDHTMLDOC])
|
1646 | |
|
1647 | |
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
|
1648 | |
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
|
1649 | |
MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
|
1650 | |
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
|
1651 | |
|
1652 | |
AC_SUBST(MAKE_TEXT)
|
1653 | |
AC_SUBST(MAKE_PS)
|
1654 | |
AC_SUBST(MAKE_PDF)
|
1655 | |
AC_SUBST(MAKE_HTML)
|
1656 | |
]) # XORG_CHECK_DOCBOOK
|
1657 | |
|
1658 | |
# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
|
1659 | |
# ----------------
|
1660 | |
# Minimum version: 1.5.0
|
1661 | |
# Minimum version for optional DEFAULT argument: 1.11.0
|
1662 | |
#
|
1663 | |
# Documentation tools are not always available on all platforms and sometimes
|
1664 | |
# not at the appropriate level. This macro enables a module to test for the
|
1665 | |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
1666 | |
# the --with-xmlto option, it allows maximum flexibilty in making decisions
|
1667 | |
# as whether or not to use the xmlto package. When DEFAULT is not specified,
|
1668 | |
# --with-xmlto assumes 'auto'.
|
1669 | |
#
|
1670 | |
# Interface to module:
|
1671 | |
# HAVE_XMLTO: used in makefiles to conditionally generate documentation
|
1672 | |
# XMLTO: returns the path of the xmlto program found
|
1673 | |
# returns the path set by the user in the environment
|
1674 | |
# --with-xmlto: 'yes' user instructs the module to use xmlto
|
1675 | |
# 'no' user instructs the module not to use xmlto
|
1676 | |
#
|
1677 | |
# Added in version 1.10.0
|
1678 | |
# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
|
1679 | |
# xmlto for text output requires either lynx, links, or w3m browsers
|
1680 | |
#
|
1681 | |
# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
|
1682 | |
#
|
1683 | |
AC_DEFUN([XORG_WITH_XMLTO],[
|
1684 | |
AC_ARG_VAR([XMLTO], [Path to xmlto command])
|
1685 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
1686 | |
AC_ARG_WITH(xmlto,
|
1687 | |
AS_HELP_STRING([--with-xmlto],
|
1688 | |
[Use xmlto to regenerate documentation (default: ]_defopt[)]),
|
1689 | |
[use_xmlto=$withval], [use_xmlto=]_defopt)
|
1690 | |
m4_undefine([_defopt])
|
1691 | |
|
1692 | |
if test "x$use_xmlto" = x"auto"; then
|
1693 | |
AC_PATH_PROG([XMLTO], [xmlto])
|
1694 | |
if test "x$XMLTO" = "x"; then
|
1695 | |
AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
|
1696 | |
have_xmlto=no
|
1697 | |
else
|
1698 | |
have_xmlto=yes
|
1699 | |
fi
|
1700 | |
elif test "x$use_xmlto" = x"yes" ; then
|
1701 | |
AC_PATH_PROG([XMLTO], [xmlto])
|
1702 | |
if test "x$XMLTO" = "x"; then
|
1703 | |
AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
|
1704 | |
fi
|
1705 | |
have_xmlto=yes
|
1706 | |
elif test "x$use_xmlto" = x"no" ; then
|
1707 | |
if test "x$XMLTO" != "x"; then
|
1708 | |
AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
|
1709 | |
fi
|
1710 | |
have_xmlto=no
|
1711 | |
else
|
1712 | |
AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
|
1713 | |
fi
|
1714 | |
|
1715 | |
# Test for a minimum version of xmlto, if provided.
|
1716 | |
m4_ifval([$1],
|
1717 | |
[if test "$have_xmlto" = yes; then
|
1718 | |
# scrape the xmlto version
|
1719 | |
AC_MSG_CHECKING([the xmlto version])
|
1720 | |
xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
|
1721 | |
AC_MSG_RESULT([$xmlto_version])
|
1722 | |
AS_VERSION_COMPARE([$xmlto_version], [$1],
|
1723 | |
[if test "x$use_xmlto" = xauto; then
|
1724 | |
AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
|
1725 | |
have_xmlto=no
|
1726 | |
else
|
1727 | |
AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
|
1728 | |
fi])
|
1729 | |
fi])
|
1730 | |
|
1731 | |
# Test for the ability of xmlto to generate a text target
|
1732 | |
have_xmlto_text=no
|
1733 | |
cat > conftest.xml << "EOF"
|
1734 | |
EOF
|
1735 | |
AS_IF([test "$have_xmlto" = yes],
|
1736 | |
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
|
1737 | |
[have_xmlto_text=yes],
|
1738 | |
[AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
|
1739 | |
rm -f conftest.xml
|
1740 | |
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
|
1741 | |
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
|
1742 | |
]) # XORG_WITH_XMLTO
|
1743 | |
|
1744 | |
# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
|
1745 | |
# --------------------------------------------
|
1746 | |
# Minimum version: 1.12.0
|
1747 | |
# Minimum version for optional DEFAULT argument: 1.12.0
|
1748 | |
#
|
1749 | |
# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
|
1750 | |
# XML-based language used for the transformation of XML documents.
|
1751 | |
# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
|
1752 | |
# It is used under the cover by xmlto to generate html files from DocBook/XML.
|
1753 | |
# The XSLT processor is often used as a standalone tool for transformations.
|
1754 | |
# It should not be assumed that this tool is used only to work with documnetation.
|
1755 | |
# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
|
1756 | |
#
|
1757 | |
# Interface to module:
|
1758 | |
# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
|
1759 | |
# XSLTPROC: returns the path of the xsltproc program found
|
1760 | |
# returns the path set by the user in the environment
|
1761 | |
# --with-xsltproc: 'yes' user instructs the module to use xsltproc
|
1762 | |
# 'no' user instructs the module not to use xsltproc
|
1763 | |
# have_xsltproc: returns yes if xsltproc found in PATH or no
|
1764 | |
#
|
1765 | |
# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
|
1766 | |
#
|
1767 | |
AC_DEFUN([XORG_WITH_XSLTPROC],[
|
1768 | |
AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
|
1769 | |
# Preserves the interface, should it be implemented later
|
1770 | |
m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
|
1771 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
1772 | |
AC_ARG_WITH(xsltproc,
|
1773 | |
AS_HELP_STRING([--with-xsltproc],
|
1774 | |
[Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
|
1775 | |
[use_xsltproc=$withval], [use_xsltproc=]_defopt)
|
1776 | |
m4_undefine([_defopt])
|
1777 | |
|
1778 | |
if test "x$use_xsltproc" = x"auto"; then
|
1779 | |
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
1780 | |
if test "x$XSLTPROC" = "x"; then
|
1781 | |
AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
|
1782 | |
have_xsltproc=no
|
1783 | |
else
|
1784 | |
have_xsltproc=yes
|
1785 | |
fi
|
1786 | |
elif test "x$use_xsltproc" = x"yes" ; then
|
1787 | |
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
1788 | |
if test "x$XSLTPROC" = "x"; then
|
1789 | |
AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
|
1790 | |
fi
|
1791 | |
have_xsltproc=yes
|
1792 | |
elif test "x$use_xsltproc" = x"no" ; then
|
1793 | |
if test "x$XSLTPROC" != "x"; then
|
1794 | |
AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
|
1795 | |
fi
|
1796 | |
have_xsltproc=no
|
1797 | |
else
|
1798 | |
AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
|
1799 | |
fi
|
1800 | |
|
1801 | |
AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
|
1802 | |
]) # XORG_WITH_XSLTPROC
|
1803 | |
|
1804 | |
# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
|
1805 | |
# ----------------------------------------
|
1806 | |
# Minimum version: 1.15.0
|
1807 | |
#
|
1808 | |
# PERL (Practical Extraction and Report Language) is a language optimized for
|
1809 | |
# scanning arbitrary text files, extracting information from those text files,
|
1810 | |
# and printing reports based on that information.
|
1811 | |
#
|
1812 | |
# When DEFAULT is not specified, --with-perl assumes 'auto'.
|
1813 | |
#
|
1814 | |
# Interface to module:
|
1815 | |
# HAVE_PERL: used in makefiles to conditionally scan text files
|
1816 | |
# PERL: returns the path of the perl program found
|
1817 | |
# returns the path set by the user in the environment
|
1818 | |
# --with-perl: 'yes' user instructs the module to use perl
|
1819 | |
# 'no' user instructs the module not to use perl
|
1820 | |
# have_perl: returns yes if perl found in PATH or no
|
1821 | |
#
|
1822 | |
# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
|
1823 | |
#
|
1824 | |
AC_DEFUN([XORG_WITH_PERL],[
|
1825 | |
AC_ARG_VAR([PERL], [Path to perl command])
|
1826 | |
# Preserves the interface, should it be implemented later
|
1827 | |
m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
|
1828 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
1829 | |
AC_ARG_WITH(perl,
|
1830 | |
AS_HELP_STRING([--with-perl],
|
1831 | |
[Use perl for extracting information from files (default: ]_defopt[)]),
|
1832 | |
[use_perl=$withval], [use_perl=]_defopt)
|
1833 | |
m4_undefine([_defopt])
|
1834 | |
|
1835 | |
if test "x$use_perl" = x"auto"; then
|
1836 | |
AC_PATH_PROG([PERL], [perl])
|
1837 | |
if test "x$PERL" = "x"; then
|
1838 | |
AC_MSG_WARN([perl not found - cannot extract information and report])
|
1839 | |
have_perl=no
|
1840 | |
else
|
1841 | |
have_perl=yes
|
1842 | |
fi
|
1843 | |
elif test "x$use_perl" = x"yes" ; then
|
1844 | |
AC_PATH_PROG([PERL], [perl])
|
1845 | |
if test "x$PERL" = "x"; then
|
1846 | |
AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
|
1847 | |
fi
|
1848 | |
have_perl=yes
|
1849 | |
elif test "x$use_perl" = x"no" ; then
|
1850 | |
if test "x$PERL" != "x"; then
|
1851 | |
AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
|
1852 | |
fi
|
1853 | |
have_perl=no
|
1854 | |
else
|
1855 | |
AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
|
1856 | |
fi
|
1857 | |
|
1858 | |
AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
|
1859 | |
]) # XORG_WITH_PERL
|
1860 | |
|
1861 | |
# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
|
1862 | |
# ----------------
|
1863 | |
# Minimum version: 1.5.0
|
1864 | |
# Minimum version for optional DEFAULT argument: 1.11.0
|
1865 | |
#
|
1866 | |
# Documentation tools are not always available on all platforms and sometimes
|
1867 | |
# not at the appropriate level. This macro enables a module to test for the
|
1868 | |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
1869 | |
# the --with-asciidoc option, it allows maximum flexibilty in making decisions
|
1870 | |
# as whether or not to use the asciidoc package. When DEFAULT is not specified,
|
1871 | |
# --with-asciidoc assumes 'auto'.
|
1872 | |
#
|
1873 | |
# Interface to module:
|
1874 | |
# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
|
1875 | |
# ASCIIDOC: returns the path of the asciidoc program found
|
1876 | |
# returns the path set by the user in the environment
|
1877 | |
# --with-asciidoc: 'yes' user instructs the module to use asciidoc
|
1878 | |
# 'no' user instructs the module not to use asciidoc
|
1879 | |
#
|
1880 | |
# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
|
1881 | |
#
|
1882 | |
AC_DEFUN([XORG_WITH_ASCIIDOC],[
|
1883 | |
AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
|
1884 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
1885 | |
AC_ARG_WITH(asciidoc,
|
1886 | |
AS_HELP_STRING([--with-asciidoc],
|
1887 | |
[Use asciidoc to regenerate documentation (default: ]_defopt[)]),
|
1888 | |
[use_asciidoc=$withval], [use_asciidoc=]_defopt)
|
1889 | |
m4_undefine([_defopt])
|
1890 | |
|
1891 | |
if test "x$use_asciidoc" = x"auto"; then
|
1892 | |
AC_PATH_PROG([ASCIIDOC], [asciidoc])
|
1893 | |
if test "x$ASCIIDOC" = "x"; then
|
1894 | |
AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
|
1895 | |
have_asciidoc=no
|
1896 | |
else
|
1897 | |
have_asciidoc=yes
|
1898 | |
fi
|
1899 | |
elif test "x$use_asciidoc" = x"yes" ; then
|
1900 | |
AC_PATH_PROG([ASCIIDOC], [asciidoc])
|
1901 | |
if test "x$ASCIIDOC" = "x"; then
|
1902 | |
AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
|
1903 | |
fi
|
1904 | |
have_asciidoc=yes
|
1905 | |
elif test "x$use_asciidoc" = x"no" ; then
|
1906 | |
if test "x$ASCIIDOC" != "x"; then
|
1907 | |
AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
|
1908 | |
fi
|
1909 | |
have_asciidoc=no
|
1910 | |
else
|
1911 | |
AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
|
1912 | |
fi
|
1913 | |
m4_ifval([$1],
|
1914 | |
[if test "$have_asciidoc" = yes; then
|
1915 | |
# scrape the asciidoc version
|
1916 | |
AC_MSG_CHECKING([the asciidoc version])
|
1917 | |
asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
|
1918 | |
AC_MSG_RESULT([$asciidoc_version])
|
1919 | |
AS_VERSION_COMPARE([$asciidoc_version], [$1],
|
1920 | |
[if test "x$use_asciidoc" = xauto; then
|
1921 | |
AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
|
1922 | |
have_asciidoc=no
|
1923 | |
else
|
1924 | |
AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
|
1925 | |
fi])
|
1926 | |
fi])
|
1927 | |
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
|
1928 | |
]) # XORG_WITH_ASCIIDOC
|
1929 | |
|
1930 | |
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
|
1931 | |
# -------------------------------------------
|
1932 | |
# Minimum version: 1.5.0
|
1933 | |
# Minimum version for optional DEFAULT argument: 1.11.0
|
1934 | |
# Minimum version for optional DOT checking: 1.18.0
|
1935 | |
#
|
1936 | |
# Documentation tools are not always available on all platforms and sometimes
|
1937 | |
# not at the appropriate level. This macro enables a module to test for the
|
1938 | |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
1939 | |
# the --with-doxygen option, it allows maximum flexibilty in making decisions
|
1940 | |
# as whether or not to use the doxygen package. When DEFAULT is not specified,
|
1941 | |
# --with-doxygen assumes 'auto'.
|
1942 | |
#
|
1943 | |
# Interface to module:
|
1944 | |
# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
|
1945 | |
# DOXYGEN: returns the path of the doxygen program found
|
1946 | |
# returns the path set by the user in the environment
|
1947 | |
# --with-doxygen: 'yes' user instructs the module to use doxygen
|
1948 | |
# 'no' user instructs the module not to use doxygen
|
1949 | |
#
|
1950 | |
# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
|
1951 | |
#
|
1952 | |
AC_DEFUN([XORG_WITH_DOXYGEN],[
|
1953 | |
AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
|
1954 | |
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
|
1955 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
1956 | |
AC_ARG_WITH(doxygen,
|
1957 | |
AS_HELP_STRING([--with-doxygen],
|
1958 | |
[Use doxygen to regenerate documentation (default: ]_defopt[)]),
|
1959 | |
[use_doxygen=$withval], [use_doxygen=]_defopt)
|
1960 | |
m4_undefine([_defopt])
|
1961 | |
|
1962 | |
if test "x$use_doxygen" = x"auto"; then
|
1963 | |
AC_PATH_PROG([DOXYGEN], [doxygen])
|
1964 | |
if test "x$DOXYGEN" = "x"; then
|
1965 | |
AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
|
1966 | |
have_doxygen=no
|
1967 | |
else
|
1968 | |
have_doxygen=yes
|
1969 | |
fi
|
1970 | |
elif test "x$use_doxygen" = x"yes" ; then
|
1971 | |
AC_PATH_PROG([DOXYGEN], [doxygen])
|
1972 | |
if test "x$DOXYGEN" = "x"; then
|
1973 | |
AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
|
1974 | |
fi
|
1975 | |
have_doxygen=yes
|
1976 | |
elif test "x$use_doxygen" = x"no" ; then
|
1977 | |
if test "x$DOXYGEN" != "x"; then
|
1978 | |
AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
|
1979 | |
fi
|
1980 | |
have_doxygen=no
|
1981 | |
else
|
1982 | |
AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
|
1983 | |
fi
|
1984 | |
m4_ifval([$1],
|
1985 | |
[if test "$have_doxygen" = yes; then
|
1986 | |
# scrape the doxygen version
|
1987 | |
AC_MSG_CHECKING([the doxygen version])
|
1988 | |
doxygen_version=`$DOXYGEN --version 2>/dev/null`
|
1989 | |
AC_MSG_RESULT([$doxygen_version])
|
1990 | |
AS_VERSION_COMPARE([$doxygen_version], [$1],
|
1991 | |
[if test "x$use_doxygen" = xauto; then
|
1992 | |
AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
|
1993 | |
have_doxygen=no
|
1994 | |
else
|
1995 | |
AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
|
1996 | |
fi])
|
1997 | |
fi])
|
1998 | |
|
1999 | |
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
|
2000 | |
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
|
2001 | |
dnl HAVE_DOT = @HAVE_DOT@
|
2002 | |
HAVE_DOT=no
|
2003 | |
if test "x$have_doxygen" = "xyes"; then
|
2004 | |
AC_PATH_PROG([DOT], [dot])
|
2005 | |
if test "x$DOT" != "x"; then
|
2006 | |
HAVE_DOT=yes
|
2007 | |
fi
|
2008 | |
fi
|
2009 | |
|
2010 | |
AC_SUBST([HAVE_DOT])
|
2011 | |
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
|
2012 | |
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
|
2013 | |
]) # XORG_WITH_DOXYGEN
|
2014 | |
|
2015 | |
# XORG_WITH_GROFF([DEFAULT])
|
2016 | |
# ----------------
|
2017 | |
# Minimum version: 1.6.0
|
2018 | |
# Minimum version for optional DEFAULT argument: 1.11.0
|
2019 | |
#
|
2020 | |
# Documentation tools are not always available on all platforms and sometimes
|
2021 | |
# not at the appropriate level. This macro enables a module to test for the
|
2022 | |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
2023 | |
# the --with-groff option, it allows maximum flexibilty in making decisions
|
2024 | |
# as whether or not to use the groff package. When DEFAULT is not specified,
|
2025 | |
# --with-groff assumes 'auto'.
|
2026 | |
#
|
2027 | |
# Interface to module:
|
2028 | |
# HAVE_GROFF: used in makefiles to conditionally generate documentation
|
2029 | |
# HAVE_GROFF_MM: the memorandum macros (-mm) package
|
2030 | |
# HAVE_GROFF_MS: the -ms macros package
|
2031 | |
# GROFF: returns the path of the groff program found
|
2032 | |
# returns the path set by the user in the environment
|
2033 | |
# --with-groff: 'yes' user instructs the module to use groff
|
2034 | |
# 'no' user instructs the module not to use groff
|
2035 | |
#
|
2036 | |
# Added in version 1.9.0:
|
2037 | |
# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
|
2038 | |
# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
|
2039 | |
# psselect from the psutils package.
|
2040 | |
# the ghostcript package. Refer to the grohtml man pages
|
2041 | |
#
|
2042 | |
# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
|
2043 | |
#
|
2044 | |
# OS and distros often splits groff in a basic and full package, the former
|
2045 | |
# having the groff program and the later having devices, fonts and macros
|
2046 | |
# Checking for the groff executable is not enough.
|
2047 | |
#
|
2048 | |
# If macros are missing, we cannot assume that groff is useless, so we don't
|
2049 | |
# unset HAVE_GROFF or GROFF env variables.
|
2050 | |
# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
|
2051 | |
#
|
2052 | |
AC_DEFUN([XORG_WITH_GROFF],[
|
2053 | |
AC_ARG_VAR([GROFF], [Path to groff command])
|
2054 | |
m4_define([_defopt], m4_default([$1], [auto]))
|
2055 | |
AC_ARG_WITH(groff,
|
2056 | |
AS_HELP_STRING([--with-groff],
|
2057 | |
[Use groff to regenerate documentation (default: ]_defopt[)]),
|
2058 | |
[use_groff=$withval], [use_groff=]_defopt)
|
2059 | |
m4_undefine([_defopt])
|
2060 | |
|
2061 | |
if test "x$use_groff" = x"auto"; then
|
2062 | |
AC_PATH_PROG([GROFF], [groff])
|
2063 | |
if test "x$GROFF" = "x"; then
|
2064 | |
AC_MSG_WARN([groff not found - documentation targets will be skipped])
|
2065 | |
have_groff=no
|
2066 | |
else
|
2067 | |
have_groff=yes
|
2068 | |
fi
|
2069 | |
elif test "x$use_groff" = x"yes" ; then
|
2070 | |
AC_PATH_PROG([GROFF], [groff])
|
2071 | |
if test "x$GROFF" = "x"; then
|
2072 | |
AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
|
2073 | |
fi
|
2074 | |
have_groff=yes
|
2075 | |
elif test "x$use_groff" = x"no" ; then
|
2076 | |
if test "x$GROFF" != "x"; then
|
2077 | |
AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
|
2078 | |
fi
|
2079 | |
have_groff=no
|
2080 | |
else
|
2081 | |
AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
|
2082 | |
fi
|
2083 | |
|
2084 | |
# We have groff, test for the presence of the macro packages
|
2085 | |
if test "x$have_groff" = x"yes"; then
|
2086 | |
AC_MSG_CHECKING([for ${GROFF} -ms macros])
|
2087 | |
if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
|
2088 | |
groff_ms_works=yes
|
2089 | |
else
|
2090 | |
groff_ms_works=no
|
2091 | |
fi
|
2092 | |
AC_MSG_RESULT([$groff_ms_works])
|
2093 | |
AC_MSG_CHECKING([for ${GROFF} -mm macros])
|
2094 | |
if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
|
2095 | |
groff_mm_works=yes
|
2096 | |
else
|
2097 | |
groff_mm_works=no
|
2098 | |
fi
|
2099 | |
AC_MSG_RESULT([$groff_mm_works])
|
2100 | |
fi
|
2101 | |
|
2102 | |
# We have groff, test for HTML dependencies, one command per package
|
2103 | |
if test "x$have_groff" = x"yes"; then
|
2104 | |
AC_PATH_PROGS(GS_PATH, [gs gswin32c])
|
2105 | |
AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
|
2106 | |
AC_PATH_PROG(PSSELECT_PATH, [psselect])
|
2107 | |
if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
|
2108 | |
have_groff_html=yes
|
2109 | |
else
|
2110 | |
have_groff_html=no
|
2111 | |
AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
|
2112 | |
fi
|
2113 | |
fi
|
2114 | |
|
2115 | |
# Set Automake conditionals for Makefiles
|
2116 | |
AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
|
2117 | |
AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
|
2118 | |
AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
|
2119 | |
AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
|
2120 | |
]) # XORG_WITH_GROFF
|
2121 | |
|
2122 | |
# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
|
2123 | |
# ---------------------------------------
|
2124 | |
# Minimum version: 1.6.0
|
2125 | |
# Minimum version for optional DEFAULT argument: 1.11.0
|
2126 | |
# Minimum version for optional MIN-VERSION argument: 1.15.0
|
2127 | |
#
|
2128 | |
# Documentation tools are not always available on all platforms and sometimes
|
2129 | |
# not at the appropriate level. This macro enables a module to test for the
|
2130 | |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
2131 | |
# the --with-fop option, it allows maximum flexibilty in making decisions
|
2132 | |
# as whether or not to use the fop package. When DEFAULT is not specified,
|
2133 | |
# --with-fop assumes 'auto'.
|
2134 | |
#
|
2135 | |
# Interface to module:
|
2136 | |
# HAVE_FOP: used in makefiles to conditionally generate documentation
|
2137 | |
# FOP: returns the path of the fop program found
|
2138 | |
# returns the path set by the user in the environment
|
2139 | |
# --with-fop: 'yes' user instructs the module to use fop
|
2140 | |
# 'no' user instructs the module not to use fop
|
2141 | |
#
|
2142 | |
# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
|
2143 | |
#
|
2144 | |
AC_DEFUN([XORG_WITH_FOP],[
|
2145 | |
AC_ARG_VAR([FOP], [Path to fop command])
|
2146 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
2147 | |
AC_ARG_WITH(fop,
|
2148 | |
AS_HELP_STRING([--with-fop],
|
2149 | |
[Use fop to regenerate documentation (default: ]_defopt[)]),
|
2150 | |
[use_fop=$withval], [use_fop=]_defopt)
|
2151 | |
m4_undefine([_defopt])
|
2152 | |
|
2153 | |
if test "x$use_fop" = x"auto"; then
|
2154 | |
AC_PATH_PROG([FOP], [fop])
|
2155 | |
if test "x$FOP" = "x"; then
|
2156 | |
AC_MSG_WARN([fop not found - documentation targets will be skipped])
|
2157 | |
have_fop=no
|
2158 | |
else
|
2159 | |
have_fop=yes
|
2160 | |
fi
|
2161 | |
elif test "x$use_fop" = x"yes" ; then
|
2162 | |
AC_PATH_PROG([FOP], [fop])
|
2163 | |
if test "x$FOP" = "x"; then
|
2164 | |
AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
|
2165 | |
fi
|
2166 | |
have_fop=yes
|
2167 | |
elif test "x$use_fop" = x"no" ; then
|
2168 | |
if test "x$FOP" != "x"; then
|
2169 | |
AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
|
2170 | |
fi
|
2171 | |
have_fop=no
|
2172 | |
else
|
2173 | |
AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
|
2174 | |
fi
|
2175 | |
|
2176 | |
# Test for a minimum version of fop, if provided.
|
2177 | |
m4_ifval([$1],
|
2178 | |
[if test "$have_fop" = yes; then
|
2179 | |
# scrape the fop version
|
2180 | |
AC_MSG_CHECKING([for fop minimum version])
|
2181 | |
fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
|
2182 | |
AC_MSG_RESULT([$fop_version])
|
2183 | |
AS_VERSION_COMPARE([$fop_version], [$1],
|
2184 | |
[if test "x$use_fop" = xauto; then
|
2185 | |
AC_MSG_WARN([fop version $fop_version found, but $1 needed])
|
2186 | |
have_fop=no
|
2187 | |
else
|
2188 | |
AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
|
2189 | |
fi])
|
2190 | |
fi])
|
2191 | |
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
|
2192 | |
]) # XORG_WITH_FOP
|
2193 | |
|
2194 | |
# XORG_WITH_M4([MIN-VERSION])
|
2195 | |
# ---------------------------
|
2196 | |
# Minimum version: 1.19.0
|
2197 | |
#
|
2198 | |
# This macro attempts to locate an m4 macro processor which supports
|
2199 | |
# -I option and is only useful for modules relying on M4 in order to
|
2200 | |
# expand macros in source code files.
|
2201 | |
#
|
2202 | |
# Interface to module:
|
2203 | |
# M4: returns the path of the m4 program found
|
2204 | |
# returns the path set by the user in the environment
|
2205 | |
#
|
2206 | |
AC_DEFUN([XORG_WITH_M4], [
|
2207 | |
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
|
2208 | |
[AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
|
2209 | |
[[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
|
2210 | |
ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
|
2211 | |
[AC_MSG_ERROR([could not find m4 that supports -I option])],
|
2212 | |
[$PATH:/usr/gnu/bin])])
|
2213 | |
|
2214 | |
AC_SUBST([M4], [$ac_cv_path_M4])
|
2215 | |
]) # XORG_WITH_M4
|
2216 | |
|
2217 | |
# XORG_WITH_PS2PDF([DEFAULT])
|
2218 | |
# ----------------
|
2219 | |
# Minimum version: 1.6.0
|
2220 | |
# Minimum version for optional DEFAULT argument: 1.11.0
|
2221 | |
#
|
2222 | |
# Documentation tools are not always available on all platforms and sometimes
|
2223 | |
# not at the appropriate level. This macro enables a module to test for the
|
2224 | |
# presence of the tool and obtain it's path in separate variables. Coupled with
|
2225 | |
# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
|
2226 | |
# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
|
2227 | |
# --with-ps2pdf assumes 'auto'.
|
2228 | |
#
|
2229 | |
# Interface to module:
|
2230 | |
# HAVE_PS2PDF: used in makefiles to conditionally generate documentation
|
2231 | |
# PS2PDF: returns the path of the ps2pdf program found
|
2232 | |
# returns the path set by the user in the environment
|
2233 | |
# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
|
2234 | |
# 'no' user instructs the module not to use ps2pdf
|
2235 | |
#
|
2236 | |
# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
|
2237 | |
#
|
2238 | |
AC_DEFUN([XORG_WITH_PS2PDF],[
|
2239 | |
AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
|
2240 | |
m4_define([_defopt], m4_default([$1], [auto]))
|
2241 | |
AC_ARG_WITH(ps2pdf,
|
2242 | |
AS_HELP_STRING([--with-ps2pdf],
|
2243 | |
[Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
|
2244 | |
[use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
|
2245 | |
m4_undefine([_defopt])
|
2246 | |
|
2247 | |
if test "x$use_ps2pdf" = x"auto"; then
|
2248 | |
AC_PATH_PROG([PS2PDF], [ps2pdf])
|
2249 | |
if test "x$PS2PDF" = "x"; then
|
2250 | |
AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
|
2251 | |
have_ps2pdf=no
|
2252 | |
else
|
2253 | |
have_ps2pdf=yes
|
2254 | |
fi
|
2255 | |
elif test "x$use_ps2pdf" = x"yes" ; then
|
2256 | |
AC_PATH_PROG([PS2PDF], [ps2pdf])
|
2257 | |
if test "x$PS2PDF" = "x"; then
|
2258 | |
AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
|
2259 | |
fi
|
2260 | |
have_ps2pdf=yes
|
2261 | |
elif test "x$use_ps2pdf" = x"no" ; then
|
2262 | |
if test "x$PS2PDF" != "x"; then
|
2263 | |
AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
|
2264 | |
fi
|
2265 | |
have_ps2pdf=no
|
2266 | |
else
|
2267 | |
AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
|
2268 | |
fi
|
2269 | |
AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
|
2270 | |
]) # XORG_WITH_PS2PDF
|
2271 | |
|
2272 | |
# XORG_ENABLE_DOCS (enable_docs=yes)
|
2273 | |
# ----------------
|
2274 | |
# Minimum version: 1.6.0
|
2275 | |
#
|
2276 | |
# Documentation tools are not always available on all platforms and sometimes
|
2277 | |
# not at the appropriate level. This macro enables a builder to skip all
|
2278 | |
# documentation targets except traditional man pages.
|
2279 | |
# Combined with the specific tool checking macros XORG_WITH_*, it provides
|
2280 | |
# maximum flexibilty in controlling documentation building.
|
2281 | |
# Refer to:
|
2282 | |
# XORG_WITH_XMLTO --with-xmlto
|
2283 | |
# XORG_WITH_ASCIIDOC --with-asciidoc
|
2284 | |
# XORG_WITH_DOXYGEN --with-doxygen
|
2285 | |
# XORG_WITH_FOP --with-fop
|
2286 | |
# XORG_WITH_GROFF --with-groff
|
2287 | |
# XORG_WITH_PS2PDF --with-ps2pdf
|
2288 | |
#
|
2289 | |
# Interface to module:
|
2290 | |
# ENABLE_DOCS: used in makefiles to conditionally generate documentation
|
2291 | |
# --enable-docs: 'yes' user instructs the module to generate docs
|
2292 | |
# 'no' user instructs the module not to generate docs
|
2293 | |
# parm1: specify the default value, yes or no.
|
2294 | |
#
|
2295 | |
AC_DEFUN([XORG_ENABLE_DOCS],[
|
2296 | |
m4_define([docs_default], m4_default([$1], [yes]))
|
2297 | |
AC_ARG_ENABLE(docs,
|
2298 | |
AS_HELP_STRING([--enable-docs],
|
2299 | |
[Enable building the documentation (default: ]docs_default[)]),
|
2300 | |
[build_docs=$enableval], [build_docs=]docs_default)
|
2301 | |
m4_undefine([docs_default])
|
2302 | |
AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
|
2303 | |
AC_MSG_CHECKING([whether to build documentation])
|
2304 | |
AC_MSG_RESULT([$build_docs])
|
2305 | |
]) # XORG_ENABLE_DOCS
|
2306 | |
|
2307 | |
# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
|
2308 | |
# ----------------
|
2309 | |
# Minimum version: 1.6.0
|
2310 | |
#
|
2311 | |
# This macro enables a builder to skip all developer documentation.
|
2312 | |
# Combined with the specific tool checking macros XORG_WITH_*, it provides
|
2313 | |
# maximum flexibilty in controlling documentation building.
|
2314 | |
# Refer to:
|
2315 | |
# XORG_WITH_XMLTO --with-xmlto
|
2316 | |
# XORG_WITH_ASCIIDOC --with-asciidoc
|
2317 | |
# XORG_WITH_DOXYGEN --with-doxygen
|
2318 | |
# XORG_WITH_FOP --with-fop
|
2319 | |
# XORG_WITH_GROFF --with-groff
|
2320 | |
# XORG_WITH_PS2PDF --with-ps2pdf
|
2321 | |
#
|
2322 | |
# Interface to module:
|
2323 | |
# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs
|
2324 | |
# --enable-devel-docs: 'yes' user instructs the module to generate developer docs
|
2325 | |
# 'no' user instructs the module not to generate developer docs
|
2326 | |
# parm1: specify the default value, yes or no.
|
2327 | |
#
|
2328 | |
AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
|
2329 | |
m4_define([devel_default], m4_default([$1], [yes]))
|
2330 | |
AC_ARG_ENABLE(devel-docs,
|
2331 | |
AS_HELP_STRING([--enable-devel-docs],
|
2332 | |
[Enable building the developer documentation (default: ]devel_default[)]),
|
2333 | |
[build_devel_docs=$enableval], [build_devel_docs=]devel_default)
|
2334 | |
m4_undefine([devel_default])
|
2335 | |
AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
|
2336 | |
AC_MSG_CHECKING([whether to build developer documentation])
|
2337 | |
AC_MSG_RESULT([$build_devel_docs])
|
2338 | |
]) # XORG_ENABLE_DEVEL_DOCS
|
2339 | |
|
2340 | |
# XORG_ENABLE_SPECS (enable_specs=yes)
|
2341 | |
# ----------------
|
2342 | |
# Minimum version: 1.6.0
|
2343 | |
#
|
2344 | |
# This macro enables a builder to skip all functional specification targets.
|
2345 | |
# Combined with the specific tool checking macros XORG_WITH_*, it provides
|
2346 | |
# maximum flexibilty in controlling documentation building.
|
2347 | |
# Refer to:
|
2348 | |
# XORG_WITH_XMLTO --with-xmlto
|
2349 | |
# XORG_WITH_ASCIIDOC --with-asciidoc
|
2350 | |
# XORG_WITH_DOXYGEN --with-doxygen
|
2351 | |
# XORG_WITH_FOP --with-fop
|
2352 | |
# XORG_WITH_GROFF --with-groff
|
2353 | |
# XORG_WITH_PS2PDF --with-ps2pdf
|
2354 | |
#
|
2355 | |
# Interface to module:
|
2356 | |
# ENABLE_SPECS: used in makefiles to conditionally generate specs
|
2357 | |
# --enable-specs: 'yes' user instructs the module to generate specs
|
2358 | |
# 'no' user instructs the module not to generate specs
|
2359 | |
# parm1: specify the default value, yes or no.
|
2360 | |
#
|
2361 | |
AC_DEFUN([XORG_ENABLE_SPECS],[
|
2362 | |
m4_define([spec_default], m4_default([$1], [yes]))
|
2363 | |
AC_ARG_ENABLE(specs,
|
2364 | |
AS_HELP_STRING([--enable-specs],
|
2365 | |
[Enable building the specs (default: ]spec_default[)]),
|
2366 | |
[build_specs=$enableval], [build_specs=]spec_default)
|
2367 | |
m4_undefine([spec_default])
|
2368 | |
AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
|
2369 | |
AC_MSG_CHECKING([whether to build functional specifications])
|
2370 | |
AC_MSG_RESULT([$build_specs])
|
2371 | |
]) # XORG_ENABLE_SPECS
|
2372 | |
|
2373 | |
# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
|
2374 | |
# ----------------------------------------------
|
2375 | |
# Minimum version: 1.13.0
|
2376 | |
#
|
2377 | |
# This macro enables a builder to enable/disable unit testing
|
2378 | |
# It makes no assumption about the test cases implementation
|
2379 | |
# Test cases may or may not use Automake "Support for test suites"
|
2380 | |
# They may or may not use the software utility library GLib
|
2381 | |
#
|
2382 | |
# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
|
2383 | |
# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
|
2384 | |
# The variable enable_unit_tests is used by other macros in this file.
|
2385 | |
#
|
2386 | |
# Interface to module:
|
2387 | |
# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests
|
2388 | |
# enable_unit_tests: used in configure.ac for additional configuration
|
2389 | |
# --enable-unit-tests: 'yes' user instructs the module to build tests
|
2390 | |
# 'no' user instructs the module not to build tests
|
2391 | |
# parm1: specify the default value, yes or no.
|
2392 | |
#
|
2393 | |
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
|
2394 | |
AC_BEFORE([$0], [XORG_WITH_GLIB])
|
2395 | |
AC_BEFORE([$0], [XORG_LD_WRAP])
|
2396 | |
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
|
2397 | |
m4_define([_defopt], m4_default([$1], [auto]))
|
2398 | |
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
|
2399 | |
[Enable building unit test cases (default: ]_defopt[)]),
|
2400 | |
[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
|
2401 | |
m4_undefine([_defopt])
|
2402 | |
AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
|
2403 | |
AC_MSG_CHECKING([whether to build unit test cases])
|
2404 | |
AC_MSG_RESULT([$enable_unit_tests])
|
2405 | |
]) # XORG_ENABLE_UNIT_TESTS
|
2406 | |
|
2407 | |
# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
|
2408 | |
# ------------------------------------------------------
|
2409 | |
# Minimum version: 1.17.0
|
2410 | |
#
|
2411 | |
# This macro enables a builder to enable/disable integration testing
|
2412 | |
# It makes no assumption about the test cases' implementation
|
2413 | |
# Test cases may or may not use Automake "Support for test suites"
|
2414 | |
#
|
2415 | |
# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
|
2416 | |
# usually requires less dependencies and may be built and run under less
|
2417 | |
# stringent environments than integration tests.
|
2418 | |
#
|
2419 | |
# Interface to module:
|
2420 | |
# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests
|
2421 | |
# enable_integration_tests: used in configure.ac for additional configuration
|
2422 | |
# --enable-integration-tests: 'yes' user instructs the module to build tests
|
2423 | |
# 'no' user instructs the module not to build tests
|
2424 | |
# parm1: specify the default value, yes or no.
|
2425 | |
#
|
2426 | |
AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
|
2427 | |
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
|
2428 | |
m4_define([_defopt], m4_default([$1], [auto]))
|
2429 | |
AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
|
2430 | |
[Enable building integration test cases (default: ]_defopt[)]),
|
2431 | |
[enable_integration_tests=$enableval],
|
2432 | |
[enable_integration_tests=]_defopt)
|
2433 | |
m4_undefine([_defopt])
|
2434 | |
AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
|
2435 | |
[test "x$enable_integration_tests" != xno])
|
2436 | |
AC_MSG_CHECKING([whether to build unit test cases])
|
2437 | |
AC_MSG_RESULT([$enable_integration_tests])
|
2438 | |
]) # XORG_ENABLE_INTEGRATION_TESTS
|
2439 | |
|
2440 | |
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
|
2441 | |
# ----------------------------------------
|
2442 | |
# Minimum version: 1.13.0
|
2443 | |
#
|
2444 | |
# GLib is a library which provides advanced data structures and functions.
|
2445 | |
# This macro enables a module to test for the presence of Glib.
|
2446 | |
#
|
2447 | |
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
|
2448 | |
# Otherwise the value of $enable_unit_tests is blank.
|
2449 | |
#
|
2450 | |
# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
|
2451 | |
# test support usually requires less dependencies and may be built and run under
|
2452 | |
# less stringent environments than integration tests.
|
2453 | |
#
|
2454 | |
# Interface to module:
|
2455 | |
# HAVE_GLIB: used in makefiles to conditionally build targets
|
2456 | |
# with_glib: used in configure.ac to know if GLib has been found
|
2457 | |
# --with-glib: 'yes' user instructs the module to use glib
|
2458 | |
# 'no' user instructs the module not to use glib
|
2459 | |
#
|
2460 | |
AC_DEFUN([XORG_WITH_GLIB],[
|
2461 | |
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
2462 | |
m4_define([_defopt], m4_default([$2], [auto]))
|
2463 | |
AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
|
2464 | |
[Use GLib library for unit testing (default: ]_defopt[)]),
|
2465 | |
[with_glib=$withval], [with_glib=]_defopt)
|
2466 | |
m4_undefine([_defopt])
|
2467 | |
|
2468 | |
have_glib=no
|
2469 | |
# Do not probe GLib if user explicitly disabled unit testing
|
2470 | |
if test "x$enable_unit_tests" != x"no"; then
|
2471 | |
# Do not probe GLib if user explicitly disabled it
|
2472 | |
if test "x$with_glib" != x"no"; then
|
2473 | |
m4_ifval(
|
2474 | |
[$1],
|
2475 | |
[PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
|
2476 | |
[PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
|
2477 | |
)
|
2478 | |
fi
|
2479 | |
fi
|
2480 | |
|
2481 | |
# Not having GLib when unit testing has been explicitly requested is an error
|
2482 | |
if test "x$enable_unit_tests" = x"yes"; then
|
2483 | |
if test "x$have_glib" = x"no"; then
|
2484 | |
AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
|
2485 | |
fi
|
2486 | |
fi
|
2487 | |
|
2488 | |
# Having unit testing disabled when GLib has been explicitly requested is an error
|
2489 | |
if test "x$enable_unit_tests" = x"no"; then
|
2490 | |
if test "x$with_glib" = x"yes"; then
|
2491 | |
AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
|
2492 | |
fi
|
2493 | |
fi
|
2494 | |
|
2495 | |
# Not having GLib when it has been explicitly requested is an error
|
2496 | |
if test "x$with_glib" = x"yes"; then
|
2497 | |
if test "x$have_glib" = x"no"; then
|
2498 | |
AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
|
2499 | |
fi
|
2500 | |
fi
|
2501 | |
|
2502 | |
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
|
2503 | |
]) # XORG_WITH_GLIB
|
2504 | |
|
2505 | |
# XORG_LD_WRAP([required|optional])
|
2506 | |
# ---------------------------------
|
2507 | |
# Minimum version: 1.13.0
|
2508 | |
#
|
2509 | |
# Check if linker supports -wrap, passed via compiler flags
|
2510 | |
#
|
2511 | |
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
|
2512 | |
# Otherwise the value of $enable_unit_tests is blank.
|
2513 | |
#
|
2514 | |
# Argument added in 1.16.0 - default is "required", to match existing behavior
|
2515 | |
# of returning an error if enable_unit_tests is yes, and ld -wrap is not
|
2516 | |
# available, an argument of "optional" allows use when some unit tests require
|
2517 | |
# ld -wrap and others do not.
|
2518 | |
#
|
2519 | |
AC_DEFUN([XORG_LD_WRAP],[
|
2520 | |
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
|
2521 | |
[AC_LANG_PROGRAM([#include <stdlib.h>
|
2522 | |
void __wrap_exit(int status) { return; }],
|
2523 | |
[exit(0);])])
|
2524 | |
# Not having ld wrap when unit testing has been explicitly requested is an error
|
2525 | |
if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
|
2526 | |
if test "x$have_ld_wrap" = x"no"; then
|
2527 | |
AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
|
2528 | |
fi
|
2529 | |
fi
|
2530 | |
AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
|
2531 | |
#
|
2532 | |
]) # XORG_LD_WRAP
|
2533 | |
|
2534 | |
# XORG_CHECK_LINKER_FLAGS
|
2535 | |
# -----------------------
|
2536 | |
# SYNOPSIS
|
2537 | |
#
|
2538 | |
# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
|
2539 | |
#
|
2540 | |
# DESCRIPTION
|
2541 | |
#
|
2542 | |
# Check whether the given linker FLAGS work with the current language's
|
2543 | |
# linker, or whether they give an error.
|
2544 | |
#
|
2545 | |
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
2546 | |
# success/failure.
|
2547 | |
#
|
2548 | |
# PROGRAM-SOURCE is the program source to link with, if needed
|
2549 | |
#
|
2550 | |
# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
|
2551 | |
#
|
2552 | |
# LICENSE
|
2553 | |
#
|
2554 | |
# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
|
2555 | |
# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
|
2556 | |
# Copyright (c) 2009 Matteo Frigo
|
2557 | |
#
|
2558 | |
# This program is free software: you can redistribute it and/or modify it
|
2559 | |
# under the terms of the GNU General Public License as published by the
|
2560 | |
# Free Software Foundation, either version 3 of the License, or (at your
|
2561 | |
# option) any later version.
|
2562 | |
#
|
2563 | |
# This program is distributed in the hope that it will be useful, but
|
2564 | |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
2565 | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
2566 | |
# Public License for more details.
|
2567 | |
#
|
2568 | |
# You should have received a copy of the GNU General Public License along
|
2569 | |
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
2570 | |
#
|
2571 | |
# As a special exception, the respective Autoconf Macro's copyright owner
|
2572 | |
# gives unlimited permission to copy, distribute and modify the configure
|
2573 | |
# scripts that are the output of Autoconf when processing the Macro. You
|
2574 | |
# need not follow the terms of the GNU General Public License when using
|
2575 | |
# or distributing such scripts, even though portions of the text of the
|
2576 | |
# Macro appear in them. The GNU General Public License (GPL) does govern
|
2577 | |
# all other use of the material that constitutes the Autoconf Macro.
|
2578 | |
#
|
2579 | |
# This special exception to the GPL applies to versions of the Autoconf
|
2580 | |
# Macro released by the Autoconf Archive. When you make and distribute a
|
2581 | |
# modified version of the Autoconf Macro, you may extend this special
|
2582 | |
# exception to the GPL to apply to your modified version as well.#
|
2583 | |
AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
|
2584 | |
[AC_MSG_CHECKING([whether the linker accepts $1])
|
2585 | |
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
|
2586 | |
AS_LITERAL_IF([$1],
|
2587 | |
[AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
|
2588 | |
ax_save_FLAGS=$LDFLAGS
|
2589 | |
LDFLAGS="$1"
|
2590 | |
AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
|
2591 | |
AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
|
2592 | |
AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
|
2593 | |
LDFLAGS=$ax_save_FLAGS])],
|
2594 | |
[ax_save_FLAGS=$LDFLAGS
|
2595 | |
LDFLAGS="$1"
|
2596 | |
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
2597 | |
eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
|
2598 | |
eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
|
2599 | |
LDFLAGS=$ax_save_FLAGS])
|
2600 | |
eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
|
2601 | |
AC_MSG_RESULT($xorg_check_linker_flags)
|
2602 | |
if test "x$xorg_check_linker_flags" = xyes; then
|
2603 | |
m4_default([$2], :)
|
2604 | |
else
|
2605 | |
m4_default([$3], :)
|
2606 | |
fi
|
2607 | |
]) # XORG_CHECK_LINKER_FLAGS
|
2608 | |
|
2609 | |
# XORG_MEMORY_CHECK_FLAGS
|
2610 | |
# -----------------------
|
2611 | |
# Minimum version: 1.16.0
|
2612 | |
#
|
2613 | |
# This macro attempts to find appropriate memory checking functionality
|
2614 | |
# for various platforms which unit testing code may use to catch various
|
2615 | |
# forms of memory allocation and access errors in testing.
|
2616 | |
#
|
2617 | |
# Interface to module:
|
2618 | |
# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
|
2619 | |
# Usually added to TESTS_ENVIRONMENT in Makefile.am
|
2620 | |
#
|
2621 | |
# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
|
2622 | |
#
|
2623 | |
AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
|
2624 | |
|
2625 | |
AC_REQUIRE([AC_CANONICAL_HOST])
|
2626 | |
AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
|
2627 | |
[Environment variables to enable memory checking in tests])
|
2628 | |
|
2629 | |
# Check for different types of support on different platforms
|
2630 | |
case $host_os in
|
2631 | |
solaris*)
|
2632 | |
AC_CHECK_LIB([umem], [umem_alloc],
|
2633 | |
[malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
|
2634 | |
;;
|
2635 | |
*-gnu*) # GNU libc - Value is used as a single byte bit pattern,
|
2636 | |
# both directly and inverted, so should not be 0 or 255.
|
2637 | |
malloc_debug_env='MALLOC_PERTURB_=15'
|
2638 | |
;;
|
2639 | |
darwin*)
|
2640 | |
malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
|
2641 | |
;;
|
2642 | |
*bsd*)
|
2643 | |
malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
|
2644 | |
;;
|
2645 | |
esac
|
2646 | |
|
2647 | |
# User supplied flags override default flags
|
2648 | |
if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
|
2649 | |
malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
|
2650 | |
fi
|
2651 | |
|
2652 | |
AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
|
2653 | |
]) # XORG_WITH_LINT
|
2654 | |
|
2655 | |
# XORG_CHECK_MALLOC_ZERO
|
2656 | |
# ----------------------
|
2657 | |
# Minimum version: 1.0.0
|
2658 | |
#
|
2659 | |
# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
|
2660 | |
# malloc(0) returns NULL. Packages should add one of these cflags to
|
2661 | |
# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
|
2662 | |
AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
|
2663 | |
AC_ARG_ENABLE(malloc0returnsnull,
|
2664 | |
AS_HELP_STRING([--enable-malloc0returnsnull],
|
2665 | |
[malloc(0) returns NULL (default: auto)]),
|
2666 | |
[MALLOC_ZERO_RETURNS_NULL=$enableval],
|
2667 | |
[MALLOC_ZERO_RETURNS_NULL=auto])
|
2668 | |
|
2669 | |
AC_MSG_CHECKING([whether malloc(0) returns NULL])
|
2670 | |
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
|
2671 | |
AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
|
2672 | |
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
|
2673 | |
#include <stdlib.h>
|
2674 | |
],[
|
2675 | |
char *m0, *r0, *c0, *p;
|
2676 | |
m0 = malloc(0);
|
2677 | |
p = malloc(10);
|
2678 | |
r0 = realloc(p,0);
|
2679 | |
c0 = calloc(0,10);
|
2680 | |
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
|
2681 | |
])],
|
2682 | |
[xorg_cv_malloc0_returns_null=yes],
|
2683 | |
[xorg_cv_malloc0_returns_null=no])])
|
2684 | |
MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
|
2685 | |
fi
|
2686 | |
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
|
2687 | |
|
2688 | |
if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
|
2689 | |
MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
|
2690 | |
XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
|
2691 | |
XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
|
2692 | |
else
|
2693 | |
MALLOC_ZERO_CFLAGS=""
|
2694 | |
XMALLOC_ZERO_CFLAGS=""
|
2695 | |
XTMALLOC_ZERO_CFLAGS=""
|
2696 | |
fi
|
2697 | |
|
2698 | |
AC_SUBST([MALLOC_ZERO_CFLAGS])
|
2699 | |
AC_SUBST([XMALLOC_ZERO_CFLAGS])
|
2700 | |
AC_SUBST([XTMALLOC_ZERO_CFLAGS])
|
2701 | |
]) # XORG_CHECK_MALLOC_ZERO
|
2702 | |
|
2703 | |
# XORG_WITH_LINT()
|
2704 | |
# ----------------
|
2705 | |
# Minimum version: 1.1.0
|
2706 | |
#
|
2707 | |
# This macro enables the use of a tool that flags some suspicious and
|
2708 | |
# non-portable constructs (likely to be bugs) in C language source code.
|
2709 | |
# It will attempt to locate the tool and use appropriate options.
|
2710 | |
# There are various lint type tools on different platforms.
|
2711 | |
#
|
2712 | |
# Interface to module:
|
2713 | |
# LINT: returns the path to the tool found on the platform
|
2714 | |
# or the value set to LINT on the configure cmd line
|
2715 | |
# also an Automake conditional
|
2716 | |
# LINT_FLAGS: an Automake variable with appropriate flags
|
2717 | |
#
|
2718 | |
# --with-lint: 'yes' user instructs the module to use lint
|
2719 | |
# 'no' user instructs the module not to use lint (default)
|
2720 | |
#
|
2721 | |
# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
|
2722 | |
# If the user sets the value of LINT_FLAGS, they are used verbatim.
|
2723 | |
#
|
2724 | |
AC_DEFUN([XORG_WITH_LINT],[
|
2725 | |
|
2726 | |
AC_ARG_VAR([LINT], [Path to a lint-style command])
|
2727 | |
AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
|
2728 | |
AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
|
2729 | |
[Use a lint-style source code checker (default: disabled)])],
|
2730 | |
[use_lint=$withval], [use_lint=no])
|
2731 | |
|
2732 | |
# Obtain platform specific info like program name and options
|
2733 | |
# The lint program on FreeBSD and NetBSD is different from the one on Solaris
|
2734 | |
case $host_os in
|
2735 | |
*linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
|
2736 | |
lint_name=splint
|
2737 | |
lint_options="-badflag"
|
2738 | |
;;
|
2739 | |
*freebsd* | *netbsd*)
|
2740 | |
lint_name=lint
|
2741 | |
lint_options="-u -b"
|
2742 | |
;;
|
2743 | |
*solaris*)
|
2744 | |
lint_name=lint
|
2745 | |
lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
|
2746 | |
;;
|
2747 | |
esac
|
2748 | |
|
2749 | |
# Test for the presence of the program (either guessed by the code or spelled out by the user)
|
2750 | |
if test "x$use_lint" = x"yes" ; then
|
2751 | |
AC_PATH_PROG([LINT], [$lint_name])
|
2752 | |
if test "x$LINT" = "x"; then
|
2753 | |
AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
|
2754 | |
fi
|
2755 | |
elif test "x$use_lint" = x"no" ; then
|
2756 | |
if test "x$LINT" != "x"; then
|
2757 | |
AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
|
2758 | |
fi
|
2759 | |
else
|
2760 | |
AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
|
2761 | |
fi
|
2762 | |
|
2763 | |
# User supplied flags override default flags
|
2764 | |
if test "x$LINT_FLAGS" != "x"; then
|
2765 | |
lint_options=$LINT_FLAGS
|
2766 | |
fi
|
2767 | |
|
2768 | |
AC_SUBST([LINT_FLAGS],[$lint_options])
|
2769 | |
AM_CONDITIONAL(LINT, [test "x$LINT" != x])
|
2770 | |
|
2771 | |
]) # XORG_WITH_LINT
|
2772 | |
|
2773 | |
# XORG_LINT_LIBRARY(LIBNAME)
|
2774 | |
# --------------------------
|
2775 | |
# Minimum version: 1.1.0
|
2776 | |
#
|
2777 | |
# Sets up flags for building lint libraries for checking programs that call
|
2778 | |
# functions in the library.
|
2779 | |
#
|
2780 | |
# Interface to module:
|
2781 | |
# LINTLIB - Automake variable with the name of lint library file to make
|
2782 | |
# MAKE_LINT_LIB - Automake conditional
|
2783 | |
#
|
2784 | |
# --enable-lint-library: - 'yes' user instructs the module to created a lint library
|
2785 | |
# - 'no' user instructs the module not to create a lint library (default)
|
2786 | |
|
2787 | |
AC_DEFUN([XORG_LINT_LIBRARY],[
|
2788 | |
AC_REQUIRE([XORG_WITH_LINT])
|
2789 | |
AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
|
2790 | |
[Create lint library (default: disabled)])],
|
2791 | |
[make_lint_lib=$enableval], [make_lint_lib=no])
|
2792 | |
|
2793 | |
if test "x$make_lint_lib" = x"yes" ; then
|
2794 | |
LINTLIB=llib-l$1.ln
|
2795 | |
if test "x$LINT" = "x"; then
|
2796 | |
AC_MSG_ERROR([Cannot make lint library without --with-lint])
|
2797 | |
fi
|
2798 | |
elif test "x$make_lint_lib" != x"no" ; then
|
2799 | |
AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
|
2800 | |
fi
|
2801 | |
|
2802 | |
AC_SUBST(LINTLIB)
|
2803 | |
AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
|
2804 | |
|
2805 | |
]) # XORG_LINT_LIBRARY
|
2806 | |
|
2807 | |
# XORG_COMPILER_BRAND
|
2808 | |
# -------------------
|
2809 | |
# Minimum version: 1.14.0
|
2810 | |
#
|
2811 | |
# Checks for various brands of compilers and sets flags as appropriate:
|
2812 | |
# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
|
2813 | |
# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
|
2814 | |
# clang compiler - sets CLANGCC to "yes"
|
2815 | |
# Intel compiler - sets INTELCC to "yes"
|
2816 | |
# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
|
2817 | |
#
|
2818 | |
AC_DEFUN([XORG_COMPILER_BRAND], [
|
2819 | |
AC_LANG_CASE(
|
2820 | |
[C], [
|
2821 | |
AC_REQUIRE([AC_PROG_CC_C99])
|
2822 | |
],
|
2823 | |
[C++], [
|
2824 | |
AC_REQUIRE([AC_PROG_CXX])
|
2825 | |
]
|
2826 | |
)
|
2827 | |
AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
|
2828 | |
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
|
2829 | |
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
|
2830 | |
]) # XORG_COMPILER_BRAND
|
2831 | |
|
2832 | |
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
|
2833 | |
# ---------------
|
2834 | |
# Minimum version: 1.16.0
|
2835 | |
#
|
2836 | |
# Test if the compiler works when passed the given flag as a command line argument.
|
2837 | |
# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
|
2838 | |
# next flag in the list until there are no more options.
|
2839 | |
#
|
2840 | |
# Note that this does not guarantee that the compiler supports the flag as some
|
2841 | |
# compilers will simply ignore arguments that they do not understand, but we do
|
2842 | |
# attempt to weed out false positives by using -Werror=unknown-warning-option and
|
2843 | |
# -Werror=unused-command-line-argument
|
2844 | |
#
|
2845 | |
AC_DEFUN([XORG_TESTSET_CFLAG], [
|
2846 | |
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
|
2847 | |
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
|
2848 | |
|
2849 | |
AC_LANG_COMPILER_REQUIRE
|
2850 | |
|
2851 | |
AC_LANG_CASE(
|
2852 | |
[C], [
|
2853 | |
AC_REQUIRE([AC_PROG_CC_C99])
|
2854 | |
define([PREFIX], [C])
|
2855 | |
define([CACHE_PREFIX], [cc])
|
2856 | |
define([COMPILER], [$CC])
|
2857 | |
],
|
2858 | |
[C++], [
|
2859 | |
define([PREFIX], [CXX])
|
2860 | |
define([CACHE_PREFIX], [cxx])
|
2861 | |
define([COMPILER], [$CXX])
|
2862 | |
]
|
2863 | |
)
|
2864 | |
|
2865 | |
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
|
2866 | |
|
2867 | |
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
|
2868 | |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
|
2869 | |
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
|
2870 | |
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
|
2871 | |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
|
2872 | |
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
|
2873 | |
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
|
2874 | |
[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
|
2875 | |
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
|
2876 | |
fi
|
2877 | |
|
2878 | |
if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
|
2879 | |
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
|
2880 | |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
|
2881 | |
fi
|
2882 | |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
|
2883 | |
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
|
2884 | |
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
|
2885 | |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
|
2886 | |
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
|
2887 | |
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
|
2888 | |
[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
|
2889 | |
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
|
2890 | |
fi
|
2891 | |
|
2892 | |
found="no"
|
2893 | |
m4_foreach([flag], m4_cdr($@), [
|
2894 | |
if test $found = "no" ; then
|
2895 | |
if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
|
2896 | |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
|
2897 | |
fi
|
2898 | |
|
2899 | |
if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
|
2900 | |
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
|
2901 | |
fi
|
2902 | |
|
2903 | |
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
|
2904 | |
|
2905 | |
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
|
2906 | |
AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
|
2907 | |
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
|
2908 | |
AC_CACHE_VAL($cacheid,
|
2909 | |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
|
2910 | |
[eval $cacheid=yes],
|
2911 | |
[eval $cacheid=no])])
|
2912 | |
|
2913 | |
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
|
2914 | |
|
2915 | |
eval supported=\$$cacheid
|
2916 | |
AC_MSG_RESULT([$supported])
|
2917 | |
if test "$supported" = "yes" ; then
|
2918 | |
$1="$$1 ]flag["
|
2919 | |
found="yes"
|
2920 | |
fi
|
2921 | |
fi
|
2922 | |
])
|
2923 | |
]) # XORG_TESTSET_CFLAG
|
2924 | |
|
2925 | |
# XORG_COMPILER_FLAGS
|
2926 | |
# ---------------
|
2927 | |
# Minimum version: 1.16.0
|
2928 | |
#
|
2929 | |
# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
|
2930 | |
# arguments supported by the selected compiler which do NOT alter the generated
|
2931 | |
# code. These arguments will cause the compiler to print various warnings
|
2932 | |
# during compilation AND turn a conservative set of warnings into errors.
|
2933 | |
#
|
2934 | |
# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
|
2935 | |
# future versions of util-macros as options are added to new compilers.
|
2936 | |
#
|
2937 | |
AC_DEFUN([XORG_COMPILER_FLAGS], [
|
2938 | |
AC_REQUIRE([XORG_COMPILER_BRAND])
|
2939 | |
|
2940 | |
AC_ARG_ENABLE(selective-werror,
|
2941 | |
AS_HELP_STRING([--disable-selective-werror],
|
2942 | |
[Turn off selective compiler errors. (default: enabled)]),
|
2943 | |
[SELECTIVE_WERROR=$enableval],
|
2944 | |
[SELECTIVE_WERROR=yes])
|
2945 | |
|
2946 | |
AC_LANG_CASE(
|
2947 | |
[C], [
|
2948 | |
define([PREFIX], [C])
|
2949 | |
],
|
2950 | |
[C++], [
|
2951 | |
define([PREFIX], [CXX])
|
2952 | |
]
|
2953 | |
)
|
2954 | |
# -v is too short to test reliably with XORG_TESTSET_CFLAG
|
2955 | |
if test "x$SUNCC" = "xyes"; then
|
2956 | |
[BASE_]PREFIX[FLAGS]="-v"
|
2957 | |
else
|
2958 | |
[BASE_]PREFIX[FLAGS]=""
|
2959 | |
fi
|
2960 | |
|
2961 | |
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
|
2962 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
|
2963 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
|
2964 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
|
2965 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
|
2966 | |
|
2967 | |
AC_LANG_CASE(
|
2968 | |
[C], [
|
2969 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
|
2970 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
|
2971 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
|
2972 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
|
2973 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
|
2974 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
|
2975 | |
]
|
2976 | |
)
|
2977 | |
|
2978 | |
# This chunk adds additional warnings that could catch undesired effects.
|
2979 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
|
2980 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
|
2981 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
|
2982 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
|
2983 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
|
2984 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
|
2985 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
|
2986 | |
|
2987 | |
# These are currently disabled because they are noisy. They will be enabled
|
2988 | |
# in the future once the codebase is sufficiently modernized to silence
|
2989 | |
# them. For now, I don't want them to drown out the other warnings.
|
2990 | |
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
|
2991 | |
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
|
2992 | |
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
|
2993 | |
|
2994 | |
# Turn some warnings into errors, so we don't accidently get successful builds
|
2995 | |
# when there are problems that should be fixed.
|
2996 | |
|
2997 | |
if test "x$SELECTIVE_WERROR" = "xyes" ; then
|
2998 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
|
2999 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
|
3000 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
|
3001 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
|
3002 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
|
3003 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
|
3004 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
|
3005 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
|
3006 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
|
3007 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
|
3008 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
|
3009 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
|
3010 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
|
3011 | |
else
|
3012 | |
AC_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])
|
3013 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
|
3014 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
|
3015 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
|
3016 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
|
3017 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
|
3018 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
|
3019 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
|
3020 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
|
3021 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
|
3022 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
|
3023 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
|
3024 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
|
3025 | |
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
|
3026 | |
fi
|
3027 | |
|
3028 | |
AC_SUBST([BASE_]PREFIX[FLAGS])
|
3029 | |
]) # XORG_COMPILER_FLAGS
|
3030 | |
|
3031 | |
# XORG_CWARNFLAGS
|
3032 | |
# ---------------
|
3033 | |
# Minimum version: 1.2.0
|
3034 | |
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
|
3035 | |
#
|
3036 | |
# Defines CWARNFLAGS to enable C compiler warnings.
|
3037 | |
#
|
3038 | |
# This function is deprecated because it defines -fno-strict-aliasing
|
3039 | |
# which alters the code generated by the compiler. If -fno-strict-aliasing
|
3040 | |
# is needed, then it should be added explicitly in the module when
|
3041 | |
# it is updated to use BASE_CFLAGS.
|
3042 | |
#
|
3043 | |
AC_DEFUN([XORG_CWARNFLAGS], [
|
3044 | |
AC_REQUIRE([XORG_COMPILER_FLAGS])
|
3045 | |
AC_REQUIRE([XORG_COMPILER_BRAND])
|
3046 | |
AC_LANG_CASE(
|
3047 | |
[C], [
|
3048 | |
CWARNFLAGS="$BASE_CFLAGS"
|
3049 | |
if test "x$GCC" = xyes ; then
|
3050 | |
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
|
3051 | |
fi
|
3052 | |
AC_SUBST(CWARNFLAGS)
|
3053 | |
]
|
3054 | |
)
|
3055 | |
]) # XORG_CWARNFLAGS
|
3056 | |
|
3057 | |
# XORG_STRICT_OPTION
|
3058 | |
# -----------------------
|
3059 | |
# Minimum version: 1.3.0
|
3060 | |
#
|
3061 | |
# Add configure option to enable strict compilation flags, such as treating
|
3062 | |
# warnings as fatal errors.
|
3063 | |
# If --enable-strict-compilation is passed to configure, adds strict flags to
|
3064 | |
# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
|
3065 | |
#
|
3066 | |
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
|
3067 | |
# when strict compilation is unconditionally desired.
|
3068 | |
AC_DEFUN([XORG_STRICT_OPTION], [
|
3069 | |
AC_REQUIRE([XORG_CWARNFLAGS])
|
3070 | |
AC_REQUIRE([XORG_COMPILER_FLAGS])
|
3071 | |
|
3072 | |
AC_ARG_ENABLE(strict-compilation,
|
3073 | |
AS_HELP_STRING([--enable-strict-compilation],
|
3074 | |
[Enable all warnings from compiler and make them errors (default: disabled)]),
|
3075 | |
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
|
3076 | |
|
3077 | |
AC_LANG_CASE(
|
3078 | |
[C], [
|
3079 | |
define([PREFIX], [C])
|
3080 | |
],
|
3081 | |
[C++], [
|
3082 | |
define([PREFIX], [CXX])
|
3083 | |
]
|
3084 | |
)
|
3085 | |
|
3086 | |
[STRICT_]PREFIX[FLAGS]=""
|
3087 | |
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
|
3088 | |
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
|
3089 | |
|
3090 | |
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
|
3091 | |
# activate it with -Werror, so we add it here explicitly.
|
3092 | |
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
|
3093 | |
|
3094 | |
if test "x$STRICT_COMPILE" = "xyes"; then
|
3095 | |
[BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
|
3096 | |
AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
|
3097 | |
fi
|
3098 | |
AC_SUBST([STRICT_]PREFIX[FLAGS])
|
3099 | |
AC_SUBST([BASE_]PREFIX[FLAGS])
|
3100 | |
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
|
3101 | |
]) # XORG_STRICT_OPTION
|
3102 | |
|
3103 | |
# XORG_DEFAULT_OPTIONS
|
3104 | |
# --------------------
|
3105 | |
# Minimum version: 1.3.0
|
3106 | |
#
|
3107 | |
# Defines default options for X.Org modules.
|
3108 | |
#
|
3109 | |
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
|
3110 | |
AC_REQUIRE([AC_PROG_INSTALL])
|
3111 | |
XORG_COMPILER_FLAGS
|
3112 | |
XORG_CWARNFLAGS
|
3113 | |
XORG_STRICT_OPTION
|
3114 | |
XORG_RELEASE_VERSION
|
3115 | |
XORG_CHANGELOG
|
3116 | |
XORG_INSTALL
|
3117 | |
XORG_MANPAGE_SECTIONS
|
3118 | |
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
|
3119 | |
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
|
3120 | |
]) # XORG_DEFAULT_OPTIONS
|
3121 | |
|
3122 | |
# XORG_INSTALL()
|
3123 | |
# ----------------
|
3124 | |
# Minimum version: 1.4.0
|
3125 | |
#
|
3126 | |
# Defines the variable INSTALL_CMD as the command to copy
|
3127 | |
# INSTALL from $prefix/share/util-macros.
|
3128 | |
#
|
3129 | |
AC_DEFUN([XORG_INSTALL], [
|
3130 | |
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
3131 | |
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
|
3132 | |
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
|
3133 | |
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
|
3134 | |
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
|
3135 | |
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
|
3136 | |
AC_SUBST([INSTALL_CMD])
|
3137 | |
]) # XORG_INSTALL
|
3138 | |
dnl Copyright 2005 Red Hat, Inc
|
3139 | |
dnl
|
3140 | |
dnl Permission to use, copy, modify, distribute, and sell this software and its
|
3141 | |
dnl documentation for any purpose is hereby granted without fee, provided that
|
3142 | |
dnl the above copyright notice appear in all copies and that both that
|
3143 | |
dnl copyright notice and this permission notice appear in supporting
|
3144 | |
dnl documentation.
|
3145 | |
dnl
|
3146 | |
dnl The above copyright notice and this permission notice shall be included
|
3147 | |
dnl in all copies or substantial portions of the Software.
|
3148 | |
dnl
|
3149 | |
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
3150 | |
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
3151 | |
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
3152 | |
dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
3153 | |
dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
3154 | |
dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
3155 | |
dnl OTHER DEALINGS IN THE SOFTWARE.
|
3156 | |
dnl
|
3157 | |
dnl Except as contained in this notice, the name of the copyright holders shall
|
3158 | |
dnl not be used in advertising or otherwise to promote the sale, use or
|
3159 | |
dnl other dealings in this Software without prior written authorization
|
3160 | |
dnl from the copyright holders.
|
3161 | |
dnl
|
3162 | |
|
3163 | |
# XORG_RELEASE_VERSION
|
3164 | |
# --------------------
|
3165 | |
# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
|
3166 | |
|
3167 | |
AC_DEFUN([XORG_RELEASE_VERSION],[
|
3168 | |
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
|
3169 | |
[`echo $PACKAGE_VERSION | cut -d . -f 1`],
|
3170 | |
[Major version of this package])
|
3171 | |
PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
|
3172 | |
if test "x$PVM" = "x"; then
|
3173 | |
PVM="0"
|
3174 | |
fi
|
3175 | |
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
|
3176 | |
[$PVM],
|
3177 | |
[Minor version of this package])
|
3178 | |
PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
|
3179 | |
if test "x$PVP" = "x"; then
|
3180 | |
PVP="0"
|
3181 | |
fi
|
3182 | |
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
|
3183 | |
[$PVP],
|
3184 | |
[Patch version of this package])
|
3185 | |
])
|
3186 | |
|
3187 | |
# XORG_CHANGELOG()
|
3188 | |
# ----------------
|
3189 | |
# Minimum version: 1.2.0
|
3190 | |
#
|
3191 | |
# Defines the variable CHANGELOG_CMD as the command to generate
|
3192 | |
# ChangeLog from git.
|
3193 | |
#
|
3194 | |
#
|
3195 | |
AC_DEFUN([XORG_CHANGELOG], [
|
3196 | |
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
|
3197 | |
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
|
3198 | |
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
|
3199 | |
echo 'git directory not found: installing possibly empty changelog.' >&2)"
|
3200 | |
AC_SUBST([CHANGELOG_CMD])
|
3201 | |
]) # XORG_CHANGELOG
|
3202 | |
|