1# codeset.m4 serial AM1 (gettext-0.10.40)
2dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3dnl This file is free software, distributed under the terms of the GNU
4dnl General Public License.  As a special exception to the GNU General
5dnl Public License, this file may be distributed as part of a program
6dnl that contains a configuration script generated by Autoconf, under
7dnl the same distribution terms as the rest of that program.
8
9dnl From Bruno Haible.
10
11AC_DEFUN([AM_LANGINFO_CODESET],
12[
13  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
14    [AC_TRY_LINK([#include <langinfo.h>],
15      [char* cs = nl_langinfo(CODESET);],
16      am_cv_langinfo_codeset=yes,
17      am_cv_langinfo_codeset=no)
18    ])
19  if test $am_cv_langinfo_codeset = yes; then
20    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
21      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
22  fi
23])
24# gettext.m4 serial 28 (gettext-0.13)
25dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
26dnl This file is free software, distributed under the terms of the GNU
27dnl General Public License.  As a special exception to the GNU General
28dnl Public License, this file may be distributed as part of a program
29dnl that contains a configuration script generated by Autoconf, under
30dnl the same distribution terms as the rest of that program.
31dnl
32dnl This file can can be used in projects which are not available under
33dnl the GNU General Public License or the GNU Library General Public
34dnl License but which still want to provide support for the GNU gettext
35dnl functionality.
36dnl Please note that the actual code of the GNU gettext library is covered
37dnl by the GNU Library General Public License, and the rest of the GNU
38dnl gettext package package is covered by the GNU General Public License.
39dnl They are *not* in the public domain.
40
41dnl Authors:
42dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
43dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
44
45dnl Macro to add for using GNU gettext.
46
47dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
48dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
49dnl    default (if it is not specified or empty) is 'no-libtool'.
50dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
51dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
52dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
53dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
54dnl    depending on --{enable,disable}-{shared,static} and on the presence of
55dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
56dnl    $(top_builddir)/intl/libintl.a will be created.
57dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
58dnl    implementations (in libc or libintl) without the ngettext() function
59dnl    will be ignored.  If NEEDSYMBOL is specified and is
60dnl    'need-formatstring-macros', then GNU gettext implementations that don't
61dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
62dnl INTLDIR is used to find the intl libraries.  If empty,
63dnl    the value `$(top_builddir)/intl/' is used.
64dnl
65dnl The result of the configuration is one of three cases:
66dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
67dnl    and used.
68dnl    Catalog format: GNU --> install in $(datadir)
69dnl    Catalog extension: .mo after installation, .gmo in source tree
70dnl 2) GNU gettext has been found in the system's C library.
71dnl    Catalog format: GNU --> install in $(datadir)
72dnl    Catalog extension: .mo after installation, .gmo in source tree
73dnl 3) No internationalization, always use English msgid.
74dnl    Catalog format: none
75dnl    Catalog extension: none
76dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
77dnl The use of .gmo is historical (it was needed to avoid overwriting the
78dnl GNU format catalogs when building on a platform with an X/Open gettext),
79dnl but we keep it in order not to force irrelevant filename changes on the
80dnl maintainers.
81dnl
82AC_DEFUN([AM_GNU_GETTEXT],
83[
84  dnl Argument checking.
85  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
86    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
87])])])])])
88  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
89    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
90])])])])
91  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
92  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
93
94  AC_REQUIRE([AM_PO_SUBDIRS])dnl
95  ifelse(gt_included_intl, yes, [
96    AC_REQUIRE([AM_INTL_SUBDIR])dnl
97  ])
98
99  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
100  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
101  AC_REQUIRE([AC_LIB_RPATH])
102
103  dnl Sometimes libintl requires libiconv, so first search for libiconv.
104  dnl Ideally we would do this search only after the
105  dnl      if test "$USE_NLS" = "yes"; then
106  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
107  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
108  dnl the configure script would need to contain the same shell code
109  dnl again, outside any 'if'. There are two solutions:
110  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
111  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
112  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
113  dnl documented, we avoid it.
114  ifelse(gt_included_intl, yes, , [
115    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
116  ])
117
118  dnl Set USE_NLS.
119  AM_NLS
120
121  ifelse(gt_included_intl, yes, [
122    BUILD_INCLUDED_LIBINTL=no
123    USE_INCLUDED_LIBINTL=no
124  ])
125  LIBINTL=
126  LTLIBINTL=
127  POSUB=
128
129  dnl If we use NLS figure out what method
130  if test "$USE_NLS" = "yes"; then
131    gt_use_preinstalled_gnugettext=no
132    ifelse(gt_included_intl, yes, [
133      AC_MSG_CHECKING([whether included gettext is requested])
134      AC_ARG_WITH(included-gettext,
135        [  --with-included-gettext use the GNU gettext library included here],
136        nls_cv_force_use_gnu_gettext=$withval,
137        nls_cv_force_use_gnu_gettext=no)
138      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
139
140      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
141      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
142    ])
143        dnl User does not insist on using GNU NLS library.  Figure out what
144        dnl to use.  If GNU gettext is available we use this.  Else we have
145        dnl to fall back to GNU NLS library.
146
147        dnl Add a version number to the cache macros.
148        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
149        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
150        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
151
152        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
153         [AC_TRY_LINK([#include <libintl.h>
154]ifelse([$2], [need-formatstring-macros],
155[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
156#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
157#endif
158changequote(,)dnl
159typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
160changequote([,])dnl
161], [])[extern int _nl_msg_cat_cntr;
162extern int *_nl_domain_bindings;],
163            [bindtextdomain ("", "");
164return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
165            gt_cv_func_gnugettext_libc=yes,
166            gt_cv_func_gnugettext_libc=no)])
167
168        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
169          dnl Sometimes libintl requires libiconv, so first search for libiconv.
170          ifelse(gt_included_intl, yes, , [
171            AM_ICONV_LINK
172          ])
173          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
174          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
175          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
176          dnl even if libiconv doesn't exist.
177          AC_LIB_LINKFLAGS_BODY([intl])
178          AC_CACHE_CHECK([for GNU gettext in libintl],
179            gt_cv_func_gnugettext_libintl,
180           [gt_save_CPPFLAGS="$CPPFLAGS"
181            CPPFLAGS="$CPPFLAGS $INCINTL"
182            gt_save_LIBS="$LIBS"
183            LIBS="$LIBS $LIBINTL"
184            dnl Now see whether libintl exists and does not depend on libiconv.
185            AC_TRY_LINK([#include <libintl.h>
186]ifelse([$2], [need-formatstring-macros],
187[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
188#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
189#endif
190changequote(,)dnl
191typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
192changequote([,])dnl
193], [])[extern int _nl_msg_cat_cntr;
194extern
195#ifdef __cplusplus
196"C"
197#endif
198const char *_nl_expand_alias ();],
199              [bindtextdomain ("", "");
200return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
201              gt_cv_func_gnugettext_libintl=yes,
202              gt_cv_func_gnugettext_libintl=no)
203            dnl Now see whether libintl exists and depends on libiconv.
204            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
205              LIBS="$LIBS $LIBICONV"
206              AC_TRY_LINK([#include <libintl.h>
207]ifelse([$2], [need-formatstring-macros],
208[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
209#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
210#endif
211changequote(,)dnl
212typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
213changequote([,])dnl
214], [])[extern int _nl_msg_cat_cntr;
215extern
216#ifdef __cplusplus
217"C"
218#endif
219const char *_nl_expand_alias ();],
220                [bindtextdomain ("", "");
221return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
222               [LIBINTL="$LIBINTL $LIBICONV"
223                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
224                gt_cv_func_gnugettext_libintl=yes
225               ])
226            fi
227            CPPFLAGS="$gt_save_CPPFLAGS"
228            LIBS="$gt_save_LIBS"])
229        fi
230
231        dnl If an already present or preinstalled GNU gettext() is found,
232        dnl use it.  But if this macro is used in GNU gettext, and GNU
233        dnl gettext is already preinstalled in libintl, we update this
234        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
235        if test "$gt_cv_func_gnugettext_libc" = "yes" \
236           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
237                && test "$PACKAGE" != gettext-runtime \
238                && test "$PACKAGE" != gettext-tools; }; then
239          gt_use_preinstalled_gnugettext=yes
240        else
241          dnl Reset the values set by searching for libintl.
242          LIBINTL=
243          LTLIBINTL=
244          INCINTL=
245        fi
246
247    ifelse(gt_included_intl, yes, [
248        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
249          dnl GNU gettext is not found in the C library.
250          dnl Fall back on included GNU gettext library.
251          nls_cv_use_gnu_gettext=yes
252        fi
253      fi
254
255      if test "$nls_cv_use_gnu_gettext" = "yes"; then
256        dnl Mark actions used to generate GNU NLS library.
257        BUILD_INCLUDED_LIBINTL=yes
258        USE_INCLUDED_LIBINTL=yes
259        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
260        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
261        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
262      fi
263
264      if test "$gt_use_preinstalled_gnugettext" = "yes" \
265         || test "$nls_cv_use_gnu_gettext" = "yes"; then
266        dnl Mark actions to use GNU gettext tools.
267        CATOBJEXT=.gmo
268      fi
269    ])
270
271    if test "$gt_use_preinstalled_gnugettext" = "yes" \
272       || test "$nls_cv_use_gnu_gettext" = "yes"; then
273      AC_DEFINE(ENABLE_NLS, 1,
274        [Define to 1 if translation of program messages to the user's native language
275   is requested.])
276    else
277      USE_NLS=no
278    fi
279  fi
280
281  AC_MSG_CHECKING([whether to use NLS])
282  AC_MSG_RESULT([$USE_NLS])
283  if test "$USE_NLS" = "yes"; then
284    AC_MSG_CHECKING([where the gettext function comes from])
285    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
286      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
287        gt_source="external libintl"
288      else
289        gt_source="libc"
290      fi
291    else
292      gt_source="included intl directory"
293    fi
294    AC_MSG_RESULT([$gt_source])
295  fi
296
297  if test "$USE_NLS" = "yes"; then
298
299    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
300      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
301        AC_MSG_CHECKING([how to link with libintl])
302        AC_MSG_RESULT([$LIBINTL])
303        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
304      fi
305
306      dnl For backward compatibility. Some packages may be using this.
307      AC_DEFINE(HAVE_GETTEXT, 1,
308       [Define if the GNU gettext() function is already present or preinstalled.])
309      AC_DEFINE(HAVE_DCGETTEXT, 1,
310       [Define if the GNU dcgettext() function is already present or preinstalled.])
311    fi
312
313    dnl We need to process the po/ directory.
314    POSUB=po
315  fi
316
317  ifelse(gt_included_intl, yes, [
318    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
319    dnl to 'yes' because some of the testsuite requires it.
320    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
321      BUILD_INCLUDED_LIBINTL=yes
322    fi
323
324    dnl Make all variables we use known to autoconf.
325    AC_SUBST(BUILD_INCLUDED_LIBINTL)
326    AC_SUBST(USE_INCLUDED_LIBINTL)
327    AC_SUBST(CATOBJEXT)
328
329    dnl For backward compatibility. Some configure.ins may be using this.
330    nls_cv_header_intl=
331    nls_cv_header_libgt=
332
333    dnl For backward compatibility. Some Makefiles may be using this.
334    DATADIRNAME=share
335    AC_SUBST(DATADIRNAME)
336
337    dnl For backward compatibility. Some Makefiles may be using this.
338    INSTOBJEXT=.mo
339    AC_SUBST(INSTOBJEXT)
340
341    dnl For backward compatibility. Some Makefiles may be using this.
342    GENCAT=gencat
343    AC_SUBST(GENCAT)
344
345    dnl For backward compatibility. Some Makefiles may be using this.
346    if test "$USE_INCLUDED_LIBINTL" = yes; then
347      INTLOBJS="\$(GETTOBJS)"
348    fi
349    AC_SUBST(INTLOBJS)
350
351    dnl Enable libtool support if the surrounding package wishes it.
352    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
353    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
354  ])
355
356  dnl For backward compatibility. Some Makefiles may be using this.
357  INTLLIBS="$LIBINTL"
358  AC_SUBST(INTLLIBS)
359
360  dnl Make all documented variables known to autoconf.
361  AC_SUBST(LIBINTL)
362  AC_SUBST(LTLIBINTL)
363  AC_SUBST(POSUB)
364])
365
366
367dnl Checks for all prerequisites of the intl subdirectory,
368dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
369dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
370AC_DEFUN([AM_INTL_SUBDIR],
371[
372  AC_REQUIRE([AC_PROG_INSTALL])dnl
373  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
374  AC_REQUIRE([AC_PROG_CC])dnl
375  AC_REQUIRE([AC_CANONICAL_HOST])dnl
376  AC_REQUIRE([AC_PROG_RANLIB])dnl
377  AC_REQUIRE([AC_ISC_POSIX])dnl
378  AC_REQUIRE([AC_HEADER_STDC])dnl
379  AC_REQUIRE([AC_C_CONST])dnl
380  AC_REQUIRE([bh_C_SIGNED])dnl
381  AC_REQUIRE([AC_C_INLINE])dnl
382  AC_REQUIRE([AC_TYPE_OFF_T])dnl
383  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
384  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
385  AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
386  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
387  AC_REQUIRE([gt_TYPE_WINT_T])dnl
388  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
389  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
390  AC_REQUIRE([gt_TYPE_INTMAX_T])
391  AC_REQUIRE([gt_PRINTF_POSIX])
392  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
393  AC_REQUIRE([AC_FUNC_MMAP])dnl
394  AC_REQUIRE([jm_GLIBC21])dnl
395  AC_REQUIRE([gt_INTDIV0])dnl
396  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
397  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
398  AC_REQUIRE([gt_INTTYPES_PRI])dnl
399  AC_REQUIRE([gl_XSIZE])dnl
400
401  AC_CHECK_TYPE([ptrdiff_t], ,
402    [AC_DEFINE([ptrdiff_t], [long],
403       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
404    ])
405  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
406stdlib.h string.h unistd.h sys/param.h])
407  AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
408mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
409strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
410__fsetlocking])
411
412  dnl Use the _snprintf function only if it is declared (because on NetBSD it
413  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
414  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
415  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
416
417  dnl Use the *_unlocked functions only if they are declared.
418  dnl (because some of them were defined without being declared in Solaris
419  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
420  dnl on Solaris 2.5.1 to run on Solaris 2.6).
421  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
422  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
423  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
424  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
425
426  case $gt_cv_func_printf_posix in
427    *yes) HAVE_POSIX_PRINTF=1 ;;
428    *) HAVE_POSIX_PRINTF=0 ;;
429  esac
430  AC_SUBST([HAVE_POSIX_PRINTF])
431  if test "$ac_cv_func_asprintf" = yes; then
432    HAVE_ASPRINTF=1
433  else
434    HAVE_ASPRINTF=0
435  fi
436  AC_SUBST([HAVE_ASPRINTF])
437  if test "$ac_cv_func_snprintf" = yes; then
438    HAVE_SNPRINTF=1
439  else
440    HAVE_SNPRINTF=0
441  fi
442  AC_SUBST([HAVE_SNPRINTF])
443  if test "$ac_cv_func_wprintf" = yes; then
444    HAVE_WPRINTF=1
445  else
446    HAVE_WPRINTF=0
447  fi
448  AC_SUBST([HAVE_WPRINTF])
449
450  AM_ICONV
451  AM_LANGINFO_CODESET
452  if test $ac_cv_header_locale_h = yes; then
453    AM_LC_MESSAGES
454  fi
455
456  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
457  dnl because plural.y uses bison specific features. It requires at least
458  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
459  dnl compile.
460  dnl bison is only needed for the maintainer (who touches plural.y). But in
461  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
462  dnl the rule in general Makefile. Now, some people carelessly touch the
463  dnl files or have a broken "make" program, hence the plural.c rule will
464  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
465  dnl present or too old.
466  AC_CHECK_PROGS([INTLBISON], [bison])
467  if test -z "$INTLBISON"; then
468    ac_verc_fail=yes
469  else
470    dnl Found it, now check the version.
471    AC_MSG_CHECKING([version of bison])
472changequote(<<,>>)dnl
473    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
474    case $ac_prog_version in
475      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
476      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
477changequote([,])dnl
478         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
479      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
480    esac
481    AC_MSG_RESULT([$ac_prog_version])
482  fi
483  if test $ac_verc_fail = yes; then
484    INTLBISON=:
485  fi
486])
487
488
489dnl gt_CHECK_DECL(FUNC, INCLUDES)
490dnl Check whether a function is declared.
491AC_DEFUN([gt_CHECK_DECL],
492[
493  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
494    [AC_TRY_COMPILE([$2], [
495#ifndef $1
496  char *p = (char *) $1;
497#endif
498], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
499  if test $ac_cv_have_decl_$1 = yes; then
500    gt_value=1
501  else
502    gt_value=0
503  fi
504  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
505    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
506])
507
508
509dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
510AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
511# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
512dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
513dnl This file is free software, distributed under the terms of the GNU
514dnl General Public License.  As a special exception to the GNU General
515dnl Public License, this file may be distributed as part of a program
516dnl that contains a configuration script generated by Autoconf, under
517dnl the same distribution terms as the rest of that program.
518
519# Test for the GNU C Library, version 2.1 or newer.
520# From Bruno Haible.
521
522AC_DEFUN([jm_GLIBC21],
523  [
524    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
525      ac_cv_gnu_library_2_1,
526      [AC_EGREP_CPP([Lucky GNU user],
527	[
528#include <features.h>
529#ifdef __GNU_LIBRARY__
530 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
531  Lucky GNU user
532 #endif
533#endif
534	],
535	ac_cv_gnu_library_2_1=yes,
536	ac_cv_gnu_library_2_1=no)
537      ]
538    )
539    AC_SUBST(GLIBC21)
540    GLIBC21="$ac_cv_gnu_library_2_1"
541  ]
542)
543# iconv.m4 serial AM4 (gettext-0.11.3)
544dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
545dnl This file is free software, distributed under the terms of the GNU
546dnl General Public License.  As a special exception to the GNU General
547dnl Public License, this file may be distributed as part of a program
548dnl that contains a configuration script generated by Autoconf, under
549dnl the same distribution terms as the rest of that program.
550
551dnl From Bruno Haible.
552
553AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
554[
555  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
556  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
557  AC_REQUIRE([AC_LIB_RPATH])
558
559  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
560  dnl accordingly.
561  AC_LIB_LINKFLAGS_BODY([iconv])
562])
563
564AC_DEFUN([AM_ICONV_LINK],
565[
566  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
567  dnl those with the standalone portable GNU libiconv installed).
568
569  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
570  dnl accordingly.
571  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
572
573  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
574  dnl because if the user has installed libiconv and not disabled its use
575  dnl via --without-libiconv-prefix, he wants to use it. The first
576  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
577  am_save_CPPFLAGS="$CPPFLAGS"
578  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
579
580  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
581    am_cv_func_iconv="no, consider installing GNU libiconv"
582    am_cv_lib_iconv=no
583    AC_TRY_LINK([#include <stdlib.h>
584#include <iconv.h>],
585      [iconv_t cd = iconv_open("","");
586       iconv(cd,NULL,NULL,NULL,NULL);
587       iconv_close(cd);],
588      am_cv_func_iconv=yes)
589    if test "$am_cv_func_iconv" != yes; then
590      am_save_LIBS="$LIBS"
591      LIBS="$LIBS $LIBICONV"
592      AC_TRY_LINK([#include <stdlib.h>
593#include <iconv.h>],
594        [iconv_t cd = iconv_open("","");
595         iconv(cd,NULL,NULL,NULL,NULL);
596         iconv_close(cd);],
597        am_cv_lib_iconv=yes
598        am_cv_func_iconv=yes)
599      LIBS="$am_save_LIBS"
600    fi
601  ])
602  if test "$am_cv_func_iconv" = yes; then
603    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
604  fi
605  if test "$am_cv_lib_iconv" = yes; then
606    AC_MSG_CHECKING([how to link with libiconv])
607    AC_MSG_RESULT([$LIBICONV])
608  else
609    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
610    dnl either.
611    CPPFLAGS="$am_save_CPPFLAGS"
612    LIBICONV=
613    LTLIBICONV=
614  fi
615  AC_SUBST(LIBICONV)
616  AC_SUBST(LTLIBICONV)
617])
618
619AC_DEFUN([AM_ICONV],
620[
621  AM_ICONV_LINK
622  if test "$am_cv_func_iconv" = yes; then
623    AC_MSG_CHECKING([for iconv declaration])
624    AC_CACHE_VAL(am_cv_proto_iconv, [
625      AC_TRY_COMPILE([
626#include <stdlib.h>
627#include <iconv.h>
628extern
629#ifdef __cplusplus
630"C"
631#endif
632#if defined(__STDC__) || defined(__cplusplus)
633size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
634#else
635size_t iconv();
636#endif
637], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
638      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);"])
639    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
640    AC_MSG_RESULT([$]{ac_t:-
641         }[$]am_cv_proto_iconv)
642    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
643      [Define as const if the declaration of iconv() needs const.])
644  fi
645])
646# intdiv0.m4 serial 1 (gettext-0.11.3)
647dnl Copyright (C) 2002 Free Software Foundation, Inc.
648dnl This file is free software, distributed under the terms of the GNU
649dnl General Public License.  As a special exception to the GNU General
650dnl Public License, this file may be distributed as part of a program
651dnl that contains a configuration script generated by Autoconf, under
652dnl the same distribution terms as the rest of that program.
653
654dnl From Bruno Haible.
655
656AC_DEFUN([gt_INTDIV0],
657[
658  AC_REQUIRE([AC_PROG_CC])dnl
659  AC_REQUIRE([AC_CANONICAL_HOST])dnl
660
661  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
662    gt_cv_int_divbyzero_sigfpe,
663    [
664      AC_TRY_RUN([
665#include <stdlib.h>
666#include <signal.h>
667
668static void
669#ifdef __cplusplus
670sigfpe_handler (int sig)
671#else
672sigfpe_handler (sig) int sig;
673#endif
674{
675  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
676  exit (sig != SIGFPE);
677}
678
679int x = 1;
680int y = 0;
681int z;
682int nan;
683
684int main ()
685{
686  signal (SIGFPE, sigfpe_handler);
687/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
688#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
689  signal (SIGTRAP, sigfpe_handler);
690#endif
691/* Linux/SPARC yields signal SIGILL.  */
692#if defined (__sparc__) && defined (__linux__)
693  signal (SIGILL, sigfpe_handler);
694#endif
695
696  z = x / y;
697  nan = y / y;
698  exit (1);
699}
700], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
701        [
702          # Guess based on the CPU.
703          case "$host_cpu" in
704            alpha* | i[34567]86 | m68k | s390*)
705              gt_cv_int_divbyzero_sigfpe="guessing yes";;
706            *)
707              gt_cv_int_divbyzero_sigfpe="guessing no";;
708          esac
709        ])
710    ])
711  case "$gt_cv_int_divbyzero_sigfpe" in
712    *yes) value=1;;
713    *) value=0;;
714  esac
715  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
716    [Define if integer division by zero raises signal SIGFPE.])
717])
718# intmax.m4 serial 1 (gettext-0.12)
719dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
720dnl This file is free software, distributed under the terms of the GNU
721dnl General Public License.  As a special exception to the GNU General
722dnl Public License, this file may be distributed as part of a program
723dnl that contains a configuration script generated by Autoconf, under
724dnl the same distribution terms as the rest of that program.
725
726dnl From Bruno Haible.
727dnl Test whether the system has the 'intmax_t' type, but don't attempt to
728dnl find a replacement if it is lacking.
729
730AC_DEFUN([gt_TYPE_INTMAX_T],
731[
732  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
733  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
734  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
735    [AC_TRY_COMPILE([
736#include <stddef.h> 
737#include <stdlib.h>
738#if HAVE_STDINT_H_WITH_UINTMAX
739#include <stdint.h>
740#endif
741#if HAVE_INTTYPES_H_WITH_UINTMAX
742#include <inttypes.h>
743#endif
744], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
745  if test $gt_cv_c_intmax_t = yes; then
746    AC_DEFINE(HAVE_INTMAX_T, 1,
747      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
748  fi
749])
750# inttypes.m4 serial 1 (gettext-0.11.4)
751dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
752dnl This file is free software, distributed under the terms of the GNU
753dnl General Public License.  As a special exception to the GNU General
754dnl Public License, this file may be distributed as part of a program
755dnl that contains a configuration script generated by Autoconf, under
756dnl the same distribution terms as the rest of that program.
757
758dnl From Paul Eggert.
759
760# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
761# <sys/types.h>.
762
763AC_DEFUN([gt_HEADER_INTTYPES_H],
764[
765  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
766  [
767    AC_TRY_COMPILE(
768      [#include <sys/types.h>
769#include <inttypes.h>],
770      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
771  ])
772  if test $gt_cv_header_inttypes_h = yes; then
773    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
774      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
775  fi
776])
777# inttypes_h.m4 serial 5 (gettext-0.12)
778dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
779dnl This file is free software, distributed under the terms of the GNU
780dnl General Public License.  As a special exception to the GNU General
781dnl Public License, this file may be distributed as part of a program
782dnl that contains a configuration script generated by Autoconf, under
783dnl the same distribution terms as the rest of that program.
784
785dnl From Paul Eggert.
786
787# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
788# doesn't clash with <sys/types.h>, and declares uintmax_t.
789
790AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
791[
792  AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
793  [AC_TRY_COMPILE(
794    [#include <sys/types.h>
795#include <inttypes.h>],
796    [uintmax_t i = (uintmax_t) -1;],
797    jm_ac_cv_header_inttypes_h=yes,
798    jm_ac_cv_header_inttypes_h=no)])
799  if test $jm_ac_cv_header_inttypes_h = yes; then
800    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
801      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
802       and declares uintmax_t. ])
803  fi
804])
805# inttypes-pri.m4 serial 1 (gettext-0.11.4)
806dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
807dnl This file is free software, distributed under the terms of the GNU
808dnl General Public License.  As a special exception to the GNU General
809dnl Public License, this file may be distributed as part of a program
810dnl that contains a configuration script generated by Autoconf, under
811dnl the same distribution terms as the rest of that program.
812
813dnl From Bruno Haible.
814
815# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
816# macros to non-string values.  This is the case on AIX 4.3.3.
817
818AC_DEFUN([gt_INTTYPES_PRI],
819[
820  AC_REQUIRE([gt_HEADER_INTTYPES_H])
821  if test $gt_cv_header_inttypes_h = yes; then
822    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
823      gt_cv_inttypes_pri_broken,
824      [
825        AC_TRY_COMPILE([#include <inttypes.h>
826#ifdef PRId32
827char *p = PRId32;
828#endif
829], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
830      ])
831  fi
832  if test "$gt_cv_inttypes_pri_broken" = yes; then
833    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
834      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
835  fi
836])
837# isc-posix.m4 serial 2 (gettext-0.11.2)
838dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
839dnl This file is free software, distributed under the terms of the GNU
840dnl General Public License.  As a special exception to the GNU General
841dnl Public License, this file may be distributed as part of a program
842dnl that contains a configuration script generated by Autoconf, under
843dnl the same distribution terms as the rest of that program.
844
845# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
846
847# This test replaces the one in autoconf.
848# Currently this macro should have the same name as the autoconf macro
849# because gettext's gettext.m4 (distributed in the automake package)
850# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
851# give these diagnostics:
852#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
853#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
854
855undefine([AC_ISC_POSIX])
856
857AC_DEFUN([AC_ISC_POSIX],
858  [
859    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
860    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
861  ]
862)
863# lcmessage.m4 serial 3 (gettext-0.11.3)
864dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
865dnl This file is free software, distributed under the terms of the GNU
866dnl General Public License.  As a special exception to the GNU General
867dnl Public License, this file may be distributed as part of a program
868dnl that contains a configuration script generated by Autoconf, under
869dnl the same distribution terms as the rest of that program.
870dnl
871dnl This file can can be used in projects which are not available under
872dnl the GNU General Public License or the GNU Library General Public
873dnl License but which still want to provide support for the GNU gettext
874dnl functionality.
875dnl Please note that the actual code of the GNU gettext library is covered
876dnl by the GNU Library General Public License, and the rest of the GNU
877dnl gettext package package is covered by the GNU General Public License.
878dnl They are *not* in the public domain.
879
880dnl Authors:
881dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
882
883# Check whether LC_MESSAGES is available in <locale.h>.
884
885AC_DEFUN([AM_LC_MESSAGES],
886[
887  AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
888    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
889       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
890  if test $am_cv_val_LC_MESSAGES = yes; then
891    AC_DEFINE(HAVE_LC_MESSAGES, 1,
892      [Define if your <locale.h> file defines LC_MESSAGES.])
893  fi
894])
895# lib-ld.m4 serial 3 (gettext-0.13)
896dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
897dnl This file is free software, distributed under the terms of the GNU
898dnl General Public License.  As a special exception to the GNU General
899dnl Public License, this file may be distributed as part of a program
900dnl that contains a configuration script generated by Autoconf, under
901dnl the same distribution terms as the rest of that program.
902
903dnl Subroutines of libtool.m4,
904dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
905dnl with libtool.m4.
906
907dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
908AC_DEFUN([AC_LIB_PROG_LD_GNU],
909[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
910[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
911case `$LD -v 2>&1 </dev/null` in
912*GNU* | *'with BFD'*)
913  acl_cv_prog_gnu_ld=yes ;;
914*)
915  acl_cv_prog_gnu_ld=no ;;
916esac])
917with_gnu_ld=$acl_cv_prog_gnu_ld
918])
919
920dnl From libtool-1.4. Sets the variable LD.
921AC_DEFUN([AC_LIB_PROG_LD],
922[AC_ARG_WITH(gnu-ld,
923[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
924test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
925AC_REQUIRE([AC_PROG_CC])dnl
926AC_REQUIRE([AC_CANONICAL_HOST])dnl
927# Prepare PATH_SEPARATOR.
928# The user is always right.
929if test "${PATH_SEPARATOR+set}" != set; then
930  echo "#! /bin/sh" >conf$$.sh
931  echo  "exit 0"   >>conf$$.sh
932  chmod +x conf$$.sh
933  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
934    PATH_SEPARATOR=';'
935  else
936    PATH_SEPARATOR=:
937  fi
938  rm -f conf$$.sh
939fi
940ac_prog=ld
941if test "$GCC" = yes; then
942  # Check if gcc -print-prog-name=ld gives a path.
943  AC_MSG_CHECKING([for ld used by GCC])
944  case $host in
945  *-*-mingw*)
946    # gcc leaves a trailing carriage return which upsets mingw
947    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
948  *)
949    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
950  esac
951  case $ac_prog in
952    # Accept absolute paths.
953    [[\\/]* | [A-Za-z]:[\\/]*)]
954      [re_direlt='/[^/][^/]*/\.\./']
955      # Canonicalize the path of ld
956      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
957      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
958	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
959      done
960      test -z "$LD" && LD="$ac_prog"
961      ;;
962  "")
963    # If it fails, then pretend we aren't using GCC.
964    ac_prog=ld
965    ;;
966  *)
967    # If it is relative, then search for the first ld in PATH.
968    with_gnu_ld=unknown
969    ;;
970  esac
971elif test "$with_gnu_ld" = yes; then
972  AC_MSG_CHECKING([for GNU ld])
973else
974  AC_MSG_CHECKING([for non-GNU ld])
975fi
976AC_CACHE_VAL(acl_cv_path_LD,
977[if test -z "$LD"; then
978  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
979  for ac_dir in $PATH; do
980    test -z "$ac_dir" && ac_dir=.
981    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
982      acl_cv_path_LD="$ac_dir/$ac_prog"
983      # Check to see if the program is GNU ld.  I'd rather use --version,
984      # but apparently some GNU ld's only accept -v.
985      # Break only if it was the GNU/non-GNU ld that we prefer.
986      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
987      *GNU* | *'with BFD'*)
988	test "$with_gnu_ld" != no && break ;;
989      *)
990	test "$with_gnu_ld" != yes && break ;;
991      esac
992    fi
993  done
994  IFS="$ac_save_ifs"
995else
996  acl_cv_path_LD="$LD" # Let the user override the test with a path.
997fi])
998LD="$acl_cv_path_LD"
999if test -n "$LD"; then
1000  AC_MSG_RESULT($LD)
1001else
1002  AC_MSG_RESULT(no)
1003fi
1004test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1005AC_LIB_PROG_LD_GNU
1006])
1007# lib-link.m4 serial 4 (gettext-0.12)
1008dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
1009dnl This file is free software, distributed under the terms of the GNU
1010dnl General Public License.  As a special exception to the GNU General
1011dnl Public License, this file may be distributed as part of a program
1012dnl that contains a configuration script generated by Autoconf, under
1013dnl the same distribution terms as the rest of that program.
1014
1015dnl From Bruno Haible.
1016
1017dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1018dnl the libraries corresponding to explicit and implicit dependencies.
1019dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1020dnl augments the CPPFLAGS variable.
1021AC_DEFUN([AC_LIB_LINKFLAGS],
1022[
1023  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1024  AC_REQUIRE([AC_LIB_RPATH])
1025  define([Name],[translit([$1],[./-], [___])])
1026  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1027                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1028  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1029    AC_LIB_LINKFLAGS_BODY([$1], [$2])
1030    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1031    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1032    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1033  ])
1034  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1035  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1036  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1037  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1038  AC_SUBST([LIB]NAME)
1039  AC_SUBST([LTLIB]NAME)
1040  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1041  dnl results of this search when this library appears as a dependency.
1042  HAVE_LIB[]NAME=yes
1043  undefine([Name])
1044  undefine([NAME])
1045])
1046
1047dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1048dnl searches for libname and the libraries corresponding to explicit and
1049dnl implicit dependencies, together with the specified include files and
1050dnl the ability to compile and link the specified testcode. If found, it
1051dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1052dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1053dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1054dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1055AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1056[
1057  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1058  AC_REQUIRE([AC_LIB_RPATH])
1059  define([Name],[translit([$1],[./-], [___])])
1060  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1061                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1062
1063  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1064  dnl accordingly.
1065  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1066
1067  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1068  dnl because if the user has installed lib[]Name and not disabled its use
1069  dnl via --without-lib[]Name-prefix, he wants to use it.
1070  ac_save_CPPFLAGS="$CPPFLAGS"
1071  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1072
1073  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1074    ac_save_LIBS="$LIBS"
1075    LIBS="$LIBS $LIB[]NAME"
1076    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1077    LIBS="$ac_save_LIBS"
1078  ])
1079  if test "$ac_cv_lib[]Name" = yes; then
1080    HAVE_LIB[]NAME=yes
1081    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1082    AC_MSG_CHECKING([how to link with lib[]$1])
1083    AC_MSG_RESULT([$LIB[]NAME])
1084  else
1085    HAVE_LIB[]NAME=no
1086    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1087    dnl $INC[]NAME either.
1088    CPPFLAGS="$ac_save_CPPFLAGS"
1089    LIB[]NAME=
1090    LTLIB[]NAME=
1091  fi
1092  AC_SUBST([HAVE_LIB]NAME)
1093  AC_SUBST([LIB]NAME)
1094  AC_SUBST([LTLIB]NAME)
1095  undefine([Name])
1096  undefine([NAME])
1097])
1098
1099dnl Determine the platform dependent parameters needed to use rpath:
1100dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1101dnl hardcode_direct, hardcode_minus_L.
1102AC_DEFUN([AC_LIB_RPATH],
1103[
1104  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1105  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1106  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1107  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1108  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1109    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1110    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1111    . ./conftest.sh
1112    rm -f ./conftest.sh
1113    acl_cv_rpath=done
1114  ])
1115  wl="$acl_cv_wl"
1116  libext="$acl_cv_libext"
1117  shlibext="$acl_cv_shlibext"
1118  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1119  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1120  hardcode_direct="$acl_cv_hardcode_direct"
1121  hardcode_minus_L="$acl_cv_hardcode_minus_L"
1122  dnl Determine whether the user wants rpath handling at all.
1123  AC_ARG_ENABLE(rpath,
1124    [  --disable-rpath         do not hardcode runtime library paths],
1125    :, enable_rpath=yes)
1126])
1127
1128dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1129dnl the libraries corresponding to explicit and implicit dependencies.
1130dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1131AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1132[
1133  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1134                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1135  dnl By default, look in $includedir and $libdir.
1136  use_additional=yes
1137  AC_LIB_WITH_FINAL_PREFIX([
1138    eval additional_includedir=\"$includedir\"
1139    eval additional_libdir=\"$libdir\"
1140  ])
1141  AC_LIB_ARG_WITH([lib$1-prefix],
1142[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1143  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1144[
1145    if test "X$withval" = "Xno"; then
1146      use_additional=no
1147    else
1148      if test "X$withval" = "X"; then
1149        AC_LIB_WITH_FINAL_PREFIX([
1150          eval additional_includedir=\"$includedir\"
1151          eval additional_libdir=\"$libdir\"
1152        ])
1153      else
1154        additional_includedir="$withval/include"
1155        additional_libdir="$withval/lib"
1156      fi
1157    fi
1158])
1159  dnl Search the library and its dependencies in $additional_libdir and
1160  dnl $LDFLAGS. Using breadth-first-seach.
1161  LIB[]NAME=
1162  LTLIB[]NAME=
1163  INC[]NAME=
1164  rpathdirs=
1165  ltrpathdirs=
1166  names_already_handled=
1167  names_next_round='$1 $2'
1168  while test -n "$names_next_round"; do
1169    names_this_round="$names_next_round"
1170    names_next_round=
1171    for name in $names_this_round; do
1172      already_handled=
1173      for n in $names_already_handled; do
1174        if test "$n" = "$name"; then
1175          already_handled=yes
1176          break
1177        fi
1178      done
1179      if test -z "$already_handled"; then
1180        names_already_handled="$names_already_handled $name"
1181        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1182        dnl or AC_LIB_HAVE_LINKFLAGS call.
1183        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1184        eval value=\"\$HAVE_LIB$uppername\"
1185        if test -n "$value"; then
1186          if test "$value" = yes; then
1187            eval value=\"\$LIB$uppername\"
1188            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1189            eval value=\"\$LTLIB$uppername\"
1190            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1191          else
1192            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1193            dnl that this library doesn't exist. So just drop it.
1194            :
1195          fi
1196        else
1197          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1198          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1199          found_dir=
1200          found_la=
1201          found_so=
1202          found_a=
1203          if test $use_additional = yes; then
1204            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
1205              found_dir="$additional_libdir"
1206              found_so="$additional_libdir/lib$name.$shlibext"
1207              if test -f "$additional_libdir/lib$name.la"; then
1208                found_la="$additional_libdir/lib$name.la"
1209              fi
1210            else
1211              if test -f "$additional_libdir/lib$name.$libext"; then
1212                found_dir="$additional_libdir"
1213                found_a="$additional_libdir/lib$name.$libext"
1214                if test -f "$additional_libdir/lib$name.la"; then
1215                  found_la="$additional_libdir/lib$name.la"
1216                fi
1217              fi
1218            fi
1219          fi
1220          if test "X$found_dir" = "X"; then
1221            for x in $LDFLAGS $LTLIB[]NAME; do
1222              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1223              case "$x" in
1224                -L*)
1225                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1226                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
1227                    found_dir="$dir"
1228                    found_so="$dir/lib$name.$shlibext"
1229                    if test -f "$dir/lib$name.la"; then
1230                      found_la="$dir/lib$name.la"
1231                    fi
1232                  else
1233                    if test -f "$dir/lib$name.$libext"; then
1234                      found_dir="$dir"
1235                      found_a="$dir/lib$name.$libext"
1236                      if test -f "$dir/lib$name.la"; then
1237                        found_la="$dir/lib$name.la"
1238                      fi
1239                    fi
1240                  fi
1241                  ;;
1242              esac
1243              if test "X$found_dir" != "X"; then
1244                break
1245              fi
1246            done
1247          fi
1248          if test "X$found_dir" != "X"; then
1249            dnl Found the library.
1250            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1251            if test "X$found_so" != "X"; then
1252              dnl Linking with a shared library. We attempt to hardcode its
1253              dnl directory into the executable's runpath, unless it's the
1254              dnl standard /usr/lib.
1255              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
1256                dnl No hardcoding is needed.
1257                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1258              else
1259                dnl Use an explicit option to hardcode DIR into the resulting
1260                dnl binary.
1261                dnl Potentially add DIR to ltrpathdirs.
1262                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1263                haveit=
1264                for x in $ltrpathdirs; do
1265                  if test "X$x" = "X$found_dir"; then
1266                    haveit=yes
1267                    break
1268                  fi
1269                done
1270                if test -z "$haveit"; then
1271                  ltrpathdirs="$ltrpathdirs $found_dir"
1272                fi
1273                dnl The hardcoding into $LIBNAME is system dependent.
1274                if test "$hardcode_direct" = yes; then
1275                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1276                  dnl resulting binary.
1277                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1278                else
1279                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1280                    dnl Use an explicit option to hardcode DIR into the resulting
1281                    dnl binary.
1282                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1283                    dnl Potentially add DIR to rpathdirs.
1284                    dnl The rpathdirs will be appended to $LIBNAME at the end.
1285                    haveit=
1286                    for x in $rpathdirs; do
1287                      if test "X$x" = "X$found_dir"; then
1288                        haveit=yes
1289                        break
1290                      fi
1291                    done
1292                    if test -z "$haveit"; then
1293                      rpathdirs="$rpathdirs $found_dir"
1294                    fi
1295                  else
1296                    dnl Rely on "-L$found_dir".
1297                    dnl But don't add it if it's already contained in the LDFLAGS
1298                    dnl or the already constructed $LIBNAME
1299                    haveit=
1300                    for x in $LDFLAGS $LIB[]NAME; do
1301                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1302                      if test "X$x" = "X-L$found_dir"; then
1303                        haveit=yes
1304                        break
1305                      fi
1306                    done
1307                    if test -z "$haveit"; then
1308                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1309                    fi
1310                    if test "$hardcode_minus_L" != no; then
1311                      dnl FIXME: Not sure whether we should use
1312                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1313                      dnl here.
1314                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1315                    else
1316                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1317                      dnl here, because this doesn't fit in flags passed to the
1318                      dnl compiler. So give up. No hardcoding. This affects only
1319                      dnl very old systems.
1320                      dnl FIXME: Not sure whether we should use
1321                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1322                      dnl here.
1323                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1324                    fi
1325                  fi
1326                fi
1327              fi
1328            else
1329              if test "X$found_a" != "X"; then
1330                dnl Linking with a static library.
1331                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1332              else
1333                dnl We shouldn't come here, but anyway it's good to have a
1334                dnl fallback.
1335                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1336              fi
1337            fi
1338            dnl Assume the include files are nearby.
1339            additional_includedir=
1340            case "$found_dir" in
1341              */lib | */lib/)
1342                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
1343                additional_includedir="$basedir/include"
1344                ;;
1345            esac
1346            if test "X$additional_includedir" != "X"; then
1347              dnl Potentially add $additional_includedir to $INCNAME.
1348              dnl But don't add it
1349              dnl   1. if it's the standard /usr/include,
1350              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1351              dnl   3. if it's already present in $CPPFLAGS or the already
1352              dnl      constructed $INCNAME,
1353              dnl   4. if it doesn't exist as a directory.
1354              if test "X$additional_includedir" != "X/usr/include"; then
1355                haveit=
1356                if test "X$additional_includedir" = "X/usr/local/include"; then
1357                  if test -n "$GCC"; then
1358                    case $host_os in
1359                      linux*) haveit=yes;;
1360                    esac
1361                  fi
1362                fi
1363                if test -z "$haveit"; then
1364                  for x in $CPPFLAGS $INC[]NAME; do
1365                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1366                    if test "X$x" = "X-I$additional_includedir"; then
1367                      haveit=yes
1368                      break
1369                    fi
1370                  done
1371                  if test -z "$haveit"; then
1372                    if test -d "$additional_includedir"; then
1373                      dnl Really add $additional_includedir to $INCNAME.
1374                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1375                    fi
1376                  fi
1377                fi
1378              fi
1379            fi
1380            dnl Look for dependencies.
1381            if test -n "$found_la"; then
1382              dnl Read the .la file. It defines the variables
1383              dnl dlname, library_names, old_library, dependency_libs, current,
1384              dnl age, revision, installed, dlopen, dlpreopen, libdir.
1385              save_libdir="$libdir"
1386              case "$found_la" in
1387                */* | *\\*) . "$found_la" ;;
1388                *) . "./$found_la" ;;
1389              esac
1390              libdir="$save_libdir"
1391              dnl We use only dependency_libs.
1392              for dep in $dependency_libs; do
1393                case "$dep" in
1394                  -L*)
1395                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1396                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1397                    dnl But don't add it
1398                    dnl   1. if it's the standard /usr/lib,
1399                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1400                    dnl   3. if it's already present in $LDFLAGS or the already
1401                    dnl      constructed $LIBNAME,
1402                    dnl   4. if it doesn't exist as a directory.
1403                    if test "X$additional_libdir" != "X/usr/lib"; then
1404                      haveit=
1405                      if test "X$additional_libdir" = "X/usr/local/lib"; then
1406                        if test -n "$GCC"; then
1407                          case $host_os in
1408                            linux*) haveit=yes;;
1409                          esac
1410                        fi
1411                      fi
1412                      if test -z "$haveit"; then
1413                        haveit=
1414                        for x in $LDFLAGS $LIB[]NAME; do
1415                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1416                          if test "X$x" = "X-L$additional_libdir"; then
1417                            haveit=yes
1418                            break
1419                          fi
1420                        done
1421                        if test -z "$haveit"; then
1422                          if test -d "$additional_libdir"; then
1423                            dnl Really add $additional_libdir to $LIBNAME.
1424                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1425                          fi
1426                        fi
1427                        haveit=
1428                        for x in $LDFLAGS $LTLIB[]NAME; do
1429                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1430                          if test "X$x" = "X-L$additional_libdir"; then
1431                            haveit=yes
1432                            break
1433                          fi
1434                        done
1435                        if test -z "$haveit"; then
1436                          if test -d "$additional_libdir"; then
1437                            dnl Really add $additional_libdir to $LTLIBNAME.
1438                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1439                          fi
1440                        fi
1441                      fi
1442                    fi
1443                    ;;
1444                  -R*)
1445                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
1446                    if test "$enable_rpath" != no; then
1447                      dnl Potentially add DIR to rpathdirs.
1448                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1449                      haveit=
1450                      for x in $rpathdirs; do
1451                        if test "X$x" = "X$dir"; then
1452                          haveit=yes
1453                          break
1454                        fi
1455                      done
1456                      if test -z "$haveit"; then
1457                        rpathdirs="$rpathdirs $dir"
1458                      fi
1459                      dnl Potentially add DIR to ltrpathdirs.
1460                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1461                      haveit=
1462                      for x in $ltrpathdirs; do
1463                        if test "X$x" = "X$dir"; then
1464                          haveit=yes
1465                          break
1466                        fi
1467                      done
1468                      if test -z "$haveit"; then
1469                        ltrpathdirs="$ltrpathdirs $dir"
1470                      fi
1471                    fi
1472                    ;;
1473                  -l*)
1474                    dnl Handle this in the next round.
1475                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1476                    ;;
1477                  *.la)
1478                    dnl Handle this in the next round. Throw away the .la's
1479                    dnl directory; it is already contained in a preceding -L
1480                    dnl option.
1481                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1482                    ;;
1483                  *)
1484                    dnl Most likely an immediate library name.
1485                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1486                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1487                    ;;
1488                esac
1489              done
1490            fi
1491          else
1492            dnl Didn't find the library; assume it is in the system directories
1493            dnl known to the linker and runtime loader. (All the system
1494            dnl directories known to the linker should also be known to the
1495            dnl runtime loader, otherwise the system is severely misconfigured.)
1496            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1497            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1498          fi
1499        fi
1500      fi
1501    done
1502  done
1503  if test "X$rpathdirs" != "X"; then
1504    if test -n "$hardcode_libdir_separator"; then
1505      dnl Weird platform: only the last -rpath option counts, the user must
1506      dnl pass all path elements in one option. We can arrange that for a
1507      dnl single library, but not when more than one $LIBNAMEs are used.
1508      alldirs=
1509      for found_dir in $rpathdirs; do
1510        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1511      done
1512      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1513      acl_save_libdir="$libdir"
1514      libdir="$alldirs"
1515      eval flag=\"$hardcode_libdir_flag_spec\"
1516      libdir="$acl_save_libdir"
1517      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1518    else
1519      dnl The -rpath options are cumulative.
1520      for found_dir in $rpathdirs; do
1521        acl_save_libdir="$libdir"
1522        libdir="$found_dir"
1523        eval flag=\"$hardcode_libdir_flag_spec\"
1524        libdir="$acl_save_libdir"
1525        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1526      done
1527    fi
1528  fi
1529  if test "X$ltrpathdirs" != "X"; then
1530    dnl When using libtool, the option that works for both libraries and
1531    dnl executables is -R. The -R options are cumulative.
1532    for found_dir in $ltrpathdirs; do
1533      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1534    done
1535  fi
1536])
1537
1538dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1539dnl unless already present in VAR.
1540dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1541dnl contains two or three consecutive elements that belong together.
1542AC_DEFUN([AC_LIB_APPENDTOVAR],
1543[
1544  for element in [$2]; do
1545    haveit=
1546    for x in $[$1]; do
1547      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1548      if test "X$x" = "X$element"; then
1549        haveit=yes
1550        break
1551      fi
1552    done
1553    if test -z "$haveit"; then
1554      [$1]="${[$1]}${[$1]:+ }$element"
1555    fi
1556  done
1557])
1558# lib-prefix.m4 serial 3 (gettext-0.13)
1559dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
1560dnl This file is free software, distributed under the terms of the GNU
1561dnl General Public License.  As a special exception to the GNU General
1562dnl Public License, this file may be distributed as part of a program
1563dnl that contains a configuration script generated by Autoconf, under
1564dnl the same distribution terms as the rest of that program.
1565
1566dnl From Bruno Haible.
1567
1568dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1569dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1570dnl require excessive bracketing.
1571ifdef([AC_HELP_STRING],
1572[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1573[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1574
1575dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1576dnl to access previously installed libraries. The basic assumption is that
1577dnl a user will want packages to use other packages he previously installed
1578dnl with the same --prefix option.
1579dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1580dnl libraries, but is otherwise very convenient.
1581AC_DEFUN([AC_LIB_PREFIX],
1582[
1583  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1584  AC_REQUIRE([AC_PROG_CC])
1585  AC_REQUIRE([AC_CANONICAL_HOST])
1586  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1587  dnl By default, look in $includedir and $libdir.
1588  use_additional=yes
1589  AC_LIB_WITH_FINAL_PREFIX([
1590    eval additional_includedir=\"$includedir\"
1591    eval additional_libdir=\"$libdir\"
1592  ])
1593  AC_LIB_ARG_WITH([lib-prefix],
1594[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1595  --without-lib-prefix    don't search for libraries in includedir and libdir],
1596[
1597    if test "X$withval" = "Xno"; then
1598      use_additional=no
1599    else
1600      if test "X$withval" = "X"; then
1601        AC_LIB_WITH_FINAL_PREFIX([
1602          eval additional_includedir=\"$includedir\"
1603          eval additional_libdir=\"$libdir\"
1604        ])
1605      else
1606        additional_includedir="$withval/include"
1607        additional_libdir="$withval/lib"
1608      fi
1609    fi
1610])
1611  if test $use_additional = yes; then
1612    dnl Potentially add $additional_includedir to $CPPFLAGS.
1613    dnl But don't add it
1614    dnl   1. if it's the standard /usr/include,
1615    dnl   2. if it's already present in $CPPFLAGS,
1616    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1617    dnl   4. if it doesn't exist as a directory.
1618    if test "X$additional_includedir" != "X/usr/include"; then
1619      haveit=
1620      for x in $CPPFLAGS; do
1621        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1622        if test "X$x" = "X-I$additional_includedir"; then
1623          haveit=yes
1624          break
1625        fi
1626      done
1627      if test -z "$haveit"; then
1628        if test "X$additional_includedir" = "X/usr/local/include"; then
1629          if test -n "$GCC"; then
1630            case $host_os in
1631              linux*) haveit=yes;;
1632            esac
1633          fi
1634        fi
1635        if test -z "$haveit"; then
1636          if test -d "$additional_includedir"; then
1637            dnl Really add $additional_includedir to $CPPFLAGS.
1638            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1639          fi
1640        fi
1641      fi
1642    fi
1643    dnl Potentially add $additional_libdir to $LDFLAGS.
1644    dnl But don't add it
1645    dnl   1. if it's the standard /usr/lib,
1646    dnl   2. if it's already present in $LDFLAGS,
1647    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1648    dnl   4. if it doesn't exist as a directory.
1649    if test "X$additional_libdir" != "X/usr/lib"; then
1650      haveit=
1651      for x in $LDFLAGS; do
1652        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1653        if test "X$x" = "X-L$additional_libdir"; then
1654          haveit=yes
1655          break
1656        fi
1657      done
1658      if test -z "$haveit"; then
1659        if test "X$additional_libdir" = "X/usr/local/lib"; then
1660          if test -n "$GCC"; then
1661            case $host_os in
1662              linux*) haveit=yes;;
1663            esac
1664          fi
1665        fi
1666        if test -z "$haveit"; then
1667          if test -d "$additional_libdir"; then
1668            dnl Really add $additional_libdir to $LDFLAGS.
1669            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1670          fi
1671        fi
1672      fi
1673    fi
1674  fi
1675])
1676
1677dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1678dnl acl_final_exec_prefix, containing the values to which $prefix and
1679dnl $exec_prefix will expand at the end of the configure script.
1680AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1681[
1682  dnl Unfortunately, prefix and exec_prefix get only finally determined
1683  dnl at the end of configure.
1684  if test "X$prefix" = "XNONE"; then
1685    acl_final_prefix="$ac_default_prefix"
1686  else
1687    acl_final_prefix="$prefix"
1688  fi
1689  if test "X$exec_prefix" = "XNONE"; then
1690    acl_final_exec_prefix='${prefix}'
1691  else
1692    acl_final_exec_prefix="$exec_prefix"
1693  fi
1694  acl_save_prefix="$prefix"
1695  prefix="$acl_final_prefix"
1696  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1697  prefix="$acl_save_prefix"
1698])
1699
1700dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1701dnl variables prefix and exec_prefix bound to the values they will have
1702dnl at the end of the configure script.
1703AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1704[
1705  acl_save_prefix="$prefix"
1706  prefix="$acl_final_prefix"
1707  acl_save_exec_prefix="$exec_prefix"
1708  exec_prefix="$acl_final_exec_prefix"
1709  $1
1710  exec_prefix="$acl_save_exec_prefix"
1711  prefix="$acl_save_prefix"
1712])
1713# longdouble.m4 serial 1 (gettext-0.12)
1714dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
1715dnl This file is free software, distributed under the terms of the GNU
1716dnl General Public License.  As a special exception to the GNU General
1717dnl Public License, this file may be distributed as part of a program
1718dnl that contains a configuration script generated by Autoconf, under
1719dnl the same distribution terms as the rest of that program.
1720
1721dnl From Bruno Haible.
1722dnl Test whether the compiler supports the 'long double' type.
1723dnl Prerequisite: AC_PROG_CC
1724
1725AC_DEFUN([gt_TYPE_LONGDOUBLE],
1726[
1727  AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
1728    [if test "$GCC" = yes; then
1729       gt_cv_c_long_double=yes
1730     else
1731       AC_TRY_COMPILE([
1732         /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
1733         long double foo = 0.0;
1734         /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
1735         int array [2*(sizeof(long double) >= sizeof(double)) - 1];
1736         ], ,
1737         gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
1738     fi])
1739  if test $gt_cv_c_long_double = yes; then
1740    AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
1741  fi
1742])
1743# longlong.m4 serial 4
1744dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
1745dnl This file is free software, distributed under the terms of the GNU
1746dnl General Public License.  As a special exception to the GNU General
1747dnl Public License, this file may be distributed as part of a program
1748dnl that contains a configuration script generated by Autoconf, under
1749dnl the same distribution terms as the rest of that program.
1750
1751dnl From Paul Eggert.
1752
1753# Define HAVE_LONG_LONG if 'long long' works.
1754
1755AC_DEFUN([jm_AC_TYPE_LONG_LONG],
1756[
1757  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
1758  [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
1759    [long long llmax = (long long) -1;
1760     return ll << i | ll >> i | llmax / ll | llmax % ll;],
1761    ac_cv_type_long_long=yes,
1762    ac_cv_type_long_long=no)])
1763  if test $ac_cv_type_long_long = yes; then
1764    AC_DEFINE(HAVE_LONG_LONG, 1,
1765      [Define if you have the 'long long' type.])
1766  fi
1767])
1768# nls.m4 serial 1 (gettext-0.12)
1769dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
1770dnl This file is free software, distributed under the terms of the GNU
1771dnl General Public License.  As a special exception to the GNU General
1772dnl Public License, this file may be distributed as part of a program
1773dnl that contains a configuration script generated by Autoconf, under
1774dnl the same distribution terms as the rest of that program.
1775dnl
1776dnl This file can can be used in projects which are not available under
1777dnl the GNU General Public License or the GNU Library General Public
1778dnl License but which still want to provide support for the GNU gettext
1779dnl functionality.
1780dnl Please note that the actual code of the GNU gettext library is covered
1781dnl by the GNU Library General Public License, and the rest of the GNU
1782dnl gettext package package is covered by the GNU General Public License.
1783dnl They are *not* in the public domain.
1784
1785dnl Authors:
1786dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1787dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1788
1789AC_DEFUN([AM_NLS],
1790[
1791  AC_MSG_CHECKING([whether NLS is requested])
1792  dnl Default is enabled NLS
1793  AC_ARG_ENABLE(nls,
1794    [  --disable-nls           do not use Native Language Support],
1795    USE_NLS=$enableval, USE_NLS=yes)
1796  AC_MSG_RESULT($USE_NLS)
1797  AC_SUBST(USE_NLS)
1798])
1799
1800AC_DEFUN([AM_MKINSTALLDIRS],
1801[
1802  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1803  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1804  dnl Try to locate it.
1805  MKINSTALLDIRS=
1806  if test -n "$ac_aux_dir"; then
1807    case "$ac_aux_dir" in
1808      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
1809      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
1810    esac
1811  fi
1812  if test -z "$MKINSTALLDIRS"; then
1813    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1814  fi
1815  AC_SUBST(MKINSTALLDIRS)
1816])
1817# po.m4 serial 3 (gettext-0.14)
1818dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
1819dnl This file is free software, distributed under the terms of the GNU
1820dnl General Public License.  As a special exception to the GNU General
1821dnl Public License, this file may be distributed as part of a program
1822dnl that contains a configuration script generated by Autoconf, under
1823dnl the same distribution terms as the rest of that program.
1824dnl
1825dnl This file can can be used in projects which are not available under
1826dnl the GNU General Public License or the GNU Library General Public
1827dnl License but which still want to provide support for the GNU gettext
1828dnl functionality.
1829dnl Please note that the actual code of the GNU gettext library is covered
1830dnl by the GNU Library General Public License, and the rest of the GNU
1831dnl gettext package package is covered by the GNU General Public License.
1832dnl They are *not* in the public domain.
1833
1834dnl Authors:
1835dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1836dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1837
1838dnl Checks for all prerequisites of the po subdirectory.
1839AC_DEFUN([AM_PO_SUBDIRS],
1840[
1841  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1842  AC_REQUIRE([AC_PROG_INSTALL])dnl
1843  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1844  AC_REQUIRE([AM_NLS])dnl
1845
1846  dnl Perform the following tests also if --disable-nls has been given,
1847  dnl because they are needed for "make dist" to work.
1848
1849  dnl Search for GNU msgfmt in the PATH.
1850  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
1851  dnl The second test excludes FreeBSD msgfmt.
1852  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1853    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
1854     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1855    :)
1856  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1857
1858  dnl Search for GNU xgettext 0.12 or newer in the PATH.
1859  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
1860  dnl The second test excludes FreeBSD xgettext.
1861  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1862    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
1863     (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)],
1864    :)
1865  dnl Remove leftover from FreeBSD xgettext call.
1866  rm -f messages.po
1867
1868  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
1869  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
1870    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
1871
1872  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1873  dnl Test whether we really found GNU msgfmt.
1874  if test "$GMSGFMT" != ":"; then
1875    dnl If it is no GNU msgfmt we define it as : so that the
1876    dnl Makefiles still can work.
1877    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
1878       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1879      : ;
1880    else
1881      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
1882      AC_MSG_RESULT(
1883        [found $GMSGFMT program is not GNU msgfmt; ignore it])
1884      GMSGFMT=":"
1885    fi
1886  fi
1887
1888  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1889  dnl Test whether we really found GNU xgettext.
1890  if test "$XGETTEXT" != ":"; then
1891    dnl If it is no GNU xgettext we define it as : so that the
1892    dnl Makefiles still can work.
1893    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
1894       (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
1895      : ;
1896    else
1897      AC_MSG_RESULT(
1898        [found xgettext program is not GNU xgettext; ignore it])
1899      XGETTEXT=":"
1900    fi
1901    dnl Remove leftover from FreeBSD xgettext call.
1902    rm -f messages.po
1903  fi
1904
1905  AC_OUTPUT_COMMANDS([
1906    for ac_file in $CONFIG_FILES; do
1907      # Support "outfile[:infile[:infile...]]"
1908      case "$ac_file" in
1909        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1910      esac
1911      # PO directories have a Makefile.in generated from Makefile.in.in.
1912      case "$ac_file" in */Makefile.in)
1913        # Adjust a relative srcdir.
1914        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1915        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1916        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1917        # In autoconf-2.13 it is called $ac_given_srcdir.
1918        # In autoconf-2.50 it is called $srcdir.
1919        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1920        case "$ac_given_srcdir" in
1921          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1922          /*) top_srcdir="$ac_given_srcdir" ;;
1923          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1924        esac
1925        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1926          rm -f "$ac_dir/POTFILES"
1927          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1928          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
1929          POMAKEFILEDEPS="POTFILES.in"
1930          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
1931          # on $ac_dir but don't depend on user-specified configuration
1932          # parameters.
1933          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
1934            # The LINGUAS file contains the set of available languages.
1935            if test -n "$OBSOLETE_ALL_LINGUAS"; then
1936              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
1937            fi
1938            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
1939            # Hide the ALL_LINGUAS assigment from automake.
1940            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
1941            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
1942          else
1943            # The set of available languages was given in configure.in.
1944            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
1945          fi
1946          # Compute POFILES
1947          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
1948          # Compute UPDATEPOFILES
1949          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
1950          # Compute DUMMYPOFILES
1951          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
1952          # Compute GMOFILES
1953          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
1954          case "$ac_given_srcdir" in
1955            .) srcdirpre= ;;
1956            *) srcdirpre='$(srcdir)/' ;;
1957          esac
1958          POFILES=
1959          UPDATEPOFILES=
1960          DUMMYPOFILES=
1961          GMOFILES=
1962          for lang in $ALL_LINGUAS; do
1963            POFILES="$POFILES $srcdirpre$lang.po"
1964            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
1965            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
1966            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
1967          done
1968          # CATALOGS depends on both $ac_dir and the user's LINGUAS
1969          # environment variable.
1970          INST_LINGUAS=
1971          if test -n "$ALL_LINGUAS"; then
1972            for presentlang in $ALL_LINGUAS; do
1973              useit=no
1974              if test "%UNSET%" != "$LINGUAS"; then
1975                desiredlanguages="$LINGUAS"
1976              else
1977                desiredlanguages="$ALL_LINGUAS"
1978              fi
1979              for desiredlang in $desiredlanguages; do
1980                # Use the presentlang catalog if desiredlang is
1981                #   a. equal to presentlang, or
1982                #   b. a variant of presentlang (because in this case,
1983                #      presentlang can be used as a fallback for messages
1984                #      which are not translated in the desiredlang catalog).
1985                case "$desiredlang" in
1986                  "$presentlang"*) useit=yes;;
1987                esac
1988              done
1989              if test $useit = yes; then
1990                INST_LINGUAS="$INST_LINGUAS $presentlang"
1991              fi
1992            done
1993          fi
1994          CATALOGS=
1995          if test -n "$INST_LINGUAS"; then
1996            for lang in $INST_LINGUAS; do
1997              CATALOGS="$CATALOGS $lang.gmo"
1998            done
1999          fi
2000          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
2001          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"
2002          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
2003            if test -f "$f"; then
2004              case "$f" in
2005                *.orig | *.bak | *~) ;;
2006                *) cat "$f" >> "$ac_dir/Makefile" ;;
2007              esac
2008            fi
2009          done
2010        fi
2011        ;;
2012      esac
2013    done],
2014   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
2015    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
2016    # from automake.
2017    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
2018    # Capture the value of LINGUAS because we need it to compute CATALOGS.
2019    LINGUAS="${LINGUAS-%UNSET%}"
2020   ])
2021])
2022
2023dnl Postprocesses a Makefile in a directory containing PO files.
2024AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
2025[
2026  # When this code is run, in config.status, two variables have already been
2027  # set:
2028  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
2029  # - LINGUAS is the value of the environment variable LINGUAS at configure
2030  #   time.
2031
2032changequote(,)dnl
2033  # Adjust a relative srcdir.
2034  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2035  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2036  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2037  # In autoconf-2.13 it is called $ac_given_srcdir.
2038  # In autoconf-2.50 it is called $srcdir.
2039  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2040  case "$ac_given_srcdir" in
2041    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2042    /*) top_srcdir="$ac_given_srcdir" ;;
2043    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2044  esac
2045
2046  # Find a way to echo strings without interpreting backslash.
2047  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
2048    gt_echo='echo'
2049  else
2050    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
2051      gt_echo='printf %s\n'
2052    else
2053      echo_func () {
2054        cat <<EOT
2055$*
2056EOT
2057      }
2058      gt_echo='echo_func'
2059    fi
2060  fi
2061
2062  # A sed script that extracts the value of VARIABLE from a Makefile.
2063  sed_x_variable='
2064# Test if the hold space is empty.
2065x
2066s/P/P/
2067x
2068ta
2069# Yes it was empty. Look if we have the expected variable definition.
2070/^[	 ]*VARIABLE[	 ]*=/{
2071  # Seen the first line of the variable definition.
2072  s/^[	 ]*VARIABLE[	 ]*=//
2073  ba
2074}
2075bd
2076:a
2077# Here we are processing a line from the variable definition.
2078# Remove comment, more precisely replace it with a space.
2079s/#.*$/ /
2080# See if the line ends in a backslash.
2081tb
2082:b
2083s/\\$//
2084# Print the line, without the trailing backslash.
2085p
2086tc
2087# There was no trailing backslash. The end of the variable definition is
2088# reached. Clear the hold space.
2089s/^.*$//
2090x
2091bd
2092:c
2093# A trailing backslash means that the variable definition continues in the
2094# next line. Put a nonempty string into the hold space to indicate this.
2095s/^.*$/P/
2096x
2097:d
2098'
2099changequote([,])dnl
2100
2101  # Set POTFILES to the value of the Makefile variable POTFILES.
2102  sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
2103  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
2104  # Compute POTFILES_DEPS as
2105  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
2106  POTFILES_DEPS=
2107  for file in $POTFILES; do
2108    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
2109  done
2110  POMAKEFILEDEPS=""
2111
2112  if test -n "$OBSOLETE_ALL_LINGUAS"; then
2113    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2114  fi
2115  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2116    # The LINGUAS file contains the set of available languages.
2117    ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2118    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2119  else
2120    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
2121    sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
2122    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
2123  fi
2124  # Hide the ALL_LINGUAS assigment from automake.
2125  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2126  # Compute POFILES
2127  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2128  # Compute UPDATEPOFILES
2129  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2130  # Compute DUMMYPOFILES
2131  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2132  # Compute GMOFILES
2133  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2134  # Compute PROPERTIESFILES
2135  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
2136  # Compute CLASSFILES
2137  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
2138  # Compute QMFILES
2139  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
2140  # Compute MSGFILES
2141  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
2142  # Compute RESOURCESDLLFILES
2143  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
2144  case "$ac_given_srcdir" in
2145    .) srcdirpre= ;;
2146    *) srcdirpre='$(srcdir)/' ;;
2147  esac
2148  POFILES=
2149  UPDATEPOFILES=
2150  DUMMYPOFILES=
2151  GMOFILES=
2152  PROPERTIESFILES=
2153  CLASSFILES=
2154  QMFILES=
2155  MSGFILES=
2156  RESOURCESDLLFILES=
2157  for lang in $ALL_LINGUAS; do
2158    POFILES="$POFILES $srcdirpre$lang.po"
2159    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2160    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2161    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2162    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
2163    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
2164    QMFILES="$QMFILES $srcdirpre$lang.qm"
2165    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2166    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
2167    frobbedlang=`echo $lang | sed -e 's/_/-/g'`
2168    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
2169  done
2170  # CATALOGS depends on both $ac_dir and the user's LINGUAS
2171  # environment variable.
2172  INST_LINGUAS=
2173  if test -n "$ALL_LINGUAS"; then
2174    for presentlang in $ALL_LINGUAS; do
2175      useit=no
2176      if test "%UNSET%" != "$LINGUAS"; then
2177        desiredlanguages="$LINGUAS"
2178      else
2179        desiredlanguages="$ALL_LINGUAS"
2180      fi
2181      for desiredlang in $desiredlanguages; do
2182        # Use the presentlang catalog if desiredlang is
2183        #   a. equal to presentlang, or
2184        #   b. a variant of presentlang (because in this case,
2185        #      presentlang can be used as a fallback for messages
2186        #      which are not translated in the desiredlang catalog).
2187        case "$desiredlang" in
2188          "$presentlang"*) useit=yes;;
2189        esac
2190      done
2191      if test $useit = yes; then
2192        INST_LINGUAS="$INST_LINGUAS $presentlang"
2193      fi
2194    done
2195  fi
2196  CATALOGS=
2197  JAVACATALOGS=
2198  QTCATALOGS=
2199  TCLCATALOGS=
2200  CSHARPCATALOGS=
2201  if test -n "$INST_LINGUAS"; then
2202    for lang in $INST_LINGUAS; do
2203      CATALOGS="$CATALOGS $lang.gmo"
2204      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
2205      QTCATALOGS="$QTCATALOGS $lang.qm"
2206      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2207      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
2208      frobbedlang=`echo $lang | sed -e 's/_/-/g'`
2209      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
2210    done
2211  fi
2212
2213  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"
2214  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
2215    # Add dependencies that cannot be formulated as a simple suffix rule.
2216    for lang in $ALL_LINGUAS; do
2217      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2218      cat >> "$ac_file.tmp" <<EOF
2219$frobbedlang.msg: $lang.po
2220	@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
2221	\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2222EOF
2223    done
2224  fi
2225  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
2226    # Add dependencies that cannot be formulated as a simple suffix rule.
2227    for lang in $ALL_LINGUAS; do
2228      frobbedlang=`echo $lang | sed -e 's/_/-/g'`
2229      cat >> "$ac_file.tmp" <<EOF
2230$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
2231	@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
2232	\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2233EOF
2234    done
2235  fi
2236  if test -n "$POMAKEFILEDEPS"; then
2237    cat >> "$ac_file.tmp" <<EOF
2238Makefile: $POMAKEFILEDEPS
2239EOF
2240  fi
2241  mv "$ac_file.tmp" "$ac_file"
2242])
2243# printf-posix.m4 serial 2 (gettext-0.13.1)
2244dnl Copyright (C) 2003 Free Software Foundation, Inc.
2245dnl This file is free software, distributed under the terms of the GNU
2246dnl General Public License.  As a special exception to the GNU General
2247dnl Public License, this file may be distributed as part of a program
2248dnl that contains a configuration script generated by Autoconf, under
2249dnl the same distribution terms as the rest of that program.
2250
2251dnl From Bruno Haible.
2252dnl Test whether the printf() function supports POSIX/XSI format strings with
2253dnl positions.
2254
2255AC_DEFUN([gt_PRINTF_POSIX],
2256[
2257  AC_REQUIRE([AC_PROG_CC])
2258  AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
2259    gt_cv_func_printf_posix,
2260    [
2261      AC_TRY_RUN([
2262#include <stdio.h>
2263#include <string.h>
2264/* The string "%2$d %1$d", with dollar characters protected from the shell's
2265   dollar expansion (possibly an autoconf bug).  */
2266static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
2267static char buf[100];
2268int main ()
2269{
2270  sprintf (buf, format, 33, 55);
2271  return (strcmp (buf, "55 33") != 0);
2272}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
2273      [
2274        AC_EGREP_CPP(notposix, [
2275#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
2276  notposix
2277#endif
2278        ], gt_cv_func_printf_posix="guessing no",
2279           gt_cv_func_printf_posix="guessing yes")
2280      ])
2281    ])
2282  case $gt_cv_func_printf_posix in
2283    *yes)
2284      AC_DEFINE(HAVE_POSIX_PRINTF, 1,
2285        [Define if your printf() function supports format strings with positions.])
2286      ;;
2287  esac
2288])
2289# progtest.m4 serial 3 (gettext-0.12)
2290dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2291dnl This file is free software, distributed under the terms of the GNU
2292dnl General Public License.  As a special exception to the GNU General
2293dnl Public License, this file may be distributed as part of a program
2294dnl that contains a configuration script generated by Autoconf, under
2295dnl the same distribution terms as the rest of that program.
2296dnl
2297dnl This file can can be used in projects which are not available under
2298dnl the GNU General Public License or the GNU Library General Public
2299dnl License but which still want to provide support for the GNU gettext
2300dnl functionality.
2301dnl Please note that the actual code of the GNU gettext library is covered
2302dnl by the GNU Library General Public License, and the rest of the GNU
2303dnl gettext package package is covered by the GNU General Public License.
2304dnl They are *not* in the public domain.
2305
2306dnl Authors:
2307dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2308
2309# Search path for a program which passes the given test.
2310
2311dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2312dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2313AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2314[
2315# Prepare PATH_SEPARATOR.
2316# The user is always right.
2317if test "${PATH_SEPARATOR+set}" != set; then
2318  echo "#! /bin/sh" >conf$$.sh
2319  echo  "exit 0"   >>conf$$.sh
2320  chmod +x conf$$.sh
2321  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2322    PATH_SEPARATOR=';'
2323  else
2324    PATH_SEPARATOR=:
2325  fi
2326  rm -f conf$$.sh
2327fi
2328
2329# Find out how to test for executable files. Don't use a zero-byte file,
2330# as systems may use methods other than mode bits to determine executability.
2331cat >conf$$.file <<_ASEOF
2332#! /bin/sh
2333exit 0
2334_ASEOF
2335chmod +x conf$$.file
2336if test -x conf$$.file >/dev/null 2>&1; then
2337  ac_executable_p="test -x"
2338else
2339  ac_executable_p="test -f"
2340fi
2341rm -f conf$$.file
2342
2343# Extract the first word of "$2", so it can be a program name with args.
2344set dummy $2; ac_word=[$]2
2345AC_MSG_CHECKING([for $ac_word])
2346AC_CACHE_VAL(ac_cv_path_$1,
2347[case "[$]$1" in
2348  [[\\/]]* | ?:[[\\/]]*)
2349    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2350    ;;
2351  *)
2352    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
2353    for ac_dir in ifelse([$5], , $PATH, [$5]); do
2354      IFS="$ac_save_IFS"
2355      test -z "$ac_dir" && ac_dir=.
2356      for ac_exec_ext in '' $ac_executable_extensions; do
2357        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
2358          if [$3]; then
2359            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
2360            break 2
2361          fi
2362        fi
2363      done
2364    done
2365    IFS="$ac_save_IFS"
2366dnl If no 4th arg is given, leave the cache variable unset,
2367dnl so AC_PATH_PROGS will keep looking.
2368ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2369])dnl
2370    ;;
2371esac])dnl
2372$1="$ac_cv_path_$1"
2373if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2374  AC_MSG_RESULT([$]$1)
2375else
2376  AC_MSG_RESULT(no)
2377fi
2378AC_SUBST($1)dnl
2379])
2380# signed.m4 serial 1 (gettext-0.10.40)
2381dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
2382dnl This file is free software, distributed under the terms of the GNU
2383dnl General Public License.  As a special exception to the GNU General
2384dnl Public License, this file may be distributed as part of a program
2385dnl that contains a configuration script generated by Autoconf, under
2386dnl the same distribution terms as the rest of that program.
2387
2388dnl From Bruno Haible.
2389
2390AC_DEFUN([bh_C_SIGNED],
2391[
2392  AC_CACHE_CHECK([for signed], bh_cv_c_signed,
2393   [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
2394  if test $bh_cv_c_signed = no; then
2395    AC_DEFINE(signed, ,
2396              [Define to empty if the C compiler doesn't support this keyword.])
2397  fi
2398])
2399# size_max.m4 serial 2
2400dnl Copyright (C) 2003 Free Software Foundation, Inc.
2401dnl This file is free software, distributed under the terms of the GNU
2402dnl General Public License.  As a special exception to the GNU General
2403dnl Public License, this file may be distributed as part of a program
2404dnl that contains a configuration script generated by Autoconf, under
2405dnl the same distribution terms as the rest of that program.
2406
2407dnl From Bruno Haible.
2408
2409AC_DEFUN([gl_SIZE_MAX],
2410[
2411  AC_CHECK_HEADERS(stdint.h)
2412  dnl First test whether the system already has SIZE_MAX.
2413  AC_MSG_CHECKING([for SIZE_MAX])
2414  result=
2415  AC_EGREP_CPP([Found it], [
2416#include <limits.h>
2417#if HAVE_STDINT_H
2418#include <stdint.h>
2419#endif
2420#ifdef SIZE_MAX
2421Found it
2422#endif
2423], result=yes)
2424  if test -z "$result"; then
2425    dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
2426    dnl than the type 'unsigned long'.
2427    dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
2428    dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
2429    _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
2430      [#include <stddef.h>], result=?)
2431    _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
2432      [#include <stddef.h>], result=?)
2433    _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
2434      [#include <stddef.h>], result=?)
2435    if test "$fits_in_uint" = 1; then
2436      dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
2437      dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
2438      AC_TRY_COMPILE([#include <stddef.h>
2439        extern size_t foo;
2440        extern unsigned long foo;
2441        ], [], fits_in_uint=0)
2442    fi
2443    if test -z "$result"; then
2444      if test "$fits_in_uint" = 1; then
2445        result="$res_hi$res_lo"U
2446      else
2447        result="$res_hi$res_lo"UL
2448      fi
2449    else
2450      dnl Shouldn't happen, but who knows...
2451      result='~(size_t)0'
2452    fi
2453  fi
2454  AC_MSG_RESULT([$result])
2455  if test "$result" != yes; then
2456    AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
2457      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
2458  fi
2459])
2460# stdint_h.m4 serial 3 (gettext-0.12)
2461dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2462dnl This file is free software, distributed under the terms of the GNU
2463dnl General Public License.  As a special exception to the GNU General
2464dnl Public License, this file may be distributed as part of a program
2465dnl that contains a configuration script generated by Autoconf, under
2466dnl the same distribution terms as the rest of that program.
2467
2468dnl From Paul Eggert.
2469
2470# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
2471# doesn't clash with <sys/types.h>, and declares uintmax_t.
2472
2473AC_DEFUN([jm_AC_HEADER_STDINT_H],
2474[
2475  AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
2476  [AC_TRY_COMPILE(
2477    [#include <sys/types.h>
2478#include <stdint.h>],
2479    [uintmax_t i = (uintmax_t) -1;],
2480    jm_ac_cv_header_stdint_h=yes,
2481    jm_ac_cv_header_stdint_h=no)])
2482  if test $jm_ac_cv_header_stdint_h = yes; then
2483    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
2484      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
2485       and declares uintmax_t. ])
2486  fi
2487])
2488# uintmax_t.m4 serial 7 (gettext-0.12)
2489dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2490dnl This file is free software, distributed under the terms of the GNU
2491dnl General Public License.  As a special exception to the GNU General
2492dnl Public License, this file may be distributed as part of a program
2493dnl that contains a configuration script generated by Autoconf, under
2494dnl the same distribution terms as the rest of that program.
2495
2496dnl From Paul Eggert.
2497
2498AC_PREREQ(2.13)
2499
2500# Define uintmax_t to 'unsigned long' or 'unsigned long long'
2501# if it is not already defined in <stdint.h> or <inttypes.h>.
2502
2503AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
2504[
2505  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2506  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
2507  if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
2508    AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2509    test $ac_cv_type_unsigned_long_long = yes \
2510      && ac_type='unsigned long long' \
2511      || ac_type='unsigned long'
2512    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2513      [Define to unsigned long or unsigned long long
2514       if <stdint.h> and <inttypes.h> don't define.])
2515  else
2516    AC_DEFINE(HAVE_UINTMAX_T, 1,
2517      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
2518  fi
2519])
2520# ulonglong.m4 serial 3
2521dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
2522dnl This file is free software, distributed under the terms of the GNU
2523dnl General Public License.  As a special exception to the GNU General
2524dnl Public License, this file may be distributed as part of a program
2525dnl that contains a configuration script generated by Autoconf, under
2526dnl the same distribution terms as the rest of that program.
2527
2528dnl From Paul Eggert.
2529
2530# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
2531
2532AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
2533[
2534  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
2535  [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
2536    [unsigned long long ullmax = (unsigned long long) -1;
2537     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
2538    ac_cv_type_unsigned_long_long=yes,
2539    ac_cv_type_unsigned_long_long=no)])
2540  if test $ac_cv_type_unsigned_long_long = yes; then
2541    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
2542      [Define if you have the 'unsigned long long' type.])
2543  fi
2544])
2545# wchar_t.m4 serial 1 (gettext-0.12)
2546dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
2547dnl This file is free software, distributed under the terms of the GNU
2548dnl General Public License.  As a special exception to the GNU General
2549dnl Public License, this file may be distributed as part of a program
2550dnl that contains a configuration script generated by Autoconf, under
2551dnl the same distribution terms as the rest of that program.
2552
2553dnl From Bruno Haible.
2554dnl Test whether <stddef.h> has the 'wchar_t' type.
2555dnl Prerequisite: AC_PROG_CC
2556
2557AC_DEFUN([gt_TYPE_WCHAR_T],
2558[
2559  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
2560    [AC_TRY_COMPILE([#include <stddef.h>
2561       wchar_t foo = (wchar_t)'\0';], ,
2562       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
2563  if test $gt_cv_c_wchar_t = yes; then
2564    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
2565  fi
2566])
2567# wint_t.m4 serial 1 (gettext-0.12)
2568dnl Copyright (C) 2003 Free Software Foundation, Inc.
2569dnl This file is free software, distributed under the terms of the GNU
2570dnl General Public License.  As a special exception to the GNU General
2571dnl Public License, this file may be distributed as part of a program
2572dnl that contains a configuration script generated by Autoconf, under
2573dnl the same distribution terms as the rest of that program.
2574
2575dnl From Bruno Haible.
2576dnl Test whether <wchar.h> has the 'wint_t' type.
2577dnl Prerequisite: AC_PROG_CC
2578
2579AC_DEFUN([gt_TYPE_WINT_T],
2580[
2581  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
2582    [AC_TRY_COMPILE([#include <wchar.h>
2583       wint_t foo = (wchar_t)'\0';], ,
2584       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
2585  if test $gt_cv_c_wint_t = yes; then
2586    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
2587  fi
2588])
2589# xsize.m4 serial 2
2590dnl Copyright (C) 2003 Free Software Foundation, Inc.
2591dnl This file is free software, distributed under the terms of the GNU
2592dnl General Public License.  As a special exception to the GNU General
2593dnl Public License, this file may be distributed as part of a program
2594dnl that contains a configuration script generated by Autoconf, under
2595dnl the same distribution terms as the rest of that program.
2596
2597AC_DEFUN([gl_XSIZE],
2598[
2599  dnl Prerequisites of lib/xsize.h.
2600  AC_REQUIRE([gl_SIZE_MAX])
2601  AC_CHECK_HEADERS(stdint.h)
2602])
2603
2604# from http://autoconf-archive.cryp.to/ax_tls.html
2605#
2606# This was licensed under the GPL with the following exception:
2607#
2608# As a special exception, the respective Autoconf Macro's copyright
2609# owner gives unlimited permission to copy, distribute and modify the
2610# configure scripts that are the output of Autoconf when processing
2611# the Macro. You need not follow the terms of the GNU General Public
2612# License when using or distributing such scripts, even though
2613# portions of the text of the Macro appear in them. The GNU General
2614# Public License (GPL) does govern all other use of the material that
2615# constitutes the Autoconf Macro.
2616#
2617# This special exception to the GPL applies to versions of the
2618# Autoconf Macro released by the Autoconf Macro Archive. When you make
2619# and distribute a modified version of the Autoconf Macro, you may
2620# extend this special exception to the GPL to apply to your modified
2621# version as well.
2622#
2623AC_DEFUN([AX_TLS], [
2624  AC_MSG_CHECKING(for thread local storage (TLS) class)
2625  AC_CACHE_VAL(ac_cv_tls, [
2626    ax_tls_keywords="__thread __declspec(thread) none"
2627    for ax_tls_keyword in $ax_tls_keywords; do
2628       case $ax_tls_keyword in
2629          none) ac_cv_tls=none ; break ;;
2630          *)
2631             AC_TRY_COMPILE(
2632                [#include <stdlib.h>
2633                 static void
2634                 foo(void) {
2635                 static ] $ax_tls_keyword [ int bar;
2636                 exit(1);
2637                 }],
2638                 [],
2639                 [ac_cv_tls=$ax_tls_keyword ; break],
2640                 ac_cv_tls=none
2641             )
2642          esac
2643    done
2644])
2645
2646  if test "$ac_cv_tls" != "none"; then
2647    dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here])
2648    AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
2649  fi
2650  AC_MSG_RESULT($ac_cv_tls)
2651])
2652
2653# Excerpted from pkg.m4 - Macros to locate and utilise pkg-config
2654#
2655# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2656#
2657# This program is free software; you can redistribute it and/or modify
2658# it under the terms of the GNU General Public License as published by
2659# the Free Software Foundation; either version 2 of the License, or
2660# (at your option) any later version.
2661#
2662# This program is distributed in the hope that it will be useful, but
2663# WITHOUT ANY WARRANTY; without even the implied warranty of
2664# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2665# General Public License for more details.
2666#
2667# You should have received a copy of the GNU General Public License
2668# along with this program; if not, write to the Free Software
2669# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2670#
2671# As a special exception to the GNU General Public License, if you
2672# distribute this file as part of a program that contains a
2673# configuration script generated by Autoconf, you may include it under
2674# the same distribution terms that you use for the rest of that program.
2675
2676# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2677# ----------------------------------
2678AC_DEFUN([PKG_PROG_PKG_CONFIG],
2679[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2680m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2681AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2682if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2683        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2684fi
2685if test -n "$PKG_CONFIG"; then
2686        _pkg_min_version=m4_default([$1], [0.9.0])
2687        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2688        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2689                AC_MSG_RESULT([yes])
2690        else
2691                AC_MSG_RESULT([no])
2692                PKG_CONFIG=""
2693        fi
2694               
2695fi[]dnl
2696])# PKG_PROG_PKG_CONFIG
2697# ===========================================================================
2698#         http://www.nongnu.org/autoconf-archive/check_gnu_make.html
2699# ===========================================================================
2700#
2701# SYNOPSIS
2702#
2703#   CHECK_GNU_MAKE()
2704#
2705# DESCRIPTION
2706#
2707#   This macro searches for a GNU version of make. If a match is found, the
2708#   makefile variable `ifGNUmake' is set to the empty string, otherwise it
2709#   is set to "#". This is useful for including a special features in a
2710#   Makefile, which cannot be handled by other versions of make. The
2711#   variable _cv_gnu_make_command is set to the command to invoke GNU make
2712#   if it exists, the empty string otherwise.
2713#
2714#   Here is an example of its use:
2715#
2716#   Makefile.in might contain:
2717#
2718#       # A failsafe way of putting a dependency rule into a makefile
2719#       $(DEPEND):
2720#               $(CC) -MM $(srcdir)/*.c > $(DEPEND)
2721#
2722#       @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
2723#       @ifGNUmake@ include $(DEPEND)
2724#       @ifGNUmake@ endif
2725#
2726#   Then configure.in would normally contain:
2727#
2728#       CHECK_GNU_MAKE()
2729#       AC_OUTPUT(Makefile)
2730#
2731#   Then perhaps to cause gnu make to override any other make, we could do
2732#   something like this (note that GNU make always looks for GNUmakefile
2733#   first):
2734#
2735#       if  ! test x$_cv_gnu_make_command = x ; then
2736#               mv Makefile GNUmakefile
2737#               echo .DEFAULT: > Makefile ;
2738#               echo \  $_cv_gnu_make_command \$@ >> Makefile;
2739#       fi
2740#
2741#   Then, if any (well almost any) other make is called, and GNU make also
2742#   exists, then the other make wraps the GNU make.
2743#
2744# LICENSE
2745#
2746#   Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
2747#
2748#   Copying and distribution of this file, with or without modification, are
2749#   permitted in any medium without royalty provided the copyright notice
2750#   and this notice are preserved.
2751#
2752# Note: Modified by Ted Ts'o to add @ifNotGNUMake@
2753
2754AC_DEFUN(
2755        [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
2756                _cv_gnu_make_command='' ;
2757dnl Search all the common names for GNU make
2758                for a in "$MAKE" make gmake gnumake ; do
2759                        if test -z "$a" ; then continue ; fi ;
2760                        if  ( sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null ) ;  then
2761                                _cv_gnu_make_command=$a ;
2762                                break;
2763                        fi
2764                done ;
2765        ) ;
2766dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
2767        if test  "x$_cv_gnu_make_command" != "x"  ; then
2768                ifGNUmake='' ;
2769                ifNotGNUmake='#' ;
2770        else
2771                ifGNUmake='#' ;
2772                ifNotGNUmake='' ;
2773                AC_MSG_RESULT("Not found");
2774        fi
2775        AC_SUBST(ifGNUmake)
2776        AC_SUBST(ifNotGNUmake)
2777] )
2778