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