1# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14# codeset.m4 serial 4 (gettext-0.18)
15dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc.
16dnl This file is free software; the Free Software Foundation
17dnl gives unlimited permission to copy and/or distribute it,
18dnl with or without modifications, as long as this notice is preserved.
19
20dnl From Bruno Haible.
21
22AC_DEFUN([AM_LANGINFO_CODESET],
23[
24  AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
25    [AC_TRY_LINK([#include <langinfo.h>],
26      [char* cs = nl_langinfo(CODESET); return !cs;],
27      [am_cv_langinfo_codeset=yes],
28      [am_cv_langinfo_codeset=no])
29    ])
30  if test $am_cv_langinfo_codeset = yes; then
31    AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
32      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
33  fi
34])
35
36# gettext.m4 serial 63 (gettext-0.18)
37dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
38dnl This file is free software; the Free Software Foundation
39dnl gives unlimited permission to copy and/or distribute it,
40dnl with or without modifications, as long as this notice is preserved.
41dnl
42dnl This file can can be used in projects which are not available under
43dnl the GNU General Public License or the GNU Library General Public
44dnl License but which still want to provide support for the GNU gettext
45dnl functionality.
46dnl Please note that the actual code of the GNU gettext library is covered
47dnl by the GNU Library General Public License, and the rest of the GNU
48dnl gettext package package is covered by the GNU General Public License.
49dnl They are *not* in the public domain.
50
51dnl Authors:
52dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
53dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
54
55dnl Macro to add for using GNU gettext.
56
57dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
58dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
59dnl    default (if it is not specified or empty) is 'no-libtool'.
60dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
61dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
62dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
63dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
64dnl    depending on --{enable,disable}-{shared,static} and on the presence of
65dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
66dnl    $(top_builddir)/intl/libintl.a will be created.
67dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
68dnl    implementations (in libc or libintl) without the ngettext() function
69dnl    will be ignored.  If NEEDSYMBOL is specified and is
70dnl    'need-formatstring-macros', then GNU gettext implementations that don't
71dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
72dnl INTLDIR is used to find the intl libraries.  If empty,
73dnl    the value `$(top_builddir)/intl/' is used.
74dnl
75dnl The result of the configuration is one of three cases:
76dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
77dnl    and used.
78dnl    Catalog format: GNU --> install in $(datadir)
79dnl    Catalog extension: .mo after installation, .gmo in source tree
80dnl 2) GNU gettext has been found in the system's C library.
81dnl    Catalog format: GNU --> install in $(datadir)
82dnl    Catalog extension: .mo after installation, .gmo in source tree
83dnl 3) No internationalization, always use English msgid.
84dnl    Catalog format: none
85dnl    Catalog extension: none
86dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
87dnl The use of .gmo is historical (it was needed to avoid overwriting the
88dnl GNU format catalogs when building on a platform with an X/Open gettext),
89dnl but we keep it in order not to force irrelevant filename changes on the
90dnl maintainers.
91dnl
92AC_DEFUN([AM_GNU_GETTEXT],
93[
94  dnl Argument checking.
95  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
96    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
97])])])])])
98  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
99    [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
100  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
101    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
102])])])])
103  define([gt_included_intl],
104    ifelse([$1], [external],
105      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
106      [yes]))
107  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
108  gt_NEEDS_INIT
109  AM_GNU_GETTEXT_NEED([$2])
110
111  AC_REQUIRE([AM_PO_SUBDIRS])dnl
112  ifelse(gt_included_intl, yes, [
113    AC_REQUIRE([AM_INTL_SUBDIR])dnl
114  ])
115
116  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
117  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
118  AC_REQUIRE([AC_LIB_RPATH])
119
120  dnl Sometimes libintl requires libiconv, so first search for libiconv.
121  dnl Ideally we would do this search only after the
122  dnl      if test "$USE_NLS" = "yes"; then
123  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
124  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
125  dnl the configure script would need to contain the same shell code
126  dnl again, outside any 'if'. There are two solutions:
127  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
128  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
129  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
130  dnl documented, we avoid it.
131  ifelse(gt_included_intl, yes, , [
132    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
133  ])
134
135  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
136  gt_INTL_MACOSX
137
138  dnl Set USE_NLS.
139  AC_REQUIRE([AM_NLS])
140
141  ifelse(gt_included_intl, yes, [
142    BUILD_INCLUDED_LIBINTL=no
143    USE_INCLUDED_LIBINTL=no
144  ])
145  LIBINTL=
146  LTLIBINTL=
147  POSUB=
148
149  dnl Add a version number to the cache macros.
150  case " $gt_needs " in
151    *" need-formatstring-macros "*) gt_api_version=3 ;;
152    *" need-ngettext "*) gt_api_version=2 ;;
153    *) gt_api_version=1 ;;
154  esac
155  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
156  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
157
158  dnl If we use NLS figure out what method
159  if test "$USE_NLS" = "yes"; then
160    gt_use_preinstalled_gnugettext=no
161    ifelse(gt_included_intl, yes, [
162      AC_MSG_CHECKING([whether included gettext is requested])
163      AC_ARG_WITH([included-gettext],
164        [  --with-included-gettext use the GNU gettext library included here],
165        nls_cv_force_use_gnu_gettext=$withval,
166        nls_cv_force_use_gnu_gettext=no)
167      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
168
169      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
170      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
171    ])
172        dnl User does not insist on using GNU NLS library.  Figure out what
173        dnl to use.  If GNU gettext is available we use this.  Else we have
174        dnl to fall back to GNU NLS library.
175
176        if test $gt_api_version -ge 3; then
177          gt_revision_test_code='
178#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
179#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
180#endif
181changequote(,)dnl
182typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
183changequote([,])dnl
184'
185        else
186          gt_revision_test_code=
187        fi
188        if test $gt_api_version -ge 2; then
189          gt_expression_test_code=' + * ngettext ("", "", 0)'
190        else
191          gt_expression_test_code=
192        fi
193
194        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
195         [AC_TRY_LINK([#include <libintl.h>
196$gt_revision_test_code
197extern int _nl_msg_cat_cntr;
198extern int *_nl_domain_bindings;],
199            [bindtextdomain ("", "");
200return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
201            [eval "$gt_func_gnugettext_libc=yes"],
202            [eval "$gt_func_gnugettext_libc=no"])])
203
204        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
205          dnl Sometimes libintl requires libiconv, so first search for libiconv.
206          ifelse(gt_included_intl, yes, , [
207            AM_ICONV_LINK
208          ])
209          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
210          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
211          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
212          dnl even if libiconv doesn't exist.
213          AC_LIB_LINKFLAGS_BODY([intl])
214          AC_CACHE_CHECK([for GNU gettext in libintl],
215            [$gt_func_gnugettext_libintl],
216           [gt_save_CPPFLAGS="$CPPFLAGS"
217            CPPFLAGS="$CPPFLAGS $INCINTL"
218            gt_save_LIBS="$LIBS"
219            LIBS="$LIBS $LIBINTL"
220            dnl Now see whether libintl exists and does not depend on libiconv.
221            AC_TRY_LINK([#include <libintl.h>
222$gt_revision_test_code
223extern int _nl_msg_cat_cntr;
224extern
225#ifdef __cplusplus
226"C"
227#endif
228const char *_nl_expand_alias (const char *);],
229              [bindtextdomain ("", "");
230return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
231              [eval "$gt_func_gnugettext_libintl=yes"],
232              [eval "$gt_func_gnugettext_libintl=no"])
233            dnl Now see whether libintl exists and depends on libiconv.
234            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
235              LIBS="$LIBS $LIBICONV"
236              AC_TRY_LINK([#include <libintl.h>
237$gt_revision_test_code
238extern int _nl_msg_cat_cntr;
239extern
240#ifdef __cplusplus
241"C"
242#endif
243const char *_nl_expand_alias (const char *);],
244                [bindtextdomain ("", "");
245return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
246               [LIBINTL="$LIBINTL $LIBICONV"
247                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
248                eval "$gt_func_gnugettext_libintl=yes"
249               ])
250            fi
251            CPPFLAGS="$gt_save_CPPFLAGS"
252            LIBS="$gt_save_LIBS"])
253        fi
254
255        dnl If an already present or preinstalled GNU gettext() is found,
256        dnl use it.  But if this macro is used in GNU gettext, and GNU
257        dnl gettext is already preinstalled in libintl, we update this
258        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
259        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
260           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
261                && test "$PACKAGE" != gettext-runtime \
262                && test "$PACKAGE" != gettext-tools; }; then
263          gt_use_preinstalled_gnugettext=yes
264        else
265          dnl Reset the values set by searching for libintl.
266          LIBINTL=
267          LTLIBINTL=
268          INCINTL=
269        fi
270
271    ifelse(gt_included_intl, yes, [
272        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
273          dnl GNU gettext is not found in the C library.
274          dnl Fall back on included GNU gettext library.
275          nls_cv_use_gnu_gettext=yes
276        fi
277      fi
278
279      if test "$nls_cv_use_gnu_gettext" = "yes"; then
280        dnl Mark actions used to generate GNU NLS library.
281        BUILD_INCLUDED_LIBINTL=yes
282        USE_INCLUDED_LIBINTL=yes
283        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
284        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
285        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
286      fi
287
288      CATOBJEXT=
289      if test "$gt_use_preinstalled_gnugettext" = "yes" \
290         || test "$nls_cv_use_gnu_gettext" = "yes"; then
291        dnl Mark actions to use GNU gettext tools.
292        CATOBJEXT=.gmo
293      fi
294    ])
295
296    if test -n "$INTL_MACOSX_LIBS"; then
297      if test "$gt_use_preinstalled_gnugettext" = "yes" \
298         || test "$nls_cv_use_gnu_gettext" = "yes"; then
299        dnl Some extra flags are needed during linking.
300        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
301        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
302      fi
303    fi
304
305    if test "$gt_use_preinstalled_gnugettext" = "yes" \
306       || test "$nls_cv_use_gnu_gettext" = "yes"; then
307      AC_DEFINE([ENABLE_NLS], [1],
308        [Define to 1 if translation of program messages to the user's native language
309   is requested.])
310    else
311      USE_NLS=no
312    fi
313  fi
314
315  AC_MSG_CHECKING([whether to use NLS])
316  AC_MSG_RESULT([$USE_NLS])
317  if test "$USE_NLS" = "yes"; then
318    AC_MSG_CHECKING([where the gettext function comes from])
319    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
320      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
321        gt_source="external libintl"
322      else
323        gt_source="libc"
324      fi
325    else
326      gt_source="included intl directory"
327    fi
328    AC_MSG_RESULT([$gt_source])
329  fi
330
331  if test "$USE_NLS" = "yes"; then
332
333    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
334      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
335        AC_MSG_CHECKING([how to link with libintl])
336        AC_MSG_RESULT([$LIBINTL])
337        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
338      fi
339
340      dnl For backward compatibility. Some packages may be using this.
341      AC_DEFINE([HAVE_GETTEXT], [1],
342       [Define if the GNU gettext() function is already present or preinstalled.])
343      AC_DEFINE([HAVE_DCGETTEXT], [1],
344       [Define if the GNU dcgettext() function is already present or preinstalled.])
345    fi
346
347    dnl We need to process the po/ directory.
348    POSUB=po
349  fi
350
351  ifelse(gt_included_intl, yes, [
352    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
353    dnl to 'yes' because some of the testsuite requires it.
354    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
355      BUILD_INCLUDED_LIBINTL=yes
356    fi
357
358    dnl Make all variables we use known to autoconf.
359    AC_SUBST([BUILD_INCLUDED_LIBINTL])
360    AC_SUBST([USE_INCLUDED_LIBINTL])
361    AC_SUBST([CATOBJEXT])
362
363    dnl For backward compatibility. Some configure.ins may be using this.
364    nls_cv_header_intl=
365    nls_cv_header_libgt=
366
367    dnl For backward compatibility. Some Makefiles may be using this.
368    DATADIRNAME=share
369    AC_SUBST([DATADIRNAME])
370
371    dnl For backward compatibility. Some Makefiles may be using this.
372    INSTOBJEXT=.mo
373    AC_SUBST([INSTOBJEXT])
374
375    dnl For backward compatibility. Some Makefiles may be using this.
376    GENCAT=gencat
377    AC_SUBST([GENCAT])
378
379    dnl For backward compatibility. Some Makefiles may be using this.
380    INTLOBJS=
381    if test "$USE_INCLUDED_LIBINTL" = yes; then
382      INTLOBJS="\$(GETTOBJS)"
383    fi
384    AC_SUBST([INTLOBJS])
385
386    dnl Enable libtool support if the surrounding package wishes it.
387    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
388    AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
389  ])
390
391  dnl For backward compatibility. Some Makefiles may be using this.
392  INTLLIBS="$LIBINTL"
393  AC_SUBST([INTLLIBS])
394
395  dnl Make all documented variables known to autoconf.
396  AC_SUBST([LIBINTL])
397  AC_SUBST([LTLIBINTL])
398  AC_SUBST([POSUB])
399])
400
401
402dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
403m4_define([gt_NEEDS_INIT],
404[
405  m4_divert_text([DEFAULTS], [gt_needs=])
406  m4_define([gt_NEEDS_INIT], [])
407])
408
409
410dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
411AC_DEFUN([AM_GNU_GETTEXT_NEED],
412[
413  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
414])
415
416
417dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
418AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
419
420# iconv.m4 serial 11 (gettext-0.18.1)
421dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
422dnl This file is free software; the Free Software Foundation
423dnl gives unlimited permission to copy and/or distribute it,
424dnl with or without modifications, as long as this notice is preserved.
425
426dnl From Bruno Haible.
427
428AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
429[
430  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
431  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
432  AC_REQUIRE([AC_LIB_RPATH])
433
434  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
435  dnl accordingly.
436  AC_LIB_LINKFLAGS_BODY([iconv])
437])
438
439AC_DEFUN([AM_ICONV_LINK],
440[
441  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
442  dnl those with the standalone portable GNU libiconv installed).
443  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
444
445  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
446  dnl accordingly.
447  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
448
449  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
450  dnl because if the user has installed libiconv and not disabled its use
451  dnl via --without-libiconv-prefix, he wants to use it. The first
452  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
453  am_save_CPPFLAGS="$CPPFLAGS"
454  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
455
456  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
457    am_cv_func_iconv="no, consider installing GNU libiconv"
458    am_cv_lib_iconv=no
459    AC_TRY_LINK([#include <stdlib.h>
460#include <iconv.h>],
461      [iconv_t cd = iconv_open("","");
462       iconv(cd,NULL,NULL,NULL,NULL);
463       iconv_close(cd);],
464      [am_cv_func_iconv=yes])
465    if test "$am_cv_func_iconv" != yes; then
466      am_save_LIBS="$LIBS"
467      LIBS="$LIBS $LIBICONV"
468      AC_TRY_LINK([#include <stdlib.h>
469#include <iconv.h>],
470        [iconv_t cd = iconv_open("","");
471         iconv(cd,NULL,NULL,NULL,NULL);
472         iconv_close(cd);],
473        [am_cv_lib_iconv=yes]
474        [am_cv_func_iconv=yes])
475      LIBS="$am_save_LIBS"
476    fi
477  ])
478  if test "$am_cv_func_iconv" = yes; then
479    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
480      dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
481      am_save_LIBS="$LIBS"
482      if test $am_cv_lib_iconv = yes; then
483        LIBS="$LIBS $LIBICONV"
484      fi
485      AC_TRY_RUN([
486#include <iconv.h>
487#include <string.h>
488int main ()
489{
490  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
491     returns.  */
492  {
493    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
494    if (cd_utf8_to_88591 != (iconv_t)(-1))
495      {
496        static const char input[] = "\342\202\254"; /* EURO SIGN */
497        char buf[10];
498        const char *inptr = input;
499        size_t inbytesleft = strlen (input);
500        char *outptr = buf;
501        size_t outbytesleft = sizeof (buf);
502        size_t res = iconv (cd_utf8_to_88591,
503                            (char **) &inptr, &inbytesleft,
504                            &outptr, &outbytesleft);
505        if (res == 0)
506          return 1;
507      }
508  }
509  /* Test against Solaris 10 bug: Failures are not distinguishable from
510     successful returns.  */
511  {
512    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
513    if (cd_ascii_to_88591 != (iconv_t)(-1))
514      {
515        static const char input[] = "\263";
516        char buf[10];
517        const char *inptr = input;
518        size_t inbytesleft = strlen (input);
519        char *outptr = buf;
520        size_t outbytesleft = sizeof (buf);
521        size_t res = iconv (cd_ascii_to_88591,
522                            (char **) &inptr, &inbytesleft,
523                            &outptr, &outbytesleft);
524        if (res == 0)
525          return 1;
526      }
527  }
528#if 0 /* This bug could be worked around by the caller.  */
529  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
530  {
531    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
532    if (cd_88591_to_utf8 != (iconv_t)(-1))
533      {
534        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
535        char buf[50];
536        const char *inptr = input;
537        size_t inbytesleft = strlen (input);
538        char *outptr = buf;
539        size_t outbytesleft = sizeof (buf);
540        size_t res = iconv (cd_88591_to_utf8,
541                            (char **) &inptr, &inbytesleft,
542                            &outptr, &outbytesleft);
543        if ((int)res > 0)
544          return 1;
545      }
546  }
547#endif
548  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
549     provided.  */
550  if (/* Try standardized names.  */
551      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
552      /* Try IRIX, OSF/1 names.  */
553      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
554      /* Try AIX names.  */
555      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
556      /* Try HP-UX names.  */
557      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
558    return 1;
559  return 0;
560}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
561        [case "$host_os" in
562           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
563           *)            am_cv_func_iconv_works="guessing yes" ;;
564         esac])
565      LIBS="$am_save_LIBS"
566    ])
567    case "$am_cv_func_iconv_works" in
568      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
569      *)   am_func_iconv=yes ;;
570    esac
571  else
572    am_func_iconv=no am_cv_lib_iconv=no
573  fi
574  if test "$am_func_iconv" = yes; then
575    AC_DEFINE([HAVE_ICONV], [1],
576      [Define if you have the iconv() function and it works.])
577  fi
578  if test "$am_cv_lib_iconv" = yes; then
579    AC_MSG_CHECKING([how to link with libiconv])
580    AC_MSG_RESULT([$LIBICONV])
581  else
582    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
583    dnl either.
584    CPPFLAGS="$am_save_CPPFLAGS"
585    LIBICONV=
586    LTLIBICONV=
587  fi
588  AC_SUBST([LIBICONV])
589  AC_SUBST([LTLIBICONV])
590])
591
592dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
593dnl avoid warnings like
594dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
595dnl This is tricky because of the way 'aclocal' is implemented:
596dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
597dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
598dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
599dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
600dnl   warnings.
601m4_define([gl_iconv_AC_DEFUN],
602  m4_version_prereq([2.64],
603    [[AC_DEFUN_ONCE(
604        [$1], [$2])]],
605    [[AC_DEFUN(
606        [$1], [$2])]]))
607gl_iconv_AC_DEFUN([AM_ICONV],
608[
609  AM_ICONV_LINK
610  if test "$am_cv_func_iconv" = yes; then
611    AC_MSG_CHECKING([for iconv declaration])
612    AC_CACHE_VAL([am_cv_proto_iconv], [
613      AC_TRY_COMPILE([
614#include <stdlib.h>
615#include <iconv.h>
616extern
617#ifdef __cplusplus
618"C"
619#endif
620#if defined(__STDC__) || defined(__cplusplus)
621size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
622#else
623size_t iconv();
624#endif
625], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
626      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);"])
627    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
628    AC_MSG_RESULT([
629         $am_cv_proto_iconv])
630    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
631      [Define as const if the declaration of iconv() needs const.])
632  fi
633])
634
635# intlmacosx.m4 serial 3 (gettext-0.18)
636dnl Copyright (C) 2004-2010 Free Software Foundation, Inc.
637dnl This file is free software; the Free Software Foundation
638dnl gives unlimited permission to copy and/or distribute it,
639dnl with or without modifications, as long as this notice is preserved.
640dnl
641dnl This file can can be used in projects which are not available under
642dnl the GNU General Public License or the GNU Library General Public
643dnl License but which still want to provide support for the GNU gettext
644dnl functionality.
645dnl Please note that the actual code of the GNU gettext library is covered
646dnl by the GNU Library General Public License, and the rest of the GNU
647dnl gettext package package is covered by the GNU General Public License.
648dnl They are *not* in the public domain.
649
650dnl Checks for special options needed on MacOS X.
651dnl Defines INTL_MACOSX_LIBS.
652AC_DEFUN([gt_INTL_MACOSX],
653[
654  dnl Check for API introduced in MacOS X 10.2.
655  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
656    [gt_cv_func_CFPreferencesCopyAppValue],
657    [gt_save_LIBS="$LIBS"
658     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
659     AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
660       [CFPreferencesCopyAppValue(NULL, NULL)],
661       [gt_cv_func_CFPreferencesCopyAppValue=yes],
662       [gt_cv_func_CFPreferencesCopyAppValue=no])
663     LIBS="$gt_save_LIBS"])
664  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
665    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
666      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
667  fi
668  dnl Check for API introduced in MacOS X 10.3.
669  AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
670    [gt_save_LIBS="$LIBS"
671     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
672     AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
673       [gt_cv_func_CFLocaleCopyCurrent=yes],
674       [gt_cv_func_CFLocaleCopyCurrent=no])
675     LIBS="$gt_save_LIBS"])
676  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
677    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
678      [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
679  fi
680  INTL_MACOSX_LIBS=
681  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
682    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
683  fi
684  AC_SUBST([INTL_MACOSX_LIBS])
685])
686
687# lib-ld.m4 serial 4 (gettext-0.18)
688dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
689dnl This file is free software; the Free Software Foundation
690dnl gives unlimited permission to copy and/or distribute it,
691dnl with or without modifications, as long as this notice is preserved.
692
693dnl Subroutines of libtool.m4,
694dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
695dnl with libtool.m4.
696
697dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
698AC_DEFUN([AC_LIB_PROG_LD_GNU],
699[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
700[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
701case `$LD -v 2>&1 </dev/null` in
702*GNU* | *'with BFD'*)
703  acl_cv_prog_gnu_ld=yes ;;
704*)
705  acl_cv_prog_gnu_ld=no ;;
706esac])
707with_gnu_ld=$acl_cv_prog_gnu_ld
708])
709
710dnl From libtool-1.4. Sets the variable LD.
711AC_DEFUN([AC_LIB_PROG_LD],
712[AC_ARG_WITH([gnu-ld],
713[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
714test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
715AC_REQUIRE([AC_PROG_CC])dnl
716AC_REQUIRE([AC_CANONICAL_HOST])dnl
717# Prepare PATH_SEPARATOR.
718# The user is always right.
719if test "${PATH_SEPARATOR+set}" != set; then
720  echo "#! /bin/sh" >conf$$.sh
721  echo  "exit 0"   >>conf$$.sh
722  chmod +x conf$$.sh
723  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
724    PATH_SEPARATOR=';'
725  else
726    PATH_SEPARATOR=:
727  fi
728  rm -f conf$$.sh
729fi
730ac_prog=ld
731if test "$GCC" = yes; then
732  # Check if gcc -print-prog-name=ld gives a path.
733  AC_MSG_CHECKING([for ld used by GCC])
734  case $host in
735  *-*-mingw*)
736    # gcc leaves a trailing carriage return which upsets mingw
737    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
738  *)
739    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
740  esac
741  case $ac_prog in
742    # Accept absolute paths.
743    [[\\/]* | [A-Za-z]:[\\/]*)]
744      [re_direlt='/[^/][^/]*/\.\./']
745      # Canonicalize the path of ld
746      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
747      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
748        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
749      done
750      test -z "$LD" && LD="$ac_prog"
751      ;;
752  "")
753    # If it fails, then pretend we aren't using GCC.
754    ac_prog=ld
755    ;;
756  *)
757    # If it is relative, then search for the first ld in PATH.
758    with_gnu_ld=unknown
759    ;;
760  esac
761elif test "$with_gnu_ld" = yes; then
762  AC_MSG_CHECKING([for GNU ld])
763else
764  AC_MSG_CHECKING([for non-GNU ld])
765fi
766AC_CACHE_VAL([acl_cv_path_LD],
767[if test -z "$LD"; then
768  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
769  for ac_dir in $PATH; do
770    test -z "$ac_dir" && ac_dir=.
771    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
772      acl_cv_path_LD="$ac_dir/$ac_prog"
773      # Check to see if the program is GNU ld.  I'd rather use --version,
774      # but apparently some GNU ld's only accept -v.
775      # Break only if it was the GNU/non-GNU ld that we prefer.
776      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
777      *GNU* | *'with BFD'*)
778        test "$with_gnu_ld" != no && break ;;
779      *)
780        test "$with_gnu_ld" != yes && break ;;
781      esac
782    fi
783  done
784  IFS="$ac_save_ifs"
785else
786  acl_cv_path_LD="$LD" # Let the user override the test with a path.
787fi])
788LD="$acl_cv_path_LD"
789if test -n "$LD"; then
790  AC_MSG_RESULT([$LD])
791else
792  AC_MSG_RESULT([no])
793fi
794test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
795AC_LIB_PROG_LD_GNU
796])
797
798# lib-link.m4 serial 21 (gettext-0.18)
799dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
800dnl This file is free software; the Free Software Foundation
801dnl gives unlimited permission to copy and/or distribute it,
802dnl with or without modifications, as long as this notice is preserved.
803
804dnl From Bruno Haible.
805
806AC_PREREQ([2.54])
807
808dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
809dnl the libraries corresponding to explicit and implicit dependencies.
810dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
811dnl augments the CPPFLAGS variable.
812dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
813dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
814AC_DEFUN([AC_LIB_LINKFLAGS],
815[
816  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
817  AC_REQUIRE([AC_LIB_RPATH])
818  pushdef([Name],[translit([$1],[./-], [___])])
819  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
820                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
821  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
822    AC_LIB_LINKFLAGS_BODY([$1], [$2])
823    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
824    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
825    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
826    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
827  ])
828  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
829  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
830  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
831  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
832  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
833  AC_SUBST([LIB]NAME)
834  AC_SUBST([LTLIB]NAME)
835  AC_SUBST([LIB]NAME[_PREFIX])
836  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
837  dnl results of this search when this library appears as a dependency.
838  HAVE_LIB[]NAME=yes
839  popdef([NAME])
840  popdef([Name])
841])
842
843dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
844dnl searches for libname and the libraries corresponding to explicit and
845dnl implicit dependencies, together with the specified include files and
846dnl the ability to compile and link the specified testcode. The missing-message
847dnl defaults to 'no' and may contain additional hints for the user.
848dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
849dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
850dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
851dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
852dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
853dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
854AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
855[
856  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
857  AC_REQUIRE([AC_LIB_RPATH])
858  pushdef([Name],[translit([$1],[./-], [___])])
859  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
860                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
861
862  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
863  dnl accordingly.
864  AC_LIB_LINKFLAGS_BODY([$1], [$2])
865
866  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
867  dnl because if the user has installed lib[]Name and not disabled its use
868  dnl via --without-lib[]Name-prefix, he wants to use it.
869  ac_save_CPPFLAGS="$CPPFLAGS"
870  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
871
872  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
873    ac_save_LIBS="$LIBS"
874    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
875    dnl because these -l options might require -L options that are present in
876    dnl LIBS. -l options benefit only from the -L options listed before it.
877    dnl Otherwise, add it to the front of LIBS, because it may be a static
878    dnl library that depends on another static library that is present in LIBS.
879    dnl Static libraries benefit only from the static libraries listed after
880    dnl it.
881    case " $LIB[]NAME" in
882      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
883      *)       LIBS="$LIB[]NAME $LIBS" ;;
884    esac
885    AC_TRY_LINK([$3], [$4],
886      [ac_cv_lib[]Name=yes],
887      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
888    LIBS="$ac_save_LIBS"
889  ])
890  if test "$ac_cv_lib[]Name" = yes; then
891    HAVE_LIB[]NAME=yes
892    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
893    AC_MSG_CHECKING([how to link with lib[]$1])
894    AC_MSG_RESULT([$LIB[]NAME])
895  else
896    HAVE_LIB[]NAME=no
897    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
898    dnl $INC[]NAME either.
899    CPPFLAGS="$ac_save_CPPFLAGS"
900    LIB[]NAME=
901    LTLIB[]NAME=
902    LIB[]NAME[]_PREFIX=
903  fi
904  AC_SUBST([HAVE_LIB]NAME)
905  AC_SUBST([LIB]NAME)
906  AC_SUBST([LTLIB]NAME)
907  AC_SUBST([LIB]NAME[_PREFIX])
908  popdef([NAME])
909  popdef([Name])
910])
911
912dnl Determine the platform dependent parameters needed to use rpath:
913dnl   acl_libext,
914dnl   acl_shlibext,
915dnl   acl_hardcode_libdir_flag_spec,
916dnl   acl_hardcode_libdir_separator,
917dnl   acl_hardcode_direct,
918dnl   acl_hardcode_minus_L.
919AC_DEFUN([AC_LIB_RPATH],
920[
921  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
922  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
923  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
924  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
925  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
926  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
927  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
928    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
929    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
930    . ./conftest.sh
931    rm -f ./conftest.sh
932    acl_cv_rpath=done
933  ])
934  wl="$acl_cv_wl"
935  acl_libext="$acl_cv_libext"
936  acl_shlibext="$acl_cv_shlibext"
937  acl_libname_spec="$acl_cv_libname_spec"
938  acl_library_names_spec="$acl_cv_library_names_spec"
939  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
940  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
941  acl_hardcode_direct="$acl_cv_hardcode_direct"
942  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
943  dnl Determine whether the user wants rpath handling at all.
944  AC_ARG_ENABLE([rpath],
945    [  --disable-rpath         do not hardcode runtime library paths],
946    :, enable_rpath=yes)
947])
948
949dnl AC_LIB_FROMPACKAGE(name, package)
950dnl declares that libname comes from the given package. The configure file
951dnl will then not have a --with-libname-prefix option but a
952dnl --with-package-prefix option. Several libraries can come from the same
953dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
954dnl macro call that searches for libname.
955AC_DEFUN([AC_LIB_FROMPACKAGE],
956[
957  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
958                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
959  define([acl_frompackage_]NAME, [$2])
960  popdef([NAME])
961  pushdef([PACK],[$2])
962  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
963                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
964  define([acl_libsinpackage_]PACKUP,
965    m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
966  popdef([PACKUP])
967  popdef([PACK])
968])
969
970dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
971dnl the libraries corresponding to explicit and implicit dependencies.
972dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
973dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
974dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
975AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
976[
977  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
978  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
979                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
980  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
981  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
982                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
983  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
984  dnl Autoconf >= 2.61 supports dots in --with options.
985  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
986  dnl By default, look in $includedir and $libdir.
987  use_additional=yes
988  AC_LIB_WITH_FINAL_PREFIX([
989    eval additional_includedir=\"$includedir\"
990    eval additional_libdir=\"$libdir\"
991  ])
992  AC_ARG_WITH(P_A_C_K[-prefix],
993[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
994  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
995[
996    if test "X$withval" = "Xno"; then
997      use_additional=no
998    else
999      if test "X$withval" = "X"; then
1000        AC_LIB_WITH_FINAL_PREFIX([
1001          eval additional_includedir=\"$includedir\"
1002          eval additional_libdir=\"$libdir\"
1003        ])
1004      else
1005        additional_includedir="$withval/include"
1006        additional_libdir="$withval/$acl_libdirstem"
1007        if test "$acl_libdirstem2" != "$acl_libdirstem" \
1008           && ! test -d "$withval/$acl_libdirstem"; then
1009          additional_libdir="$withval/$acl_libdirstem2"
1010        fi
1011      fi
1012    fi
1013])
1014  dnl Search the library and its dependencies in $additional_libdir and
1015  dnl $LDFLAGS. Using breadth-first-seach.
1016  LIB[]NAME=
1017  LTLIB[]NAME=
1018  INC[]NAME=
1019  LIB[]NAME[]_PREFIX=
1020  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
1021  dnl computed. So it has to be reset here.
1022  HAVE_LIB[]NAME=
1023  rpathdirs=
1024  ltrpathdirs=
1025  names_already_handled=
1026  names_next_round='$1 $2'
1027  while test -n "$names_next_round"; do
1028    names_this_round="$names_next_round"
1029    names_next_round=
1030    for name in $names_this_round; do
1031      already_handled=
1032      for n in $names_already_handled; do
1033        if test "$n" = "$name"; then
1034          already_handled=yes
1035          break
1036        fi
1037      done
1038      if test -z "$already_handled"; then
1039        names_already_handled="$names_already_handled $name"
1040        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1041        dnl or AC_LIB_HAVE_LINKFLAGS call.
1042        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1043        eval value=\"\$HAVE_LIB$uppername\"
1044        if test -n "$value"; then
1045          if test "$value" = yes; then
1046            eval value=\"\$LIB$uppername\"
1047            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1048            eval value=\"\$LTLIB$uppername\"
1049            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1050          else
1051            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1052            dnl that this library doesn't exist. So just drop it.
1053            :
1054          fi
1055        else
1056          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1057          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1058          found_dir=
1059          found_la=
1060          found_so=
1061          found_a=
1062          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
1063          if test -n "$acl_shlibext"; then
1064            shrext=".$acl_shlibext"             # typically: shrext=.so
1065          else
1066            shrext=
1067          fi
1068          if test $use_additional = yes; then
1069            dir="$additional_libdir"
1070            dnl The same code as in the loop below:
1071            dnl First look for a shared library.
1072            if test -n "$acl_shlibext"; then
1073              if test -f "$dir/$libname$shrext"; then
1074                found_dir="$dir"
1075                found_so="$dir/$libname$shrext"
1076              else
1077                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1078                  ver=`(cd "$dir" && \
1079                        for f in "$libname$shrext".*; do echo "$f"; done \
1080                        | sed -e "s,^$libname$shrext\\\\.,," \
1081                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1082                        | sed 1q ) 2>/dev/null`
1083                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1084                    found_dir="$dir"
1085                    found_so="$dir/$libname$shrext.$ver"
1086                  fi
1087                else
1088                  eval library_names=\"$acl_library_names_spec\"
1089                  for f in $library_names; do
1090                    if test -f "$dir/$f"; then
1091                      found_dir="$dir"
1092                      found_so="$dir/$f"
1093                      break
1094                    fi
1095                  done
1096                fi
1097              fi
1098            fi
1099            dnl Then look for a static library.
1100            if test "X$found_dir" = "X"; then
1101              if test -f "$dir/$libname.$acl_libext"; then
1102                found_dir="$dir"
1103                found_a="$dir/$libname.$acl_libext"
1104              fi
1105            fi
1106            if test "X$found_dir" != "X"; then
1107              if test -f "$dir/$libname.la"; then
1108                found_la="$dir/$libname.la"
1109              fi
1110            fi
1111          fi
1112          if test "X$found_dir" = "X"; then
1113            for x in $LDFLAGS $LTLIB[]NAME; do
1114              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1115              case "$x" in
1116                -L*)
1117                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1118                  dnl First look for a shared library.
1119                  if test -n "$acl_shlibext"; then
1120                    if test -f "$dir/$libname$shrext"; then
1121                      found_dir="$dir"
1122                      found_so="$dir/$libname$shrext"
1123                    else
1124                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1125                        ver=`(cd "$dir" && \
1126                              for f in "$libname$shrext".*; do echo "$f"; done \
1127                              | sed -e "s,^$libname$shrext\\\\.,," \
1128                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1129                              | sed 1q ) 2>/dev/null`
1130                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1131                          found_dir="$dir"
1132                          found_so="$dir/$libname$shrext.$ver"
1133                        fi
1134                      else
1135                        eval library_names=\"$acl_library_names_spec\"
1136                        for f in $library_names; do
1137                          if test -f "$dir/$f"; then
1138                            found_dir="$dir"
1139                            found_so="$dir/$f"
1140                            break
1141                          fi
1142                        done
1143                      fi
1144                    fi
1145                  fi
1146                  dnl Then look for a static library.
1147                  if test "X$found_dir" = "X"; then
1148                    if test -f "$dir/$libname.$acl_libext"; then
1149                      found_dir="$dir"
1150                      found_a="$dir/$libname.$acl_libext"
1151                    fi
1152                  fi
1153                  if test "X$found_dir" != "X"; then
1154                    if test -f "$dir/$libname.la"; then
1155                      found_la="$dir/$libname.la"
1156                    fi
1157                  fi
1158                  ;;
1159              esac
1160              if test "X$found_dir" != "X"; then
1161                break
1162              fi
1163            done
1164          fi
1165          if test "X$found_dir" != "X"; then
1166            dnl Found the library.
1167            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1168            if test "X$found_so" != "X"; then
1169              dnl Linking with a shared library. We attempt to hardcode its
1170              dnl directory into the executable's runpath, unless it's the
1171              dnl standard /usr/lib.
1172              if test "$enable_rpath" = no \
1173                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
1174                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
1175                dnl No hardcoding is needed.
1176                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1177              else
1178                dnl Use an explicit option to hardcode DIR into the resulting
1179                dnl binary.
1180                dnl Potentially add DIR to ltrpathdirs.
1181                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1182                haveit=
1183                for x in $ltrpathdirs; do
1184                  if test "X$x" = "X$found_dir"; then
1185                    haveit=yes
1186                    break
1187                  fi
1188                done
1189                if test -z "$haveit"; then
1190                  ltrpathdirs="$ltrpathdirs $found_dir"
1191                fi
1192                dnl The hardcoding into $LIBNAME is system dependent.
1193                if test "$acl_hardcode_direct" = yes; then
1194                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1195                  dnl resulting binary.
1196                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1197                else
1198                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1199                    dnl Use an explicit option to hardcode DIR into the resulting
1200                    dnl binary.
1201                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1202                    dnl Potentially add DIR to rpathdirs.
1203                    dnl The rpathdirs will be appended to $LIBNAME at the end.
1204                    haveit=
1205                    for x in $rpathdirs; do
1206                      if test "X$x" = "X$found_dir"; then
1207                        haveit=yes
1208                        break
1209                      fi
1210                    done
1211                    if test -z "$haveit"; then
1212                      rpathdirs="$rpathdirs $found_dir"
1213                    fi
1214                  else
1215                    dnl Rely on "-L$found_dir".
1216                    dnl But don't add it if it's already contained in the LDFLAGS
1217                    dnl or the already constructed $LIBNAME
1218                    haveit=
1219                    for x in $LDFLAGS $LIB[]NAME; do
1220                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1221                      if test "X$x" = "X-L$found_dir"; then
1222                        haveit=yes
1223                        break
1224                      fi
1225                    done
1226                    if test -z "$haveit"; then
1227                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1228                    fi
1229                    if test "$acl_hardcode_minus_L" != no; then
1230                      dnl FIXME: Not sure whether we should use
1231                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1232                      dnl here.
1233                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1234                    else
1235                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
1236                      dnl here, because this doesn't fit in flags passed to the
1237                      dnl compiler. So give up. No hardcoding. This affects only
1238                      dnl very old systems.
1239                      dnl FIXME: Not sure whether we should use
1240                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1241                      dnl here.
1242                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1243                    fi
1244                  fi
1245                fi
1246              fi
1247            else
1248              if test "X$found_a" != "X"; then
1249                dnl Linking with a static library.
1250                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1251              else
1252                dnl We shouldn't come here, but anyway it's good to have a
1253                dnl fallback.
1254                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1255              fi
1256            fi
1257            dnl Assume the include files are nearby.
1258            additional_includedir=
1259            case "$found_dir" in
1260              */$acl_libdirstem | */$acl_libdirstem/)
1261                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
1262                if test "$name" = '$1'; then
1263                  LIB[]NAME[]_PREFIX="$basedir"
1264                fi
1265                additional_includedir="$basedir/include"
1266                ;;
1267              */$acl_libdirstem2 | */$acl_libdirstem2/)
1268                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
1269                if test "$name" = '$1'; then
1270                  LIB[]NAME[]_PREFIX="$basedir"
1271                fi
1272                additional_includedir="$basedir/include"
1273                ;;
1274            esac
1275            if test "X$additional_includedir" != "X"; then
1276              dnl Potentially add $additional_includedir to $INCNAME.
1277              dnl But don't add it
1278              dnl   1. if it's the standard /usr/include,
1279              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1280              dnl   3. if it's already present in $CPPFLAGS or the already
1281              dnl      constructed $INCNAME,
1282              dnl   4. if it doesn't exist as a directory.
1283              if test "X$additional_includedir" != "X/usr/include"; then
1284                haveit=
1285                if test "X$additional_includedir" = "X/usr/local/include"; then
1286                  if test -n "$GCC"; then
1287                    case $host_os in
1288                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1289                    esac
1290                  fi
1291                fi
1292                if test -z "$haveit"; then
1293                  for x in $CPPFLAGS $INC[]NAME; do
1294                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1295                    if test "X$x" = "X-I$additional_includedir"; then
1296                      haveit=yes
1297                      break
1298                    fi
1299                  done
1300                  if test -z "$haveit"; then
1301                    if test -d "$additional_includedir"; then
1302                      dnl Really add $additional_includedir to $INCNAME.
1303                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1304                    fi
1305                  fi
1306                fi
1307              fi
1308            fi
1309            dnl Look for dependencies.
1310            if test -n "$found_la"; then
1311              dnl Read the .la file. It defines the variables
1312              dnl dlname, library_names, old_library, dependency_libs, current,
1313              dnl age, revision, installed, dlopen, dlpreopen, libdir.
1314              save_libdir="$libdir"
1315              case "$found_la" in
1316                */* | *\\*) . "$found_la" ;;
1317                *) . "./$found_la" ;;
1318              esac
1319              libdir="$save_libdir"
1320              dnl We use only dependency_libs.
1321              for dep in $dependency_libs; do
1322                case "$dep" in
1323                  -L*)
1324                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1325                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1326                    dnl But don't add it
1327                    dnl   1. if it's the standard /usr/lib,
1328                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1329                    dnl   3. if it's already present in $LDFLAGS or the already
1330                    dnl      constructed $LIBNAME,
1331                    dnl   4. if it doesn't exist as a directory.
1332                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
1333                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
1334                      haveit=
1335                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
1336                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
1337                        if test -n "$GCC"; then
1338                          case $host_os in
1339                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1340                          esac
1341                        fi
1342                      fi
1343                      if test -z "$haveit"; then
1344                        haveit=
1345                        for x in $LDFLAGS $LIB[]NAME; do
1346                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1347                          if test "X$x" = "X-L$additional_libdir"; then
1348                            haveit=yes
1349                            break
1350                          fi
1351                        done
1352                        if test -z "$haveit"; then
1353                          if test -d "$additional_libdir"; then
1354                            dnl Really add $additional_libdir to $LIBNAME.
1355                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1356                          fi
1357                        fi
1358                        haveit=
1359                        for x in $LDFLAGS $LTLIB[]NAME; do
1360                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1361                          if test "X$x" = "X-L$additional_libdir"; then
1362                            haveit=yes
1363                            break
1364                          fi
1365                        done
1366                        if test -z "$haveit"; then
1367                          if test -d "$additional_libdir"; then
1368                            dnl Really add $additional_libdir to $LTLIBNAME.
1369                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1370                          fi
1371                        fi
1372                      fi
1373                    fi
1374                    ;;
1375                  -R*)
1376                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
1377                    if test "$enable_rpath" != no; then
1378                      dnl Potentially add DIR to rpathdirs.
1379                      dnl The rpathdirs will be appended to $LIBNAME at the end.
1380                      haveit=
1381                      for x in $rpathdirs; do
1382                        if test "X$x" = "X$dir"; then
1383                          haveit=yes
1384                          break
1385                        fi
1386                      done
1387                      if test -z "$haveit"; then
1388                        rpathdirs="$rpathdirs $dir"
1389                      fi
1390                      dnl Potentially add DIR to ltrpathdirs.
1391                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1392                      haveit=
1393                      for x in $ltrpathdirs; do
1394                        if test "X$x" = "X$dir"; then
1395                          haveit=yes
1396                          break
1397                        fi
1398                      done
1399                      if test -z "$haveit"; then
1400                        ltrpathdirs="$ltrpathdirs $dir"
1401                      fi
1402                    fi
1403                    ;;
1404                  -l*)
1405                    dnl Handle this in the next round.
1406                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1407                    ;;
1408                  *.la)
1409                    dnl Handle this in the next round. Throw away the .la's
1410                    dnl directory; it is already contained in a preceding -L
1411                    dnl option.
1412                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1413                    ;;
1414                  *)
1415                    dnl Most likely an immediate library name.
1416                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1417                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1418                    ;;
1419                esac
1420              done
1421            fi
1422          else
1423            dnl Didn't find the library; assume it is in the system directories
1424            dnl known to the linker and runtime loader. (All the system
1425            dnl directories known to the linker should also be known to the
1426            dnl runtime loader, otherwise the system is severely misconfigured.)
1427            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1428            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1429          fi
1430        fi
1431      fi
1432    done
1433  done
1434  if test "X$rpathdirs" != "X"; then
1435    if test -n "$acl_hardcode_libdir_separator"; then
1436      dnl Weird platform: only the last -rpath option counts, the user must
1437      dnl pass all path elements in one option. We can arrange that for a
1438      dnl single library, but not when more than one $LIBNAMEs are used.
1439      alldirs=
1440      for found_dir in $rpathdirs; do
1441        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
1442      done
1443      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
1444      acl_save_libdir="$libdir"
1445      libdir="$alldirs"
1446      eval flag=\"$acl_hardcode_libdir_flag_spec\"
1447      libdir="$acl_save_libdir"
1448      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1449    else
1450      dnl The -rpath options are cumulative.
1451      for found_dir in $rpathdirs; do
1452        acl_save_libdir="$libdir"
1453        libdir="$found_dir"
1454        eval flag=\"$acl_hardcode_libdir_flag_spec\"
1455        libdir="$acl_save_libdir"
1456        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1457      done
1458    fi
1459  fi
1460  if test "X$ltrpathdirs" != "X"; then
1461    dnl When using libtool, the option that works for both libraries and
1462    dnl executables is -R. The -R options are cumulative.
1463    for found_dir in $ltrpathdirs; do
1464      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1465    done
1466  fi
1467  popdef([P_A_C_K])
1468  popdef([PACKLIBS])
1469  popdef([PACKUP])
1470  popdef([PACK])
1471  popdef([NAME])
1472])
1473
1474dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1475dnl unless already present in VAR.
1476dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1477dnl contains two or three consecutive elements that belong together.
1478AC_DEFUN([AC_LIB_APPENDTOVAR],
1479[
1480  for element in [$2]; do
1481    haveit=
1482    for x in $[$1]; do
1483      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1484      if test "X$x" = "X$element"; then
1485        haveit=yes
1486        break
1487      fi
1488    done
1489    if test -z "$haveit"; then
1490      [$1]="${[$1]}${[$1]:+ }$element"
1491    fi
1492  done
1493])
1494
1495dnl For those cases where a variable contains several -L and -l options
1496dnl referring to unknown libraries and directories, this macro determines the
1497dnl necessary additional linker options for the runtime path.
1498dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
1499dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
1500dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
1501dnl otherwise linking without libtool is assumed.
1502AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
1503[
1504  AC_REQUIRE([AC_LIB_RPATH])
1505  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1506  $1=
1507  if test "$enable_rpath" != no; then
1508    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
1509      dnl Use an explicit option to hardcode directories into the resulting
1510      dnl binary.
1511      rpathdirs=
1512      next=
1513      for opt in $2; do
1514        if test -n "$next"; then
1515          dir="$next"
1516          dnl No need to hardcode the standard /usr/lib.
1517          if test "X$dir" != "X/usr/$acl_libdirstem" \
1518             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1519            rpathdirs="$rpathdirs $dir"
1520          fi
1521          next=
1522        else
1523          case $opt in
1524            -L) next=yes ;;
1525            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
1526                 dnl No need to hardcode the standard /usr/lib.
1527                 if test "X$dir" != "X/usr/$acl_libdirstem" \
1528                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
1529                   rpathdirs="$rpathdirs $dir"
1530                 fi
1531                 next= ;;
1532            *) next= ;;
1533          esac
1534        fi
1535      done
1536      if test "X$rpathdirs" != "X"; then
1537        if test -n ""$3""; then
1538          dnl libtool is used for linking. Use -R options.
1539          for dir in $rpathdirs; do
1540            $1="${$1}${$1:+ }-R$dir"
1541          done
1542        else
1543          dnl The linker is used for linking directly.
1544          if test -n "$acl_hardcode_libdir_separator"; then
1545            dnl Weird platform: only the last -rpath option counts, the user
1546            dnl must pass all path elements in one option.
1547            alldirs=
1548            for dir in $rpathdirs; do
1549              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
1550            done
1551            acl_save_libdir="$libdir"
1552            libdir="$alldirs"
1553            eval flag=\"$acl_hardcode_libdir_flag_spec\"
1554            libdir="$acl_save_libdir"
1555            $1="$flag"
1556          else
1557            dnl The -rpath options are cumulative.
1558            for dir in $rpathdirs; do
1559              acl_save_libdir="$libdir"
1560              libdir="$dir"
1561              eval flag=\"$acl_hardcode_libdir_flag_spec\"
1562              libdir="$acl_save_libdir"
1563              $1="${$1}${$1:+ }$flag"
1564            done
1565          fi
1566        fi
1567      fi
1568    fi
1569  fi
1570  AC_SUBST([$1])
1571])
1572
1573# lib-prefix.m4 serial 7 (gettext-0.18)
1574dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
1575dnl This file is free software; the Free Software Foundation
1576dnl gives unlimited permission to copy and/or distribute it,
1577dnl with or without modifications, as long as this notice is preserved.
1578
1579dnl From Bruno Haible.
1580
1581dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
1582dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
1583dnl require excessive bracketing.
1584ifdef([AC_HELP_STRING],
1585[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
1586[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
1587
1588dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1589dnl to access previously installed libraries. The basic assumption is that
1590dnl a user will want packages to use other packages he previously installed
1591dnl with the same --prefix option.
1592dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1593dnl libraries, but is otherwise very convenient.
1594AC_DEFUN([AC_LIB_PREFIX],
1595[
1596  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1597  AC_REQUIRE([AC_PROG_CC])
1598  AC_REQUIRE([AC_CANONICAL_HOST])
1599  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1600  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1601  dnl By default, look in $includedir and $libdir.
1602  use_additional=yes
1603  AC_LIB_WITH_FINAL_PREFIX([
1604    eval additional_includedir=\"$includedir\"
1605    eval additional_libdir=\"$libdir\"
1606  ])
1607  AC_LIB_ARG_WITH([lib-prefix],
1608[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1609  --without-lib-prefix    don't search for libraries in includedir and libdir],
1610[
1611    if test "X$withval" = "Xno"; then
1612      use_additional=no
1613    else
1614      if test "X$withval" = "X"; then
1615        AC_LIB_WITH_FINAL_PREFIX([
1616          eval additional_includedir=\"$includedir\"
1617          eval additional_libdir=\"$libdir\"
1618        ])
1619      else
1620        additional_includedir="$withval/include"
1621        additional_libdir="$withval/$acl_libdirstem"
1622      fi
1623    fi
1624])
1625  if test $use_additional = yes; then
1626    dnl Potentially add $additional_includedir to $CPPFLAGS.
1627    dnl But don't add it
1628    dnl   1. if it's the standard /usr/include,
1629    dnl   2. if it's already present in $CPPFLAGS,
1630    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1631    dnl   4. if it doesn't exist as a directory.
1632    if test "X$additional_includedir" != "X/usr/include"; then
1633      haveit=
1634      for x in $CPPFLAGS; do
1635        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1636        if test "X$x" = "X-I$additional_includedir"; then
1637          haveit=yes
1638          break
1639        fi
1640      done
1641      if test -z "$haveit"; then
1642        if test "X$additional_includedir" = "X/usr/local/include"; then
1643          if test -n "$GCC"; then
1644            case $host_os in
1645              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
1646            esac
1647          fi
1648        fi
1649        if test -z "$haveit"; then
1650          if test -d "$additional_includedir"; then
1651            dnl Really add $additional_includedir to $CPPFLAGS.
1652            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1653          fi
1654        fi
1655      fi
1656    fi
1657    dnl Potentially add $additional_libdir to $LDFLAGS.
1658    dnl But don't add it
1659    dnl   1. if it's the standard /usr/lib,
1660    dnl   2. if it's already present in $LDFLAGS,
1661    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1662    dnl   4. if it doesn't exist as a directory.
1663    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
1664      haveit=
1665      for x in $LDFLAGS; do
1666        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1667        if test "X$x" = "X-L$additional_libdir"; then
1668          haveit=yes
1669          break
1670        fi
1671      done
1672      if test -z "$haveit"; then
1673        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
1674          if test -n "$GCC"; then
1675            case $host_os in
1676              linux*) haveit=yes;;
1677            esac
1678          fi
1679        fi
1680        if test -z "$haveit"; then
1681          if test -d "$additional_libdir"; then
1682            dnl Really add $additional_libdir to $LDFLAGS.
1683            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1684          fi
1685        fi
1686      fi
1687    fi
1688  fi
1689])
1690
1691dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1692dnl acl_final_exec_prefix, containing the values to which $prefix and
1693dnl $exec_prefix will expand at the end of the configure script.
1694AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1695[
1696  dnl Unfortunately, prefix and exec_prefix get only finally determined
1697  dnl at the end of configure.
1698  if test "X$prefix" = "XNONE"; then
1699    acl_final_prefix="$ac_default_prefix"
1700  else
1701    acl_final_prefix="$prefix"
1702  fi
1703  if test "X$exec_prefix" = "XNONE"; then
1704    acl_final_exec_prefix='${prefix}'
1705  else
1706    acl_final_exec_prefix="$exec_prefix"
1707  fi
1708  acl_save_prefix="$prefix"
1709  prefix="$acl_final_prefix"
1710  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1711  prefix="$acl_save_prefix"
1712])
1713
1714dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1715dnl variables prefix and exec_prefix bound to the values they will have
1716dnl at the end of the configure script.
1717AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1718[
1719  acl_save_prefix="$prefix"
1720  prefix="$acl_final_prefix"
1721  acl_save_exec_prefix="$exec_prefix"
1722  exec_prefix="$acl_final_exec_prefix"
1723  $1
1724  exec_prefix="$acl_save_exec_prefix"
1725  prefix="$acl_save_prefix"
1726])
1727
1728dnl AC_LIB_PREPARE_MULTILIB creates
1729dnl - a variable acl_libdirstem, containing the basename of the libdir, either
1730dnl   "lib" or "lib64" or "lib/64",
1731dnl - a variable acl_libdirstem2, as a secondary possible value for
1732dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
1733dnl   "lib/amd64".
1734AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
1735[
1736  dnl There is no formal standard regarding lib and lib64.
1737  dnl On glibc systems, the current practice is that on a system supporting
1738  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1739  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
1740  dnl the compiler's default mode by looking at the compiler's library search
1741  dnl path. If at least one of its elements ends in /lib64 or points to a
1742  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
1743  dnl Otherwise we use the default, namely "lib".
1744  dnl On Solaris systems, the current practice is that on a system supporting
1745  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
1746  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
1747  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
1748  AC_REQUIRE([AC_CANONICAL_HOST])
1749  acl_libdirstem=lib
1750  acl_libdirstem2=
1751  case "$host_os" in
1752    solaris*)
1753      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
1754      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
1755      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
1756      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
1757      dnl symlink is missing, so we set acl_libdirstem2 too.
1758      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
1759        [AC_EGREP_CPP([sixtyfour bits], [
1760#ifdef _LP64
1761sixtyfour bits
1762#endif
1763           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
1764        ])
1765      if test $gl_cv_solaris_64bit = yes; then
1766        acl_libdirstem=lib/64
1767        case "$host_cpu" in
1768          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
1769          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
1770        esac
1771      fi
1772      ;;
1773    *)
1774      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
1775      if test -n "$searchpath"; then
1776        acl_save_IFS="${IFS= 	}"; IFS=":"
1777        for searchdir in $searchpath; do
1778          if test -d "$searchdir"; then
1779            case "$searchdir" in
1780              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
1781              */../ | */.. )
1782                # Better ignore directories of this form. They are misleading.
1783                ;;
1784              *) searchdir=`cd "$searchdir" && pwd`
1785                 case "$searchdir" in
1786                   */lib64 ) acl_libdirstem=lib64 ;;
1787                 esac ;;
1788            esac
1789          fi
1790        done
1791        IFS="$acl_save_IFS"
1792      fi
1793      ;;
1794  esac
1795  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
1796])
1797
1798# nls.m4 serial 5 (gettext-0.18)
1799dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
1800dnl Inc.
1801dnl This file is free software; the Free Software Foundation
1802dnl gives unlimited permission to copy and/or distribute it,
1803dnl with or without modifications, as long as this notice is preserved.
1804dnl
1805dnl This file can can be used in projects which are not available under
1806dnl the GNU General Public License or the GNU Library General Public
1807dnl License but which still want to provide support for the GNU gettext
1808dnl functionality.
1809dnl Please note that the actual code of the GNU gettext library is covered
1810dnl by the GNU Library General Public License, and the rest of the GNU
1811dnl gettext package package is covered by the GNU General Public License.
1812dnl They are *not* in the public domain.
1813
1814dnl Authors:
1815dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1816dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1817
1818AC_PREREQ([2.50])
1819
1820AC_DEFUN([AM_NLS],
1821[
1822  AC_MSG_CHECKING([whether NLS is requested])
1823  dnl Default is enabled NLS
1824  AC_ARG_ENABLE([nls],
1825    [  --disable-nls           do not use Native Language Support],
1826    USE_NLS=$enableval, USE_NLS=yes)
1827  AC_MSG_RESULT([$USE_NLS])
1828  AC_SUBST([USE_NLS])
1829])
1830
1831# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1832# serial 1 (pkg-config-0.24)
1833#
1834# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1835#
1836# This program is free software; you can redistribute it and/or modify
1837# it under the terms of the GNU General Public License as published by
1838# the Free Software Foundation; either version 2 of the License, or
1839# (at your option) any later version.
1840#
1841# This program is distributed in the hope that it will be useful, but
1842# WITHOUT ANY WARRANTY; without even the implied warranty of
1843# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1844# General Public License for more details.
1845#
1846# You should have received a copy of the GNU General Public License
1847# along with this program; if not, write to the Free Software
1848# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1849#
1850# As a special exception to the GNU General Public License, if you
1851# distribute this file as part of a program that contains a
1852# configuration script generated by Autoconf, you may include it under
1853# the same distribution terms that you use for the rest of that program.
1854
1855# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1856# ----------------------------------
1857AC_DEFUN([PKG_PROG_PKG_CONFIG],
1858[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1859m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1860AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1861AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1862AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1863
1864if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1865	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1866fi
1867if test -n "$PKG_CONFIG"; then
1868	_pkg_min_version=m4_default([$1], [0.9.0])
1869	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1870	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1871		AC_MSG_RESULT([yes])
1872	else
1873		AC_MSG_RESULT([no])
1874		PKG_CONFIG=""
1875	fi
1876fi[]dnl
1877])# PKG_PROG_PKG_CONFIG
1878
1879# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1880#
1881# Check to see whether a particular set of modules exists.  Similar
1882# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1883#
1884# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1885# only at the first occurence in configure.ac, so if the first place
1886# it's called might be skipped (such as if it is within an "if", you
1887# have to call PKG_CHECK_EXISTS manually
1888# --------------------------------------------------------------
1889AC_DEFUN([PKG_CHECK_EXISTS],
1890[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1891if test -n "$PKG_CONFIG" && \
1892    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1893  m4_default([$2], [:])
1894m4_ifvaln([$3], [else
1895  $3])dnl
1896fi])
1897
1898# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1899# ---------------------------------------------
1900m4_define([_PKG_CONFIG],
1901[if test -n "$$1"; then
1902    pkg_cv_[]$1="$$1"
1903 elif test -n "$PKG_CONFIG"; then
1904    PKG_CHECK_EXISTS([$3],
1905                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1906		     [pkg_failed=yes])
1907 else
1908    pkg_failed=untried
1909fi[]dnl
1910])# _PKG_CONFIG
1911
1912# _PKG_SHORT_ERRORS_SUPPORTED
1913# -----------------------------
1914AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1915[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1916if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1917        _pkg_short_errors_supported=yes
1918else
1919        _pkg_short_errors_supported=no
1920fi[]dnl
1921])# _PKG_SHORT_ERRORS_SUPPORTED
1922
1923
1924# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1925# [ACTION-IF-NOT-FOUND])
1926#
1927#
1928# Note that if there is a possibility the first call to
1929# PKG_CHECK_MODULES might not happen, you should be sure to include an
1930# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1931#
1932#
1933# --------------------------------------------------------------
1934AC_DEFUN([PKG_CHECK_MODULES],
1935[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1936AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1937AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1938
1939pkg_failed=no
1940AC_MSG_CHECKING([for $1])
1941
1942_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1943_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1944
1945m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1946and $1[]_LIBS to avoid the need to call pkg-config.
1947See the pkg-config man page for more details.])
1948
1949if test $pkg_failed = yes; then
1950   	AC_MSG_RESULT([no])
1951        _PKG_SHORT_ERRORS_SUPPORTED
1952        if test $_pkg_short_errors_supported = yes; then
1953	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1954        else
1955	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1956        fi
1957	# Put the nasty error message in config.log where it belongs
1958	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1959
1960	m4_default([$4], [AC_MSG_ERROR(
1961[Package requirements ($2) were not met:
1962
1963$$1_PKG_ERRORS
1964
1965Consider adjusting the PKG_CONFIG_PATH environment variable if you
1966installed software in a non-standard prefix.
1967
1968_PKG_TEXT])[]dnl
1969        ])
1970elif test $pkg_failed = untried; then
1971     	AC_MSG_RESULT([no])
1972	m4_default([$4], [AC_MSG_FAILURE(
1973[The pkg-config script could not be found or is too old.  Make sure it
1974is in your PATH or set the PKG_CONFIG environment variable to the full
1975path to pkg-config.
1976
1977_PKG_TEXT
1978
1979To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1980        ])
1981else
1982	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1983	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1984        AC_MSG_RESULT([yes])
1985	$3
1986fi[]dnl
1987])# PKG_CHECK_MODULES
1988
1989# po.m4 serial 17 (gettext-0.18)
1990dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
1991dnl This file is free software; the Free Software Foundation
1992dnl gives unlimited permission to copy and/or distribute it,
1993dnl with or without modifications, as long as this notice is preserved.
1994dnl
1995dnl This file can can be used in projects which are not available under
1996dnl the GNU General Public License or the GNU Library General Public
1997dnl License but which still want to provide support for the GNU gettext
1998dnl functionality.
1999dnl Please note that the actual code of the GNU gettext library is covered
2000dnl by the GNU Library General Public License, and the rest of the GNU
2001dnl gettext package package is covered by the GNU General Public License.
2002dnl They are *not* in the public domain.
2003
2004dnl Authors:
2005dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2006dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2007
2008AC_PREREQ([2.50])
2009
2010dnl Checks for all prerequisites of the po subdirectory.
2011AC_DEFUN([AM_PO_SUBDIRS],
2012[
2013  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2014  AC_REQUIRE([AC_PROG_INSTALL])dnl
2015  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
2016  AC_REQUIRE([AM_NLS])dnl
2017
2018  dnl Release version of the gettext macros. This is used to ensure that
2019  dnl the gettext macros and po/Makefile.in.in are in sync.
2020  AC_SUBST([GETTEXT_MACRO_VERSION], [0.18])
2021
2022  dnl Perform the following tests also if --disable-nls has been given,
2023  dnl because they are needed for "make dist" to work.
2024
2025  dnl Search for GNU msgfmt in the PATH.
2026  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
2027  dnl The second test excludes FreeBSD msgfmt.
2028  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2029    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
2030     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
2031    :)
2032  AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
2033
2034  dnl Test whether it is GNU msgfmt >= 0.15.
2035changequote(,)dnl
2036  case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
2037    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
2038    *) MSGFMT_015=$MSGFMT ;;
2039  esac
2040changequote([,])dnl
2041  AC_SUBST([MSGFMT_015])
2042changequote(,)dnl
2043  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
2044    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
2045    *) GMSGFMT_015=$GMSGFMT ;;
2046  esac
2047changequote([,])dnl
2048  AC_SUBST([GMSGFMT_015])
2049
2050  dnl Search for GNU xgettext 0.12 or newer in the PATH.
2051  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
2052  dnl The second test excludes FreeBSD xgettext.
2053  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2054    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
2055     (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)],
2056    :)
2057  dnl Remove leftover from FreeBSD xgettext call.
2058  rm -f messages.po
2059
2060  dnl Test whether it is GNU xgettext >= 0.15.
2061changequote(,)dnl
2062  case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
2063    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
2064    *) XGETTEXT_015=$XGETTEXT ;;
2065  esac
2066changequote([,])dnl
2067  AC_SUBST([XGETTEXT_015])
2068
2069  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
2070  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
2071    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
2072
2073  dnl Installation directories.
2074  dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
2075  dnl have to define it here, so that it can be used in po/Makefile.
2076  test -n "$localedir" || localedir='${datadir}/locale'
2077  AC_SUBST([localedir])
2078
2079  dnl Support for AM_XGETTEXT_OPTION.
2080  test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
2081  AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
2082
2083  AC_CONFIG_COMMANDS([po-directories], [[
2084    for ac_file in $CONFIG_FILES; do
2085      # Support "outfile[:infile[:infile...]]"
2086      case "$ac_file" in
2087        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
2088      esac
2089      # PO directories have a Makefile.in generated from Makefile.in.in.
2090      case "$ac_file" in */Makefile.in)
2091        # Adjust a relative srcdir.
2092        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2093        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2094        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2095        # In autoconf-2.13 it is called $ac_given_srcdir.
2096        # In autoconf-2.50 it is called $srcdir.
2097        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2098        case "$ac_given_srcdir" in
2099          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2100          /*) top_srcdir="$ac_given_srcdir" ;;
2101          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2102        esac
2103        # Treat a directory as a PO directory if and only if it has a
2104        # POTFILES.in file. This allows packages to have multiple PO
2105        # directories under different names or in different locations.
2106        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
2107          rm -f "$ac_dir/POTFILES"
2108          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
2109          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
2110          POMAKEFILEDEPS="POTFILES.in"
2111          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
2112          # on $ac_dir but don't depend on user-specified configuration
2113          # parameters.
2114          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2115            # The LINGUAS file contains the set of available languages.
2116            if test -n "$OBSOLETE_ALL_LINGUAS"; then
2117              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2118            fi
2119            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2120            # Hide the ALL_LINGUAS assigment from automake < 1.5.
2121            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2122            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2123          else
2124            # The set of available languages was given in configure.in.
2125            # Hide the ALL_LINGUAS assigment from automake < 1.5.
2126            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
2127          fi
2128          # Compute POFILES
2129          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2130          # Compute UPDATEPOFILES
2131          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2132          # Compute DUMMYPOFILES
2133          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2134          # Compute GMOFILES
2135          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2136          case "$ac_given_srcdir" in
2137            .) srcdirpre= ;;
2138            *) srcdirpre='$(srcdir)/' ;;
2139          esac
2140          POFILES=
2141          UPDATEPOFILES=
2142          DUMMYPOFILES=
2143          GMOFILES=
2144          for lang in $ALL_LINGUAS; do
2145            POFILES="$POFILES $srcdirpre$lang.po"
2146            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2147            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2148            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2149          done
2150          # CATALOGS depends on both $ac_dir and the user's LINGUAS
2151          # environment variable.
2152          INST_LINGUAS=
2153          if test -n "$ALL_LINGUAS"; then
2154            for presentlang in $ALL_LINGUAS; do
2155              useit=no
2156              if test "%UNSET%" != "$LINGUAS"; then
2157                desiredlanguages="$LINGUAS"
2158              else
2159                desiredlanguages="$ALL_LINGUAS"
2160              fi
2161              for desiredlang in $desiredlanguages; do
2162                # Use the presentlang catalog if desiredlang is
2163                #   a. equal to presentlang, or
2164                #   b. a variant of presentlang (because in this case,
2165                #      presentlang can be used as a fallback for messages
2166                #      which are not translated in the desiredlang catalog).
2167                case "$desiredlang" in
2168                  "$presentlang"*) useit=yes;;
2169                esac
2170              done
2171              if test $useit = yes; then
2172                INST_LINGUAS="$INST_LINGUAS $presentlang"
2173              fi
2174            done
2175          fi
2176          CATALOGS=
2177          if test -n "$INST_LINGUAS"; then
2178            for lang in $INST_LINGUAS; do
2179              CATALOGS="$CATALOGS $lang.gmo"
2180            done
2181          fi
2182          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
2183          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"
2184          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
2185            if test -f "$f"; then
2186              case "$f" in
2187                *.orig | *.bak | *~) ;;
2188                *) cat "$f" >> "$ac_dir/Makefile" ;;
2189              esac
2190            fi
2191          done
2192        fi
2193        ;;
2194      esac
2195    done]],
2196   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
2197    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
2198    # from automake < 1.5.
2199    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
2200    # Capture the value of LINGUAS because we need it to compute CATALOGS.
2201    LINGUAS="${LINGUAS-%UNSET%}"
2202   ])
2203])
2204
2205dnl Postprocesses a Makefile in a directory containing PO files.
2206AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
2207[
2208  # When this code is run, in config.status, two variables have already been
2209  # set:
2210  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
2211  # - LINGUAS is the value of the environment variable LINGUAS at configure
2212  #   time.
2213
2214changequote(,)dnl
2215  # Adjust a relative srcdir.
2216  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2217  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2218  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2219  # In autoconf-2.13 it is called $ac_given_srcdir.
2220  # In autoconf-2.50 it is called $srcdir.
2221  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2222  case "$ac_given_srcdir" in
2223    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2224    /*) top_srcdir="$ac_given_srcdir" ;;
2225    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2226  esac
2227
2228  # Find a way to echo strings without interpreting backslash.
2229  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
2230    gt_echo='echo'
2231  else
2232    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
2233      gt_echo='printf %s\n'
2234    else
2235      echo_func () {
2236        cat <<EOT
2237$*
2238EOT
2239      }
2240      gt_echo='echo_func'
2241    fi
2242  fi
2243
2244  # A sed script that extracts the value of VARIABLE from a Makefile.
2245  sed_x_variable='
2246# Test if the hold space is empty.
2247x
2248s/P/P/
2249x
2250ta
2251# Yes it was empty. Look if we have the expected variable definition.
2252/^[	 ]*VARIABLE[	 ]*=/{
2253  # Seen the first line of the variable definition.
2254  s/^[	 ]*VARIABLE[	 ]*=//
2255  ba
2256}
2257bd
2258:a
2259# Here we are processing a line from the variable definition.
2260# Remove comment, more precisely replace it with a space.
2261s/#.*$/ /
2262# See if the line ends in a backslash.
2263tb
2264:b
2265s/\\$//
2266# Print the line, without the trailing backslash.
2267p
2268tc
2269# There was no trailing backslash. The end of the variable definition is
2270# reached. Clear the hold space.
2271s/^.*$//
2272x
2273bd
2274:c
2275# A trailing backslash means that the variable definition continues in the
2276# next line. Put a nonempty string into the hold space to indicate this.
2277s/^.*$/P/
2278x
2279:d
2280'
2281changequote([,])dnl
2282
2283  # Set POTFILES to the value of the Makefile variable POTFILES.
2284  sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
2285  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
2286  # Compute POTFILES_DEPS as
2287  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
2288  POTFILES_DEPS=
2289  for file in $POTFILES; do
2290    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
2291  done
2292  POMAKEFILEDEPS=""
2293
2294  if test -n "$OBSOLETE_ALL_LINGUAS"; then
2295    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2296  fi
2297  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2298    # The LINGUAS file contains the set of available languages.
2299    ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2300    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2301  else
2302    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
2303    sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
2304    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
2305  fi
2306  # Hide the ALL_LINGUAS assigment from automake < 1.5.
2307  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2308  # Compute POFILES
2309  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2310  # Compute UPDATEPOFILES
2311  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2312  # Compute DUMMYPOFILES
2313  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2314  # Compute GMOFILES
2315  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2316  # Compute PROPERTIESFILES
2317  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
2318  # Compute CLASSFILES
2319  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
2320  # Compute QMFILES
2321  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
2322  # Compute MSGFILES
2323  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
2324  # Compute RESOURCESDLLFILES
2325  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
2326  case "$ac_given_srcdir" in
2327    .) srcdirpre= ;;
2328    *) srcdirpre='$(srcdir)/' ;;
2329  esac
2330  POFILES=
2331  UPDATEPOFILES=
2332  DUMMYPOFILES=
2333  GMOFILES=
2334  PROPERTIESFILES=
2335  CLASSFILES=
2336  QMFILES=
2337  MSGFILES=
2338  RESOURCESDLLFILES=
2339  for lang in $ALL_LINGUAS; do
2340    POFILES="$POFILES $srcdirpre$lang.po"
2341    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2342    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2343    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2344    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
2345    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
2346    QMFILES="$QMFILES $srcdirpre$lang.qm"
2347    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2348    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
2349    frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2350    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
2351  done
2352  # CATALOGS depends on both $ac_dir and the user's LINGUAS
2353  # environment variable.
2354  INST_LINGUAS=
2355  if test -n "$ALL_LINGUAS"; then
2356    for presentlang in $ALL_LINGUAS; do
2357      useit=no
2358      if test "%UNSET%" != "$LINGUAS"; then
2359        desiredlanguages="$LINGUAS"
2360      else
2361        desiredlanguages="$ALL_LINGUAS"
2362      fi
2363      for desiredlang in $desiredlanguages; do
2364        # Use the presentlang catalog if desiredlang is
2365        #   a. equal to presentlang, or
2366        #   b. a variant of presentlang (because in this case,
2367        #      presentlang can be used as a fallback for messages
2368        #      which are not translated in the desiredlang catalog).
2369        case "$desiredlang" in
2370          "$presentlang"*) useit=yes;;
2371        esac
2372      done
2373      if test $useit = yes; then
2374        INST_LINGUAS="$INST_LINGUAS $presentlang"
2375      fi
2376    done
2377  fi
2378  CATALOGS=
2379  JAVACATALOGS=
2380  QTCATALOGS=
2381  TCLCATALOGS=
2382  CSHARPCATALOGS=
2383  if test -n "$INST_LINGUAS"; then
2384    for lang in $INST_LINGUAS; do
2385      CATALOGS="$CATALOGS $lang.gmo"
2386      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
2387      QTCATALOGS="$QTCATALOGS $lang.qm"
2388      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2389      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
2390      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2391      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
2392    done
2393  fi
2394
2395  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"
2396  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
2397    # Add dependencies that cannot be formulated as a simple suffix rule.
2398    for lang in $ALL_LINGUAS; do
2399      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2400      cat >> "$ac_file.tmp" <<EOF
2401$frobbedlang.msg: $lang.po
2402	@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
2403	\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2404EOF
2405    done
2406  fi
2407  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
2408    # Add dependencies that cannot be formulated as a simple suffix rule.
2409    for lang in $ALL_LINGUAS; do
2410      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
2411      cat >> "$ac_file.tmp" <<EOF
2412$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
2413	@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
2414	\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2415EOF
2416    done
2417  fi
2418  if test -n "$POMAKEFILEDEPS"; then
2419    cat >> "$ac_file.tmp" <<EOF
2420Makefile: $POMAKEFILEDEPS
2421EOF
2422  fi
2423  mv "$ac_file.tmp" "$ac_file"
2424])
2425
2426dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
2427AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
2428[
2429  XGETTEXT_EXTRA_OPTIONS=
2430])
2431
2432dnl Registers an option to be passed to xgettext in the po subdirectory.
2433AC_DEFUN([AM_XGETTEXT_OPTION],
2434[
2435  AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
2436  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
2437])
2438
2439# progtest.m4 serial 6 (gettext-0.18)
2440dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc.
2441dnl This file is free software; the Free Software Foundation
2442dnl gives unlimited permission to copy and/or distribute it,
2443dnl with or without modifications, as long as this notice is preserved.
2444dnl
2445dnl This file can can be used in projects which are not available under
2446dnl the GNU General Public License or the GNU Library General Public
2447dnl License but which still want to provide support for the GNU gettext
2448dnl functionality.
2449dnl Please note that the actual code of the GNU gettext library is covered
2450dnl by the GNU Library General Public License, and the rest of the GNU
2451dnl gettext package package is covered by the GNU General Public License.
2452dnl They are *not* in the public domain.
2453
2454dnl Authors:
2455dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2456
2457AC_PREREQ([2.50])
2458
2459# Search path for a program which passes the given test.
2460
2461dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2462dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2463AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2464[
2465# Prepare PATH_SEPARATOR.
2466# The user is always right.
2467if test "${PATH_SEPARATOR+set}" != set; then
2468  echo "#! /bin/sh" >conf$$.sh
2469  echo  "exit 0"   >>conf$$.sh
2470  chmod +x conf$$.sh
2471  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2472    PATH_SEPARATOR=';'
2473  else
2474    PATH_SEPARATOR=:
2475  fi
2476  rm -f conf$$.sh
2477fi
2478
2479# Find out how to test for executable files. Don't use a zero-byte file,
2480# as systems may use methods other than mode bits to determine executability.
2481cat >conf$$.file <<_ASEOF
2482#! /bin/sh
2483exit 0
2484_ASEOF
2485chmod +x conf$$.file
2486if test -x conf$$.file >/dev/null 2>&1; then
2487  ac_executable_p="test -x"
2488else
2489  ac_executable_p="test -f"
2490fi
2491rm -f conf$$.file
2492
2493# Extract the first word of "$2", so it can be a program name with args.
2494set dummy $2; ac_word=[$]2
2495AC_MSG_CHECKING([for $ac_word])
2496AC_CACHE_VAL([ac_cv_path_$1],
2497[case "[$]$1" in
2498  [[\\/]]* | ?:[[\\/]]*)
2499    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2500    ;;
2501  *)
2502    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
2503    for ac_dir in ifelse([$5], , $PATH, [$5]); do
2504      IFS="$ac_save_IFS"
2505      test -z "$ac_dir" && ac_dir=.
2506      for ac_exec_ext in '' $ac_executable_extensions; do
2507        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
2508          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
2509          if [$3]; then
2510            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
2511            break 2
2512          fi
2513        fi
2514      done
2515    done
2516    IFS="$ac_save_IFS"
2517dnl If no 4th arg is given, leave the cache variable unset,
2518dnl so AC_PATH_PROGS will keep looking.
2519ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2520])dnl
2521    ;;
2522esac])dnl
2523$1="$ac_cv_path_$1"
2524if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2525  AC_MSG_RESULT([$][$1])
2526else
2527  AC_MSG_RESULT([no])
2528fi
2529AC_SUBST([$1])dnl
2530])
2531
2532# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
2533#
2534# This file is free software; the Free Software Foundation
2535# gives unlimited permission to copy and/or distribute it,
2536# with or without modifications, as long as this notice is preserved.
2537
2538# AM_PROG_MKDIR_P
2539# ---------------
2540# Check for `mkdir -p'.
2541AC_DEFUN([AM_PROG_MKDIR_P],
2542[AC_PREREQ([2.60])dnl
2543AC_REQUIRE([AC_PROG_MKDIR_P])dnl
2544dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
2545dnl while keeping a definition of mkdir_p for backward compatibility.
2546dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
2547dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
2548dnl Makefile.ins that do not define MKDIR_P, so we do our own
2549dnl adjustment using top_builddir (which is defined more often than
2550dnl MKDIR_P).
2551AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
2552case $mkdir_p in
2553  [[\\/$]]* | ?:[[\\/]]*) ;;
2554  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
2555esac
2556])
2557
2558m4_include([acinclude.m4])
2559