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