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