aclocal.m4 revision d838582f
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
22dnl
23dnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
24dnl 
25dnl Permission is hereby granted, free of charge, to any person obtaining a
26dnl copy of this software and associated documentation files (the
27dnl "Software"), to deal in the Software without restriction, including
28dnl without limitation the rights to use, copy, modify, merge, publish,
29dnl distribute, and/or sell copies of the Software, and to permit persons
30dnl to whom the Software is furnished to do so, provided that the above
31dnl copyright notice(s) and this permission notice appear in all copies of
32dnl the Software and that both the above copyright notice(s) and this
33dnl permission notice appear in supporting documentation.
34dnl
35dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
36dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
38dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
39dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
40dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
41dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
42dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
43dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
44dnl
45dnl Except as contained in this notice, the name of a copyright holder
46dnl shall not be used in advertising or otherwise to promote the sale, use
47dnl or other dealings in this Software without prior written authorization
48dnl of the copyright holder.
49
50# XORG_MACROS_VERSION(required-version)
51# -------------------------------------
52# Minimum version: 1.1.0
53#
54# If you're using a macro added in Version 1.1 or newer, include this in
55# your configure.ac with the minimum required version, such as:
56# XORG_MACROS_VERSION(1.1)
57#
58# To force at least a version with this macro defined, also add:
59# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
60#
61#
62# See the "minimum version" comment for each macro you use to see what 
63# version you require.
64AC_DEFUN([XORG_MACROS_VERSION],[
65	[XORG_MACROS_needed_version=$1
66	XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
67	XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
68	AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
69	[XORG_MACROS_version=1.1.6
70	XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
71	XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
72	if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
73		AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
74	fi
75	if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
76		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])
77	fi
78	AC_MSG_RESULT([yes, $XORG_MACROS_version])
79]) # XORG_MACROS_VERSION
80
81# XORG_PROG_RAWCPP()
82# ------------------
83# Minimum version: 1.0.0
84#
85# Find cpp program and necessary flags for use in pre-processing text files
86# such as man pages and config files
87AC_DEFUN([XORG_PROG_RAWCPP],[
88AC_REQUIRE([AC_PROG_CPP])
89AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
90   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
91
92# Check for flag to avoid builtin definitions - assumes unix is predefined,
93# which is not the best choice for supporting other OS'es, but covers most
94# of the ones we need for now.
95AC_MSG_CHECKING([if $RAWCPP requires -undef])
96AC_LANG_CONFTEST([Does cpp redefine unix ?])
97if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
98	AC_MSG_RESULT([no])
99else
100	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
101		RAWCPPFLAGS=-undef
102		AC_MSG_RESULT([yes])
103	else
104		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
105	fi
106fi
107rm -f conftest.$ac_ext
108
109AC_MSG_CHECKING([if $RAWCPP requires -traditional])
110AC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
111if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
112	AC_MSG_RESULT([no])
113else
114	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
115		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
116		AC_MSG_RESULT([yes])
117	else
118		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
119	fi
120fi
121rm -f conftest.$ac_ext
122AC_SUBST(RAWCPPFLAGS)
123]) # XORG_PROG_RAWCPP
124
125# XORG_MANPAGE_SECTIONS()
126# -----------------------
127# Minimum version: 1.0.0
128#
129# Determine which sections man pages go in for the different man page types
130# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
131# Not sure if there's any better way than just hardcoding by OS name.
132# Override default settings by setting environment variables
133
134AC_DEFUN([XORG_MANPAGE_SECTIONS],[
135AC_REQUIRE([AC_CANONICAL_HOST])
136
137if test x$APP_MAN_SUFFIX = x    ; then
138    APP_MAN_SUFFIX=1
139fi
140if test x$APP_MAN_DIR = x    ; then
141    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
142fi
143
144if test x$LIB_MAN_SUFFIX = x    ; then
145    LIB_MAN_SUFFIX=3
146fi
147if test x$LIB_MAN_DIR = x    ; then
148    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
149fi
150
151if test x$FILE_MAN_SUFFIX = x    ; then
152    case $host_os in
153	solaris*)	FILE_MAN_SUFFIX=4  ;;
154	*)		FILE_MAN_SUFFIX=5  ;;
155    esac
156fi
157if test x$FILE_MAN_DIR = x    ; then
158    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
159fi
160
161if test x$MISC_MAN_SUFFIX = x    ; then
162    case $host_os in
163	solaris*)	MISC_MAN_SUFFIX=5  ;;
164	*)		MISC_MAN_SUFFIX=7  ;;
165    esac
166fi
167if test x$MISC_MAN_DIR = x    ; then
168    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
169fi
170
171if test x$DRIVER_MAN_SUFFIX = x    ; then
172    case $host_os in
173	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
174	*)		DRIVER_MAN_SUFFIX=4  ;;
175    esac
176fi
177if test x$DRIVER_MAN_DIR = x    ; then
178    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
179fi
180
181if test x$ADMIN_MAN_SUFFIX = x    ; then
182    case $host_os in
183	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
184	*)		ADMIN_MAN_SUFFIX=8  ;;
185    esac
186fi
187if test x$ADMIN_MAN_DIR = x    ; then
188    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
189fi
190
191
192AC_SUBST([APP_MAN_SUFFIX])
193AC_SUBST([LIB_MAN_SUFFIX])
194AC_SUBST([FILE_MAN_SUFFIX])
195AC_SUBST([MISC_MAN_SUFFIX])
196AC_SUBST([DRIVER_MAN_SUFFIX])
197AC_SUBST([ADMIN_MAN_SUFFIX])
198AC_SUBST([APP_MAN_DIR])
199AC_SUBST([LIB_MAN_DIR])
200AC_SUBST([FILE_MAN_DIR])
201AC_SUBST([MISC_MAN_DIR])
202AC_SUBST([DRIVER_MAN_DIR])
203AC_SUBST([ADMIN_MAN_DIR])
204]) # XORG_MANPAGE_SECTIONS
205
206# XORG_CHECK_LINUXDOC
207# -------------------
208# Minimum version: 1.0.0
209#
210# Defines the variable MAKE_TEXT if the necessary tools and
211# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
212# Whether or not the necessary tools and files are found can be checked
213# with the AM_CONDITIONAL "BUILD_LINUXDOC"
214AC_DEFUN([XORG_CHECK_LINUXDOC],[
215XORG_SGML_PATH=$prefix/share/sgml
216HAVE_DEFS_ENT=
217
218if test x"$cross_compiling" = x"yes" ; then
219  HAVE_DEFS_ENT=no
220else
221  AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
222fi
223
224AC_PATH_PROG(LINUXDOC, linuxdoc)
225AC_PATH_PROG(PS2PDF, ps2pdf)
226
227AC_MSG_CHECKING([Whether to build documentation])
228
229if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
230   BUILDDOC=yes
231else
232   BUILDDOC=no
233fi
234
235AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
236
237AC_MSG_RESULT([$BUILDDOC])
238
239AC_MSG_CHECKING([Whether to build pdf documentation])
240
241if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
242   BUILDPDFDOC=yes
243else
244   BUILDPDFDOC=no
245fi
246
247AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
248
249AC_MSG_RESULT([$BUILDPDFDOC])
250
251MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
252MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
253MAKE_PDF="$PS2PDF"
254MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
255
256AC_SUBST(MAKE_TEXT)
257AC_SUBST(MAKE_PS)
258AC_SUBST(MAKE_PDF)
259AC_SUBST(MAKE_HTML)
260]) # XORG_CHECK_LINUXDOC
261
262# XORG_CHECK_DOCBOOK
263# -------------------
264# Minimum version: 1.0.0
265#
266# Checks for the ability to build output formats from SGML DocBook source.
267# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
268# indicates whether the necessary tools and files are found and, if set,
269# $(MAKE_XXX) blah.sgml will produce blah.xxx.
270AC_DEFUN([XORG_CHECK_DOCBOOK],[
271XORG_SGML_PATH=$prefix/share/sgml
272HAVE_DEFS_ENT=
273BUILDTXTDOC=no
274BUILDPDFDOC=no
275BUILDPSDOC=no
276BUILDHTMLDOC=no
277
278AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
279
280AC_PATH_PROG(DOCBOOKPS, docbook2ps)
281AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
282AC_PATH_PROG(DOCBOOKHTML, docbook2html)
283AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
284
285AC_MSG_CHECKING([Whether to build text documentation])
286if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
287   test x$BUILD_TXTDOC != xno; then
288	BUILDTXTDOC=yes
289fi
290AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
291AC_MSG_RESULT([$BUILDTXTDOC])
292
293AC_MSG_CHECKING([Whether to build PDF documentation])
294if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
295   test x$BUILD_PDFDOC != xno; then
296	BUILDPDFDOC=yes
297fi
298AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
299AC_MSG_RESULT([$BUILDPDFDOC])
300
301AC_MSG_CHECKING([Whether to build PostScript documentation])
302if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
303   test x$BUILD_PSDOC != xno; then
304	BUILDPSDOC=yes
305fi
306AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
307AC_MSG_RESULT([$BUILDPSDOC])
308
309AC_MSG_CHECKING([Whether to build HTML documentation])
310if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
311   test x$BUILD_HTMLDOC != xno; then
312	BUILDHTMLDOC=yes
313fi
314AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
315AC_MSG_RESULT([$BUILDHTMLDOC])
316
317MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
318MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
319MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
320MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
321
322AC_SUBST(MAKE_TEXT)
323AC_SUBST(MAKE_PS)
324AC_SUBST(MAKE_PDF)
325AC_SUBST(MAKE_HTML)
326]) # XORG_CHECK_DOCBOOK
327
328# XORG_CHECK_MALLOC_ZERO
329# ----------------------
330# Minimum version: 1.0.0
331#
332# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
333# malloc(0) returns NULL.  Packages should add one of these cflags to
334# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
335AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
336AC_ARG_ENABLE(malloc0returnsnull,
337	AC_HELP_STRING([--enable-malloc0returnsnull],
338		       [malloc(0) returns NULL (default: auto)]),
339	[MALLOC_ZERO_RETURNS_NULL=$enableval],
340	[MALLOC_ZERO_RETURNS_NULL=auto])
341
342AC_MSG_CHECKING([whether malloc(0) returns NULL])
343if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
344	AC_RUN_IFELSE([
345char *malloc();
346char *realloc();
347char *calloc();
348main() {
349    char *m0, *r0, *c0, *p;
350    m0 = malloc(0);
351    p = malloc(10);
352    r0 = realloc(p,0);
353    c0 = calloc(0);
354    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
355}],
356		[MALLOC_ZERO_RETURNS_NULL=yes],
357		[MALLOC_ZERO_RETURNS_NULL=no])
358fi
359AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
360
361if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
362	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
363	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
364	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
365else
366	MALLOC_ZERO_CFLAGS=""
367	XMALLOC_ZERO_CFLAGS=""
368	XTMALLOC_ZERO_CFLAGS=""
369fi
370
371AC_SUBST([MALLOC_ZERO_CFLAGS])
372AC_SUBST([XMALLOC_ZERO_CFLAGS])
373AC_SUBST([XTMALLOC_ZERO_CFLAGS])
374]) # XORG_CHECK_MALLOC_ZERO
375
376# XORG_WITH_LINT()
377# ----------------
378# Minimum version: 1.1.0
379#
380# Sets up flags for source checkers such as lint and sparse if --with-lint
381# is specified.   (Use --with-lint=sparse for sparse.)
382# Sets $LINT to name of source checker passed with --with-lint (default: lint)
383# Sets $LINT_FLAGS to flags to pass to source checker
384# Sets LINT automake conditional if enabled (default: disabled)
385#
386AC_DEFUN([XORG_WITH_LINT],[
387
388# Allow checking code with lint, sparse, etc.
389AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
390		[Use a lint-style source code checker (default: disabled)])],
391		[use_lint=$withval], [use_lint=no])
392if test "x$use_lint" = "xyes" ; then
393	LINT="lint"
394else
395	LINT="$use_lint"
396fi
397if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
398    case $LINT in
399	lint|*/lint)
400	    case $host_os in
401		solaris*)
402			LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
403			;;
404	    esac
405	    ;;
406    esac
407fi
408
409AC_SUBST(LINT)
410AC_SUBST(LINT_FLAGS)
411AM_CONDITIONAL(LINT, [test x$LINT != xno])
412
413]) # XORG_WITH_LINT
414
415# XORG_LINT_LIBRARY(LIBNAME)
416# --------------------------
417# Minimum version: 1.1.0
418#
419# Sets up flags for building lint libraries for checking programs that call
420# functions in the library.
421# Disabled by default, enable with --enable-lint-library
422# Sets: 
423#	@LINTLIB@		- name of lint library file to make
424#	MAKE_LINT_LIB		- automake conditional
425#
426
427AC_DEFUN([XORG_LINT_LIBRARY],[
428AC_REQUIRE([XORG_WITH_LINT])
429# Build lint "library" for more indepth checks of programs calling this library
430AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
431	[Create lint library (default: disabled)])],
432	[make_lint_lib=$enableval], [make_lint_lib=no])
433if test "x$make_lint_lib" != "xno" ; then
434	if test "x$LINT" = "xno" ; then
435		AC_MSG_ERROR([Cannot make lint library without --with-lint])
436	fi
437	if test "x$make_lint_lib" = "xyes" ; then
438		LINTLIB=llib-l$1.ln
439	else
440		LINTLIB=$make_lint_lib
441	fi
442fi
443AC_SUBST(LINTLIB)
444AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
445
446]) # XORG_LINT_LIBRARY
447
448dnl Copyright 2005 Red Hat, Inc
449dnl
450dnl Permission to use, copy, modify, distribute, and sell this software and its
451dnl documentation for any purpose is hereby granted without fee, provided that
452dnl the above copyright notice appear in all copies and that both that
453dnl copyright notice and this permission notice appear in supporting
454dnl documentation.
455dnl
456dnl The above copyright notice and this permission notice shall be included
457dnl in all copies or substantial portions of the Software.
458dnl
459dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
460dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
461dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
462dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
463dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
464dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
465dnl OTHER DEALINGS IN THE SOFTWARE.
466dnl
467dnl Except as contained in this notice, the name of the copyright holders shall
468dnl not be used in advertising or otherwise to promote the sale, use or
469dnl other dealings in this Software without prior written authorization
470dnl from the copyright holders.
471dnl
472
473# XORG_RELEASE_VERSION
474# --------------------
475# Adds --with/without-release-string and changes the PACKAGE and
476# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION".  If
477# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged.  Also
478# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
479 
480AC_DEFUN([XORG_RELEASE_VERSION],[
481	AC_ARG_WITH(release-version,
482			AC_HELP_STRING([--with-release-version=STRING],
483				[Use release version string in package name]),
484			[RELEASE_VERSION="$withval"],
485			[RELEASE_VERSION=""])
486	if test "x$RELEASE_VERSION" != "x"; then
487		PACKAGE="$PACKAGE-$RELEASE_VERSION"
488		PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
489		AC_MSG_NOTICE([Building with package name set to $PACKAGE])
490	fi
491	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
492		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
493		[Major version of this package])
494	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
495	if test "x$PVM" = "x"; then
496		PVM="0"
497	fi
498	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
499		[$PVM],
500		[Minor version of this package])
501	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
502	if test "x$PVP" = "x"; then
503		PVP="0"
504	fi
505	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
506		[$PVP],
507		[Patch version of this package])
508])
509
510# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
511#
512# This file is free software; the Free Software Foundation
513# gives unlimited permission to copy and/or distribute it,
514# with or without modifications, as long as this notice is preserved.
515
516# AM_AUTOMAKE_VERSION(VERSION)
517# ----------------------------
518# Automake X.Y traces this macro to ensure aclocal.m4 has been
519# generated from the m4 files accompanying Automake X.Y.
520# (This private macro should not be called outside this file.)
521AC_DEFUN([AM_AUTOMAKE_VERSION],
522[am__api_version='1.10'
523dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
524dnl require some minimum version.  Point them to the right macro.
525m4_if([$1], [1.10.1], [],
526      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
527])
528
529# _AM_AUTOCONF_VERSION(VERSION)
530# -----------------------------
531# aclocal traces this macro to find the Autoconf version.
532# This is a private macro too.  Using m4_define simplifies
533# the logic in aclocal, which can simply ignore this definition.
534m4_define([_AM_AUTOCONF_VERSION], [])
535
536# AM_SET_CURRENT_AUTOMAKE_VERSION
537# -------------------------------
538# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
539# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
540AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
541[AM_AUTOMAKE_VERSION([1.10.1])dnl
542m4_ifndef([AC_AUTOCONF_VERSION],
543  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
544_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
545
546# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
547
548# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
549#
550# This file is free software; the Free Software Foundation
551# gives unlimited permission to copy and/or distribute it,
552# with or without modifications, as long as this notice is preserved.
553
554# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
555# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
556# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
557#
558# Of course, Automake must honor this variable whenever it calls a
559# tool from the auxiliary directory.  The problem is that $srcdir (and
560# therefore $ac_aux_dir as well) can be either absolute or relative,
561# depending on how configure is run.  This is pretty annoying, since
562# it makes $ac_aux_dir quite unusable in subdirectories: in the top
563# source directory, any form will work fine, but in subdirectories a
564# relative path needs to be adjusted first.
565#
566# $ac_aux_dir/missing
567#    fails when called from a subdirectory if $ac_aux_dir is relative
568# $top_srcdir/$ac_aux_dir/missing
569#    fails if $ac_aux_dir is absolute,
570#    fails when called from a subdirectory in a VPATH build with
571#          a relative $ac_aux_dir
572#
573# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
574# are both prefixed by $srcdir.  In an in-source build this is usually
575# harmless because $srcdir is `.', but things will broke when you
576# start a VPATH build or use an absolute $srcdir.
577#
578# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
579# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
580#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
581# and then we would define $MISSING as
582#   MISSING="\${SHELL} $am_aux_dir/missing"
583# This will work as long as MISSING is not called from configure, because
584# unfortunately $(top_srcdir) has no meaning in configure.
585# However there are other variables, like CC, which are often used in
586# configure, and could therefore not use this "fixed" $ac_aux_dir.
587#
588# Another solution, used here, is to always expand $ac_aux_dir to an
589# absolute PATH.  The drawback is that using absolute paths prevent a
590# configured tree to be moved without reconfiguration.
591
592AC_DEFUN([AM_AUX_DIR_EXPAND],
593[dnl Rely on autoconf to set up CDPATH properly.
594AC_PREREQ([2.50])dnl
595# expand $ac_aux_dir to an absolute path
596am_aux_dir=`cd $ac_aux_dir && pwd`
597])
598
599# AM_CONDITIONAL                                            -*- Autoconf -*-
600
601# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
602# Free Software Foundation, Inc.
603#
604# This file is free software; the Free Software Foundation
605# gives unlimited permission to copy and/or distribute it,
606# with or without modifications, as long as this notice is preserved.
607
608# serial 8
609
610# AM_CONDITIONAL(NAME, SHELL-CONDITION)
611# -------------------------------------
612# Define a conditional.
613AC_DEFUN([AM_CONDITIONAL],
614[AC_PREREQ(2.52)dnl
615 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
616	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
617AC_SUBST([$1_TRUE])dnl
618AC_SUBST([$1_FALSE])dnl
619_AM_SUBST_NOTMAKE([$1_TRUE])dnl
620_AM_SUBST_NOTMAKE([$1_FALSE])dnl
621if $2; then
622  $1_TRUE=
623  $1_FALSE='#'
624else
625  $1_TRUE='#'
626  $1_FALSE=
627fi
628AC_CONFIG_COMMANDS_PRE(
629[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
630  AC_MSG_ERROR([[conditional "$1" was never defined.
631Usually this means the macro was only invoked conditionally.]])
632fi])])
633
634# Do all the work for Automake.                             -*- Autoconf -*-
635
636# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
637# 2005, 2006, 2008 Free Software Foundation, Inc.
638#
639# This file is free software; the Free Software Foundation
640# gives unlimited permission to copy and/or distribute it,
641# with or without modifications, as long as this notice is preserved.
642
643# serial 13
644
645# This macro actually does too much.  Some checks are only needed if
646# your package does certain things.  But this isn't really a big deal.
647
648# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
649# AM_INIT_AUTOMAKE([OPTIONS])
650# -----------------------------------------------
651# The call with PACKAGE and VERSION arguments is the old style
652# call (pre autoconf-2.50), which is being phased out.  PACKAGE
653# and VERSION should now be passed to AC_INIT and removed from
654# the call to AM_INIT_AUTOMAKE.
655# We support both call styles for the transition.  After
656# the next Automake release, Autoconf can make the AC_INIT
657# arguments mandatory, and then we can depend on a new Autoconf
658# release and drop the old call support.
659AC_DEFUN([AM_INIT_AUTOMAKE],
660[AC_PREREQ([2.60])dnl
661dnl Autoconf wants to disallow AM_ names.  We explicitly allow
662dnl the ones we care about.
663m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
664AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
665AC_REQUIRE([AC_PROG_INSTALL])dnl
666if test "`cd $srcdir && pwd`" != "`pwd`"; then
667  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
668  # is not polluted with repeated "-I."
669  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
670  # test to see if srcdir already configured
671  if test -f $srcdir/config.status; then
672    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
673  fi
674fi
675
676# test whether we have cygpath
677if test -z "$CYGPATH_W"; then
678  if (cygpath --version) >/dev/null 2>/dev/null; then
679    CYGPATH_W='cygpath -w'
680  else
681    CYGPATH_W=echo
682  fi
683fi
684AC_SUBST([CYGPATH_W])
685
686# Define the identity of the package.
687dnl Distinguish between old-style and new-style calls.
688m4_ifval([$2],
689[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
690 AC_SUBST([PACKAGE], [$1])dnl
691 AC_SUBST([VERSION], [$2])],
692[_AM_SET_OPTIONS([$1])dnl
693dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
694m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
695  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
696 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
697 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
698
699_AM_IF_OPTION([no-define],,
700[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
701 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
702
703# Some tools Automake needs.
704AC_REQUIRE([AM_SANITY_CHECK])dnl
705AC_REQUIRE([AC_ARG_PROGRAM])dnl
706AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
707AM_MISSING_PROG(AUTOCONF, autoconf)
708AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
709AM_MISSING_PROG(AUTOHEADER, autoheader)
710AM_MISSING_PROG(MAKEINFO, makeinfo)
711AM_PROG_INSTALL_SH
712AM_PROG_INSTALL_STRIP
713AC_REQUIRE([AM_PROG_MKDIR_P])dnl
714# We need awk for the "check" target.  The system "awk" is bad on
715# some platforms.
716AC_REQUIRE([AC_PROG_AWK])dnl
717AC_REQUIRE([AC_PROG_MAKE_SET])dnl
718AC_REQUIRE([AM_SET_LEADING_DOT])dnl
719_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
720              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
721	      		     [_AM_PROG_TAR([v7])])])
722_AM_IF_OPTION([no-dependencies],,
723[AC_PROVIDE_IFELSE([AC_PROG_CC],
724                  [_AM_DEPENDENCIES(CC)],
725                  [define([AC_PROG_CC],
726                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
727AC_PROVIDE_IFELSE([AC_PROG_CXX],
728                  [_AM_DEPENDENCIES(CXX)],
729                  [define([AC_PROG_CXX],
730                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
731AC_PROVIDE_IFELSE([AC_PROG_OBJC],
732                  [_AM_DEPENDENCIES(OBJC)],
733                  [define([AC_PROG_OBJC],
734                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
735])
736])
737
738
739# When config.status generates a header, we must update the stamp-h file.
740# This file resides in the same directory as the config header
741# that is generated.  The stamp files are numbered to have different names.
742
743# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
744# loop where config.status creates the headers, so we can generate
745# our stamp files there.
746AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
747[# Compute $1's index in $config_headers.
748_am_arg=$1
749_am_stamp_count=1
750for _am_header in $config_headers :; do
751  case $_am_header in
752    $_am_arg | $_am_arg:* )
753      break ;;
754    * )
755      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
756  esac
757done
758echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
759
760# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
761#
762# This file is free software; the Free Software Foundation
763# gives unlimited permission to copy and/or distribute it,
764# with or without modifications, as long as this notice is preserved.
765
766# AM_PROG_INSTALL_SH
767# ------------------
768# Define $install_sh.
769AC_DEFUN([AM_PROG_INSTALL_SH],
770[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
771install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
772AC_SUBST(install_sh)])
773
774# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
775#
776# This file is free software; the Free Software Foundation
777# gives unlimited permission to copy and/or distribute it,
778# with or without modifications, as long as this notice is preserved.
779
780# serial 2
781
782# Check whether the underlying file-system supports filenames
783# with a leading dot.  For instance MS-DOS doesn't.
784AC_DEFUN([AM_SET_LEADING_DOT],
785[rm -rf .tst 2>/dev/null
786mkdir .tst 2>/dev/null
787if test -d .tst; then
788  am__leading_dot=.
789else
790  am__leading_dot=_
791fi
792rmdir .tst 2>/dev/null
793AC_SUBST([am__leading_dot])])
794
795# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
796# From Jim Meyering
797
798# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
799# Free Software Foundation, Inc.
800#
801# This file is free software; the Free Software Foundation
802# gives unlimited permission to copy and/or distribute it,
803# with or without modifications, as long as this notice is preserved.
804
805# serial 4
806
807AC_DEFUN([AM_MAINTAINER_MODE],
808[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
809  dnl maintainer-mode is disabled by default
810  AC_ARG_ENABLE(maintainer-mode,
811[  --enable-maintainer-mode  enable make rules and dependencies not useful
812			  (and sometimes confusing) to the casual installer],
813      USE_MAINTAINER_MODE=$enableval,
814      USE_MAINTAINER_MODE=no)
815  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
816  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
817  MAINT=$MAINTAINER_MODE_TRUE
818  AC_SUBST(MAINT)dnl
819]
820)
821
822AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
823
824# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
825
826# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
827# Free Software Foundation, Inc.
828#
829# This file is free software; the Free Software Foundation
830# gives unlimited permission to copy and/or distribute it,
831# with or without modifications, as long as this notice is preserved.
832
833# serial 5
834
835# AM_MISSING_PROG(NAME, PROGRAM)
836# ------------------------------
837AC_DEFUN([AM_MISSING_PROG],
838[AC_REQUIRE([AM_MISSING_HAS_RUN])
839$1=${$1-"${am_missing_run}$2"}
840AC_SUBST($1)])
841
842
843# AM_MISSING_HAS_RUN
844# ------------------
845# Define MISSING if not defined so far and test if it supports --run.
846# If it does, set am_missing_run to use it, otherwise, to nothing.
847AC_DEFUN([AM_MISSING_HAS_RUN],
848[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
849AC_REQUIRE_AUX_FILE([missing])dnl
850test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
851# Use eval to expand $SHELL
852if eval "$MISSING --run true"; then
853  am_missing_run="$MISSING --run "
854else
855  am_missing_run=
856  AC_MSG_WARN([`missing' script is too old or missing])
857fi
858])
859
860# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
861#
862# This file is free software; the Free Software Foundation
863# gives unlimited permission to copy and/or distribute it,
864# with or without modifications, as long as this notice is preserved.
865
866# AM_PROG_MKDIR_P
867# ---------------
868# Check for `mkdir -p'.
869AC_DEFUN([AM_PROG_MKDIR_P],
870[AC_PREREQ([2.60])dnl
871AC_REQUIRE([AC_PROG_MKDIR_P])dnl
872dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
873dnl while keeping a definition of mkdir_p for backward compatibility.
874dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
875dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
876dnl Makefile.ins that do not define MKDIR_P, so we do our own
877dnl adjustment using top_builddir (which is defined more often than
878dnl MKDIR_P).
879AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
880case $mkdir_p in
881  [[\\/$]]* | ?:[[\\/]]*) ;;
882  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
883esac
884])
885
886# Helper functions for option handling.                     -*- Autoconf -*-
887
888# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
889#
890# This file is free software; the Free Software Foundation
891# gives unlimited permission to copy and/or distribute it,
892# with or without modifications, as long as this notice is preserved.
893
894# serial 3
895
896# _AM_MANGLE_OPTION(NAME)
897# -----------------------
898AC_DEFUN([_AM_MANGLE_OPTION],
899[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
900
901# _AM_SET_OPTION(NAME)
902# ------------------------------
903# Set option NAME.  Presently that only means defining a flag for this option.
904AC_DEFUN([_AM_SET_OPTION],
905[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
906
907# _AM_SET_OPTIONS(OPTIONS)
908# ----------------------------------
909# OPTIONS is a space-separated list of Automake options.
910AC_DEFUN([_AM_SET_OPTIONS],
911[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
912
913# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
914# -------------------------------------------
915# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
916AC_DEFUN([_AM_IF_OPTION],
917[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
918
919# Check to make sure that the build environment is sane.    -*- Autoconf -*-
920
921# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
922# Free Software Foundation, Inc.
923#
924# This file is free software; the Free Software Foundation
925# gives unlimited permission to copy and/or distribute it,
926# with or without modifications, as long as this notice is preserved.
927
928# serial 4
929
930# AM_SANITY_CHECK
931# ---------------
932AC_DEFUN([AM_SANITY_CHECK],
933[AC_MSG_CHECKING([whether build environment is sane])
934# Just in case
935sleep 1
936echo timestamp > conftest.file
937# Do `set' in a subshell so we don't clobber the current shell's
938# arguments.  Must try -L first in case configure is actually a
939# symlink; some systems play weird games with the mod time of symlinks
940# (eg FreeBSD returns the mod time of the symlink's containing
941# directory).
942if (
943   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
944   if test "$[*]" = "X"; then
945      # -L didn't work.
946      set X `ls -t $srcdir/configure conftest.file`
947   fi
948   rm -f conftest.file
949   if test "$[*]" != "X $srcdir/configure conftest.file" \
950      && test "$[*]" != "X conftest.file $srcdir/configure"; then
951
952      # If neither matched, then we have a broken ls.  This can happen
953      # if, for instance, CONFIG_SHELL is bash and it inherits a
954      # broken ls alias from the environment.  This has actually
955      # happened.  Such a system could not be considered "sane".
956      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
957alias in your environment])
958   fi
959
960   test "$[2]" = conftest.file
961   )
962then
963   # Ok.
964   :
965else
966   AC_MSG_ERROR([newly created file is older than distributed files!
967Check your system clock])
968fi
969AC_MSG_RESULT(yes)])
970
971# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
972#
973# This file is free software; the Free Software Foundation
974# gives unlimited permission to copy and/or distribute it,
975# with or without modifications, as long as this notice is preserved.
976
977# AM_PROG_INSTALL_STRIP
978# ---------------------
979# One issue with vendor `install' (even GNU) is that you can't
980# specify the program used to strip binaries.  This is especially
981# annoying in cross-compiling environments, where the build's strip
982# is unlikely to handle the host's binaries.
983# Fortunately install-sh will honor a STRIPPROG variable, so we
984# always use install-sh in `make install-strip', and initialize
985# STRIPPROG with the value of the STRIP variable (set by the user).
986AC_DEFUN([AM_PROG_INSTALL_STRIP],
987[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
988# Installed binaries are usually stripped using `strip' when the user
989# run `make install-strip'.  However `strip' might not be the right
990# tool to use in cross-compilation environments, therefore Automake
991# will honor the `STRIP' environment variable to overrule this program.
992dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
993if test "$cross_compiling" != no; then
994  AC_CHECK_TOOL([STRIP], [strip], :)
995fi
996INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
997AC_SUBST([INSTALL_STRIP_PROGRAM])])
998
999# Copyright (C) 2006  Free Software Foundation, Inc.
1000#
1001# This file is free software; the Free Software Foundation
1002# gives unlimited permission to copy and/or distribute it,
1003# with or without modifications, as long as this notice is preserved.
1004
1005# _AM_SUBST_NOTMAKE(VARIABLE)
1006# ---------------------------
1007# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1008# This macro is traced by Automake.
1009AC_DEFUN([_AM_SUBST_NOTMAKE])
1010
1011# Check how to create a tarball.                            -*- Autoconf -*-
1012
1013# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
1014#
1015# This file is free software; the Free Software Foundation
1016# gives unlimited permission to copy and/or distribute it,
1017# with or without modifications, as long as this notice is preserved.
1018
1019# serial 2
1020
1021# _AM_PROG_TAR(FORMAT)
1022# --------------------
1023# Check how to create a tarball in format FORMAT.
1024# FORMAT should be one of `v7', `ustar', or `pax'.
1025#
1026# Substitute a variable $(am__tar) that is a command
1027# writing to stdout a FORMAT-tarball containing the directory
1028# $tardir.
1029#     tardir=directory && $(am__tar) > result.tar
1030#
1031# Substitute a variable $(am__untar) that extract such
1032# a tarball read from stdin.
1033#     $(am__untar) < result.tar
1034AC_DEFUN([_AM_PROG_TAR],
1035[# Always define AMTAR for backward compatibility.
1036AM_MISSING_PROG([AMTAR], [tar])
1037m4_if([$1], [v7],
1038     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
1039     [m4_case([$1], [ustar],, [pax],,
1040              [m4_fatal([Unknown tar format])])
1041AC_MSG_CHECKING([how to create a $1 tar archive])
1042# Loop over all known methods to create a tar archive until one works.
1043_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1044_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1045# Do not fold the above two line into one, because Tru64 sh and
1046# Solaris sh will not grok spaces in the rhs of `-'.
1047for _am_tool in $_am_tools
1048do
1049  case $_am_tool in
1050  gnutar)
1051    for _am_tar in tar gnutar gtar;
1052    do
1053      AM_RUN_LOG([$_am_tar --version]) && break
1054    done
1055    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1056    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1057    am__untar="$_am_tar -xf -"
1058    ;;
1059  plaintar)
1060    # Must skip GNU tar: if it does not support --format= it doesn't create
1061    # ustar tarball either.
1062    (tar --version) >/dev/null 2>&1 && continue
1063    am__tar='tar chf - "$$tardir"'
1064    am__tar_='tar chf - "$tardir"'
1065    am__untar='tar xf -'
1066    ;;
1067  pax)
1068    am__tar='pax -L -x $1 -w "$$tardir"'
1069    am__tar_='pax -L -x $1 -w "$tardir"'
1070    am__untar='pax -r'
1071    ;;
1072  cpio)
1073    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1074    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1075    am__untar='cpio -i -H $1 -d'
1076    ;;
1077  none)
1078    am__tar=false
1079    am__tar_=false
1080    am__untar=false
1081    ;;
1082  esac
1083
1084  # If the value was cached, stop now.  We just wanted to have am__tar
1085  # and am__untar set.
1086  test -n "${am_cv_prog_tar_$1}" && break
1087
1088  # tar/untar a dummy directory, and stop if the command works
1089  rm -rf conftest.dir
1090  mkdir conftest.dir
1091  echo GrepMe > conftest.dir/file
1092  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1093  rm -rf conftest.dir
1094  if test -s conftest.tar; then
1095    AM_RUN_LOG([$am__untar <conftest.tar])
1096    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1097  fi
1098done
1099rm -rf conftest.dir
1100
1101AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1102AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1103AC_SUBST([am__tar])
1104AC_SUBST([am__untar])
1105]) # _AM_PROG_TAR
1106
1107