1# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005  Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14# codeset.m4 serial AM1 (gettext-0.10.40)
15dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
16dnl This file is free software; the Free Software Foundation
17dnl gives unlimited permission to copy and/or distribute it,
18dnl with or without modifications, as long as this notice is preserved.
19
20dnl From Bruno Haible.
21
22AC_DEFUN([AM_LANGINFO_CODESET],
23[
24  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
25    [AC_TRY_LINK([#include <langinfo.h>],
26      [char* cs = nl_langinfo(CODESET);],
27      am_cv_langinfo_codeset=yes,
28      am_cv_langinfo_codeset=no)
29    ])
30  if test $am_cv_langinfo_codeset = yes; then
31    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
32      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
33  fi
34])
35
36# gettext.m4 serial 37 (gettext-0.14.4)
37dnl Copyright (C) 1995-2005 Free Software Foundation, Inc.
38dnl This file is free software; the Free Software Foundation
39dnl gives unlimited permission to copy and/or distribute it,
40dnl with or without modifications, as long as this notice is preserved.
41dnl
42dnl This file can can be used in projects which are not available under
43dnl the GNU General Public License or the GNU Library General Public
44dnl License but which still want to provide support for the GNU gettext
45dnl functionality.
46dnl Please note that the actual code of the GNU gettext library is covered
47dnl by the GNU Library General Public License, and the rest of the GNU
48dnl gettext package package is covered by the GNU General Public License.
49dnl They are *not* in the public domain.
50
51dnl Authors:
52dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
53dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
54
55dnl Macro to add for using GNU gettext.
56
57dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
58dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
59dnl    default (if it is not specified or empty) is 'no-libtool'.
60dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
61dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
62dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
63dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
64dnl    depending on --{enable,disable}-{shared,static} and on the presence of
65dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
66dnl    $(top_builddir)/intl/libintl.a will be created.
67dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
68dnl    implementations (in libc or libintl) without the ngettext() function
69dnl    will be ignored.  If NEEDSYMBOL is specified and is
70dnl    'need-formatstring-macros', then GNU gettext implementations that don't
71dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
72dnl INTLDIR is used to find the intl libraries.  If empty,
73dnl    the value `$(top_builddir)/intl/' is used.
74dnl
75dnl The result of the configuration is one of three cases:
76dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
77dnl    and used.
78dnl    Catalog format: GNU --> install in $(datadir)
79dnl    Catalog extension: .mo after installation, .gmo in source tree
80dnl 2) GNU gettext has been found in the system's C library.
81dnl    Catalog format: GNU --> install in $(datadir)
82dnl    Catalog extension: .mo after installation, .gmo in source tree
83dnl 3) No internationalization, always use English msgid.
84dnl    Catalog format: none
85dnl    Catalog extension: none
86dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
87dnl The use of .gmo is historical (it was needed to avoid overwriting the
88dnl GNU format catalogs when building on a platform with an X/Open gettext),
89dnl but we keep it in order not to force irrelevant filename changes on the
90dnl maintainers.
91dnl
92AC_DEFUN([AM_GNU_GETTEXT],
93[
94  dnl Argument checking.
95  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
96    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
97])])])])])
98  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
99    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
100])])])])
101  define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
102  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
103
104  AC_REQUIRE([AM_PO_SUBDIRS])dnl
105  ifelse(gt_included_intl, yes, [
106    AC_REQUIRE([AM_INTL_SUBDIR])dnl
107  ])
108
109  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
110  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
111  AC_REQUIRE([AC_LIB_RPATH])
112
113  dnl Sometimes libintl requires libiconv, so first search for libiconv.
114  dnl Ideally we would do this search only after the
115  dnl      if test "$USE_NLS" = "yes"; then
116  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
117  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
118  dnl the configure script would need to contain the same shell code
119  dnl again, outside any 'if'. There are two solutions:
120  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
121  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
122  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
123  dnl documented, we avoid it.
124  ifelse(gt_included_intl, yes, , [
125    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
126  ])
127
128  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
129  gt_INTL_MACOSX
130
131  dnl Set USE_NLS.
132  AM_NLS
133
134  ifelse(gt_included_intl, yes, [
135    BUILD_INCLUDED_LIBINTL=no
136    USE_INCLUDED_LIBINTL=no
137  ])
138  LIBINTL=
139  LTLIBINTL=
140  POSUB=
141
142  dnl If we use NLS figure out what method
143  if test "$USE_NLS" = "yes"; then
144    gt_use_preinstalled_gnugettext=no
145    ifelse(gt_included_intl, yes, [
146      AC_MSG_CHECKING([whether included gettext is requested])
147      AC_ARG_WITH(included-gettext,
148        [  --with-included-gettext use the GNU gettext library included here],
149        nls_cv_force_use_gnu_gettext=$withval,
150        nls_cv_force_use_gnu_gettext=no)
151      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
152
153      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
154      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
155    ])
156        dnl User does not insist on using GNU NLS library.  Figure out what
157        dnl to use.  If GNU gettext is available we use this.  Else we have
158        dnl to fall back to GNU NLS library.
159
160        dnl Add a version number to the cache macros.
161        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
162        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
163        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
164
165        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
166         [AC_TRY_LINK([#include <libintl.h>
167]ifelse([$2], [need-formatstring-macros],
168[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
169#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
170#endif
171changequote(,)dnl
172typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
173changequote([,])dnl
174], [])[extern int _nl_msg_cat_cntr;
175extern int *_nl_domain_bindings;],
176            [bindtextdomain ("", "");
177return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
178            gt_cv_func_gnugettext_libc=yes,
179            gt_cv_func_gnugettext_libc=no)])
180
181        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
182          dnl Sometimes libintl requires libiconv, so first search for libiconv.
183          ifelse(gt_included_intl, yes, , [
184            AM_ICONV_LINK
185          ])
186          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
187          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
188          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
189          dnl even if libiconv doesn't exist.
190          AC_LIB_LINKFLAGS_BODY([intl])
191          AC_CACHE_CHECK([for GNU gettext in libintl],
192            gt_cv_func_gnugettext_libintl,
193           [gt_save_CPPFLAGS="$CPPFLAGS"
194            CPPFLAGS="$CPPFLAGS $INCINTL"
195            gt_save_LIBS="$LIBS"
196            LIBS="$LIBS $LIBINTL"
197            dnl Now see whether libintl exists and does not depend on libiconv.
198            AC_TRY_LINK([#include <libintl.h>
199]ifelse([$2], [need-formatstring-macros],
200[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
201#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
202#endif
203changequote(,)dnl
204typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
205changequote([,])dnl
206], [])[extern int _nl_msg_cat_cntr;
207extern
208#ifdef __cplusplus
209"C"
210#endif
211const char *_nl_expand_alias (const char *);],
212              [bindtextdomain ("", "");
213return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
214              gt_cv_func_gnugettext_libintl=yes,
215              gt_cv_func_gnugettext_libintl=no)
216            dnl Now see whether libintl exists and depends on libiconv.
217            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
218              LIBS="$LIBS $LIBICONV"
219              AC_TRY_LINK([#include <libintl.h>
220]ifelse([$2], [need-formatstring-macros],
221[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
222#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
223#endif
224changequote(,)dnl
225typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
226changequote([,])dnl
227], [])[extern int _nl_msg_cat_cntr;
228extern
229#ifdef __cplusplus
230"C"
231#endif
232const char *_nl_expand_alias (const char *);],
233                [bindtextdomain ("", "");
234return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
235               [LIBINTL="$LIBINTL $LIBICONV"
236                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
237                gt_cv_func_gnugettext_libintl=yes
238               ])
239            fi
240            CPPFLAGS="$gt_save_CPPFLAGS"
241            LIBS="$gt_save_LIBS"])
242        fi
243
244        dnl If an already present or preinstalled GNU gettext() is found,
245        dnl use it.  But if this macro is used in GNU gettext, and GNU
246        dnl gettext is already preinstalled in libintl, we update this
247        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
248        if test "$gt_cv_func_gnugettext_libc" = "yes" \
249           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
250                && test "$PACKAGE" != gettext-runtime \
251                && test "$PACKAGE" != gettext-tools; }; then
252          gt_use_preinstalled_gnugettext=yes
253        else
254          dnl Reset the values set by searching for libintl.
255          LIBINTL=
256          LTLIBINTL=
257          INCINTL=
258        fi
259
260    ifelse(gt_included_intl, yes, [
261        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
262          dnl GNU gettext is not found in the C library.
263          dnl Fall back on included GNU gettext library.
264          nls_cv_use_gnu_gettext=yes
265        fi
266      fi
267
268      if test "$nls_cv_use_gnu_gettext" = "yes"; then
269        dnl Mark actions used to generate GNU NLS library.
270        BUILD_INCLUDED_LIBINTL=yes
271        USE_INCLUDED_LIBINTL=yes
272        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
273        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
274        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
275      fi
276
277      CATOBJEXT=
278      if test "$gt_use_preinstalled_gnugettext" = "yes" \
279         || test "$nls_cv_use_gnu_gettext" = "yes"; then
280        dnl Mark actions to use GNU gettext tools.
281        CATOBJEXT=.gmo
282      fi
283    ])
284
285    if test -n "$INTL_MACOSX_LIBS"; then
286      if test "$gt_use_preinstalled_gnugettext" = "yes" \
287         || test "$nls_cv_use_gnu_gettext" = "yes"; then
288        dnl Some extra flags are needed during linking.
289        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
290        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
291      fi
292    fi
293
294    if test "$gt_use_preinstalled_gnugettext" = "yes" \
295       || test "$nls_cv_use_gnu_gettext" = "yes"; then
296      AC_DEFINE(ENABLE_NLS, 1,
297        [Define to 1 if translation of program messages to the user's native language
298   is requested.])
299    else
300      USE_NLS=no
301    fi
302  fi
303
304  AC_MSG_CHECKING([whether to use NLS])
305  AC_MSG_RESULT([$USE_NLS])
306  if test "$USE_NLS" = "yes"; then
307    AC_MSG_CHECKING([where the gettext function comes from])
308    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
309      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
310        gt_source="external libintl"
311      else
312        gt_source="libc"
313      fi
314    else
315      gt_source="included intl directory"
316    fi
317    AC_MSG_RESULT([$gt_source])
318  fi
319
320  if test "$USE_NLS" = "yes"; then
321
322    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
323      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
324        AC_MSG_CHECKING([how to link with libintl])
325        AC_MSG_RESULT([$LIBINTL])
326        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
327      fi
328
329      dnl For backward compatibility. Some packages may be using this.
330      AC_DEFINE(HAVE_GETTEXT, 1,
331       [Define if the GNU gettext() function is already present or preinstalled.])
332      AC_DEFINE(HAVE_DCGETTEXT, 1,
333       [Define if the GNU dcgettext() function is already present or preinstalled.])
334    fi
335
336    dnl We need to process the po/ directory.
337    POSUB=po
338  fi
339
340  ifelse(gt_included_intl, yes, [
341    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
342    dnl to 'yes' because some of the testsuite requires it.
343    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
344      BUILD_INCLUDED_LIBINTL=yes
345    fi
346
347    dnl Make all variables we use known to autoconf.
348    AC_SUBST(BUILD_INCLUDED_LIBINTL)
349    AC_SUBST(USE_INCLUDED_LIBINTL)
350    AC_SUBST(CATOBJEXT)
351
352    dnl For backward compatibility. Some configure.ins may be using this.
353    nls_cv_header_intl=
354    nls_cv_header_libgt=
355
356    dnl For backward compatibility. Some Makefiles may be using this.
357    DATADIRNAME=share
358    AC_SUBST(DATADIRNAME)
359
360    dnl For backward compatibility. Some Makefiles may be using this.
361    INSTOBJEXT=.mo
362    AC_SUBST(INSTOBJEXT)
363
364    dnl For backward compatibility. Some Makefiles may be using this.
365    GENCAT=gencat
366    AC_SUBST(GENCAT)
367
368    dnl For backward compatibility. Some Makefiles may be using this.
369    INTLOBJS=
370    if test "$USE_INCLUDED_LIBINTL" = yes; then
371      INTLOBJS="\$(GETTOBJS)"
372    fi
373    AC_SUBST(INTLOBJS)
374
375    dnl Enable libtool support if the surrounding package wishes it.
376    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
377    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
378  ])
379
380  dnl For backward compatibility. Some Makefiles may be using this.
381  INTLLIBS="$LIBINTL"
382  AC_SUBST(INTLLIBS)
383
384  dnl Make all documented variables known to autoconf.
385  AC_SUBST(LIBINTL)
386  AC_SUBST(LTLIBINTL)
387  AC_SUBST(POSUB)
388])
389
390
391dnl Checks for all prerequisites of the intl subdirectory,
392dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
393dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
394AC_DEFUN([AM_INTL_SUBDIR],
395[
396  AC_REQUIRE([AC_PROG_INSTALL])dnl
397  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
398  AC_REQUIRE([AC_PROG_CC])dnl
399  AC_REQUIRE([AC_CANONICAL_HOST])dnl
400  AC_REQUIRE([gt_GLIBC2])dnl
401  AC_REQUIRE([AC_PROG_RANLIB])dnl
402  AC_REQUIRE([AC_ISC_POSIX])dnl
403  AC_REQUIRE([AC_HEADER_STDC])dnl
404  AC_REQUIRE([AC_C_CONST])dnl
405  AC_REQUIRE([bh_C_SIGNED])dnl
406  AC_REQUIRE([AC_C_INLINE])dnl
407  AC_REQUIRE([AC_TYPE_OFF_T])dnl
408  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
409  AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
410  AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
411  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
412  AC_REQUIRE([gt_TYPE_WINT_T])dnl
413  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
414  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
415  AC_REQUIRE([gt_TYPE_INTMAX_T])
416  AC_REQUIRE([gt_PRINTF_POSIX])
417  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
418  AC_REQUIRE([AC_FUNC_MMAP])dnl
419  AC_REQUIRE([gl_GLIBC21])dnl
420  AC_REQUIRE([gt_INTDIV0])dnl
421  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
422  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
423  AC_REQUIRE([gt_INTTYPES_PRI])dnl
424  AC_REQUIRE([gl_XSIZE])dnl
425  AC_REQUIRE([gt_INTL_MACOSX])dnl
426
427  AC_CHECK_TYPE([ptrdiff_t], ,
428    [AC_DEFINE([ptrdiff_t], [long],
429       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
430    ])
431  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
432stdlib.h string.h unistd.h sys/param.h])
433  AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
434mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
435strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
436__fsetlocking])
437
438  dnl Use the _snprintf function only if it is declared (because on NetBSD it
439  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
440  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
441  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
442
443  dnl Use the *_unlocked functions only if they are declared.
444  dnl (because some of them were defined without being declared in Solaris
445  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
446  dnl on Solaris 2.5.1 to run on Solaris 2.6).
447  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
448  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
449  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
450  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
451
452  case $gt_cv_func_printf_posix in
453    *yes) HAVE_POSIX_PRINTF=1 ;;
454    *) HAVE_POSIX_PRINTF=0 ;;
455  esac
456  AC_SUBST([HAVE_POSIX_PRINTF])
457  if test "$ac_cv_func_asprintf" = yes; then
458    HAVE_ASPRINTF=1
459  else
460    HAVE_ASPRINTF=0
461  fi
462  AC_SUBST([HAVE_ASPRINTF])
463  if test "$ac_cv_func_snprintf" = yes; then
464    HAVE_SNPRINTF=1
465  else
466    HAVE_SNPRINTF=0
467  fi
468  AC_SUBST([HAVE_SNPRINTF])
469  if test "$ac_cv_func_wprintf" = yes; then
470    HAVE_WPRINTF=1
471  else
472    HAVE_WPRINTF=0
473  fi
474  AC_SUBST([HAVE_WPRINTF])
475
476  AM_ICONV
477  AM_LANGINFO_CODESET
478  if test $ac_cv_header_locale_h = yes; then
479    gt_LC_MESSAGES
480  fi
481
482  if test -n "$INTL_MACOSX_LIBS"; then
483    CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
484  fi
485
486  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
487  dnl because plural.y uses bison specific features. It requires at least
488  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
489  dnl compile.
490  dnl bison is only needed for the maintainer (who touches plural.y). But in
491  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
492  dnl the rule in general Makefile. Now, some people carelessly touch the
493  dnl files or have a broken "make" program, hence the plural.c rule will
494  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
495  dnl present or too old.
496  AC_CHECK_PROGS([INTLBISON], [bison])
497  if test -z "$INTLBISON"; then
498    ac_verc_fail=yes
499  else
500    dnl Found it, now check the version.
501    AC_MSG_CHECKING([version of bison])
502changequote(<<,>>)dnl
503    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
504    case $ac_prog_version in
505      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
506      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
507changequote([,])dnl
508         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
509      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
510    esac
511    AC_MSG_RESULT([$ac_prog_version])
512  fi
513  if test $ac_verc_fail = yes; then
514    INTLBISON=:
515  fi
516])
517
518
519dnl Checks for special options needed on MacOS X.
520dnl Defines INTL_MACOSX_LIBS.
521AC_DEFUN([gt_INTL_MACOSX],
522[
523  dnl Check for API introduced in MacOS X 10.2.
524  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
525    gt_cv_func_CFPreferencesCopyAppValue,
526    [gt_save_CPPFLAGS="$CPPFLAGS"
527     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
528     gt_save_LIBS="$LIBS"
529     LIBS="$LIBS -framework CoreFoundation"
530     AC_TRY_LINK([#include <CFPreferences.h>],
531       [CFPreferencesCopyAppValue(NULL, NULL)],
532       [gt_cv_func_CFPreferencesCopyAppValue=yes],
533       [gt_cv_func_CFPreferencesCopyAppValue=no])
534     CPPFLAGS="$gt_save_CPPFLAGS"
535     LIBS="$gt_save_LIBS"])
536  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
537    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
538      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
539  fi
540  dnl Check for API introduced in MacOS X 10.3.
541  AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
542    [gt_save_CPPFLAGS="$CPPFLAGS"
543     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
544     gt_save_LIBS="$LIBS"
545     LIBS="$LIBS -framework CoreFoundation"
546     AC_TRY_LINK([#include <CFLocale.h>], [CFLocaleCopyCurrent();],
547       [gt_cv_func_CFLocaleCopyCurrent=yes],
548       [gt_cv_func_CFLocaleCopyCurrent=no])
549     CPPFLAGS="$gt_save_CPPFLAGS"
550     LIBS="$gt_save_LIBS"])
551  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
552    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
553      [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
554  fi
555  INTL_MACOSX_LIBS=
556  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
557    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
558  fi
559  AC_SUBST([INTL_MACOSX_LIBS])
560])
561
562
563dnl gt_CHECK_DECL(FUNC, INCLUDES)
564dnl Check whether a function is declared.
565AC_DEFUN([gt_CHECK_DECL],
566[
567  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
568    [AC_TRY_COMPILE([$2], [
569#ifndef $1
570  char *p = (char *) $1;
571#endif
572], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
573  if test $ac_cv_have_decl_$1 = yes; then
574    gt_value=1
575  else
576    gt_value=0
577  fi
578  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
579    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
580])
581
582
583dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
584AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
585
586# glibc2.m4 serial 1
587dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
588dnl This file is free software; the Free Software Foundation
589dnl gives unlimited permission to copy and/or distribute it,
590dnl with or without modifications, as long as this notice is preserved.
591
592# Test for the GNU C Library, version 2.0 or newer.
593# From Bruno Haible.
594
595AC_DEFUN([gt_GLIBC2],
596  [
597    AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer,
598      ac_cv_gnu_library_2,
599      [AC_EGREP_CPP([Lucky GNU user],
600	[
601#include <features.h>
602#ifdef __GNU_LIBRARY__
603 #if (__GLIBC__ >= 2)
604  Lucky GNU user
605 #endif
606#endif
607	],
608	ac_cv_gnu_library_2=yes,
609	ac_cv_gnu_library_2=no)
610      ]
611    )
612    AC_SUBST(GLIBC2)
613    GLIBC2="$ac_cv_gnu_library_2"
614  ]
615)
616
617# glibc21.m4 serial 3
618dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
619dnl This file is free software; the Free Software Foundation
620dnl gives unlimited permission to copy and/or distribute it,
621dnl with or without modifications, as long as this notice is preserved.
622
623# Test for the GNU C Library, version 2.1 or newer.
624# From Bruno Haible.
625
626AC_DEFUN([gl_GLIBC21],
627  [
628    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
629      ac_cv_gnu_library_2_1,
630      [AC_EGREP_CPP([Lucky GNU user],
631	[
632#include <features.h>
633#ifdef __GNU_LIBRARY__
634 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
635  Lucky GNU user
636 #endif
637#endif
638	],
639	ac_cv_gnu_library_2_1=yes,
640	ac_cv_gnu_library_2_1=no)
641      ]
642    )
643    AC_SUBST(GLIBC21)
644    GLIBC21="$ac_cv_gnu_library_2_1"
645  ]
646)
647
648# iconv.m4 serial AM4 (gettext-0.11.3)
649dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
650dnl This file is free software; the Free Software Foundation
651dnl gives unlimited permission to copy and/or distribute it,
652dnl with or without modifications, as long as this notice is preserved.
653
654dnl From Bruno Haible.
655
656AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
657[
658  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
659  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
660  AC_REQUIRE([AC_LIB_RPATH])
661
662  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
663  dnl accordingly.
664  AC_LIB_LINKFLAGS_BODY([iconv])
665])
666
667AC_DEFUN([AM_ICONV_LINK],
668[
669  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
670  dnl those with the standalone portable GNU libiconv installed).
671
672  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
673  dnl accordingly.
674  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
675
676  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
677  dnl because if the user has installed libiconv and not disabled its use
678  dnl via --without-libiconv-prefix, he wants to use it. The first
679  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
680  am_save_CPPFLAGS="$CPPFLAGS"
681  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
682
683  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
684    am_cv_func_iconv="no, consider installing GNU libiconv"
685    am_cv_lib_iconv=no
686    AC_TRY_LINK([#include <stdlib.h>
687#include <iconv.h>],
688      [iconv_t cd = iconv_open("","");
689       iconv(cd,NULL,NULL,NULL,NULL);
690       iconv_close(cd);],
691      am_cv_func_iconv=yes)
692    if test "$am_cv_func_iconv" != yes; then
693      am_save_LIBS="$LIBS"
694      LIBS="$LIBS $LIBICONV"
695      AC_TRY_LINK([#include <stdlib.h>
696#include <iconv.h>],
697        [iconv_t cd = iconv_open("","");
698         iconv(cd,NULL,NULL,NULL,NULL);
699         iconv_close(cd);],
700        am_cv_lib_iconv=yes
701        am_cv_func_iconv=yes)
702      LIBS="$am_save_LIBS"
703    fi
704  ])
705  if test "$am_cv_func_iconv" = yes; then
706    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
707  fi
708  if test "$am_cv_lib_iconv" = yes; then
709    AC_MSG_CHECKING([how to link with libiconv])
710    AC_MSG_RESULT([$LIBICONV])
711  else
712    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
713    dnl either.
714    CPPFLAGS="$am_save_CPPFLAGS"
715    LIBICONV=
716    LTLIBICONV=
717  fi
718  AC_SUBST(LIBICONV)
719  AC_SUBST(LTLIBICONV)
720])
721
722AC_DEFUN([AM_ICONV],
723[
724  AM_ICONV_LINK
725  if test "$am_cv_func_iconv" = yes; then
726    AC_MSG_CHECKING([for iconv declaration])
727    AC_CACHE_VAL(am_cv_proto_iconv, [
728      AC_TRY_COMPILE([
729#include <stdlib.h>
730#include <iconv.h>
731extern
732#ifdef __cplusplus
733"C"
734#endif
735#if defined(__STDC__) || defined(__cplusplus)
736size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
737#else
738size_t iconv();
739#endif
740], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
741      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
742    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
743    AC_MSG_RESULT([$]{ac_t:-
744         }[$]am_cv_proto_iconv)
745    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
746      [Define as const if the declaration of iconv() needs const.])
747  fi
748])
749
750# intdiv0.m4 serial 1 (gettext-0.11.3)
751dnl Copyright (C) 2002 Free Software Foundation, Inc.
752dnl This file is free software; the Free Software Foundation
753dnl gives unlimited permission to copy and/or distribute it,
754dnl with or without modifications, as long as this notice is preserved.
755
756dnl From Bruno Haible.
757
758AC_DEFUN([gt_INTDIV0],
759[
760  AC_REQUIRE([AC_PROG_CC])dnl
761  AC_REQUIRE([AC_CANONICAL_HOST])dnl
762
763  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
764    gt_cv_int_divbyzero_sigfpe,
765    [
766      AC_TRY_RUN([
767#include <stdlib.h>
768#include <signal.h>
769
770static void
771#ifdef __cplusplus
772sigfpe_handler (int sig)
773#else
774sigfpe_handler (sig) int sig;
775#endif
776{
777  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
778  exit (sig != SIGFPE);
779}
780
781int x = 1;
782int y = 0;
783int z;
784int nan;
785
786int main ()
787{
788  signal (SIGFPE, sigfpe_handler);
789/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
790#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
791  signal (SIGTRAP, sigfpe_handler);
792#endif
793/* Linux/SPARC yields signal SIGILL.  */
794#if defined (__sparc__) && defined (__linux__)
795  signal (SIGILL, sigfpe_handler);
796#endif
797
798  z = x / y;
799  nan = y / y;
800  exit (1);
801}
802], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
803        [
804          # Guess based on the CPU.
805          case "$host_cpu" in
806            alpha* | i[34567]86 | m68k | s390*)
807              gt_cv_int_divbyzero_sigfpe="guessing yes";;
808            *)
809              gt_cv_int_divbyzero_sigfpe="guessing no";;
810          esac
811        ])
812    ])
813  case "$gt_cv_int_divbyzero_sigfpe" in
814    *yes) value=1;;
815    *) value=0;;
816  esac
817  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
818    [Define if integer division by zero raises signal SIGFPE.])
819])
820
821# intmax.m4 serial 2 (gettext-0.14.2)
822dnl Copyright (C) 2002-2005 Free Software Foundation, Inc.
823dnl This file is free software; the Free Software Foundation
824dnl gives unlimited permission to copy and/or distribute it,
825dnl with or without modifications, as long as this notice is preserved.
826
827dnl From Bruno Haible.
828dnl Test whether the system has the 'intmax_t' type, but don't attempt to
829dnl find a replacement if it is lacking.
830
831AC_DEFUN([gt_TYPE_INTMAX_T],
832[
833  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
834  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
835  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
836    [AC_TRY_COMPILE([
837#include <stddef.h>
838#include <stdlib.h>
839#if HAVE_STDINT_H_WITH_UINTMAX
840#include <stdint.h>
841#endif
842#if HAVE_INTTYPES_H_WITH_UINTMAX
843#include <inttypes.h>
844#endif
845], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
846  if test $gt_cv_c_intmax_t = yes; then
847    AC_DEFINE(HAVE_INTMAX_T, 1,
848      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
849  fi
850])
851
852# inttypes-pri.m4 serial 1 (gettext-0.11.4)
853dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
854dnl This file is free software; the Free Software Foundation
855dnl gives unlimited permission to copy and/or distribute it,
856dnl with or without modifications, as long as this notice is preserved.
857
858dnl From Bruno Haible.
859
860# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
861# macros to non-string values.  This is the case on AIX 4.3.3.
862
863AC_DEFUN([gt_INTTYPES_PRI],
864[
865  AC_REQUIRE([gt_HEADER_INTTYPES_H])
866  if test $gt_cv_header_inttypes_h = yes; then
867    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
868      gt_cv_inttypes_pri_broken,
869      [
870        AC_TRY_COMPILE([#include <inttypes.h>
871#ifdef PRId32
872char *p = PRId32;
873#endif
874], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
875      ])
876  fi
877  if test "$gt_cv_inttypes_pri_broken" = yes; then
878    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
879      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
880  fi
881])
882
883# inttypes.m4 serial 1 (gettext-0.11.4)
884dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
885dnl This file is free software; the Free Software Foundation
886dnl gives unlimited permission to copy and/or distribute it,
887dnl with or without modifications, as long as this notice is preserved.
888
889dnl From Paul Eggert.
890
891# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
892# <sys/types.h>.
893
894AC_DEFUN([gt_HEADER_INTTYPES_H],
895[
896  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
897  [
898    AC_TRY_COMPILE(
899      [#include <sys/types.h>
900#include <inttypes.h>],
901      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
902  ])
903  if test $gt_cv_header_inttypes_h = yes; then
904    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
905      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
906  fi
907])
908
909# inttypes_h.m4 serial 6
910dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
911dnl This file is free software; the Free Software Foundation
912dnl gives unlimited permission to copy and/or distribute it,
913dnl with or without modifications, as long as this notice is preserved.
914
915dnl From Paul Eggert.
916
917# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
918# doesn't clash with <sys/types.h>, and declares uintmax_t.
919
920AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
921[
922  AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
923  [AC_TRY_COMPILE(
924    [#include <sys/types.h>
925#include <inttypes.h>],
926    [uintmax_t i = (uintmax_t) -1;],
927    gl_cv_header_inttypes_h=yes,
928    gl_cv_header_inttypes_h=no)])
929  if test $gl_cv_header_inttypes_h = yes; then
930    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
931      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
932       and declares uintmax_t. ])
933  fi
934])
935
936# lcmessage.m4 serial 4 (gettext-0.14.2)
937dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc.
938dnl This file is free software; the Free Software Foundation
939dnl gives unlimited permission to copy and/or distribute it,
940dnl with or without modifications, as long as this notice is preserved.
941dnl
942dnl This file can can be used in projects which are not available under
943dnl the GNU General Public License or the GNU Library General Public
944dnl License but which still want to provide support for the GNU gettext
945dnl functionality.
946dnl Please note that the actual code of the GNU gettext library is covered
947dnl by the GNU Library General Public License, and the rest of the GNU
948dnl gettext package package is covered by the GNU General Public License.
949dnl They are *not* in the public domain.
950
951dnl Authors:
952dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
953
954# Check whether LC_MESSAGES is available in <locale.h>.
955
956AC_DEFUN([gt_LC_MESSAGES],
957[
958  AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES,
959    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
960       gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)])
961  if test $gt_cv_val_LC_MESSAGES = yes; then
962    AC_DEFINE(HAVE_LC_MESSAGES, 1,
963      [Define if your <locale.h> file defines LC_MESSAGES.])
964  fi
965])
966
967# lib-ld.m4 serial 3 (gettext-0.13)
968dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
969dnl This file is free software; the Free Software Foundation
970dnl gives unlimited permission to copy and/or distribute it,
971dnl with or without modifications, as long as this notice is preserved.
972
973dnl Subroutines of libtool.m4,
974dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
975dnl with libtool.m4.
976
977dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
978AC_DEFUN([AC_LIB_PROG_LD_GNU],
979[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
980[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
981case `$LD -v 2>&1 </dev/null` in
982*GNU* | *'with BFD'*)
983  acl_cv_prog_gnu_ld=yes ;;
984*)
985  acl_cv_prog_gnu_ld=no ;;
986esac])
987with_gnu_ld=$acl_cv_prog_gnu_ld
988])
989
990dnl From libtool-1.4. Sets the variable LD.
991AC_DEFUN([AC_LIB_PROG_LD],
992[AC_ARG_WITH(gnu-ld,
993[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
994test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
995AC_REQUIRE([AC_PROG_CC])dnl
996AC_REQUIRE([AC_CANONICAL_HOST])dnl
997# Prepare PATH_SEPARATOR.
998# The user is always right.
999if test "${PATH_SEPARATOR+set}" != set; then
1000  echo "#! /bin/sh" >conf$$.sh
1001  echo  "exit 0"   >>conf$$.sh
1002  chmod +x conf$$.sh
1003  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1004    PATH_SEPARATOR=';'
1005  else
1006    PATH_SEPARATOR=:
1007  fi
1008  rm -f conf$$.sh
1009fi
1010ac_prog=ld
1011if test "$GCC" = yes; then
1012  # Check if gcc -print-prog-name=ld gives a path.
1013  AC_MSG_CHECKING([for ld used by GCC])
1014  case $host in
1015  *-*-mingw*)
1016    # gcc leaves a trailing carriage return which upsets mingw
1017    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1018  *)
1019    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1020  esac
1021  case $ac_prog in
1022    # Accept absolute paths.
1023    [[\\/]* | [A-Za-z]:[\\/]*)]
1024      [re_direlt='/[^/][^/]*/\.\./']
1025      # Canonicalize the path of ld
1026      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1027      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1028	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1029      done
1030      test -z "$LD" && LD="$ac_prog"
1031      ;;
1032  "")
1033    # If it fails, then pretend we aren't using GCC.
1034    ac_prog=ld
1035    ;;
1036  *)
1037    # If it is relative, then search for the first ld in PATH.
1038    with_gnu_ld=unknown
1039    ;;
1040  esac
1041elif test "$with_gnu_ld" = yes; then
1042  AC_MSG_CHECKING([for GNU ld])
1043else
1044  AC_MSG_CHECKING([for non-GNU ld])
1045fi
1046AC_CACHE_VAL(acl_cv_path_LD,
1047[if test -z "$LD"; then
1048  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1049  for ac_dir in $PATH; do
1050    test -z "$ac_dir" && ac_dir=.
1051    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1052      acl_cv_path_LD="$ac_dir/$ac_prog"
1053      # Check to see if the program is GNU ld.  I'd rather use --version,
1054      # but apparently some GNU ld's only accept -v.
1055      # Break only if it was the GNU/non-GNU ld that we prefer.
1056      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
1057      *GNU* | *'with BFD'*)
1058	test "$with_gnu_ld" != no && break ;;
1059      *)
1060	test "$with_gnu_ld" != yes && break ;;
1061      esac
1062    fi
1063  done
1064  IFS="$ac_save_ifs"
1065else
1066  acl_cv_path_LD="$LD" # Let the user override the test with a path.
1067fi])
1068LD="$acl_cv_path_LD"
1069if test -n "$LD"; then
1070  AC_MSG_RESULT($LD)
1071else
1072  AC_MSG_RESULT(no)
1073fi
1074test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1075AC_LIB_PROG_LD_GNU
1076])
1077
1078# lib-link.m4 serial 6 (gettext-0.14.3)
1079dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
1080dnl This file is free software; the Free Software Foundation
1081dnl gives unlimited permission to copy and/or distribute it,
1082dnl with or without modifications, as long as this notice is preserved.
1083
1084dnl From Bruno Haible.
1085
1086AC_PREREQ(2.50)
1087
1088dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1089dnl the libraries corresponding to explicit and implicit dependencies.
1090dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1091dnl augments the CPPFLAGS variable.
1092AC_DEFUN([AC_LIB_LINKFLAGS],
1093[
1094  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1095  AC_REQUIRE([AC_LIB_RPATH])
1096  define([Name],[translit([$1],[./-], [___])])
1097  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1098                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1099  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1100    AC_LIB_LINKFLAGS_BODY([$1], [$2])
1101    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1102    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1103    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1104  ])
1105  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1106  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1107  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1108  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1109  AC_SUBST([LIB]NAME)
1110  AC_SUBST([LTLIB]NAME)
1111  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1112  dnl results of this search when this library appears as a dependency.
1113  HAVE_LIB[]NAME=yes
1114  undefine([Name])
1115  undefine([NAME])
1116])
1117
1118dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1119dnl searches for libname and the libraries corresponding to explicit and
1120dnl implicit dependencies, together with the specified include files and
1121dnl the ability to compile and link the specified testcode. If found, it
1122dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1123dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1124dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1125dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1126AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1127[
1128  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1129  AC_REQUIRE([AC_LIB_RPATH])
1130  define([Name],[translit([$1],[./-], [___])])
1131  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1132                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1133
1134  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1135  dnl accordingly.
1136  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1137
1138  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1139  dnl because if the user has installed lib[]Name and not disabled its use
1140  dnl via --without-lib[]Name-prefix, he wants to use it.
1141  ac_save_CPPFLAGS="$CPPFLAGS"
1142  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1143
1144  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1145    ac_save_LIBS="$LIBS"
1146    LIBS="$LIBS $LIB[]NAME"
1147    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1148    LIBS="$ac_save_LIBS"
1149  ])
1150  if test "$ac_cv_lib[]Name" = yes; then
1151    HAVE_LIB[]NAME=yes
1152    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1153    AC_MSG_CHECKING([how to link with lib[]$1])
1154    AC_MSG_RESULT([$LIB[]NAME])
1155  else
1156    HAVE_LIB[]NAME=no
1157    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1158    dnl $INC[]NAME either.
1159    CPPFLAGS="$ac_save_CPPFLAGS"
1160    LIB[]NAME=
1161    LTLIB[]NAME=
1162  fi
1163  AC_SUBST([HAVE_LIB]NAME)
1164  AC_SUBST([LIB]NAME)
1165  AC_SUBST([LTLIB]NAME)
1166  undefine([Name])
1167  undefine([NAME])
1168])
1169
1170dnl Determine the platform dependent parameters needed to use rpath:
1171dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1172dnl hardcode_direct, hardcode_minus_L.
1173AC_DEFUN([AC_LIB_RPATH],
1174[
1175  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
1176  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
1177  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1178  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1179  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1180  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1181  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1182    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1183    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1184    . ./conftest.sh
1185    rm -f ./conftest.sh
1186    acl_cv_rpath=done
1187  ])
1188  wl="$acl_cv_wl"
1189  libext="$acl_cv_libext"
1190  shlibext="$acl_cv_shlibext"
1191  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1192  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1193  hardcode_direct="$acl_cv_hardcode_direct"
1194  hardcode_minus_L="$acl_cv_hardcode_minus_L"
1195  dnl Determine whether the user wants rpath handling at all.
1196  AC_ARG_ENABLE(rpath,
1197    [  --disable-rpath         do not hardcode runtime library paths],
1198    :, enable_rpath=yes)
1199])
1200
1201dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1202dnl the libraries corresponding to explicit and implicit dependencies.
1203dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1204AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1205[
1206  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1207                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1208  dnl By default, look in $includedir and $libdir.
1209  use_additional=yes
1210  AC_LIB_WITH_FINAL_PREFIX([
1211    eval additional_includedir=\"$includedir\"
1212    eval additional_libdir=\"$libdir\"
1213  ])
1214  AC_LIB_ARG_WITH([lib$1-prefix],
1215[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1216  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1217[
1218    if test "X$withval" = "Xno"; then
1219      use_additional=no
1220    else
1221      if test "X$withval" = "X"; then
1222        AC_LIB_WITH_FINAL_PREFIX([
1223          eval additional_includedir=\"$includedir\"
1224          eval additional_libdir=\"$libdir\"
1225        ])
1226      else
1227        additional_includedir="$withval/include"
1228        additional_libdir="$withval/lib"
1229      fi
1230    fi
1231])
1232  dnl Search the library and its dependencies in $additional_libdir and
1233  dnl $LDFLAGS. Using breadth-first-seach.
1234  LIB[]NAME=
1235  LTLIB[]NAME=
1236  INC[]NAME=
1237  rpathdirs=
1238  ltrpathdirs=
1239  names_already_handled=
1240  names_next_round='$1 $2'
1241  while test -n "$names_next_round"; do
1242    names_this_round="$names_next_round"
1243    names_next_round=
1244    for name in $names_this_round; do
1245      already_handled=
1246      for n in $names_already_handled; do
1247        if test "$n" = "$name"; then
1248          already_handled=yes
1249          break
1250        fi
1251      done
1252      if test -z "$already_handled"; then
1253        names_already_handled="$names_already_handled $name"
1254        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1255        dnl or AC_LIB_HAVE_LINKFLAGS call.
1256        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1257        eval value=\"\$HAVE_LIB$uppername\"
1258        if test -n "$value"; then
1259          if test "$value" = yes; then
1260            eval value=\"\$LIB$uppername\"
1261            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1262            eval value=\"\$LTLIB$uppername\"
1263            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1264          else
1265            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1266            dnl that this library doesn't exist. So just drop it.
1267            :
1268          fi
1269        else
1270          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1271          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1272          found_dir=
1273          found_la=
1274          found_so=
1275          found_a=
1276          if test $use_additional = yes; then
1277            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
1278              found_dir="$additional_libdir"
1279              found_so="$additional_libdir/lib$name.$shlibext"
1280              if test -f "$additional_libdir/lib$name.la"; then
1281                found_la="$additional_libdir/lib$name.la"
1282              fi
1283            else
1284              if test -f "$additional_libdir/lib$name.$libext"; then
1285                found_dir="$additional_libdir"
1286                found_a="$additional_libdir/lib$name.$libext"
1287                if test -f "$additional_libdir/lib$name.la"; then
1288                  found_la="$additional_libdir/lib$name.la"
1289                fi
1290              fi
1291            fi
1292          fi
1293          if test "X$found_dir" = "X"; then
1294            for x in $LDFLAGS $LTLIB[]NAME; do
1295              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1296              case "$x" in
1297                -L*)
1298                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1299                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
1300                    found_dir="$dir"
1301                    found_so="$dir/lib$name.$shlibext"
1302                    if test -f "$dir/lib$name.la"; then
1303                      found_la="$dir/lib$name.la"
1304                    fi
1305                  else
1306                    if test -f "$dir/lib$name.$libext"; then
1307                      found_dir="$dir"
1308                      found_a="$dir/lib$name.$libext"
1309                      if test -f "$dir/lib$name.la"; then
1310                        found_la="$dir/lib$name.la"
1311                      fi
1312                    fi
1313                  fi
1314                  ;;
1315              esac
1316              if test "X$found_dir" != "X"; then
1317                break
1318              fi
1319            done
1320          fi
1321          if test "X$found_dir" != "X"; then
1322            dnl Found the library.
1323            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1324            if test "X$found_so" != "X"; then
1325              dnl Linking with a shared library. We attempt to hardcode its
1326              dnl directory into the executable's runpath, unless it's the
1327              dnl standard /usr/lib.
1328              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
1329                dnl No hardcoding is needed.
1330                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1331              else
1332                dnl Use an explicit option to hardcode DIR into the resulting
1333                dnl binary.
1334                dnl Potentially add DIR to ltrpathdirs.
1335                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1336                haveit=
1337                for x in $ltrpathdirs; do
1338                  if test "X$x" = "X$found_dir"; then
1339                    haveit=yes
1340                    break
1341                  fi
1342                done
1343                if test -z "$haveit"; then
1344                  ltrpathdirs="$ltrpathdirs $found_dir"
1345                fi
1346                dnl The hardcoding into $LIBNAME is system dependent.
1347                if test "$hardcode_direct" = yes; then
1348                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1349                  dnl resulting binary.
1350                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1351                else
1352                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1353                    dnl Use an explicit option to hardcode DIR into the resulting
1354                    dnl binary.
1355                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1356                    dnl Potentially add DIR to rpathdirs.
1357                    dnl The rpathdirs will be appended to $LIBNAME at the end.
1358                    haveit=
1359                    for x in $rpathdirs; do
1360                      if test "X$x" = "X$found_dir"; then
1361                        haveit=yes
1362                        break
1363                      fi
1364                    done
1365                    if test -z "$haveit"; then
1366                      rpathdirs="$rpathdirs $found_dir"
1367                    fi
1368                  else
1369                    dnl Rely on "-L$found_dir".
1370                    dnl But don't add it if it's already contained in the LDFLAGS
1371                    dnl or the already constructed $LIBNAME
1372                    haveit=
1373                    for x in $LDFLAGS $LIB[]NAME; do
1374                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1375                      if test "X$x" = "X-L$found_dir"; then
1376                        haveit=yes
1377                        break
1378                      fi
1379                    done
1380                    if test -z "$haveit"; then
1381                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1382                    fi
1383                    if test "$hardcode_minus_L" != no; then
1384                      dnl FIXME: Not sure whether we should use
1385                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1386                      dnl here.
1387                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1388                    else
1389                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1390                      dnl here, because this doesn't fit in flags passed to the
1391                      dnl compiler. So give up. No hardcoding. This affects only
1392                      dnl very old systems.
1393                      dnl FIXME: Not sure whether we should use
1394                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1395                      dnl here.
1396                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1397                    fi
1398                  fi
1399                fi
1400              fi
1401            else
1402              if test "X$found_a" != "X"; then
1403                dnl Linking with a static library.
1404                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1405              else
1406                dnl We shouldn't come here, but anyway it's good to have a
1407                dnl fallback.
1408                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1409              fi
1410            fi
1411            dnl Assume the include files are nearby.
1412            additional_includedir=
1413            case "$found_dir" in
1414              */lib | */lib/)
1415                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
1416                additional_includedir="$basedir/include"
1417                ;;
1418            esac
1419            if test "X$additional_includedir" != "X"; then
1420              dnl Potentially add $additional_includedir to $INCNAME.
1421              dnl But don't add it
1422              dnl   1. if it's the standard /usr/include,
1423              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1424              dnl   3. if it's already present in $CPPFLAGS or the already
1425              dnl      constructed $INCNAME,
1426              dnl   4. if it doesn't exist as a directory.
1427              if test "X$additional_includedir" != "X/usr/include"; then
1428                haveit=
1429                if test "X$additional_includedir" = "X/usr/local/include"; then
1430                  if test -n "$GCC"; then
1431                    case $host_os in
1432                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1433                    esac
1434                  fi
1435                fi
1436                if test -z "$haveit"; then
1437                  for x in $CPPFLAGS $INC[]NAME; do
1438                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1439                    if test "X$x" = "X-I$additional_includedir"; then
1440                      haveit=yes
1441                      break
1442                    fi
1443                  done
1444                  if test -z "$haveit"; then
1445                    if test -d "$additional_includedir"; then
1446                      dnl Really add $additional_includedir to $INCNAME.
1447                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1448                    fi
1449                  fi
1450                fi
1451              fi
1452            fi
1453            dnl Look for dependencies.
1454            if test -n "$found_la"; then
1455              dnl Read the .la file. It defines the variables
1456              dnl dlname, library_names, old_library, dependency_libs, current,
1457              dnl age, revision, installed, dlopen, dlpreopen, libdir.
1458              save_libdir="$libdir"
1459              case "$found_la" in
1460                */* | *\\*) . "$found_la" ;;
1461                *) . "./$found_la" ;;
1462              esac
1463              libdir="$save_libdir"
1464              dnl We use only dependency_libs.
1465              for dep in $dependency_libs; do
1466                case "$dep" in
1467                  -L*)
1468                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1469                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1470                    dnl But don't add it
1471                    dnl   1. if it's the standard /usr/lib,
1472                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1473                    dnl   3. if it's already present in $LDFLAGS or the already
1474                    dnl      constructed $LIBNAME,
1475                    dnl   4. if it doesn't exist as a directory.
1476                    if test "X$additional_libdir" != "X/usr/lib"; then
1477                      haveit=
1478                      if test "X$additional_libdir" = "X/usr/local/lib"; then
1479                        if test -n "$GCC"; then
1480                          case $host_os in
1481                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1482                          esac
1483                        fi
1484                      fi
1485                      if test -z "$haveit"; then
1486                        haveit=
1487                        for x in $LDFLAGS $LIB[]NAME; do
1488                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1489                          if test "X$x" = "X-L$additional_libdir"; then
1490                            haveit=yes
1491                            break
1492                          fi
1493                        done
1494                        if test -z "$haveit"; then
1495                          if test -d "$additional_libdir"; then
1496                            dnl Really add $additional_libdir to $LIBNAME.
1497                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1498                          fi
1499                        fi
1500                        haveit=
1501                        for x in $LDFLAGS $LTLIB[]NAME; do
1502                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1503                          if test "X$x" = "X-L$additional_libdir"; then
1504                            haveit=yes
1505                            break
1506                          fi
1507                        done
1508                        if test -z "$haveit"; then
1509                          if test -d "$additional_libdir"; then
1510                            dnl Really add $additional_libdir to $LTLIBNAME.
1511                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1512                          fi
1513                        fi
1514                      fi
1515                    fi
1516                    ;;
1517                  -R*)
1518                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
1519                    if test "$enable_rpath" != no; then
1520                      dnl Potentially add DIR to rpathdirs.
1521                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1522                      haveit=
1523                      for x in $rpathdirs; do
1524                        if test "X$x" = "X$dir"; then
1525                          haveit=yes
1526                          break
1527                        fi
1528                      done
1529                      if test -z "$haveit"; then
1530                        rpathdirs="$rpathdirs $dir"
1531                      fi
1532                      dnl Potentially add DIR to ltrpathdirs.
1533                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1534                      haveit=
1535                      for x in $ltrpathdirs; do
1536                        if test "X$x" = "X$dir"; then
1537                          haveit=yes
1538                          break
1539                        fi
1540                      done
1541                      if test -z "$haveit"; then
1542                        ltrpathdirs="$ltrpathdirs $dir"
1543                      fi
1544                    fi
1545                    ;;
1546                  -l*)
1547                    dnl Handle this in the next round.
1548                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1549                    ;;
1550                  *.la)
1551                    dnl Handle this in the next round. Throw away the .la's
1552                    dnl directory; it is already contained in a preceding -L
1553                    dnl option.
1554                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1555                    ;;
1556                  *)
1557                    dnl Most likely an immediate library name.
1558                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1559                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1560                    ;;
1561                esac
1562              done
1563            fi
1564          else
1565            dnl Didn't find the library; assume it is in the system directories
1566            dnl known to the linker and runtime loader. (All the system
1567            dnl directories known to the linker should also be known to the
1568            dnl runtime loader, otherwise the system is severely misconfigured.)
1569            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1570            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1571          fi
1572        fi
1573      fi
1574    done
1575  done
1576  if test "X$rpathdirs" != "X"; then
1577    if test -n "$hardcode_libdir_separator"; then
1578      dnl Weird platform: only the last -rpath option counts, the user must
1579      dnl pass all path elements in one option. We can arrange that for a
1580      dnl single library, but not when more than one $LIBNAMEs are used.
1581      alldirs=
1582      for found_dir in $rpathdirs; do
1583        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1584      done
1585      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1586      acl_save_libdir="$libdir"
1587      libdir="$alldirs"
1588      eval flag=\"$hardcode_libdir_flag_spec\"
1589      libdir="$acl_save_libdir"
1590      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1591    else
1592      dnl The -rpath options are cumulative.
1593      for found_dir in $rpathdirs; do
1594        acl_save_libdir="$libdir"
1595        libdir="$found_dir"
1596        eval flag=\"$hardcode_libdir_flag_spec\"
1597        libdir="$acl_save_libdir"
1598        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1599      done
1600    fi
1601  fi
1602  if test "X$ltrpathdirs" != "X"; then
1603    dnl When using libtool, the option that works for both libraries and
1604    dnl executables is -R. The -R options are cumulative.
1605    for found_dir in $ltrpathdirs; do
1606      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1607    done
1608  fi
1609])
1610
1611dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1612dnl unless already present in VAR.
1613dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1614dnl contains two or three consecutive elements that belong together.
1615AC_DEFUN([AC_LIB_APPENDTOVAR],
1616[
1617  for element in [$2]; do
1618    haveit=
1619    for x in $[$1]; do
1620      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1621      if test "X$x" = "X$element"; then
1622        haveit=yes
1623        break
1624      fi
1625    done
1626    if test -z "$haveit"; then
1627      [$1]="${[$1]}${[$1]:+ }$element"
1628    fi
1629  done
1630])
1631
1632# lib-prefix.m4 serial 4 (gettext-0.14.2)
1633dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
1634dnl This file is free software; the Free Software Foundation
1635dnl gives unlimited permission to copy and/or distribute it,
1636dnl with or without modifications, as long as this notice is preserved.
1637
1638dnl From Bruno Haible.
1639
1640dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1641dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1642dnl require excessive bracketing.
1643ifdef([AC_HELP_STRING],
1644[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1645[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1646
1647dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1648dnl to access previously installed libraries. The basic assumption is that
1649dnl a user will want packages to use other packages he previously installed
1650dnl with the same --prefix option.
1651dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1652dnl libraries, but is otherwise very convenient.
1653AC_DEFUN([AC_LIB_PREFIX],
1654[
1655  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1656  AC_REQUIRE([AC_PROG_CC])
1657  AC_REQUIRE([AC_CANONICAL_HOST])
1658  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1659  dnl By default, look in $includedir and $libdir.
1660  use_additional=yes
1661  AC_LIB_WITH_FINAL_PREFIX([
1662    eval additional_includedir=\"$includedir\"
1663    eval additional_libdir=\"$libdir\"
1664  ])
1665  AC_LIB_ARG_WITH([lib-prefix],
1666[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1667  --without-lib-prefix    don't search for libraries in includedir and libdir],
1668[
1669    if test "X$withval" = "Xno"; then
1670      use_additional=no
1671    else
1672      if test "X$withval" = "X"; then
1673        AC_LIB_WITH_FINAL_PREFIX([
1674          eval additional_includedir=\"$includedir\"
1675          eval additional_libdir=\"$libdir\"
1676        ])
1677      else
1678        additional_includedir="$withval/include"
1679        additional_libdir="$withval/lib"
1680      fi
1681    fi
1682])
1683  if test $use_additional = yes; then
1684    dnl Potentially add $additional_includedir to $CPPFLAGS.
1685    dnl But don't add it
1686    dnl   1. if it's the standard /usr/include,
1687    dnl   2. if it's already present in $CPPFLAGS,
1688    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1689    dnl   4. if it doesn't exist as a directory.
1690    if test "X$additional_includedir" != "X/usr/include"; then
1691      haveit=
1692      for x in $CPPFLAGS; do
1693        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1694        if test "X$x" = "X-I$additional_includedir"; then
1695          haveit=yes
1696          break
1697        fi
1698      done
1699      if test -z "$haveit"; then
1700        if test "X$additional_includedir" = "X/usr/local/include"; then
1701          if test -n "$GCC"; then
1702            case $host_os in
1703              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1704            esac
1705          fi
1706        fi
1707        if test -z "$haveit"; then
1708          if test -d "$additional_includedir"; then
1709            dnl Really add $additional_includedir to $CPPFLAGS.
1710            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1711          fi
1712        fi
1713      fi
1714    fi
1715    dnl Potentially add $additional_libdir to $LDFLAGS.
1716    dnl But don't add it
1717    dnl   1. if it's the standard /usr/lib,
1718    dnl   2. if it's already present in $LDFLAGS,
1719    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1720    dnl   4. if it doesn't exist as a directory.
1721    if test "X$additional_libdir" != "X/usr/lib"; then
1722      haveit=
1723      for x in $LDFLAGS; do
1724        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1725        if test "X$x" = "X-L$additional_libdir"; then
1726          haveit=yes
1727          break
1728        fi
1729      done
1730      if test -z "$haveit"; then
1731        if test "X$additional_libdir" = "X/usr/local/lib"; then
1732          if test -n "$GCC"; then
1733            case $host_os in
1734              linux*) haveit=yes;;
1735            esac
1736          fi
1737        fi
1738        if test -z "$haveit"; then
1739          if test -d "$additional_libdir"; then
1740            dnl Really add $additional_libdir to $LDFLAGS.
1741            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1742          fi
1743        fi
1744      fi
1745    fi
1746  fi
1747])
1748
1749dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1750dnl acl_final_exec_prefix, containing the values to which $prefix and
1751dnl $exec_prefix will expand at the end of the configure script.
1752AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1753[
1754  dnl Unfortunately, prefix and exec_prefix get only finally determined
1755  dnl at the end of configure.
1756  if test "X$prefix" = "XNONE"; then
1757    acl_final_prefix="$ac_default_prefix"
1758  else
1759    acl_final_prefix="$prefix"
1760  fi
1761  if test "X$exec_prefix" = "XNONE"; then
1762    acl_final_exec_prefix='${prefix}'
1763  else
1764    acl_final_exec_prefix="$exec_prefix"
1765  fi
1766  acl_save_prefix="$prefix"
1767  prefix="$acl_final_prefix"
1768  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1769  prefix="$acl_save_prefix"
1770])
1771
1772dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1773dnl variables prefix and exec_prefix bound to the values they will have
1774dnl at the end of the configure script.
1775AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1776[
1777  acl_save_prefix="$prefix"
1778  prefix="$acl_final_prefix"
1779  acl_save_exec_prefix="$exec_prefix"
1780  exec_prefix="$acl_final_exec_prefix"
1781  $1
1782  exec_prefix="$acl_save_exec_prefix"
1783  prefix="$acl_save_prefix"
1784])
1785
1786# longdouble.m4 serial 1 (gettext-0.12)
1787dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
1788dnl This file is free software; the Free Software Foundation
1789dnl gives unlimited permission to copy and/or distribute it,
1790dnl with or without modifications, as long as this notice is preserved.
1791
1792dnl From Bruno Haible.
1793dnl Test whether the compiler supports the 'long double' type.
1794dnl Prerequisite: AC_PROG_CC
1795
1796AC_DEFUN([gt_TYPE_LONGDOUBLE],
1797[
1798  AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
1799    [if test "$GCC" = yes; then
1800       gt_cv_c_long_double=yes
1801     else
1802       AC_TRY_COMPILE([
1803         /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
1804         long double foo = 0.0;
1805         /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
1806         int array [2*(sizeof(long double) >= sizeof(double)) - 1];
1807         ], ,
1808         gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
1809     fi])
1810  if test $gt_cv_c_long_double = yes; then
1811    AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
1812  fi
1813])
1814
1815# longlong.m4 serial 5
1816dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
1817dnl This file is free software; the Free Software Foundation
1818dnl gives unlimited permission to copy and/or distribute it,
1819dnl with or without modifications, as long as this notice is preserved.
1820
1821dnl From Paul Eggert.
1822
1823# Define HAVE_LONG_LONG if 'long long' works.
1824
1825AC_DEFUN([gl_AC_TYPE_LONG_LONG],
1826[
1827  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
1828  [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
1829    [long long llmax = (long long) -1;
1830     return ll << i | ll >> i | llmax / ll | llmax % ll;],
1831    ac_cv_type_long_long=yes,
1832    ac_cv_type_long_long=no)])
1833  if test $ac_cv_type_long_long = yes; then
1834    AC_DEFINE(HAVE_LONG_LONG, 1,
1835      [Define if you have the 'long long' type.])
1836  fi
1837])
1838
1839# nls.m4 serial 2 (gettext-0.14.3)
1840dnl Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc.
1841dnl This file is free software; the Free Software Foundation
1842dnl gives unlimited permission to copy and/or distribute it,
1843dnl with or without modifications, as long as this notice is preserved.
1844dnl
1845dnl This file can can be used in projects which are not available under
1846dnl the GNU General Public License or the GNU Library General Public
1847dnl License but which still want to provide support for the GNU gettext
1848dnl functionality.
1849dnl Please note that the actual code of the GNU gettext library is covered
1850dnl by the GNU Library General Public License, and the rest of the GNU
1851dnl gettext package package is covered by the GNU General Public License.
1852dnl They are *not* in the public domain.
1853
1854dnl Authors:
1855dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1856dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1857
1858AC_PREREQ(2.50)
1859
1860AC_DEFUN([AM_NLS],
1861[
1862  AC_MSG_CHECKING([whether NLS is requested])
1863  dnl Default is enabled NLS
1864  AC_ARG_ENABLE(nls,
1865    [  --disable-nls           do not use Native Language Support],
1866    USE_NLS=$enableval, USE_NLS=yes)
1867  AC_MSG_RESULT($USE_NLS)
1868  AC_SUBST(USE_NLS)
1869])
1870
1871AC_DEFUN([AM_MKINSTALLDIRS],
1872[
1873  dnl Tell automake >= 1.10 to complain if mkinstalldirs is missing.
1874  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([mkinstalldirs])])
1875  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1876  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1877  dnl Try to locate it.
1878  MKINSTALLDIRS=
1879  if test -n "$ac_aux_dir"; then
1880    case "$ac_aux_dir" in
1881      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
1882      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
1883    esac
1884  fi
1885  if test -z "$MKINSTALLDIRS"; then
1886    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1887  fi
1888  AC_SUBST(MKINSTALLDIRS)
1889])
1890
1891# po.m4 serial 7 (gettext-0.14.3)
1892dnl Copyright (C) 1995-2005 Free Software Foundation, Inc.
1893dnl This file is free software; the Free Software Foundation
1894dnl gives unlimited permission to copy and/or distribute it,
1895dnl with or without modifications, as long as this notice is preserved.
1896dnl
1897dnl This file can can be used in projects which are not available under
1898dnl the GNU General Public License or the GNU Library General Public
1899dnl License but which still want to provide support for the GNU gettext
1900dnl functionality.
1901dnl Please note that the actual code of the GNU gettext library is covered
1902dnl by the GNU Library General Public License, and the rest of the GNU
1903dnl gettext package package is covered by the GNU General Public License.
1904dnl They are *not* in the public domain.
1905
1906dnl Authors:
1907dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1908dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1909
1910AC_PREREQ(2.50)
1911
1912dnl Checks for all prerequisites of the po subdirectory.
1913AC_DEFUN([AM_PO_SUBDIRS],
1914[
1915  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1916  AC_REQUIRE([AC_PROG_INSTALL])dnl
1917  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1918  AC_REQUIRE([AM_NLS])dnl
1919
1920  dnl Perform the following tests also if --disable-nls has been given,
1921  dnl because they are needed for "make dist" to work.
1922
1923  dnl Search for GNU msgfmt in the PATH.
1924  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
1925  dnl The second test excludes FreeBSD msgfmt.
1926  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1927    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
1928     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1929    :)
1930  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1931
1932  dnl Search for GNU xgettext 0.12 or newer in the PATH.
1933  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
1934  dnl The second test excludes FreeBSD xgettext.
1935  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1936    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
1937     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1938    :)
1939  dnl Remove leftover from FreeBSD xgettext call.
1940  rm -f messages.po
1941
1942  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
1943  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
1944    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
1945
1946  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1947  dnl Test whether we really found GNU msgfmt.
1948  if test "$GMSGFMT" != ":"; then
1949    dnl If it is no GNU msgfmt we define it as : so that the
1950    dnl Makefiles still can work.
1951    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
1952       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1953      : ;
1954    else
1955      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
1956      AC_MSG_RESULT(
1957        [found $GMSGFMT program is not GNU msgfmt; ignore it])
1958      GMSGFMT=":"
1959    fi
1960  fi
1961
1962  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1963  dnl Test whether we really found GNU xgettext.
1964  if test "$XGETTEXT" != ":"; then
1965    dnl If it is no GNU xgettext we define it as : so that the
1966    dnl Makefiles still can work.
1967    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
1968       (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1969      : ;
1970    else
1971      AC_MSG_RESULT(
1972        [found xgettext program is not GNU xgettext; ignore it])
1973      XGETTEXT=":"
1974    fi
1975    dnl Remove leftover from FreeBSD xgettext call.
1976    rm -f messages.po
1977  fi
1978
1979  AC_OUTPUT_COMMANDS([
1980    for ac_file in $CONFIG_FILES; do
1981      # Support "outfile[:infile[:infile...]]"
1982      case "$ac_file" in
1983        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1984      esac
1985      # PO directories have a Makefile.in generated from Makefile.in.in.
1986      case "$ac_file" in */Makefile.in)
1987        # Adjust a relative srcdir.
1988        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1989        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1990        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1991        # In autoconf-2.13 it is called $ac_given_srcdir.
1992        # In autoconf-2.50 it is called $srcdir.
1993        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1994        case "$ac_given_srcdir" in
1995          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1996          /*) top_srcdir="$ac_given_srcdir" ;;
1997          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1998        esac
1999        # Treat a directory as a PO directory if and only if it has a
2000        # POTFILES.in file. This allows packages to have multiple PO
2001        # directories under different names or in different locations.
2002        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
2003          rm -f "$ac_dir/POTFILES"
2004          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
2005          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
2006          POMAKEFILEDEPS="POTFILES.in"
2007          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
2008          # on $ac_dir but don't depend on user-specified configuration
2009          # parameters.
2010          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2011            # The LINGUAS file contains the set of available languages.
2012            if test -n "$OBSOLETE_ALL_LINGUAS"; then
2013              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2014            fi
2015            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2016            # Hide the ALL_LINGUAS assigment from automake.
2017            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2018            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2019          else
2020            # The set of available languages was given in configure.in.
2021            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
2022          fi
2023          # Compute POFILES
2024          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2025          # Compute UPDATEPOFILES
2026          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2027          # Compute DUMMYPOFILES
2028          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2029          # Compute GMOFILES
2030          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2031          case "$ac_given_srcdir" in
2032            .) srcdirpre= ;;
2033            *) srcdirpre='$(srcdir)/' ;;
2034          esac
2035          POFILES=
2036          UPDATEPOFILES=
2037          DUMMYPOFILES=
2038          GMOFILES=
2039          for lang in $ALL_LINGUAS; do
2040            POFILES="$POFILES $srcdirpre$lang.po"
2041            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2042            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2043            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2044          done
2045          # CATALOGS depends on both $ac_dir and the user's LINGUAS
2046          # environment variable.
2047          INST_LINGUAS=
2048          if test -n "$ALL_LINGUAS"; then
2049            for presentlang in $ALL_LINGUAS; do
2050              useit=no
2051              if test "%UNSET%" != "$LINGUAS"; then
2052                desiredlanguages="$LINGUAS"
2053              else
2054                desiredlanguages="$ALL_LINGUAS"
2055              fi
2056              for desiredlang in $desiredlanguages; do
2057                # Use the presentlang catalog if desiredlang is
2058                #   a. equal to presentlang, or
2059                #   b. a variant of presentlang (because in this case,
2060                #      presentlang can be used as a fallback for messages
2061                #      which are not translated in the desiredlang catalog).
2062                case "$desiredlang" in
2063                  "$presentlang"*) useit=yes;;
2064                esac
2065              done
2066              if test $useit = yes; then
2067                INST_LINGUAS="$INST_LINGUAS $presentlang"
2068              fi
2069            done
2070          fi
2071          CATALOGS=
2072          if test -n "$INST_LINGUAS"; then
2073            for lang in $INST_LINGUAS; do
2074              CATALOGS="$CATALOGS $lang.gmo"
2075            done
2076          fi
2077          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
2078          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
2079          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
2080            if test -f "$f"; then
2081              case "$f" in
2082                *.orig | *.bak | *~) ;;
2083                *) cat "$f" >> "$ac_dir/Makefile" ;;
2084              esac
2085            fi
2086          done
2087        fi
2088        ;;
2089      esac
2090    done],
2091   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
2092    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
2093    # from automake.
2094    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
2095    # Capture the value of LINGUAS because we need it to compute CATALOGS.
2096    LINGUAS="${LINGUAS-%UNSET%}"
2097   ])
2098])
2099
2100dnl Postprocesses a Makefile in a directory containing PO files.
2101AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
2102[
2103  # When this code is run, in config.status, two variables have already been
2104  # set:
2105  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
2106  # - LINGUAS is the value of the environment variable LINGUAS at configure
2107  #   time.
2108
2109changequote(,)dnl
2110  # Adjust a relative srcdir.
2111  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2112  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2113  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2114  # In autoconf-2.13 it is called $ac_given_srcdir.
2115  # In autoconf-2.50 it is called $srcdir.
2116  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2117  case "$ac_given_srcdir" in
2118    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2119    /*) top_srcdir="$ac_given_srcdir" ;;
2120    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2121  esac
2122
2123  # Find a way to echo strings without interpreting backslash.
2124  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
2125    gt_echo='echo'
2126  else
2127    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
2128      gt_echo='printf %s\n'
2129    else
2130      echo_func () {
2131        cat <<EOT
2132$*
2133EOT
2134      }
2135      gt_echo='echo_func'
2136    fi
2137  fi
2138
2139  # A sed script that extracts the value of VARIABLE from a Makefile.
2140  sed_x_variable='
2141# Test if the hold space is empty.
2142x
2143s/P/P/
2144x
2145ta
2146# Yes it was empty. Look if we have the expected variable definition.
2147/^[	 ]*VARIABLE[	 ]*=/{
2148  # Seen the first line of the variable definition.
2149  s/^[	 ]*VARIABLE[	 ]*=//
2150  ba
2151}
2152bd
2153:a
2154# Here we are processing a line from the variable definition.
2155# Remove comment, more precisely replace it with a space.
2156s/#.*$/ /
2157# See if the line ends in a backslash.
2158tb
2159:b
2160s/\\$//
2161# Print the line, without the trailing backslash.
2162p
2163tc
2164# There was no trailing backslash. The end of the variable definition is
2165# reached. Clear the hold space.
2166s/^.*$//
2167x
2168bd
2169:c
2170# A trailing backslash means that the variable definition continues in the
2171# next line. Put a nonempty string into the hold space to indicate this.
2172s/^.*$/P/
2173x
2174:d
2175'
2176changequote([,])dnl
2177
2178  # Set POTFILES to the value of the Makefile variable POTFILES.
2179  sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
2180  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
2181  # Compute POTFILES_DEPS as
2182  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
2183  POTFILES_DEPS=
2184  for file in $POTFILES; do
2185    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
2186  done
2187  POMAKEFILEDEPS=""
2188
2189  if test -n "$OBSOLETE_ALL_LINGUAS"; then
2190    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2191  fi
2192  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2193    # The LINGUAS file contains the set of available languages.
2194    ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2195    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2196  else
2197    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
2198    sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
2199    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
2200  fi
2201  # Hide the ALL_LINGUAS assigment from automake.
2202  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2203  # Compute POFILES
2204  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2205  # Compute UPDATEPOFILES
2206  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2207  # Compute DUMMYPOFILES
2208  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2209  # Compute GMOFILES
2210  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2211  # Compute PROPERTIESFILES
2212  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
2213  # Compute CLASSFILES
2214  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
2215  # Compute QMFILES
2216  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
2217  # Compute MSGFILES
2218  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
2219  # Compute RESOURCESDLLFILES
2220  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
2221  case "$ac_given_srcdir" in
2222    .) srcdirpre= ;;
2223    *) srcdirpre='$(srcdir)/' ;;
2224  esac
2225  POFILES=
2226  UPDATEPOFILES=
2227  DUMMYPOFILES=
2228  GMOFILES=
2229  PROPERTIESFILES=
2230  CLASSFILES=
2231  QMFILES=
2232  MSGFILES=
2233  RESOURCESDLLFILES=
2234  for lang in $ALL_LINGUAS; do
2235    POFILES="$POFILES $srcdirpre$lang.po"
2236    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2237    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2238    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2239    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
2240    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
2241    QMFILES="$QMFILES $srcdirpre$lang.qm"
2242    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2243    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
2244    frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2245    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
2246  done
2247  # CATALOGS depends on both $ac_dir and the user's LINGUAS
2248  # environment variable.
2249  INST_LINGUAS=
2250  if test -n "$ALL_LINGUAS"; then
2251    for presentlang in $ALL_LINGUAS; do
2252      useit=no
2253      if test "%UNSET%" != "$LINGUAS"; then
2254        desiredlanguages="$LINGUAS"
2255      else
2256        desiredlanguages="$ALL_LINGUAS"
2257      fi
2258      for desiredlang in $desiredlanguages; do
2259        # Use the presentlang catalog if desiredlang is
2260        #   a. equal to presentlang, or
2261        #   b. a variant of presentlang (because in this case,
2262        #      presentlang can be used as a fallback for messages
2263        #      which are not translated in the desiredlang catalog).
2264        case "$desiredlang" in
2265          "$presentlang"*) useit=yes;;
2266        esac
2267      done
2268      if test $useit = yes; then
2269        INST_LINGUAS="$INST_LINGUAS $presentlang"
2270      fi
2271    done
2272  fi
2273  CATALOGS=
2274  JAVACATALOGS=
2275  QTCATALOGS=
2276  TCLCATALOGS=
2277  CSHARPCATALOGS=
2278  if test -n "$INST_LINGUAS"; then
2279    for lang in $INST_LINGUAS; do
2280      CATALOGS="$CATALOGS $lang.gmo"
2281      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
2282      QTCATALOGS="$QTCATALOGS $lang.qm"
2283      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2284      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
2285      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2286      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
2287    done
2288  fi
2289
2290  sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
2291  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
2292    # Add dependencies that cannot be formulated as a simple suffix rule.
2293    for lang in $ALL_LINGUAS; do
2294      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2295      cat >> "$ac_file.tmp" <<EOF
2296$frobbedlang.msg: $lang.po
2297	@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
2298	\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2299EOF
2300    done
2301  fi
2302  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
2303    # Add dependencies that cannot be formulated as a simple suffix rule.
2304    for lang in $ALL_LINGUAS; do
2305      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2306      cat >> "$ac_file.tmp" <<EOF
2307$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
2308	@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
2309	\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2310EOF
2311    done
2312  fi
2313  if test -n "$POMAKEFILEDEPS"; then
2314    cat >> "$ac_file.tmp" <<EOF
2315Makefile: $POMAKEFILEDEPS
2316EOF
2317  fi
2318  mv "$ac_file.tmp" "$ac_file"
2319])
2320
2321# printf-posix.m4 serial 2 (gettext-0.13.1)
2322dnl Copyright (C) 2003 Free Software Foundation, Inc.
2323dnl This file is free software; the Free Software Foundation
2324dnl gives unlimited permission to copy and/or distribute it,
2325dnl with or without modifications, as long as this notice is preserved.
2326
2327dnl From Bruno Haible.
2328dnl Test whether the printf() function supports POSIX/XSI format strings with
2329dnl positions.
2330
2331AC_DEFUN([gt_PRINTF_POSIX],
2332[
2333  AC_REQUIRE([AC_PROG_CC])
2334  AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
2335    gt_cv_func_printf_posix,
2336    [
2337      AC_TRY_RUN([
2338#include <stdio.h>
2339#include <string.h>
2340/* The string "%2$d %1$d", with dollar characters protected from the shell's
2341   dollar expansion (possibly an autoconf bug).  */
2342static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
2343static char buf[100];
2344int main ()
2345{
2346  sprintf (buf, format, 33, 55);
2347  return (strcmp (buf, "55 33") != 0);
2348}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
2349      [
2350        AC_EGREP_CPP(notposix, [
2351#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
2352  notposix
2353#endif
2354        ], gt_cv_func_printf_posix="guessing no",
2355           gt_cv_func_printf_posix="guessing yes")
2356      ])
2357    ])
2358  case $gt_cv_func_printf_posix in
2359    *yes)
2360      AC_DEFINE(HAVE_POSIX_PRINTF, 1,
2361        [Define if your printf() function supports format strings with positions.])
2362      ;;
2363  esac
2364])
2365
2366# progtest.m4 serial 4 (gettext-0.14.2)
2367dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
2368dnl This file is free software; the Free Software Foundation
2369dnl gives unlimited permission to copy and/or distribute it,
2370dnl with or without modifications, as long as this notice is preserved.
2371dnl
2372dnl This file can can be used in projects which are not available under
2373dnl the GNU General Public License or the GNU Library General Public
2374dnl License but which still want to provide support for the GNU gettext
2375dnl functionality.
2376dnl Please note that the actual code of the GNU gettext library is covered
2377dnl by the GNU Library General Public License, and the rest of the GNU
2378dnl gettext package package is covered by the GNU General Public License.
2379dnl They are *not* in the public domain.
2380
2381dnl Authors:
2382dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2383
2384AC_PREREQ(2.50)
2385
2386# Search path for a program which passes the given test.
2387
2388dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2389dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2390AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2391[
2392# Prepare PATH_SEPARATOR.
2393# The user is always right.
2394if test "${PATH_SEPARATOR+set}" != set; then
2395  echo "#! /bin/sh" >conf$$.sh
2396  echo  "exit 0"   >>conf$$.sh
2397  chmod +x conf$$.sh
2398  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2399    PATH_SEPARATOR=';'
2400  else
2401    PATH_SEPARATOR=:
2402  fi
2403  rm -f conf$$.sh
2404fi
2405
2406# Find out how to test for executable files. Don't use a zero-byte file,
2407# as systems may use methods other than mode bits to determine executability.
2408cat >conf$$.file <<_ASEOF
2409#! /bin/sh
2410exit 0
2411_ASEOF
2412chmod +x conf$$.file
2413if test -x conf$$.file >/dev/null 2>&1; then
2414  ac_executable_p="test -x"
2415else
2416  ac_executable_p="test -f"
2417fi
2418rm -f conf$$.file
2419
2420# Extract the first word of "$2", so it can be a program name with args.
2421set dummy $2; ac_word=[$]2
2422AC_MSG_CHECKING([for $ac_word])
2423AC_CACHE_VAL(ac_cv_path_$1,
2424[case "[$]$1" in
2425  [[\\/]]* | ?:[[\\/]]*)
2426    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2427    ;;
2428  *)
2429    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
2430    for ac_dir in ifelse([$5], , $PATH, [$5]); do
2431      IFS="$ac_save_IFS"
2432      test -z "$ac_dir" && ac_dir=.
2433      for ac_exec_ext in '' $ac_executable_extensions; do
2434        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
2435          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
2436          if [$3]; then
2437            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
2438            break 2
2439          fi
2440        fi
2441      done
2442    done
2443    IFS="$ac_save_IFS"
2444dnl If no 4th arg is given, leave the cache variable unset,
2445dnl so AC_PATH_PROGS will keep looking.
2446ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2447])dnl
2448    ;;
2449esac])dnl
2450$1="$ac_cv_path_$1"
2451if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2452  AC_MSG_RESULT([$]$1)
2453else
2454  AC_MSG_RESULT(no)
2455fi
2456AC_SUBST($1)dnl
2457])
2458
2459# Configure paths for SDL
2460# Sam Lantinga 9/21/99
2461# stolen from Manish Singh
2462# stolen back from Frank Belew
2463# stolen from Manish Singh
2464# Shamelessly stolen from Owen Taylor
2465
2466dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2467dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
2468dnl
2469AC_DEFUN([AM_PATH_SDL],
2470[dnl
2471dnl Get the cflags and libraries from the sdl-config script
2472dnl
2473AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
2474            sdl_prefix="$withval", sdl_prefix="")
2475AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
2476            sdl_exec_prefix="$withval", sdl_exec_prefix="")
2477AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
2478		    , enable_sdltest=yes)
2479
2480  if test x$sdl_exec_prefix != x ; then
2481    sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
2482    if test x${SDL_CONFIG+set} != xset ; then
2483      SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
2484    fi
2485  fi
2486  if test x$sdl_prefix != x ; then
2487    sdl_args="$sdl_args --prefix=$sdl_prefix"
2488    if test x${SDL_CONFIG+set} != xset ; then
2489      SDL_CONFIG=$sdl_prefix/bin/sdl-config
2490    fi
2491  fi
2492
2493  if test "x$prefix" != xNONE; then
2494    PATH="$prefix/bin:$prefix/usr/bin:$PATH"
2495  fi
2496  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
2497  min_sdl_version=ifelse([$1], ,0.11.0,$1)
2498  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
2499  no_sdl=""
2500  if test "$SDL_CONFIG" = "no" ; then
2501    no_sdl=yes
2502  else
2503    SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
2504    SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
2505
2506    sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
2507           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2508    sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
2509           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2510    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
2511           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2512    if test "x$enable_sdltest" = "xyes" ; then
2513      ac_save_CFLAGS="$CFLAGS"
2514      ac_save_CXXFLAGS="$CXXFLAGS"
2515      ac_save_LIBS="$LIBS"
2516      CFLAGS="$CFLAGS $SDL_CFLAGS"
2517      CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2518      LIBS="$LIBS $SDL_LIBS"
2519dnl
2520dnl Now check if the installed SDL is sufficiently new. (Also sanity
2521dnl checks the results of sdl-config to some extent
2522dnl
2523      rm -f conf.sdltest
2524      AC_TRY_RUN([
2525#include <stdio.h>
2526#include <stdlib.h>
2527#include <string.h>
2528#include "SDL.h"
2529
2530char*
2531my_strdup (char *str)
2532{
2533  char *new_str;
2534
2535  if (str)
2536    {
2537      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
2538      strcpy (new_str, str);
2539    }
2540  else
2541    new_str = NULL;
2542
2543  return new_str;
2544}
2545
2546int main (int argc, char *argv[])
2547{
2548  int major, minor, micro;
2549  char *tmp_version;
2550
2551  /* This hangs on some systems (?)
2552  system ("touch conf.sdltest");
2553  */
2554  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
2555
2556  /* HP/UX 9 (%@#!) writes to sscanf strings */
2557  tmp_version = my_strdup("$min_sdl_version");
2558  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2559     printf("%s, bad version string\n", "$min_sdl_version");
2560     exit(1);
2561   }
2562
2563   if (($sdl_major_version > major) ||
2564      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
2565      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
2566    {
2567      return 0;
2568    }
2569  else
2570    {
2571      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
2572      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
2573      printf("*** best to upgrade to the required version.\n");
2574      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
2575      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
2576      printf("*** config.cache before re-running configure\n");
2577      return 1;
2578    }
2579}
2580
2581],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2582       CFLAGS="$ac_save_CFLAGS"
2583       CXXFLAGS="$ac_save_CXXFLAGS"
2584       LIBS="$ac_save_LIBS"
2585     fi
2586  fi
2587  if test "x$no_sdl" = x ; then
2588     AC_MSG_RESULT(yes)
2589     ifelse([$2], , :, [$2])
2590  else
2591     AC_MSG_RESULT(no)
2592     if test "$SDL_CONFIG" = "no" ; then
2593       echo "*** The sdl-config script installed by SDL could not be found"
2594       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
2595       echo "*** your path, or set the SDL_CONFIG environment variable to the"
2596       echo "*** full path to sdl-config."
2597     else
2598       if test -f conf.sdltest ; then
2599        :
2600       else
2601          echo "*** Could not run SDL test program, checking why..."
2602          CFLAGS="$CFLAGS $SDL_CFLAGS"
2603          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2604          LIBS="$LIBS $SDL_LIBS"
2605          AC_TRY_LINK([
2606#include <stdio.h>
2607#include "SDL.h"
2608
2609int main(int argc, char *argv[])
2610{ return 0; }
2611#undef  main
2612#define main K_and_R_C_main
2613],      [ return 0; ],
2614        [ echo "*** The test program compiled, but did not run. This usually means"
2615          echo "*** that the run-time linker is not finding SDL or finding the wrong"
2616          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
2617          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2618          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2619          echo "*** is required on your system"
2620	  echo "***"
2621          echo "*** If you have an old version installed, it is best to remove it, although"
2622          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2623        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2624          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
2625          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
2626          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
2627          CFLAGS="$ac_save_CFLAGS"
2628          CXXFLAGS="$ac_save_CXXFLAGS"
2629          LIBS="$ac_save_LIBS"
2630       fi
2631     fi
2632     SDL_CFLAGS=""
2633     SDL_LIBS=""
2634     ifelse([$3], , :, [$3])
2635  fi
2636  AC_SUBST(SDL_CFLAGS)
2637  AC_SUBST(SDL_LIBS)
2638  rm -f conf.sdltest
2639])
2640
2641# signed.m4 serial 1 (gettext-0.10.40)
2642dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
2643dnl This file is free software; the Free Software Foundation
2644dnl gives unlimited permission to copy and/or distribute it,
2645dnl with or without modifications, as long as this notice is preserved.
2646
2647dnl From Bruno Haible.
2648
2649AC_DEFUN([bh_C_SIGNED],
2650[
2651  AC_CACHE_CHECK([for signed], bh_cv_c_signed,
2652   [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
2653  if test $bh_cv_c_signed = no; then
2654    AC_DEFINE(signed, ,
2655              [Define to empty if the C compiler doesn't support this keyword.])
2656  fi
2657])
2658
2659# size_max.m4 serial 2
2660dnl Copyright (C) 2003 Free Software Foundation, Inc.
2661dnl This file is free software; the Free Software Foundation
2662dnl gives unlimited permission to copy and/or distribute it,
2663dnl with or without modifications, as long as this notice is preserved.
2664
2665dnl From Bruno Haible.
2666
2667AC_DEFUN([gl_SIZE_MAX],
2668[
2669  AC_CHECK_HEADERS(stdint.h)
2670  dnl First test whether the system already has SIZE_MAX.
2671  AC_MSG_CHECKING([for SIZE_MAX])
2672  result=
2673  AC_EGREP_CPP([Found it], [
2674#include <limits.h>
2675#if HAVE_STDINT_H
2676#include <stdint.h>
2677#endif
2678#ifdef SIZE_MAX
2679Found it
2680#endif
2681], result=yes)
2682  if test -z "$result"; then
2683    dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
2684    dnl than the type 'unsigned long'.
2685    dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
2686    dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
2687    _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
2688      [#include <stddef.h>], result=?)
2689    _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
2690      [#include <stddef.h>], result=?)
2691    _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
2692      [#include <stddef.h>], result=?)
2693    if test "$fits_in_uint" = 1; then
2694      dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
2695      dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
2696      AC_TRY_COMPILE([#include <stddef.h>
2697        extern size_t foo;
2698        extern unsigned long foo;
2699        ], [], fits_in_uint=0)
2700    fi
2701    if test -z "$result"; then
2702      if test "$fits_in_uint" = 1; then
2703        result="$res_hi$res_lo"U
2704      else
2705        result="$res_hi$res_lo"UL
2706      fi
2707    else
2708      dnl Shouldn't happen, but who knows...
2709      result='~(size_t)0'
2710    fi
2711  fi
2712  AC_MSG_RESULT([$result])
2713  if test "$result" != yes; then
2714    AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
2715      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
2716  fi
2717])
2718
2719# stdint_h.m4 serial 5
2720dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
2721dnl This file is free software; the Free Software Foundation
2722dnl gives unlimited permission to copy and/or distribute it,
2723dnl with or without modifications, as long as this notice is preserved.
2724
2725dnl From Paul Eggert.
2726
2727# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
2728# doesn't clash with <sys/types.h>, and declares uintmax_t.
2729
2730AC_DEFUN([gl_AC_HEADER_STDINT_H],
2731[
2732  AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
2733  [AC_TRY_COMPILE(
2734    [#include <sys/types.h>
2735#include <stdint.h>],
2736    [uintmax_t i = (uintmax_t) -1;],
2737    gl_cv_header_stdint_h=yes,
2738    gl_cv_header_stdint_h=no)])
2739  if test $gl_cv_header_stdint_h = yes; then
2740    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
2741      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
2742       and declares uintmax_t. ])
2743  fi
2744])
2745
2746# uintmax_t.m4 serial 9
2747dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
2748dnl This file is free software; the Free Software Foundation
2749dnl gives unlimited permission to copy and/or distribute it,
2750dnl with or without modifications, as long as this notice is preserved.
2751
2752dnl From Paul Eggert.
2753
2754AC_PREREQ(2.13)
2755
2756# Define uintmax_t to 'unsigned long' or 'unsigned long long'
2757# if it is not already defined in <stdint.h> or <inttypes.h>.
2758
2759AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
2760[
2761  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
2762  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
2763  if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
2764    AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG])
2765    test $ac_cv_type_unsigned_long_long = yes \
2766      && ac_type='unsigned long long' \
2767      || ac_type='unsigned long'
2768    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2769      [Define to unsigned long or unsigned long long
2770       if <stdint.h> and <inttypes.h> don't define.])
2771  else
2772    AC_DEFINE(HAVE_UINTMAX_T, 1,
2773      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
2774  fi
2775])
2776
2777# ulonglong.m4 serial 4
2778dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
2779dnl This file is free software; the Free Software Foundation
2780dnl gives unlimited permission to copy and/or distribute it,
2781dnl with or without modifications, as long as this notice is preserved.
2782
2783dnl From Paul Eggert.
2784
2785# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
2786
2787AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
2788[
2789  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
2790  [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
2791    [unsigned long long ullmax = (unsigned long long) -1;
2792     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
2793    ac_cv_type_unsigned_long_long=yes,
2794    ac_cv_type_unsigned_long_long=no)])
2795  if test $ac_cv_type_unsigned_long_long = yes; then
2796    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
2797      [Define if you have the 'unsigned long long' type.])
2798  fi
2799])
2800
2801# wchar_t.m4 serial 1 (gettext-0.12)
2802dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
2803dnl This file is free software; the Free Software Foundation
2804dnl gives unlimited permission to copy and/or distribute it,
2805dnl with or without modifications, as long as this notice is preserved.
2806
2807dnl From Bruno Haible.
2808dnl Test whether <stddef.h> has the 'wchar_t' type.
2809dnl Prerequisite: AC_PROG_CC
2810
2811AC_DEFUN([gt_TYPE_WCHAR_T],
2812[
2813  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
2814    [AC_TRY_COMPILE([#include <stddef.h>
2815       wchar_t foo = (wchar_t)'\0';], ,
2816       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
2817  if test $gt_cv_c_wchar_t = yes; then
2818    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
2819  fi
2820])
2821
2822# wint_t.m4 serial 1 (gettext-0.12)
2823dnl Copyright (C) 2003 Free Software Foundation, Inc.
2824dnl This file is free software; the Free Software Foundation
2825dnl gives unlimited permission to copy and/or distribute it,
2826dnl with or without modifications, as long as this notice is preserved.
2827
2828dnl From Bruno Haible.
2829dnl Test whether <wchar.h> has the 'wint_t' type.
2830dnl Prerequisite: AC_PROG_CC
2831
2832AC_DEFUN([gt_TYPE_WINT_T],
2833[
2834  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
2835    [AC_TRY_COMPILE([#include <wchar.h>
2836       wint_t foo = (wchar_t)'\0';], ,
2837       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
2838  if test $gt_cv_c_wint_t = yes; then
2839    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
2840  fi
2841])
2842
2843# xsize.m4 serial 3
2844dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
2845dnl This file is free software; the Free Software Foundation
2846dnl gives unlimited permission to copy and/or distribute it,
2847dnl with or without modifications, as long as this notice is preserved.
2848
2849AC_DEFUN([gl_XSIZE],
2850[
2851  dnl Prerequisites of lib/xsize.h.
2852  AC_REQUIRE([gl_SIZE_MAX])
2853  AC_REQUIRE([AC_C_INLINE])
2854  AC_CHECK_HEADERS(stdint.h)
2855])
2856
2857# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
2858#
2859# This file is free software; the Free Software Foundation
2860# gives unlimited permission to copy and/or distribute it,
2861# with or without modifications, as long as this notice is preserved.
2862
2863# AM_AUTOMAKE_VERSION(VERSION)
2864# ----------------------------
2865# Automake X.Y traces this macro to ensure aclocal.m4 has been
2866# generated from the m4 files accompanying Automake X.Y.
2867AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
2868
2869# AM_SET_CURRENT_AUTOMAKE_VERSION
2870# -------------------------------
2871# Call AM_AUTOMAKE_VERSION so it can be traced.
2872# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
2873AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
2874	 [AM_AUTOMAKE_VERSION([1.9.6])])
2875
2876# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
2877
2878# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
2879#
2880# This file is free software; the Free Software Foundation
2881# gives unlimited permission to copy and/or distribute it,
2882# with or without modifications, as long as this notice is preserved.
2883
2884# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2885# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
2886# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
2887#
2888# Of course, Automake must honor this variable whenever it calls a
2889# tool from the auxiliary directory.  The problem is that $srcdir (and
2890# therefore $ac_aux_dir as well) can be either absolute or relative,
2891# depending on how configure is run.  This is pretty annoying, since
2892# it makes $ac_aux_dir quite unusable in subdirectories: in the top
2893# source directory, any form will work fine, but in subdirectories a
2894# relative path needs to be adjusted first.
2895#
2896# $ac_aux_dir/missing
2897#    fails when called from a subdirectory if $ac_aux_dir is relative
2898# $top_srcdir/$ac_aux_dir/missing
2899#    fails if $ac_aux_dir is absolute,
2900#    fails when called from a subdirectory in a VPATH build with
2901#          a relative $ac_aux_dir
2902#
2903# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2904# are both prefixed by $srcdir.  In an in-source build this is usually
2905# harmless because $srcdir is `.', but things will broke when you
2906# start a VPATH build or use an absolute $srcdir.
2907#
2908# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2909# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2910#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2911# and then we would define $MISSING as
2912#   MISSING="\${SHELL} $am_aux_dir/missing"
2913# This will work as long as MISSING is not called from configure, because
2914# unfortunately $(top_srcdir) has no meaning in configure.
2915# However there are other variables, like CC, which are often used in
2916# configure, and could therefore not use this "fixed" $ac_aux_dir.
2917#
2918# Another solution, used here, is to always expand $ac_aux_dir to an
2919# absolute PATH.  The drawback is that using absolute paths prevent a
2920# configured tree to be moved without reconfiguration.
2921
2922AC_DEFUN([AM_AUX_DIR_EXPAND],
2923[dnl Rely on autoconf to set up CDPATH properly.
2924AC_PREREQ([2.50])dnl
2925# expand $ac_aux_dir to an absolute path
2926am_aux_dir=`cd $ac_aux_dir && pwd`
2927])
2928
2929# AM_CONDITIONAL                                            -*- Autoconf -*-
2930
2931# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
2932# Free Software Foundation, Inc.
2933#
2934# This file is free software; the Free Software Foundation
2935# gives unlimited permission to copy and/or distribute it,
2936# with or without modifications, as long as this notice is preserved.
2937
2938# serial 7
2939
2940# AM_CONDITIONAL(NAME, SHELL-CONDITION)
2941# -------------------------------------
2942# Define a conditional.
2943AC_DEFUN([AM_CONDITIONAL],
2944[AC_PREREQ(2.52)dnl
2945 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
2946	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
2947AC_SUBST([$1_TRUE])
2948AC_SUBST([$1_FALSE])
2949if $2; then
2950  $1_TRUE=
2951  $1_FALSE='#'
2952else
2953  $1_TRUE='#'
2954  $1_FALSE=
2955fi
2956AC_CONFIG_COMMANDS_PRE(
2957[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
2958  AC_MSG_ERROR([[conditional "$1" was never defined.
2959Usually this means the macro was only invoked conditionally.]])
2960fi])])
2961
2962
2963# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
2964# Free Software Foundation, Inc.
2965#
2966# This file is free software; the Free Software Foundation
2967# gives unlimited permission to copy and/or distribute it,
2968# with or without modifications, as long as this notice is preserved.
2969
2970# serial 8
2971
2972# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
2973# written in clear, in which case automake, when reading aclocal.m4,
2974# will think it sees a *use*, and therefore will trigger all it's
2975# C support machinery.  Also note that it means that autoscan, seeing
2976# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2977
2978
2979# _AM_DEPENDENCIES(NAME)
2980# ----------------------
2981# See how the compiler implements dependency checking.
2982# NAME is "CC", "CXX", "GCJ", or "OBJC".
2983# We try a few techniques and use that to set a single cache variable.
2984#
2985# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2986# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2987# dependency, and given that the user is not expected to run this macro,
2988# just rely on AC_PROG_CC.
2989AC_DEFUN([_AM_DEPENDENCIES],
2990[AC_REQUIRE([AM_SET_DEPDIR])dnl
2991AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2992AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2993AC_REQUIRE([AM_DEP_TRACK])dnl
2994
2995ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
2996       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
2997       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2998       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2999                   [depcc="$$1"   am_compiler_list=])
3000
3001AC_CACHE_CHECK([dependency style of $depcc],
3002               [am_cv_$1_dependencies_compiler_type],
3003[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
3004  # We make a subdir and do the tests there.  Otherwise we can end up
3005  # making bogus files that we don't know about and never remove.  For
3006  # instance it was reported that on HP-UX the gcc test will end up
3007  # making a dummy file named `D' -- because `-MD' means `put the output
3008  # in D'.
3009  mkdir conftest.dir
3010  # Copy depcomp to subdir because otherwise we won't find it if we're
3011  # using a relative directory.
3012  cp "$am_depcomp" conftest.dir
3013  cd conftest.dir
3014  # We will build objects and dependencies in a subdirectory because
3015  # it helps to detect inapplicable dependency modes.  For instance
3016  # both Tru64's cc and ICC support -MD to output dependencies as a
3017  # side effect of compilation, but ICC will put the dependencies in
3018  # the current directory while Tru64 will put them in the object
3019  # directory.
3020  mkdir sub
3021
3022  am_cv_$1_dependencies_compiler_type=none
3023  if test "$am_compiler_list" = ""; then
3024     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
3025  fi
3026  for depmode in $am_compiler_list; do
3027    # Setup a source with many dependencies, because some compilers
3028    # like to wrap large dependency lists on column 80 (with \), and
3029    # we should not choose a depcomp mode which is confused by this.
3030    #
3031    # We need to recreate these files for each test, as the compiler may
3032    # overwrite some of them when testing with obscure command lines.
3033    # This happens at least with the AIX C compiler.
3034    : > sub/conftest.c
3035    for i in 1 2 3 4 5 6; do
3036      echo '#include "conftst'$i'.h"' >> sub/conftest.c
3037      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
3038      # Solaris 8's {/usr,}/bin/sh.
3039      touch sub/conftst$i.h
3040    done
3041    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
3042
3043    case $depmode in
3044    nosideeffect)
3045      # after this tag, mechanisms are not by side-effect, so they'll
3046      # only be used when explicitly requested
3047      if test "x$enable_dependency_tracking" = xyes; then
3048	continue
3049      else
3050	break
3051      fi
3052      ;;
3053    none) break ;;
3054    esac
3055    # We check with `-c' and `-o' for the sake of the "dashmstdout"
3056    # mode.  It turns out that the SunPro C++ compiler does not properly
3057    # handle `-M -o', and we need to detect this.
3058    if depmode=$depmode \
3059       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
3060       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
3061       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
3062         >/dev/null 2>conftest.err &&
3063       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
3064       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
3065       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
3066      # icc doesn't choke on unknown options, it will just issue warnings
3067      # or remarks (even with -Werror).  So we grep stderr for any message
3068      # that says an option was ignored or not supported.
3069      # When given -MP, icc 7.0 and 7.1 complain thusly:
3070      #   icc: Command line warning: ignoring option '-M'; no argument required
3071      # The diagnosis changed in icc 8.0:
3072      #   icc: Command line remark: option '-MP' not supported
3073      if (grep 'ignoring option' conftest.err ||
3074          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
3075        am_cv_$1_dependencies_compiler_type=$depmode
3076        break
3077      fi
3078    fi
3079  done
3080
3081  cd ..
3082  rm -rf conftest.dir
3083else
3084  am_cv_$1_dependencies_compiler_type=none
3085fi
3086])
3087AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
3088AM_CONDITIONAL([am__fastdep$1], [
3089  test "x$enable_dependency_tracking" != xno \
3090  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
3091])
3092
3093
3094# AM_SET_DEPDIR
3095# -------------
3096# Choose a directory name for dependency files.
3097# This macro is AC_REQUIREd in _AM_DEPENDENCIES
3098AC_DEFUN([AM_SET_DEPDIR],
3099[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3100AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3101])
3102
3103
3104# AM_DEP_TRACK
3105# ------------
3106AC_DEFUN([AM_DEP_TRACK],
3107[AC_ARG_ENABLE(dependency-tracking,
3108[  --disable-dependency-tracking  speeds up one-time build
3109  --enable-dependency-tracking   do not reject slow dependency extractors])
3110if test "x$enable_dependency_tracking" != xno; then
3111  am_depcomp="$ac_aux_dir/depcomp"
3112  AMDEPBACKSLASH='\'
3113fi
3114AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3115AC_SUBST([AMDEPBACKSLASH])
3116])
3117
3118# Generate code to set up dependency tracking.              -*- Autoconf -*-
3119
3120# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
3121# Free Software Foundation, Inc.
3122#
3123# This file is free software; the Free Software Foundation
3124# gives unlimited permission to copy and/or distribute it,
3125# with or without modifications, as long as this notice is preserved.
3126
3127#serial 3
3128
3129# _AM_OUTPUT_DEPENDENCY_COMMANDS
3130# ------------------------------
3131AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3132[for mf in $CONFIG_FILES; do
3133  # Strip MF so we end up with the name of the file.
3134  mf=`echo "$mf" | sed -e 's/:.*$//'`
3135  # Check whether this is an Automake generated Makefile or not.
3136  # We used to match only the files named `Makefile.in', but
3137  # some people rename them; so instead we look at the file content.
3138  # Grep'ing the first line is not enough: some people post-process
3139  # each Makefile.in and add a new line on top of each file to say so.
3140  # So let's grep whole file.
3141  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
3142    dirpart=`AS_DIRNAME("$mf")`
3143  else
3144    continue
3145  fi
3146  # Extract the definition of DEPDIR, am__include, and am__quote
3147  # from the Makefile without running `make'.
3148  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3149  test -z "$DEPDIR" && continue
3150  am__include=`sed -n 's/^am__include = //p' < "$mf"`
3151  test -z "am__include" && continue
3152  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3153  # When using ansi2knr, U may be empty or an underscore; expand it
3154  U=`sed -n 's/^U = //p' < "$mf"`
3155  # Find all dependency output files, they are included files with
3156  # $(DEPDIR) in their names.  We invoke sed twice because it is the
3157  # simplest approach to changing $(DEPDIR) to its actual value in the
3158  # expansion.
3159  for file in `sed -n "
3160    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3161       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
3162    # Make sure the directory exists.
3163    test -f "$dirpart/$file" && continue
3164    fdir=`AS_DIRNAME(["$file"])`
3165    AS_MKDIR_P([$dirpart/$fdir])
3166    # echo "creating $dirpart/$file"
3167    echo '# dummy' > "$dirpart/$file"
3168  done
3169done
3170])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3171
3172
3173# AM_OUTPUT_DEPENDENCY_COMMANDS
3174# -----------------------------
3175# This macro should only be invoked once -- use via AC_REQUIRE.
3176#
3177# This code is only required when automatic dependency tracking
3178# is enabled.  FIXME.  This creates each `.P' file that we will
3179# need in order to bootstrap the dependency handling code.
3180AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3181[AC_CONFIG_COMMANDS([depfiles],
3182     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3183     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
3184])
3185
3186# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
3187# Free Software Foundation, Inc.
3188#
3189# This file is free software; the Free Software Foundation
3190# gives unlimited permission to copy and/or distribute it,
3191# with or without modifications, as long as this notice is preserved.
3192
3193# serial 8
3194
3195# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
3196AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
3197
3198# Do all the work for Automake.                             -*- Autoconf -*-
3199
3200# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
3201# Free Software Foundation, Inc.
3202#
3203# This file is free software; the Free Software Foundation
3204# gives unlimited permission to copy and/or distribute it,
3205# with or without modifications, as long as this notice is preserved.
3206
3207# serial 12
3208
3209# This macro actually does too much.  Some checks are only needed if
3210# your package does certain things.  But this isn't really a big deal.
3211
3212# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
3213# AM_INIT_AUTOMAKE([OPTIONS])
3214# -----------------------------------------------
3215# The call with PACKAGE and VERSION arguments is the old style
3216# call (pre autoconf-2.50), which is being phased out.  PACKAGE
3217# and VERSION should now be passed to AC_INIT and removed from
3218# the call to AM_INIT_AUTOMAKE.
3219# We support both call styles for the transition.  After
3220# the next Automake release, Autoconf can make the AC_INIT
3221# arguments mandatory, and then we can depend on a new Autoconf
3222# release and drop the old call support.
3223AC_DEFUN([AM_INIT_AUTOMAKE],
3224[AC_PREREQ([2.58])dnl
3225dnl Autoconf wants to disallow AM_ names.  We explicitly allow
3226dnl the ones we care about.
3227m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
3228AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
3229AC_REQUIRE([AC_PROG_INSTALL])dnl
3230# test to see if srcdir already configured
3231if test "`cd $srcdir && pwd`" != "`pwd`" &&
3232   test -f $srcdir/config.status; then
3233  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
3234fi
3235
3236# test whether we have cygpath
3237if test -z "$CYGPATH_W"; then
3238  if (cygpath --version) >/dev/null 2>/dev/null; then
3239    CYGPATH_W='cygpath -w'
3240  else
3241    CYGPATH_W=echo
3242  fi
3243fi
3244AC_SUBST([CYGPATH_W])
3245
3246# Define the identity of the package.
3247dnl Distinguish between old-style and new-style calls.
3248m4_ifval([$2],
3249[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
3250 AC_SUBST([PACKAGE], [$1])dnl
3251 AC_SUBST([VERSION], [$2])],
3252[_AM_SET_OPTIONS([$1])dnl
3253 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
3254 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
3255
3256_AM_IF_OPTION([no-define],,
3257[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
3258 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
3259
3260# Some tools Automake needs.
3261AC_REQUIRE([AM_SANITY_CHECK])dnl
3262AC_REQUIRE([AC_ARG_PROGRAM])dnl
3263AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
3264AM_MISSING_PROG(AUTOCONF, autoconf)
3265AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
3266AM_MISSING_PROG(AUTOHEADER, autoheader)
3267AM_MISSING_PROG(MAKEINFO, makeinfo)
3268AM_PROG_INSTALL_SH
3269AM_PROG_INSTALL_STRIP
3270AC_REQUIRE([AM_PROG_MKDIR_P])dnl
3271# We need awk for the "check" target.  The system "awk" is bad on
3272# some platforms.
3273AC_REQUIRE([AC_PROG_AWK])dnl
3274AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3275AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3276_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
3277              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
3278	      		     [_AM_PROG_TAR([v7])])])
3279_AM_IF_OPTION([no-dependencies],,
3280[AC_PROVIDE_IFELSE([AC_PROG_CC],
3281                  [_AM_DEPENDENCIES(CC)],
3282                  [define([AC_PROG_CC],
3283                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
3284AC_PROVIDE_IFELSE([AC_PROG_CXX],
3285                  [_AM_DEPENDENCIES(CXX)],
3286                  [define([AC_PROG_CXX],
3287                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
3288])
3289])
3290
3291
3292# When config.status generates a header, we must update the stamp-h file.
3293# This file resides in the same directory as the config header
3294# that is generated.  The stamp files are numbered to have different names.
3295
3296# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
3297# loop where config.status creates the headers, so we can generate
3298# our stamp files there.
3299AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
3300[# Compute $1's index in $config_headers.
3301_am_stamp_count=1
3302for _am_header in $config_headers :; do
3303  case $_am_header in
3304    $1 | $1:* )
3305      break ;;
3306    * )
3307      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
3308  esac
3309done
3310echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
3311
3312# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
3313#
3314# This file is free software; the Free Software Foundation
3315# gives unlimited permission to copy and/or distribute it,
3316# with or without modifications, as long as this notice is preserved.
3317
3318# AM_PROG_INSTALL_SH
3319# ------------------
3320# Define $install_sh.
3321AC_DEFUN([AM_PROG_INSTALL_SH],
3322[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3323install_sh=${install_sh-"$am_aux_dir/install-sh"}
3324AC_SUBST(install_sh)])
3325
3326# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
3327#
3328# This file is free software; the Free Software Foundation
3329# gives unlimited permission to copy and/or distribute it,
3330# with or without modifications, as long as this notice is preserved.
3331
3332# serial 2
3333
3334# Check whether the underlying file-system supports filenames
3335# with a leading dot.  For instance MS-DOS doesn't.
3336AC_DEFUN([AM_SET_LEADING_DOT],
3337[rm -rf .tst 2>/dev/null
3338mkdir .tst 2>/dev/null
3339if test -d .tst; then
3340  am__leading_dot=.
3341else
3342  am__leading_dot=_
3343fi
3344rmdir .tst 2>/dev/null
3345AC_SUBST([am__leading_dot])])
3346
3347# Check to see how 'make' treats includes.	            -*- Autoconf -*-
3348
3349# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
3350#
3351# This file is free software; the Free Software Foundation
3352# gives unlimited permission to copy and/or distribute it,
3353# with or without modifications, as long as this notice is preserved.
3354
3355# serial 3
3356
3357# AM_MAKE_INCLUDE()
3358# -----------------
3359# Check to see how make treats includes.
3360AC_DEFUN([AM_MAKE_INCLUDE],
3361[am_make=${MAKE-make}
3362cat > confinc << 'END'
3363am__doit:
3364	@echo done
3365.PHONY: am__doit
3366END
3367# If we don't find an include directive, just comment out the code.
3368AC_MSG_CHECKING([for style of include used by $am_make])
3369am__include="#"
3370am__quote=
3371_am_result=none
3372# First try GNU make style include.
3373echo "include confinc" > confmf
3374# We grep out `Entering directory' and `Leaving directory'
3375# messages which can occur if `w' ends up in MAKEFLAGS.
3376# In particular we don't look at `^make:' because GNU make might
3377# be invoked under some other name (usually "gmake"), in which
3378# case it prints its new name instead of `make'.
3379if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
3380   am__include=include
3381   am__quote=
3382   _am_result=GNU
3383fi
3384# Now try BSD make style include.
3385if test "$am__include" = "#"; then
3386   echo '.include "confinc"' > confmf
3387   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
3388      am__include=.include
3389      am__quote="\""
3390      _am_result=BSD
3391   fi
3392fi
3393AC_SUBST([am__include])
3394AC_SUBST([am__quote])
3395AC_MSG_RESULT([$_am_result])
3396rm -f confinc confmf
3397])
3398
3399# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
3400
3401# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
3402# Free Software Foundation, Inc.
3403#
3404# This file is free software; the Free Software Foundation
3405# gives unlimited permission to copy and/or distribute it,
3406# with or without modifications, as long as this notice is preserved.
3407
3408# serial 4
3409
3410# AM_MISSING_PROG(NAME, PROGRAM)
3411# ------------------------------
3412AC_DEFUN([AM_MISSING_PROG],
3413[AC_REQUIRE([AM_MISSING_HAS_RUN])
3414$1=${$1-"${am_missing_run}$2"}
3415AC_SUBST($1)])
3416
3417
3418# AM_MISSING_HAS_RUN
3419# ------------------
3420# Define MISSING if not defined so far and test if it supports --run.
3421# If it does, set am_missing_run to use it, otherwise, to nothing.
3422AC_DEFUN([AM_MISSING_HAS_RUN],
3423[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
3424test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
3425# Use eval to expand $SHELL
3426if eval "$MISSING --run true"; then
3427  am_missing_run="$MISSING --run "
3428else
3429  am_missing_run=
3430  AC_MSG_WARN([`missing' script is too old or missing])
3431fi
3432])
3433
3434# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
3435#
3436# This file is free software; the Free Software Foundation
3437# gives unlimited permission to copy and/or distribute it,
3438# with or without modifications, as long as this notice is preserved.
3439
3440# AM_PROG_MKDIR_P
3441# ---------------
3442# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
3443#
3444# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
3445# created by `make install' are always world readable, even if the
3446# installer happens to have an overly restrictive umask (e.g. 077).
3447# This was a mistake.  There are at least two reasons why we must not
3448# use `-m 0755':
3449#   - it causes special bits like SGID to be ignored,
3450#   - it may be too restrictive (some setups expect 775 directories).
3451#
3452# Do not use -m 0755 and let people choose whatever they expect by
3453# setting umask.
3454#
3455# We cannot accept any implementation of `mkdir' that recognizes `-p'.
3456# Some implementations (such as Solaris 8's) are not thread-safe: if a
3457# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
3458# concurrently, both version can detect that a/ is missing, but only
3459# one can create it and the other will error out.  Consequently we
3460# restrict ourselves to GNU make (using the --version option ensures
3461# this.)
3462AC_DEFUN([AM_PROG_MKDIR_P],
3463[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
3464  # We used to keeping the `.' as first argument, in order to
3465  # allow $(mkdir_p) to be used without argument.  As in
3466  #   $(mkdir_p) $(somedir)
3467  # where $(somedir) is conditionally defined.  However this is wrong
3468  # for two reasons:
3469  #  1. if the package is installed by a user who cannot write `.'
3470  #     make install will fail,
3471  #  2. the above comment should most certainly read
3472  #     $(mkdir_p) $(DESTDIR)$(somedir)
3473  #     so it does not work when $(somedir) is undefined and
3474  #     $(DESTDIR) is not.
3475  #  To support the latter case, we have to write
3476  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
3477  #  so the `.' trick is pointless.
3478  mkdir_p='mkdir -p --'
3479else
3480  # On NextStep and OpenStep, the `mkdir' command does not
3481  # recognize any option.  It will interpret all options as
3482  # directories to create, and then abort because `.' already
3483  # exists.
3484  for d in ./-p ./--version;
3485  do
3486    test -d $d && rmdir $d
3487  done
3488  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
3489  if test -f "$ac_aux_dir/mkinstalldirs"; then
3490    mkdir_p='$(mkinstalldirs)'
3491  else
3492    mkdir_p='$(install_sh) -d'
3493  fi
3494fi
3495AC_SUBST([mkdir_p])])
3496
3497# Helper functions for option handling.                     -*- Autoconf -*-
3498
3499# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
3500#
3501# This file is free software; the Free Software Foundation
3502# gives unlimited permission to copy and/or distribute it,
3503# with or without modifications, as long as this notice is preserved.
3504
3505# serial 3
3506
3507# _AM_MANGLE_OPTION(NAME)
3508# -----------------------
3509AC_DEFUN([_AM_MANGLE_OPTION],
3510[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
3511
3512# _AM_SET_OPTION(NAME)
3513# ------------------------------
3514# Set option NAME.  Presently that only means defining a flag for this option.
3515AC_DEFUN([_AM_SET_OPTION],
3516[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
3517
3518# _AM_SET_OPTIONS(OPTIONS)
3519# ----------------------------------
3520# OPTIONS is a space-separated list of Automake options.
3521AC_DEFUN([_AM_SET_OPTIONS],
3522[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
3523
3524# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
3525# -------------------------------------------
3526# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
3527AC_DEFUN([_AM_IF_OPTION],
3528[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
3529
3530# Check to make sure that the build environment is sane.    -*- Autoconf -*-
3531
3532# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
3533# Free Software Foundation, Inc.
3534#
3535# This file is free software; the Free Software Foundation
3536# gives unlimited permission to copy and/or distribute it,
3537# with or without modifications, as long as this notice is preserved.
3538
3539# serial 4
3540
3541# AM_SANITY_CHECK
3542# ---------------
3543AC_DEFUN([AM_SANITY_CHECK],
3544[AC_MSG_CHECKING([whether build environment is sane])
3545# Just in case
3546sleep 1
3547echo timestamp > conftest.file
3548# Do `set' in a subshell so we don't clobber the current shell's
3549# arguments.  Must try -L first in case configure is actually a
3550# symlink; some systems play weird games with the mod time of symlinks
3551# (eg FreeBSD returns the mod time of the symlink's containing
3552# directory).
3553if (
3554   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
3555   if test "$[*]" = "X"; then
3556      # -L didn't work.
3557      set X `ls -t $srcdir/configure conftest.file`
3558   fi
3559   rm -f conftest.file
3560   if test "$[*]" != "X $srcdir/configure conftest.file" \
3561      && test "$[*]" != "X conftest.file $srcdir/configure"; then
3562
3563      # If neither matched, then we have a broken ls.  This can happen
3564      # if, for instance, CONFIG_SHELL is bash and it inherits a
3565      # broken ls alias from the environment.  This has actually
3566      # happened.  Such a system could not be considered "sane".
3567      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
3568alias in your environment])
3569   fi
3570
3571   test "$[2]" = conftest.file
3572   )
3573then
3574   # Ok.
3575   :
3576else
3577   AC_MSG_ERROR([newly created file is older than distributed files!
3578Check your system clock])
3579fi
3580AC_MSG_RESULT(yes)])
3581
3582# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
3583#
3584# This file is free software; the Free Software Foundation
3585# gives unlimited permission to copy and/or distribute it,
3586# with or without modifications, as long as this notice is preserved.
3587
3588# AM_PROG_INSTALL_STRIP
3589# ---------------------
3590# One issue with vendor `install' (even GNU) is that you can't
3591# specify the program used to strip binaries.  This is especially
3592# annoying in cross-compiling environments, where the build's strip
3593# is unlikely to handle the host's binaries.
3594# Fortunately install-sh will honor a STRIPPROG variable, so we
3595# always use install-sh in `make install-strip', and initialize
3596# STRIPPROG with the value of the STRIP variable (set by the user).
3597AC_DEFUN([AM_PROG_INSTALL_STRIP],
3598[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
3599# Installed binaries are usually stripped using `strip' when the user
3600# run `make install-strip'.  However `strip' might not be the right
3601# tool to use in cross-compilation environments, therefore Automake
3602# will honor the `STRIP' environment variable to overrule this program.
3603dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
3604if test "$cross_compiling" != no; then
3605  AC_CHECK_TOOL([STRIP], [strip], :)
3606fi
3607INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
3608AC_SUBST([INSTALL_STRIP_PROGRAM])])
3609
3610# Check how to create a tarball.                            -*- Autoconf -*-
3611
3612# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
3613#
3614# This file is free software; the Free Software Foundation
3615# gives unlimited permission to copy and/or distribute it,
3616# with or without modifications, as long as this notice is preserved.
3617
3618# serial 2
3619
3620# _AM_PROG_TAR(FORMAT)
3621# --------------------
3622# Check how to create a tarball in format FORMAT.
3623# FORMAT should be one of `v7', `ustar', or `pax'.
3624#
3625# Substitute a variable $(am__tar) that is a command
3626# writing to stdout a FORMAT-tarball containing the directory
3627# $tardir.
3628#     tardir=directory && $(am__tar) > result.tar
3629#
3630# Substitute a variable $(am__untar) that extract such
3631# a tarball read from stdin.
3632#     $(am__untar) < result.tar
3633AC_DEFUN([_AM_PROG_TAR],
3634[# Always define AMTAR for backward compatibility.
3635AM_MISSING_PROG([AMTAR], [tar])
3636m4_if([$1], [v7],
3637     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
3638     [m4_case([$1], [ustar],, [pax],,
3639              [m4_fatal([Unknown tar format])])
3640AC_MSG_CHECKING([how to create a $1 tar archive])
3641# Loop over all known methods to create a tar archive until one works.
3642_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
3643_am_tools=${am_cv_prog_tar_$1-$_am_tools}
3644# Do not fold the above two line into one, because Tru64 sh and
3645# Solaris sh will not grok spaces in the rhs of `-'.
3646for _am_tool in $_am_tools
3647do
3648  case $_am_tool in
3649  gnutar)
3650    for _am_tar in tar gnutar gtar;
3651    do
3652      AM_RUN_LOG([$_am_tar --version]) && break
3653    done
3654    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
3655    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
3656    am__untar="$_am_tar -xf -"
3657    ;;
3658  plaintar)
3659    # Must skip GNU tar: if it does not support --format= it doesn't create
3660    # ustar tarball either.
3661    (tar --version) >/dev/null 2>&1 && continue
3662    am__tar='tar chf - "$$tardir"'
3663    am__tar_='tar chf - "$tardir"'
3664    am__untar='tar xf -'
3665    ;;
3666  pax)
3667    am__tar='pax -L -x $1 -w "$$tardir"'
3668    am__tar_='pax -L -x $1 -w "$tardir"'
3669    am__untar='pax -r'
3670    ;;
3671  cpio)
3672    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
3673    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
3674    am__untar='cpio -i -H $1 -d'
3675    ;;
3676  none)
3677    am__tar=false
3678    am__tar_=false
3679    am__untar=false
3680    ;;
3681  esac
3682
3683  # If the value was cached, stop now.  We just wanted to have am__tar
3684  # and am__untar set.
3685  test -n "${am_cv_prog_tar_$1}" && break
3686
3687  # tar/untar a dummy directory, and stop if the command works
3688  rm -rf conftest.dir
3689  mkdir conftest.dir
3690  echo GrepMe > conftest.dir/file
3691  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
3692  rm -rf conftest.dir
3693  if test -s conftest.tar; then
3694    AM_RUN_LOG([$am__untar <conftest.tar])
3695    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
3696  fi
3697done
3698rm -rf conftest.dir
3699
3700AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
3701AC_MSG_RESULT([$am_cv_prog_tar_$1])])
3702AC_SUBST([am__tar])
3703AC_SUBST([am__untar])
3704]) # _AM_PROG_TAR
3705
3706