aclocal.m4 revision afe13c8e
1afe13c8eSmrg# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
2b3307321Smrg
3afe13c8eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4afe13c8eSmrg# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
5b3307321Smrg# This file is free software; the Free Software Foundation
6b3307321Smrg# gives unlimited permission to copy and/or distribute it,
7b3307321Smrg# with or without modifications, as long as this notice is preserved.
8b3307321Smrg
9b3307321Smrg# This program is distributed in the hope that it will be useful,
10b3307321Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b3307321Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b3307321Smrg# PARTICULAR PURPOSE.
13b3307321Smrg
14afe13c8eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15afe13c8eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16afe13c8eSmrgm4_if(AC_AUTOCONF_VERSION, [2.62],,
17afe13c8eSmrg[m4_warning([this file was generated for autoconf 2.62.
18afe13c8eSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19afe13c8eSmrgIf you have problems, you may need to regenerate the build system entirely.
20afe13c8eSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21b3307321Smrg
22afe13c8eSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
23afe13c8eSmrg# 
24afe13c8eSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
25afe13c8eSmrg#
26b3307321Smrg# This program is free software; you can redistribute it and/or modify
27b3307321Smrg# it under the terms of the GNU General Public License as published by
28afe13c8eSmrg# the Free Software Foundation; either version 2 of the License, or
29afe13c8eSmrg# (at your option) any later version.
30afe13c8eSmrg#
31afe13c8eSmrg# This program is distributed in the hope that it will be useful, but
32afe13c8eSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
33afe13c8eSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
34afe13c8eSmrg# General Public License for more details.
35afe13c8eSmrg#
36b3307321Smrg# You should have received a copy of the GNU General Public License
37b3307321Smrg# along with this program; if not, write to the Free Software
38afe13c8eSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39afe13c8eSmrg#
40afe13c8eSmrg# As a special exception to the GNU General Public License, if you
41afe13c8eSmrg# distribute this file as part of a program that contains a
42afe13c8eSmrg# configuration script generated by Autoconf, you may include it under
43afe13c8eSmrg# the same distribution terms that you use for the rest of that program.
44b3307321Smrg
45afe13c8eSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
46afe13c8eSmrg# ----------------------------------
47afe13c8eSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
48afe13c8eSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
49afe13c8eSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
50afe13c8eSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
51afe13c8eSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
52afe13c8eSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
53b3307321Smrgfi
54afe13c8eSmrgif test -n "$PKG_CONFIG"; then
55afe13c8eSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
56afe13c8eSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
57afe13c8eSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
58afe13c8eSmrg		AC_MSG_RESULT([yes])
59afe13c8eSmrg	else
60afe13c8eSmrg		AC_MSG_RESULT([no])
61afe13c8eSmrg		PKG_CONFIG=""
62afe13c8eSmrg	fi
63afe13c8eSmrg		
64afe13c8eSmrgfi[]dnl
65afe13c8eSmrg])# PKG_PROG_PKG_CONFIG
66b3307321Smrg
67afe13c8eSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
68afe13c8eSmrg#
69afe13c8eSmrg# Check to see whether a particular set of modules exists.  Similar
70afe13c8eSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
71afe13c8eSmrg#
72afe13c8eSmrg#
73afe13c8eSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
74afe13c8eSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
75afe13c8eSmrg# PKG_CHECK_EXISTS manually
76afe13c8eSmrg# --------------------------------------------------------------
77afe13c8eSmrgAC_DEFUN([PKG_CHECK_EXISTS],
78afe13c8eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
79afe13c8eSmrgif test -n "$PKG_CONFIG" && \
80afe13c8eSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
81afe13c8eSmrg  m4_ifval([$2], [$2], [:])
82afe13c8eSmrgm4_ifvaln([$3], [else
83afe13c8eSmrg  $3])dnl
84afe13c8eSmrgfi])
85b3307321Smrg
86b3307321Smrg
87afe13c8eSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
88afe13c8eSmrg# ---------------------------------------------
89afe13c8eSmrgm4_define([_PKG_CONFIG],
90afe13c8eSmrg[if test -n "$$1"; then
91afe13c8eSmrg    pkg_cv_[]$1="$$1"
92afe13c8eSmrg elif test -n "$PKG_CONFIG"; then
93afe13c8eSmrg    PKG_CHECK_EXISTS([$3],
94afe13c8eSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
95afe13c8eSmrg		     [pkg_failed=yes])
96afe13c8eSmrg else
97afe13c8eSmrg    pkg_failed=untried
98afe13c8eSmrgfi[]dnl
99afe13c8eSmrg])# _PKG_CONFIG
100b3307321Smrg
101afe13c8eSmrg# _PKG_SHORT_ERRORS_SUPPORTED
102afe13c8eSmrg# -----------------------------
103afe13c8eSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
104afe13c8eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
105afe13c8eSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
106afe13c8eSmrg        _pkg_short_errors_supported=yes
107afe13c8eSmrgelse
108afe13c8eSmrg        _pkg_short_errors_supported=no
109afe13c8eSmrgfi[]dnl
110afe13c8eSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
111b3307321Smrg
112b3307321Smrg
113afe13c8eSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
114afe13c8eSmrg# [ACTION-IF-NOT-FOUND])
115afe13c8eSmrg#
116afe13c8eSmrg#
117afe13c8eSmrg# Note that if there is a possibility the first call to
118afe13c8eSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
119afe13c8eSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
120afe13c8eSmrg#
121afe13c8eSmrg#
122afe13c8eSmrg# --------------------------------------------------------------
123afe13c8eSmrgAC_DEFUN([PKG_CHECK_MODULES],
124afe13c8eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
125afe13c8eSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
126afe13c8eSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
127b3307321Smrg
128afe13c8eSmrgpkg_failed=no
129afe13c8eSmrgAC_MSG_CHECKING([for $1])
130b3307321Smrg
131afe13c8eSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
132afe13c8eSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
133b3307321Smrg
134afe13c8eSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
135afe13c8eSmrgand $1[]_LIBS to avoid the need to call pkg-config.
136afe13c8eSmrgSee the pkg-config man page for more details.])
137b3307321Smrg
138afe13c8eSmrgif test $pkg_failed = yes; then
139afe13c8eSmrg        _PKG_SHORT_ERRORS_SUPPORTED
140afe13c8eSmrg        if test $_pkg_short_errors_supported = yes; then
141afe13c8eSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
142afe13c8eSmrg        else 
143afe13c8eSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
144afe13c8eSmrg        fi
145afe13c8eSmrg	# Put the nasty error message in config.log where it belongs
146afe13c8eSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
147b3307321Smrg
148afe13c8eSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
149afe13c8eSmrg[Package requirements ($2) were not met:
150b3307321Smrg
151afe13c8eSmrg$$1_PKG_ERRORS
152b3307321Smrg
153afe13c8eSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
154afe13c8eSmrginstalled software in a non-standard prefix.
155b3307321Smrg
156afe13c8eSmrg_PKG_TEXT
157afe13c8eSmrg])],
158afe13c8eSmrg		[AC_MSG_RESULT([no])
159afe13c8eSmrg                $4])
160afe13c8eSmrgelif test $pkg_failed = untried; then
161afe13c8eSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
162afe13c8eSmrg[The pkg-config script could not be found or is too old.  Make sure it
163afe13c8eSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
164afe13c8eSmrgpath to pkg-config.
165b3307321Smrg
166afe13c8eSmrg_PKG_TEXT
167b3307321Smrg
168afe13c8eSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
169afe13c8eSmrg		[$4])
170afe13c8eSmrgelse
171afe13c8eSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
172afe13c8eSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
173afe13c8eSmrg        AC_MSG_RESULT([yes])
174afe13c8eSmrg	ifelse([$3], , :, [$3])
175afe13c8eSmrgfi[]dnl
176afe13c8eSmrg])# PKG_CHECK_MODULES
177b3307321Smrg
178afe13c8eSmrgdnl
179afe13c8eSmrgdnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
180afe13c8eSmrgdnl 
181afe13c8eSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
182afe13c8eSmrgdnl copy of this software and associated documentation files (the
183afe13c8eSmrgdnl "Software"), to deal in the Software without restriction, including
184afe13c8eSmrgdnl without limitation the rights to use, copy, modify, merge, publish,
185afe13c8eSmrgdnl distribute, and/or sell copies of the Software, and to permit persons
186afe13c8eSmrgdnl to whom the Software is furnished to do so, provided that the above
187afe13c8eSmrgdnl copyright notice(s) and this permission notice appear in all copies of
188afe13c8eSmrgdnl the Software and that both the above copyright notice(s) and this
189afe13c8eSmrgdnl permission notice appear in supporting documentation.
190afe13c8eSmrgdnl
191afe13c8eSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
192afe13c8eSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
193afe13c8eSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
194afe13c8eSmrgdnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
195afe13c8eSmrgdnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
196afe13c8eSmrgdnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
197afe13c8eSmrgdnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
198afe13c8eSmrgdnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
199afe13c8eSmrgdnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
200afe13c8eSmrgdnl
201afe13c8eSmrgdnl Except as contained in this notice, the name of a copyright holder
202afe13c8eSmrgdnl shall not be used in advertising or otherwise to promote the sale, use
203afe13c8eSmrgdnl or other dealings in this Software without prior written authorization
204afe13c8eSmrgdnl of the copyright holder.
205b3307321Smrg
206afe13c8eSmrg# XORG_MACROS_VERSION(required-version)
207afe13c8eSmrg# -------------------------------------
208afe13c8eSmrg# Minimum version: 1.1.0
209afe13c8eSmrg#
210afe13c8eSmrg# If you're using a macro added in Version 1.1 or newer, include this in
211afe13c8eSmrg# your configure.ac with the minimum required version, such as:
212afe13c8eSmrg# XORG_MACROS_VERSION(1.1)
213afe13c8eSmrg#
214afe13c8eSmrg# To force at least a version with this macro defined, also add:
215afe13c8eSmrg# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
216afe13c8eSmrg#
217afe13c8eSmrg#
218afe13c8eSmrg# See the "minimum version" comment for each macro you use to see what 
219afe13c8eSmrg# version you require.
220afe13c8eSmrgAC_DEFUN([XORG_MACROS_VERSION],[
221afe13c8eSmrg	[XORG_MACROS_needed_version=$1
222afe13c8eSmrg	XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
223afe13c8eSmrg	XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
224afe13c8eSmrg	AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
225afe13c8eSmrg	[XORG_MACROS_version=1.1.6
226afe13c8eSmrg	XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
227afe13c8eSmrg	XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
228afe13c8eSmrg	if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
229afe13c8eSmrg		AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
230afe13c8eSmrg	fi
231afe13c8eSmrg	if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
232afe13c8eSmrg		AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer])
233afe13c8eSmrg	fi
234afe13c8eSmrg	AC_MSG_RESULT([yes, $XORG_MACROS_version])
235afe13c8eSmrg]) # XORG_MACROS_VERSION
236b3307321Smrg
237afe13c8eSmrg# XORG_PROG_RAWCPP()
238afe13c8eSmrg# ------------------
239afe13c8eSmrg# Minimum version: 1.0.0
240afe13c8eSmrg#
241afe13c8eSmrg# Find cpp program and necessary flags for use in pre-processing text files
242afe13c8eSmrg# such as man pages and config files
243afe13c8eSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
244afe13c8eSmrgAC_REQUIRE([AC_PROG_CPP])
245afe13c8eSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
246afe13c8eSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
247b3307321Smrg
248afe13c8eSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
249afe13c8eSmrg# which is not the best choice for supporting other OS'es, but covers most
250afe13c8eSmrg# of the ones we need for now.
251afe13c8eSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
252afe13c8eSmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
253afe13c8eSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
254afe13c8eSmrg	AC_MSG_RESULT([no])
255afe13c8eSmrgelse
256afe13c8eSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
257afe13c8eSmrg		RAWCPPFLAGS=-undef
258afe13c8eSmrg		AC_MSG_RESULT([yes])
259afe13c8eSmrg	else
260afe13c8eSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
261afe13c8eSmrg	fi
262afe13c8eSmrgfi
263afe13c8eSmrgrm -f conftest.$ac_ext
264b3307321Smrg
265afe13c8eSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
266afe13c8eSmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
267afe13c8eSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
268afe13c8eSmrg	AC_MSG_RESULT([no])
269afe13c8eSmrgelse
270afe13c8eSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
271afe13c8eSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
272afe13c8eSmrg		AC_MSG_RESULT([yes])
273afe13c8eSmrg	else
274afe13c8eSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
275afe13c8eSmrg	fi
276afe13c8eSmrgfi
277afe13c8eSmrgrm -f conftest.$ac_ext
278afe13c8eSmrgAC_SUBST(RAWCPPFLAGS)
279afe13c8eSmrg]) # XORG_PROG_RAWCPP
280b3307321Smrg
281afe13c8eSmrg# XORG_MANPAGE_SECTIONS()
282afe13c8eSmrg# -----------------------
283afe13c8eSmrg# Minimum version: 1.0.0
284b3307321Smrg#
285afe13c8eSmrg# Determine which sections man pages go in for the different man page types
286afe13c8eSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
287afe13c8eSmrg# Not sure if there's any better way than just hardcoding by OS name.
288afe13c8eSmrg# Override default settings by setting environment variables
289b3307321Smrg
290afe13c8eSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
291afe13c8eSmrgAC_REQUIRE([AC_CANONICAL_HOST])
292b3307321Smrg
293afe13c8eSmrgif test x$APP_MAN_SUFFIX = x    ; then
294afe13c8eSmrg    APP_MAN_SUFFIX=1
295afe13c8eSmrgfi
296afe13c8eSmrgif test x$APP_MAN_DIR = x    ; then
297afe13c8eSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
298afe13c8eSmrgfi
299b3307321Smrg
300afe13c8eSmrgif test x$LIB_MAN_SUFFIX = x    ; then
301afe13c8eSmrg    LIB_MAN_SUFFIX=3
302afe13c8eSmrgfi
303afe13c8eSmrgif test x$LIB_MAN_DIR = x    ; then
304afe13c8eSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
305afe13c8eSmrgfi
306b3307321Smrg
307afe13c8eSmrgif test x$FILE_MAN_SUFFIX = x    ; then
308afe13c8eSmrg    case $host_os in
309afe13c8eSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
310afe13c8eSmrg	*)		FILE_MAN_SUFFIX=5  ;;
311afe13c8eSmrg    esac
312afe13c8eSmrgfi
313afe13c8eSmrgif test x$FILE_MAN_DIR = x    ; then
314afe13c8eSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
315afe13c8eSmrgfi
316b3307321Smrg
317afe13c8eSmrgif test x$MISC_MAN_SUFFIX = x    ; then
318afe13c8eSmrg    case $host_os in
319afe13c8eSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
320afe13c8eSmrg	*)		MISC_MAN_SUFFIX=7  ;;
321afe13c8eSmrg    esac
322afe13c8eSmrgfi
323afe13c8eSmrgif test x$MISC_MAN_DIR = x    ; then
324afe13c8eSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
325afe13c8eSmrgfi
326b3307321Smrg
327afe13c8eSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
328afe13c8eSmrg    case $host_os in
329afe13c8eSmrg	linux*)		DRIVER_MAN_SUFFIX=4x ;;
330afe13c8eSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
331afe13c8eSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
332afe13c8eSmrg    esac
333afe13c8eSmrgfi
334afe13c8eSmrgif test x$DRIVER_MAN_DIR = x    ; then
335afe13c8eSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
336afe13c8eSmrgfi
337b3307321Smrg
338afe13c8eSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
339afe13c8eSmrg    case $host_os in
340afe13c8eSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
341afe13c8eSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
342afe13c8eSmrg    esac
343afe13c8eSmrgfi
344afe13c8eSmrgif test x$ADMIN_MAN_DIR = x    ; then
345afe13c8eSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
346b3307321Smrgfi
347b3307321Smrg
348b3307321Smrg
349afe13c8eSmrgAC_SUBST([APP_MAN_SUFFIX])
350afe13c8eSmrgAC_SUBST([LIB_MAN_SUFFIX])
351afe13c8eSmrgAC_SUBST([FILE_MAN_SUFFIX])
352afe13c8eSmrgAC_SUBST([MISC_MAN_SUFFIX])
353afe13c8eSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
354afe13c8eSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
355afe13c8eSmrgAC_SUBST([APP_MAN_DIR])
356afe13c8eSmrgAC_SUBST([LIB_MAN_DIR])
357afe13c8eSmrgAC_SUBST([FILE_MAN_DIR])
358afe13c8eSmrgAC_SUBST([MISC_MAN_DIR])
359afe13c8eSmrgAC_SUBST([DRIVER_MAN_DIR])
360afe13c8eSmrgAC_SUBST([ADMIN_MAN_DIR])
361afe13c8eSmrg]) # XORG_MANPAGE_SECTIONS
362b3307321Smrg
363afe13c8eSmrg# XORG_CHECK_LINUXDOC
364afe13c8eSmrg# -------------------
365afe13c8eSmrg# Minimum version: 1.0.0
366afe13c8eSmrg#
367afe13c8eSmrg# Defines the variable MAKE_TEXT if the necessary tools and
368afe13c8eSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
369afe13c8eSmrg# Whether or not the necessary tools and files are found can be checked
370afe13c8eSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
371afe13c8eSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
372afe13c8eSmrgXORG_SGML_PATH=$prefix/share/sgml
373afe13c8eSmrgHAVE_DEFS_ENT=
374b3307321Smrg
375afe13c8eSmrgif test x"$cross_compiling" = x"yes" ; then
376afe13c8eSmrg  HAVE_DEFS_ENT=no
377afe13c8eSmrgelse
378afe13c8eSmrg  AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
379afe13c8eSmrgfi
380b3307321Smrg
381afe13c8eSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
382afe13c8eSmrgAC_PATH_PROG(PS2PDF, ps2pdf)
383b3307321Smrg
384afe13c8eSmrgAC_MSG_CHECKING([Whether to build documentation])
385b3307321Smrg
386afe13c8eSmrgif test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
387afe13c8eSmrg   BUILDDOC=yes
388afe13c8eSmrgelse
389afe13c8eSmrg   BUILDDOC=no
390afe13c8eSmrgfi
391b3307321Smrg
392afe13c8eSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
393b3307321Smrg
394afe13c8eSmrgAC_MSG_RESULT([$BUILDDOC])
395b3307321Smrg
396afe13c8eSmrgAC_MSG_CHECKING([Whether to build pdf documentation])
397afe13c8eSmrg
398afe13c8eSmrgif test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
399afe13c8eSmrg   BUILDPDFDOC=yes
400b3307321Smrgelse
401afe13c8eSmrg   BUILDPDFDOC=no
402b3307321Smrgfi
403b3307321Smrg
404afe13c8eSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
405b3307321Smrg
406afe13c8eSmrgAC_MSG_RESULT([$BUILDPDFDOC])
407b3307321Smrg
408afe13c8eSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
409afe13c8eSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
410afe13c8eSmrgMAKE_PDF="$PS2PDF"
411afe13c8eSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
412b3307321Smrg
413afe13c8eSmrgAC_SUBST(MAKE_TEXT)
414afe13c8eSmrgAC_SUBST(MAKE_PS)
415afe13c8eSmrgAC_SUBST(MAKE_PDF)
416afe13c8eSmrgAC_SUBST(MAKE_HTML)
417afe13c8eSmrg]) # XORG_CHECK_LINUXDOC
418b3307321Smrg
419afe13c8eSmrg# XORG_CHECK_DOCBOOK
420afe13c8eSmrg# -------------------
421afe13c8eSmrg# Minimum version: 1.0.0
422b3307321Smrg#
423afe13c8eSmrg# Checks for the ability to build output formats from SGML DocBook source.
424afe13c8eSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
425afe13c8eSmrg# indicates whether the necessary tools and files are found and, if set,
426afe13c8eSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
427afe13c8eSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
428afe13c8eSmrgXORG_SGML_PATH=$prefix/share/sgml
429afe13c8eSmrgHAVE_DEFS_ENT=
430afe13c8eSmrgBUILDTXTDOC=no
431afe13c8eSmrgBUILDPDFDOC=no
432afe13c8eSmrgBUILDPSDOC=no
433afe13c8eSmrgBUILDHTMLDOC=no
434afe13c8eSmrg
435afe13c8eSmrgAC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
436afe13c8eSmrg
437afe13c8eSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
438afe13c8eSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
439afe13c8eSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
440afe13c8eSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
441afe13c8eSmrg
442afe13c8eSmrgAC_MSG_CHECKING([Whether to build text documentation])
443afe13c8eSmrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
444afe13c8eSmrg   test x$BUILD_TXTDOC != xno; then
445afe13c8eSmrg	BUILDTXTDOC=yes
446afe13c8eSmrgfi
447afe13c8eSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
448afe13c8eSmrgAC_MSG_RESULT([$BUILDTXTDOC])
449b3307321Smrg
450afe13c8eSmrgAC_MSG_CHECKING([Whether to build PDF documentation])
451afe13c8eSmrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
452afe13c8eSmrg   test x$BUILD_PDFDOC != xno; then
453afe13c8eSmrg	BUILDPDFDOC=yes
454afe13c8eSmrgfi
455afe13c8eSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
456afe13c8eSmrgAC_MSG_RESULT([$BUILDPDFDOC])
457b3307321Smrg
458afe13c8eSmrgAC_MSG_CHECKING([Whether to build PostScript documentation])
459afe13c8eSmrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
460afe13c8eSmrg   test x$BUILD_PSDOC != xno; then
461afe13c8eSmrg	BUILDPSDOC=yes
462afe13c8eSmrgfi
463afe13c8eSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
464afe13c8eSmrgAC_MSG_RESULT([$BUILDPSDOC])
465b3307321Smrg
466afe13c8eSmrgAC_MSG_CHECKING([Whether to build HTML documentation])
467afe13c8eSmrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
468afe13c8eSmrg   test x$BUILD_HTMLDOC != xno; then
469afe13c8eSmrg	BUILDHTMLDOC=yes
470afe13c8eSmrgfi
471afe13c8eSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
472afe13c8eSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
473b3307321Smrg
474afe13c8eSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
475afe13c8eSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
476afe13c8eSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
477afe13c8eSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
478b3307321Smrg
479afe13c8eSmrgAC_SUBST(MAKE_TEXT)
480afe13c8eSmrgAC_SUBST(MAKE_PS)
481afe13c8eSmrgAC_SUBST(MAKE_PDF)
482afe13c8eSmrgAC_SUBST(MAKE_HTML)
483afe13c8eSmrg]) # XORG_CHECK_DOCBOOK
484b3307321Smrg
485afe13c8eSmrg# XORG_CHECK_MALLOC_ZERO
486afe13c8eSmrg# ----------------------
487afe13c8eSmrg# Minimum version: 1.0.0
488afe13c8eSmrg#
489afe13c8eSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
490afe13c8eSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
491afe13c8eSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
492afe13c8eSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
493afe13c8eSmrgAC_ARG_ENABLE(malloc0returnsnull,
494afe13c8eSmrg	AC_HELP_STRING([--enable-malloc0returnsnull],
495afe13c8eSmrg		       [malloc(0) returns NULL (default: auto)]),
496afe13c8eSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
497afe13c8eSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
498b3307321Smrg
499afe13c8eSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
500afe13c8eSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
501afe13c8eSmrg	AC_RUN_IFELSE([
502afe13c8eSmrgchar *malloc();
503afe13c8eSmrgchar *realloc();
504afe13c8eSmrgchar *calloc();
505afe13c8eSmrgmain() {
506afe13c8eSmrg    char *m0, *r0, *c0, *p;
507afe13c8eSmrg    m0 = malloc(0);
508afe13c8eSmrg    p = malloc(10);
509afe13c8eSmrg    r0 = realloc(p,0);
510afe13c8eSmrg    c0 = calloc(0);
511afe13c8eSmrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
512afe13c8eSmrg}],
513afe13c8eSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
514afe13c8eSmrg		[MALLOC_ZERO_RETURNS_NULL=no])
515afe13c8eSmrgfi
516afe13c8eSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
517b3307321Smrg
518afe13c8eSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
519afe13c8eSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
520afe13c8eSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
521afe13c8eSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
522afe13c8eSmrgelse
523afe13c8eSmrg	MALLOC_ZERO_CFLAGS=""
524afe13c8eSmrg	XMALLOC_ZERO_CFLAGS=""
525afe13c8eSmrg	XTMALLOC_ZERO_CFLAGS=""
526afe13c8eSmrgfi
527b3307321Smrg
528afe13c8eSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
529afe13c8eSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
530afe13c8eSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
531afe13c8eSmrg]) # XORG_CHECK_MALLOC_ZERO
532b3307321Smrg
533afe13c8eSmrg# XORG_WITH_LINT()
534afe13c8eSmrg# ----------------
535afe13c8eSmrg# Minimum version: 1.1.0
536afe13c8eSmrg#
537afe13c8eSmrg# Sets up flags for source checkers such as lint and sparse if --with-lint
538afe13c8eSmrg# is specified.   (Use --with-lint=sparse for sparse.)
539afe13c8eSmrg# Sets $LINT to name of source checker passed with --with-lint (default: lint)
540afe13c8eSmrg# Sets $LINT_FLAGS to flags to pass to source checker
541afe13c8eSmrg# Sets LINT automake conditional if enabled (default: disabled)
542afe13c8eSmrg#
543afe13c8eSmrgAC_DEFUN([XORG_WITH_LINT],[
544afe13c8eSmrg
545afe13c8eSmrg# Allow checking code with lint, sparse, etc.
546afe13c8eSmrgAC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
547afe13c8eSmrg		[Use a lint-style source code checker (default: disabled)])],
548afe13c8eSmrg		[use_lint=$withval], [use_lint=no])
549afe13c8eSmrgif test "x$use_lint" = "xyes" ; then
550afe13c8eSmrg	LINT="lint"
551afe13c8eSmrgelse
552afe13c8eSmrg	LINT="$use_lint"
553afe13c8eSmrgfi
554afe13c8eSmrgif test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
555afe13c8eSmrg    case $LINT in
556afe13c8eSmrg	lint|*/lint)
557afe13c8eSmrg	    case $host_os in
558afe13c8eSmrg		solaris*)
559afe13c8eSmrg			LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
560afe13c8eSmrg			;;
561afe13c8eSmrg	    esac
562afe13c8eSmrg	    ;;
563afe13c8eSmrg    esac
564afe13c8eSmrgfi
565b3307321Smrg
566afe13c8eSmrgAC_SUBST(LINT)
567afe13c8eSmrgAC_SUBST(LINT_FLAGS)
568afe13c8eSmrgAM_CONDITIONAL(LINT, [test x$LINT != xno])
569b3307321Smrg
570afe13c8eSmrg]) # XORG_WITH_LINT
571b3307321Smrg
572afe13c8eSmrg# XORG_LINT_LIBRARY(LIBNAME)
573afe13c8eSmrg# --------------------------
574afe13c8eSmrg# Minimum version: 1.1.0
575afe13c8eSmrg#
576afe13c8eSmrg# Sets up flags for building lint libraries for checking programs that call
577afe13c8eSmrg# functions in the library.
578afe13c8eSmrg# Disabled by default, enable with --enable-lint-library
579afe13c8eSmrg# Sets: 
580afe13c8eSmrg#	@LINTLIB@		- name of lint library file to make
581afe13c8eSmrg#	MAKE_LINT_LIB		- automake conditional
582afe13c8eSmrg#
583b3307321Smrg
584afe13c8eSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
585afe13c8eSmrgAC_REQUIRE([XORG_WITH_LINT])
586afe13c8eSmrg# Build lint "library" for more indepth checks of programs calling this library
587afe13c8eSmrgAC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
588afe13c8eSmrg	[Create lint library (default: disabled)])],
589afe13c8eSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
590afe13c8eSmrgif test "x$make_lint_lib" != "xno" ; then
591afe13c8eSmrg	if test "x$LINT" = "xno" ; then
592afe13c8eSmrg		AC_MSG_ERROR([Cannot make lint library without --with-lint])
593afe13c8eSmrg	fi
594afe13c8eSmrg	if test "x$make_lint_lib" = "xyes" ; then
595afe13c8eSmrg		LINTLIB=llib-l$1.ln
596afe13c8eSmrg	else
597afe13c8eSmrg		LINTLIB=$make_lint_lib
598afe13c8eSmrg	fi
599b3307321Smrgfi
600afe13c8eSmrgAC_SUBST(LINTLIB)
601afe13c8eSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
602b3307321Smrg
603afe13c8eSmrg]) # XORG_LINT_LIBRARY
604b3307321Smrg
605afe13c8eSmrgdnl Copyright 2005 Red Hat, Inc
606afe13c8eSmrgdnl
607afe13c8eSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
608afe13c8eSmrgdnl documentation for any purpose is hereby granted without fee, provided that
609afe13c8eSmrgdnl the above copyright notice appear in all copies and that both that
610afe13c8eSmrgdnl copyright notice and this permission notice appear in supporting
611afe13c8eSmrgdnl documentation.
612afe13c8eSmrgdnl
613afe13c8eSmrgdnl The above copyright notice and this permission notice shall be included
614afe13c8eSmrgdnl in all copies or substantial portions of the Software.
615afe13c8eSmrgdnl
616afe13c8eSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
617afe13c8eSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
618afe13c8eSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
619afe13c8eSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
620afe13c8eSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
621afe13c8eSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
622afe13c8eSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
623afe13c8eSmrgdnl
624afe13c8eSmrgdnl Except as contained in this notice, the name of the copyright holders shall
625afe13c8eSmrgdnl not be used in advertising or otherwise to promote the sale, use or
626afe13c8eSmrgdnl other dealings in this Software without prior written authorization
627afe13c8eSmrgdnl from the copyright holders.
628afe13c8eSmrgdnl
629b3307321Smrg
630afe13c8eSmrg# XORG_RELEASE_VERSION
631afe13c8eSmrg# --------------------
632afe13c8eSmrg# Adds --with/without-release-string and changes the PACKAGE and
633afe13c8eSmrg# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION".  If
634afe13c8eSmrg# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged.  Also
635afe13c8eSmrg# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
636afe13c8eSmrg 
637afe13c8eSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
638afe13c8eSmrg	AC_ARG_WITH(release-version,
639afe13c8eSmrg			AC_HELP_STRING([--with-release-version=STRING],
640afe13c8eSmrg				[Use release version string in package name]),
641afe13c8eSmrg			[RELEASE_VERSION="$withval"],
642afe13c8eSmrg			[RELEASE_VERSION=""])
643afe13c8eSmrg	if test "x$RELEASE_VERSION" != "x"; then
644afe13c8eSmrg		PACKAGE="$PACKAGE-$RELEASE_VERSION"
645afe13c8eSmrg		PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
646afe13c8eSmrg		AC_MSG_NOTICE([Building with package name set to $PACKAGE])
647afe13c8eSmrg	fi
648afe13c8eSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
649afe13c8eSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
650afe13c8eSmrg		[Major version of this package])
651afe13c8eSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
652afe13c8eSmrg	if test "x$PVM" = "x"; then
653afe13c8eSmrg		PVM="0"
654afe13c8eSmrg	fi
655afe13c8eSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
656afe13c8eSmrg		[$PVM],
657afe13c8eSmrg		[Minor version of this package])
658afe13c8eSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
659afe13c8eSmrg	if test "x$PVP" = "x"; then
660afe13c8eSmrg		PVP="0"
661afe13c8eSmrg	fi
662afe13c8eSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
663afe13c8eSmrg		[$PVP],
664afe13c8eSmrg		[Patch version of this package])
665afe13c8eSmrg])
666b3307321Smrg
667afe13c8eSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
668afe13c8eSmrg#
669afe13c8eSmrg# This file is free software; the Free Software Foundation
670afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
671afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
672b3307321Smrg
673afe13c8eSmrg# AM_AUTOMAKE_VERSION(VERSION)
674afe13c8eSmrg# ----------------------------
675afe13c8eSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
676afe13c8eSmrg# generated from the m4 files accompanying Automake X.Y.
677afe13c8eSmrg# (This private macro should not be called outside this file.)
678afe13c8eSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
679afe13c8eSmrg[am__api_version='1.10'
680afe13c8eSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
681afe13c8eSmrgdnl require some minimum version.  Point them to the right macro.
682afe13c8eSmrgm4_if([$1], [1.10.1], [],
683afe13c8eSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
684afe13c8eSmrg])
685b3307321Smrg
686afe13c8eSmrg# _AM_AUTOCONF_VERSION(VERSION)
687afe13c8eSmrg# -----------------------------
688afe13c8eSmrg# aclocal traces this macro to find the Autoconf version.
689afe13c8eSmrg# This is a private macro too.  Using m4_define simplifies
690afe13c8eSmrg# the logic in aclocal, which can simply ignore this definition.
691afe13c8eSmrgm4_define([_AM_AUTOCONF_VERSION], [])
692b3307321Smrg
693afe13c8eSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
694afe13c8eSmrg# -------------------------------
695afe13c8eSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
696afe13c8eSmrg# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
697afe13c8eSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
698afe13c8eSmrg[AM_AUTOMAKE_VERSION([1.10.1])dnl
699afe13c8eSmrgm4_ifndef([AC_AUTOCONF_VERSION],
700afe13c8eSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
701afe13c8eSmrg_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
702b3307321Smrg
703afe13c8eSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
704b3307321Smrg
705afe13c8eSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
706afe13c8eSmrg#
707afe13c8eSmrg# This file is free software; the Free Software Foundation
708afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
709afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
710b3307321Smrg
711afe13c8eSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
712afe13c8eSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
713afe13c8eSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
714afe13c8eSmrg#
715afe13c8eSmrg# Of course, Automake must honor this variable whenever it calls a
716afe13c8eSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
717afe13c8eSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
718afe13c8eSmrg# depending on how configure is run.  This is pretty annoying, since
719afe13c8eSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
720afe13c8eSmrg# source directory, any form will work fine, but in subdirectories a
721afe13c8eSmrg# relative path needs to be adjusted first.
722afe13c8eSmrg#
723afe13c8eSmrg# $ac_aux_dir/missing
724afe13c8eSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
725afe13c8eSmrg# $top_srcdir/$ac_aux_dir/missing
726afe13c8eSmrg#    fails if $ac_aux_dir is absolute,
727afe13c8eSmrg#    fails when called from a subdirectory in a VPATH build with
728afe13c8eSmrg#          a relative $ac_aux_dir
729afe13c8eSmrg#
730afe13c8eSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
731afe13c8eSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
732afe13c8eSmrg# harmless because $srcdir is `.', but things will broke when you
733afe13c8eSmrg# start a VPATH build or use an absolute $srcdir.
734afe13c8eSmrg#
735afe13c8eSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
736afe13c8eSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
737afe13c8eSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
738afe13c8eSmrg# and then we would define $MISSING as
739afe13c8eSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
740afe13c8eSmrg# This will work as long as MISSING is not called from configure, because
741afe13c8eSmrg# unfortunately $(top_srcdir) has no meaning in configure.
742afe13c8eSmrg# However there are other variables, like CC, which are often used in
743afe13c8eSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
744afe13c8eSmrg#
745afe13c8eSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
746afe13c8eSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
747afe13c8eSmrg# configured tree to be moved without reconfiguration.
748b3307321Smrg
749afe13c8eSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
750afe13c8eSmrg[dnl Rely on autoconf to set up CDPATH properly.
751afe13c8eSmrgAC_PREREQ([2.50])dnl
752afe13c8eSmrg# expand $ac_aux_dir to an absolute path
753afe13c8eSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
754afe13c8eSmrg])
755afe13c8eSmrg
756afe13c8eSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
757afe13c8eSmrg
758afe13c8eSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
759afe13c8eSmrg# Free Software Foundation, Inc.
760afe13c8eSmrg#
761afe13c8eSmrg# This file is free software; the Free Software Foundation
762afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
763afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
764afe13c8eSmrg
765afe13c8eSmrg# serial 8
766afe13c8eSmrg
767afe13c8eSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
768afe13c8eSmrg# -------------------------------------
769afe13c8eSmrg# Define a conditional.
770afe13c8eSmrgAC_DEFUN([AM_CONDITIONAL],
771afe13c8eSmrg[AC_PREREQ(2.52)dnl
772afe13c8eSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
773afe13c8eSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
774afe13c8eSmrgAC_SUBST([$1_TRUE])dnl
775afe13c8eSmrgAC_SUBST([$1_FALSE])dnl
776afe13c8eSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
777afe13c8eSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
778afe13c8eSmrgif $2; then
779afe13c8eSmrg  $1_TRUE=
780afe13c8eSmrg  $1_FALSE='#'
781afe13c8eSmrgelse
782afe13c8eSmrg  $1_TRUE='#'
783afe13c8eSmrg  $1_FALSE=
784afe13c8eSmrgfi
785afe13c8eSmrgAC_CONFIG_COMMANDS_PRE(
786afe13c8eSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
787afe13c8eSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
788afe13c8eSmrgUsually this means the macro was only invoked conditionally.]])
789afe13c8eSmrgfi])])
790afe13c8eSmrg
791afe13c8eSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
792afe13c8eSmrg# Free Software Foundation, Inc.
793afe13c8eSmrg#
794afe13c8eSmrg# This file is free software; the Free Software Foundation
795afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
796afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
797b3307321Smrg
798afe13c8eSmrg# serial 9
799b3307321Smrg
800b3307321Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
801b3307321Smrg# written in clear, in which case automake, when reading aclocal.m4,
802b3307321Smrg# will think it sees a *use*, and therefore will trigger all it's
803b3307321Smrg# C support machinery.  Also note that it means that autoscan, seeing
804b3307321Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
805b3307321Smrg
806b3307321Smrg
807b3307321Smrg# _AM_DEPENDENCIES(NAME)
808b3307321Smrg# ----------------------
809b3307321Smrg# See how the compiler implements dependency checking.
810b3307321Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
811b3307321Smrg# We try a few techniques and use that to set a single cache variable.
812b3307321Smrg#
813b3307321Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
814b3307321Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
815b3307321Smrg# dependency, and given that the user is not expected to run this macro,
816b3307321Smrg# just rely on AC_PROG_CC.
817b3307321SmrgAC_DEFUN([_AM_DEPENDENCIES],
818b3307321Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
819b3307321SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
820b3307321SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
821b3307321SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
822b3307321Smrg
823b3307321Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
824b3307321Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
825b3307321Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
826afe13c8eSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
827b3307321Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
828b3307321Smrg                   [depcc="$$1"   am_compiler_list=])
829b3307321Smrg
830b3307321SmrgAC_CACHE_CHECK([dependency style of $depcc],
831b3307321Smrg               [am_cv_$1_dependencies_compiler_type],
832b3307321Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
833b3307321Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
834b3307321Smrg  # making bogus files that we don't know about and never remove.  For
835b3307321Smrg  # instance it was reported that on HP-UX the gcc test will end up
836b3307321Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
837b3307321Smrg  # in D'.
838b3307321Smrg  mkdir conftest.dir
839b3307321Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
840b3307321Smrg  # using a relative directory.
841b3307321Smrg  cp "$am_depcomp" conftest.dir
842b3307321Smrg  cd conftest.dir
843b3307321Smrg  # We will build objects and dependencies in a subdirectory because
844b3307321Smrg  # it helps to detect inapplicable dependency modes.  For instance
845b3307321Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
846b3307321Smrg  # side effect of compilation, but ICC will put the dependencies in
847b3307321Smrg  # the current directory while Tru64 will put them in the object
848b3307321Smrg  # directory.
849b3307321Smrg  mkdir sub
850b3307321Smrg
851b3307321Smrg  am_cv_$1_dependencies_compiler_type=none
852b3307321Smrg  if test "$am_compiler_list" = ""; then
853b3307321Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
854b3307321Smrg  fi
855b3307321Smrg  for depmode in $am_compiler_list; do
856b3307321Smrg    # Setup a source with many dependencies, because some compilers
857b3307321Smrg    # like to wrap large dependency lists on column 80 (with \), and
858b3307321Smrg    # we should not choose a depcomp mode which is confused by this.
859b3307321Smrg    #
860b3307321Smrg    # We need to recreate these files for each test, as the compiler may
861b3307321Smrg    # overwrite some of them when testing with obscure command lines.
862b3307321Smrg    # This happens at least with the AIX C compiler.
863b3307321Smrg    : > sub/conftest.c
864b3307321Smrg    for i in 1 2 3 4 5 6; do
865b3307321Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
866afe13c8eSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
867afe13c8eSmrg      # Solaris 8's {/usr,}/bin/sh.
868afe13c8eSmrg      touch sub/conftst$i.h
869b3307321Smrg    done
870b3307321Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
871b3307321Smrg
872b3307321Smrg    case $depmode in
873b3307321Smrg    nosideeffect)
874b3307321Smrg      # after this tag, mechanisms are not by side-effect, so they'll
875b3307321Smrg      # only be used when explicitly requested
876b3307321Smrg      if test "x$enable_dependency_tracking" = xyes; then
877b3307321Smrg	continue
878b3307321Smrg      else
879b3307321Smrg	break
880b3307321Smrg      fi
881b3307321Smrg      ;;
882b3307321Smrg    none) break ;;
883b3307321Smrg    esac
884b3307321Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
885b3307321Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
886b3307321Smrg    # handle `-M -o', and we need to detect this.
887b3307321Smrg    if depmode=$depmode \
888b3307321Smrg       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
889b3307321Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
890b3307321Smrg       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
891b3307321Smrg         >/dev/null 2>conftest.err &&
892afe13c8eSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
893b3307321Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
894b3307321Smrg       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
895b3307321Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
896b3307321Smrg      # icc doesn't choke on unknown options, it will just issue warnings
897afe13c8eSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
898afe13c8eSmrg      # that says an option was ignored or not supported.
899afe13c8eSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
900afe13c8eSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
901afe13c8eSmrg      # The diagnosis changed in icc 8.0:
902afe13c8eSmrg      #   icc: Command line remark: option '-MP' not supported
903afe13c8eSmrg      if (grep 'ignoring option' conftest.err ||
904afe13c8eSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
905b3307321Smrg        am_cv_$1_dependencies_compiler_type=$depmode
906b3307321Smrg        break
907b3307321Smrg      fi
908b3307321Smrg    fi
909b3307321Smrg  done
910b3307321Smrg
911b3307321Smrg  cd ..
912b3307321Smrg  rm -rf conftest.dir
913b3307321Smrgelse
914b3307321Smrg  am_cv_$1_dependencies_compiler_type=none
915b3307321Smrgfi
916b3307321Smrg])
917b3307321SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
918b3307321SmrgAM_CONDITIONAL([am__fastdep$1], [
919b3307321Smrg  test "x$enable_dependency_tracking" != xno \
920b3307321Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
921b3307321Smrg])
922b3307321Smrg
923b3307321Smrg
924b3307321Smrg# AM_SET_DEPDIR
925b3307321Smrg# -------------
926b3307321Smrg# Choose a directory name for dependency files.
927b3307321Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
928b3307321SmrgAC_DEFUN([AM_SET_DEPDIR],
929b3307321Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
930b3307321SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
931b3307321Smrg])
932b3307321Smrg
933b3307321Smrg
934b3307321Smrg# AM_DEP_TRACK
935b3307321Smrg# ------------
936b3307321SmrgAC_DEFUN([AM_DEP_TRACK],
937b3307321Smrg[AC_ARG_ENABLE(dependency-tracking,
938afe13c8eSmrg[  --disable-dependency-tracking  speeds up one-time build
939afe13c8eSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
940b3307321Smrgif test "x$enable_dependency_tracking" != xno; then
941b3307321Smrg  am_depcomp="$ac_aux_dir/depcomp"
942b3307321Smrg  AMDEPBACKSLASH='\'
943b3307321Smrgfi
944b3307321SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
945afe13c8eSmrgAC_SUBST([AMDEPBACKSLASH])dnl
946afe13c8eSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
947b3307321Smrg])
948b3307321Smrg
949afe13c8eSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
950b3307321Smrg
951afe13c8eSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
952afe13c8eSmrg# Free Software Foundation, Inc.
953afe13c8eSmrg#
954afe13c8eSmrg# This file is free software; the Free Software Foundation
955afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
956afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
957b3307321Smrg
958afe13c8eSmrg#serial 3
959b3307321Smrg
960b3307321Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
961b3307321Smrg# ------------------------------
962b3307321SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
963b3307321Smrg[for mf in $CONFIG_FILES; do
964b3307321Smrg  # Strip MF so we end up with the name of the file.
965b3307321Smrg  mf=`echo "$mf" | sed -e 's/:.*$//'`
966b3307321Smrg  # Check whether this is an Automake generated Makefile or not.
967b3307321Smrg  # We used to match only the files named `Makefile.in', but
968b3307321Smrg  # some people rename them; so instead we look at the file content.
969b3307321Smrg  # Grep'ing the first line is not enough: some people post-process
970b3307321Smrg  # each Makefile.in and add a new line on top of each file to say so.
971afe13c8eSmrg  # Grep'ing the whole file is not good either: AIX grep has a line
972afe13c8eSmrg  # limit of 2048, but all sed's we know have understand at least 4000.
973afe13c8eSmrg  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
974b3307321Smrg    dirpart=`AS_DIRNAME("$mf")`
975b3307321Smrg  else
976b3307321Smrg    continue
977b3307321Smrg  fi
978afe13c8eSmrg  # Extract the definition of DEPDIR, am__include, and am__quote
979afe13c8eSmrg  # from the Makefile without running `make'.
980afe13c8eSmrg  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
981b3307321Smrg  test -z "$DEPDIR" && continue
982afe13c8eSmrg  am__include=`sed -n 's/^am__include = //p' < "$mf"`
983afe13c8eSmrg  test -z "am__include" && continue
984afe13c8eSmrg  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
985b3307321Smrg  # When using ansi2knr, U may be empty or an underscore; expand it
986afe13c8eSmrg  U=`sed -n 's/^U = //p' < "$mf"`
987afe13c8eSmrg  # Find all dependency output files, they are included files with
988afe13c8eSmrg  # $(DEPDIR) in their names.  We invoke sed twice because it is the
989afe13c8eSmrg  # simplest approach to changing $(DEPDIR) to its actual value in the
990afe13c8eSmrg  # expansion.
991afe13c8eSmrg  for file in `sed -n "
992afe13c8eSmrg    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
993b3307321Smrg       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
994b3307321Smrg    # Make sure the directory exists.
995b3307321Smrg    test -f "$dirpart/$file" && continue
996b3307321Smrg    fdir=`AS_DIRNAME(["$file"])`
997b3307321Smrg    AS_MKDIR_P([$dirpart/$fdir])
998b3307321Smrg    # echo "creating $dirpart/$file"
999b3307321Smrg    echo '# dummy' > "$dirpart/$file"
1000b3307321Smrg  done
1001b3307321Smrgdone
1002b3307321Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
1003b3307321Smrg
1004b3307321Smrg
1005b3307321Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
1006b3307321Smrg# -----------------------------
1007b3307321Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
1008b3307321Smrg#
1009b3307321Smrg# This code is only required when automatic dependency tracking
1010b3307321Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
1011b3307321Smrg# need in order to bootstrap the dependency handling code.
1012b3307321SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
1013b3307321Smrg[AC_CONFIG_COMMANDS([depfiles],
1014b3307321Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
1015b3307321Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
1016b3307321Smrg])
1017b3307321Smrg
1018afe13c8eSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
1019afe13c8eSmrg# Free Software Foundation, Inc.
1020afe13c8eSmrg#
1021afe13c8eSmrg# This file is free software; the Free Software Foundation
1022afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1023afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1024b3307321Smrg
1025afe13c8eSmrg# serial 8
1026b3307321Smrg
1027afe13c8eSmrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
1028afe13c8eSmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
1029b3307321Smrg
1030afe13c8eSmrg# Do all the work for Automake.                             -*- Autoconf -*-
1031b3307321Smrg
1032afe13c8eSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
1033afe13c8eSmrg# 2005, 2006, 2008 Free Software Foundation, Inc.
1034afe13c8eSmrg#
1035afe13c8eSmrg# This file is free software; the Free Software Foundation
1036afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1037afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1038afe13c8eSmrg
1039afe13c8eSmrg# serial 13
1040afe13c8eSmrg
1041afe13c8eSmrg# This macro actually does too much.  Some checks are only needed if
1042afe13c8eSmrg# your package does certain things.  But this isn't really a big deal.
1043afe13c8eSmrg
1044afe13c8eSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1045afe13c8eSmrg# AM_INIT_AUTOMAKE([OPTIONS])
1046afe13c8eSmrg# -----------------------------------------------
1047afe13c8eSmrg# The call with PACKAGE and VERSION arguments is the old style
1048afe13c8eSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
1049afe13c8eSmrg# and VERSION should now be passed to AC_INIT and removed from
1050afe13c8eSmrg# the call to AM_INIT_AUTOMAKE.
1051afe13c8eSmrg# We support both call styles for the transition.  After
1052afe13c8eSmrg# the next Automake release, Autoconf can make the AC_INIT
1053afe13c8eSmrg# arguments mandatory, and then we can depend on a new Autoconf
1054afe13c8eSmrg# release and drop the old call support.
1055afe13c8eSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
1056afe13c8eSmrg[AC_PREREQ([2.60])dnl
1057afe13c8eSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
1058afe13c8eSmrgdnl the ones we care about.
1059afe13c8eSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1060afe13c8eSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1061afe13c8eSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
1062afe13c8eSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
1063afe13c8eSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
1064afe13c8eSmrg  # is not polluted with repeated "-I."
1065afe13c8eSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
1066afe13c8eSmrg  # test to see if srcdir already configured
1067afe13c8eSmrg  if test -f $srcdir/config.status; then
1068afe13c8eSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1069afe13c8eSmrg  fi
1070afe13c8eSmrgfi
1071afe13c8eSmrg
1072afe13c8eSmrg# test whether we have cygpath
1073afe13c8eSmrgif test -z "$CYGPATH_W"; then
1074afe13c8eSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
1075afe13c8eSmrg    CYGPATH_W='cygpath -w'
1076afe13c8eSmrg  else
1077afe13c8eSmrg    CYGPATH_W=echo
1078afe13c8eSmrg  fi
1079afe13c8eSmrgfi
1080afe13c8eSmrgAC_SUBST([CYGPATH_W])
1081afe13c8eSmrg
1082afe13c8eSmrg# Define the identity of the package.
1083afe13c8eSmrgdnl Distinguish between old-style and new-style calls.
1084afe13c8eSmrgm4_ifval([$2],
1085afe13c8eSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1086afe13c8eSmrg AC_SUBST([PACKAGE], [$1])dnl
1087afe13c8eSmrg AC_SUBST([VERSION], [$2])],
1088afe13c8eSmrg[_AM_SET_OPTIONS([$1])dnl
1089afe13c8eSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
1090afe13c8eSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
1091afe13c8eSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
1092afe13c8eSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1093afe13c8eSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1094afe13c8eSmrg
1095afe13c8eSmrg_AM_IF_OPTION([no-define],,
1096afe13c8eSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1097afe13c8eSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
1098afe13c8eSmrg
1099afe13c8eSmrg# Some tools Automake needs.
1100afe13c8eSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
1101afe13c8eSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
1102afe13c8eSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
1103afe13c8eSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
1104afe13c8eSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
1105afe13c8eSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
1106afe13c8eSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
1107afe13c8eSmrgAM_PROG_INSTALL_SH
1108afe13c8eSmrgAM_PROG_INSTALL_STRIP
1109afe13c8eSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
1110afe13c8eSmrg# We need awk for the "check" target.  The system "awk" is bad on
1111afe13c8eSmrg# some platforms.
1112afe13c8eSmrgAC_REQUIRE([AC_PROG_AWK])dnl
1113afe13c8eSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
1114afe13c8eSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
1115afe13c8eSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
1116afe13c8eSmrg              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
1117afe13c8eSmrg	      		     [_AM_PROG_TAR([v7])])])
1118afe13c8eSmrg_AM_IF_OPTION([no-dependencies],,
1119afe13c8eSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
1120afe13c8eSmrg                  [_AM_DEPENDENCIES(CC)],
1121afe13c8eSmrg                  [define([AC_PROG_CC],
1122afe13c8eSmrg                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
1123afe13c8eSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
1124afe13c8eSmrg                  [_AM_DEPENDENCIES(CXX)],
1125afe13c8eSmrg                  [define([AC_PROG_CXX],
1126afe13c8eSmrg                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
1127afe13c8eSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
1128afe13c8eSmrg                  [_AM_DEPENDENCIES(OBJC)],
1129afe13c8eSmrg                  [define([AC_PROG_OBJC],
1130afe13c8eSmrg                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
1131afe13c8eSmrg])
1132afe13c8eSmrg])
1133afe13c8eSmrg
1134afe13c8eSmrg
1135afe13c8eSmrg# When config.status generates a header, we must update the stamp-h file.
1136afe13c8eSmrg# This file resides in the same directory as the config header
1137afe13c8eSmrg# that is generated.  The stamp files are numbered to have different names.
1138afe13c8eSmrg
1139afe13c8eSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
1140afe13c8eSmrg# loop where config.status creates the headers, so we can generate
1141afe13c8eSmrg# our stamp files there.
1142afe13c8eSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
1143afe13c8eSmrg[# Compute $1's index in $config_headers.
1144afe13c8eSmrg_am_arg=$1
1145afe13c8eSmrg_am_stamp_count=1
1146afe13c8eSmrgfor _am_header in $config_headers :; do
1147afe13c8eSmrg  case $_am_header in
1148afe13c8eSmrg    $_am_arg | $_am_arg:* )
1149afe13c8eSmrg      break ;;
1150afe13c8eSmrg    * )
1151afe13c8eSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
1152afe13c8eSmrg  esac
1153afe13c8eSmrgdone
1154afe13c8eSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
1155afe13c8eSmrg
1156afe13c8eSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
1157afe13c8eSmrg#
1158afe13c8eSmrg# This file is free software; the Free Software Foundation
1159afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1160afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1161afe13c8eSmrg
1162afe13c8eSmrg# AM_PROG_INSTALL_SH
1163afe13c8eSmrg# ------------------
1164afe13c8eSmrg# Define $install_sh.
1165afe13c8eSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
1166afe13c8eSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1167afe13c8eSmrginstall_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
1168afe13c8eSmrgAC_SUBST(install_sh)])
1169afe13c8eSmrg
1170afe13c8eSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
1171afe13c8eSmrg#
1172afe13c8eSmrg# This file is free software; the Free Software Foundation
1173afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1174afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1175b3307321Smrg
1176b3307321Smrg# serial 2
1177b3307321Smrg
1178afe13c8eSmrg# Check whether the underlying file-system supports filenames
1179afe13c8eSmrg# with a leading dot.  For instance MS-DOS doesn't.
1180afe13c8eSmrgAC_DEFUN([AM_SET_LEADING_DOT],
1181afe13c8eSmrg[rm -rf .tst 2>/dev/null
1182afe13c8eSmrgmkdir .tst 2>/dev/null
1183afe13c8eSmrgif test -d .tst; then
1184afe13c8eSmrg  am__leading_dot=.
1185afe13c8eSmrgelse
1186afe13c8eSmrg  am__leading_dot=_
1187afe13c8eSmrgfi
1188afe13c8eSmrgrmdir .tst 2>/dev/null
1189afe13c8eSmrgAC_SUBST([am__leading_dot])])
1190afe13c8eSmrg
1191afe13c8eSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
1192afe13c8eSmrg# From Jim Meyering
1193afe13c8eSmrg
1194afe13c8eSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
1195afe13c8eSmrg# Free Software Foundation, Inc.
1196afe13c8eSmrg#
1197afe13c8eSmrg# This file is free software; the Free Software Foundation
1198afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1199afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1200afe13c8eSmrg
1201afe13c8eSmrg# serial 4
1202afe13c8eSmrg
1203afe13c8eSmrgAC_DEFUN([AM_MAINTAINER_MODE],
1204afe13c8eSmrg[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1205afe13c8eSmrg  dnl maintainer-mode is disabled by default
1206afe13c8eSmrg  AC_ARG_ENABLE(maintainer-mode,
1207afe13c8eSmrg[  --enable-maintainer-mode  enable make rules and dependencies not useful
1208afe13c8eSmrg			  (and sometimes confusing) to the casual installer],
1209afe13c8eSmrg      USE_MAINTAINER_MODE=$enableval,
1210afe13c8eSmrg      USE_MAINTAINER_MODE=no)
1211afe13c8eSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
1212afe13c8eSmrg  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
1213afe13c8eSmrg  MAINT=$MAINTAINER_MODE_TRUE
1214afe13c8eSmrg  AC_SUBST(MAINT)dnl
1215afe13c8eSmrg]
1216afe13c8eSmrg)
1217afe13c8eSmrg
1218afe13c8eSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
1219afe13c8eSmrg
1220afe13c8eSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
1221afe13c8eSmrg
1222afe13c8eSmrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
1223afe13c8eSmrg#
1224afe13c8eSmrg# This file is free software; the Free Software Foundation
1225afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1226afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1227afe13c8eSmrg
1228afe13c8eSmrg# serial 3
1229afe13c8eSmrg
1230b3307321Smrg# AM_MAKE_INCLUDE()
1231b3307321Smrg# -----------------
1232b3307321Smrg# Check to see how make treats includes.
1233b3307321SmrgAC_DEFUN([AM_MAKE_INCLUDE],
1234b3307321Smrg[am_make=${MAKE-make}
1235b3307321Smrgcat > confinc << 'END'
1236b3307321Smrgam__doit:
1237b3307321Smrg	@echo done
1238b3307321Smrg.PHONY: am__doit
1239b3307321SmrgEND
1240b3307321Smrg# If we don't find an include directive, just comment out the code.
1241b3307321SmrgAC_MSG_CHECKING([for style of include used by $am_make])
1242b3307321Smrgam__include="#"
1243b3307321Smrgam__quote=
1244b3307321Smrg_am_result=none
1245b3307321Smrg# First try GNU make style include.
1246b3307321Smrgecho "include confinc" > confmf
1247b3307321Smrg# We grep out `Entering directory' and `Leaving directory'
1248b3307321Smrg# messages which can occur if `w' ends up in MAKEFLAGS.
1249b3307321Smrg# In particular we don't look at `^make:' because GNU make might
1250b3307321Smrg# be invoked under some other name (usually "gmake"), in which
1251b3307321Smrg# case it prints its new name instead of `make'.
1252b3307321Smrgif test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
1253b3307321Smrg   am__include=include
1254b3307321Smrg   am__quote=
1255b3307321Smrg   _am_result=GNU
1256b3307321Smrgfi
1257b3307321Smrg# Now try BSD make style include.
1258b3307321Smrgif test "$am__include" = "#"; then
1259b3307321Smrg   echo '.include "confinc"' > confmf
1260b3307321Smrg   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
1261b3307321Smrg      am__include=.include
1262b3307321Smrg      am__quote="\""
1263b3307321Smrg      _am_result=BSD
1264b3307321Smrg   fi
1265b3307321Smrgfi
1266b3307321SmrgAC_SUBST([am__include])
1267b3307321SmrgAC_SUBST([am__quote])
1268b3307321SmrgAC_MSG_RESULT([$_am_result])
1269b3307321Smrgrm -f confinc confmf
1270b3307321Smrg])
1271b3307321Smrg
1272afe13c8eSmrg# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
1273afe13c8eSmrg# Free Software Foundation, Inc.
1274afe13c8eSmrg#
1275afe13c8eSmrg# This file is free software; the Free Software Foundation
1276afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1277afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1278b3307321Smrg
1279afe13c8eSmrg# serial 5
1280b3307321Smrg
1281afe13c8eSmrg# AM_PROG_CC_C_O
1282afe13c8eSmrg# --------------
1283afe13c8eSmrg# Like AC_PROG_CC_C_O, but changed for automake.
1284afe13c8eSmrgAC_DEFUN([AM_PROG_CC_C_O],
1285afe13c8eSmrg[AC_REQUIRE([AC_PROG_CC_C_O])dnl
1286afe13c8eSmrgAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1287afe13c8eSmrgAC_REQUIRE_AUX_FILE([compile])dnl
1288afe13c8eSmrg# FIXME: we rely on the cache variable name because
1289afe13c8eSmrg# there is no other way.
1290afe13c8eSmrgset dummy $CC
1291afe13c8eSmrgac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
1292afe13c8eSmrgif eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
1293afe13c8eSmrg   # Losing compiler, so override with the script.
1294afe13c8eSmrg   # FIXME: It is wrong to rewrite CC.
1295afe13c8eSmrg   # But if we don't then we get into trouble of one sort or another.
1296afe13c8eSmrg   # A longer-term fix would be to have automake use am__CC in this case,
1297afe13c8eSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
1298afe13c8eSmrg   CC="$am_aux_dir/compile $CC"
1299afe13c8eSmrgfi
1300afe13c8eSmrgdnl Make sure AC_PROG_CC is never called again, or it will override our
1301afe13c8eSmrgdnl setting of CC.
1302afe13c8eSmrgm4_define([AC_PROG_CC],
1303afe13c8eSmrg          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
1304afe13c8eSmrg])
1305b3307321Smrg
1306afe13c8eSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
1307b3307321Smrg
1308afe13c8eSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
1309afe13c8eSmrg# Free Software Foundation, Inc.
1310afe13c8eSmrg#
1311afe13c8eSmrg# This file is free software; the Free Software Foundation
1312afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1313afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1314b3307321Smrg
1315b3307321Smrg# serial 5
1316b3307321Smrg
1317afe13c8eSmrg# AM_MISSING_PROG(NAME, PROGRAM)
1318afe13c8eSmrg# ------------------------------
1319afe13c8eSmrgAC_DEFUN([AM_MISSING_PROG],
1320afe13c8eSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
1321afe13c8eSmrg$1=${$1-"${am_missing_run}$2"}
1322afe13c8eSmrgAC_SUBST($1)])
1323afe13c8eSmrg
1324b3307321Smrg
1325afe13c8eSmrg# AM_MISSING_HAS_RUN
1326afe13c8eSmrg# ------------------
1327afe13c8eSmrg# Define MISSING if not defined so far and test if it supports --run.
1328afe13c8eSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
1329afe13c8eSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
1330afe13c8eSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1331afe13c8eSmrgAC_REQUIRE_AUX_FILE([missing])dnl
1332afe13c8eSmrgtest x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
1333afe13c8eSmrg# Use eval to expand $SHELL
1334afe13c8eSmrgif eval "$MISSING --run true"; then
1335afe13c8eSmrg  am_missing_run="$MISSING --run "
1336b3307321Smrgelse
1337afe13c8eSmrg  am_missing_run=
1338afe13c8eSmrg  AC_MSG_WARN([`missing' script is too old or missing])
1339b3307321Smrgfi
1340afe13c8eSmrg])
1341b3307321Smrg
1342afe13c8eSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
1343afe13c8eSmrg#
1344afe13c8eSmrg# This file is free software; the Free Software Foundation
1345afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1346afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1347b3307321Smrg
1348afe13c8eSmrg# AM_PROG_MKDIR_P
1349afe13c8eSmrg# ---------------
1350afe13c8eSmrg# Check for `mkdir -p'.
1351afe13c8eSmrgAC_DEFUN([AM_PROG_MKDIR_P],
1352afe13c8eSmrg[AC_PREREQ([2.60])dnl
1353afe13c8eSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
1354afe13c8eSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
1355afe13c8eSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
1356afe13c8eSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
1357afe13c8eSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
1358afe13c8eSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
1359afe13c8eSmrgdnl adjustment using top_builddir (which is defined more often than
1360afe13c8eSmrgdnl MKDIR_P).
1361afe13c8eSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
1362afe13c8eSmrgcase $mkdir_p in
1363afe13c8eSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
1364afe13c8eSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
1365afe13c8eSmrgesac
1366afe13c8eSmrg])
1367b3307321Smrg
1368afe13c8eSmrg# Helper functions for option handling.                     -*- Autoconf -*-
1369b3307321Smrg
1370afe13c8eSmrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
1371afe13c8eSmrg#
1372afe13c8eSmrg# This file is free software; the Free Software Foundation
1373afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1374afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1375b3307321Smrg
1376afe13c8eSmrg# serial 3
1377b3307321Smrg
1378afe13c8eSmrg# _AM_MANGLE_OPTION(NAME)
1379afe13c8eSmrg# -----------------------
1380afe13c8eSmrgAC_DEFUN([_AM_MANGLE_OPTION],
1381afe13c8eSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
1382b3307321Smrg
1383afe13c8eSmrg# _AM_SET_OPTION(NAME)
1384afe13c8eSmrg# ------------------------------
1385afe13c8eSmrg# Set option NAME.  Presently that only means defining a flag for this option.
1386afe13c8eSmrgAC_DEFUN([_AM_SET_OPTION],
1387afe13c8eSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
1388b3307321Smrg
1389afe13c8eSmrg# _AM_SET_OPTIONS(OPTIONS)
1390afe13c8eSmrg# ----------------------------------
1391afe13c8eSmrg# OPTIONS is a space-separated list of Automake options.
1392afe13c8eSmrgAC_DEFUN([_AM_SET_OPTIONS],
1393afe13c8eSmrg[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
1394b3307321Smrg
1395afe13c8eSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
1396afe13c8eSmrg# -------------------------------------------
1397afe13c8eSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
1398afe13c8eSmrgAC_DEFUN([_AM_IF_OPTION],
1399afe13c8eSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
1400b3307321Smrg
1401afe13c8eSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
1402b3307321Smrg
1403afe13c8eSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
1404afe13c8eSmrg# Free Software Foundation, Inc.
1405afe13c8eSmrg#
1406afe13c8eSmrg# This file is free software; the Free Software Foundation
1407afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1408afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1409b3307321Smrg
1410afe13c8eSmrg# serial 4
1411b3307321Smrg
1412afe13c8eSmrg# AM_SANITY_CHECK
1413afe13c8eSmrg# ---------------
1414afe13c8eSmrgAC_DEFUN([AM_SANITY_CHECK],
1415afe13c8eSmrg[AC_MSG_CHECKING([whether build environment is sane])
1416afe13c8eSmrg# Just in case
1417afe13c8eSmrgsleep 1
1418afe13c8eSmrgecho timestamp > conftest.file
1419afe13c8eSmrg# Do `set' in a subshell so we don't clobber the current shell's
1420afe13c8eSmrg# arguments.  Must try -L first in case configure is actually a
1421afe13c8eSmrg# symlink; some systems play weird games with the mod time of symlinks
1422afe13c8eSmrg# (eg FreeBSD returns the mod time of the symlink's containing
1423afe13c8eSmrg# directory).
1424afe13c8eSmrgif (
1425afe13c8eSmrg   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
1426afe13c8eSmrg   if test "$[*]" = "X"; then
1427afe13c8eSmrg      # -L didn't work.
1428afe13c8eSmrg      set X `ls -t $srcdir/configure conftest.file`
1429afe13c8eSmrg   fi
1430afe13c8eSmrg   rm -f conftest.file
1431afe13c8eSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
1432afe13c8eSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
1433b3307321Smrg
1434afe13c8eSmrg      # If neither matched, then we have a broken ls.  This can happen
1435afe13c8eSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
1436afe13c8eSmrg      # broken ls alias from the environment.  This has actually
1437afe13c8eSmrg      # happened.  Such a system could not be considered "sane".
1438afe13c8eSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1439afe13c8eSmrgalias in your environment])
1440afe13c8eSmrg   fi
1441b3307321Smrg
1442afe13c8eSmrg   test "$[2]" = conftest.file
1443afe13c8eSmrg   )
1444afe13c8eSmrgthen
1445afe13c8eSmrg   # Ok.
1446afe13c8eSmrg   :
1447afe13c8eSmrgelse
1448afe13c8eSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
1449afe13c8eSmrgCheck your system clock])
1450afe13c8eSmrgfi
1451afe13c8eSmrgAC_MSG_RESULT(yes)])
1452b3307321Smrg
1453afe13c8eSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
1454b3307321Smrg#
1455afe13c8eSmrg# This file is free software; the Free Software Foundation
1456afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1457afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1458b3307321Smrg
1459afe13c8eSmrg# AM_PROG_INSTALL_STRIP
1460afe13c8eSmrg# ---------------------
1461afe13c8eSmrg# One issue with vendor `install' (even GNU) is that you can't
1462afe13c8eSmrg# specify the program used to strip binaries.  This is especially
1463afe13c8eSmrg# annoying in cross-compiling environments, where the build's strip
1464afe13c8eSmrg# is unlikely to handle the host's binaries.
1465afe13c8eSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1466afe13c8eSmrg# always use install-sh in `make install-strip', and initialize
1467afe13c8eSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
1468afe13c8eSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1469afe13c8eSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1470afe13c8eSmrg# Installed binaries are usually stripped using `strip' when the user
1471afe13c8eSmrg# run `make install-strip'.  However `strip' might not be the right
1472afe13c8eSmrg# tool to use in cross-compilation environments, therefore Automake
1473afe13c8eSmrg# will honor the `STRIP' environment variable to overrule this program.
1474afe13c8eSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
1475afe13c8eSmrgif test "$cross_compiling" != no; then
1476afe13c8eSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
1477b3307321Smrgfi
1478afe13c8eSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1479afe13c8eSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1480b3307321Smrg
1481afe13c8eSmrg# Copyright (C) 2006  Free Software Foundation, Inc.
1482b3307321Smrg#
1483afe13c8eSmrg# This file is free software; the Free Software Foundation
1484afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1485afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1486b3307321Smrg
1487afe13c8eSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1488afe13c8eSmrg# ---------------------------
1489afe13c8eSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1490afe13c8eSmrg# This macro is traced by Automake.
1491afe13c8eSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1492b3307321Smrg
1493afe13c8eSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1494b3307321Smrg
1495afe13c8eSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
1496afe13c8eSmrg#
1497afe13c8eSmrg# This file is free software; the Free Software Foundation
1498afe13c8eSmrg# gives unlimited permission to copy and/or distribute it,
1499afe13c8eSmrg# with or without modifications, as long as this notice is preserved.
1500b3307321Smrg
1501afe13c8eSmrg# serial 2
1502b3307321Smrg
1503afe13c8eSmrg# _AM_PROG_TAR(FORMAT)
1504afe13c8eSmrg# --------------------
1505afe13c8eSmrg# Check how to create a tarball in format FORMAT.
1506afe13c8eSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
1507b3307321Smrg#
1508afe13c8eSmrg# Substitute a variable $(am__tar) that is a command
1509afe13c8eSmrg# writing to stdout a FORMAT-tarball containing the directory
1510afe13c8eSmrg# $tardir.
1511afe13c8eSmrg#     tardir=directory && $(am__tar) > result.tar
1512b3307321Smrg#
1513afe13c8eSmrg# Substitute a variable $(am__untar) that extract such
1514afe13c8eSmrg# a tarball read from stdin.
1515afe13c8eSmrg#     $(am__untar) < result.tar
1516afe13c8eSmrgAC_DEFUN([_AM_PROG_TAR],
1517afe13c8eSmrg[# Always define AMTAR for backward compatibility.
1518afe13c8eSmrgAM_MISSING_PROG([AMTAR], [tar])
1519afe13c8eSmrgm4_if([$1], [v7],
1520afe13c8eSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1521afe13c8eSmrg     [m4_case([$1], [ustar],, [pax],,
1522afe13c8eSmrg              [m4_fatal([Unknown tar format])])
1523afe13c8eSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
1524afe13c8eSmrg# Loop over all known methods to create a tar archive until one works.
1525afe13c8eSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1526afe13c8eSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1527afe13c8eSmrg# Do not fold the above two line into one, because Tru64 sh and
1528afe13c8eSmrg# Solaris sh will not grok spaces in the rhs of `-'.
1529afe13c8eSmrgfor _am_tool in $_am_tools
1530afe13c8eSmrgdo
1531afe13c8eSmrg  case $_am_tool in
1532afe13c8eSmrg  gnutar)
1533afe13c8eSmrg    for _am_tar in tar gnutar gtar;
1534afe13c8eSmrg    do
1535afe13c8eSmrg      AM_RUN_LOG([$_am_tar --version]) && break
1536afe13c8eSmrg    done
1537afe13c8eSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1538afe13c8eSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1539afe13c8eSmrg    am__untar="$_am_tar -xf -"
1540afe13c8eSmrg    ;;
1541afe13c8eSmrg  plaintar)
1542afe13c8eSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
1543afe13c8eSmrg    # ustar tarball either.
1544afe13c8eSmrg    (tar --version) >/dev/null 2>&1 && continue
1545afe13c8eSmrg    am__tar='tar chf - "$$tardir"'
1546afe13c8eSmrg    am__tar_='tar chf - "$tardir"'
1547afe13c8eSmrg    am__untar='tar xf -'
1548afe13c8eSmrg    ;;
1549afe13c8eSmrg  pax)
1550afe13c8eSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
1551afe13c8eSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
1552afe13c8eSmrg    am__untar='pax -r'
1553afe13c8eSmrg    ;;
1554afe13c8eSmrg  cpio)
1555afe13c8eSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1556afe13c8eSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1557afe13c8eSmrg    am__untar='cpio -i -H $1 -d'
1558afe13c8eSmrg    ;;
1559afe13c8eSmrg  none)
1560afe13c8eSmrg    am__tar=false
1561afe13c8eSmrg    am__tar_=false
1562afe13c8eSmrg    am__untar=false
1563afe13c8eSmrg    ;;
1564afe13c8eSmrg  esac
1565b3307321Smrg
1566afe13c8eSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
1567afe13c8eSmrg  # and am__untar set.
1568afe13c8eSmrg  test -n "${am_cv_prog_tar_$1}" && break
1569b3307321Smrg
1570afe13c8eSmrg  # tar/untar a dummy directory, and stop if the command works
1571afe13c8eSmrg  rm -rf conftest.dir
1572afe13c8eSmrg  mkdir conftest.dir
1573afe13c8eSmrg  echo GrepMe > conftest.dir/file
1574afe13c8eSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1575afe13c8eSmrg  rm -rf conftest.dir
1576afe13c8eSmrg  if test -s conftest.tar; then
1577afe13c8eSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1578afe13c8eSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1579afe13c8eSmrg  fi
1580afe13c8eSmrgdone
1581afe13c8eSmrgrm -rf conftest.dir
1582b3307321Smrg
1583afe13c8eSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1584afe13c8eSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1585afe13c8eSmrgAC_SUBST([am__tar])
1586afe13c8eSmrgAC_SUBST([am__untar])
1587afe13c8eSmrg]) # _AM_PROG_TAR
1588b3307321Smrg
1589