1428d7b3dSmrg# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
2428d7b3dSmrg
3428d7b3dSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4428d7b3dSmrg
5428d7b3dSmrg# This file is free software; the Free Software Foundation
6428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
7428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
8428d7b3dSmrg
9428d7b3dSmrg# This program is distributed in the hope that it will be useful,
10428d7b3dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11428d7b3dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12428d7b3dSmrg# PARTICULAR PURPOSE.
13428d7b3dSmrg
14428d7b3dSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15428d7b3dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16428d7b3dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17428d7b3dSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18428d7b3dSmrg[m4_warning([this file was generated for autoconf 2.69.
19428d7b3dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20428d7b3dSmrgIf you have problems, you may need to regenerate the build system entirely.
21428d7b3dSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22428d7b3dSmrg
23428d7b3dSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
24428d7b3dSmrg# serial 1 (pkg-config-0.24)
25428d7b3dSmrg# 
26428d7b3dSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
27428d7b3dSmrg#
28428d7b3dSmrg# This program is free software; you can redistribute it and/or modify
29428d7b3dSmrg# it under the terms of the GNU General Public License as published by
30428d7b3dSmrg# the Free Software Foundation; either version 2 of the License, or
31428d7b3dSmrg# (at your option) any later version.
32428d7b3dSmrg#
33428d7b3dSmrg# This program is distributed in the hope that it will be useful, but
34428d7b3dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
35428d7b3dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36428d7b3dSmrg# General Public License for more details.
37428d7b3dSmrg#
38428d7b3dSmrg# You should have received a copy of the GNU General Public License
39428d7b3dSmrg# along with this program; if not, write to the Free Software
40428d7b3dSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41428d7b3dSmrg#
42428d7b3dSmrg# As a special exception to the GNU General Public License, if you
43428d7b3dSmrg# distribute this file as part of a program that contains a
44428d7b3dSmrg# configuration script generated by Autoconf, you may include it under
45428d7b3dSmrg# the same distribution terms that you use for the rest of that program.
46428d7b3dSmrg
47428d7b3dSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
48428d7b3dSmrg# ----------------------------------
49428d7b3dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
50428d7b3dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
51428d7b3dSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
52428d7b3dSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
53428d7b3dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
54428d7b3dSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
55428d7b3dSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
56428d7b3dSmrg
57428d7b3dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
58428d7b3dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
59428d7b3dSmrgfi
60428d7b3dSmrgif test -n "$PKG_CONFIG"; then
61428d7b3dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
62428d7b3dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
63428d7b3dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
64428d7b3dSmrg		AC_MSG_RESULT([yes])
65428d7b3dSmrg	else
66428d7b3dSmrg		AC_MSG_RESULT([no])
67428d7b3dSmrg		PKG_CONFIG=""
68428d7b3dSmrg	fi
69428d7b3dSmrgfi[]dnl
70428d7b3dSmrg])# PKG_PROG_PKG_CONFIG
71428d7b3dSmrg
72428d7b3dSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
73428d7b3dSmrg#
74428d7b3dSmrg# Check to see whether a particular set of modules exists.  Similar
75428d7b3dSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
76428d7b3dSmrg#
77428d7b3dSmrg# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
78428d7b3dSmrg# only at the first occurence in configure.ac, so if the first place
79428d7b3dSmrg# it's called might be skipped (such as if it is within an "if", you
80428d7b3dSmrg# have to call PKG_CHECK_EXISTS manually
81428d7b3dSmrg# --------------------------------------------------------------
82428d7b3dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
83428d7b3dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
84428d7b3dSmrgif test -n "$PKG_CONFIG" && \
85428d7b3dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
86428d7b3dSmrg  m4_default([$2], [:])
87428d7b3dSmrgm4_ifvaln([$3], [else
88428d7b3dSmrg  $3])dnl
89428d7b3dSmrgfi])
90428d7b3dSmrg
91428d7b3dSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
92428d7b3dSmrg# ---------------------------------------------
93428d7b3dSmrgm4_define([_PKG_CONFIG],
94428d7b3dSmrg[if test -n "$$1"; then
95428d7b3dSmrg    pkg_cv_[]$1="$$1"
96428d7b3dSmrg elif test -n "$PKG_CONFIG"; then
97428d7b3dSmrg    PKG_CHECK_EXISTS([$3],
98428d7b3dSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
99428d7b3dSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
100428d7b3dSmrg		     [pkg_failed=yes])
101428d7b3dSmrg else
102428d7b3dSmrg    pkg_failed=untried
103428d7b3dSmrgfi[]dnl
104428d7b3dSmrg])# _PKG_CONFIG
105428d7b3dSmrg
106428d7b3dSmrg# _PKG_SHORT_ERRORS_SUPPORTED
107428d7b3dSmrg# -----------------------------
108428d7b3dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
109428d7b3dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110428d7b3dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
111428d7b3dSmrg        _pkg_short_errors_supported=yes
112428d7b3dSmrgelse
113428d7b3dSmrg        _pkg_short_errors_supported=no
114428d7b3dSmrgfi[]dnl
115428d7b3dSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
116428d7b3dSmrg
117428d7b3dSmrg
118428d7b3dSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
119428d7b3dSmrg# [ACTION-IF-NOT-FOUND])
120428d7b3dSmrg#
121428d7b3dSmrg#
122428d7b3dSmrg# Note that if there is a possibility the first call to
123428d7b3dSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
124428d7b3dSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
125428d7b3dSmrg#
126428d7b3dSmrg#
127428d7b3dSmrg# --------------------------------------------------------------
128428d7b3dSmrgAC_DEFUN([PKG_CHECK_MODULES],
129428d7b3dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
130428d7b3dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
131428d7b3dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
132428d7b3dSmrg
133428d7b3dSmrgpkg_failed=no
134428d7b3dSmrgAC_MSG_CHECKING([for $1])
135428d7b3dSmrg
136428d7b3dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
137428d7b3dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138428d7b3dSmrg
139428d7b3dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
140428d7b3dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
141428d7b3dSmrgSee the pkg-config man page for more details.])
142428d7b3dSmrg
143428d7b3dSmrgif test $pkg_failed = yes; then
144428d7b3dSmrg   	AC_MSG_RESULT([no])
145428d7b3dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
146428d7b3dSmrg        if test $_pkg_short_errors_supported = yes; then
147428d7b3dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
148428d7b3dSmrg        else 
149428d7b3dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
150428d7b3dSmrg        fi
151428d7b3dSmrg	# Put the nasty error message in config.log where it belongs
152428d7b3dSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
153428d7b3dSmrg
154428d7b3dSmrg	m4_default([$4], [AC_MSG_ERROR(
155428d7b3dSmrg[Package requirements ($2) were not met:
156428d7b3dSmrg
157428d7b3dSmrg$$1_PKG_ERRORS
158428d7b3dSmrg
159428d7b3dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
160428d7b3dSmrginstalled software in a non-standard prefix.
161428d7b3dSmrg
162428d7b3dSmrg_PKG_TEXT])[]dnl
163428d7b3dSmrg        ])
164428d7b3dSmrgelif test $pkg_failed = untried; then
165428d7b3dSmrg     	AC_MSG_RESULT([no])
166428d7b3dSmrg	m4_default([$4], [AC_MSG_FAILURE(
167428d7b3dSmrg[The pkg-config script could not be found or is too old.  Make sure it
168428d7b3dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
169428d7b3dSmrgpath to pkg-config.
170428d7b3dSmrg
171428d7b3dSmrg_PKG_TEXT
172428d7b3dSmrg
173428d7b3dSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
174428d7b3dSmrg        ])
175428d7b3dSmrgelse
176428d7b3dSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
177428d7b3dSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
178428d7b3dSmrg        AC_MSG_RESULT([yes])
179428d7b3dSmrg	$3
180428d7b3dSmrgfi[]dnl
181428d7b3dSmrg])# PKG_CHECK_MODULES
182428d7b3dSmrg
183428d7b3dSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
184428d7b3dSmrgdnl
185428d7b3dSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
186428d7b3dSmrgdnl 
187428d7b3dSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
188428d7b3dSmrgdnl copy of this software and associated documentation files (the "Software"),
189428d7b3dSmrgdnl to deal in the Software without restriction, including without limitation
190428d7b3dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
191428d7b3dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
192428d7b3dSmrgdnl Software is furnished to do so, subject to the following conditions:
193428d7b3dSmrgdnl
194428d7b3dSmrgdnl The above copyright notice and this permission notice (including the next
195428d7b3dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
196428d7b3dSmrgdnl Software.
197428d7b3dSmrgdnl
198428d7b3dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
199428d7b3dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
200428d7b3dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
201428d7b3dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
202428d7b3dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
203428d7b3dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
204428d7b3dSmrgdnl DEALINGS IN THE SOFTWARE.
205428d7b3dSmrg
206428d7b3dSmrg# XORG_MACROS_VERSION(required-version)
207428d7b3dSmrg# -------------------------------------
208428d7b3dSmrg# Minimum version: 1.1.0
209428d7b3dSmrg#
210428d7b3dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
211428d7b3dSmrg# your configure.ac with the minimum required version, such as:
212428d7b3dSmrg# XORG_MACROS_VERSION(1.1)
213428d7b3dSmrg#
214428d7b3dSmrg# To ensure that this macro is defined, also add:
215428d7b3dSmrg# m4_ifndef([XORG_MACROS_VERSION],
216428d7b3dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
217428d7b3dSmrg#
218428d7b3dSmrg#
219428d7b3dSmrg# See the "minimum version" comment for each macro you use to see what 
220428d7b3dSmrg# version you require.
221428d7b3dSmrgm4_defun([XORG_MACROS_VERSION],[
222428d7b3dSmrgm4_define([vers_have], [1.17])
223428d7b3dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
224428d7b3dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
225428d7b3dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
226428d7b3dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
227428d7b3dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
228428d7b3dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
229428d7b3dSmrgm4_undefine([vers_have])
230428d7b3dSmrgm4_undefine([maj_have])
231428d7b3dSmrgm4_undefine([maj_needed])
232428d7b3dSmrg]) # XORG_MACROS_VERSION
233428d7b3dSmrg
234428d7b3dSmrg# XORG_PROG_RAWCPP()
235428d7b3dSmrg# ------------------
236428d7b3dSmrg# Minimum version: 1.0.0
237428d7b3dSmrg#
238428d7b3dSmrg# Find cpp program and necessary flags for use in pre-processing text files
239428d7b3dSmrg# such as man pages and config files
240428d7b3dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
241428d7b3dSmrgAC_REQUIRE([AC_PROG_CPP])
242428d7b3dSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
243428d7b3dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
244428d7b3dSmrg
245428d7b3dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
246428d7b3dSmrg# which is not the best choice for supporting other OS'es, but covers most
247428d7b3dSmrg# of the ones we need for now.
248428d7b3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
249428d7b3dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
250428d7b3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
251428d7b3dSmrg	AC_MSG_RESULT([no])
252428d7b3dSmrgelse
253428d7b3dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
254428d7b3dSmrg		RAWCPPFLAGS=-undef
255428d7b3dSmrg		AC_MSG_RESULT([yes])
256428d7b3dSmrg	# under Cygwin unix is still defined even with -undef
257428d7b3dSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
258428d7b3dSmrg		RAWCPPFLAGS="-undef -ansi"
259428d7b3dSmrg		AC_MSG_RESULT([yes, with -ansi])
260428d7b3dSmrg	else
261428d7b3dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
262428d7b3dSmrg	fi
263428d7b3dSmrgfi
264428d7b3dSmrgrm -f conftest.$ac_ext
265428d7b3dSmrg
266428d7b3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
267428d7b3dSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
268428d7b3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
269428d7b3dSmrg	AC_MSG_RESULT([no])
270428d7b3dSmrgelse
271428d7b3dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
272428d7b3dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
273428d7b3dSmrg		AC_MSG_RESULT([yes])
274428d7b3dSmrg	else
275428d7b3dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
276428d7b3dSmrg	fi
277428d7b3dSmrgfi
278428d7b3dSmrgrm -f conftest.$ac_ext
279428d7b3dSmrgAC_SUBST(RAWCPPFLAGS)
280428d7b3dSmrg]) # XORG_PROG_RAWCPP
281428d7b3dSmrg
282428d7b3dSmrg# XORG_MANPAGE_SECTIONS()
283428d7b3dSmrg# -----------------------
284428d7b3dSmrg# Minimum version: 1.0.0
285428d7b3dSmrg#
286428d7b3dSmrg# Determine which sections man pages go in for the different man page types
287428d7b3dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
288428d7b3dSmrg# Not sure if there's any better way than just hardcoding by OS name.
289428d7b3dSmrg# Override default settings by setting environment variables
290428d7b3dSmrg# Added MAN_SUBSTS in version 1.8
291428d7b3dSmrg# Added AC_PROG_SED in version 1.8
292428d7b3dSmrg
293428d7b3dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
294428d7b3dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
295428d7b3dSmrgAC_REQUIRE([AC_PROG_SED])
296428d7b3dSmrg
297428d7b3dSmrgif test x$APP_MAN_SUFFIX = x    ; then
298428d7b3dSmrg    APP_MAN_SUFFIX=1
299428d7b3dSmrgfi
300428d7b3dSmrgif test x$APP_MAN_DIR = x    ; then
301428d7b3dSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
302428d7b3dSmrgfi
303428d7b3dSmrg
304428d7b3dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
305428d7b3dSmrg    LIB_MAN_SUFFIX=3
306428d7b3dSmrgfi
307428d7b3dSmrgif test x$LIB_MAN_DIR = x    ; then
308428d7b3dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
309428d7b3dSmrgfi
310428d7b3dSmrg
311428d7b3dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
312428d7b3dSmrg    case $host_os in
313428d7b3dSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
314428d7b3dSmrg	*)		FILE_MAN_SUFFIX=5  ;;
315428d7b3dSmrg    esac
316428d7b3dSmrgfi
317428d7b3dSmrgif test x$FILE_MAN_DIR = x    ; then
318428d7b3dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
319428d7b3dSmrgfi
320428d7b3dSmrg
321428d7b3dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
322428d7b3dSmrg    case $host_os in
323428d7b3dSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
324428d7b3dSmrg	*)		MISC_MAN_SUFFIX=7  ;;
325428d7b3dSmrg    esac
326428d7b3dSmrgfi
327428d7b3dSmrgif test x$MISC_MAN_DIR = x    ; then
328428d7b3dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
329428d7b3dSmrgfi
330428d7b3dSmrg
331428d7b3dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
332428d7b3dSmrg    case $host_os in
333428d7b3dSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
334428d7b3dSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
335428d7b3dSmrg    esac
336428d7b3dSmrgfi
337428d7b3dSmrgif test x$DRIVER_MAN_DIR = x    ; then
338428d7b3dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
339428d7b3dSmrgfi
340428d7b3dSmrg
341428d7b3dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
342428d7b3dSmrg    case $host_os in
343428d7b3dSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
344428d7b3dSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
345428d7b3dSmrg    esac
346428d7b3dSmrgfi
347428d7b3dSmrgif test x$ADMIN_MAN_DIR = x    ; then
348428d7b3dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
349428d7b3dSmrgfi
350428d7b3dSmrg
351428d7b3dSmrg
352428d7b3dSmrgAC_SUBST([APP_MAN_SUFFIX])
353428d7b3dSmrgAC_SUBST([LIB_MAN_SUFFIX])
354428d7b3dSmrgAC_SUBST([FILE_MAN_SUFFIX])
355428d7b3dSmrgAC_SUBST([MISC_MAN_SUFFIX])
356428d7b3dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
357428d7b3dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
358428d7b3dSmrgAC_SUBST([APP_MAN_DIR])
359428d7b3dSmrgAC_SUBST([LIB_MAN_DIR])
360428d7b3dSmrgAC_SUBST([FILE_MAN_DIR])
361428d7b3dSmrgAC_SUBST([MISC_MAN_DIR])
362428d7b3dSmrgAC_SUBST([DRIVER_MAN_DIR])
363428d7b3dSmrgAC_SUBST([ADMIN_MAN_DIR])
364428d7b3dSmrg
365428d7b3dSmrgXORG_MAN_PAGE="X Version 11"
366428d7b3dSmrgAC_SUBST([XORG_MAN_PAGE])
367428d7b3dSmrgMAN_SUBSTS="\
368428d7b3dSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
369428d7b3dSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
370428d7b3dSmrg	-e 's|__xservername__|Xorg|g' \
371428d7b3dSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
372428d7b3dSmrg	-e 's|__projectroot__|\$(prefix)|g' \
373428d7b3dSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
374428d7b3dSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
375428d7b3dSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
376428d7b3dSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
377428d7b3dSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
378428d7b3dSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
379428d7b3dSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
380428d7b3dSmrgAC_SUBST([MAN_SUBSTS])
381428d7b3dSmrg
382428d7b3dSmrg]) # XORG_MANPAGE_SECTIONS
383428d7b3dSmrg
384428d7b3dSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
385428d7b3dSmrg# ------------------------
386428d7b3dSmrg# Minimum version: 1.7.0
387428d7b3dSmrg#
388428d7b3dSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
389428d7b3dSmrg# provided by xorg-sgml-doctools, if installed.
390428d7b3dSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
391428d7b3dSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
392428d7b3dSmrgXORG_SGML_PATH=
393428d7b3dSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
394428d7b3dSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
395428d7b3dSmrg    [m4_ifval([$1],[:],
396428d7b3dSmrg        [if test x"$cross_compiling" != x"yes" ; then
397428d7b3dSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
398428d7b3dSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
399428d7b3dSmrg         fi])
400428d7b3dSmrg    ])
401428d7b3dSmrg
402428d7b3dSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
403428d7b3dSmrg# the path and the name of the doc stylesheet
404428d7b3dSmrgif test "x$XORG_SGML_PATH" != "x" ; then
405428d7b3dSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
406428d7b3dSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
407428d7b3dSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
408428d7b3dSmrgelse
409428d7b3dSmrg   AC_MSG_RESULT([no])
410428d7b3dSmrgfi
411428d7b3dSmrg
412428d7b3dSmrgAC_SUBST(XORG_SGML_PATH)
413428d7b3dSmrgAC_SUBST(STYLESHEET_SRCDIR)
414428d7b3dSmrgAC_SUBST(XSL_STYLESHEET)
415428d7b3dSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
416428d7b3dSmrg]) # XORG_CHECK_SGML_DOCTOOLS
417428d7b3dSmrg
418428d7b3dSmrg# XORG_CHECK_LINUXDOC
419428d7b3dSmrg# -------------------
420428d7b3dSmrg# Minimum version: 1.0.0
421428d7b3dSmrg#
422428d7b3dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
423428d7b3dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
424428d7b3dSmrg# Whether or not the necessary tools and files are found can be checked
425428d7b3dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
426428d7b3dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
427428d7b3dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
428428d7b3dSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
429428d7b3dSmrg
430428d7b3dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
431428d7b3dSmrg
432428d7b3dSmrgAC_MSG_CHECKING([whether to build documentation])
433428d7b3dSmrg
434428d7b3dSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
435428d7b3dSmrg   BUILDDOC=yes
436428d7b3dSmrgelse
437428d7b3dSmrg   BUILDDOC=no
438428d7b3dSmrgfi
439428d7b3dSmrg
440428d7b3dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
441428d7b3dSmrg
442428d7b3dSmrgAC_MSG_RESULT([$BUILDDOC])
443428d7b3dSmrg
444428d7b3dSmrgAC_MSG_CHECKING([whether to build pdf documentation])
445428d7b3dSmrg
446428d7b3dSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
447428d7b3dSmrg   BUILDPDFDOC=yes
448428d7b3dSmrgelse
449428d7b3dSmrg   BUILDPDFDOC=no
450428d7b3dSmrgfi
451428d7b3dSmrg
452428d7b3dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
453428d7b3dSmrg
454428d7b3dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
455428d7b3dSmrg
456428d7b3dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
457428d7b3dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
458428d7b3dSmrgMAKE_PDF="$PS2PDF"
459428d7b3dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
460428d7b3dSmrg
461428d7b3dSmrgAC_SUBST(MAKE_TEXT)
462428d7b3dSmrgAC_SUBST(MAKE_PS)
463428d7b3dSmrgAC_SUBST(MAKE_PDF)
464428d7b3dSmrgAC_SUBST(MAKE_HTML)
465428d7b3dSmrg]) # XORG_CHECK_LINUXDOC
466428d7b3dSmrg
467428d7b3dSmrg# XORG_CHECK_DOCBOOK
468428d7b3dSmrg# -------------------
469428d7b3dSmrg# Minimum version: 1.0.0
470428d7b3dSmrg#
471428d7b3dSmrg# Checks for the ability to build output formats from SGML DocBook source.
472428d7b3dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
473428d7b3dSmrg# indicates whether the necessary tools and files are found and, if set,
474428d7b3dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
475428d7b3dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
476428d7b3dSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
477428d7b3dSmrg
478428d7b3dSmrgBUILDTXTDOC=no
479428d7b3dSmrgBUILDPDFDOC=no
480428d7b3dSmrgBUILDPSDOC=no
481428d7b3dSmrgBUILDHTMLDOC=no
482428d7b3dSmrg
483428d7b3dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
484428d7b3dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
485428d7b3dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
486428d7b3dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
487428d7b3dSmrg
488428d7b3dSmrgAC_MSG_CHECKING([whether to build text documentation])
489428d7b3dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
490428d7b3dSmrg   test x$BUILD_TXTDOC != xno; then
491428d7b3dSmrg	BUILDTXTDOC=yes
492428d7b3dSmrgfi
493428d7b3dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
494428d7b3dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
495428d7b3dSmrg
496428d7b3dSmrgAC_MSG_CHECKING([whether to build PDF documentation])
497428d7b3dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
498428d7b3dSmrg   test x$BUILD_PDFDOC != xno; then
499428d7b3dSmrg	BUILDPDFDOC=yes
500428d7b3dSmrgfi
501428d7b3dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
502428d7b3dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
503428d7b3dSmrg
504428d7b3dSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
505428d7b3dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
506428d7b3dSmrg   test x$BUILD_PSDOC != xno; then
507428d7b3dSmrg	BUILDPSDOC=yes
508428d7b3dSmrgfi
509428d7b3dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
510428d7b3dSmrgAC_MSG_RESULT([$BUILDPSDOC])
511428d7b3dSmrg
512428d7b3dSmrgAC_MSG_CHECKING([whether to build HTML documentation])
513428d7b3dSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
514428d7b3dSmrg   test x$BUILD_HTMLDOC != xno; then
515428d7b3dSmrg	BUILDHTMLDOC=yes
516428d7b3dSmrgfi
517428d7b3dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
518428d7b3dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
519428d7b3dSmrg
520428d7b3dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
521428d7b3dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
522428d7b3dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
523428d7b3dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
524428d7b3dSmrg
525428d7b3dSmrgAC_SUBST(MAKE_TEXT)
526428d7b3dSmrgAC_SUBST(MAKE_PS)
527428d7b3dSmrgAC_SUBST(MAKE_PDF)
528428d7b3dSmrgAC_SUBST(MAKE_HTML)
529428d7b3dSmrg]) # XORG_CHECK_DOCBOOK
530428d7b3dSmrg
531428d7b3dSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
532428d7b3dSmrg# ----------------
533428d7b3dSmrg# Minimum version: 1.5.0
534428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
535428d7b3dSmrg#
536428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
537428d7b3dSmrg# not at the appropriate level. This macro enables a module to test for the
538428d7b3dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
539428d7b3dSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
540428d7b3dSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
541428d7b3dSmrg# --with-xmlto assumes 'auto'.
542428d7b3dSmrg#
543428d7b3dSmrg# Interface to module:
544428d7b3dSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
545428d7b3dSmrg# XMLTO:	returns the path of the xmlto program found
546428d7b3dSmrg#		returns the path set by the user in the environment
547428d7b3dSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
548428d7b3dSmrg#		'no' user instructs the module not to use xmlto
549428d7b3dSmrg#
550428d7b3dSmrg# Added in version 1.10.0
551428d7b3dSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
552428d7b3dSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
553428d7b3dSmrg#
554428d7b3dSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
555428d7b3dSmrg#
556428d7b3dSmrgAC_DEFUN([XORG_WITH_XMLTO],[
557428d7b3dSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
558428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
559428d7b3dSmrgAC_ARG_WITH(xmlto,
560428d7b3dSmrg	AS_HELP_STRING([--with-xmlto],
561428d7b3dSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
562428d7b3dSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
563428d7b3dSmrgm4_undefine([_defopt])
564428d7b3dSmrg
565428d7b3dSmrgif test "x$use_xmlto" = x"auto"; then
566428d7b3dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
567428d7b3dSmrg   if test "x$XMLTO" = "x"; then
568428d7b3dSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
569428d7b3dSmrg	have_xmlto=no
570428d7b3dSmrg   else
571428d7b3dSmrg        have_xmlto=yes
572428d7b3dSmrg   fi
573428d7b3dSmrgelif test "x$use_xmlto" = x"yes" ; then
574428d7b3dSmrg   AC_PATH_PROG([XMLTO], [xmlto])
575428d7b3dSmrg   if test "x$XMLTO" = "x"; then
576428d7b3dSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
577428d7b3dSmrg   fi
578428d7b3dSmrg   have_xmlto=yes
579428d7b3dSmrgelif test "x$use_xmlto" = x"no" ; then
580428d7b3dSmrg   if test "x$XMLTO" != "x"; then
581428d7b3dSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
582428d7b3dSmrg   fi
583428d7b3dSmrg   have_xmlto=no
584428d7b3dSmrgelse
585428d7b3dSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
586428d7b3dSmrgfi
587428d7b3dSmrg
588428d7b3dSmrg# Test for a minimum version of xmlto, if provided.
589428d7b3dSmrgm4_ifval([$1],
590428d7b3dSmrg[if test "$have_xmlto" = yes; then
591428d7b3dSmrg    # scrape the xmlto version
592428d7b3dSmrg    AC_MSG_CHECKING([the xmlto version])
593428d7b3dSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
594428d7b3dSmrg    AC_MSG_RESULT([$xmlto_version])
595428d7b3dSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
596428d7b3dSmrg        [if test "x$use_xmlto" = xauto; then
597428d7b3dSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
598428d7b3dSmrg            have_xmlto=no
599428d7b3dSmrg        else
600428d7b3dSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
601428d7b3dSmrg        fi])
602428d7b3dSmrgfi])
603428d7b3dSmrg
604428d7b3dSmrg# Test for the ability of xmlto to generate a text target
605428d7b3dSmrghave_xmlto_text=no
606428d7b3dSmrgcat > conftest.xml << "EOF"
607428d7b3dSmrgEOF
608428d7b3dSmrgAS_IF([test "$have_xmlto" = yes],
609428d7b3dSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
610428d7b3dSmrg             [have_xmlto_text=yes],
611428d7b3dSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
612428d7b3dSmrgrm -f conftest.xml
613428d7b3dSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
614428d7b3dSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
615428d7b3dSmrg]) # XORG_WITH_XMLTO
616428d7b3dSmrg
617428d7b3dSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
618428d7b3dSmrg# --------------------------------------------
619428d7b3dSmrg# Minimum version: 1.12.0
620428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.12.0
621428d7b3dSmrg#
622428d7b3dSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
623428d7b3dSmrg# XML-based language used for the transformation of XML documents.
624428d7b3dSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
625428d7b3dSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
626428d7b3dSmrg# The XSLT processor is often used as a standalone tool for transformations.
627428d7b3dSmrg# It should not be assumed that this tool is used only to work with documnetation.
628428d7b3dSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
629428d7b3dSmrg#
630428d7b3dSmrg# Interface to module:
631428d7b3dSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
632428d7b3dSmrg# XSLTPROC:	 returns the path of the xsltproc program found
633428d7b3dSmrg#		 returns the path set by the user in the environment
634428d7b3dSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
635428d7b3dSmrg#		  'no' user instructs the module not to use xsltproc
636428d7b3dSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
637428d7b3dSmrg#
638428d7b3dSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
639428d7b3dSmrg#
640428d7b3dSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
641428d7b3dSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
642428d7b3dSmrg# Preserves the interface, should it be implemented later
643428d7b3dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
644428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
645428d7b3dSmrgAC_ARG_WITH(xsltproc,
646428d7b3dSmrg	AS_HELP_STRING([--with-xsltproc],
647428d7b3dSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
648428d7b3dSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
649428d7b3dSmrgm4_undefine([_defopt])
650428d7b3dSmrg
651428d7b3dSmrgif test "x$use_xsltproc" = x"auto"; then
652428d7b3dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
653428d7b3dSmrg   if test "x$XSLTPROC" = "x"; then
654428d7b3dSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
655428d7b3dSmrg	have_xsltproc=no
656428d7b3dSmrg   else
657428d7b3dSmrg        have_xsltproc=yes
658428d7b3dSmrg   fi
659428d7b3dSmrgelif test "x$use_xsltproc" = x"yes" ; then
660428d7b3dSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
661428d7b3dSmrg   if test "x$XSLTPROC" = "x"; then
662428d7b3dSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
663428d7b3dSmrg   fi
664428d7b3dSmrg   have_xsltproc=yes
665428d7b3dSmrgelif test "x$use_xsltproc" = x"no" ; then
666428d7b3dSmrg   if test "x$XSLTPROC" != "x"; then
667428d7b3dSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
668428d7b3dSmrg   fi
669428d7b3dSmrg   have_xsltproc=no
670428d7b3dSmrgelse
671428d7b3dSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
672428d7b3dSmrgfi
673428d7b3dSmrg
674428d7b3dSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
675428d7b3dSmrg]) # XORG_WITH_XSLTPROC
676428d7b3dSmrg
677428d7b3dSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
678428d7b3dSmrg# ----------------------------------------
679428d7b3dSmrg# Minimum version: 1.15.0
680428d7b3dSmrg#
681428d7b3dSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
682428d7b3dSmrg# scanning arbitrary text files, extracting information from those text files,
683428d7b3dSmrg# and printing reports based on that information.
684428d7b3dSmrg#
685428d7b3dSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
686428d7b3dSmrg#
687428d7b3dSmrg# Interface to module:
688428d7b3dSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
689428d7b3dSmrg# PERL:	     returns the path of the perl program found
690428d7b3dSmrg#	     returns the path set by the user in the environment
691428d7b3dSmrg# --with-perl: 'yes' user instructs the module to use perl
692428d7b3dSmrg#	       'no' user instructs the module not to use perl
693428d7b3dSmrg# have_perl: returns yes if perl found in PATH or no
694428d7b3dSmrg#
695428d7b3dSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
696428d7b3dSmrg#
697428d7b3dSmrgAC_DEFUN([XORG_WITH_PERL],[
698428d7b3dSmrgAC_ARG_VAR([PERL], [Path to perl command])
699428d7b3dSmrg# Preserves the interface, should it be implemented later
700428d7b3dSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
701428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
702428d7b3dSmrgAC_ARG_WITH(perl,
703428d7b3dSmrg	AS_HELP_STRING([--with-perl],
704428d7b3dSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
705428d7b3dSmrg	   [use_perl=$withval], [use_perl=]_defopt)
706428d7b3dSmrgm4_undefine([_defopt])
707428d7b3dSmrg
708428d7b3dSmrgif test "x$use_perl" = x"auto"; then
709428d7b3dSmrg   AC_PATH_PROG([PERL], [perl])
710428d7b3dSmrg   if test "x$PERL" = "x"; then
711428d7b3dSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
712428d7b3dSmrg	have_perl=no
713428d7b3dSmrg   else
714428d7b3dSmrg        have_perl=yes
715428d7b3dSmrg   fi
716428d7b3dSmrgelif test "x$use_perl" = x"yes" ; then
717428d7b3dSmrg   AC_PATH_PROG([PERL], [perl])
718428d7b3dSmrg   if test "x$PERL" = "x"; then
719428d7b3dSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
720428d7b3dSmrg   fi
721428d7b3dSmrg   have_perl=yes
722428d7b3dSmrgelif test "x$use_perl" = x"no" ; then
723428d7b3dSmrg   if test "x$PERL" != "x"; then
724428d7b3dSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
725428d7b3dSmrg   fi
726428d7b3dSmrg   have_perl=no
727428d7b3dSmrgelse
728428d7b3dSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
729428d7b3dSmrgfi
730428d7b3dSmrg
731428d7b3dSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
732428d7b3dSmrg]) # XORG_WITH_PERL
733428d7b3dSmrg
734428d7b3dSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
735428d7b3dSmrg# ----------------
736428d7b3dSmrg# Minimum version: 1.5.0
737428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
738428d7b3dSmrg#
739428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
740428d7b3dSmrg# not at the appropriate level. This macro enables a module to test for the
741428d7b3dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
742428d7b3dSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
743428d7b3dSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
744428d7b3dSmrg# --with-asciidoc assumes 'auto'.
745428d7b3dSmrg#
746428d7b3dSmrg# Interface to module:
747428d7b3dSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
748428d7b3dSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
749428d7b3dSmrg#		 returns the path set by the user in the environment
750428d7b3dSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
751428d7b3dSmrg#		  'no' user instructs the module not to use asciidoc
752428d7b3dSmrg#
753428d7b3dSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
754428d7b3dSmrg#
755428d7b3dSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
756428d7b3dSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
757428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
758428d7b3dSmrgAC_ARG_WITH(asciidoc,
759428d7b3dSmrg	AS_HELP_STRING([--with-asciidoc],
760428d7b3dSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
761428d7b3dSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
762428d7b3dSmrgm4_undefine([_defopt])
763428d7b3dSmrg
764428d7b3dSmrgif test "x$use_asciidoc" = x"auto"; then
765428d7b3dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
766428d7b3dSmrg   if test "x$ASCIIDOC" = "x"; then
767428d7b3dSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
768428d7b3dSmrg	have_asciidoc=no
769428d7b3dSmrg   else
770428d7b3dSmrg        have_asciidoc=yes
771428d7b3dSmrg   fi
772428d7b3dSmrgelif test "x$use_asciidoc" = x"yes" ; then
773428d7b3dSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
774428d7b3dSmrg   if test "x$ASCIIDOC" = "x"; then
775428d7b3dSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
776428d7b3dSmrg   fi
777428d7b3dSmrg   have_asciidoc=yes
778428d7b3dSmrgelif test "x$use_asciidoc" = x"no" ; then
779428d7b3dSmrg   if test "x$ASCIIDOC" != "x"; then
780428d7b3dSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
781428d7b3dSmrg   fi
782428d7b3dSmrg   have_asciidoc=no
783428d7b3dSmrgelse
784428d7b3dSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
785428d7b3dSmrgfi
786428d7b3dSmrgm4_ifval([$1],
787428d7b3dSmrg[if test "$have_asciidoc" = yes; then
788428d7b3dSmrg    # scrape the asciidoc version
789428d7b3dSmrg    AC_MSG_CHECKING([the asciidoc version])
790428d7b3dSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
791428d7b3dSmrg    AC_MSG_RESULT([$asciidoc_version])
792428d7b3dSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
793428d7b3dSmrg        [if test "x$use_asciidoc" = xauto; then
794428d7b3dSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
795428d7b3dSmrg            have_asciidoc=no
796428d7b3dSmrg        else
797428d7b3dSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
798428d7b3dSmrg        fi])
799428d7b3dSmrgfi])
800428d7b3dSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
801428d7b3dSmrg]) # XORG_WITH_ASCIIDOC
802428d7b3dSmrg
803428d7b3dSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
804428d7b3dSmrg# --------------------------------
805428d7b3dSmrg# Minimum version: 1.5.0
806428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
807428d7b3dSmrg#
808428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
809428d7b3dSmrg# not at the appropriate level. This macro enables a module to test for the
810428d7b3dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
811428d7b3dSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
812428d7b3dSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
813428d7b3dSmrg# --with-doxygen assumes 'auto'.
814428d7b3dSmrg#
815428d7b3dSmrg# Interface to module:
816428d7b3dSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
817428d7b3dSmrg# DOXYGEN:	 returns the path of the doxygen program found
818428d7b3dSmrg#		 returns the path set by the user in the environment
819428d7b3dSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
820428d7b3dSmrg#		  'no' user instructs the module not to use doxygen
821428d7b3dSmrg#
822428d7b3dSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
823428d7b3dSmrg#
824428d7b3dSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
825428d7b3dSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
826428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
827428d7b3dSmrgAC_ARG_WITH(doxygen,
828428d7b3dSmrg	AS_HELP_STRING([--with-doxygen],
829428d7b3dSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
830428d7b3dSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
831428d7b3dSmrgm4_undefine([_defopt])
832428d7b3dSmrg
833428d7b3dSmrgif test "x$use_doxygen" = x"auto"; then
834428d7b3dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
835428d7b3dSmrg   if test "x$DOXYGEN" = "x"; then
836428d7b3dSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
837428d7b3dSmrg	have_doxygen=no
838428d7b3dSmrg   else
839428d7b3dSmrg        have_doxygen=yes
840428d7b3dSmrg   fi
841428d7b3dSmrgelif test "x$use_doxygen" = x"yes" ; then
842428d7b3dSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
843428d7b3dSmrg   if test "x$DOXYGEN" = "x"; then
844428d7b3dSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
845428d7b3dSmrg   fi
846428d7b3dSmrg   have_doxygen=yes
847428d7b3dSmrgelif test "x$use_doxygen" = x"no" ; then
848428d7b3dSmrg   if test "x$DOXYGEN" != "x"; then
849428d7b3dSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
850428d7b3dSmrg   fi
851428d7b3dSmrg   have_doxygen=no
852428d7b3dSmrgelse
853428d7b3dSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
854428d7b3dSmrgfi
855428d7b3dSmrgm4_ifval([$1],
856428d7b3dSmrg[if test "$have_doxygen" = yes; then
857428d7b3dSmrg    # scrape the doxygen version
858428d7b3dSmrg    AC_MSG_CHECKING([the doxygen version])
859428d7b3dSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
860428d7b3dSmrg    AC_MSG_RESULT([$doxygen_version])
861428d7b3dSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
862428d7b3dSmrg        [if test "x$use_doxygen" = xauto; then
863428d7b3dSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
864428d7b3dSmrg            have_doxygen=no
865428d7b3dSmrg        else
866428d7b3dSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
867428d7b3dSmrg        fi])
868428d7b3dSmrgfi])
869428d7b3dSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
870428d7b3dSmrg]) # XORG_WITH_DOXYGEN
871428d7b3dSmrg
872428d7b3dSmrg# XORG_WITH_GROFF([DEFAULT])
873428d7b3dSmrg# ----------------
874428d7b3dSmrg# Minimum version: 1.6.0
875428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
876428d7b3dSmrg#
877428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
878428d7b3dSmrg# not at the appropriate level. This macro enables a module to test for the
879428d7b3dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
880428d7b3dSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
881428d7b3dSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
882428d7b3dSmrg# --with-groff assumes 'auto'.
883428d7b3dSmrg#
884428d7b3dSmrg# Interface to module:
885428d7b3dSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
886428d7b3dSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
887428d7b3dSmrg# HAVE_GROFF_MS: the -ms macros package
888428d7b3dSmrg# GROFF:	 returns the path of the groff program found
889428d7b3dSmrg#		 returns the path set by the user in the environment
890428d7b3dSmrg# --with-groff:	 'yes' user instructs the module to use groff
891428d7b3dSmrg#		 'no' user instructs the module not to use groff
892428d7b3dSmrg#
893428d7b3dSmrg# Added in version 1.9.0:
894428d7b3dSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
895428d7b3dSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
896428d7b3dSmrg#		   psselect from the psutils package.
897428d7b3dSmrg#		   the ghostcript package. Refer to the grohtml man pages
898428d7b3dSmrg#
899428d7b3dSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
900428d7b3dSmrg#
901428d7b3dSmrg# OS and distros often splits groff in a basic and full package, the former
902428d7b3dSmrg# having the groff program and the later having devices, fonts and macros
903428d7b3dSmrg# Checking for the groff executable is not enough.
904428d7b3dSmrg#
905428d7b3dSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
906428d7b3dSmrg# unset HAVE_GROFF or GROFF env variables.
907428d7b3dSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
908428d7b3dSmrg#
909428d7b3dSmrgAC_DEFUN([XORG_WITH_GROFF],[
910428d7b3dSmrgAC_ARG_VAR([GROFF], [Path to groff command])
911428d7b3dSmrgm4_define([_defopt], m4_default([$1], [auto]))
912428d7b3dSmrgAC_ARG_WITH(groff,
913428d7b3dSmrg	AS_HELP_STRING([--with-groff],
914428d7b3dSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
915428d7b3dSmrg	   [use_groff=$withval], [use_groff=]_defopt)
916428d7b3dSmrgm4_undefine([_defopt])
917428d7b3dSmrg
918428d7b3dSmrgif test "x$use_groff" = x"auto"; then
919428d7b3dSmrg   AC_PATH_PROG([GROFF], [groff])
920428d7b3dSmrg   if test "x$GROFF" = "x"; then
921428d7b3dSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
922428d7b3dSmrg	have_groff=no
923428d7b3dSmrg   else
924428d7b3dSmrg        have_groff=yes
925428d7b3dSmrg   fi
926428d7b3dSmrgelif test "x$use_groff" = x"yes" ; then
927428d7b3dSmrg   AC_PATH_PROG([GROFF], [groff])
928428d7b3dSmrg   if test "x$GROFF" = "x"; then
929428d7b3dSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
930428d7b3dSmrg   fi
931428d7b3dSmrg   have_groff=yes
932428d7b3dSmrgelif test "x$use_groff" = x"no" ; then
933428d7b3dSmrg   if test "x$GROFF" != "x"; then
934428d7b3dSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
935428d7b3dSmrg   fi
936428d7b3dSmrg   have_groff=no
937428d7b3dSmrgelse
938428d7b3dSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
939428d7b3dSmrgfi
940428d7b3dSmrg
941428d7b3dSmrg# We have groff, test for the presence of the macro packages
942428d7b3dSmrgif test "x$have_groff" = x"yes"; then
943428d7b3dSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
944428d7b3dSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
945428d7b3dSmrg        groff_ms_works=yes
946428d7b3dSmrg    else
947428d7b3dSmrg        groff_ms_works=no
948428d7b3dSmrg    fi
949428d7b3dSmrg    AC_MSG_RESULT([$groff_ms_works])
950428d7b3dSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
951428d7b3dSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
952428d7b3dSmrg        groff_mm_works=yes
953428d7b3dSmrg    else
954428d7b3dSmrg        groff_mm_works=no
955428d7b3dSmrg    fi
956428d7b3dSmrg    AC_MSG_RESULT([$groff_mm_works])
957428d7b3dSmrgfi
958428d7b3dSmrg
959428d7b3dSmrg# We have groff, test for HTML dependencies, one command per package
960428d7b3dSmrgif test "x$have_groff" = x"yes"; then
961428d7b3dSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
962428d7b3dSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
963428d7b3dSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
964428d7b3dSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
965428d7b3dSmrg      have_groff_html=yes
966428d7b3dSmrg   else
967428d7b3dSmrg      have_groff_html=no
968428d7b3dSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
969428d7b3dSmrg   fi
970428d7b3dSmrgfi
971428d7b3dSmrg
972428d7b3dSmrg# Set Automake conditionals for Makefiles
973428d7b3dSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
974428d7b3dSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
975428d7b3dSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
976428d7b3dSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
977428d7b3dSmrg]) # XORG_WITH_GROFF
978428d7b3dSmrg
979428d7b3dSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
980428d7b3dSmrg# ---------------------------------------
981428d7b3dSmrg# Minimum version: 1.6.0
982428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
983428d7b3dSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
984428d7b3dSmrg#
985428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
986428d7b3dSmrg# not at the appropriate level. This macro enables a module to test for the
987428d7b3dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
988428d7b3dSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
989428d7b3dSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
990428d7b3dSmrg# --with-fop assumes 'auto'.
991428d7b3dSmrg#
992428d7b3dSmrg# Interface to module:
993428d7b3dSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
994428d7b3dSmrg# FOP:	 	returns the path of the fop program found
995428d7b3dSmrg#		returns the path set by the user in the environment
996428d7b3dSmrg# --with-fop: 	'yes' user instructs the module to use fop
997428d7b3dSmrg#		'no' user instructs the module not to use fop
998428d7b3dSmrg#
999428d7b3dSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1000428d7b3dSmrg#
1001428d7b3dSmrgAC_DEFUN([XORG_WITH_FOP],[
1002428d7b3dSmrgAC_ARG_VAR([FOP], [Path to fop command])
1003428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1004428d7b3dSmrgAC_ARG_WITH(fop,
1005428d7b3dSmrg	AS_HELP_STRING([--with-fop],
1006428d7b3dSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1007428d7b3dSmrg	   [use_fop=$withval], [use_fop=]_defopt)
1008428d7b3dSmrgm4_undefine([_defopt])
1009428d7b3dSmrg
1010428d7b3dSmrgif test "x$use_fop" = x"auto"; then
1011428d7b3dSmrg   AC_PATH_PROG([FOP], [fop])
1012428d7b3dSmrg   if test "x$FOP" = "x"; then
1013428d7b3dSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
1014428d7b3dSmrg	have_fop=no
1015428d7b3dSmrg   else
1016428d7b3dSmrg        have_fop=yes
1017428d7b3dSmrg   fi
1018428d7b3dSmrgelif test "x$use_fop" = x"yes" ; then
1019428d7b3dSmrg   AC_PATH_PROG([FOP], [fop])
1020428d7b3dSmrg   if test "x$FOP" = "x"; then
1021428d7b3dSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
1022428d7b3dSmrg   fi
1023428d7b3dSmrg   have_fop=yes
1024428d7b3dSmrgelif test "x$use_fop" = x"no" ; then
1025428d7b3dSmrg   if test "x$FOP" != "x"; then
1026428d7b3dSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
1027428d7b3dSmrg   fi
1028428d7b3dSmrg   have_fop=no
1029428d7b3dSmrgelse
1030428d7b3dSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
1031428d7b3dSmrgfi
1032428d7b3dSmrg
1033428d7b3dSmrg# Test for a minimum version of fop, if provided.
1034428d7b3dSmrgm4_ifval([$1],
1035428d7b3dSmrg[if test "$have_fop" = yes; then
1036428d7b3dSmrg    # scrape the fop version
1037428d7b3dSmrg    AC_MSG_CHECKING([for fop minimum version])
1038428d7b3dSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
1039428d7b3dSmrg    AC_MSG_RESULT([$fop_version])
1040428d7b3dSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
1041428d7b3dSmrg        [if test "x$use_fop" = xauto; then
1042428d7b3dSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
1043428d7b3dSmrg            have_fop=no
1044428d7b3dSmrg        else
1045428d7b3dSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
1046428d7b3dSmrg        fi])
1047428d7b3dSmrgfi])
1048428d7b3dSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
1049428d7b3dSmrg]) # XORG_WITH_FOP
1050428d7b3dSmrg
1051428d7b3dSmrg# XORG_WITH_PS2PDF([DEFAULT])
1052428d7b3dSmrg# ----------------
1053428d7b3dSmrg# Minimum version: 1.6.0
1054428d7b3dSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1055428d7b3dSmrg#
1056428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
1057428d7b3dSmrg# not at the appropriate level. This macro enables a module to test for the
1058428d7b3dSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1059428d7b3dSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
1060428d7b3dSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
1061428d7b3dSmrg# --with-ps2pdf assumes 'auto'.
1062428d7b3dSmrg#
1063428d7b3dSmrg# Interface to module:
1064428d7b3dSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
1065428d7b3dSmrg# PS2PDF:	returns the path of the ps2pdf program found
1066428d7b3dSmrg#		returns the path set by the user in the environment
1067428d7b3dSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
1068428d7b3dSmrg#		 'no' user instructs the module not to use ps2pdf
1069428d7b3dSmrg#
1070428d7b3dSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
1071428d7b3dSmrg#
1072428d7b3dSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
1073428d7b3dSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
1074428d7b3dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1075428d7b3dSmrgAC_ARG_WITH(ps2pdf,
1076428d7b3dSmrg	AS_HELP_STRING([--with-ps2pdf],
1077428d7b3dSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
1078428d7b3dSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
1079428d7b3dSmrgm4_undefine([_defopt])
1080428d7b3dSmrg
1081428d7b3dSmrgif test "x$use_ps2pdf" = x"auto"; then
1082428d7b3dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1083428d7b3dSmrg   if test "x$PS2PDF" = "x"; then
1084428d7b3dSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
1085428d7b3dSmrg	have_ps2pdf=no
1086428d7b3dSmrg   else
1087428d7b3dSmrg        have_ps2pdf=yes
1088428d7b3dSmrg   fi
1089428d7b3dSmrgelif test "x$use_ps2pdf" = x"yes" ; then
1090428d7b3dSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
1091428d7b3dSmrg   if test "x$PS2PDF" = "x"; then
1092428d7b3dSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
1093428d7b3dSmrg   fi
1094428d7b3dSmrg   have_ps2pdf=yes
1095428d7b3dSmrgelif test "x$use_ps2pdf" = x"no" ; then
1096428d7b3dSmrg   if test "x$PS2PDF" != "x"; then
1097428d7b3dSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
1098428d7b3dSmrg   fi
1099428d7b3dSmrg   have_ps2pdf=no
1100428d7b3dSmrgelse
1101428d7b3dSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
1102428d7b3dSmrgfi
1103428d7b3dSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
1104428d7b3dSmrg]) # XORG_WITH_PS2PDF
1105428d7b3dSmrg
1106428d7b3dSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
1107428d7b3dSmrg# ----------------
1108428d7b3dSmrg# Minimum version: 1.6.0
1109428d7b3dSmrg#
1110428d7b3dSmrg# Documentation tools are not always available on all platforms and sometimes
1111428d7b3dSmrg# not at the appropriate level. This macro enables a builder to skip all
1112428d7b3dSmrg# documentation targets except traditional man pages.
1113428d7b3dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1114428d7b3dSmrg# maximum flexibilty in controlling documentation building.
1115428d7b3dSmrg# Refer to:
1116428d7b3dSmrg# XORG_WITH_XMLTO         --with-xmlto
1117428d7b3dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1118428d7b3dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1119428d7b3dSmrg# XORG_WITH_FOP           --with-fop
1120428d7b3dSmrg# XORG_WITH_GROFF         --with-groff
1121428d7b3dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1122428d7b3dSmrg#
1123428d7b3dSmrg# Interface to module:
1124428d7b3dSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
1125428d7b3dSmrg# --enable-docs: 'yes' user instructs the module to generate docs
1126428d7b3dSmrg#		 'no' user instructs the module not to generate docs
1127428d7b3dSmrg# parm1:	specify the default value, yes or no.
1128428d7b3dSmrg#
1129428d7b3dSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
1130428d7b3dSmrgm4_define([docs_default], m4_default([$1], [yes]))
1131428d7b3dSmrgAC_ARG_ENABLE(docs,
1132428d7b3dSmrg	AS_HELP_STRING([--enable-docs],
1133428d7b3dSmrg	   [Enable building the documentation (default: ]docs_default[)]),
1134428d7b3dSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
1135428d7b3dSmrgm4_undefine([docs_default])
1136428d7b3dSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
1137428d7b3dSmrgAC_MSG_CHECKING([whether to build documentation])
1138428d7b3dSmrgAC_MSG_RESULT([$build_docs])
1139428d7b3dSmrg]) # XORG_ENABLE_DOCS
1140428d7b3dSmrg
1141428d7b3dSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
1142428d7b3dSmrg# ----------------
1143428d7b3dSmrg# Minimum version: 1.6.0
1144428d7b3dSmrg#
1145428d7b3dSmrg# This macro enables a builder to skip all developer documentation.
1146428d7b3dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1147428d7b3dSmrg# maximum flexibilty in controlling documentation building.
1148428d7b3dSmrg# Refer to:
1149428d7b3dSmrg# XORG_WITH_XMLTO         --with-xmlto
1150428d7b3dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1151428d7b3dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1152428d7b3dSmrg# XORG_WITH_FOP           --with-fop
1153428d7b3dSmrg# XORG_WITH_GROFF         --with-groff
1154428d7b3dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1155428d7b3dSmrg#
1156428d7b3dSmrg# Interface to module:
1157428d7b3dSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
1158428d7b3dSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
1159428d7b3dSmrg#			'no' user instructs the module not to generate developer docs
1160428d7b3dSmrg# parm1:		specify the default value, yes or no.
1161428d7b3dSmrg#
1162428d7b3dSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
1163428d7b3dSmrgm4_define([devel_default], m4_default([$1], [yes]))
1164428d7b3dSmrgAC_ARG_ENABLE(devel-docs,
1165428d7b3dSmrg	AS_HELP_STRING([--enable-devel-docs],
1166428d7b3dSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
1167428d7b3dSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
1168428d7b3dSmrgm4_undefine([devel_default])
1169428d7b3dSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
1170428d7b3dSmrgAC_MSG_CHECKING([whether to build developer documentation])
1171428d7b3dSmrgAC_MSG_RESULT([$build_devel_docs])
1172428d7b3dSmrg]) # XORG_ENABLE_DEVEL_DOCS
1173428d7b3dSmrg
1174428d7b3dSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
1175428d7b3dSmrg# ----------------
1176428d7b3dSmrg# Minimum version: 1.6.0
1177428d7b3dSmrg#
1178428d7b3dSmrg# This macro enables a builder to skip all functional specification targets.
1179428d7b3dSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
1180428d7b3dSmrg# maximum flexibilty in controlling documentation building.
1181428d7b3dSmrg# Refer to:
1182428d7b3dSmrg# XORG_WITH_XMLTO         --with-xmlto
1183428d7b3dSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1184428d7b3dSmrg# XORG_WITH_DOXYGEN       --with-doxygen
1185428d7b3dSmrg# XORG_WITH_FOP           --with-fop
1186428d7b3dSmrg# XORG_WITH_GROFF         --with-groff
1187428d7b3dSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
1188428d7b3dSmrg#
1189428d7b3dSmrg# Interface to module:
1190428d7b3dSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1191428d7b3dSmrg# --enable-specs:	'yes' user instructs the module to generate specs
1192428d7b3dSmrg#			'no' user instructs the module not to generate specs
1193428d7b3dSmrg# parm1:		specify the default value, yes or no.
1194428d7b3dSmrg#
1195428d7b3dSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1196428d7b3dSmrgm4_define([spec_default], m4_default([$1], [yes]))
1197428d7b3dSmrgAC_ARG_ENABLE(specs,
1198428d7b3dSmrg	AS_HELP_STRING([--enable-specs],
1199428d7b3dSmrg	   [Enable building the specs (default: ]spec_default[)]),
1200428d7b3dSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
1201428d7b3dSmrgm4_undefine([spec_default])
1202428d7b3dSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1203428d7b3dSmrgAC_MSG_CHECKING([whether to build functional specifications])
1204428d7b3dSmrgAC_MSG_RESULT([$build_specs])
1205428d7b3dSmrg]) # XORG_ENABLE_SPECS
1206428d7b3dSmrg
1207428d7b3dSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
1208428d7b3dSmrg# ----------------------------------------------
1209428d7b3dSmrg# Minimum version: 1.13.0
1210428d7b3dSmrg#
1211428d7b3dSmrg# This macro enables a builder to enable/disable unit testing
1212428d7b3dSmrg# It makes no assumption about the test cases implementation
1213428d7b3dSmrg# Test cases may or may not use Automake "Support for test suites"
1214428d7b3dSmrg# They may or may not use the software utility library GLib
1215428d7b3dSmrg#
1216428d7b3dSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
1217428d7b3dSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
1218428d7b3dSmrg# The variable enable_unit_tests is used by other macros in this file.
1219428d7b3dSmrg#
1220428d7b3dSmrg# Interface to module:
1221428d7b3dSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
1222428d7b3dSmrg# enable_unit_tests:    used in configure.ac for additional configuration
1223428d7b3dSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
1224428d7b3dSmrg#			'no' user instructs the module not to build tests
1225428d7b3dSmrg# parm1:		specify the default value, yes or no.
1226428d7b3dSmrg#
1227428d7b3dSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
1228428d7b3dSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
1229428d7b3dSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
1230428d7b3dSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1231428d7b3dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1232428d7b3dSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
1233428d7b3dSmrg	[Enable building unit test cases (default: ]_defopt[)]),
1234428d7b3dSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
1235428d7b3dSmrgm4_undefine([_defopt])
1236428d7b3dSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
1237428d7b3dSmrgAC_MSG_CHECKING([whether to build unit test cases])
1238428d7b3dSmrgAC_MSG_RESULT([$enable_unit_tests])
1239428d7b3dSmrg]) # XORG_ENABLE_UNIT_TESTS
1240428d7b3dSmrg
1241428d7b3dSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
1242428d7b3dSmrg# ------------------------------------------------------
1243428d7b3dSmrg# Minimum version: 1.17.0
1244428d7b3dSmrg#
1245428d7b3dSmrg# This macro enables a builder to enable/disable integration testing
1246428d7b3dSmrg# It makes no assumption about the test cases' implementation
1247428d7b3dSmrg# Test cases may or may not use Automake "Support for test suites"
1248428d7b3dSmrg#
1249428d7b3dSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
1250428d7b3dSmrg# usually requires less dependencies and may be built and run under less
1251428d7b3dSmrg# stringent environments than integration tests.
1252428d7b3dSmrg#
1253428d7b3dSmrg# Interface to module:
1254428d7b3dSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
1255428d7b3dSmrg# enable_integration_tests:   used in configure.ac for additional configuration
1256428d7b3dSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
1257428d7b3dSmrg#                             'no' user instructs the module not to build tests
1258428d7b3dSmrg# parm1:                      specify the default value, yes or no.
1259428d7b3dSmrg#
1260428d7b3dSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
1261428d7b3dSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
1262428d7b3dSmrgm4_define([_defopt], m4_default([$1], [auto]))
1263428d7b3dSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
1264428d7b3dSmrg	[Enable building integration test cases (default: ]_defopt[)]),
1265428d7b3dSmrg	[enable_integration_tests=$enableval],
1266428d7b3dSmrg	[enable_integration_tests=]_defopt)
1267428d7b3dSmrgm4_undefine([_defopt])
1268428d7b3dSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
1269428d7b3dSmrg	[test "x$enable_integration_tests" != xno])
1270428d7b3dSmrgAC_MSG_CHECKING([whether to build unit test cases])
1271428d7b3dSmrgAC_MSG_RESULT([$enable_integration_tests])
1272428d7b3dSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
1273428d7b3dSmrg
1274428d7b3dSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
1275428d7b3dSmrg# ----------------------------------------
1276428d7b3dSmrg# Minimum version: 1.13.0
1277428d7b3dSmrg#
1278428d7b3dSmrg# GLib is a library which provides advanced data structures and functions.
1279428d7b3dSmrg# This macro enables a module to test for the presence of Glib.
1280428d7b3dSmrg#
1281428d7b3dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
1282428d7b3dSmrg# Otherwise the value of $enable_unit_tests is blank.
1283428d7b3dSmrg#
1284428d7b3dSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
1285428d7b3dSmrg# test support usually requires less dependencies and may be built and run under
1286428d7b3dSmrg# less stringent environments than integration tests.
1287428d7b3dSmrg#
1288428d7b3dSmrg# Interface to module:
1289428d7b3dSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
1290428d7b3dSmrg# with_glib: used in configure.ac to know if GLib has been found
1291428d7b3dSmrg# --with-glib:	'yes' user instructs the module to use glib
1292428d7b3dSmrg#		'no' user instructs the module not to use glib
1293428d7b3dSmrg#
1294428d7b3dSmrgAC_DEFUN([XORG_WITH_GLIB],[
1295428d7b3dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1296428d7b3dSmrgm4_define([_defopt], m4_default([$2], [auto]))
1297428d7b3dSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
1298428d7b3dSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
1299428d7b3dSmrg	[with_glib=$withval], [with_glib=]_defopt)
1300428d7b3dSmrgm4_undefine([_defopt])
1301428d7b3dSmrg
1302428d7b3dSmrghave_glib=no
1303428d7b3dSmrg# Do not probe GLib if user explicitly disabled unit testing
1304428d7b3dSmrgif test "x$enable_unit_tests" != x"no"; then
1305428d7b3dSmrg  # Do not probe GLib if user explicitly disabled it
1306428d7b3dSmrg  if test "x$with_glib" != x"no"; then
1307428d7b3dSmrg    m4_ifval(
1308428d7b3dSmrg      [$1],
1309428d7b3dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
1310428d7b3dSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
1311428d7b3dSmrg    )
1312428d7b3dSmrg  fi
1313428d7b3dSmrgfi
1314428d7b3dSmrg
1315428d7b3dSmrg# Not having GLib when unit testing has been explicitly requested is an error
1316428d7b3dSmrgif test "x$enable_unit_tests" = x"yes"; then
1317428d7b3dSmrg  if test "x$have_glib" = x"no"; then
1318428d7b3dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1319428d7b3dSmrg  fi
1320428d7b3dSmrgfi
1321428d7b3dSmrg
1322428d7b3dSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
1323428d7b3dSmrgif test "x$enable_unit_tests" = x"no"; then
1324428d7b3dSmrg  if test "x$with_glib" = x"yes"; then
1325428d7b3dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
1326428d7b3dSmrg  fi
1327428d7b3dSmrgfi
1328428d7b3dSmrg
1329428d7b3dSmrg# Not having GLib when it has been explicitly requested is an error
1330428d7b3dSmrgif test "x$with_glib" = x"yes"; then
1331428d7b3dSmrg  if test "x$have_glib" = x"no"; then
1332428d7b3dSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
1333428d7b3dSmrg  fi
1334428d7b3dSmrgfi
1335428d7b3dSmrg
1336428d7b3dSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
1337428d7b3dSmrg]) # XORG_WITH_GLIB
1338428d7b3dSmrg
1339428d7b3dSmrg# XORG_LD_WRAP([required|optional])
1340428d7b3dSmrg# ---------------------------------
1341428d7b3dSmrg# Minimum version: 1.13.0
1342428d7b3dSmrg#
1343428d7b3dSmrg# Check if linker supports -wrap, passed via compiler flags
1344428d7b3dSmrg#
1345428d7b3dSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
1346428d7b3dSmrg# Otherwise the value of $enable_unit_tests is blank.
1347428d7b3dSmrg#
1348428d7b3dSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
1349428d7b3dSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
1350428d7b3dSmrg# available, an argument of "optional" allows use when some unit tests require
1351428d7b3dSmrg# ld -wrap and others do not.
1352428d7b3dSmrg#
1353428d7b3dSmrgAC_DEFUN([XORG_LD_WRAP],[
1354428d7b3dSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
1355428d7b3dSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
1356428d7b3dSmrg                      void __wrap_exit(int status) { return; }],
1357428d7b3dSmrg                     [exit(0);])])
1358428d7b3dSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
1359428d7b3dSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
1360428d7b3dSmrg  if test "x$have_ld_wrap" = x"no"; then
1361428d7b3dSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
1362428d7b3dSmrg  fi
1363428d7b3dSmrgfi
1364428d7b3dSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
1365428d7b3dSmrg#
1366428d7b3dSmrg]) # XORG_LD_WRAP
1367428d7b3dSmrg
1368428d7b3dSmrg# XORG_CHECK_LINKER_FLAGS
1369428d7b3dSmrg# -----------------------
1370428d7b3dSmrg# SYNOPSIS
1371428d7b3dSmrg#
1372428d7b3dSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
1373428d7b3dSmrg#
1374428d7b3dSmrg# DESCRIPTION
1375428d7b3dSmrg#
1376428d7b3dSmrg#   Check whether the given linker FLAGS work with the current language's
1377428d7b3dSmrg#   linker, or whether they give an error.
1378428d7b3dSmrg#
1379428d7b3dSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
1380428d7b3dSmrg#   success/failure.
1381428d7b3dSmrg#
1382428d7b3dSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
1383428d7b3dSmrg#
1384428d7b3dSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
1385428d7b3dSmrg#
1386428d7b3dSmrg# LICENSE
1387428d7b3dSmrg#
1388428d7b3dSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
1389428d7b3dSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
1390428d7b3dSmrg#   Copyright (c) 2009 Matteo Frigo
1391428d7b3dSmrg#
1392428d7b3dSmrg#   This program is free software: you can redistribute it and/or modify it
1393428d7b3dSmrg#   under the terms of the GNU General Public License as published by the
1394428d7b3dSmrg#   Free Software Foundation, either version 3 of the License, or (at your
1395428d7b3dSmrg#   option) any later version.
1396428d7b3dSmrg#
1397428d7b3dSmrg#   This program is distributed in the hope that it will be useful, but
1398428d7b3dSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
1399428d7b3dSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1400428d7b3dSmrg#   Public License for more details.
1401428d7b3dSmrg#
1402428d7b3dSmrg#   You should have received a copy of the GNU General Public License along
1403428d7b3dSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
1404428d7b3dSmrg#
1405428d7b3dSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
1406428d7b3dSmrg#   gives unlimited permission to copy, distribute and modify the configure
1407428d7b3dSmrg#   scripts that are the output of Autoconf when processing the Macro. You
1408428d7b3dSmrg#   need not follow the terms of the GNU General Public License when using
1409428d7b3dSmrg#   or distributing such scripts, even though portions of the text of the
1410428d7b3dSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
1411428d7b3dSmrg#   all other use of the material that constitutes the Autoconf Macro.
1412428d7b3dSmrg#
1413428d7b3dSmrg#   This special exception to the GPL applies to versions of the Autoconf
1414428d7b3dSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
1415428d7b3dSmrg#   modified version of the Autoconf Macro, you may extend this special
1416428d7b3dSmrg#   exception to the GPL to apply to your modified version as well.#
1417428d7b3dSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
1418428d7b3dSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
1419428d7b3dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
1420428d7b3dSmrgAS_LITERAL_IF([$1],
1421428d7b3dSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
1422428d7b3dSmrg      ax_save_FLAGS=$LDFLAGS
1423428d7b3dSmrg      LDFLAGS="$1"
1424428d7b3dSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
1425428d7b3dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1426428d7b3dSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1427428d7b3dSmrg      LDFLAGS=$ax_save_FLAGS])],
1428428d7b3dSmrg  [ax_save_FLAGS=$LDFLAGS
1429428d7b3dSmrg   LDFLAGS="$1"
1430428d7b3dSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
1431428d7b3dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
1432428d7b3dSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
1433428d7b3dSmrg   LDFLAGS=$ax_save_FLAGS])
1434428d7b3dSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
1435428d7b3dSmrgAC_MSG_RESULT($xorg_check_linker_flags)
1436428d7b3dSmrgif test "x$xorg_check_linker_flags" = xyes; then
1437428d7b3dSmrg	m4_default([$2], :)
1438428d7b3dSmrgelse
1439428d7b3dSmrg	m4_default([$3], :)
1440428d7b3dSmrgfi
1441428d7b3dSmrg]) # XORG_CHECK_LINKER_FLAGS
1442428d7b3dSmrg
1443428d7b3dSmrg# XORG_MEMORY_CHECK_FLAGS
1444428d7b3dSmrg# -----------------------
1445428d7b3dSmrg# Minimum version: 1.16.0
1446428d7b3dSmrg#
1447428d7b3dSmrg# This macro attempts to find appropriate memory checking functionality
1448428d7b3dSmrg# for various platforms which unit testing code may use to catch various
1449428d7b3dSmrg# forms of memory allocation and access errors in testing.
1450428d7b3dSmrg#
1451428d7b3dSmrg# Interface to module:
1452428d7b3dSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
1453428d7b3dSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
1454428d7b3dSmrg#
1455428d7b3dSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
1456428d7b3dSmrg#
1457428d7b3dSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
1458428d7b3dSmrg
1459428d7b3dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1460428d7b3dSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
1461428d7b3dSmrg           [Environment variables to enable memory checking in tests])
1462428d7b3dSmrg
1463428d7b3dSmrg# Check for different types of support on different platforms
1464428d7b3dSmrgcase $host_os in
1465428d7b3dSmrg    solaris*)
1466428d7b3dSmrg        AC_CHECK_LIB([umem], [umem_alloc],
1467428d7b3dSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
1468428d7b3dSmrg        ;;
1469428d7b3dSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
1470428d7b3dSmrg        # both directly and inverted, so should not be 0 or 255.
1471428d7b3dSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
1472428d7b3dSmrg        ;;
1473428d7b3dSmrg    darwin*)
1474428d7b3dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
1475428d7b3dSmrg        ;;
1476428d7b3dSmrg    *bsd*)
1477428d7b3dSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
1478428d7b3dSmrg        ;;
1479428d7b3dSmrgesac
1480428d7b3dSmrg
1481428d7b3dSmrg# User supplied flags override default flags
1482428d7b3dSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
1483428d7b3dSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
1484428d7b3dSmrgfi
1485428d7b3dSmrg
1486428d7b3dSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
1487428d7b3dSmrg]) # XORG_WITH_LINT
1488428d7b3dSmrg
1489428d7b3dSmrg# XORG_CHECK_MALLOC_ZERO
1490428d7b3dSmrg# ----------------------
1491428d7b3dSmrg# Minimum version: 1.0.0
1492428d7b3dSmrg#
1493428d7b3dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1494428d7b3dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1495428d7b3dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1496428d7b3dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1497428d7b3dSmrgAC_ARG_ENABLE(malloc0returnsnull,
1498428d7b3dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1499428d7b3dSmrg		       [malloc(0) returns NULL (default: auto)]),
1500428d7b3dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1501428d7b3dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1502428d7b3dSmrg
1503428d7b3dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1504428d7b3dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1505428d7b3dSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
1506428d7b3dSmrg#include <stdlib.h>
1507428d7b3dSmrg],[
1508428d7b3dSmrg    char *m0, *r0, *c0, *p;
1509428d7b3dSmrg    m0 = malloc(0);
1510428d7b3dSmrg    p = malloc(10);
1511428d7b3dSmrg    r0 = realloc(p,0);
1512428d7b3dSmrg    c0 = calloc(0,10);
1513428d7b3dSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
1514428d7b3dSmrg])],
1515428d7b3dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1516428d7b3dSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
1517428d7b3dSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1518428d7b3dSmrgfi
1519428d7b3dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1520428d7b3dSmrg
1521428d7b3dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1522428d7b3dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1523428d7b3dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1524428d7b3dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1525428d7b3dSmrgelse
1526428d7b3dSmrg	MALLOC_ZERO_CFLAGS=""
1527428d7b3dSmrg	XMALLOC_ZERO_CFLAGS=""
1528428d7b3dSmrg	XTMALLOC_ZERO_CFLAGS=""
1529428d7b3dSmrgfi
1530428d7b3dSmrg
1531428d7b3dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1532428d7b3dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1533428d7b3dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1534428d7b3dSmrg]) # XORG_CHECK_MALLOC_ZERO
1535428d7b3dSmrg
1536428d7b3dSmrg# XORG_WITH_LINT()
1537428d7b3dSmrg# ----------------
1538428d7b3dSmrg# Minimum version: 1.1.0
1539428d7b3dSmrg#
1540428d7b3dSmrg# This macro enables the use of a tool that flags some suspicious and
1541428d7b3dSmrg# non-portable constructs (likely to be bugs) in C language source code.
1542428d7b3dSmrg# It will attempt to locate the tool and use appropriate options.
1543428d7b3dSmrg# There are various lint type tools on different platforms.
1544428d7b3dSmrg#
1545428d7b3dSmrg# Interface to module:
1546428d7b3dSmrg# LINT:		returns the path to the tool found on the platform
1547428d7b3dSmrg#		or the value set to LINT on the configure cmd line
1548428d7b3dSmrg#		also an Automake conditional
1549428d7b3dSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
1550428d7b3dSmrg#
1551428d7b3dSmrg# --with-lint:	'yes' user instructs the module to use lint
1552428d7b3dSmrg#		'no' user instructs the module not to use lint (default)
1553428d7b3dSmrg#
1554428d7b3dSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1555428d7b3dSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1556428d7b3dSmrg#
1557428d7b3dSmrgAC_DEFUN([XORG_WITH_LINT],[
1558428d7b3dSmrg
1559428d7b3dSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1560428d7b3dSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1561428d7b3dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1562428d7b3dSmrg		[Use a lint-style source code checker (default: disabled)])],
1563428d7b3dSmrg		[use_lint=$withval], [use_lint=no])
1564428d7b3dSmrg
1565428d7b3dSmrg# Obtain platform specific info like program name and options
1566428d7b3dSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1567428d7b3dSmrgcase $host_os in
1568428d7b3dSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1569428d7b3dSmrg	lint_name=splint
1570428d7b3dSmrg	lint_options="-badflag"
1571428d7b3dSmrg	;;
1572428d7b3dSmrg  *freebsd* | *netbsd*)
1573428d7b3dSmrg	lint_name=lint
1574428d7b3dSmrg	lint_options="-u -b"
1575428d7b3dSmrg	;;
1576428d7b3dSmrg  *solaris*)
1577428d7b3dSmrg	lint_name=lint
1578428d7b3dSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1579428d7b3dSmrg	;;
1580428d7b3dSmrgesac
1581428d7b3dSmrg
1582428d7b3dSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1583428d7b3dSmrgif test "x$use_lint" = x"yes" ; then
1584428d7b3dSmrg   AC_PATH_PROG([LINT], [$lint_name])
1585428d7b3dSmrg   if test "x$LINT" = "x"; then
1586428d7b3dSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1587428d7b3dSmrg   fi
1588428d7b3dSmrgelif test "x$use_lint" = x"no" ; then
1589428d7b3dSmrg   if test "x$LINT" != "x"; then
1590428d7b3dSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1591428d7b3dSmrg   fi
1592428d7b3dSmrgelse
1593428d7b3dSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1594428d7b3dSmrgfi
1595428d7b3dSmrg
1596428d7b3dSmrg# User supplied flags override default flags
1597428d7b3dSmrgif test "x$LINT_FLAGS" != "x"; then
1598428d7b3dSmrg   lint_options=$LINT_FLAGS
1599428d7b3dSmrgfi
1600428d7b3dSmrg
1601428d7b3dSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1602428d7b3dSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1603428d7b3dSmrg
1604428d7b3dSmrg]) # XORG_WITH_LINT
1605428d7b3dSmrg
1606428d7b3dSmrg# XORG_LINT_LIBRARY(LIBNAME)
1607428d7b3dSmrg# --------------------------
1608428d7b3dSmrg# Minimum version: 1.1.0
1609428d7b3dSmrg#
1610428d7b3dSmrg# Sets up flags for building lint libraries for checking programs that call
1611428d7b3dSmrg# functions in the library.
1612428d7b3dSmrg#
1613428d7b3dSmrg# Interface to module:
1614428d7b3dSmrg# LINTLIB		- Automake variable with the name of lint library file to make
1615428d7b3dSmrg# MAKE_LINT_LIB		- Automake conditional
1616428d7b3dSmrg#
1617428d7b3dSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1618428d7b3dSmrg#			  - 'no' user instructs the module not to create a lint library (default)
1619428d7b3dSmrg
1620428d7b3dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1621428d7b3dSmrgAC_REQUIRE([XORG_WITH_LINT])
1622428d7b3dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1623428d7b3dSmrg	[Create lint library (default: disabled)])],
1624428d7b3dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1625428d7b3dSmrg
1626428d7b3dSmrgif test "x$make_lint_lib" = x"yes" ; then
1627428d7b3dSmrg   LINTLIB=llib-l$1.ln
1628428d7b3dSmrg   if test "x$LINT" = "x"; then
1629428d7b3dSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1630428d7b3dSmrg   fi
1631428d7b3dSmrgelif test "x$make_lint_lib" != x"no" ; then
1632428d7b3dSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1633428d7b3dSmrgfi
1634428d7b3dSmrg
1635428d7b3dSmrgAC_SUBST(LINTLIB)
1636428d7b3dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1637428d7b3dSmrg
1638428d7b3dSmrg]) # XORG_LINT_LIBRARY
1639428d7b3dSmrg
1640428d7b3dSmrg# XORG_COMPILER_BRAND
1641428d7b3dSmrg# -------------------
1642428d7b3dSmrg# Minimum version: 1.14.0
1643428d7b3dSmrg#
1644428d7b3dSmrg# Checks for various brands of compilers and sets flags as appropriate:
1645428d7b3dSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
1646428d7b3dSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
1647428d7b3dSmrg#   clang compiler - sets CLANGCC to "yes"
1648428d7b3dSmrg#   Intel compiler - sets INTELCC to "yes"
1649428d7b3dSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
1650428d7b3dSmrg#
1651428d7b3dSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
1652428d7b3dSmrgAC_LANG_CASE(
1653428d7b3dSmrg	[C], [
1654428d7b3dSmrg		AC_REQUIRE([AC_PROG_CC_C99])
1655428d7b3dSmrg	],
1656428d7b3dSmrg	[C++], [
1657428d7b3dSmrg		AC_REQUIRE([AC_PROG_CXX])
1658428d7b3dSmrg	]
1659428d7b3dSmrg)
1660428d7b3dSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
1661428d7b3dSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1662428d7b3dSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1663428d7b3dSmrg]) # XORG_COMPILER_BRAND
1664428d7b3dSmrg
1665428d7b3dSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
1666428d7b3dSmrg# ---------------
1667428d7b3dSmrg# Minimum version: 1.16.0
1668428d7b3dSmrg#
1669428d7b3dSmrg# Test if the compiler works when passed the given flag as a command line argument.
1670428d7b3dSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
1671428d7b3dSmrg# next flag in the list until there are no more options.
1672428d7b3dSmrg#
1673428d7b3dSmrg# Note that this does not guarantee that the compiler supports the flag as some
1674428d7b3dSmrg# compilers will simply ignore arguments that they do not understand, but we do
1675428d7b3dSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
1676428d7b3dSmrg# -Werror=unused-command-line-argument
1677428d7b3dSmrg#
1678428d7b3dSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
1679428d7b3dSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1680428d7b3dSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
1681428d7b3dSmrg
1682428d7b3dSmrgAC_LANG_COMPILER_REQUIRE
1683428d7b3dSmrg
1684428d7b3dSmrgAC_LANG_CASE(
1685428d7b3dSmrg	[C], [
1686428d7b3dSmrg		AC_REQUIRE([AC_PROG_CC_C99])
1687428d7b3dSmrg		define([PREFIX], [C])
1688428d7b3dSmrg		define([CACHE_PREFIX], [cc])
1689428d7b3dSmrg		define([COMPILER], [$CC])
1690428d7b3dSmrg	],
1691428d7b3dSmrg	[C++], [
1692428d7b3dSmrg		define([PREFIX], [CXX])
1693428d7b3dSmrg		define([CACHE_PREFIX], [cxx])
1694428d7b3dSmrg		define([COMPILER], [$CXX])
1695428d7b3dSmrg	]
1696428d7b3dSmrg)
1697428d7b3dSmrg
1698428d7b3dSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
1699428d7b3dSmrg
1700428d7b3dSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
1701428d7b3dSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1702428d7b3dSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
1703428d7b3dSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
1704428d7b3dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1705428d7b3dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
1706428d7b3dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
1707428d7b3dSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
1708428d7b3dSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1709428d7b3dSmrgfi
1710428d7b3dSmrg
1711428d7b3dSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
1712428d7b3dSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
1713428d7b3dSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1714428d7b3dSmrg	fi
1715428d7b3dSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1716428d7b3dSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
1717428d7b3dSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
1718428d7b3dSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1719428d7b3dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
1720428d7b3dSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
1721428d7b3dSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
1722428d7b3dSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1723428d7b3dSmrgfi
1724428d7b3dSmrg
1725428d7b3dSmrgfound="no"
1726428d7b3dSmrgm4_foreach([flag], m4_cdr($@), [
1727428d7b3dSmrg	if test $found = "no" ; then
1728428d7b3dSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
1729428d7b3dSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
1730428d7b3dSmrg		fi
1731428d7b3dSmrg
1732428d7b3dSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
1733428d7b3dSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
1734428d7b3dSmrg		fi
1735428d7b3dSmrg
1736428d7b3dSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
1737428d7b3dSmrg
1738428d7b3dSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
1739428d7b3dSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
1740428d7b3dSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
1741428d7b3dSmrg		AC_CACHE_VAL($cacheid,
1742428d7b3dSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
1743428d7b3dSmrg					     [eval $cacheid=yes],
1744428d7b3dSmrg					     [eval $cacheid=no])])
1745428d7b3dSmrg
1746428d7b3dSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
1747428d7b3dSmrg
1748428d7b3dSmrg		eval supported=\$$cacheid
1749428d7b3dSmrg		AC_MSG_RESULT([$supported])
1750428d7b3dSmrg		if test "$supported" = "yes" ; then
1751428d7b3dSmrg			$1="$$1 ]flag["
1752428d7b3dSmrg			found="yes"
1753428d7b3dSmrg		fi
1754428d7b3dSmrg	fi
1755428d7b3dSmrg])
1756428d7b3dSmrg]) # XORG_TESTSET_CFLAG
1757428d7b3dSmrg
1758428d7b3dSmrg# XORG_COMPILER_FLAGS
1759428d7b3dSmrg# ---------------
1760428d7b3dSmrg# Minimum version: 1.16.0
1761428d7b3dSmrg#
1762428d7b3dSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
1763428d7b3dSmrg# arguments supported by the selected compiler which do NOT alter the generated
1764428d7b3dSmrg# code.  These arguments will cause the compiler to print various warnings
1765428d7b3dSmrg# during compilation AND turn a conservative set of warnings into errors.
1766428d7b3dSmrg#
1767428d7b3dSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
1768428d7b3dSmrg# future versions of util-macros as options are added to new compilers.
1769428d7b3dSmrg#
1770428d7b3dSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
1771428d7b3dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1772428d7b3dSmrg
1773428d7b3dSmrgAC_ARG_ENABLE(selective-werror,
1774428d7b3dSmrg              AS_HELP_STRING([--disable-selective-werror],
1775428d7b3dSmrg                             [Turn off selective compiler errors. (default: enabled)]),
1776428d7b3dSmrg              [SELECTIVE_WERROR=$enableval],
1777428d7b3dSmrg              [SELECTIVE_WERROR=yes])
1778428d7b3dSmrg
1779428d7b3dSmrgAC_LANG_CASE(
1780428d7b3dSmrg        [C], [
1781428d7b3dSmrg                define([PREFIX], [C])
1782428d7b3dSmrg        ],
1783428d7b3dSmrg        [C++], [
1784428d7b3dSmrg                define([PREFIX], [CXX])
1785428d7b3dSmrg        ]
1786428d7b3dSmrg)
1787428d7b3dSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
1788428d7b3dSmrgif test "x$SUNCC" = "xyes"; then
1789428d7b3dSmrg    [BASE_]PREFIX[FLAGS]="-v"
1790428d7b3dSmrgelse
1791428d7b3dSmrg    [BASE_]PREFIX[FLAGS]=""
1792428d7b3dSmrgfi
1793428d7b3dSmrg
1794428d7b3dSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
1795428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
1796428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
1797428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
1798428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
1799428d7b3dSmrg
1800428d7b3dSmrgAC_LANG_CASE(
1801428d7b3dSmrg	[C], [
1802428d7b3dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
1803428d7b3dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
1804428d7b3dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
1805428d7b3dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
1806428d7b3dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
1807428d7b3dSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
1808428d7b3dSmrg	]
1809428d7b3dSmrg)
1810428d7b3dSmrg
1811428d7b3dSmrg# This chunk adds additional warnings that could catch undesired effects.
1812428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
1813428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
1814428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
1815428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
1816428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
1817428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
1818428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
1819428d7b3dSmrg
1820428d7b3dSmrg# These are currently disabled because they are noisy.  They will be enabled
1821428d7b3dSmrg# in the future once the codebase is sufficiently modernized to silence
1822428d7b3dSmrg# them.  For now, I don't want them to drown out the other warnings.
1823428d7b3dSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
1824428d7b3dSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
1825428d7b3dSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
1826428d7b3dSmrg
1827428d7b3dSmrg# Turn some warnings into errors, so we don't accidently get successful builds
1828428d7b3dSmrg# when there are problems that should be fixed.
1829428d7b3dSmrg
1830428d7b3dSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
1831428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
1832428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
1833428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
1834428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
1835428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
1836428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
1837428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
1838428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
1839428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
1840428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
1841428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
1842428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
1843428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
1844428d7b3dSmrgelse
1845428d7b3dSmrgAC_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])
1846428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
1847428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
1848428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
1849428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
1850428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
1851428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
1852428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
1853428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
1854428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
1855428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
1856428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
1857428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
1858428d7b3dSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
1859428d7b3dSmrgfi
1860428d7b3dSmrg
1861428d7b3dSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
1862428d7b3dSmrg]) # XORG_COMPILER_FLAGS
1863428d7b3dSmrg
1864428d7b3dSmrg# XORG_CWARNFLAGS
1865428d7b3dSmrg# ---------------
1866428d7b3dSmrg# Minimum version: 1.2.0
1867428d7b3dSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
1868428d7b3dSmrg#
1869428d7b3dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
1870428d7b3dSmrg#
1871428d7b3dSmrg# This function is deprecated because it defines -fno-strict-aliasing
1872428d7b3dSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
1873428d7b3dSmrg# is needed, then it should be added explicitly in the module when
1874428d7b3dSmrg# it is updated to use BASE_CFLAGS.
1875428d7b3dSmrg#
1876428d7b3dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
1877428d7b3dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
1878428d7b3dSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1879428d7b3dSmrgAC_LANG_CASE(
1880428d7b3dSmrg	[C], [
1881428d7b3dSmrg		CWARNFLAGS="$BASE_CFLAGS"
1882428d7b3dSmrg		if  test "x$GCC" = xyes ; then
1883428d7b3dSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
1884428d7b3dSmrg		fi
1885428d7b3dSmrg		AC_SUBST(CWARNFLAGS)
1886428d7b3dSmrg	]
1887428d7b3dSmrg)
1888428d7b3dSmrg]) # XORG_CWARNFLAGS
1889428d7b3dSmrg
1890428d7b3dSmrg# XORG_STRICT_OPTION
1891428d7b3dSmrg# -----------------------
1892428d7b3dSmrg# Minimum version: 1.3.0
1893428d7b3dSmrg#
1894428d7b3dSmrg# Add configure option to enable strict compilation flags, such as treating
1895428d7b3dSmrg# warnings as fatal errors.
1896428d7b3dSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
1897428d7b3dSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
1898428d7b3dSmrg#
1899428d7b3dSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
1900428d7b3dSmrg# when strict compilation is unconditionally desired.
1901428d7b3dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
1902428d7b3dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
1903428d7b3dSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
1904428d7b3dSmrg
1905428d7b3dSmrgAC_ARG_ENABLE(strict-compilation,
1906428d7b3dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
1907428d7b3dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
1908428d7b3dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
1909428d7b3dSmrg
1910428d7b3dSmrgAC_LANG_CASE(
1911428d7b3dSmrg        [C], [
1912428d7b3dSmrg                define([PREFIX], [C])
1913428d7b3dSmrg        ],
1914428d7b3dSmrg        [C++], [
1915428d7b3dSmrg                define([PREFIX], [CXX])
1916428d7b3dSmrg        ]
1917428d7b3dSmrg)
1918428d7b3dSmrg
1919428d7b3dSmrg[STRICT_]PREFIX[FLAGS]=""
1920428d7b3dSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
1921428d7b3dSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
1922428d7b3dSmrg
1923428d7b3dSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
1924428d7b3dSmrg# activate it with -Werror, so we add it here explicitly.
1925428d7b3dSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
1926428d7b3dSmrg
1927428d7b3dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
1928428d7b3dSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
1929428d7b3dSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
1930428d7b3dSmrgfi
1931428d7b3dSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
1932428d7b3dSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
1933428d7b3dSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
1934428d7b3dSmrg]) # XORG_STRICT_OPTION
1935428d7b3dSmrg
1936428d7b3dSmrg# XORG_DEFAULT_OPTIONS
1937428d7b3dSmrg# --------------------
1938428d7b3dSmrg# Minimum version: 1.3.0
1939428d7b3dSmrg#
1940428d7b3dSmrg# Defines default options for X.Org modules.
1941428d7b3dSmrg#
1942428d7b3dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
1943428d7b3dSmrgAC_REQUIRE([AC_PROG_INSTALL])
1944428d7b3dSmrgXORG_COMPILER_FLAGS
1945428d7b3dSmrgXORG_CWARNFLAGS
1946428d7b3dSmrgXORG_STRICT_OPTION
1947428d7b3dSmrgXORG_RELEASE_VERSION
1948428d7b3dSmrgXORG_CHANGELOG
1949428d7b3dSmrgXORG_INSTALL
1950428d7b3dSmrgXORG_MANPAGE_SECTIONS
1951428d7b3dSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
1952428d7b3dSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
1953428d7b3dSmrg]) # XORG_DEFAULT_OPTIONS
1954428d7b3dSmrg
1955428d7b3dSmrg# XORG_INSTALL()
1956428d7b3dSmrg# ----------------
1957428d7b3dSmrg# Minimum version: 1.4.0
1958428d7b3dSmrg#
1959428d7b3dSmrg# Defines the variable INSTALL_CMD as the command to copy
1960428d7b3dSmrg# INSTALL from $prefix/share/util-macros.
1961428d7b3dSmrg#
1962428d7b3dSmrgAC_DEFUN([XORG_INSTALL], [
1963428d7b3dSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1964428d7b3dSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
1965428d7b3dSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
1966428d7b3dSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
1967428d7b3dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
1968428d7b3dSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
1969428d7b3dSmrgAC_SUBST([INSTALL_CMD])
1970428d7b3dSmrg]) # XORG_INSTALL
1971428d7b3dSmrgdnl Copyright 2005 Red Hat, Inc
1972428d7b3dSmrgdnl
1973428d7b3dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1974428d7b3dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
1975428d7b3dSmrgdnl the above copyright notice appear in all copies and that both that
1976428d7b3dSmrgdnl copyright notice and this permission notice appear in supporting
1977428d7b3dSmrgdnl documentation.
1978428d7b3dSmrgdnl
1979428d7b3dSmrgdnl The above copyright notice and this permission notice shall be included
1980428d7b3dSmrgdnl in all copies or substantial portions of the Software.
1981428d7b3dSmrgdnl
1982428d7b3dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1983428d7b3dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1984428d7b3dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1985428d7b3dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1986428d7b3dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1987428d7b3dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1988428d7b3dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
1989428d7b3dSmrgdnl
1990428d7b3dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
1991428d7b3dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
1992428d7b3dSmrgdnl other dealings in this Software without prior written authorization
1993428d7b3dSmrgdnl from the copyright holders.
1994428d7b3dSmrgdnl
1995428d7b3dSmrg
1996428d7b3dSmrg# XORG_RELEASE_VERSION
1997428d7b3dSmrg# --------------------
1998428d7b3dSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
1999428d7b3dSmrg 
2000428d7b3dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2001428d7b3dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2002428d7b3dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2003428d7b3dSmrg		[Major version of this package])
2004428d7b3dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2005428d7b3dSmrg	if test "x$PVM" = "x"; then
2006428d7b3dSmrg		PVM="0"
2007428d7b3dSmrg	fi
2008428d7b3dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2009428d7b3dSmrg		[$PVM],
2010428d7b3dSmrg		[Minor version of this package])
2011428d7b3dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2012428d7b3dSmrg	if test "x$PVP" = "x"; then
2013428d7b3dSmrg		PVP="0"
2014428d7b3dSmrg	fi
2015428d7b3dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2016428d7b3dSmrg		[$PVP],
2017428d7b3dSmrg		[Patch version of this package])
2018428d7b3dSmrg])
2019428d7b3dSmrg
2020428d7b3dSmrg# XORG_CHANGELOG()
2021428d7b3dSmrg# ----------------
2022428d7b3dSmrg# Minimum version: 1.2.0
2023428d7b3dSmrg#
2024428d7b3dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
2025428d7b3dSmrg# ChangeLog from git.
2026428d7b3dSmrg#
2027428d7b3dSmrg#
2028428d7b3dSmrgAC_DEFUN([XORG_CHANGELOG], [
2029428d7b3dSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
2030428d7b3dSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
2031428d7b3dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
2032428d7b3dSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
2033428d7b3dSmrgAC_SUBST([CHANGELOG_CMD])
2034428d7b3dSmrg]) # XORG_CHANGELOG
2035428d7b3dSmrg
2036428d7b3dSmrgdnl Copyright 2005 Red Hat, Inc
2037428d7b3dSmrgdnl 
2038428d7b3dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2039428d7b3dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2040428d7b3dSmrgdnl the above copyright notice appear in all copies and that both that
2041428d7b3dSmrgdnl copyright notice and this permission notice appear in supporting
2042428d7b3dSmrgdnl documentation.
2043428d7b3dSmrgdnl 
2044428d7b3dSmrgdnl The above copyright notice and this permission notice shall be included
2045428d7b3dSmrgdnl in all copies or substantial portions of the Software.
2046428d7b3dSmrgdnl 
2047428d7b3dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2048428d7b3dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2049428d7b3dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2050428d7b3dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2051428d7b3dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2052428d7b3dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2053428d7b3dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2054428d7b3dSmrgdnl 
2055428d7b3dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2056428d7b3dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2057428d7b3dSmrgdnl other dealings in this Software without prior written authorization
2058428d7b3dSmrgdnl from the copyright holders.
2059428d7b3dSmrgdnl 
2060428d7b3dSmrg
2061428d7b3dSmrg# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
2062428d7b3dSmrg# --------------------------
2063428d7b3dSmrg# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
2064428d7b3dSmrg# is defined, then add the given PROTO to $REQUIRED_MODULES.
2065428d7b3dSmrg
2066428d7b3dSmrgAC_DEFUN([XORG_DRIVER_CHECK_EXT],[
2067428d7b3dSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2068428d7b3dSmrg	SAVE_CFLAGS="$CFLAGS"
2069428d7b3dSmrg	CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`"
2070428d7b3dSmrg	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2071428d7b3dSmrg#include "xorg-server.h"
2072428d7b3dSmrg#if !defined $1
2073428d7b3dSmrg#error $1 not defined
2074428d7b3dSmrg#endif
2075428d7b3dSmrg		]])],
2076428d7b3dSmrg		[_EXT_CHECK=yes],
2077428d7b3dSmrg		[_EXT_CHECK=no])
2078428d7b3dSmrg	CFLAGS="$SAVE_CFLAGS"
2079428d7b3dSmrg	AC_MSG_CHECKING([if $1 is defined])
2080428d7b3dSmrg	AC_MSG_RESULT([$_EXT_CHECK])
2081428d7b3dSmrg	if test "$_EXT_CHECK" != no; then
2082428d7b3dSmrg		REQUIRED_MODULES="$REQUIRED_MODULES $2"
2083428d7b3dSmrg	fi
2084428d7b3dSmrg])
2085428d7b3dSmrg
2086428d7b3dSmrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
2087428d7b3dSmrg#
2088428d7b3dSmrg# This file is free software; the Free Software Foundation
2089428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2090428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2091428d7b3dSmrg
2092428d7b3dSmrg# AM_AUTOMAKE_VERSION(VERSION)
2093428d7b3dSmrg# ----------------------------
2094428d7b3dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
2095428d7b3dSmrg# generated from the m4 files accompanying Automake X.Y.
2096428d7b3dSmrg# (This private macro should not be called outside this file.)
2097428d7b3dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
2098428d7b3dSmrg[am__api_version='1.14'
2099428d7b3dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
2100428d7b3dSmrgdnl require some minimum version.  Point them to the right macro.
2101428d7b3dSmrgm4_if([$1], [1.14.1], [],
2102428d7b3dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
2103428d7b3dSmrg])
2104428d7b3dSmrg
2105428d7b3dSmrg# _AM_AUTOCONF_VERSION(VERSION)
2106428d7b3dSmrg# -----------------------------
2107428d7b3dSmrg# aclocal traces this macro to find the Autoconf version.
2108428d7b3dSmrg# This is a private macro too.  Using m4_define simplifies
2109428d7b3dSmrg# the logic in aclocal, which can simply ignore this definition.
2110428d7b3dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
2111428d7b3dSmrg
2112428d7b3dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
2113428d7b3dSmrg# -------------------------------
2114428d7b3dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
2115428d7b3dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
2116428d7b3dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2117428d7b3dSmrg[AM_AUTOMAKE_VERSION([1.14.1])dnl
2118428d7b3dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
2119428d7b3dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
2120428d7b3dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
2121428d7b3dSmrg
2122428d7b3dSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2123428d7b3dSmrg
2124428d7b3dSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2125428d7b3dSmrg#
2126428d7b3dSmrg# This file is free software; the Free Software Foundation
2127428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2128428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2129428d7b3dSmrg
2130428d7b3dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2131428d7b3dSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
2132428d7b3dSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
2133428d7b3dSmrg#
2134428d7b3dSmrg# Of course, Automake must honor this variable whenever it calls a
2135428d7b3dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
2136428d7b3dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
2137428d7b3dSmrg# depending on how configure is run.  This is pretty annoying, since
2138428d7b3dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2139428d7b3dSmrg# source directory, any form will work fine, but in subdirectories a
2140428d7b3dSmrg# relative path needs to be adjusted first.
2141428d7b3dSmrg#
2142428d7b3dSmrg# $ac_aux_dir/missing
2143428d7b3dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
2144428d7b3dSmrg# $top_srcdir/$ac_aux_dir/missing
2145428d7b3dSmrg#    fails if $ac_aux_dir is absolute,
2146428d7b3dSmrg#    fails when called from a subdirectory in a VPATH build with
2147428d7b3dSmrg#          a relative $ac_aux_dir
2148428d7b3dSmrg#
2149428d7b3dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2150428d7b3dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
2151428d7b3dSmrg# harmless because $srcdir is '.', but things will broke when you
2152428d7b3dSmrg# start a VPATH build or use an absolute $srcdir.
2153428d7b3dSmrg#
2154428d7b3dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2155428d7b3dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2156428d7b3dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2157428d7b3dSmrg# and then we would define $MISSING as
2158428d7b3dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
2159428d7b3dSmrg# This will work as long as MISSING is not called from configure, because
2160428d7b3dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
2161428d7b3dSmrg# However there are other variables, like CC, which are often used in
2162428d7b3dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
2163428d7b3dSmrg#
2164428d7b3dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
2165428d7b3dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
2166428d7b3dSmrg# configured tree to be moved without reconfiguration.
2167428d7b3dSmrg
2168428d7b3dSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
2169428d7b3dSmrg[dnl Rely on autoconf to set up CDPATH properly.
2170428d7b3dSmrgAC_PREREQ([2.50])dnl
2171428d7b3dSmrg# expand $ac_aux_dir to an absolute path
2172428d7b3dSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
2173428d7b3dSmrg])
2174428d7b3dSmrg
2175428d7b3dSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
2176428d7b3dSmrg
2177428d7b3dSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
2178428d7b3dSmrg#
2179428d7b3dSmrg# This file is free software; the Free Software Foundation
2180428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2181428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2182428d7b3dSmrg
2183428d7b3dSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2184428d7b3dSmrg# -------------------------------------
2185428d7b3dSmrg# Define a conditional.
2186428d7b3dSmrgAC_DEFUN([AM_CONDITIONAL],
2187428d7b3dSmrg[AC_PREREQ([2.52])dnl
2188428d7b3dSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2189428d7b3dSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2190428d7b3dSmrgAC_SUBST([$1_TRUE])dnl
2191428d7b3dSmrgAC_SUBST([$1_FALSE])dnl
2192428d7b3dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
2193428d7b3dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
2194428d7b3dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
2195428d7b3dSmrgif $2; then
2196428d7b3dSmrg  $1_TRUE=
2197428d7b3dSmrg  $1_FALSE='#'
2198428d7b3dSmrgelse
2199428d7b3dSmrg  $1_TRUE='#'
2200428d7b3dSmrg  $1_FALSE=
2201428d7b3dSmrgfi
2202428d7b3dSmrgAC_CONFIG_COMMANDS_PRE(
2203428d7b3dSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2204428d7b3dSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
2205428d7b3dSmrgUsually this means the macro was only invoked conditionally.]])
2206428d7b3dSmrgfi])])
2207428d7b3dSmrg
2208428d7b3dSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2209428d7b3dSmrg#
2210428d7b3dSmrg# This file is free software; the Free Software Foundation
2211428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2212428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2213428d7b3dSmrg
2214428d7b3dSmrg
2215428d7b3dSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
2216428d7b3dSmrg# written in clear, in which case automake, when reading aclocal.m4,
2217428d7b3dSmrg# will think it sees a *use*, and therefore will trigger all it's
2218428d7b3dSmrg# C support machinery.  Also note that it means that autoscan, seeing
2219428d7b3dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2220428d7b3dSmrg
2221428d7b3dSmrg
2222428d7b3dSmrg# _AM_DEPENDENCIES(NAME)
2223428d7b3dSmrg# ----------------------
2224428d7b3dSmrg# See how the compiler implements dependency checking.
2225428d7b3dSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
2226428d7b3dSmrg# We try a few techniques and use that to set a single cache variable.
2227428d7b3dSmrg#
2228428d7b3dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2229428d7b3dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2230428d7b3dSmrg# dependency, and given that the user is not expected to run this macro,
2231428d7b3dSmrg# just rely on AC_PROG_CC.
2232428d7b3dSmrgAC_DEFUN([_AM_DEPENDENCIES],
2233428d7b3dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
2234428d7b3dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2235428d7b3dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
2236428d7b3dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
2237428d7b3dSmrg
2238428d7b3dSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
2239428d7b3dSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
2240428d7b3dSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2241428d7b3dSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
2242428d7b3dSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
2243428d7b3dSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2244428d7b3dSmrg                    [depcc="$$1"   am_compiler_list=])
2245428d7b3dSmrg
2246428d7b3dSmrgAC_CACHE_CHECK([dependency style of $depcc],
2247428d7b3dSmrg               [am_cv_$1_dependencies_compiler_type],
2248428d7b3dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2249428d7b3dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
2250428d7b3dSmrg  # making bogus files that we don't know about and never remove.  For
2251428d7b3dSmrg  # instance it was reported that on HP-UX the gcc test will end up
2252428d7b3dSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
2253428d7b3dSmrg  # in D".
2254428d7b3dSmrg  rm -rf conftest.dir
2255428d7b3dSmrg  mkdir conftest.dir
2256428d7b3dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
2257428d7b3dSmrg  # using a relative directory.
2258428d7b3dSmrg  cp "$am_depcomp" conftest.dir
2259428d7b3dSmrg  cd conftest.dir
2260428d7b3dSmrg  # We will build objects and dependencies in a subdirectory because
2261428d7b3dSmrg  # it helps to detect inapplicable dependency modes.  For instance
2262428d7b3dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
2263428d7b3dSmrg  # side effect of compilation, but ICC will put the dependencies in
2264428d7b3dSmrg  # the current directory while Tru64 will put them in the object
2265428d7b3dSmrg  # directory.
2266428d7b3dSmrg  mkdir sub
2267428d7b3dSmrg
2268428d7b3dSmrg  am_cv_$1_dependencies_compiler_type=none
2269428d7b3dSmrg  if test "$am_compiler_list" = ""; then
2270428d7b3dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2271428d7b3dSmrg  fi
2272428d7b3dSmrg  am__universal=false
2273428d7b3dSmrg  m4_case([$1], [CC],
2274428d7b3dSmrg    [case " $depcc " in #(
2275428d7b3dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2276428d7b3dSmrg     esac],
2277428d7b3dSmrg    [CXX],
2278428d7b3dSmrg    [case " $depcc " in #(
2279428d7b3dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2280428d7b3dSmrg     esac])
2281428d7b3dSmrg
2282428d7b3dSmrg  for depmode in $am_compiler_list; do
2283428d7b3dSmrg    # Setup a source with many dependencies, because some compilers
2284428d7b3dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2285428d7b3dSmrg    # we should not choose a depcomp mode which is confused by this.
2286428d7b3dSmrg    #
2287428d7b3dSmrg    # We need to recreate these files for each test, as the compiler may
2288428d7b3dSmrg    # overwrite some of them when testing with obscure command lines.
2289428d7b3dSmrg    # This happens at least with the AIX C compiler.
2290428d7b3dSmrg    : > sub/conftest.c
2291428d7b3dSmrg    for i in 1 2 3 4 5 6; do
2292428d7b3dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2293428d7b3dSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2294428d7b3dSmrg      # Solaris 10 /bin/sh.
2295428d7b3dSmrg      echo '/* dummy */' > sub/conftst$i.h
2296428d7b3dSmrg    done
2297428d7b3dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2298428d7b3dSmrg
2299428d7b3dSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2300428d7b3dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2301428d7b3dSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2302428d7b3dSmrg    # versions had trouble with output in subdirs.
2303428d7b3dSmrg    am__obj=sub/conftest.${OBJEXT-o}
2304428d7b3dSmrg    am__minus_obj="-o $am__obj"
2305428d7b3dSmrg    case $depmode in
2306428d7b3dSmrg    gcc)
2307428d7b3dSmrg      # This depmode causes a compiler race in universal mode.
2308428d7b3dSmrg      test "$am__universal" = false || continue
2309428d7b3dSmrg      ;;
2310428d7b3dSmrg    nosideeffect)
2311428d7b3dSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2312428d7b3dSmrg      # only be used when explicitly requested.
2313428d7b3dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2314428d7b3dSmrg	continue
2315428d7b3dSmrg      else
2316428d7b3dSmrg	break
2317428d7b3dSmrg      fi
2318428d7b3dSmrg      ;;
2319428d7b3dSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2320428d7b3dSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2321428d7b3dSmrg      # not run yet.  These depmodes are late enough in the game, and
2322428d7b3dSmrg      # so weak that their functioning should not be impacted.
2323428d7b3dSmrg      am__obj=conftest.${OBJEXT-o}
2324428d7b3dSmrg      am__minus_obj=
2325428d7b3dSmrg      ;;
2326428d7b3dSmrg    none) break ;;
2327428d7b3dSmrg    esac
2328428d7b3dSmrg    if depmode=$depmode \
2329428d7b3dSmrg       source=sub/conftest.c object=$am__obj \
2330428d7b3dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2331428d7b3dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2332428d7b3dSmrg         >/dev/null 2>conftest.err &&
2333428d7b3dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2334428d7b3dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2335428d7b3dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2336428d7b3dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2337428d7b3dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2338428d7b3dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2339428d7b3dSmrg      # that says an option was ignored or not supported.
2340428d7b3dSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2341428d7b3dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2342428d7b3dSmrg      # The diagnosis changed in icc 8.0:
2343428d7b3dSmrg      #   icc: Command line remark: option '-MP' not supported
2344428d7b3dSmrg      if (grep 'ignoring option' conftest.err ||
2345428d7b3dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2346428d7b3dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2347428d7b3dSmrg        break
2348428d7b3dSmrg      fi
2349428d7b3dSmrg    fi
2350428d7b3dSmrg  done
2351428d7b3dSmrg
2352428d7b3dSmrg  cd ..
2353428d7b3dSmrg  rm -rf conftest.dir
2354428d7b3dSmrgelse
2355428d7b3dSmrg  am_cv_$1_dependencies_compiler_type=none
2356428d7b3dSmrgfi
2357428d7b3dSmrg])
2358428d7b3dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2359428d7b3dSmrgAM_CONDITIONAL([am__fastdep$1], [
2360428d7b3dSmrg  test "x$enable_dependency_tracking" != xno \
2361428d7b3dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2362428d7b3dSmrg])
2363428d7b3dSmrg
2364428d7b3dSmrg
2365428d7b3dSmrg# AM_SET_DEPDIR
2366428d7b3dSmrg# -------------
2367428d7b3dSmrg# Choose a directory name for dependency files.
2368428d7b3dSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
2369428d7b3dSmrgAC_DEFUN([AM_SET_DEPDIR],
2370428d7b3dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2371428d7b3dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2372428d7b3dSmrg])
2373428d7b3dSmrg
2374428d7b3dSmrg
2375428d7b3dSmrg# AM_DEP_TRACK
2376428d7b3dSmrg# ------------
2377428d7b3dSmrgAC_DEFUN([AM_DEP_TRACK],
2378428d7b3dSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
2379428d7b3dSmrgAS_HELP_STRING(
2380428d7b3dSmrg  [--enable-dependency-tracking],
2381428d7b3dSmrg  [do not reject slow dependency extractors])
2382428d7b3dSmrgAS_HELP_STRING(
2383428d7b3dSmrg  [--disable-dependency-tracking],
2384428d7b3dSmrg  [speeds up one-time build])])
2385428d7b3dSmrgif test "x$enable_dependency_tracking" != xno; then
2386428d7b3dSmrg  am_depcomp="$ac_aux_dir/depcomp"
2387428d7b3dSmrg  AMDEPBACKSLASH='\'
2388428d7b3dSmrg  am__nodep='_no'
2389428d7b3dSmrgfi
2390428d7b3dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2391428d7b3dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
2392428d7b3dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
2393428d7b3dSmrgAC_SUBST([am__nodep])dnl
2394428d7b3dSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
2395428d7b3dSmrg])
2396428d7b3dSmrg
2397428d7b3dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
2398428d7b3dSmrg
2399428d7b3dSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2400428d7b3dSmrg#
2401428d7b3dSmrg# This file is free software; the Free Software Foundation
2402428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2403428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2404428d7b3dSmrg
2405428d7b3dSmrg
2406428d7b3dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
2407428d7b3dSmrg# ------------------------------
2408428d7b3dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2409428d7b3dSmrg[{
2410428d7b3dSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
2411428d7b3dSmrg  # are listed without --file.  Let's play safe and only enable the eval
2412428d7b3dSmrg  # if we detect the quoting.
2413428d7b3dSmrg  case $CONFIG_FILES in
2414428d7b3dSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
2415428d7b3dSmrg  *)   set x $CONFIG_FILES ;;
2416428d7b3dSmrg  esac
2417428d7b3dSmrg  shift
2418428d7b3dSmrg  for mf
2419428d7b3dSmrg  do
2420428d7b3dSmrg    # Strip MF so we end up with the name of the file.
2421428d7b3dSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
2422428d7b3dSmrg    # Check whether this is an Automake generated Makefile or not.
2423428d7b3dSmrg    # We used to match only the files named 'Makefile.in', but
2424428d7b3dSmrg    # some people rename them; so instead we look at the file content.
2425428d7b3dSmrg    # Grep'ing the first line is not enough: some people post-process
2426428d7b3dSmrg    # each Makefile.in and add a new line on top of each file to say so.
2427428d7b3dSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
2428428d7b3dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
2429428d7b3dSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
2430428d7b3dSmrg      dirpart=`AS_DIRNAME("$mf")`
2431428d7b3dSmrg    else
2432428d7b3dSmrg      continue
2433428d7b3dSmrg    fi
2434428d7b3dSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
2435428d7b3dSmrg    # from the Makefile without running 'make'.
2436428d7b3dSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
2437428d7b3dSmrg    test -z "$DEPDIR" && continue
2438428d7b3dSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
2439428d7b3dSmrg    test -z "$am__include" && continue
2440428d7b3dSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
2441428d7b3dSmrg    # Find all dependency output files, they are included files with
2442428d7b3dSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
2443428d7b3dSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
2444428d7b3dSmrg    # expansion.
2445428d7b3dSmrg    for file in `sed -n "
2446428d7b3dSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
2447428d7b3dSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
2448428d7b3dSmrg      # Make sure the directory exists.
2449428d7b3dSmrg      test -f "$dirpart/$file" && continue
2450428d7b3dSmrg      fdir=`AS_DIRNAME(["$file"])`
2451428d7b3dSmrg      AS_MKDIR_P([$dirpart/$fdir])
2452428d7b3dSmrg      # echo "creating $dirpart/$file"
2453428d7b3dSmrg      echo '# dummy' > "$dirpart/$file"
2454428d7b3dSmrg    done
2455428d7b3dSmrg  done
2456428d7b3dSmrg}
2457428d7b3dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2458428d7b3dSmrg
2459428d7b3dSmrg
2460428d7b3dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
2461428d7b3dSmrg# -----------------------------
2462428d7b3dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
2463428d7b3dSmrg#
2464428d7b3dSmrg# This code is only required when automatic dependency tracking
2465428d7b3dSmrg# is enabled.  FIXME.  This creates each '.P' file that we will
2466428d7b3dSmrg# need in order to bootstrap the dependency handling code.
2467428d7b3dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2468428d7b3dSmrg[AC_CONFIG_COMMANDS([depfiles],
2469428d7b3dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2470428d7b3dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2471428d7b3dSmrg])
2472428d7b3dSmrg
2473428d7b3dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
2474428d7b3dSmrg
2475428d7b3dSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2476428d7b3dSmrg#
2477428d7b3dSmrg# This file is free software; the Free Software Foundation
2478428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2479428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2480428d7b3dSmrg
2481428d7b3dSmrg# This macro actually does too much.  Some checks are only needed if
2482428d7b3dSmrg# your package does certain things.  But this isn't really a big deal.
2483428d7b3dSmrg
2484428d7b3dSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
2485428d7b3dSmrgm4_define([AC_PROG_CC],
2486428d7b3dSmrgm4_defn([AC_PROG_CC])
2487428d7b3dSmrg[_AM_PROG_CC_C_O
2488428d7b3dSmrg])
2489428d7b3dSmrg
2490428d7b3dSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
2491428d7b3dSmrg# AM_INIT_AUTOMAKE([OPTIONS])
2492428d7b3dSmrg# -----------------------------------------------
2493428d7b3dSmrg# The call with PACKAGE and VERSION arguments is the old style
2494428d7b3dSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
2495428d7b3dSmrg# and VERSION should now be passed to AC_INIT and removed from
2496428d7b3dSmrg# the call to AM_INIT_AUTOMAKE.
2497428d7b3dSmrg# We support both call styles for the transition.  After
2498428d7b3dSmrg# the next Automake release, Autoconf can make the AC_INIT
2499428d7b3dSmrg# arguments mandatory, and then we can depend on a new Autoconf
2500428d7b3dSmrg# release and drop the old call support.
2501428d7b3dSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
2502428d7b3dSmrg[AC_PREREQ([2.65])dnl
2503428d7b3dSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
2504428d7b3dSmrgdnl the ones we care about.
2505428d7b3dSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
2506428d7b3dSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
2507428d7b3dSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
2508428d7b3dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
2509428d7b3dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
2510428d7b3dSmrg  # is not polluted with repeated "-I."
2511428d7b3dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
2512428d7b3dSmrg  # test to see if srcdir already configured
2513428d7b3dSmrg  if test -f $srcdir/config.status; then
2514428d7b3dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2515428d7b3dSmrg  fi
2516428d7b3dSmrgfi
2517428d7b3dSmrg
2518428d7b3dSmrg# test whether we have cygpath
2519428d7b3dSmrgif test -z "$CYGPATH_W"; then
2520428d7b3dSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
2521428d7b3dSmrg    CYGPATH_W='cygpath -w'
2522428d7b3dSmrg  else
2523428d7b3dSmrg    CYGPATH_W=echo
2524428d7b3dSmrg  fi
2525428d7b3dSmrgfi
2526428d7b3dSmrgAC_SUBST([CYGPATH_W])
2527428d7b3dSmrg
2528428d7b3dSmrg# Define the identity of the package.
2529428d7b3dSmrgdnl Distinguish between old-style and new-style calls.
2530428d7b3dSmrgm4_ifval([$2],
2531428d7b3dSmrg[AC_DIAGNOSE([obsolete],
2532428d7b3dSmrg             [$0: two- and three-arguments forms are deprecated.])
2533428d7b3dSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
2534428d7b3dSmrg AC_SUBST([PACKAGE], [$1])dnl
2535428d7b3dSmrg AC_SUBST([VERSION], [$2])],
2536428d7b3dSmrg[_AM_SET_OPTIONS([$1])dnl
2537428d7b3dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
2538428d7b3dSmrgm4_if(
2539428d7b3dSmrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
2540428d7b3dSmrg  [ok:ok],,
2541428d7b3dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
2542428d7b3dSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
2543428d7b3dSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
2544428d7b3dSmrg
2545428d7b3dSmrg_AM_IF_OPTION([no-define],,
2546428d7b3dSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
2547428d7b3dSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
2548428d7b3dSmrg
2549428d7b3dSmrg# Some tools Automake needs.
2550428d7b3dSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
2551428d7b3dSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
2552428d7b3dSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
2553428d7b3dSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
2554428d7b3dSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
2555428d7b3dSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
2556428d7b3dSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
2557428d7b3dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2558428d7b3dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
2559428d7b3dSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
2560428d7b3dSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
2561428d7b3dSmrg# dies out for good.  For more background, see:
2562428d7b3dSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
2563428d7b3dSmrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
2564428d7b3dSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
2565428d7b3dSmrg# We need awk for the "check" target.  The system "awk" is bad on
2566428d7b3dSmrg# some platforms.
2567428d7b3dSmrgAC_REQUIRE([AC_PROG_AWK])dnl
2568428d7b3dSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
2569428d7b3dSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
2570428d7b3dSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
2571428d7b3dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
2572428d7b3dSmrg			     [_AM_PROG_TAR([v7])])])
2573428d7b3dSmrg_AM_IF_OPTION([no-dependencies],,
2574428d7b3dSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
2575428d7b3dSmrg		  [_AM_DEPENDENCIES([CC])],
2576428d7b3dSmrg		  [m4_define([AC_PROG_CC],
2577428d7b3dSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
2578428d7b3dSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
2579428d7b3dSmrg		  [_AM_DEPENDENCIES([CXX])],
2580428d7b3dSmrg		  [m4_define([AC_PROG_CXX],
2581428d7b3dSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
2582428d7b3dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
2583428d7b3dSmrg		  [_AM_DEPENDENCIES([OBJC])],
2584428d7b3dSmrg		  [m4_define([AC_PROG_OBJC],
2585428d7b3dSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
2586428d7b3dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
2587428d7b3dSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
2588428d7b3dSmrg		  [m4_define([AC_PROG_OBJCXX],
2589428d7b3dSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
2590428d7b3dSmrg])
2591428d7b3dSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
2592428d7b3dSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
2593428d7b3dSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
2594428d7b3dSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
2595428d7b3dSmrgAC_CONFIG_COMMANDS_PRE(dnl
2596428d7b3dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
2597428d7b3dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
2598428d7b3dSmrg
2599428d7b3dSmrg# POSIX will say in a future version that running "rm -f" with no argument
2600428d7b3dSmrg# is OK; and we want to be able to make that assumption in our Makefile
2601428d7b3dSmrg# recipes.  So use an aggressive probe to check that the usage we want is
2602428d7b3dSmrg# actually supported "in the wild" to an acceptable degree.
2603428d7b3dSmrg# See automake bug#10828.
2604428d7b3dSmrg# To make any issue more visible, cause the running configure to be aborted
2605428d7b3dSmrg# by default if the 'rm' program in use doesn't match our expectations; the
2606428d7b3dSmrg# user can still override this though.
2607428d7b3dSmrgif rm -f && rm -fr && rm -rf; then : OK; else
2608428d7b3dSmrg  cat >&2 <<'END'
2609428d7b3dSmrgOops!
2610428d7b3dSmrg
2611428d7b3dSmrgYour 'rm' program seems unable to run without file operands specified
2612428d7b3dSmrgon the command line, even when the '-f' option is present.  This is contrary
2613428d7b3dSmrgto the behaviour of most rm programs out there, and not conforming with
2614428d7b3dSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
2615428d7b3dSmrg
2616428d7b3dSmrgPlease tell bug-automake@gnu.org about your system, including the value
2617428d7b3dSmrgof your $PATH and any error possibly output before this message.  This
2618428d7b3dSmrgcan help us improve future automake versions.
2619428d7b3dSmrg
2620428d7b3dSmrgEND
2621428d7b3dSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
2622428d7b3dSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
2623428d7b3dSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
2624428d7b3dSmrg    echo >&2
2625428d7b3dSmrg  else
2626428d7b3dSmrg    cat >&2 <<'END'
2627428d7b3dSmrgAborting the configuration process, to ensure you take notice of the issue.
2628428d7b3dSmrg
2629428d7b3dSmrgYou can download and install GNU coreutils to get an 'rm' implementation
2630428d7b3dSmrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
2631428d7b3dSmrg
2632428d7b3dSmrgIf you want to complete the configuration process using your problematic
2633428d7b3dSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
2634428d7b3dSmrgto "yes", and re-run configure.
2635428d7b3dSmrg
2636428d7b3dSmrgEND
2637428d7b3dSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
2638428d7b3dSmrg  fi
2639428d7b3dSmrgfi])
2640428d7b3dSmrg
2641428d7b3dSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
2642428d7b3dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
2643428d7b3dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
2644428d7b3dSmrgm4_define([_AC_COMPILER_EXEEXT],
2645428d7b3dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
2646428d7b3dSmrg
2647428d7b3dSmrg# When config.status generates a header, we must update the stamp-h file.
2648428d7b3dSmrg# This file resides in the same directory as the config header
2649428d7b3dSmrg# that is generated.  The stamp files are numbered to have different names.
2650428d7b3dSmrg
2651428d7b3dSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
2652428d7b3dSmrg# loop where config.status creates the headers, so we can generate
2653428d7b3dSmrg# our stamp files there.
2654428d7b3dSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
2655428d7b3dSmrg[# Compute $1's index in $config_headers.
2656428d7b3dSmrg_am_arg=$1
2657428d7b3dSmrg_am_stamp_count=1
2658428d7b3dSmrgfor _am_header in $config_headers :; do
2659428d7b3dSmrg  case $_am_header in
2660428d7b3dSmrg    $_am_arg | $_am_arg:* )
2661428d7b3dSmrg      break ;;
2662428d7b3dSmrg    * )
2663428d7b3dSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
2664428d7b3dSmrg  esac
2665428d7b3dSmrgdone
2666428d7b3dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
2667428d7b3dSmrg
2668428d7b3dSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2669428d7b3dSmrg#
2670428d7b3dSmrg# This file is free software; the Free Software Foundation
2671428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2672428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2673428d7b3dSmrg
2674428d7b3dSmrg# AM_PROG_INSTALL_SH
2675428d7b3dSmrg# ------------------
2676428d7b3dSmrg# Define $install_sh.
2677428d7b3dSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
2678428d7b3dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2679428d7b3dSmrgif test x"${install_sh}" != xset; then
2680428d7b3dSmrg  case $am_aux_dir in
2681428d7b3dSmrg  *\ * | *\	*)
2682428d7b3dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2683428d7b3dSmrg  *)
2684428d7b3dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
2685428d7b3dSmrg  esac
2686428d7b3dSmrgfi
2687428d7b3dSmrgAC_SUBST([install_sh])])
2688428d7b3dSmrg
2689428d7b3dSmrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
2690428d7b3dSmrg#
2691428d7b3dSmrg# This file is free software; the Free Software Foundation
2692428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2693428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2694428d7b3dSmrg
2695428d7b3dSmrg# Check whether the underlying file-system supports filenames
2696428d7b3dSmrg# with a leading dot.  For instance MS-DOS doesn't.
2697428d7b3dSmrgAC_DEFUN([AM_SET_LEADING_DOT],
2698428d7b3dSmrg[rm -rf .tst 2>/dev/null
2699428d7b3dSmrgmkdir .tst 2>/dev/null
2700428d7b3dSmrgif test -d .tst; then
2701428d7b3dSmrg  am__leading_dot=.
2702428d7b3dSmrgelse
2703428d7b3dSmrg  am__leading_dot=_
2704428d7b3dSmrgfi
2705428d7b3dSmrgrmdir .tst 2>/dev/null
2706428d7b3dSmrgAC_SUBST([am__leading_dot])])
2707428d7b3dSmrg
2708428d7b3dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
2709428d7b3dSmrg
2710428d7b3dSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2711428d7b3dSmrg#
2712428d7b3dSmrg# This file is free software; the Free Software Foundation
2713428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2714428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2715428d7b3dSmrg
2716428d7b3dSmrg# AM_MAKE_INCLUDE()
2717428d7b3dSmrg# -----------------
2718428d7b3dSmrg# Check to see how make treats includes.
2719428d7b3dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
2720428d7b3dSmrg[am_make=${MAKE-make}
2721428d7b3dSmrgcat > confinc << 'END'
2722428d7b3dSmrgam__doit:
2723428d7b3dSmrg	@echo this is the am__doit target
2724428d7b3dSmrg.PHONY: am__doit
2725428d7b3dSmrgEND
2726428d7b3dSmrg# If we don't find an include directive, just comment out the code.
2727428d7b3dSmrgAC_MSG_CHECKING([for style of include used by $am_make])
2728428d7b3dSmrgam__include="#"
2729428d7b3dSmrgam__quote=
2730428d7b3dSmrg_am_result=none
2731428d7b3dSmrg# First try GNU make style include.
2732428d7b3dSmrgecho "include confinc" > confmf
2733428d7b3dSmrg# Ignore all kinds of additional output from 'make'.
2734428d7b3dSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
2735428d7b3dSmrg*the\ am__doit\ target*)
2736428d7b3dSmrg  am__include=include
2737428d7b3dSmrg  am__quote=
2738428d7b3dSmrg  _am_result=GNU
2739428d7b3dSmrg  ;;
2740428d7b3dSmrgesac
2741428d7b3dSmrg# Now try BSD make style include.
2742428d7b3dSmrgif test "$am__include" = "#"; then
2743428d7b3dSmrg   echo '.include "confinc"' > confmf
2744428d7b3dSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
2745428d7b3dSmrg   *the\ am__doit\ target*)
2746428d7b3dSmrg     am__include=.include
2747428d7b3dSmrg     am__quote="\""
2748428d7b3dSmrg     _am_result=BSD
2749428d7b3dSmrg     ;;
2750428d7b3dSmrg   esac
2751428d7b3dSmrgfi
2752428d7b3dSmrgAC_SUBST([am__include])
2753428d7b3dSmrgAC_SUBST([am__quote])
2754428d7b3dSmrgAC_MSG_RESULT([$_am_result])
2755428d7b3dSmrgrm -f confinc confmf
2756428d7b3dSmrg])
2757428d7b3dSmrg
2758428d7b3dSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
2759428d7b3dSmrg
2760428d7b3dSmrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
2761428d7b3dSmrg#
2762428d7b3dSmrg# This file is free software; the Free Software Foundation
2763428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2764428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2765428d7b3dSmrg
2766428d7b3dSmrg# AM_MISSING_PROG(NAME, PROGRAM)
2767428d7b3dSmrg# ------------------------------
2768428d7b3dSmrgAC_DEFUN([AM_MISSING_PROG],
2769428d7b3dSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
2770428d7b3dSmrg$1=${$1-"${am_missing_run}$2"}
2771428d7b3dSmrgAC_SUBST($1)])
2772428d7b3dSmrg
2773428d7b3dSmrg# AM_MISSING_HAS_RUN
2774428d7b3dSmrg# ------------------
2775428d7b3dSmrg# Define MISSING if not defined so far and test if it is modern enough.
2776428d7b3dSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
2777428d7b3dSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
2778428d7b3dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2779428d7b3dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
2780428d7b3dSmrgif test x"${MISSING+set}" != xset; then
2781428d7b3dSmrg  case $am_aux_dir in
2782428d7b3dSmrg  *\ * | *\	*)
2783428d7b3dSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2784428d7b3dSmrg  *)
2785428d7b3dSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
2786428d7b3dSmrg  esac
2787428d7b3dSmrgfi
2788428d7b3dSmrg# Use eval to expand $SHELL
2789428d7b3dSmrgif eval "$MISSING --is-lightweight"; then
2790428d7b3dSmrg  am_missing_run="$MISSING "
2791428d7b3dSmrgelse
2792428d7b3dSmrg  am_missing_run=
2793428d7b3dSmrg  AC_MSG_WARN(['missing' script is too old or missing])
2794428d7b3dSmrgfi
2795428d7b3dSmrg])
2796428d7b3dSmrg
2797428d7b3dSmrg# Helper functions for option handling.                     -*- Autoconf -*-
2798428d7b3dSmrg
2799428d7b3dSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2800428d7b3dSmrg#
2801428d7b3dSmrg# This file is free software; the Free Software Foundation
2802428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2803428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2804428d7b3dSmrg
2805428d7b3dSmrg# _AM_MANGLE_OPTION(NAME)
2806428d7b3dSmrg# -----------------------
2807428d7b3dSmrgAC_DEFUN([_AM_MANGLE_OPTION],
2808428d7b3dSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
2809428d7b3dSmrg
2810428d7b3dSmrg# _AM_SET_OPTION(NAME)
2811428d7b3dSmrg# --------------------
2812428d7b3dSmrg# Set option NAME.  Presently that only means defining a flag for this option.
2813428d7b3dSmrgAC_DEFUN([_AM_SET_OPTION],
2814428d7b3dSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
2815428d7b3dSmrg
2816428d7b3dSmrg# _AM_SET_OPTIONS(OPTIONS)
2817428d7b3dSmrg# ------------------------
2818428d7b3dSmrg# OPTIONS is a space-separated list of Automake options.
2819428d7b3dSmrgAC_DEFUN([_AM_SET_OPTIONS],
2820428d7b3dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2821428d7b3dSmrg
2822428d7b3dSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2823428d7b3dSmrg# -------------------------------------------
2824428d7b3dSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2825428d7b3dSmrgAC_DEFUN([_AM_IF_OPTION],
2826428d7b3dSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2827428d7b3dSmrg
2828428d7b3dSmrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
2829428d7b3dSmrg#
2830428d7b3dSmrg# This file is free software; the Free Software Foundation
2831428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2832428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2833428d7b3dSmrg
2834428d7b3dSmrg# _AM_PROG_CC_C_O
2835428d7b3dSmrg# ---------------
2836428d7b3dSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
2837428d7b3dSmrg# to automatically call this.
2838428d7b3dSmrgAC_DEFUN([_AM_PROG_CC_C_O],
2839428d7b3dSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2840428d7b3dSmrgAC_REQUIRE_AUX_FILE([compile])dnl
2841428d7b3dSmrgAC_LANG_PUSH([C])dnl
2842428d7b3dSmrgAC_CACHE_CHECK(
2843428d7b3dSmrg  [whether $CC understands -c and -o together],
2844428d7b3dSmrg  [am_cv_prog_cc_c_o],
2845428d7b3dSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
2846428d7b3dSmrg  # Make sure it works both with $CC and with simple cc.
2847428d7b3dSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
2848428d7b3dSmrg  # compilers refuse to overwrite an existing .o file with -o,
2849428d7b3dSmrg  # though they will create one.
2850428d7b3dSmrg  am_cv_prog_cc_c_o=yes
2851428d7b3dSmrg  for am_i in 1 2; do
2852428d7b3dSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
2853428d7b3dSmrg         && test -f conftest2.$ac_objext; then
2854428d7b3dSmrg      : OK
2855428d7b3dSmrg    else
2856428d7b3dSmrg      am_cv_prog_cc_c_o=no
2857428d7b3dSmrg      break
2858428d7b3dSmrg    fi
2859428d7b3dSmrg  done
2860428d7b3dSmrg  rm -f core conftest*
2861428d7b3dSmrg  unset am_i])
2862428d7b3dSmrgif test "$am_cv_prog_cc_c_o" != yes; then
2863428d7b3dSmrg   # Losing compiler, so override with the script.
2864428d7b3dSmrg   # FIXME: It is wrong to rewrite CC.
2865428d7b3dSmrg   # But if we don't then we get into trouble of one sort or another.
2866428d7b3dSmrg   # A longer-term fix would be to have automake use am__CC in this case,
2867428d7b3dSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
2868428d7b3dSmrg   CC="$am_aux_dir/compile $CC"
2869428d7b3dSmrgfi
2870428d7b3dSmrgAC_LANG_POP([C])])
2871428d7b3dSmrg
2872428d7b3dSmrg# For backward compatibility.
2873428d7b3dSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
2874428d7b3dSmrg
2875428d7b3dSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
2876428d7b3dSmrg#
2877428d7b3dSmrg# This file is free software; the Free Software Foundation
2878428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2879428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2880428d7b3dSmrg
2881428d7b3dSmrg# AM_RUN_LOG(COMMAND)
2882428d7b3dSmrg# -------------------
2883428d7b3dSmrg# Run COMMAND, save the exit status in ac_status, and log it.
2884428d7b3dSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
2885428d7b3dSmrgAC_DEFUN([AM_RUN_LOG],
2886428d7b3dSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
2887428d7b3dSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
2888428d7b3dSmrg   ac_status=$?
2889428d7b3dSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
2890428d7b3dSmrg   (exit $ac_status); }])
2891428d7b3dSmrg
2892428d7b3dSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
2893428d7b3dSmrg
2894428d7b3dSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
2895428d7b3dSmrg#
2896428d7b3dSmrg# This file is free software; the Free Software Foundation
2897428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2898428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2899428d7b3dSmrg
2900428d7b3dSmrg# AM_SANITY_CHECK
2901428d7b3dSmrg# ---------------
2902428d7b3dSmrgAC_DEFUN([AM_SANITY_CHECK],
2903428d7b3dSmrg[AC_MSG_CHECKING([whether build environment is sane])
2904428d7b3dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
2905428d7b3dSmrg# name.  Accept space and tab only in the latter.
2906428d7b3dSmrgam_lf='
2907428d7b3dSmrg'
2908428d7b3dSmrgcase `pwd` in
2909428d7b3dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
2910428d7b3dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
2911428d7b3dSmrgesac
2912428d7b3dSmrgcase $srcdir in
2913428d7b3dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
2914428d7b3dSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
2915428d7b3dSmrgesac
2916428d7b3dSmrg
2917428d7b3dSmrg# Do 'set' in a subshell so we don't clobber the current shell's
2918428d7b3dSmrg# arguments.  Must try -L first in case configure is actually a
2919428d7b3dSmrg# symlink; some systems play weird games with the mod time of symlinks
2920428d7b3dSmrg# (eg FreeBSD returns the mod time of the symlink's containing
2921428d7b3dSmrg# directory).
2922428d7b3dSmrgif (
2923428d7b3dSmrg   am_has_slept=no
2924428d7b3dSmrg   for am_try in 1 2; do
2925428d7b3dSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
2926428d7b3dSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
2927428d7b3dSmrg     if test "$[*]" = "X"; then
2928428d7b3dSmrg	# -L didn't work.
2929428d7b3dSmrg	set X `ls -t "$srcdir/configure" conftest.file`
2930428d7b3dSmrg     fi
2931428d7b3dSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
2932428d7b3dSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
2933428d7b3dSmrg
2934428d7b3dSmrg	# If neither matched, then we have a broken ls.  This can happen
2935428d7b3dSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
2936428d7b3dSmrg	# broken ls alias from the environment.  This has actually
2937428d7b3dSmrg	# happened.  Such a system could not be considered "sane".
2938428d7b3dSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2939428d7b3dSmrg  alias in your environment])
2940428d7b3dSmrg     fi
2941428d7b3dSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
2942428d7b3dSmrg       break
2943428d7b3dSmrg     fi
2944428d7b3dSmrg     # Just in case.
2945428d7b3dSmrg     sleep 1
2946428d7b3dSmrg     am_has_slept=yes
2947428d7b3dSmrg   done
2948428d7b3dSmrg   test "$[2]" = conftest.file
2949428d7b3dSmrg   )
2950428d7b3dSmrgthen
2951428d7b3dSmrg   # Ok.
2952428d7b3dSmrg   :
2953428d7b3dSmrgelse
2954428d7b3dSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
2955428d7b3dSmrgCheck your system clock])
2956428d7b3dSmrgfi
2957428d7b3dSmrgAC_MSG_RESULT([yes])
2958428d7b3dSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
2959428d7b3dSmrg# generated files are strictly newer.
2960428d7b3dSmrgam_sleep_pid=
2961428d7b3dSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
2962428d7b3dSmrg  ( sleep 1 ) &
2963428d7b3dSmrg  am_sleep_pid=$!
2964428d7b3dSmrgfi
2965428d7b3dSmrgAC_CONFIG_COMMANDS_PRE(
2966428d7b3dSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
2967428d7b3dSmrg   if test -n "$am_sleep_pid"; then
2968428d7b3dSmrg     # Hide warnings about reused PIDs.
2969428d7b3dSmrg     wait $am_sleep_pid 2>/dev/null
2970428d7b3dSmrg   fi
2971428d7b3dSmrg   AC_MSG_RESULT([done])])
2972428d7b3dSmrgrm -f conftest.file
2973428d7b3dSmrg])
2974428d7b3dSmrg
2975428d7b3dSmrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
2976428d7b3dSmrg#
2977428d7b3dSmrg# This file is free software; the Free Software Foundation
2978428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
2979428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
2980428d7b3dSmrg
2981428d7b3dSmrg# AM_SILENT_RULES([DEFAULT])
2982428d7b3dSmrg# --------------------------
2983428d7b3dSmrg# Enable less verbose build rules; with the default set to DEFAULT
2984428d7b3dSmrg# ("yes" being less verbose, "no" or empty being verbose).
2985428d7b3dSmrgAC_DEFUN([AM_SILENT_RULES],
2986428d7b3dSmrg[AC_ARG_ENABLE([silent-rules], [dnl
2987428d7b3dSmrgAS_HELP_STRING(
2988428d7b3dSmrg  [--enable-silent-rules],
2989428d7b3dSmrg  [less verbose build output (undo: "make V=1")])
2990428d7b3dSmrgAS_HELP_STRING(
2991428d7b3dSmrg  [--disable-silent-rules],
2992428d7b3dSmrg  [verbose build output (undo: "make V=0")])dnl
2993428d7b3dSmrg])
2994428d7b3dSmrgcase $enable_silent_rules in @%:@ (((
2995428d7b3dSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
2996428d7b3dSmrg   no) AM_DEFAULT_VERBOSITY=1;;
2997428d7b3dSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
2998428d7b3dSmrgesac
2999428d7b3dSmrgdnl
3000428d7b3dSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
3001428d7b3dSmrgdnl do not support nested variable expansions.
3002428d7b3dSmrgdnl See automake bug#9928 and bug#10237.
3003428d7b3dSmrgam_make=${MAKE-make}
3004428d7b3dSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
3005428d7b3dSmrg   [am_cv_make_support_nested_variables],
3006428d7b3dSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
3007428d7b3dSmrgBAR0=false
3008428d7b3dSmrgBAR1=true
3009428d7b3dSmrgV=1
3010428d7b3dSmrgam__doit:
3011428d7b3dSmrg	@$(TRUE)
3012428d7b3dSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
3013428d7b3dSmrg  am_cv_make_support_nested_variables=yes
3014428d7b3dSmrgelse
3015428d7b3dSmrg  am_cv_make_support_nested_variables=no
3016428d7b3dSmrgfi])
3017428d7b3dSmrgif test $am_cv_make_support_nested_variables = yes; then
3018428d7b3dSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
3019428d7b3dSmrg  AM_V='$(V)'
3020428d7b3dSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3021428d7b3dSmrgelse
3022428d7b3dSmrg  AM_V=$AM_DEFAULT_VERBOSITY
3023428d7b3dSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3024428d7b3dSmrgfi
3025428d7b3dSmrgAC_SUBST([AM_V])dnl
3026428d7b3dSmrgAM_SUBST_NOTMAKE([AM_V])dnl
3027428d7b3dSmrgAC_SUBST([AM_DEFAULT_V])dnl
3028428d7b3dSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
3029428d7b3dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
3030428d7b3dSmrgAM_BACKSLASH='\'
3031428d7b3dSmrgAC_SUBST([AM_BACKSLASH])dnl
3032428d7b3dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
3033428d7b3dSmrg])
3034428d7b3dSmrg
3035428d7b3dSmrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
3036428d7b3dSmrg#
3037428d7b3dSmrg# This file is free software; the Free Software Foundation
3038428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
3039428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
3040428d7b3dSmrg
3041428d7b3dSmrg# AM_PROG_INSTALL_STRIP
3042428d7b3dSmrg# ---------------------
3043428d7b3dSmrg# One issue with vendor 'install' (even GNU) is that you can't
3044428d7b3dSmrg# specify the program used to strip binaries.  This is especially
3045428d7b3dSmrg# annoying in cross-compiling environments, where the build's strip
3046428d7b3dSmrg# is unlikely to handle the host's binaries.
3047428d7b3dSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
3048428d7b3dSmrg# always use install-sh in "make install-strip", and initialize
3049428d7b3dSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
3050428d7b3dSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
3051428d7b3dSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3052428d7b3dSmrg# Installed binaries are usually stripped using 'strip' when the user
3053428d7b3dSmrg# run "make install-strip".  However 'strip' might not be the right
3054428d7b3dSmrg# tool to use in cross-compilation environments, therefore Automake
3055428d7b3dSmrg# will honor the 'STRIP' environment variable to overrule this program.
3056428d7b3dSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
3057428d7b3dSmrgif test "$cross_compiling" != no; then
3058428d7b3dSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
3059428d7b3dSmrgfi
3060428d7b3dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
3061428d7b3dSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
3062428d7b3dSmrg
3063428d7b3dSmrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
3064428d7b3dSmrg#
3065428d7b3dSmrg# This file is free software; the Free Software Foundation
3066428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
3067428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
3068428d7b3dSmrg
3069428d7b3dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
3070428d7b3dSmrg# ---------------------------
3071428d7b3dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
3072428d7b3dSmrg# This macro is traced by Automake.
3073428d7b3dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
3074428d7b3dSmrg
3075428d7b3dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
3076428d7b3dSmrg# --------------------------
3077428d7b3dSmrg# Public sister of _AM_SUBST_NOTMAKE.
3078428d7b3dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
3079428d7b3dSmrg
3080428d7b3dSmrg# Check how to create a tarball.                            -*- Autoconf -*-
3081428d7b3dSmrg
3082428d7b3dSmrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
3083428d7b3dSmrg#
3084428d7b3dSmrg# This file is free software; the Free Software Foundation
3085428d7b3dSmrg# gives unlimited permission to copy and/or distribute it,
3086428d7b3dSmrg# with or without modifications, as long as this notice is preserved.
3087428d7b3dSmrg
3088428d7b3dSmrg# _AM_PROG_TAR(FORMAT)
3089428d7b3dSmrg# --------------------
3090428d7b3dSmrg# Check how to create a tarball in format FORMAT.
3091428d7b3dSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
3092428d7b3dSmrg#
3093428d7b3dSmrg# Substitute a variable $(am__tar) that is a command
3094428d7b3dSmrg# writing to stdout a FORMAT-tarball containing the directory
3095428d7b3dSmrg# $tardir.
3096428d7b3dSmrg#     tardir=directory && $(am__tar) > result.tar
3097428d7b3dSmrg#
3098428d7b3dSmrg# Substitute a variable $(am__untar) that extract such
3099428d7b3dSmrg# a tarball read from stdin.
3100428d7b3dSmrg#     $(am__untar) < result.tar
3101428d7b3dSmrg#
3102428d7b3dSmrgAC_DEFUN([_AM_PROG_TAR],
3103428d7b3dSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
3104428d7b3dSmrg# in the wild :-(  We should find a proper way to deprecate it ...
3105428d7b3dSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
3106428d7b3dSmrg
3107428d7b3dSmrg# We'll loop over all known methods to create a tar archive until one works.
3108428d7b3dSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3109428d7b3dSmrg
3110428d7b3dSmrgm4_if([$1], [v7],
3111428d7b3dSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
3112428d7b3dSmrg
3113428d7b3dSmrg  [m4_case([$1],
3114428d7b3dSmrg    [ustar],
3115428d7b3dSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
3116428d7b3dSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
3117428d7b3dSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
3118428d7b3dSmrg      # and bug#13588).
3119428d7b3dSmrg      am_max_uid=2097151 # 2^21 - 1
3120428d7b3dSmrg      am_max_gid=$am_max_uid
3121428d7b3dSmrg      # The $UID and $GID variables are not portable, so we need to resort
3122428d7b3dSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
3123428d7b3dSmrg      # below are definitely unexpected, so allow the users to see them
3124428d7b3dSmrg      # (that is, avoid stderr redirection).
3125428d7b3dSmrg      am_uid=`id -u || echo unknown`
3126428d7b3dSmrg      am_gid=`id -g || echo unknown`
3127428d7b3dSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
3128428d7b3dSmrg      if test $am_uid -le $am_max_uid; then
3129428d7b3dSmrg         AC_MSG_RESULT([yes])
3130428d7b3dSmrg      else
3131428d7b3dSmrg         AC_MSG_RESULT([no])
3132428d7b3dSmrg         _am_tools=none
3133428d7b3dSmrg      fi
3134428d7b3dSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
3135428d7b3dSmrg      if test $am_gid -le $am_max_gid; then
3136428d7b3dSmrg         AC_MSG_RESULT([yes])
3137428d7b3dSmrg      else
3138428d7b3dSmrg        AC_MSG_RESULT([no])
3139428d7b3dSmrg        _am_tools=none
3140428d7b3dSmrg      fi],
3141428d7b3dSmrg
3142428d7b3dSmrg  [pax],
3143428d7b3dSmrg    [],
3144428d7b3dSmrg
3145428d7b3dSmrg  [m4_fatal([Unknown tar format])])
3146428d7b3dSmrg
3147428d7b3dSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
3148428d7b3dSmrg
3149428d7b3dSmrg  # Go ahead even if we have the value already cached.  We do so because we
3150428d7b3dSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
3151428d7b3dSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
3152428d7b3dSmrg
3153428d7b3dSmrg  for _am_tool in $_am_tools; do
3154428d7b3dSmrg    case $_am_tool in
3155428d7b3dSmrg    gnutar)
3156428d7b3dSmrg      for _am_tar in tar gnutar gtar; do
3157428d7b3dSmrg        AM_RUN_LOG([$_am_tar --version]) && break
3158428d7b3dSmrg      done
3159428d7b3dSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3160428d7b3dSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3161428d7b3dSmrg      am__untar="$_am_tar -xf -"
3162428d7b3dSmrg      ;;
3163428d7b3dSmrg    plaintar)
3164428d7b3dSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
3165428d7b3dSmrg      # ustar tarball either.
3166428d7b3dSmrg      (tar --version) >/dev/null 2>&1 && continue
3167428d7b3dSmrg      am__tar='tar chf - "$$tardir"'
3168428d7b3dSmrg      am__tar_='tar chf - "$tardir"'
3169428d7b3dSmrg      am__untar='tar xf -'
3170428d7b3dSmrg      ;;
3171428d7b3dSmrg    pax)
3172428d7b3dSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
3173428d7b3dSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
3174428d7b3dSmrg      am__untar='pax -r'
3175428d7b3dSmrg      ;;
3176428d7b3dSmrg    cpio)
3177428d7b3dSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3178428d7b3dSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3179428d7b3dSmrg      am__untar='cpio -i -H $1 -d'
3180428d7b3dSmrg      ;;
3181428d7b3dSmrg    none)
3182428d7b3dSmrg      am__tar=false
3183428d7b3dSmrg      am__tar_=false
3184428d7b3dSmrg      am__untar=false
3185428d7b3dSmrg      ;;
3186428d7b3dSmrg    esac
3187428d7b3dSmrg
3188428d7b3dSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
3189428d7b3dSmrg    # and am__untar set.
3190428d7b3dSmrg    test -n "${am_cv_prog_tar_$1}" && break
3191428d7b3dSmrg
3192428d7b3dSmrg    # tar/untar a dummy directory, and stop if the command works.
3193428d7b3dSmrg    rm -rf conftest.dir
3194428d7b3dSmrg    mkdir conftest.dir
3195428d7b3dSmrg    echo GrepMe > conftest.dir/file
3196428d7b3dSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3197428d7b3dSmrg    rm -rf conftest.dir
3198428d7b3dSmrg    if test -s conftest.tar; then
3199428d7b3dSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
3200428d7b3dSmrg      AM_RUN_LOG([cat conftest.dir/file])
3201428d7b3dSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3202428d7b3dSmrg    fi
3203428d7b3dSmrg  done
3204428d7b3dSmrg  rm -rf conftest.dir
3205428d7b3dSmrg
3206428d7b3dSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3207428d7b3dSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3208428d7b3dSmrg
3209428d7b3dSmrgAC_SUBST([am__tar])
3210428d7b3dSmrgAC_SUBST([am__untar])
3211428d7b3dSmrg]) # _AM_PROG_TAR
3212428d7b3dSmrg
3213428d7b3dSmrgm4_include([m4/ac_define_dir.m4])
3214428d7b3dSmrgm4_include([m4/libtool.m4])
3215428d7b3dSmrgm4_include([m4/ltoptions.m4])
3216428d7b3dSmrgm4_include([m4/ltsugar.m4])
3217428d7b3dSmrgm4_include([m4/ltversion.m4])
3218428d7b3dSmrgm4_include([m4/lt~obsolete.m4])
3219